mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-01 21:13:09 +00:00
feat: enable strictNullChecks
feat: enable `noImplicitAny` chore: remove sync data access fix loading package data for affected dependencies chore: properly get alt marketplace data update patchdb client to allow for emit on undefined values
This commit is contained in:
@@ -15,7 +15,7 @@ import { HttpError, RpcError } from '@start9labs/shared'
|
||||
})
|
||||
export class HttpService {
|
||||
fullUrl: string
|
||||
productKey: string
|
||||
productKey?: string
|
||||
|
||||
constructor(private readonly http: HttpClient) {
|
||||
const port = window.location.port
|
||||
@@ -43,6 +43,8 @@ export class HttpService {
|
||||
}
|
||||
|
||||
if (isRpcSuccess(res)) return res.result
|
||||
|
||||
throw new Error('Unknown RPC response')
|
||||
}
|
||||
|
||||
async encryptedHttpRequest<T>(httpOpts: {
|
||||
@@ -53,7 +55,7 @@ export class HttpService {
|
||||
const url = urlIsRelative ? this.fullUrl + httpOpts.url : httpOpts.url
|
||||
|
||||
const encryptedBody = await AES_CTR.encryptPbkdf2(
|
||||
this.productKey,
|
||||
this.productKey || '',
|
||||
encodeUtf8(JSON.stringify(httpOpts.body)),
|
||||
)
|
||||
const options = {
|
||||
@@ -74,7 +76,7 @@ export class HttpService {
|
||||
.toPromise()
|
||||
.then(res =>
|
||||
AES_CTR.decryptPbkdf2(
|
||||
this.productKey,
|
||||
this.productKey || '',
|
||||
(res as any).body as ArrayBuffer,
|
||||
),
|
||||
)
|
||||
@@ -206,7 +208,7 @@ type AES_CTR = {
|
||||
secretKey: string,
|
||||
messageBuffer: Uint8Array,
|
||||
) => Promise<Uint8Array>
|
||||
decryptPbkdf2: (secretKey, arr: ArrayBuffer) => Promise<string>
|
||||
decryptPbkdf2: (secretKey: string, arr: ArrayBuffer) => Promise<string>
|
||||
}
|
||||
|
||||
export const AES_CTR: AES_CTR = {
|
||||
@@ -243,8 +245,10 @@ export const AES_CTR: AES_CTR = {
|
||||
|
||||
export const encode16 = (buffer: Uint8Array) =>
|
||||
buffer.reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '')
|
||||
export const decode16 = hexString =>
|
||||
new Uint8Array(hexString.match(/.{1,2}/g).map(byte => parseInt(byte, 16)))
|
||||
export const decode16 = (hexString: string) =>
|
||||
new Uint8Array(
|
||||
hexString.match(/.{1,2}/g)?.map(byte => parseInt(byte, 16)) || [],
|
||||
)
|
||||
|
||||
export function encodeUtf8(str: string): Uint8Array {
|
||||
const encoder = new TextEncoder()
|
||||
|
||||
@@ -43,7 +43,7 @@ export class LiveApiService extends ApiService {
|
||||
)
|
||||
}
|
||||
|
||||
async set02XDrive(logicalname) {
|
||||
async set02XDrive(logicalname: string) {
|
||||
return this.http.rpcRequest<void>(
|
||||
{
|
||||
method: 'setup.recovery.v2.set',
|
||||
@@ -124,7 +124,7 @@ export class LiveApiService extends ApiService {
|
||||
}
|
||||
|
||||
function isCifsSource(
|
||||
source: CifsRecoverySource | DiskRecoverySource | undefined,
|
||||
source: CifsRecoverySource | DiskRecoverySource | null,
|
||||
): source is CifsRecoverySource {
|
||||
return !!(source as CifsRecoverySource)?.hostname
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ export class StateService {
|
||||
embassyLoaded = false
|
||||
|
||||
recoverySource: CifsRecoverySource | DiskRecoverySource
|
||||
recoveryPassword: string
|
||||
recoveryPassword?: string
|
||||
|
||||
dataTransferProgress: {
|
||||
bytesTransferred: number
|
||||
|
||||
Reference in New Issue
Block a user