mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-01 21:13:09 +00:00
better subscriptions
This commit is contained in:
committed by
Aiden McClelland
parent
7a144b4d25
commit
2086367407
@@ -307,7 +307,6 @@ export class MockApiService extends ApiService {
|
||||
const pkg: PackageDataEntry = {
|
||||
...Mock.bitcoinproxy,
|
||||
state: PackageState.Installing,
|
||||
'temp-manifest': Mock.MockManifestBitcoinProxy,
|
||||
// installed: undefined,
|
||||
'install-progress': {
|
||||
size: 100,
|
||||
|
||||
@@ -578,12 +578,11 @@ export module Mock {
|
||||
icon: 'assets/img/service-icons/bitcoind.png',
|
||||
instructions: 'instructionsUrl', // /public/package-data/bitcoind/0.21.1/INSTRUCTIONS.md
|
||||
},
|
||||
'temp-manifest': undefined,
|
||||
manifest: {
|
||||
...MockManifestBitcoind,
|
||||
version: '0.20.0',
|
||||
},
|
||||
installed: {
|
||||
manifest: {
|
||||
...MockManifestBitcoind,
|
||||
version: '0.20.0',
|
||||
},
|
||||
status: {
|
||||
configured: true,
|
||||
main: {
|
||||
@@ -629,9 +628,8 @@ export module Mock {
|
||||
icon: 'assets/img/service-icons/lnd.png',
|
||||
instructions: 'instructionsUrl', // /public/package-data/lnd/0.21.1/INSTRUCTIONS.md
|
||||
},
|
||||
'temp-manifest': undefined,
|
||||
manifest: MockManifestLnd,
|
||||
installed: {
|
||||
manifest: MockManifestLnd,
|
||||
status: {
|
||||
configured: true,
|
||||
main: {
|
||||
@@ -681,9 +679,8 @@ export module Mock {
|
||||
icon: 'assets/img/service-icons/bitcoin-proxy.png',
|
||||
instructions: 'instructionsUrl', // /public/package-data/bitcoinproxy/0.2.2/INSTRUCTIONS.md
|
||||
},
|
||||
'temp-manifest': undefined,
|
||||
manifest: MockManifestBitcoinProxy,
|
||||
installed: {
|
||||
manifest: MockManifestBitcoinProxy,
|
||||
status: {
|
||||
configured: true,
|
||||
main: {
|
||||
|
||||
@@ -53,16 +53,14 @@ export class ConfigService {
|
||||
return false
|
||||
}
|
||||
|
||||
const installed = pkg.installed
|
||||
|
||||
return installed.status.main.status === PackageMainStatus.Running &&
|
||||
return pkg.installed.status.main.status === PackageMainStatus.Running &&
|
||||
(
|
||||
(hasTorUi(installed.manifest.interfaces) && this.isTor()) ||
|
||||
(hasLanUi(installed.manifest.interfaces) && !this.isTor())
|
||||
(hasTorUi(pkg.manifest.interfaces) && this.isTor()) ||
|
||||
(hasLanUi(pkg.manifest.interfaces) && !this.isTor())
|
||||
)
|
||||
}
|
||||
|
||||
launchableURL (pkg: InstalledPackageDataEntry): string {
|
||||
launchableURL (pkg: PackageDataEntry): string {
|
||||
return this.isTor() ? `http://${torUiAddress(pkg)}` : `https://${lanUiAddress(pkg)}`
|
||||
}
|
||||
}
|
||||
@@ -75,7 +73,7 @@ export function hasLanUi (interfaces: { [id: string]: InterfaceDef }): boolean {
|
||||
return !!Object.values(interfaces).find(i => i.ui && i['lan-config'])
|
||||
}
|
||||
|
||||
export function torUiAddress (pkg: InstalledPackageDataEntry): string {
|
||||
export function torUiAddress (pkg: PackageDataEntry): string {
|
||||
const interfaces = pkg.manifest.interfaces
|
||||
const id = Object.keys(interfaces).find(key => {
|
||||
const val = interfaces[key]
|
||||
@@ -84,7 +82,7 @@ export function torUiAddress (pkg: InstalledPackageDataEntry): string {
|
||||
return pkg['interface-info'].addresses[id]['tor-address']
|
||||
}
|
||||
|
||||
export function lanUiAddress (pkg: InstalledPackageDataEntry): string {
|
||||
export function lanUiAddress (pkg: PackageDataEntry): string {
|
||||
const interfaces = pkg.manifest.interfaces
|
||||
const id = Object.keys(interfaces).find(key => {
|
||||
const val = interfaces[key]
|
||||
@@ -99,7 +97,7 @@ export function hasUi (interfaces: { [id: string]: InterfaceDef }): boolean {
|
||||
|
||||
export function getManifest (pkg: PackageDataEntry): Manifest {
|
||||
if (pkg.state === PackageState.Installed) {
|
||||
return pkg.installed.manifest
|
||||
return pkg.manifest
|
||||
}
|
||||
return pkg['temp-manifest']
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ export class ConnectionService {
|
||||
this.connectionFailure$.next(ConnectionFailure.Network)
|
||||
} else if (!this.configService.isTor()) {
|
||||
this.connectionFailure$.next(ConnectionFailure.Lan)
|
||||
} {
|
||||
} else {
|
||||
// diagnosing
|
||||
this.connectionFailure$.next(ConnectionFailure.Diagnosing)
|
||||
const torSuccess = await this.testAddrs(addrs?.tor || [])
|
||||
|
||||
@@ -46,7 +46,7 @@ export interface PackageDataEntry {
|
||||
instructions: URL
|
||||
icon: URL
|
||||
}
|
||||
'temp-manifest'?: Manifest // exists when: installing, updating, removing
|
||||
manifest: Manifest
|
||||
installed?: InstalledPackageDataEntry, // exists when: installed, updating
|
||||
'install-progress'?: InstallProgress, // exists when: installing, updating
|
||||
}
|
||||
@@ -62,7 +62,6 @@ export interface InstallProgress {
|
||||
}
|
||||
|
||||
export interface InstalledPackageDataEntry {
|
||||
manifest: Manifest
|
||||
status: Status
|
||||
'interface-info': InterfaceInfo
|
||||
'system-pointers': any[]
|
||||
|
||||
Reference in New Issue
Block a user