add registries.json and use real marketplace name

This commit is contained in:
Matt Hill
2022-02-25 17:19:14 -07:00
committed by Aiden McClelland
parent 798e17f636
commit 94a6cd4ff6
11 changed files with 111 additions and 59 deletions

20
frontend/build-config.js Executable file
View File

@@ -0,0 +1,20 @@
// @ts-check
const fs = require('fs')
const childProcess = require('child_process')
const { env } = require('process')
const gitHash = String(
childProcess.execSync('git describe --always --abbrev=40 --dirty=-modified'),
).trim()
const origConfig = require('./config.json')
const registries = require('./registries.json')
origConfig['gitHash'] = gitHash
if (/(^|-)beta($|-)/.test(env['ENVIRONMENT'] || '')) {
origConfig.ui['marketplace'] = registries.beta
} else {
origConfig.ui['marketplace'] = registries.prod
}
fs.writeFileSync('./config.json', JSON.stringify(origConfig, null, 2))

View File

@@ -13,10 +13,6 @@
"mocks": { "mocks": {
"maskAs": "tor", "maskAs": "tor",
"skipStartupAlerts": true "skipStartupAlerts": true
},
"marketplace": {
"url": "https://beta-registry-0-3.start9labs.com",
"name": "Start9"
} }
} }
} }

View File

@@ -15,10 +15,10 @@
"build:setup-wizard": "ng run setup-wizard:build", "build:setup-wizard": "ng run setup-wizard:build",
"build:ui": "ng run ui:build && tsc projects/ui/postprocess.ts && node projects/ui/postprocess.js && git log | head -n1 > dist/ui/git-hash.txt", "build:ui": "ng run ui:build && tsc projects/ui/postprocess.ts && node projects/ui/postprocess.js && git log | head -n1 > dist/ui/git-hash.txt",
"build:all": "npm run build:deps && npm run build:diagnostic-ui && npm run build:setup-wizard && npm run build:ui", "build:all": "npm run build:deps && npm run build:diagnostic-ui && npm run build:setup-wizard && npm run build:ui",
"start:diagnostic-ui": "npm run copy-git-hash && ionic serve --project diagnostic-ui", "start:diagnostic-ui": "npm run-script build-config && ionic serve --project diagnostic-ui",
"start:setup-wizard": "npm run copy-git-hash && ionic serve --project setup-wizard", "start:setup-wizard": "npm run-script build-config && ionic serve --project setup-wizard",
"start:ui": "npm run-script copy-git-hash && ionic serve --project ui", "start:ui": "npm run-script build-config && ionic serve --project ui",
"copy-git-hash": "node update-git-hash.js" "build-config": "node build-config.js"
}, },
"dependencies": { "dependencies": {
"@angular/animations": "^13.2.0", "@angular/animations": "^13.2.0",

View File

@@ -1,20 +1,61 @@
<ion-header> <ion-header>
<ion-toolbar> <ion-toolbar>
<ion-title>Welcome to {{ version }}!</ion-title> <ion-title>{{ version }} Release Notes</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content class="ion-padding"> <ion-content class="ion-padding">
<div style="display: flex; flex-direction: column; justify-content: space-between; height: 100%"> <h1>A whole new Embassy!</h1>
<h2>A Whole New Embassy</h2> <p>
<div class="main-content"> Check out the full
<p>New features and more new features!</p> <a
</div> href="https://start9labs.medium.com/embassyos-0-3-0-f3d2d2ea016f"
target="_blank"
noreferrer
>Release Notes</a
>.
</p>
<h2>Highlights</h2>
<ul class="spaced-list">
<li>
<b>SSD Support</b> - Embassy now requires an external SSD, offering more
storage, better reliability, and a faster experience.
</li>
<li><b>Websockets</b> - Provides a smooth, "real-time" feel.</li>
<li>
<b>Full Embassy Backups</b> - Create encrypted backups of your Embassy and
all its services with a single button.
</li>
<li>
<b>LAN Shared Folders (for backups)</b> - Easily perform "over-the-air"
backups on your desktop/laptop or a drive plugged into your
desktop/laptop.
</li>
<li>
<b>Revamped User Interface</b> - The user interface has been rewritten and
redesigned to be more performant, understandable, and beautiful.
</li>
<li>
<b>Session Management</b> - View your Embassy's active sessions and log
out remotely.
</li>
<li>
<b>Alt Marketplaces</b> - Optionally connect to and browse alternative
service marketplaces.
</li>
<li>
<b>Progress Reporting</b> - View live progress of services
installs/updates and EmbassyOS updates.
</li>
<li>
<b>Health Checks</b> - View the health of your services at a glance, along
with helpful messages if something is wrong.
</li>
</ul>
<div class="close-button"> <div class="ion-text-center ion-padding">
<ion-button fill="outline" color="dark" (click)="dismiss()"> <ion-button fill="outline" color="dark" (click)="dismiss()">
Begin Begin
</ion-button> </ion-button>
</div>
</div> </div>
</ion-content> </ion-content>

View File

@@ -7,6 +7,11 @@
} }
.main-content { .main-content {
height: 100%;
color: var(--ion-color-dark); color: var(--ion-color-dark);
}
.spaced-list {
li {
padding-bottom: 12px;
}
} }

View File

@@ -19,7 +19,7 @@
style="font-family: 'Montserrat'; font-size: 42px; margin: 32px 0" style="font-family: 'Montserrat'; font-size: 42px; margin: 32px 0"
class="ion-text-center" class="ion-text-center"
> >
Embassy Marketplace {{ marketplaceService.marketplace.name }}
</h1> </h1>
<ion-grid style="padding-bottom: 32px"> <ion-grid style="padding-bottom: 32px">

View File

@@ -22,7 +22,10 @@ export class MarketplaceService {
[version: string]: string [version: string]: string
} }
} = {} } = {}
marketplaceUrl: string marketplace: {
url: string
name: string
}
constructor( constructor(
private readonly api: ApiService, private readonly api: ApiService,
@@ -34,10 +37,11 @@ export class MarketplaceService {
init(): Subscription { init(): Subscription {
return this.patch.watch$('ui', 'marketplace').subscribe(marketplace => { return this.patch.watch$('ui', 'marketplace').subscribe(marketplace => {
if (!marketplace || !marketplace['selected-id']) { if (!marketplace || !marketplace['selected-id']) {
this.marketplaceUrl = this.config.marketplace.url console.log('**MARKETPLACE', this.config)
this.marketplace = this.config.marketplace
} else { } else {
this.marketplaceUrl = this.marketplace =
marketplace['known-hosts'][marketplace['selected-id']].url marketplace['known-hosts'][marketplace['selected-id']]
} }
}) })
} }
@@ -68,7 +72,7 @@ export class MarketplaceService {
} }
async installPackage(req: Omit<RR.InstallPackageReq, 'marketplace-url'>) { async installPackage(req: Omit<RR.InstallPackageReq, 'marketplace-url'>) {
req['marketplace-url'] = this.marketplaceUrl req['marketplace-url'] = this.marketplace.url
return this.api.installPackage(req as RR.InstallPackageReq) return this.api.installPackage(req as RR.InstallPackageReq)
} }
@@ -121,7 +125,7 @@ export class MarketplaceService {
params: RR.GetMarketplaceDataReq, params: RR.GetMarketplaceDataReq,
url?: string, url?: string,
): Promise<RR.GetMarketplaceDataRes> { ): Promise<RR.GetMarketplaceDataRes> {
url = url || this.marketplaceUrl url = url || this.marketplace.url
return this.api.marketplaceProxy('/package/v0/info', params, url) return this.api.marketplaceProxy('/package/v0/info', params, url)
} }
@@ -140,7 +144,7 @@ export class MarketplaceService {
return this.api.marketplaceProxy( return this.api.marketplaceProxy(
'/package/v0/index', '/package/v0/index',
qp, qp,
this.marketplaceUrl, this.marketplace.url,
) )
} }
@@ -150,7 +154,7 @@ export class MarketplaceService {
return this.api.marketplaceProxy( return this.api.marketplaceProxy(
`/package/v0/release-notes/${params.id}`, `/package/v0/release-notes/${params.id}`,
{}, {},
this.marketplaceUrl, this.marketplace.url,
) )
} }
} }

View File

@@ -17,7 +17,6 @@ import { wizardModal } from 'src/app/components/install-wizard/install-wizard.co
import { exists, isEmptyObject } from '@start9labs/shared' import { exists, isEmptyObject } from '@start9labs/shared'
import { EOSService } from 'src/app/services/eos.service' import { EOSService } from 'src/app/services/eos.service'
import { ServerStatus } from 'src/app/services/patch-db/data-model' import { ServerStatus } from 'src/app/services/patch-db/data-model'
import { SnakePage } from 'src/app/modals/snake/snake.page'
@Component({ @Component({
selector: 'server-show', selector: 'server-show',

14
frontend/registries.json Normal file
View File

@@ -0,0 +1,14 @@
{
"prod": {
"url": "https://registry.start9.com",
"name": "Embassy Marketplace"
},
"beta": {
"url": "https://beta-registry-0-3.start9labs.com",
"name": "Embassy Marketplace (Beta)"
},
"alpha": {
"url": "https://alpha-registry-0-3.start9labs.com",
"name": "Embassy Marketplace (Alpha)"
}
}

View File

@@ -1,27 +0,0 @@
// @ts-check
const fs = require('fs')
const childProcess = require('child_process')
const gitHash = String(childProcess.execSync('git rev-parse HEAD')).trim()
/**
* @template T
* @param {() => T} fn
* @param {T} defaultValue
* @returns
*/
function catchDefault(fn, defaultValue) {
try {
return fn()
} catch {
return defaultValue
}
}
const origConfig = catchDefault(
/** @returns {{gitHash?: string}} */
() => JSON.parse(fs.readFileSync('./config.json')),
{},
)
origConfig.gitHash = gitHash
fs.writeFileSync('./config.json', JSON.stringify(origConfig, null, 2))