mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-02 05:23:14 +00:00
Merge branch 'next' of github.com:Start9Labs/start-os into rebase/integration/refactors
This commit is contained in:
@@ -19,7 +19,7 @@ Check your versions
|
||||
|
||||
```sh
|
||||
node --version
|
||||
v16.10.0
|
||||
v18.15.0
|
||||
|
||||
npm --version
|
||||
v8.0.0
|
||||
|
||||
@@ -5,6 +5,7 @@ import { IonicModule } from '@ionic/angular'
|
||||
import { ServerSpecsPage } from './server-specs.page'
|
||||
import { EmverPipesModule } from '@start9labs/shared'
|
||||
import { TuiLetModule } from '@taiga-ui/cdk'
|
||||
import { QRComponentModule } from 'src/app/components/qr/qr.component.module'
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@@ -18,6 +19,7 @@ const routes: Routes = [
|
||||
CommonModule,
|
||||
IonicModule,
|
||||
RouterModule.forChild(routes),
|
||||
QRComponentModule,
|
||||
EmverPipesModule,
|
||||
TuiLetModule,
|
||||
],
|
||||
|
||||
@@ -36,6 +36,9 @@
|
||||
<ion-button fill="clear" (click)="launch(torAddress)">
|
||||
<ion-icon slot="icon-only" name="open-outline"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button fill="clear" (click)="showQR(torAddress)">
|
||||
<ion-icon slot="icon-only" name="qr-code-outline"></ion-icon>
|
||||
</ion-button>
|
||||
<ion-button fill="clear" (click)="copy(torAddress)">
|
||||
<ion-icon slot="icon-only" name="copy-outline"></ion-icon>
|
||||
</ion-button>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { ChangeDetectionStrategy, Component } from '@angular/core'
|
||||
import { ToastController } from '@ionic/angular'
|
||||
import { ModalController, ToastController } from '@ionic/angular'
|
||||
import { PatchDB } from 'patch-db-client'
|
||||
import { ConfigService } from 'src/app/services/config.service'
|
||||
import { QRComponent } from 'src/app/components/qr/qr.component'
|
||||
import { copyToClipboard } from '@start9labs/shared'
|
||||
import { DataModel } from 'src/app/services/patch-db/data-model'
|
||||
|
||||
@@ -16,6 +17,7 @@ export class ServerSpecsPage {
|
||||
|
||||
constructor(
|
||||
private readonly toastCtrl: ToastController,
|
||||
private readonly modalCtrl: ModalController,
|
||||
private readonly patch: PatchDB<DataModel>,
|
||||
private readonly config: ConfigService,
|
||||
) {}
|
||||
@@ -44,6 +46,17 @@ export class ServerSpecsPage {
|
||||
await toast.present()
|
||||
}
|
||||
|
||||
async showQR(text: string): Promise<void> {
|
||||
const modal = await this.modalCtrl.create({
|
||||
component: QRComponent,
|
||||
componentProps: {
|
||||
text,
|
||||
},
|
||||
cssClass: 'qr-modal',
|
||||
})
|
||||
await modal.present()
|
||||
}
|
||||
|
||||
asIsOrder(a: any, b: any) {
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -310,19 +310,14 @@ export module RR {
|
||||
|
||||
// marketplace
|
||||
|
||||
export type EnvInfo = {
|
||||
'server-id': string
|
||||
'eos-version': string
|
||||
}
|
||||
export type GetMarketplaceInfoReq = EnvInfo
|
||||
export type GetMarketplaceInfoReq = { 'server-id': string }
|
||||
export type GetMarketplaceInfoRes = StoreInfo
|
||||
|
||||
export type GetMarketplaceEosReq = EnvInfo
|
||||
export type GetMarketplaceEosReq = { 'server-id': string }
|
||||
export type GetMarketplaceEosRes = MarketplaceEOS
|
||||
|
||||
export type GetMarketplacePackagesReq = {
|
||||
ids?: { id: string; version: string }[]
|
||||
'eos-version-compat': string
|
||||
// iff !ids
|
||||
category?: string
|
||||
query?: string
|
||||
|
||||
@@ -127,7 +127,6 @@ export abstract class ApiService {
|
||||
path: string,
|
||||
params: Record<string, unknown>,
|
||||
url: string,
|
||||
arch?: string,
|
||||
): Promise<T>
|
||||
|
||||
abstract getEos(): Promise<RR.GetMarketplaceEosRes>
|
||||
|
||||
@@ -233,10 +233,7 @@ export class LiveApiService extends ApiService {
|
||||
path: string,
|
||||
qp: Record<string, string>,
|
||||
baseUrl: string,
|
||||
arch: string = this.config.packageArch,
|
||||
): Promise<T> {
|
||||
// Object.assign(qp, { arch })
|
||||
qp['arch'] = arch
|
||||
const fullUrl = `${baseUrl}${path}?${new URLSearchParams(qp).toString()}`
|
||||
return this.rpcRequest({
|
||||
method: 'marketplace.get',
|
||||
@@ -245,17 +242,13 @@ export class LiveApiService extends ApiService {
|
||||
}
|
||||
|
||||
async getEos(): Promise<RR.GetMarketplaceEosRes> {
|
||||
const { id, version } = await getServerInfo(this.patch)
|
||||
const qp: RR.GetMarketplaceEosReq = {
|
||||
'server-id': id,
|
||||
'eos-version': version,
|
||||
}
|
||||
const { id } = await getServerInfo(this.patch)
|
||||
const qp: RR.GetMarketplaceEosReq = { 'server-id': id }
|
||||
|
||||
return this.marketplaceProxy(
|
||||
'/eos/v0/latest',
|
||||
qp,
|
||||
this.config.marketplace.start9,
|
||||
this.config.osArch,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -363,7 +363,6 @@ export class MockApiService extends ApiService {
|
||||
path: string,
|
||||
params: Record<string, string>,
|
||||
url: string,
|
||||
arch = '',
|
||||
): Promise<any> {
|
||||
await pauseFor(2000)
|
||||
|
||||
|
||||
@@ -215,10 +215,7 @@ export class MarketplaceService implements AbstractMarketplaceService {
|
||||
return this.patch.watch$('server-info').pipe(
|
||||
take(1),
|
||||
switchMap(serverInfo => {
|
||||
const qp: RR.GetMarketplaceInfoReq = {
|
||||
'server-id': serverInfo.id,
|
||||
'eos-version': serverInfo.version,
|
||||
}
|
||||
const qp: RR.GetMarketplaceInfoReq = { 'server-id': serverInfo.id }
|
||||
return this.api.marketplaceProxy<RR.GetMarketplaceInfoRes>(
|
||||
'/package/v0/info',
|
||||
qp,
|
||||
@@ -272,28 +269,21 @@ export class MarketplaceService implements AbstractMarketplaceService {
|
||||
|
||||
private fetchPackages$(
|
||||
url: string,
|
||||
params: Omit<
|
||||
RR.GetMarketplacePackagesReq,
|
||||
'eos-version-compat' | 'page' | 'per-page'
|
||||
> = {},
|
||||
params: Omit<RR.GetMarketplacePackagesReq, 'page' | 'per-page'> = {},
|
||||
): Observable<MarketplacePkg[]> {
|
||||
return this.patch.watch$('server-info', 'eos-version-compat').pipe(
|
||||
take(1),
|
||||
switchMap(versionCompat => {
|
||||
const qp: RR.GetMarketplacePackagesReq = {
|
||||
...params,
|
||||
'eos-version-compat': versionCompat,
|
||||
page: 1,
|
||||
'per-page': 100,
|
||||
}
|
||||
if (qp.ids) qp.ids = JSON.stringify(qp.ids)
|
||||
const qp: RR.GetMarketplacePackagesReq = {
|
||||
...params,
|
||||
page: 1,
|
||||
'per-page': 100,
|
||||
}
|
||||
if (qp.ids) qp.ids = JSON.stringify(qp.ids)
|
||||
|
||||
return this.api.marketplaceProxy<RR.GetMarketplacePackagesRes>(
|
||||
'/package/v0/index',
|
||||
qp,
|
||||
url,
|
||||
)
|
||||
}),
|
||||
return from(
|
||||
this.api.marketplaceProxy<RR.GetMarketplacePackagesRes>(
|
||||
'/package/v0/index',
|
||||
qp,
|
||||
url,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user