uploads test

This commit is contained in:
biglyderv 2024-11-25 14:12:43 -05:00
parent 29bc2b8ddd
commit dabbc7d862
11 changed files with 121 additions and 44 deletions

19
client/player.js Normal file
View file

@ -0,0 +1,19 @@
import Route from "../route.js";
import auth from "../form/auth.js";
import initDb from "../db.js";
let db = await initDb();
let main = new Route([auth], async function (req, res, input) {
let { username } = input;
let videoData = await db.all('SELECT * FROM video WHERE id = ?', [
req.query.id
]);
videoData = videoData[0];
return res.render('player', {
username,
videoData
});
});
export default main;

19
client/upload.js Normal file
View file

@ -0,0 +1,19 @@
import Route from "../route.js";
import auth from "../form/auth.js";
// TODO: rewrite
let main = new Route([auth], async function (req, res, input) {
let { username } = input;
return res.render('form', {
data: [
{ label: "Video file", type: "file", name: "file" },
{ label: "Name", type: "text", name: "title" },
{ label: "Description", type: "text", name: "desc" }
],
'route': '/api/upload/upload',
'title': 'Upload Content',
username
});
});
export default main;