mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 22:39:46 +00:00
dont send undefined qp to registry
This commit is contained in:
committed by
Aiden McClelland
parent
57c9d0bca1
commit
2c04990f72
@@ -46,7 +46,7 @@ export class MarketplaceService {
|
|||||||
try {
|
try {
|
||||||
const [data, pkgs] = await Promise.all([
|
const [data, pkgs] = await Promise.all([
|
||||||
this.getMarketplaceData({}),
|
this.getMarketplaceData({}),
|
||||||
this.getPkgs(1, 100),
|
this.getMarketplacePkgs({ page: 1, 'per-page': 100 }),
|
||||||
])
|
])
|
||||||
this.data = data
|
this.data = data
|
||||||
this.pkgs = pkgs
|
this.pkgs = pkgs
|
||||||
@@ -86,8 +86,6 @@ export class MarketplaceService {
|
|||||||
})
|
})
|
||||||
const latestPkgs = await this.getMarketplacePkgs({
|
const latestPkgs = await this.getMarketplacePkgs({
|
||||||
ids: idAndCurrentVersions,
|
ids: idAndCurrentVersions,
|
||||||
'eos-version-compat':
|
|
||||||
this.patch.getData()['server-info']['eos-version-compat'],
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return latestPkgs.filter(latestPkg => {
|
return latestPkgs.filter(latestPkg => {
|
||||||
@@ -100,8 +98,6 @@ export class MarketplaceService {
|
|||||||
async getPkg(id: string, version = '*'): Promise<MarketplacePkg> {
|
async getPkg(id: string, version = '*'): Promise<MarketplacePkg> {
|
||||||
const pkgs = await this.getMarketplacePkgs({
|
const pkgs = await this.getMarketplacePkgs({
|
||||||
ids: [{ id, version }],
|
ids: [{ id, version }],
|
||||||
'eos-version-compat':
|
|
||||||
this.patch.getData()['server-info']['eos-version-compat'],
|
|
||||||
})
|
})
|
||||||
const pkg = pkgs.find(pkg => pkg.manifest.id == id)
|
const pkg = pkgs.find(pkg => pkg.manifest.id == id)
|
||||||
|
|
||||||
@@ -116,20 +112,6 @@ export class MarketplaceService {
|
|||||||
this.releaseNotes[id] = await this.getReleaseNotes({ id })
|
this.releaseNotes[id] = await this.getReleaseNotes({ id })
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getPkgs(
|
|
||||||
page: number,
|
|
||||||
perPage: number,
|
|
||||||
): Promise<MarketplacePkg[]> {
|
|
||||||
const pkgs = await this.getMarketplacePkgs({
|
|
||||||
page: String(page),
|
|
||||||
'per-page': String(perPage),
|
|
||||||
'eos-version-compat':
|
|
||||||
this.patch.getData()['server-info']['eos-version-compat'],
|
|
||||||
})
|
|
||||||
|
|
||||||
return pkgs
|
|
||||||
}
|
|
||||||
|
|
||||||
async getMarketplaceData(
|
async getMarketplaceData(
|
||||||
params: RR.GetMarketplaceDataReq,
|
params: RR.GetMarketplaceDataReq,
|
||||||
url?: string,
|
url?: string,
|
||||||
@@ -139,15 +121,20 @@ export class MarketplaceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async getMarketplacePkgs(
|
async getMarketplacePkgs(
|
||||||
params: RR.GetMarketplacePackagesReq,
|
params: Omit<RR.GetMarketplacePackagesReq, 'eos-version-compat'>,
|
||||||
): Promise<RR.GetMarketplacePackagesRes> {
|
): Promise<RR.GetMarketplacePackagesRes> {
|
||||||
if (params.query) params.category = undefined
|
if (params.query) delete params.category
|
||||||
|
if (params.ids) params.ids = JSON.stringify(params.ids) as any
|
||||||
|
|
||||||
|
const qp: RR.GetMarketplacePackagesReq = {
|
||||||
|
...params,
|
||||||
|
'eos-version-compat':
|
||||||
|
this.patch.getData()['server-info']['eos-version-compat'],
|
||||||
|
}
|
||||||
|
|
||||||
return this.api.marketplaceProxy(
|
return this.api.marketplaceProxy(
|
||||||
'/package/v0/index',
|
'/package/v0/index',
|
||||||
{
|
qp,
|
||||||
...params,
|
|
||||||
ids: JSON.stringify(params.ids),
|
|
||||||
},
|
|
||||||
this.marketplaceUrl,
|
this.marketplaceUrl,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -257,8 +257,8 @@ export module RR {
|
|||||||
// iff !ids
|
// iff !ids
|
||||||
category?: string
|
category?: string
|
||||||
query?: string
|
query?: string
|
||||||
page?: string
|
page?: number
|
||||||
'per-page'?: string
|
'per-page'?: number
|
||||||
}
|
}
|
||||||
export type GetMarketplacePackagesRes = MarketplacePkg[]
|
export type GetMarketplacePackagesRes = MarketplacePkg[]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user