mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
fix: reset sideload service after websocket completes (#2798)
* fix: reset sideload service after websocket completes * chore: fix comment
This commit is contained in:
4477
web/package-lock.json
generated
4477
web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -52,6 +52,7 @@
|
||||
"@start9labs/emver": "^0.1.5",
|
||||
"@start9labs/start-sdk": "file:../sdk/baseDist",
|
||||
"@taiga-ui/addon-charts": "3.96.0",
|
||||
"@taiga-ui/addon-commerce": "3.96.0",
|
||||
"@taiga-ui/cdk": "3.96.0",
|
||||
"@taiga-ui/core": "3.96.0",
|
||||
"@taiga-ui/experimental": "3.96.0",
|
||||
@@ -83,7 +84,7 @@
|
||||
"pbkdf2": "^3.1.2",
|
||||
"rxjs": "^7.8.1",
|
||||
"swiper": "^8.2.4",
|
||||
"ts-matches": "^5.5.1",
|
||||
"ts-matches": "^6.1.0",
|
||||
"tslib": "^2.3.0",
|
||||
"uuid": "^8.3.2",
|
||||
"zone.js": "^0.11.5"
|
||||
|
||||
@@ -6,7 +6,7 @@ import cbor from 'cbor'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { ConfigService } from 'src/app/services/config.service'
|
||||
import { SideloadService } from './sideload.service'
|
||||
import { firstValueFrom } from 'rxjs'
|
||||
import { filter, firstValueFrom } from 'rxjs'
|
||||
import mime from 'mime'
|
||||
|
||||
interface Positions {
|
||||
@@ -124,7 +124,7 @@ export class SideloadPage {
|
||||
this.api
|
||||
.uploadPackage(res.upload, this.toUpload.file!)
|
||||
.catch(e => console.error(e))
|
||||
await firstValueFrom(this.sideloadService.websocketConnected$)
|
||||
await firstValueFrom(this.progress$.pipe(filter(Boolean)))
|
||||
} catch (e: any) {
|
||||
this.errorService.handleError(e)
|
||||
} finally {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { T } from '@start9labs/start-sdk'
|
||||
import { endWith, ReplaySubject, shareReplay, Subject, switchMap } from 'rxjs'
|
||||
import { BehaviorSubject, endWith, shareReplay, Subject, switchMap } from 'rxjs'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
|
||||
@Injectable({
|
||||
@@ -9,17 +9,9 @@ import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
export class SideloadService {
|
||||
private readonly guid$ = new Subject<string>()
|
||||
|
||||
readonly websocketConnected$ = new ReplaySubject()
|
||||
|
||||
readonly progress$ = this.guid$.pipe(
|
||||
switchMap(guid =>
|
||||
this.api
|
||||
.openWebsocket$<T.FullProgress>(guid, {
|
||||
openObserver: {
|
||||
next: () => this.websocketConnected$.next(''),
|
||||
},
|
||||
})
|
||||
.pipe(endWith(null)),
|
||||
this.api.openWebsocket$<T.FullProgress>(guid).pipe(endWith(null)),
|
||||
),
|
||||
shareReplay(1),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user