diff --git a/frontend/proxy.conf.json b/frontend/proxy.conf.json index 4e6c6e197..9e99f4b27 100644 --- a/frontend/proxy.conf.json +++ b/frontend/proxy.conf.json @@ -8,11 +8,11 @@ "secure": false, "ws": true }, - "/api": { + "/api/": { "target": "http://localhost:50001/", "secure": false, "pathRewrite": { - "^/api": "" + "^/api/": "" } }, "/testnet/api/v1": { @@ -30,7 +30,7 @@ "^/testnet/api": "/api/v1/ws" } }, - "/testnet/api": { + "/testnet/api/": { "target": "http://localhost:50001/", "secure": false, "pathRewrite": { @@ -45,18 +45,18 @@ "^/liquid/api": "/api/v1/ws" } }, - "/liquid/api": { + "/liquid/api/": { "target": "http://localhost:50001/", "secure": false, "pathRewrite": { - "^/liquid/api": "" + "^/liquid/api/": "" } }, - "/bisq/api": { + "/bisq/api/": { "target": "http://localhost:8999/", "secure": false, "pathRewrite": { - "^/bisq/api": "/api/v1/bisq" + "^/bisq/api/": "/api/v1/bisq" } }, "/bisq/api/v1/ws": { @@ -64,7 +64,7 @@ "secure": false, "ws": true, "pathRewrite": { - "^/testnet/api": "/api/v1/ws" + "^/bisq/api": "/api/v1/ws" } } } \ No newline at end of file diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index 4daffcaa8..662a96179 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -14,6 +14,7 @@ import { AssetsComponent } from './assets/assets.component'; import { StatusViewComponent } from './components/status-view/status-view.component'; import { DashboardComponent } from './dashboard/dashboard.component'; import { LatestBlocksComponent } from './components/latest-blocks/latest-blocks.component'; +import { ApiDocsComponent } from './components/api-docs/api-docs.component'; const routes: Routes = [ { @@ -54,6 +55,10 @@ const routes: Routes = [ path: 'about', component: AboutComponent, }, + { + path: 'api', + component: ApiDocsComponent, + }, { path: 'address/:id', children: [], @@ -110,6 +115,10 @@ const routes: Routes = [ path: 'assets', component: AssetsComponent, }, + { + path: 'api', + component: ApiDocsComponent, + }, ], }, { @@ -168,6 +177,10 @@ const routes: Routes = [ children: [], component: AddressComponent }, + { + path: 'api', + component: ApiDocsComponent, + }, ], }, { diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.ts index 8482e8df1..9997ff97e 100644 --- a/frontend/src/app/app.module.ts +++ b/frontend/src/app/app.module.ts @@ -43,7 +43,8 @@ import { NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap'; import { FeesBoxComponent } from './components/fees-box/fees-box.component'; import { DashboardComponent } from './dashboard/dashboard.component'; import { FontAwesomeModule, FaIconLibrary } from '@fortawesome/angular-fontawesome'; -import { faChartArea, faCube, faCubes, faDatabase, faInfo, faInfoCircle, faList, faQuestion, faQuestionCircle, faSearch, faTachometerAlt, faThList, faTv } from '@fortawesome/free-solid-svg-icons'; +import { faChartArea, faCogs, faCubes, faDatabase, faInfoCircle, faList, faSearch, faTachometerAlt, faThList, faTv } from '@fortawesome/free-solid-svg-icons'; +import { ApiDocsComponent } from './components/api-docs/api-docs.component'; @NgModule({ declarations: [ @@ -76,6 +77,7 @@ import { faChartArea, faCube, faCubes, faDatabase, faInfo, faInfoCircle, faList, StatusViewComponent, FeesBoxComponent, DashboardComponent, + ApiDocsComponent, ], imports: [ BrowserModule, @@ -103,6 +105,7 @@ export class AppModule { library.addIcons(faTv); library.addIcons(faTachometerAlt); library.addIcons(faCubes); + library.addIcons(faCogs); library.addIcons(faThList); library.addIcons(faList); library.addIcons(faTachometerAlt); diff --git a/frontend/src/app/bisq/bisq.routing.module.ts b/frontend/src/app/bisq/bisq.routing.module.ts index da0c490c6..90bec63ce 100644 --- a/frontend/src/app/bisq/bisq.routing.module.ts +++ b/frontend/src/app/bisq/bisq.routing.module.ts @@ -8,6 +8,7 @@ import { BisqBlocksComponent } from './bisq-blocks/bisq-blocks.component'; import { BisqExplorerComponent } from './bisq-explorer/bisq-explorer.component'; import { BisqAddressComponent } from './bisq-address/bisq-address.component'; import { BisqStatsComponent } from './bisq-stats/bisq-stats.component'; +import { ApiDocsComponent } from '../components/api-docs/api-docs.component'; const routes: Routes = [ { @@ -43,6 +44,10 @@ const routes: Routes = [ path: 'about', component: AboutComponent, }, + { + path: 'api', + component: ApiDocsComponent, + }, { path: '**', redirectTo: '' diff --git a/frontend/src/app/components/about/about.component.html b/frontend/src/app/components/about/about.component.html index 5ebd35307..c31534ac8 100644 --- a/frontend/src/app/components/about/about.component.html +++ b/frontend/src/app/components/about/about.component.html @@ -56,7 +56,7 @@

-

GitHub

+

Open source

@@ -70,98 +70,10 @@ github.com/mempool/mempool -

- -
-

API

-
- - - -
-
Git commit: {{ gitCommit$ | async }}
-
- diff --git a/frontend/src/app/components/about/about.component.scss b/frontend/src/app/components/about/about.component.scss index 16713b38d..0bb662b1e 100644 --- a/frontend/src/app/components/about/about.component.scss +++ b/frontend/src/app/components/about/about.component.scss @@ -1,20 +1,3 @@ -.text-small { - font-size: 12px; -} - -.code { - background-color: #1d1f31; - font-family: Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New; -} - -tr { - white-space: inherit; -} - -.nowrap { - white-space: nowrap; -} - .qr-wrapper { background-color: #FFF; padding: 10px; @@ -28,3 +11,7 @@ tr { border-radius: 50%; cursor: pointer; } + +.text-small { + font-size: 12px; +} \ No newline at end of file diff --git a/frontend/src/app/components/about/about.component.ts b/frontend/src/app/components/about/about.component.ts index 3e9251811..8e85e472a 100644 --- a/frontend/src/app/components/about/about.component.ts +++ b/frontend/src/app/components/about/about.component.ts @@ -12,8 +12,6 @@ import { ApiService } from 'src/app/services/api.service'; styleUrls: ['./about.component.scss'], }) export class AboutComponent implements OnInit { - active = 1; - hostname = document.location.hostname; gitCommit$: Observable; donationForm: FormGroup; donationStatus = 1; @@ -32,12 +30,6 @@ export class AboutComponent implements OnInit { this.gitCommit$ = this.stateService.gitCommit$; this.seoService.setTitle('About'); this.websocketService.want(['blocks']); - if (this.stateService.network === 'bisq') { - this.active = 2; - } - if (document.location.port !== '') { - this.hostname = this.hostname + ':' + document.location.port; - } this.donationForm = this.formBuilder.group({ amount: [0.01], diff --git a/frontend/src/app/components/api-docs/api-docs.component.html b/frontend/src/app/components/api-docs/api-docs.component.html new file mode 100644 index 000000000..b268545db --- /dev/null +++ b/frontend/src/app/components/api-docs/api-docs.component.html @@ -0,0 +1,88 @@ +
+
+

API documentation

+
+ + + +
+ +
+ +
\ No newline at end of file diff --git a/frontend/src/app/components/api-docs/api-docs.component.scss b/frontend/src/app/components/api-docs/api-docs.component.scss new file mode 100644 index 000000000..5e208bcf8 --- /dev/null +++ b/frontend/src/app/components/api-docs/api-docs.component.scss @@ -0,0 +1,16 @@ +.text-small { + font-size: 12px; +} + +.code { + background-color: #1d1f31; + font-family: Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New; +} + +tr { + white-space: inherit; +} + +.nowrap { + white-space: nowrap; +} diff --git a/frontend/src/app/components/api-docs/api-docs.component.ts b/frontend/src/app/components/api-docs/api-docs.component.ts new file mode 100644 index 000000000..f6fcfe94f --- /dev/null +++ b/frontend/src/app/components/api-docs/api-docs.component.ts @@ -0,0 +1,26 @@ +import { Component, OnInit } from '@angular/core'; +import { StateService } from 'src/app/services/state.service'; + +@Component({ + selector: 'app-api-docs', + templateUrl: './api-docs.component.html', + styleUrls: ['./api-docs.component.scss'] +}) +export class ApiDocsComponent implements OnInit { + hostname = document.location.hostname; + active = 1; + + constructor( + private stateService: StateService, + ) { } + + ngOnInit(): void { + if (this.stateService.network === 'bisq') { + this.active = 2; + } + if (document.location.port !== '') { + this.hostname = this.hostname + ':' + document.location.port; + } + } + +} diff --git a/frontend/src/app/components/master-page/master-page.component.html b/frontend/src/app/components/master-page/master-page.component.html index bb4d32ac9..6aa8d4291 100644 --- a/frontend/src/app/components/master-page/master-page.component.html +++ b/frontend/src/app/components/master-page/master-page.component.html @@ -55,6 +55,9 @@ +