mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
send id to marketplace
This commit is contained in:
committed by
Aiden McClelland
parent
184381b536
commit
840fa8d49b
@@ -283,8 +283,8 @@ export class AppComponent {
|
||||
if (
|
||||
ret.data.highScore &&
|
||||
(ret.data.highScore >
|
||||
this.patch.data.ui.gaming?.snake?.['high-score'] ||
|
||||
!this.patch.data.ui.gaming?.snake?.['high-score'])
|
||||
this.patch.getData().ui.gaming?.snake?.['high-score'] ||
|
||||
!this.patch.getData().ui.gaming?.snake?.['high-score'])
|
||||
) {
|
||||
const loader = await this.loadingCtrl.create({
|
||||
spinner: 'lines',
|
||||
@@ -331,13 +331,11 @@ export class AppComponent {
|
||||
break
|
||||
case ConnectionFailure.Tor:
|
||||
message = 'Browser unable to connect over Tor.'
|
||||
link =
|
||||
'https://start9.com/latest/support/common-issues'
|
||||
link = 'https://start9.com/latest/support/common-issues'
|
||||
break
|
||||
case ConnectionFailure.Lan:
|
||||
message = 'Embassy not found on Local Area Network.'
|
||||
link =
|
||||
'https://start9.com/latest/support/common-issues'
|
||||
link = 'https://start9.com/latest/support/common-issues'
|
||||
break
|
||||
}
|
||||
await this.presentToastOffline(message, link)
|
||||
|
||||
@@ -36,8 +36,8 @@ export class SnakePage {
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.patch.data.ui.gaming?.snake?.['high-score']) {
|
||||
this.highScore = this.patch.data.ui.gaming?.snake?.['high-score']
|
||||
if (this.patch.getData().ui.gaming?.snake?.['high-score']) {
|
||||
this.highScore = this.patch.getData().ui.gaming?.snake?.['high-score']
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,9 @@ export class MarketplaceService {
|
||||
async load(): Promise<void> {
|
||||
try {
|
||||
const [data, pkgs] = await Promise.all([
|
||||
this.getMarketplaceData({}),
|
||||
this.getMarketplaceData({
|
||||
'server-id': this.patch.getData()['server-info'].id,
|
||||
}),
|
||||
this.getMarketplacePkgs({ page: 1, 'per-page': 100 }),
|
||||
])
|
||||
this.data = data
|
||||
|
||||
@@ -90,7 +90,7 @@ export class MarketplacesPage {
|
||||
|
||||
async presentAction(id: string) {
|
||||
// no need to view actions if is selected marketplace
|
||||
if (id === this.patch.data.ui.marketplace['selected-id']) return
|
||||
if (id === this.patch.getData().ui.marketplace['selected-id']) return
|
||||
|
||||
const buttons: ActionSheetButton[] = [
|
||||
{
|
||||
@@ -125,7 +125,7 @@ export class MarketplacesPage {
|
||||
|
||||
private async connect(id: string): Promise<void> {
|
||||
const marketplace: UIMarketplaceData = JSON.parse(
|
||||
JSON.stringify(this.patch.data.ui.marketplace),
|
||||
JSON.stringify(this.patch.getData().ui.marketplace),
|
||||
)
|
||||
|
||||
const url = id
|
||||
@@ -140,7 +140,10 @@ export class MarketplacesPage {
|
||||
await loader.present()
|
||||
|
||||
try {
|
||||
await this.marketplaceService.getMarketplaceData({}, url)
|
||||
await this.marketplaceService.getMarketplaceData(
|
||||
{ 'server-id': this.patch.getData()['server-info'].id },
|
||||
url,
|
||||
)
|
||||
} catch (e) {
|
||||
this.errToast.present(e)
|
||||
loader.dismiss()
|
||||
@@ -171,7 +174,7 @@ export class MarketplacesPage {
|
||||
private async delete(id: string): Promise<void> {
|
||||
if (!id) return
|
||||
const marketplace: UIMarketplaceData = JSON.parse(
|
||||
JSON.stringify(this.patch.data.ui.marketplace),
|
||||
JSON.stringify(this.patch.getData().ui.marketplace),
|
||||
)
|
||||
|
||||
const loader = await this.loadingCtrl.create({
|
||||
@@ -192,9 +195,9 @@ export class MarketplacesPage {
|
||||
}
|
||||
|
||||
private async save(url: string): Promise<void> {
|
||||
const marketplace = this.patch.data.ui.marketplace
|
||||
const marketplace = this.patch.getData().ui.marketplace
|
||||
? (JSON.parse(
|
||||
JSON.stringify(this.patch.data.ui.marketplace),
|
||||
JSON.stringify(this.patch.getData().ui.marketplace),
|
||||
) as UIMarketplaceData)
|
||||
: { 'selected-id': undefined, 'known-hosts': {} }
|
||||
|
||||
@@ -212,7 +215,10 @@ export class MarketplacesPage {
|
||||
|
||||
try {
|
||||
const id = v4()
|
||||
const { name } = await this.marketplaceService.getMarketplaceData({}, url)
|
||||
const { name } = await this.marketplaceService.getMarketplaceData(
|
||||
{ 'server-id': this.patch.getData()['server-info'].id },
|
||||
url,
|
||||
)
|
||||
marketplace['known-hosts'][id] = { name, url }
|
||||
} catch (e) {
|
||||
this.errToast.present(e)
|
||||
@@ -232,9 +238,11 @@ export class MarketplacesPage {
|
||||
}
|
||||
|
||||
private async saveAndConnect(url: string): Promise<void> {
|
||||
const marketplace = this.patch.data.ui.marketplace
|
||||
await this.save(url)
|
||||
|
||||
const marketplace = this.patch.getData().ui.marketplace
|
||||
? (JSON.parse(
|
||||
JSON.stringify(this.patch.data.ui.marketplace),
|
||||
JSON.stringify(this.patch.getData().ui.marketplace),
|
||||
) as UIMarketplaceData)
|
||||
: { 'selected-id': undefined, 'known-hosts': {} }
|
||||
|
||||
@@ -251,7 +259,10 @@ export class MarketplacesPage {
|
||||
|
||||
try {
|
||||
const id = v4()
|
||||
const { name } = await this.marketplaceService.getMarketplaceData({}, url)
|
||||
const { name } = await this.marketplaceService.getMarketplaceData(
|
||||
{ 'server-id': this.patch.getData()['server-info'].id },
|
||||
url,
|
||||
)
|
||||
marketplace['known-hosts'][id] = { name, url }
|
||||
marketplace['selected-id'] = id
|
||||
} catch (e) {
|
||||
@@ -270,7 +281,7 @@ export class MarketplacesPage {
|
||||
return
|
||||
}
|
||||
|
||||
loader.message = 'Syncing store...'
|
||||
loader.message = 'Syncing marketplace data...'
|
||||
|
||||
try {
|
||||
await this.marketplaceService.load()
|
||||
|
||||
@@ -121,7 +121,7 @@ export class ServerShowPage {
|
||||
}
|
||||
|
||||
async presentAlertSystemRebuild() {
|
||||
const minutes = Object.keys(this.patch.data['package-data']).length * 2
|
||||
const minutes = Object.keys(this.patch.getData()['package-data']).length * 2
|
||||
const alert = await this.alertCtrl.create({
|
||||
header: 'System Rebuild',
|
||||
message: new IonicSafeString(
|
||||
|
||||
@@ -242,7 +242,7 @@ export module RR {
|
||||
|
||||
// marketplace
|
||||
|
||||
export type GetMarketplaceDataReq = { url?: string }
|
||||
export type GetMarketplaceDataReq = { 'server-id': string }
|
||||
export type GetMarketplaceDataRes = MarketplaceData
|
||||
|
||||
export type GetMarketplaceEOSReq = {
|
||||
|
||||
@@ -26,7 +26,7 @@ export class EOSService {
|
||||
const updateAvailable =
|
||||
this.emver.compare(
|
||||
this.eos.version,
|
||||
this.patch.data['server-info'].version,
|
||||
this.patch.getData()['server-info'].version,
|
||||
) === 1
|
||||
this.updateAvailable$.next(updateAvailable)
|
||||
return updateAvailable
|
||||
|
||||
Reference in New Issue
Block a user