cleanup
This commit is contained in:
parent
77f21692cf
commit
4273369736
20 changed files with 56 additions and 53 deletions
|
@ -7,7 +7,6 @@ import crypto from "node:crypto";
|
|||
|
||||
let db = await initDb();
|
||||
|
||||
// TODO: rewrite
|
||||
let main = new Route([], async function (req, res, input) {
|
||||
const canvas = new Canvas.Canvas(250, 100)
|
||||
const ctx = canvas.getContext('2d')
|
||||
|
@ -47,6 +46,7 @@ let main = new Route([], async function (req, res, input) {
|
|||
res.header('Cache-Control', 'no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0')
|
||||
res.header('Expires', 'Sun, 19 May 1984 02:00:00 GMT')
|
||||
canvas.jpegStream().pipe(res)
|
||||
return true;
|
||||
});
|
||||
|
||||
export default main;
|
|
@ -2,9 +2,10 @@ import Route from "../route.js";
|
|||
import auth from "../form/auth.js";
|
||||
|
||||
let main = new Route([auth], async function (req, res, input) {
|
||||
return res.render('404', {
|
||||
res.render('404', {
|
||||
...input
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
||||
export default main;
|
|
@ -3,7 +3,7 @@ import auth from "../form/auth.js";
|
|||
|
||||
// TODO: rewrite
|
||||
let main = new Route([auth], async function (req, res, input) {
|
||||
return res.render('form', {
|
||||
res.render('form', {
|
||||
data: [
|
||||
{ label: "Username", type: "text", name: "user" },
|
||||
{ label: "Password", type: "password", name: "pass" },
|
||||
|
@ -12,6 +12,7 @@ let main = new Route([auth], async function (req, res, input) {
|
|||
'title': 'Login',
|
||||
...input
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
||||
export default main;
|
|
@ -11,11 +11,12 @@ let main = new Route([auth], async function (req, res, input) {
|
|||
let videosFollow = await db.all('SELECT * FROM video WHERE username IN (SELECT target FROM follow WHERE username = ?) ORDER BY date DESC LIMIT 20', [
|
||||
username
|
||||
]);
|
||||
return res.render('main', {
|
||||
res.render('main', {
|
||||
...input,
|
||||
videos,
|
||||
videosFollow
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
||||
export default main;
|
|
@ -16,10 +16,11 @@ let main = new Route([auth], async function (req, res, input) {
|
|||
username
|
||||
]);
|
||||
|
||||
return res.render('messages', {
|
||||
res.render('messages', {
|
||||
...input,
|
||||
msgs
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
||||
export default main;
|
|
@ -10,11 +10,12 @@ let main = new Route([comment], async function (req, res, input) {
|
|||
]);
|
||||
if (videoData.length == 0) return;
|
||||
videoData = videoData[0];
|
||||
return res.render('player', {
|
||||
res.render('player', {
|
||||
...input,
|
||||
videoData,
|
||||
ogType: 'video'
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
||||
export default main;
|
|
@ -3,7 +3,7 @@ import auth from "../form/auth.js";
|
|||
|
||||
// TODO: rewrite
|
||||
let main = new Route([auth], async function (req, res, input) {
|
||||
return res.render('form', {
|
||||
res.render('form', {
|
||||
data: [
|
||||
{ label: "Username", type: "text", name: "user" },
|
||||
{ label: "Password", type: "password", name: "pass" },
|
||||
|
@ -13,6 +13,7 @@ let main = new Route([auth], async function (req, res, input) {
|
|||
'title': 'Join',
|
||||
...input
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
||||
export default main;
|
|
@ -3,7 +3,7 @@ import auth from "../form/auth.js";
|
|||
|
||||
// TODO: rewrite
|
||||
let main = new Route([auth], async function (req, res, input) {
|
||||
return res.render('form', {
|
||||
res.render('form', {
|
||||
data: [
|
||||
{ label: "Description", type: "textarea", name: "desc" },
|
||||
{ label: "Avatar", type: "file", name: "file" }
|
||||
|
@ -11,7 +11,8 @@ let main = new Route([auth], async function (req, res, input) {
|
|||
'route': '/api/upload/settings',
|
||||
'title': 'User Settings',
|
||||
...input
|
||||
}); /* todo: form in not a file */
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
||||
export default main;
|
|
@ -2,9 +2,10 @@ import Route from "../route.js";
|
|||
import auth from "../form/auth.js";
|
||||
|
||||
let main = new Route([auth], async function (req, res, input) {
|
||||
return res.render('guidelines', {
|
||||
res.render('guidelines', {
|
||||
...input
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
||||
export default main;
|
|
@ -3,7 +3,7 @@ import auth from "../form/auth.js";
|
|||
|
||||
// TODO: rewrite
|
||||
let main = new Route([auth], async function (req, res, input) {
|
||||
return res.render('form', {
|
||||
res.render('form', {
|
||||
data: [
|
||||
{ label: "Video file", type: "file", name: "file" },
|
||||
{ label: "Name", type: "text", name: "title" },
|
||||
|
@ -13,6 +13,7 @@ let main = new Route([auth], async function (req, res, input) {
|
|||
'title': 'Upload Content',
|
||||
...input
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
||||
export default main;
|
|
@ -22,7 +22,7 @@ let main = new Route([comment], async function (req, res, input) {
|
|||
req.query.id
|
||||
]);
|
||||
|
||||
return res.render('user', {
|
||||
res.render('user', {
|
||||
...input,
|
||||
id,
|
||||
videos,
|
||||
|
@ -31,6 +31,7 @@ let main = new Route([comment], async function (req, res, input) {
|
|||
user,
|
||||
icon: `${process.env.URL}/pfp/${id}.png`
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
||||
export default main;
|
Loading…
Add table
Add a link
Reference in a new issue