fix(ampp): require auth on AMPP endpoint

This commit is contained in:
Zac Gaetano 2026-06-03 04:52:43 +00:00
parent d16d19c26d
commit c21260c9b0

View file

@ -1,8 +1,9 @@
import express from 'express'; import express from 'express';
import pool from '../db/pool.js'; import pool from '../db/pool.js';
import { requireAuth } from '../middleware/auth.js';
const router = express.Router(); const router = express.Router();
// No session auth — called from AMPP Script Task inside broadcast network // Protected by requireAuth — AMPP Script Task must use an API token (Bearer Auth).
/** /**
* GET /api/v1/ampp/folder-for/:filename * GET /api/v1/ampp/folder-for/:filename
@ -14,7 +15,7 @@ const router = express.Router();
* 200: { folder_id: "abc123" } * 200: { folder_id: "abc123" }
* 404: { error: "..." } (file not uploaded through Dragon-Wind handle gracefully) * 404: { error: "..." } (file not uploaded through Dragon-Wind handle gracefully)
*/ */
router.get('/folder-for/:filename', async (req, res, next) => { router.get('/folder-for/:filename', requireAuth, async (req, res, next) => {
try { try {
const { filename } = req.params; const { filename } = req.params;
const result = await pool.query( const result = await pool.query(