forked from didirus/AstralRinth
* feat: api-client module for content v0 * feat: delete unused components + modules + setting * feat: xhr uploading * feat: fs module -> api-client * feat: migrate files.vue to use tanstack * fix: mem leak + other issues * fix: build * feat: switch to monaco * fix: go back to using ace, but improve preloading + theme * fix: styling + dead attrs * feat: match figma * fix: padding * feat: files-new for ui page structure * feat: finalize files.vue * fix: lint * fix: qa * fix: dep * fix: lint * fix: lockfile merge * feat: icons on navtab * fix: surface alternating on table * fix: hover surface color --------- Signed-off-by: Calum H. <contact@cal.engineer> Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
import type { Archon } from '@modrinth/api-client'
|
|
import type { ComputedRef, Reactive, Ref } from 'vue'
|
|
|
|
import { createContext } from '.'
|
|
|
|
export type BackupTaskState = {
|
|
progress: number
|
|
state: Archon.Backups.v1.BackupState
|
|
}
|
|
|
|
export type BackupProgressEntry = {
|
|
file?: BackupTaskState
|
|
create?: BackupTaskState
|
|
restore?: BackupTaskState
|
|
}
|
|
|
|
export type BackupsState = Map<string, BackupProgressEntry>
|
|
|
|
export interface FilesystemAuth {
|
|
url: string
|
|
token: string
|
|
}
|
|
|
|
export interface ModrinthServerContext {
|
|
readonly serverId: string
|
|
readonly server: Ref<Archon.Servers.v0.Server>
|
|
|
|
// Websocket state
|
|
readonly isConnected: Ref<boolean>
|
|
readonly powerState: Ref<Archon.Websocket.v0.PowerState>
|
|
readonly isServerRunning: ComputedRef<boolean>
|
|
readonly backupsState: Reactive<BackupsState>
|
|
markBackupCancelled: (backupId: string) => void
|
|
|
|
// Filesystem state
|
|
readonly fsAuth: Ref<FilesystemAuth | null>
|
|
readonly fsOps: Ref<Archon.Websocket.v0.FilesystemOperation[]>
|
|
readonly fsQueuedOps: Ref<Archon.Websocket.v0.QueuedFilesystemOp[]>
|
|
refreshFsAuth: () => Promise<void>
|
|
}
|
|
|
|
export const [injectModrinthServerContext, provideModrinthServerContext] =
|
|
createContext<ModrinthServerContext>('[id].vue', 'modrinthServerContext')
|