mirror of
https://github.com/modrinth/code.git
synced 2026-08-25 09:04:55 +00:00
feat(frontend): lookup server by subdomain (#7210)
feat(frontend): lookup server by subdomain admin
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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<Archon.Servers.Internal.Lookup> {
|
||||
return this.client.request<Archon.Servers.Internal.Lookup>(
|
||||
`/servers/by-subdomain/${encodeURIComponent(subdomain)}`,
|
||||
{
|
||||
api: 'archon',
|
||||
version: 'internal',
|
||||
method: 'GET',
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -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[]
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user