feat: temporary file map to test upload retrieval

pull/243/head
Josh Moore 1 year ago
parent 0f184c6630
commit ab76785e5f

@ -23,6 +23,9 @@ bb.extend(router, {
// Render or redirect // Render or redirect
router.get('/', (req, res) => UserConfig.ready ? res.render('index') : res.redirect('/setup')); router.get('/', (req, res) => UserConfig.ready ? res.render('index') : res.redirect('/setup'));
// temp file map
const files = new Map<string, AssFile>();
// Upload flow // Upload flow
router.post('/', async (req, res) => { router.post('/', async (req, res) => {
@ -72,11 +75,13 @@ router.post('/', async (req, res) => {
await fs.rm(bbFile.file); await fs.rm(bbFile.file);
// todo: get S3 save data // todo: get S3 save data
assFile.save.s3 = true;
} }
log.debug('File saved to', !s3 ? assFile.save.local! : 'S3'); log.debug('File saved to', !s3 ? assFile.save.local! : 'S3');
// todo: save metadata // todo: save metadata
files.set(assFile.fakeid, assFile);
return res.type('json').send({ resource: `${req.ass.host}/${assFile.fakeid}` }); return res.type('json').send({ resource: `${req.ass.host}/${assFile.fakeid}` });
} catch (err) { } catch (err) {

Loading…
Cancel
Save