Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,14 @@ export class MarketplaceShowPage {

readonly flavors$ = this.route.queryParamMap.pipe(
switchMap(paramMap =>
this.marketplaceService
.getSelectedStore$()
.pipe(
map(s =>
s.packages.filter(
p => p.id === this.pkgId && p.flavor !== paramMap.get('flavor'),
),
this.marketplaceService.getSelectedStore$().pipe(
map(s =>
s.packages.filter(
p => p.id === this.pkgId && p.flavor !== paramMap.get('flavor'),
),
),
filter(p => p.length > 0),
),
),
)

Expand Down
3 changes: 2 additions & 1 deletion web/projects/ui/src/app/services/api/mock-patch.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { DataModel } from 'src/app/services/patch-db/data-model'
import { Mock } from './api.fixures'
import { BUILT_IN_WIDGETS } from '../../pages/widgets/built-in/widgets'
const version = require('../../../../../../package.json').version

export const mockPatchData: DataModel = {
ui: {
Expand Down Expand Up @@ -37,7 +38,7 @@ export const mockPatchData: DataModel = {
arch: 'x86_64',
onionAddress: 'myveryownspecialtoraddress',
id: 'abcdefgh',
version: '0.3.6',
version,
lastBackup: new Date(new Date().valueOf() - 604800001).toISOString(),
lanAddress: 'https://adjective-noun.local',
torAddress: 'https://myveryownspecialtoraddress.onion',
Expand Down
52 changes: 28 additions & 24 deletions web/projects/ui/src/app/services/marketplace.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class MarketplaceService implements AbstractMarketplaceService {
private readonly knownHosts$: Observable<StoreIdentity[]> = this.patch
.watch$('ui', 'marketplace', 'knownHosts')
.pipe(
map(hosts => {
map((hosts: { [url: string]: UIStore }) => {
const { start9, community } = this.config.marketplace
let arr = [
toStoreIdentity(start9, hosts[start9]),
Expand Down Expand Up @@ -81,31 +81,35 @@ export class MarketplaceService implements AbstractMarketplaceService {
shareReplay({ bufferSize: 1, refCount: true }),
)

private readonly marketplace$ = this.knownHosts$.pipe(
startWith<StoreIdentity[]>([]),
pairwise(),
mergeMap(([prev, curr]) =>
curr.filter(c => !prev.find(p => sameUrl(c.url, p.url))),
),
mergeMap(({ url, name }) =>
this.fetchStore$(url).pipe(
tap(data => {
if (data?.info.name) this.updateStoreName(url, name, data.info.name)
}),
map<StoreData | null, [string, StoreData | null]>(data => [url, data]),
startWith<[string, StoreData | null]>([url, null]),
private readonly marketplace$: Observable<Marketplace> =
this.knownHosts$.pipe(
startWith<StoreIdentity[]>([]),
pairwise(),
mergeMap(([prev, curr]) =>
curr.filter(c => !prev.find(p => sameUrl(c.url, p.url))),
),
),
scan<[string, StoreData | null], Record<string, StoreData | null>>(
(requests, [url, store]) => {
requests[url] = store
mergeMap(({ url, name }) =>
this.fetchStore$(url).pipe(
tap(data => {
if (data?.info.name) this.updateStoreName(url, name, data.info.name)
}),
map<StoreData | null, [string, StoreData | null]>(data => [
url,
data,
]),
startWith<[string, StoreData | null]>([url, null]),
),
),
scan<[string, StoreData | null], Record<string, StoreData | null>>(
(requests, [url, store]) => {
requests[url] = store

return requests
},
{},
),
shareReplay({ bufferSize: 1, refCount: true }),
)
return requests
},
{},
),
shareReplay({ bufferSize: 1, refCount: true }),
)

private readonly filteredMarketplace$ = combineLatest([
this.clientStorageService.showDevTools$,
Expand Down