mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 04:01:58 +00:00
* refactor how we handle rpc responses and patchdb connection monitoring * websockets only * remove unused global error handlers * chore: clear storage inside auth service * feat: convert all global toasts to declarative approach (#1754) * no more reference to serverID Co-authored-by: Aiden McClelland <me@drbonez.dev> Co-authored-by: waterplea <alexander@inkin.ru>
25 lines
826 B
TypeScript
25 lines
826 B
TypeScript
import { Injectable } from '@angular/core'
|
|
import { endWith, Observable } from 'rxjs'
|
|
import { map } from 'rxjs/operators'
|
|
import { Emver } from '@start9labs/shared'
|
|
|
|
import { PatchDbService } from '../../../services/patch-db/patch-db.service'
|
|
import { ConfigService } from '../../../services/config.service'
|
|
|
|
// Watch for connection status
|
|
@Injectable({ providedIn: 'root' })
|
|
export class RefreshAlertService extends Observable<boolean> {
|
|
private readonly stream$ = this.patch.watch$('server-info', 'version').pipe(
|
|
map(version => !!this.emver.compare(this.config.version, version)),
|
|
endWith(false),
|
|
)
|
|
|
|
constructor(
|
|
private readonly patch: PatchDbService,
|
|
private readonly emver: Emver,
|
|
private readonly config: ConfigService,
|
|
) {
|
|
super(subscriber => this.stream$.subscribe(subscriber))
|
|
}
|
|
}
|