mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
eos-version-compat
This commit is contained in:
committed by
Aiden McClelland
parent
bb72bdb9d1
commit
221d99bfee
@@ -4,6 +4,7 @@ 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'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
@@ -19,14 +20,14 @@ export class MarketplaceService {
|
||||
constructor (
|
||||
private readonly api: ApiService,
|
||||
private readonly emver: Emver,
|
||||
private readonly config: ConfigService,
|
||||
private readonly patch: PatchDbService,
|
||||
) { }
|
||||
|
||||
async load (): Promise<void> {
|
||||
const [data, eos, pkgs] = await Promise.all([
|
||||
this.api.getMarketplaceData({ }),
|
||||
this.api.getEos({
|
||||
'eos-version': this.config.version,
|
||||
'eos-version-compat': this.patch.data['server-info']['eos-version-compat'],
|
||||
}),
|
||||
this.getPkgs(1, 100),
|
||||
])
|
||||
@@ -39,7 +40,7 @@ export class MarketplaceService {
|
||||
const idAndCurrentVersions = Object.keys(localPkgs).map(key => ({ id: key, version: localPkgs[key].manifest.version }))
|
||||
const latestPkgs = await this.api.getMarketplacePkgs({
|
||||
ids: idAndCurrentVersions,
|
||||
'eos-version': this.config.version,
|
||||
'eos-version-compat': this.patch.data['server-info']['eos-version-compat'],
|
||||
})
|
||||
|
||||
return latestPkgs.filter(latestPkg => {
|
||||
@@ -52,7 +53,7 @@ export class MarketplaceService {
|
||||
async getPkg (id: string, version?: string): Promise<MarketplacePkg> {
|
||||
const pkgs = await this.api.getMarketplacePkgs({
|
||||
ids: [{ id, version: version || '*' }],
|
||||
'eos-version': this.config.version,
|
||||
'eos-version-compat': this.patch.data['server-info']['eos-version-compat'],
|
||||
})
|
||||
const pkg = pkgs.find(pkg => pkg.manifest.id == id)
|
||||
|
||||
@@ -71,7 +72,7 @@ export class MarketplaceService {
|
||||
const pkgs = await this.api.getMarketplacePkgs({
|
||||
page: String(page),
|
||||
'per-page': String(perPage),
|
||||
'eos-version': this.config.version,
|
||||
'eos-version-compat': this.patch.data['server-info']['eos-version-compat'],
|
||||
})
|
||||
|
||||
return pkgs
|
||||
|
||||
@@ -194,14 +194,14 @@ export module RR {
|
||||
export type GetMarketplaceDataRes = MarketplaceData
|
||||
|
||||
export type GetMarketplaceEOSReq = {
|
||||
'eos-version': string
|
||||
'eos-version-compat': string
|
||||
}
|
||||
export type GetMarketplaceEOSRes = MarketplaceEOS
|
||||
|
||||
export type GetMarketplacePackagesReq = {
|
||||
ids?: { id: string, version: string }[]
|
||||
// iff !id
|
||||
'eos-version': string
|
||||
'eos-version-compat': string
|
||||
category?: string
|
||||
query?: string
|
||||
page?: string
|
||||
|
||||
@@ -30,6 +30,7 @@ export interface ServerInfo {
|
||||
size: number
|
||||
downloaded: number
|
||||
}
|
||||
'eos-version-compat': string
|
||||
}
|
||||
|
||||
export enum ServerStatus {
|
||||
|
||||
@@ -116,7 +116,7 @@ export class StartupAlertsService {
|
||||
|
||||
private async osUpdateCheck (): Promise<RR.GetMarketplaceEOSRes | undefined> {
|
||||
const res = await this.api.getEos({
|
||||
'eos-version': this.config.version,
|
||||
'eos-version-compat': this.patch.data['server-info']['eos-version-compat'],
|
||||
})
|
||||
|
||||
if (this.emver.compare(this.config.version, res.version) === -1) {
|
||||
|
||||
Reference in New Issue
Block a user