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
$RECYCLE.BIN/
start9-ambassador
*.tar.gz
config.json
ambassador.tar.gz
*.log
log.txt
npm-debug.log*
postprocess.js
/.angular
/.idea
/.sass-cache
@@ -34,8 +28,6 @@ postprocess.js
/dist
/out-tsc
/node_modules
/platforms
/plugins
config.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
npm --version
v10.8.2
v11.1.0
```
#### 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
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`.
- 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.
## Running the development server

View File

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

View File

@@ -122,5 +122,13 @@
"hooks": {
"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": {},
"theme": "Dark",
"widgets": []
"theme": "Dark"
}

View File

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

View File

@@ -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)
}
}

View File

@@ -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 {