Add verified administrator controls and upload abuse limits

This commit is contained in:
2026-10-14 20:37:55 +09:00
parent c3573b605c
commit 3786baf60c
23 changed files with 1941 additions and 22 deletions

View File

@@ -4,6 +4,7 @@ import type { Server } from 'socket.io';
import type { Auth } from './auth.js';
import type { Accounts } from './accounts.js';
import { Storage } from './storage.js';
import { Administration } from './administration.js';
import { ResumableUploads } from './resumable.js';
import { NearbyLocations } from './nearby.js';
import { Vault } from './vault.js';
@@ -28,12 +29,14 @@ export class Service {
accounts!: Accounts;
io?: Server;
storage: Storage;
admin: Administration;
resumable: ResumableUploads;
vault: Vault;
constructor(
readonly db: DB,
readonly cfg: Config,
) {
this.admin = new Administration(this);
this.storage = new Storage(this);
this.resumable = new ResumableUploads(this);
this.nearby = new NearbyLocations(cfg.locationRadiusMeters, (ids: string[]) =>
@@ -585,6 +588,7 @@ export class Service {
storageUserId?: string,
) {
this.cleanup();
if (input.kind === 'file' && !storedSource) this.admin.assertNewUploads();
const target = this.deviceGuest(input.targetDeviceId);
if (
target &&