mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
minor web cleanup chores
This commit is contained in:
@@ -1,18 +1,9 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { ReplaySubject, Subject } from 'rxjs'
|
||||
import { WorkspaceConfig } from '../../../../shared/src/types/workspace-config'
|
||||
import { ReplaySubject } from 'rxjs'
|
||||
import { StorageService } from './storage.service'
|
||||
|
||||
const SHOW_DEV_TOOLS = 'SHOW_DEV_TOOLS'
|
||||
const SHOW_DISK_REPAIR = 'SHOW_DISK_REPAIR'
|
||||
const WIDGET_DRAWER = 'WIDGET_DRAWER'
|
||||
|
||||
const { enableWidgets } =
|
||||
require('../../../../../config.json') as WorkspaceConfig
|
||||
|
||||
export type WidgetDrawer = {
|
||||
open: boolean
|
||||
width: 400 | 600
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -20,24 +11,12 @@ export type WidgetDrawer = {
|
||||
export class ClientStorageService {
|
||||
readonly showDevTools$ = new ReplaySubject<boolean>(1)
|
||||
readonly showDiskRepair$ = new ReplaySubject<boolean>(1)
|
||||
readonly widgetDrawer$ = new ReplaySubject<WidgetDrawer>(1)
|
||||
|
||||
constructor(private readonly storage: StorageService) {}
|
||||
|
||||
init() {
|
||||
this.showDevTools$.next(!!this.storage.get(SHOW_DEV_TOOLS))
|
||||
this.showDiskRepair$.next(!!this.storage.get(SHOW_DISK_REPAIR))
|
||||
this.widgetDrawer$.next(
|
||||
enableWidgets
|
||||
? this.storage.get(WIDGET_DRAWER) || {
|
||||
open: true,
|
||||
width: 600,
|
||||
}
|
||||
: {
|
||||
open: false,
|
||||
width: 600,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
toggleShowDevTools(): boolean {
|
||||
@@ -53,9 +32,4 @@ export class ClientStorageService {
|
||||
this.showDiskRepair$.next(newVal)
|
||||
return newVal
|
||||
}
|
||||
|
||||
updateWidgetDrawer(drawer: WidgetDrawer) {
|
||||
this.widgetDrawer$.next(drawer)
|
||||
this.storage.set(WIDGET_DRAWER, drawer)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ export class ConfigService {
|
||||
}
|
||||
|
||||
isLocal(): boolean {
|
||||
return (
|
||||
this.hostname.endsWith('.local') || (useMocks && mocks.maskAs === 'local')
|
||||
)
|
||||
return useMocks
|
||||
? mocks.maskAs === 'local'
|
||||
: this.hostname.endsWith('.local')
|
||||
}
|
||||
|
||||
isLocalhost(): boolean {
|
||||
|
||||
Reference in New Issue
Block a user