remove sourceVersion and minor cleanup

This commit is contained in:
Matt Hill
2024-07-29 22:42:17 -06:00
parent 1dd21f1f76
commit 290a15bbd9
6 changed files with 10 additions and 16 deletions

View File

@@ -3,7 +3,6 @@ import { T } from '@start9labs/start-sdk'
export type GetPackageReq = { export type GetPackageReq = {
id: string id: string
version: string | null version: string | null
sourceVersion: null // @TODO what is this?
otherVersions: 'short' otherVersions: 'short'
} }
export type GetPackageRes = T.GetPackageResponse & { export type GetPackageRes = T.GetPackageResponse & {
@@ -13,9 +12,9 @@ export type GetPackageRes = T.GetPackageResponse & {
export type GetPackagesReq = { export type GetPackagesReq = {
id: null id: null
version: null version: null
sourceVersion: null
otherVersions: 'short' otherVersions: 'short'
} }
export type GetPackagesRes = { export type GetPackagesRes = {
[id: T.PackageId]: GetPackageRes [id: T.PackageId]: GetPackageRes
} }

View File

@@ -58,9 +58,7 @@ export class InitService extends Observable<MappedProgress> {
} }
}), }),
catchError(e => { catchError(e => {
// @TODO Alex this toast is presenting when we navigate away from init page. It seems other websockets exhibit the same behavior, but we never noticed because the error were not being caught and presented in this manner. It seems odd that unsubscribing from a websocket subject would be treated as an error. console.error(e)
// this.errorService.handleError(e)
return EMPTY return EMPTY
}), }),
) )

View File

@@ -138,8 +138,8 @@ export class SideloadPage {
).getUint32(0, false) ).getUint32(0, false)
await getPositions(start, end, file, positions, tocLength as any) await getPositions(start, end, file, positions, tocLength as any)
await this.getManifest(positions, file) await this.getManifestV1(positions, file)
await this.getIcon(positions, file) await this.getIconV1(positions, file)
} }
async parseS9pkV2(file: File) { async parseS9pkV2(file: File) {
@@ -148,7 +148,7 @@ export class SideloadPage {
this.toUpload.icon = await s9pk.icon() this.toUpload.icon = await s9pk.icon()
} }
async getManifest(positions: Positions, file: Blob) { private async getManifestV1(positions: Positions, file: Blob) {
const data = await blobToBuffer( const data = await blobToBuffer(
file.slice( file.slice(
Number(positions['manifest'][0]), Number(positions['manifest'][0]),
@@ -158,12 +158,11 @@ export class SideloadPage {
this.toUpload.manifest = await cbor.decode(data, true) this.toUpload.manifest = await cbor.decode(data, true)
} }
async getIcon(positions: Positions, file: Blob) { private async getIconV1(positions: Positions, file: Blob) {
const contentType = '' // @TODO
const data = file.slice( const data = file.slice(
Number(positions['icon'][0]), Number(positions['icon'][0]),
Number(positions['icon'][0]) + Number(positions['icon'][1]), Number(positions['icon'][0]) + Number(positions['icon'][1]),
contentType, '',
) )
this.toUpload.icon = await blobToDataURL(data) this.toUpload.icon = await blobToDataURL(data)
} }

View File

@@ -38,7 +38,7 @@ export class LiveApiService extends ApiService {
@Inject(PATCH_CACHE) private readonly cache$: Observable<Dump<DataModel>>, @Inject(PATCH_CACHE) private readonly cache$: Observable<Dump<DataModel>>,
) { ) {
super() super()
;(window as any).rpcClient = this ; (window as any).rpcClient = this
} }
// for sideloading packages // for sideloading packages
@@ -321,7 +321,6 @@ export class LiveApiService extends ApiService {
const params: GetPackageReq = { const params: GetPackageReq = {
id, id,
version: versionRange, version: versionRange,
sourceVersion: null,
otherVersions: 'short', otherVersions: 'short',
} }
@@ -335,7 +334,6 @@ export class LiveApiService extends ApiService {
const params: GetPackagesReq = { const params: GetPackagesReq = {
id: null, id: null,
version: null, version: null,
sourceVersion: null,
otherVersions: 'short', otherVersions: 'short',
} }

View File

@@ -41,7 +41,7 @@ export class PatchDbSource extends Observable<Update<DataModel>[]> {
catchError((_, original$) => { catchError((_, original$) => {
this.state.retrigger() this.state.retrigger()
// @TODO this is returning right away, but we need to wait until state emits again from the retrigger() above. // @TODO Alex this is returning right away and crashing the browser, but we need to wait until state emits again from the retrigger() above.
return this.state.pipe( return this.state.pipe(
filter(current => current === 'running'), filter(current => current === 'running'),
take(1), take(1),

View File

@@ -111,7 +111,7 @@ export class StateService extends Observable<RR.ServerState | null> {
), ),
), ),
) )
.subscribe() // @TODO shouldn't this be subscribed in app component with the others? Do we ever need to unsubscribe? .subscribe() // @TODO Alex shouldn't this be subscribed in app component with the others? Do we ever need to unsubscribe?
constructor() { constructor() {
super(subscriber => this.stream$.subscribe(subscriber)) super(subscriber => this.stream$.subscribe(subscriber))