feat(editor): bridge the advanced photo editor into the event workflow
CI / build (push) Has been cancelled
CI / build (push) Has been cancelled
Event photos can now be opened in Lumenroom, a WebGL2 develop module, from the photo editor's Advanced button. The dashboard signs a short-lived token scoped to one user and event; Lumenroom exchanges it, imports the event's photo list and proxies bytes on demand, so nothing is copied and the temporary catalog expires with the bridge session. Saving in Lumenroom renders the photo and writes it back as the event's edited JPEG, with the advanced recipe kept in event_photos.advanced_edit_json. Lumenroom is vendored under lumenroom/ and built as a second compose service, so one clone and `docker compose up -d --build` deploys both apps. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { NextRequest } from "next/server";
|
||||
import { authenticateBridge } from "@/db/bridge";
|
||||
import {
|
||||
BRIDGE_SESSION_TTL_SECONDS,
|
||||
signBridgeToken,
|
||||
} from "@/lib/bridge";
|
||||
import { errorResponse, jsonResponse } from "@/lib/http";
|
||||
|
||||
/**
|
||||
* POST /api/bridge/sessions/:sessionId/exchange
|
||||
*
|
||||
* The login token is deliberately short-lived because it travels in a URL.
|
||||
* The editor exchanges it once for a service token it keeps server-side; that
|
||||
* token authorizes the photo proxy and the save-back calls.
|
||||
*/
|
||||
export const POST = async (
|
||||
req: NextRequest,
|
||||
{ params }: { params: Promise<{ sessionId: string }> },
|
||||
) => {
|
||||
const { sessionId } = await params;
|
||||
const auth = await authenticateBridge(req, sessionId, "login");
|
||||
if (!auth) return errorResponse(401, "invalid or expired bridge token");
|
||||
|
||||
const token = signBridgeToken({
|
||||
sid: auth.session.id,
|
||||
eid: auth.session.eventId,
|
||||
uid: auth.user.id,
|
||||
email: auth.user.email,
|
||||
name: auth.user.name,
|
||||
kind: "service",
|
||||
exp: Math.floor(Date.now() / 1000) + BRIDGE_SESSION_TTL_SECONDS,
|
||||
});
|
||||
|
||||
return jsonResponse({
|
||||
token,
|
||||
sessionId: auth.session.id,
|
||||
eventId: auth.session.eventId,
|
||||
expiresAt: auth.session.expiresAt,
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user