no seeding marketplace"

dep icons

matt comments addressed

fix circular dependencies

Update marketplace.service.ts
This commit is contained in:
Drew Ansbacher
2022-02-02 15:13:08 -07:00
committed by Aiden McClelland
parent 0c0cd9d0a0
commit 01d766fce9
20 changed files with 250 additions and 209 deletions

View File

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

View File

@@ -1,39 +1,38 @@
import { Injectable } from "@angular/core"
import { HttpService } from "../http.service"
import { ApiService, GetErrorRes, GetLogsReq, GetLogsRes } from "./api.service"
import { Injectable } from '@angular/core'
import { HttpService } from '../http.service'
import { ApiService, GetErrorRes, GetLogsReq, GetLogsRes } from './api.service'
@Injectable()
export class LiveApiService extends ApiService {
constructor(private readonly http: HttpService) {
super()
}
constructor (
private readonly http: HttpService,
) { super() }
getError (): Promise<GetErrorRes> {
getError(): Promise<GetErrorRes> {
return this.http.rpcRequest<GetErrorRes>({
method: 'diagnostic.error',
params: { },
params: {},
})
}
restart (): Promise<void> {
restart(): Promise<void> {
return this.http.rpcRequest<void>({
method: 'diagnostic.restart',
params: { },
params: {},
})
}
forgetDrive (): Promise<void> {
forgetDrive(): Promise<void> {
return this.http.rpcRequest<void>({
method: 'diagnostic.forget-disk',
params: { },
params: {},
})
}
getLogs (params: GetLogsReq): Promise<GetLogsRes> {
getLogs(params: GetLogsReq): Promise<GetLogsRes> {
return this.http.rpcRequest<GetLogsRes>({
method: 'diagnostic.logs',
params,
})
}
}
}

View File

@@ -16,6 +16,9 @@ export type WorkspaceConfig = {
maskAs: 'tor' | 'lan'
skipStartupAlerts: boolean
}
eosMarketplaceURL: string
marketplace: {
url: string
name: string
}
}
}

View File

@@ -150,8 +150,6 @@ export class AppComponent {
.subscribe(data => {
// check for updates to EOS
this.checkForEosUpdate(data.ui)
// seed EOS marketplace as default for services too
this.seedMarketplace(data.ui.marketplace)
this.subscriptions = this.subscriptions.concat([
// watch status to present toast for updated state
@@ -224,26 +222,6 @@ export class AppComponent {
}
}
private async seedMarketplace(marketplace: UIMarketplaceData): Promise<void> {
if (
!marketplace ||
!marketplace['known-hosts'] ||
!marketplace['selected-id']
) {
const uuid = v4()
const value: UIMarketplaceData = {
'selected-id': uuid,
'known-hosts': {
[uuid]: {
url: this.config.eosMarketplaceUrl,
name: 'Start9 Embassy Marketplace',
},
},
}
await this.embassyApi.setDbValue({ pointer: '/marketplace', value })
}
}
// should wipe cache independant of actual BE logout
private async logout () {
this.embassyApi.logout({})

View File

@@ -13,7 +13,7 @@ import {
TruncateTailPipe,
} from '../pipes/truncate.pipe'
import { MaskPipe } from '../pipes/mask.pipe'
import { HasUiPipe, LaunchablePipe } from '../pipes/ui.pipe'
import { HasUiPipe, LaunchablePipe, SanitizePipe } from '../pipes/ui.pipe'
import { EmptyPipe } from '../pipes/empty.pipe'
import { NotificationColorPipe } from '../pipes/notification-color.pipe'
import { InstallState } from '../pipes/install-state.pipe'
@@ -42,6 +42,7 @@ import { InstallProgressPipe } from '../pipes/install-progress.pipe'
NotificationColorPipe,
ConvertBytesPipe,
DurationToSecondsPipe,
SanitizePipe,
],
imports: [TextSpinnerComponentModule],
exports: [
@@ -65,6 +66,7 @@ import { InstallProgressPipe } from '../pipes/install-progress.pipe'
DurationToSecondsPipe,
// components
TextSpinnerComponentModule,
SanitizePipe,
],
})
export class SharingModule {}

View File

@@ -15,18 +15,18 @@ export class AppReleaseNotes {
pkgId: string
loading = true
constructor (
constructor(
private readonly route: ActivatedRoute,
public marketplaceService: MarketplaceService,
public errToast: ErrorToastService,
) { }
) {}
async ngOnInit () {
async ngOnInit() {
this.pkgId = this.route.snapshot.paramMap.get('pkgId')
try {
const promises = []
if (!this.marketplaceService.releaseNotes[this.pkgId]) {
promises.push(this.marketplaceService.getReleaseNotes(this.pkgId))
promises.push(this.marketplaceService.cacheReleaseNotes(this.pkgId))
}
if (!this.marketplaceService.pkgs.length) {
promises.push(this.marketplaceService.load())
@@ -39,11 +39,11 @@ export class AppReleaseNotes {
}
}
ngAfterViewInit () {
ngAfterViewInit() {
this.content.scrollToPoint(undefined, 1)
}
setSelected (selected: string) {
setSelected(selected: string) {
if (this.selected === selected) {
this.selected = null
} else {
@@ -51,12 +51,12 @@ export class AppReleaseNotes {
}
}
getDocSize (selected: string) {
getDocSize(selected: string) {
const element = document.getElementById(selected)
return `${element.scrollHeight}px`
}
asIsOrder (a: any, b: any) {
asIsOrder(a: any, b: any) {
return 0
}
}

View File

@@ -122,9 +122,7 @@
<ion-col *ngFor="let pkg of pkgs" sizeXs="12" sizeSm="12" sizeMd="6">
<ion-item [routerLink]="['/marketplace', pkg.manifest.id]">
<ion-thumbnail slot="start">
<img
[src]="sanitizer.bypassSecurityTrustResourceUrl('data:image/png;base64,' + pkg.icon)"
/>
<img [src]="('data:image/png;base64,' + pkg.icon) | sanitize" />
</ion-thumbnail>
<ion-label>
<h2 style="font-family: 'Montserrat'; font-weight: bold">

View File

@@ -12,7 +12,6 @@ import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
import Fuse from 'fuse.js/dist/fuse.min.js'
import { exists, isEmptyObject } from 'src/app/util/misc.util'
import { filter, first } from 'rxjs/operators'
import { DomSanitizer } from '@angular/platform-browser'
const defaultOps = {
isCaseSensitive: false,
@@ -58,7 +57,6 @@ export class MarketplaceListPage {
private readonly errToast: ErrorToastService,
public readonly patch: PatchDbService,
public readonly marketplaceService: MarketplaceService,
public readonly sanitizer: DomSanitizer,
) {}
async ngOnInit() {

View File

@@ -18,9 +18,7 @@
<ion-row>
<ion-col sizeXs="12" sizeSm="12" sizeMd="9" sizeLg="9" sizeXl="9">
<div class="header">
<img
[src]="sanitizer.bypassSecurityTrustResourceUrl('data:image/png;base64,' + pkg.icon)"
/>
<img [src]="('data:image/png;base64,' + pkg.icon) | sanitize" />
<div class="header-text">
<h1 class="header-title">{{ pkg.manifest.title }}</h1>
<p class="header-version">
@@ -200,7 +198,7 @@
<ion-item [routerLink]="['/marketplace', dep.key]">
<ion-thumbnail slot="start">
<img
[src]="'/marketplace' + pkg['dependency-metadata'][dep.key].icon"
[src]="('data:image/png;base64,' + pkg['dependency-metadata'][dep.key].icon) | sanitize"
/>
</ion-thumbnail>
<ion-label>

View File

@@ -23,7 +23,6 @@ import { Subscription } from 'rxjs'
import { MarkdownPage } from 'src/app/modals/markdown/markdown.page'
import { ApiService } from 'src/app/services/api/embassy-api.service'
import { MarketplacePkg } from 'src/app/services/api/api.types'
import { DomSanitizer } from '@angular/platform-browser'
@Component({
selector: 'marketplace-show',
@@ -52,7 +51,6 @@ export class MarketplaceShowPage {
private readonly patch: PatchDbService,
private readonly embassyApi: ApiService,
private readonly marketplaceService: MarketplaceService,
public readonly sanitizer: DomSanitizer,
) {}
async ngOnInit() {

View File

@@ -1,6 +1,11 @@
import { Injectable } from '@angular/core'
import { MarketplaceData, MarketplacePkg } from 'src/app/services/api/api.types'
import {
MarketplaceData,
MarketplacePkg,
RR,
} from 'src/app/services/api/api.types'
import { ApiService } from 'src/app/services/api/embassy-api.service'
import { ConfigService } from 'src/app/services/config.service'
import { Emver } from 'src/app/services/emver.service'
import { PackageDataEntry } from 'src/app/services/patch-db/data-model'
import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
@@ -16,28 +21,43 @@ export class MarketplaceService {
[version: string]: string
}
} = {}
marketplaceUrl: string
constructor(
private readonly api: ApiService,
private readonly emver: Emver,
private readonly patch: PatchDbService,
private readonly config: ConfigService,
) {}
async init() {
this.patch.watch$('ui', 'marketplace').subscribe(marketplace => {
if (!marketplace || !marketplace['selected-id']) {
this.marketplaceUrl = this.config.marketplace.url
} else {
this.marketplaceUrl =
marketplace['known-hosts'][marketplace['selected-id']].url
}
})
}
async load(): Promise<void> {
try {
const [data, pkgs] = await Promise.all([
this.api.getMarketplaceData({}),
this.getMarketplaceData({}),
this.getPkgs(1, 100),
])
this.data = data
this.pkgs = pkgs
const { 'selected-id': selectedId, 'known-hosts': knownHosts } =
this.patch.getData().ui.marketplace
if (knownHosts[selectedId].name !== this.data.name) {
this.api.setDbValue({
pointer: `/marketplace/known-hosts/${selectedId}/name`,
value: this.data.name,
})
if (this.patch.getData().ui.marketplace?.['selected-id']) {
const { 'selected-id': selectedId, 'known-hosts': knownHosts } =
this.patch.getData().ui.marketplace
if (knownHosts[selectedId].name !== this.data.name) {
this.api.setDbValue({
pointer: `/marketplace/known-hosts/${selectedId}/name`,
value: this.data.name,
})
}
}
} catch (e) {
this.data = undefined
@@ -49,6 +69,11 @@ export class MarketplaceService {
async getUpdates(localPkgs: {
[id: string]: PackageDataEntry
}): Promise<MarketplacePkg[]> {
const id = this.patch.getData().ui.marketplace?.['selected-id']
const url = id
? this.patch.getData().ui.marketplace['known-hosts'][id].url
: this.config.marketplace.url
const idAndCurrentVersions = Object.keys(localPkgs)
.map(key => ({
id: key,
@@ -56,12 +81,9 @@ export class MarketplaceService {
marketplaceUrl: localPkgs[key].installed['marketplace-url'],
}))
.filter(pkg => {
return (
pkg.marketplaceUrl ===
this.patch.getData().ui.marketplace['known-hosts']['selected-id'].url
)
return pkg.marketplaceUrl === url
})
const latestPkgs = await this.api.getMarketplacePkgs({
const latestPkgs = await this.getMarketplacePkgs({
ids: idAndCurrentVersions,
'eos-version-compat':
this.patch.getData()['server-info']['eos-version-compat'],
@@ -75,7 +97,7 @@ export class MarketplaceService {
}
async getPkg(id: string, version = '*'): Promise<MarketplacePkg> {
const pkgs = await this.api.getMarketplacePkgs({
const pkgs = await this.getMarketplacePkgs({
ids: [{ id, version }],
'eos-version-compat':
this.patch.getData()['server-info']['eos-version-compat'],
@@ -89,15 +111,15 @@ export class MarketplaceService {
}
}
async getReleaseNotes(id: string): Promise<void> {
this.releaseNotes[id] = await this.api.getReleaseNotes({ id })
async cacheReleaseNotes(id: string): Promise<void> {
this.releaseNotes[id] = await this.getReleaseNotes({ id })
}
private async getPkgs(
page: number,
perPage: number,
): Promise<MarketplacePkg[]> {
const pkgs = await this.api.getMarketplacePkgs({
const pkgs = await this.getMarketplacePkgs({
page: String(page),
'per-page': String(perPage),
'eos-version-compat':
@@ -106,4 +128,36 @@ export class MarketplaceService {
return pkgs
}
async getMarketplaceData(
params: RR.GetMarketplaceDataReq,
url?: string,
): Promise<RR.GetMarketplaceDataRes> {
url = url || this.marketplaceUrl
return this.api.marketplaceProxy('/package/data', params, url)
}
async getMarketplacePkgs(
params: RR.GetMarketplacePackagesReq,
): Promise<RR.GetMarketplacePackagesRes> {
if (params.query) params.category = undefined
return this.api.marketplaceProxy(
'/package/index',
{
...params,
ids: JSON.stringify(params.ids),
},
this.marketplaceUrl,
)
}
async getReleaseNotes(
params: RR.GetReleaseNotesReq,
): Promise<RR.GetReleaseNotesRes> {
return this.api.marketplaceProxy(
'/package/release-notes',
params,
this.marketplaceUrl,
)
}
}

View File

@@ -20,31 +20,28 @@
</ion-item>
<ion-item
[button]="mp.key !== patch.data.ui.marketplace['selected-id']"
[button]="mp.id !== selectedId"
detail="false"
*ngFor="let mp of patch.data.ui.marketplace['known-hosts'] | keyvalue"
(click)="presentAction(mp.key)"
*ngFor="let mp of marketplaces"
(click)="presentAction(mp.id)"
>
<div
*ngIf="mp.key !== patch.data.ui.marketplace['selected-id']"
*ngIf="mp.id !== selectedId"
slot="start"
style="padding-right: 32px"
></div>
<ion-icon
*ngIf="mp.key === patch.data.ui.marketplace['selected-id']"
*ngIf="mp.id === selectedId"
slot="start"
size="large"
name="checkmark"
color="success"
></ion-icon>
<ion-label>
<h2>{{ mp.value.name }}</h2>
<p>{{ mp.value.url }}</p>
<h2>{{ mp.name }}</h2>
<p>{{ mp.url }}</p>
</ion-label>
<ion-note
*ngIf="mp.key === patch.data.ui.marketplace['selected-id']"
slot="end"
>
<ion-note *ngIf="mp.id === selectedId" slot="end">
<ion-text color="success">Selected</ion-text>
</ion-note>
</ion-item>

View File

@@ -21,6 +21,9 @@ import { ConfigService } from '../../../services/config.service'
styleUrls: ['marketplaces.page.scss'],
})
export class MarketplacesPage {
selectedId: string | undefined
marketplaces: { id: string | undefined; name: string; url: string }[] = []
constructor(
private readonly api: ApiService,
private readonly loadingCtrl: LoadingController,
@@ -32,6 +35,30 @@ export class MarketplacesPage {
public readonly patch: PatchDbService,
) {}
ngOnInit() {
this.patch.watch$('ui', 'marketplace').subscribe(mp => {
const marketplaces = [
{
id: undefined,
name: this.config.marketplace.name,
url: this.config.marketplace.url,
},
]
if (mp) {
this.selectedId = mp['selected-id']
const alts = Object.entries(mp['known-hosts']).map(([k, v]) => {
return {
id: k,
name: v.name,
url: v.url,
}
})
marketplaces.push.apply(marketplaces, alts)
}
this.marketplaces = marketplaces
})
}
async presentModalAdd() {
const marketplaceSpec = getMarketplaceValueSpec()
const modal = await this.modalCtrl.create({
@@ -82,6 +109,10 @@ export class MarketplacesPage {
},
]
if (!id) {
buttons.shift()
}
const action = await this.actionCtrl.create({
header: id,
subHeader: 'Manage marketplaces',
@@ -96,7 +127,10 @@ export class MarketplacesPage {
const marketplace: UIMarketplaceData = JSON.parse(
JSON.stringify(this.patch.data.ui.marketplace),
)
const newMarketplace = marketplace['known-hosts'][id]
const url = id
? marketplace['known-hosts'][id].url
: this.config.marketplace.url
const loader = await this.loadingCtrl.create({
spinner: 'lines',
@@ -106,10 +140,10 @@ export class MarketplacesPage {
await loader.present()
try {
await this.api.getMarketplaceData({}, newMarketplace.url)
await this.marketplaceService.getMarketplaceData({}, url)
} catch (e) {
this.errToast.present({
message: `Could not connect to ${newMarketplace.url}`,
message: `Could not connect to ${url}`,
} as any)
loader.dismiss()
return
@@ -139,6 +173,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),
)
@@ -161,14 +196,14 @@ export class MarketplacesPage {
}
private async save(url: string): Promise<void> {
const marketplace = JSON.parse(
JSON.stringify(this.patch.data.ui.marketplace),
) as UIMarketplaceData
const marketplace = this.patch.data.ui.marketplace
? (JSON.parse(
JSON.stringify(this.patch.data.ui.marketplace),
) as UIMarketplaceData)
: { 'selected-id': undefined, 'known-hosts': {} }
// no-op on duplicates
const currentUrls = Object.values(marketplace['known-hosts']).map(
u => new URL(u.url).hostname,
)
const currentUrls = this.marketplaces.map(mp => mp.url)
if (currentUrls.includes(new URL(url).hostname)) return
const loader = await this.loadingCtrl.create({
@@ -181,7 +216,7 @@ export class MarketplacesPage {
try {
const id = v4()
const { name } = await this.api.getMarketplaceData({}, url)
const { name } = await this.marketplaceService.getMarketplaceData({}, url)
marketplace['known-hosts'][id] = { name, url }
} catch (e) {
this.errToast.present({ message: `Could not connect to ${url}` } as any)
@@ -201,14 +236,14 @@ export class MarketplacesPage {
}
private async saveAndConnect(url: string): Promise<void> {
const marketplace = JSON.parse(
JSON.stringify(this.patch.data.ui.marketplace),
) as UIMarketplaceData
const marketplace = this.patch.data.ui.marketplace
? (JSON.parse(
JSON.stringify(this.patch.data.ui.marketplace),
) as UIMarketplaceData)
: { 'selected-id': undefined, 'known-hosts': {} }
// no-op on duplicates
const currentUrls = Object.values(marketplace['known-hosts']).map(
u => new URL(u.url).hostname,
)
const currentUrls = this.marketplaces.map(mp => mp.url)
if (currentUrls.includes(new URL(url).hostname)) return
const loader = await this.loadingCtrl.create({
@@ -220,7 +255,7 @@ export class MarketplacesPage {
try {
const id = v4()
const { name } = await this.api.getMarketplaceData({}, url)
const { name } = await this.marketplaceService.getMarketplaceData({}, url)
marketplace['known-hosts'][id] = { name, url }
marketplace['selected-id'] = id
} catch (e) {

View File

@@ -1,13 +1,17 @@
import { Pipe, PipeTransform } from '@angular/core'
import { InterfaceDef, PackageMainStatus, PackageState } from '../services/patch-db/data-model'
import {
InterfaceDef,
PackageMainStatus,
PackageState,
} from '../services/patch-db/data-model'
import { ConfigService, hasUi } from '../services/config.service'
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'
@Pipe({
name: 'hasUi',
})
export class HasUiPipe implements PipeTransform {
transform (interfaces: { [id: string]: InterfaceDef }): boolean {
transform(interfaces: { [id: string]: InterfaceDef }): boolean {
return hasUi(interfaces)
}
}
@@ -16,10 +20,24 @@ export class HasUiPipe implements PipeTransform {
name: 'isLaunchable',
})
export class LaunchablePipe implements PipeTransform {
constructor(private configService: ConfigService) {}
constructor (private configService: ConfigService) { }
transform (state: PackageState, status: PackageMainStatus, interfaces: { [id: string]: InterfaceDef }): boolean {
transform(
state: PackageState,
status: PackageMainStatus,
interfaces: { [id: string]: InterfaceDef },
): boolean {
return this.configService.isLaunchable(state, status, interfaces)
}
}
@Pipe({
name: 'sanitize',
})
export class SanitizePipe implements PipeTransform {
constructor(public readonly sanitizer: DomSanitizer) {}
transform(base64Icon: string): SafeResourceUrl {
return this.sanitizer.bypassSecurityTrustResourceUrl(base64Icon)
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -96,23 +96,16 @@ export abstract class ApiService implements Source<DataModel>, Http<DataModel> {
// marketplace URLs
abstract marketplaceProxy<T>(
path: string,
params: {},
url: string,
): Promise<T>
abstract getEos(
params: RR.GetMarketplaceEOSReq,
): Promise<RR.GetMarketplaceEOSRes>
abstract getMarketplaceData(
params: RR.GetMarketplaceDataReq,
url?: string,
): Promise<RR.GetMarketplaceDataRes>
abstract getMarketplacePkgs(
params: RR.GetMarketplacePackagesReq,
): Promise<RR.GetMarketplacePackagesRes>
abstract getReleaseNotes(
params: RR.GetReleaseNotesReq,
): Promise<RR.GetReleaseNotesRes>
// password
// abstract updatePassword (params: RR.UpdatePasswordReq): Promise<RR.UpdatePasswordRes>

View File

@@ -3,7 +3,6 @@ import { HttpService, Method } from '../http.service'
import { ApiService } from './embassy-api.service'
import { RR } from './api.types'
import { parsePropertiesPermissive } from 'src/app/util/properties.util'
import { PatchDbService } from '../patch-db/patch-db.service'
import { ConfigService } from '../config.service'
@Injectable()
@@ -12,14 +11,10 @@ export class LiveApiService extends ApiService {
constructor(
private readonly http: HttpService,
private readonly patch: PatchDbService,
private readonly config: ConfigService,
) {
super()
;(window as any).rpcClient = this
this.patch.watch$('ui', 'marketplace', 'selected-id').subscribe(id => {
this.marketplaceUrl = id
})
}
async getStatic(url: string): Promise<string> {
@@ -108,12 +103,7 @@ export class LiveApiService extends ApiService {
// marketplace URLs
private async marketplaceProxy<T>(
path: string,
params: {},
url?: string,
): Promise<T> {
url = url || this.marketplaceUrl
async marketplaceProxy<T>(path: string, params: {}, url: string): Promise<T> {
const fullURL = `${url}${path}?${new URLSearchParams(params).toString()}`
return this.http.rpcRequest({
method: 'marketplace.get',
@@ -127,33 +117,10 @@ export class LiveApiService extends ApiService {
return this.marketplaceProxy(
'/eos/latest',
params,
this.config.eosMarketplaceUrl,
this.config.marketplace.url,
)
}
async getMarketplaceData(
params: RR.GetMarketplaceDataReq,
url?: string,
): Promise<RR.GetMarketplaceDataRes> {
return this.marketplaceProxy('/package/data', params, url)
}
async getMarketplacePkgs(
params: RR.GetMarketplacePackagesReq,
): Promise<RR.GetMarketplacePackagesRes> {
if (params.query) params.category = undefined
return this.marketplaceProxy('/package/index', {
...params,
ids: JSON.stringify(params.ids),
})
}
async getReleaseNotes(
params: RR.GetReleaseNotesReq,
): Promise<RR.GetReleaseNotesRes> {
return this.marketplaceProxy('/package/release-notes', params)
}
// password
// async updatePassword (params: RR.UpdatePasswordReq): Promise<RR.UpdatePasswordRes> {
// return this.http.rpcRequest({ method: 'password.set', params })

View File

@@ -188,6 +188,29 @@ export class MockApiService extends ApiService {
// marketplace URLs
async marketplaceProxy (path: string, params: {}, url: string): Promise<any> {
await pauseFor(2000)
if (path === '/package/data') {
return {
name: 'Dark9',
categories: [
'featured',
'bitcoin',
'lightning',
'data',
'messaging',
'social',
'alt coin',
],
}
} else if (path === '/package/index') {
return Mock.MarketplacePkgsList
} else if (path === '/package/release-notes') {
return Mock.ReleaseNotes
}
}
async getEos (
params: RR.GetMarketplaceEOSReq,
): Promise<RR.GetMarketplaceEOSRes> {
@@ -195,39 +218,6 @@ export class MockApiService extends ApiService {
return Mock.MarketplaceEos
}
async getMarketplaceData (
params: RR.GetMarketplaceDataReq,
url?: string,
): Promise<RR.GetMarketplaceDataRes> {
await pauseFor(2000)
return {
name: 'Dark9',
categories: [
'featured',
'bitcoin',
'lightning',
'data',
'messaging',
'social',
'alt coin',
],
}
}
async getMarketplacePkgs (
params: RR.GetMarketplacePackagesReq,
): Promise<RR.GetMarketplacePackagesRes> {
await pauseFor(2000)
return Mock.MarketplacePkgsList
}
async getReleaseNotes (
params: RR.GetReleaseNotesReq,
): Promise<RR.GetReleaseNotesRes> {
await pauseFor(2000)
return Mock.ReleaseNotes
}
// password
// async updatePassword (params: RR.UpdatePasswordReq): Promise<RR.UpdatePasswordRes> {
// await pauseFor(2000)

View File

@@ -9,7 +9,7 @@ import { WorkspaceConfig } from '@shared'
const {
useMocks,
ui: { gitHash, patchDb, api, mocks, eosMarketplaceURL },
ui: { gitHash, patchDb, api, mocks, marketplace },
} = require('../../../../../config.json') as WorkspaceConfig
@Injectable({
@@ -25,7 +25,7 @@ export class ConfigService {
gitHash = gitHash
patchDb = patchDb
api = api
eosMarketplaceUrl = eosMarketplaceURL
marketplace = marketplace
skipStartupAlerts = useMocks && mocks.skipStartupAlerts
isConsulate = window['platform'] === 'ios'