mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
* remove product key flow from setup * feat: backend turned off encryption + new Id + no package id * implement new encryption scheme in FE * decode response string * crypto not working * update setup wizard closes #1762 * feat: Get the encryption key * fix: Get to recovery * remove old code * fix build * fix: Install works for now * fix bug in config for adding new list items * dismiss action modal on success * clear button in config * wip: Currently broken in avahi mdns * include headers with req/res and refactor patchDB init and usage * fix: Can now run in the main * flatline on failed init * update patch DB * add last-wifi-region to data model even though not used by FE * chore: Fix the start. * wip: Fix wrong order for getting hostname before sql has been created * fix edge case where union keys displayed as new when not new * fix: Can start * last backup color, markdown links always new tab, fix bug with login * refactor to remove WithRevision * resolve circular dep issue * update submodule * fix patch-db * update patchDB * update patch again * escape error * decodeuricomponent * increase proxy buffer size * increase proxy buffer size * fix nginx Co-authored-by: BluJ <mogulslayer@gmail.com> Co-authored-by: BluJ <dragondef@gmail.com> Co-authored-by: Aiden McClelland <me@drbonez.dev>
62 lines
1.3 KiB
TypeScript
62 lines
1.3 KiB
TypeScript
import { Injectable } from '@angular/core'
|
|
import {
|
|
HttpService,
|
|
isRpcError,
|
|
RpcError,
|
|
RPCOptions,
|
|
} from '@start9labs/shared'
|
|
import { ApiService, GetErrorRes } from './api.service'
|
|
import { LogsRes, ServerLogsReq } from '@start9labs/shared'
|
|
|
|
@Injectable()
|
|
export class LiveApiService implements ApiService {
|
|
constructor(private readonly http: HttpService) {}
|
|
|
|
getError(): Promise<GetErrorRes> {
|
|
return this.rpcRequest<GetErrorRes>({
|
|
method: 'diagnostic.error',
|
|
params: {},
|
|
})
|
|
}
|
|
|
|
restart(): Promise<void> {
|
|
return this.rpcRequest<void>({
|
|
method: 'diagnostic.restart',
|
|
params: {},
|
|
})
|
|
}
|
|
|
|
forgetDrive(): Promise<void> {
|
|
return this.rpcRequest<void>({
|
|
method: 'diagnostic.disk.forget',
|
|
params: {},
|
|
})
|
|
}
|
|
|
|
repairDisk(): Promise<void> {
|
|
return this.rpcRequest<void>({
|
|
method: 'diagnostic.disk.repair',
|
|
params: {},
|
|
})
|
|
}
|
|
|
|
getLogs(params: ServerLogsReq): Promise<LogsRes> {
|
|
return this.rpcRequest<LogsRes>({
|
|
method: 'diagnostic.logs',
|
|
params,
|
|
})
|
|
}
|
|
|
|
private async rpcRequest<T>(opts: RPCOptions): Promise<T> {
|
|
const res = await this.http.rpcRequest<T>(opts)
|
|
|
|
const rpcRes = res.body
|
|
|
|
if (isRpcError(rpcRes)) {
|
|
throw new RpcError(rpcRes.error)
|
|
}
|
|
|
|
return rpcRes.result
|
|
}
|
|
}
|