You've already forked AstralRinth
forked from didirus/AstralRinth
feat: modrinth hosting - files tab refactor (#4912)
* 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>
This commit is contained in:
56
packages/api-client/src/modules/archon/content/v0.ts
Normal file
56
packages/api-client/src/modules/archon/content/v0.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { AbstractModule } from '../../../core/abstract-module'
|
||||
import type { Archon } from '../types'
|
||||
|
||||
export class ArchonContentV0Module extends AbstractModule {
|
||||
public getModuleID(): string {
|
||||
return 'archon_content_v0'
|
||||
}
|
||||
|
||||
/** GET /modrinth/v0/servers/:server_id/mods */
|
||||
public async list(serverId: string): Promise<Archon.Content.v0.Mod[]> {
|
||||
return this.client.request<Archon.Content.v0.Mod[]>(`/servers/${serverId}/mods`, {
|
||||
api: 'archon',
|
||||
version: 'modrinth/v0',
|
||||
method: 'GET',
|
||||
})
|
||||
}
|
||||
|
||||
/** POST /modrinth/v0/servers/:server_id/mods */
|
||||
public async install(
|
||||
serverId: string,
|
||||
request: Archon.Content.v0.InstallModRequest,
|
||||
): Promise<void> {
|
||||
await this.client.request<void>(`/servers/${serverId}/mods`, {
|
||||
api: 'archon',
|
||||
version: 'modrinth/v0',
|
||||
method: 'POST',
|
||||
body: request,
|
||||
})
|
||||
}
|
||||
|
||||
/** POST /modrinth/v0/servers/:server_id/deleteMod */
|
||||
public async delete(
|
||||
serverId: string,
|
||||
request: Archon.Content.v0.DeleteModRequest,
|
||||
): Promise<void> {
|
||||
await this.client.request<void>(`/servers/${serverId}/deleteMod`, {
|
||||
api: 'archon',
|
||||
version: 'modrinth/v0',
|
||||
method: 'POST',
|
||||
body: request,
|
||||
})
|
||||
}
|
||||
|
||||
/** POST /modrinth/v0/servers/:server_id/mods/update */
|
||||
public async update(
|
||||
serverId: string,
|
||||
request: Archon.Content.v0.UpdateModRequest,
|
||||
): Promise<void> {
|
||||
await this.client.request<void>(`/servers/${serverId}/mods/update`, {
|
||||
api: 'archon',
|
||||
version: 'modrinth/v0',
|
||||
method: 'POST',
|
||||
body: request,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
export * from './backups/v0'
|
||||
export * from './backups/v1'
|
||||
export * from './content/v0'
|
||||
export * from './servers/v0'
|
||||
export * from './servers/v1'
|
||||
export * from './types'
|
||||
|
||||
@@ -78,4 +78,20 @@ export class ArchonServersV0Module extends AbstractModule {
|
||||
method: 'GET',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a power action to a server (Start, Stop, Restart, Kill)
|
||||
* POST /modrinth/v0/servers/:id/power
|
||||
*/
|
||||
public async power(
|
||||
serverId: string,
|
||||
action: 'Start' | 'Stop' | 'Restart' | 'Kill',
|
||||
): Promise<void> {
|
||||
await this.client.request(`/servers/${serverId}/power`, {
|
||||
api: 'archon',
|
||||
method: 'POST',
|
||||
version: 'modrinth/v0',
|
||||
body: { action },
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,40 @@
|
||||
export namespace Archon {
|
||||
export namespace Content {
|
||||
export namespace v0 {
|
||||
export type ContentKind = 'mod' | 'plugin'
|
||||
|
||||
export type Mod = {
|
||||
filename: string
|
||||
project_id: string | undefined
|
||||
version_id: string | undefined
|
||||
name: string | undefined
|
||||
version_number: string | undefined
|
||||
icon_url: string | undefined
|
||||
owner: string | undefined
|
||||
disabled: boolean
|
||||
installing: boolean
|
||||
}
|
||||
|
||||
export type InstallModRequest = {
|
||||
rinth_ids: {
|
||||
project_id: string
|
||||
version_id: string
|
||||
}
|
||||
install_as: ContentKind
|
||||
}
|
||||
|
||||
export type DeleteModRequest = {
|
||||
path: string
|
||||
}
|
||||
|
||||
export type UpdateModRequest = {
|
||||
replace: string
|
||||
project_id: string
|
||||
version_id: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export namespace Servers {
|
||||
export namespace v0 {
|
||||
export type ServerGetResponse = {
|
||||
@@ -274,6 +310,11 @@ export namespace Archon {
|
||||
started: string
|
||||
}
|
||||
|
||||
export type QueuedFilesystemOp = {
|
||||
op: FilesystemOpKind
|
||||
src: string
|
||||
}
|
||||
|
||||
export type WSFilesystemOpsEvent = {
|
||||
event: 'filesystem-ops'
|
||||
all: FilesystemOperation[]
|
||||
|
||||
Reference in New Issue
Block a user