mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
global click protections, install wizard fixes, better login, better marketplace search, fix mocks
This commit is contained in:
committed by
Aiden McClelland
parent
14a0dbe66e
commit
7b9ce88a16
@@ -581,56 +581,58 @@ export module Mock {
|
||||
|
||||
export const MarketplacePkgsList: RR.GetMarketplacePackagesRes = Object.values(Mock.MarketplacePkgs).map(service => service['latest'])
|
||||
|
||||
export const bitcoinproxy: PackageDataEntry = {
|
||||
state: PackageState.Installed,
|
||||
'static-files': {
|
||||
license: 'licenseUrl', // /public/package-data/bitcoinproxy/0.21.1/LICENSE.md,
|
||||
icon: 'assets/img/service-icons/bitcoin-proxy.png',
|
||||
instructions: 'instructionsUrl', // /public/package-data/bitcoinproxy/0.2.2/INSTRUCTIONS.md
|
||||
},
|
||||
manifest: MockManifestBitcoinProxy,
|
||||
installed: {
|
||||
status: {
|
||||
configured: true,
|
||||
main: {
|
||||
status: PackageMainStatus.Running,
|
||||
started: new Date().toISOString(),
|
||||
health: { },
|
||||
},
|
||||
'dependency-errors': { },
|
||||
export const Pkgs: { [key: string]: PackageDataEntry } = {
|
||||
'bitcoin-proxy': {
|
||||
state: PackageState.Installed,
|
||||
'static-files': {
|
||||
license: 'licenseUrl', // /public/package-data/bitcoinproxy/0.21.1/LICENSE.md,
|
||||
icon: 'assets/img/service-icons/bitcoin-proxy.png',
|
||||
instructions: 'instructionsUrl', // /public/package-data/bitcoinproxy/0.2.2/INSTRUCTIONS.md
|
||||
},
|
||||
manifest: MockManifestBitcoinProxy,
|
||||
'interface-addresses': {
|
||||
rpc: {
|
||||
'tor-address': 'bitcoinproxy-rpc-address.onion',
|
||||
'lan-address': 'bitcoinproxy-rpc-address.local',
|
||||
},
|
||||
},
|
||||
'system-pointers': [],
|
||||
'current-dependents': {
|
||||
'lnd': {
|
||||
pointers: [],
|
||||
'health-checks': [],
|
||||
},
|
||||
},
|
||||
'current-dependencies': {
|
||||
'bitcoind': {
|
||||
pointers: [],
|
||||
'health-checks': [],
|
||||
},
|
||||
},
|
||||
'dependency-info': {
|
||||
'lnd': {
|
||||
manifest: Mock.MockManifestLnd,
|
||||
icon: 'assets/img/service-icons/lnd.png',
|
||||
},
|
||||
'bitcoind': {
|
||||
manifest: Mock.MockManifestBitcoind,
|
||||
icon: 'assets/img/service-icons/bitcoind.png',
|
||||
installed: {
|
||||
status: {
|
||||
configured: true,
|
||||
main: {
|
||||
status: PackageMainStatus.Running,
|
||||
started: new Date().toISOString(),
|
||||
health: { },
|
||||
},
|
||||
'dependency-errors': { },
|
||||
},
|
||||
manifest: MockManifestBitcoinProxy,
|
||||
'interface-addresses': {
|
||||
rpc: {
|
||||
'tor-address': 'bitcoinproxy-rpc-address.onion',
|
||||
'lan-address': 'bitcoinproxy-rpc-address.local',
|
||||
},
|
||||
},
|
||||
'system-pointers': [],
|
||||
'current-dependents': {
|
||||
'lnd': {
|
||||
pointers: [],
|
||||
'health-checks': [],
|
||||
},
|
||||
},
|
||||
'current-dependencies': {
|
||||
'bitcoind': {
|
||||
pointers: [],
|
||||
'health-checks': [],
|
||||
},
|
||||
},
|
||||
'dependency-info': {
|
||||
'lnd': {
|
||||
manifest: Mock.MockManifestLnd,
|
||||
icon: 'assets/img/service-icons/lnd.png',
|
||||
},
|
||||
'bitcoind': {
|
||||
manifest: Mock.MockManifestBitcoind,
|
||||
icon: 'assets/img/service-icons/bitcoind.png',
|
||||
},
|
||||
},
|
||||
},
|
||||
'install-progress': undefined,
|
||||
},
|
||||
'install-progress': undefined,
|
||||
}
|
||||
|
||||
export const Notifications: ServerNotifications = [
|
||||
@@ -1455,62 +1457,62 @@ export module Mock {
|
||||
// 'install-progress': undefined,
|
||||
// }
|
||||
|
||||
export const lnd: PackageDataEntry = {
|
||||
state: PackageState.Installed,
|
||||
'static-files': {
|
||||
license: 'licenseUrl', // /public/package-data/lnd/0.21.1/LICENSE.md,
|
||||
icon: 'assets/img/service-icons/lnd.png',
|
||||
instructions: 'instructionsUrl', // /public/package-data/lnd/0.21.1/INSTRUCTIONS.md
|
||||
},
|
||||
manifest: MockManifestLnd,
|
||||
installed: {
|
||||
status: {
|
||||
configured: true,
|
||||
main: {
|
||||
status: PackageMainStatus.Stopped,
|
||||
},
|
||||
'dependency-errors': {
|
||||
'bitcoin-proxy': {
|
||||
type: DependencyErrorType.NotInstalled,
|
||||
},
|
||||
},
|
||||
},
|
||||
manifest: MockManifestLnd,
|
||||
'interface-addresses': {
|
||||
rpc: {
|
||||
'tor-address': 'lnd-rpc-address.onion',
|
||||
'lan-address': 'lnd-rpc-address.local',
|
||||
},
|
||||
grpc: {
|
||||
'tor-address': 'lnd-grpc-address.onion',
|
||||
'lan-address': 'lnd-grpc-address.local',
|
||||
},
|
||||
},
|
||||
'system-pointers': [],
|
||||
'current-dependents': { },
|
||||
'current-dependencies': {
|
||||
'bitcoind': {
|
||||
pointers: [],
|
||||
'health-checks': [],
|
||||
},
|
||||
'bitcoin-proxy': {
|
||||
pointers: [],
|
||||
'health-checks': [],
|
||||
},
|
||||
},
|
||||
'dependency-info': {
|
||||
'bitcoind': {
|
||||
manifest: Mock.MockManifestBitcoind,
|
||||
icon: 'assets/img/service-icons/bitcoind.png',
|
||||
},
|
||||
'bitcoin-proxy': {
|
||||
manifest: Mock.MockManifestBitcoinProxy,
|
||||
icon: 'assets/img/service-icons/bitcoin-proxy.png',
|
||||
},
|
||||
},
|
||||
},
|
||||
'install-progress': undefined,
|
||||
}
|
||||
// export const lnd: PackageDataEntry = {
|
||||
// state: PackageState.Installed,
|
||||
// 'static-files': {
|
||||
// license: 'licenseUrl', // /public/package-data/lnd/0.21.1/LICENSE.md,
|
||||
// icon: 'assets/img/service-icons/lnd.png',
|
||||
// instructions: 'instructionsUrl', // /public/package-data/lnd/0.21.1/INSTRUCTIONS.md
|
||||
// },
|
||||
// manifest: MockManifestLnd,
|
||||
// installed: {
|
||||
// status: {
|
||||
// configured: true,
|
||||
// main: {
|
||||
// status: PackageMainStatus.Stopped,
|
||||
// },
|
||||
// 'dependency-errors': {
|
||||
// 'bitcoin-proxy': {
|
||||
// type: DependencyErrorType.NotInstalled,
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// manifest: MockManifestLnd,
|
||||
// 'interface-addresses': {
|
||||
// rpc: {
|
||||
// 'tor-address': 'lnd-rpc-address.onion',
|
||||
// 'lan-address': 'lnd-rpc-address.local',
|
||||
// },
|
||||
// grpc: {
|
||||
// 'tor-address': 'lnd-grpc-address.onion',
|
||||
// 'lan-address': 'lnd-grpc-address.local',
|
||||
// },
|
||||
// },
|
||||
// 'system-pointers': [],
|
||||
// 'current-dependents': { },
|
||||
// 'current-dependencies': {
|
||||
// 'bitcoind': {
|
||||
// pointers: [],
|
||||
// 'health-checks': [],
|
||||
// },
|
||||
// 'bitcoin-proxy': {
|
||||
// pointers: [],
|
||||
// 'health-checks': [],
|
||||
// },
|
||||
// },
|
||||
// 'dependency-info': {
|
||||
// 'bitcoind': {
|
||||
// manifest: Mock.MockManifestBitcoind,
|
||||
// icon: 'assets/img/service-icons/bitcoind.png',
|
||||
// },
|
||||
// 'bitcoin-proxy': {
|
||||
// manifest: Mock.MockManifestBitcoinProxy,
|
||||
// icon: 'assets/img/service-icons/bitcoin-proxy.png',
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// 'install-progress': undefined,
|
||||
// }
|
||||
|
||||
// export const DbDump: RR.GetDumpRes = {
|
||||
// id: 1,
|
||||
|
||||
@@ -13,6 +13,8 @@ export abstract class ApiService implements Source<DataModel>, Http<DataModel> {
|
||||
return this.sync.asObservable()
|
||||
}
|
||||
|
||||
connectionMade$ = new Subject<void>()
|
||||
|
||||
// for getting static files: ex icons, instructions, licenses
|
||||
abstract getStatic (url: string): Promise<string>
|
||||
|
||||
@@ -195,6 +197,7 @@ export abstract class ApiService implements Source<DataModel>, Http<DataModel> {
|
||||
throw e
|
||||
})
|
||||
.then(({ response, revision }) => {
|
||||
this.connectionMade$.next()
|
||||
if (revision) this.sync.next(revision)
|
||||
return response
|
||||
})
|
||||
|
||||
@@ -96,6 +96,7 @@ export class LiveApiService extends ApiService {
|
||||
}
|
||||
|
||||
async getMarketplacePkgs (params: RR.GetMarketplacePackagesReq): Promise <RR.GetMarketplacePackagesRes> {
|
||||
if (params.query) params.category = undefined
|
||||
return this.http.httpRequest({
|
||||
method: Method.GET,
|
||||
url: '/marketplace/package/index',
|
||||
|
||||
@@ -335,7 +335,7 @@ export class MockApiService extends ApiService {
|
||||
'unpack-complete': false,
|
||||
}
|
||||
const pkg: PackageDataEntry = {
|
||||
...Mock[params.id],
|
||||
...Mock.Pkgs[params.id],
|
||||
state: PackageState.Installing,
|
||||
'install-progress': initialProgress,
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Inject, Injectable, InjectionToken } from '@angular/core'
|
||||
import { Bootstrapper, PatchDB, Source, Store } from 'patch-db-client'
|
||||
import { BehaviorSubject, Observable, of, Subscription } from 'rxjs'
|
||||
import { catchError, debounceTime, finalize, map, tap } from 'rxjs/operators'
|
||||
import { BehaviorSubject, combineLatest, Observable, of, Subscription } from 'rxjs'
|
||||
import { catchError, debounceTime, delay, filter, finalize, map, take, tap, timeout } from 'rxjs/operators'
|
||||
import { pauseFor } from 'src/app/util/misc.util'
|
||||
import { ApiService } from '../api/embassy-api.service'
|
||||
import { DataModel } from './data-model'
|
||||
@@ -42,18 +42,30 @@ export class PatchDbService {
|
||||
start (): void {
|
||||
// make sure everything is stopped before initializing
|
||||
if (this.patchSub) {
|
||||
console.log('Retrying')
|
||||
this.patchSub.unsubscribe()
|
||||
this.patchSub = undefined
|
||||
}
|
||||
console.log('Retrying')
|
||||
try {
|
||||
this.patchSub = this.patchDb.sync$()
|
||||
.pipe(debounceTime(500))
|
||||
.subscribe({
|
||||
next: cache => {
|
||||
const connectedSub$ = this.patchDb.connectionMade$()
|
||||
.pipe(
|
||||
tap(() => {
|
||||
this.patchConnection$.next(PatchConnection.Connected)
|
||||
}),
|
||||
timeout(30000),
|
||||
take(1),
|
||||
)
|
||||
|
||||
const updateSub$ = this.patchDb.sync$()
|
||||
.pipe(
|
||||
debounceTime(500),
|
||||
tap(cache => {
|
||||
this.bootstrapper.update(cache)
|
||||
},
|
||||
}),
|
||||
)
|
||||
|
||||
this.patchSub = combineLatest([connectedSub$, updateSub$])
|
||||
.subscribe({
|
||||
error: async e => {
|
||||
console.error('patch-db-sync sub ERROR', e)
|
||||
this.patchConnection$.next(PatchConnection.Disconnected)
|
||||
|
||||
Reference in New Issue
Block a user