minor web cleanup chores

This commit is contained in:
Matt Hill
2025-04-13 13:03:51 -06:00
parent 2e6e9635c3
commit 03f8b73627
9 changed files with 17 additions and 53 deletions

8
web/.gitignore vendored
View File

@@ -13,17 +13,11 @@ Thumbs.db
UserInterfaceState.xcuserstate UserInterfaceState.xcuserstate
$RECYCLE.BIN/ $RECYCLE.BIN/
start9-ambassador
*.tar.gz *.tar.gz
config.json
ambassador.tar.gz
*.log *.log
log.txt log.txt
npm-debug.log* npm-debug.log*
postprocess.js
/.angular /.angular
/.idea /.idea
/.sass-cache /.sass-cache
@@ -34,8 +28,6 @@ postprocess.js
/dist /dist
/out-tsc /out-tsc
/node_modules /node_modules
/platforms
/plugins
config.json config.json
proxy.conf.json proxy.conf.json

View File

@@ -1,7 +0,0 @@
{
"singleQuote": true,
"semi": false,
"arrowParens": "avoid",
"trailingComma": "all",
"htmlWhitespaceSensitivity": "ignore"
}

View File

@@ -27,12 +27,12 @@ node --version
v20.17.0 v20.17.0
npm --version npm --version
v10.8.2 v11.1.0
``` ```
#### Install and enable the Prettier extension for your text editor #### Install and enable the Prettier extension for your text editor
#### Clone StartOS and load the PatchDB submodule if you have not already #### Clone StartOS and load submodules
```sh ```sh
git clone https://github.com/Start9Labs/start-os.git git clone https://github.com/Start9Labs/start-os.git
@@ -57,7 +57,7 @@ cp config-sample.json config.json
``` ```
- By default, "useMocks" is set to `true`. - By default, "useMocks" is set to `true`.
- Use "maskAs" to mock the host from which the web UI is served. Valid values are `tor`, `local`, and `localhost`. - Use "maskAs" to mock the host from which the web UI is served. Valid values are `tor`, `local`, `localhost`, `ipv4`, `ipv6`, and `clearnet`.
- Use "maskAsHttps" to mock the protocol over which the web UI is served. `true` means https; `false` means http. - Use "maskAsHttps" to mock the protocol over which the web UI is served. `true` means https; `false` means http.
## Running the development server ## Running the development server

View File

@@ -1,6 +1,5 @@
{ {
"useMocks": true, "useMocks": true,
"enableWidgets": false,
"ui": { "ui": {
"api": { "api": {
"url": "rpc", "url": "rpc",

View File

@@ -122,5 +122,13 @@
"hooks": { "hooks": {
"pre-commit": "lint-staged --concurrent false" "pre-commit": "lint-staged --concurrent false"
} }
},
"prettier": {
"singleQuote": true,
"semi": false,
"arrowParens": "avoid",
"trailingComma": "all",
"htmlWhitespaceSensitivity": "ignore",
"tabWidth": 2
} }
} }

View File

@@ -17,6 +17,5 @@
} }
}, },
"ackInstructions": {}, "ackInstructions": {},
"theme": "Dark", "theme": "Dark"
"widgets": []
} }

View File

@@ -1,7 +1,6 @@
export type WorkspaceConfig = { export type WorkspaceConfig = {
gitHash: string gitHash: string
useMocks: boolean useMocks: boolean
enableWidgets: boolean
// each key corresponds to a project and values adjust settings for that project, eg: ui, install-wizard, setup-wizard // each key corresponds to a project and values adjust settings for that project, eg: ui, install-wizard, setup-wizard
ui: { ui: {
api: { api: {

View File

@@ -1,18 +1,9 @@
import { Injectable } from '@angular/core' import { Injectable } from '@angular/core'
import { ReplaySubject, Subject } from 'rxjs' import { ReplaySubject } from 'rxjs'
import { WorkspaceConfig } from '../../../../shared/src/types/workspace-config'
import { StorageService } from './storage.service' import { StorageService } from './storage.service'
const SHOW_DEV_TOOLS = 'SHOW_DEV_TOOLS' const SHOW_DEV_TOOLS = 'SHOW_DEV_TOOLS'
const SHOW_DISK_REPAIR = 'SHOW_DISK_REPAIR' 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({ @Injectable({
providedIn: 'root', providedIn: 'root',
@@ -20,24 +11,12 @@ export type WidgetDrawer = {
export class ClientStorageService { export class ClientStorageService {
readonly showDevTools$ = new ReplaySubject<boolean>(1) readonly showDevTools$ = new ReplaySubject<boolean>(1)
readonly showDiskRepair$ = new ReplaySubject<boolean>(1) readonly showDiskRepair$ = new ReplaySubject<boolean>(1)
readonly widgetDrawer$ = new ReplaySubject<WidgetDrawer>(1)
constructor(private readonly storage: StorageService) {} constructor(private readonly storage: StorageService) {}
init() { init() {
this.showDevTools$.next(!!this.storage.get(SHOW_DEV_TOOLS)) this.showDevTools$.next(!!this.storage.get(SHOW_DEV_TOOLS))
this.showDiskRepair$.next(!!this.storage.get(SHOW_DISK_REPAIR)) 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 { toggleShowDevTools(): boolean {
@@ -53,9 +32,4 @@ export class ClientStorageService {
this.showDiskRepair$.next(newVal) this.showDiskRepair$.next(newVal)
return newVal return newVal
} }
updateWidgetDrawer(drawer: WidgetDrawer) {
this.widgetDrawer$.next(drawer)
this.storage.set(WIDGET_DRAWER, drawer)
}
} }

View File

@@ -35,9 +35,9 @@ export class ConfigService {
} }
isLocal(): boolean { isLocal(): boolean {
return ( return useMocks
this.hostname.endsWith('.local') || (useMocks && mocks.maskAs === 'local') ? mocks.maskAs === 'local'
) : this.hostname.endsWith('.local')
} }
isLocalhost(): boolean { isLocalhost(): boolean {