diff --git a/apps/frontend/src/layouts/default.vue b/apps/frontend/src/layouts/default.vue index 6ebd410f11..11cb84c868 100644 --- a/apps/frontend/src/layouts/default.vue +++ b/apps/frontend/src/layouts/default.vue @@ -427,6 +427,14 @@ tone: 'brand', shown: isAdmin(auth.user), }, + { + id: 'servers-lookup', + label: 'Server lookup', + type: 'link', + to: '/admin/servers/lookup', + tone: 'brand', + shown: isAdmin(auth.user), + }, { id: 'servers-notices', label: formatMessage(messages.manageServerNotices), @@ -480,6 +488,7 @@ + diff --git a/apps/frontend/src/pages/admin/servers/lookup.vue b/apps/frontend/src/pages/admin/servers/lookup.vue new file mode 100644 index 0000000000..29f1002235 --- /dev/null +++ b/apps/frontend/src/pages/admin/servers/lookup.vue @@ -0,0 +1,113 @@ + + + diff --git a/packages/api-client/src/modules/archon/index.ts b/packages/api-client/src/modules/archon/index.ts index 194ea0333e..335bd23434 100644 --- a/packages/api-client/src/modules/archon/index.ts +++ b/packages/api-client/src/modules/archon/index.ts @@ -3,6 +3,7 @@ export * from './backups/v1' export * from './backups-queue/v1' export * from './content/v1' export * from './properties/v1' +export * from './servers/internal' export * from './servers/v0' export * from './servers/v1' export * from './types' diff --git a/packages/api-client/src/modules/archon/servers/internal.ts b/packages/api-client/src/modules/archon/servers/internal.ts new file mode 100644 index 0000000000..2be3033882 --- /dev/null +++ b/packages/api-client/src/modules/archon/servers/internal.ts @@ -0,0 +1,23 @@ +import { AbstractModule } from '../../../core/abstract-module' +import type { Archon } from '../types' + +export class ArchonServersInternalModule extends AbstractModule { + public getModuleID(): string { + return 'archon_servers_internal' + } + + /** + * Get the server assigned to a subdomain. + * GET /_internal/servers/by-subdomain/:subdomain + */ + public async getBySubdomain(subdomain: string): Promise { + return this.client.request( + `/servers/by-subdomain/${encodeURIComponent(subdomain)}`, + { + api: 'archon', + version: 'internal', + method: 'GET', + }, + ) + } +} diff --git a/packages/api-client/src/modules/archon/types.ts b/packages/api-client/src/modules/archon/types.ts index 56df291622..00fb3c7da4 100644 --- a/packages/api-client/src/modules/archon/types.ts +++ b/packages/api-client/src/modules/archon/types.ts @@ -573,6 +573,12 @@ export namespace Archon { } export namespace Servers { + export namespace Internal { + export type Lookup = { + id: string + } + } + export namespace v0 { export type ServerGetResponse = { servers: Server[] diff --git a/packages/api-client/src/modules/index.ts b/packages/api-client/src/modules/index.ts index a08a953259..43792728bc 100644 --- a/packages/api-client/src/modules/index.ts +++ b/packages/api-client/src/modules/index.ts @@ -9,6 +9,7 @@ import { ArchonNoticesV0Module } from './archon/notices/v0' import { ArchonOptionsV1Module } from './archon/options/v1' import { ArchonPropertiesV1Module } from './archon/properties/v1' import { ArchonServerUsersV1Module } from './archon/server-users/v1' +import { ArchonServersInternalModule } from './archon/servers/internal' import { ArchonServersV0Module } from './archon/servers/v0' import { ArchonServersV1Module } from './archon/servers/v1' import { ArchonTransfersInternalModule } from './archon/transfers/internal' @@ -87,6 +88,7 @@ export const MODULE_REGISTRY = { archon_options_v1: ArchonOptionsV1Module, archon_properties_v1: ArchonPropertiesV1Module, archon_server_users_v1: ArchonServerUsersV1Module, + archon_servers_internal: ArchonServersInternalModule, archon_servers_v0: ArchonServersV0Module, archon_servers_v1: ArchonServersV1Module, archon_transfers_internal: ArchonTransfersInternalModule,