Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

993 B
Raw Blame
// @ts-check
// GET /api/cron/anon-upload-sweep: enforces the declared size on anonymous
// presigned PUT uploads. presignUpload() cannot sign ContentLength (it breaks the
// CORS preflight), so this hourly sweep lists each anonymous prefix, HEAD-checks
// anything over its ceiling (api/_lib/anon-upload-limits.js) and deletes it.

import { json, method, wrapCron } from '../_lib/http.js';
import { requireCron } from '../_lib/cron-auth.js';
import { listObjectsPage, headObject, deleteObject, objectStorageConfigured } from '../_lib/r2.js';
import { sweepAnonUploads } from '../_lib/anon-upload-sweep.js';

export default wrapCron(async (req, res) => {
	if (!method(req, res, ['GET', 'POST'])) return;
	if (!requireCron(req, res)) return;
	if (!objectStorageConfigured()) {
		return json(res, 200, { ok: true, skipped: 'storage_unconfigured' });
	}
	const summary = await sweepAnonUploads({ listObjectsPage, headObject, deleteObject });
	return json(res, 200, { ok: true, ...summary });
});