mirror of
https://github.com/Eugeny/tabby-web.git
synced 2026-08-18 15:26:04 +01:00
wip
This commit is contained in:
@@ -159,8 +159,8 @@ export class AppConnectorService {
|
||||
return this.version.version
|
||||
}
|
||||
|
||||
async getDistURL (): Promise<string> {
|
||||
return await this.commonService.backendURL$ + '/app-dist'
|
||||
getDistURL (): string {
|
||||
return this.commonService.backendURL + '/app-dist'
|
||||
}
|
||||
|
||||
getPluginsToLoad (): string[] {
|
||||
|
||||
@@ -1,23 +1,14 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
|
||||
declare const BACKEND_URL: any
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class CommonService {
|
||||
private configPromise: Promise<any>
|
||||
backendURL$: Promise<string>
|
||||
backendURL: string = BACKEND_URL
|
||||
|
||||
constructor () {
|
||||
this.configPromise = this.getConfig()
|
||||
this.backendURL$ = this.configPromise.then(cfg => {
|
||||
let backendURL = cfg.backendURL
|
||||
if (backendURL.endsWith('/')) {
|
||||
backendURL = backendURL.slice(0, -1)
|
||||
}
|
||||
return backendURL
|
||||
})
|
||||
}
|
||||
|
||||
private async getConfig () {
|
||||
return (await fetch('/config.json')).json()
|
||||
if (this.backendURL.endsWith('/')) {
|
||||
this.backendURL = this.backendURL.slice(0, -1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user