mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
Refactor/project structure (#3085)
* refactor project structure * environment-based default registry * fix tests * update build container * use docker platform for iso build emulation * simplify compat * Fix docker platform spec in run-compat.sh * handle riscv compat * fix bug with dep error exists attr * undo removal of sorting * use qemu for iso stage --------- Co-authored-by: Mariusz Kogen <k0gen@pm.me> Co-authored-by: Matt Hill <mattnine@protonmail.com>
This commit is contained in:
31
web/compress-uis.sh
Executable file
31
web/compress-uis.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
|
||||
set -e
|
||||
|
||||
STATIC_DIR=dist/static/$1
|
||||
RAW_DIR=dist/raw/$1
|
||||
|
||||
mkdir -p $STATIC_DIR
|
||||
rm -rf $STATIC_DIR
|
||||
|
||||
if ! [[ "$ENVIRONMENT" =~ (^|-)dev($|-) ]]; then
|
||||
find $RAW_DIR -type f -not -name '*.gz' -and -not -name '*.br' | xargs -n 1 -P 0 gzip -kf
|
||||
find $RAW_DIR -type f -not -name '*.gz' -and -not -name '*.br' | xargs -n 1 -P 0 brotli -kf
|
||||
|
||||
for file in $(find $RAW_DIR -type f -not -name '*.gz' -and -not -name '*.br'); do
|
||||
raw_size=$(du $file | awk '{print $1 * 512}')
|
||||
gz_size=$(du $file.gz | awk '{print $1 * 512}')
|
||||
br_size=$(du $file.br | awk '{print $1 * 512}')
|
||||
if [ $((gz_size * 100 / raw_size)) -gt 70 ]; then
|
||||
rm $file.gz
|
||||
fi
|
||||
if [ $((br_size * 100 / raw_size)) -gt 70 ]; then
|
||||
rm $file.br
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
cp -r $RAW_DIR $STATIC_DIR
|
||||
@@ -11,5 +11,6 @@
|
||||
"skipStartupAlerts": true
|
||||
}
|
||||
},
|
||||
"defaultRegistry": "https://registry.start9.com",
|
||||
"gitHash": ""
|
||||
}
|
||||
|
||||
11
web/patchdb-ui-seed.beta.json
Normal file
11
web/patchdb-ui-seed.beta.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": null,
|
||||
"registries": {
|
||||
"https://registry.start9.com/": "Start9 Registry",
|
||||
"https://community-registry.start9.com/": "Community Registry",
|
||||
"https://beta-registry.start9.com/": "Start9 Beta Registry",
|
||||
"https://community-beta-registry.start9.com/": "Community Beta Registry"
|
||||
},
|
||||
"startosRegistry": "https://beta-registry.start9.com/",
|
||||
"snakeHighScore": 0
|
||||
}
|
||||
@@ -13,6 +13,7 @@ export type WorkspaceConfig = {
|
||||
skipStartupAlerts: boolean
|
||||
}
|
||||
}
|
||||
defaultRegistry: string
|
||||
}
|
||||
|
||||
export const defaultRegistries = {
|
||||
@@ -24,4 +25,5 @@ export const knownRegistries = {
|
||||
...defaultRegistries,
|
||||
start9Alpha: 'https://alpha-registry-x.start9.com/',
|
||||
start9Beta: 'https://beta-registry.start9.com/',
|
||||
communityBeta: 'https://community-beta-registry.start9.com/',
|
||||
} as const
|
||||
|
||||
@@ -56,7 +56,8 @@ export class MarketplaceNotificationComponent {
|
||||
@Input() url = ''
|
||||
|
||||
get status() {
|
||||
const { start9, community, start9Beta, start9Alpha } = knownRegistries
|
||||
const { start9, community, start9Beta, communityBeta, start9Alpha } =
|
||||
knownRegistries
|
||||
|
||||
if (sameUrl(this.url, start9)) {
|
||||
return 'success'
|
||||
@@ -66,7 +67,7 @@ export class MarketplaceNotificationComponent {
|
||||
return 'info'
|
||||
}
|
||||
|
||||
if (sameUrl(this.url, start9Beta)) {
|
||||
if (sameUrl(this.url, start9Beta) || sameUrl(this.url, communityBeta)) {
|
||||
return 'warning'
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
FilterPackagesPipe,
|
||||
FilterPackagesPipeModule,
|
||||
} from '@start9labs/marketplace'
|
||||
import { defaultRegistries, i18nPipe } from '@start9labs/shared'
|
||||
import { i18nPipe } from '@start9labs/shared'
|
||||
import { TuiScrollbar } from '@taiga-ui/core'
|
||||
import { tap } from 'rxjs'
|
||||
import { MarketplaceService } from 'src/app/services/marketplace.service'
|
||||
@@ -16,6 +16,7 @@ import { MarketplaceMenuComponent } from './components/menu.component'
|
||||
import { MarketplaceNotificationComponent } from './components/notification.component'
|
||||
import { MarketplaceTileComponent } from './components/tile.component'
|
||||
import { StorageService } from 'src/app/services/storage.service'
|
||||
import { ConfigService } from 'src/app/services/config.service'
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
@@ -160,6 +161,7 @@ import { StorageService } from 'src/app/services/storage.service'
|
||||
export default class MarketplaceComponent {
|
||||
private readonly categoryService = inject(AbstractCategoryService)
|
||||
private readonly marketplaceService = inject(MarketplaceService)
|
||||
private readonly configService = inject(ConfigService)
|
||||
private readonly router = inject(Router)
|
||||
private readonly storage = inject(StorageService)
|
||||
private readonly route = inject(ActivatedRoute)
|
||||
@@ -175,7 +177,7 @@ export default class MarketplaceComponent {
|
||||
queryParams: {
|
||||
registry:
|
||||
this.storage.get('selectedRegistry') ||
|
||||
defaultRegistries.start9,
|
||||
this.configService.defaultRegistry,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
})
|
||||
|
||||
@@ -6,6 +6,7 @@ const {
|
||||
gitHash,
|
||||
useMocks,
|
||||
ui: { api, mocks },
|
||||
defaultRegistry,
|
||||
} = require('../../../../../config.json') as WorkspaceConfig
|
||||
|
||||
@Injectable({
|
||||
@@ -26,6 +27,7 @@ export class ConfigService {
|
||||
api = api
|
||||
skipStartupAlerts = useMocks && mocks.skipStartupAlerts
|
||||
supportsWebSockets = !!window.WebSocket
|
||||
defaultRegistry = defaultRegistry
|
||||
|
||||
isTor(): boolean {
|
||||
return useMocks ? mocks.maskAs === 'tor' : this.hostname.endsWith('.onion')
|
||||
|
||||
@@ -156,15 +156,14 @@ export class DepErrorService {
|
||||
|
||||
const depStatus = getInstalledBaseStatus(dep.statusInfo)
|
||||
|
||||
// not running
|
||||
if (depStatus !== 'running' && depStatus !== 'starting') {
|
||||
return {
|
||||
type: 'notRunning',
|
||||
}
|
||||
}
|
||||
|
||||
// health check failure
|
||||
if (currentDep?.kind === 'running') {
|
||||
// not running
|
||||
if (depStatus !== 'running' && depStatus !== 'starting') {
|
||||
return {
|
||||
type: 'notRunning',
|
||||
}
|
||||
}
|
||||
// health check failure
|
||||
for (let id of currentDep.healthChecks) {
|
||||
const check = dep.statusInfo.health[id]
|
||||
if (check?.result !== 'success') {
|
||||
|
||||
16
web/update-config.sh
Executable file
16
web/update-config.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd "$(dirname ${BASH_SOURCE[0]})"
|
||||
|
||||
set -e
|
||||
|
||||
if [[ "$(cat ../build/env/ENVIRONMENT.txt)" =~ (^|-)beta($|-) ]]; then
|
||||
BETA='beta-'
|
||||
fi
|
||||
|
||||
CONFIG=$(if [ -f config.json ]; then cat config.json; else cat config-sample.json; fi)
|
||||
echo "$CONFIG" \
|
||||
| jq '.useMocks = false' \
|
||||
| jq ".gitHash = \"$(cat ../build/env/GIT_HASH.txt)\"" \
|
||||
| jq ".defaultRegistry = \"https://${BETA}registry.start9.com\"" \
|
||||
> config.json
|
||||
Reference in New Issue
Block a user