fix: queue store stability + persistence (#5909)

* fix: queue store stability + persistence

* fix: lint

* feat: set to draft btn

* feat: migrate to indexed db rather than local storage for moderation checklist storage (keep session + perms alone)

* fix: storage cleanup + lint

* fix: invalidation fixes
This commit is contained in:
Calum H.
2026-04-27 17:39:32 +01:00
committed by GitHub
parent a2eed001b2
commit 3f8fd9cb56
19 changed files with 1548 additions and 387 deletions

View File

@@ -4,6 +4,7 @@ export * from './billing/internal'
export * from './collections'
export * from './globals/internal'
export * from './limits/v3'
export * from './moderation/internal'
export * from './notifications/v2'
export * from './oauth/internal'
export * from './organizations/v3'

View File

@@ -0,0 +1,60 @@
import { AbstractModule } from '../../../core/abstract-module'
import type { Labrinth } from '../types'
export class LabrinthModerationInternalModule extends AbstractModule {
public getModuleID(): string {
return 'labrinth_moderation_internal'
}
public async acquireLock(
projectId: string,
): Promise<Labrinth.Moderation.Internal.LockAcquireResponse> {
return this.client.request<Labrinth.Moderation.Internal.LockAcquireResponse>(
`/moderation/lock/${projectId}`,
{
api: 'labrinth',
version: 'internal',
method: 'POST',
},
)
}
public async overrideLock(
projectId: string,
): Promise<Labrinth.Moderation.Internal.LockAcquireResponse> {
return this.client.request<Labrinth.Moderation.Internal.LockAcquireResponse>(
`/moderation/lock/${projectId}/override`,
{
api: 'labrinth',
version: 'internal',
method: 'POST',
},
)
}
public async releaseLock(
projectId: string,
): Promise<Labrinth.Moderation.Internal.ReleaseLockResponse> {
return this.client.request<Labrinth.Moderation.Internal.ReleaseLockResponse>(
`/moderation/lock/${projectId}`,
{
api: 'labrinth',
version: 'internal',
method: 'DELETE',
},
)
}
public async checkLock(
projectId: string,
): Promise<Labrinth.Moderation.Internal.LockStatusResponse> {
return this.client.request<Labrinth.Moderation.Internal.LockStatusResponse>(
`/moderation/lock/${projectId}`,
{
api: 'labrinth',
version: 'internal',
method: 'GET',
},
)
}
}

View File

@@ -1301,6 +1301,38 @@ export namespace Labrinth {
}
}
export namespace Moderation {
export namespace Internal {
export type LockedByUser = {
id: string
username: string
avatar_url?: string
}
export type LockStatusResponse = {
locked: boolean
is_own_lock: boolean
locked_by?: LockedByUser
locked_at?: string
expires_at?: string
expired?: boolean
}
export type LockAcquireResponse = {
success: boolean
is_own_lock: boolean
locked_by?: LockedByUser
locked_at?: string
expires_at?: string
expired?: boolean
}
export type ReleaseLockResponse = {
success: boolean
}
}
}
export namespace Notifications {
export namespace v2 {
export type NotificationAction = {