feat: all profile uploads through transferStore; delete legacy POST /api/uploads

Migrates the remaining 5 profile/space upload sites (CreateSpace, AccountPanel
avatar+banner, OverviewPanel icon+banner) to transferStore.startUpload with
tray:false. Space sites pass _instanceOrigin so uploads route to the space's
home instance.

Removes upload/uploadWithProgress from api.uploads (and their private
uploadFile/uploadFileWithProgress helpers); api.uploads.url is preserved for
GET-path URL building. Deletes the server-side POST /api/uploads handler and
the now-unused @fastify/multipart plugin registration. GET /api/uploads/:filename
remains intact.
This commit is contained in:
Jannis Braun
2026-05-02 16:46:29 +02:00
parent 727c51f659
commit 2be243336b
6 changed files with 28 additions and 230 deletions
-7
View File
@@ -2,7 +2,6 @@ import Fastify from 'fastify';
import cors from '@fastify/cors';
import rateLimit from '@fastify/rate-limit';
import websocket from '@fastify/websocket';
import multipart from '@fastify/multipart';
import fastifyStatic from '@fastify/static';
import { config } from './config.js';
import { getDb, getRawDb } from './db/index.js';
@@ -65,12 +64,6 @@ async function main(): Promise<void> {
await app.register(websocket);
await app.register(multipart, {
limits: {
fileSize: Number.MAX_SAFE_INTEGER, // No global cap — actual limit enforced per-request from DB
},
});
// Serve built frontend in production
const webDistPath = path.resolve(import.meta.dirname ?? '.', '../../web/dist');
if (fs.existsSync(webDistPath)) {