diff --git a/index.js b/index.js index 23358c4..a849ae3 100644 --- a/index.js +++ b/index.js @@ -180,7 +180,7 @@ app.get("/api/logout", authorized(), (req, res) => { }); app.post("/api/upload-video", authorized(), fileUpload({ limits: { fileSize: 2 ** 26 }, useTempFiles: true }), async (req, res) => { - const { title } = req.body; + const { title, description } = req.body; if (!title) { return res.status(400).json({ ok: false, error: "bad request" }); } @@ -229,7 +229,10 @@ app.post("/api/upload-video", authorized(), fileUpload({ limits: { fileSize: 2 * return; } - dbRun("INSERT INTO videos (id, user_id, title) VALUES (?, ?, ?)", id, userId, title); + dbRun( + "INSERT INTO videos (id, user_id, title, description, created_at) VALUES (?, ?, ?, ?, ?)", + id, userId, title, description ?? "", new Date().toISOString() + ); const index = videoQueue.indexOf(item => item.videoId === queueItem.videoId) videoQueue.splice(index, 1); @@ -250,7 +253,7 @@ app.get("/api/video-info", async (req, res) => { const id = req.query["id"]; const video = await dbGet(` - SELECT videos.id, videos.title, users.username AS author + SELECT videos.id, videos.title, videos.description, videos.created_at, users.username AS author FROM videos JOIN users ON users.id = videos.user_id WHERE videos.id = ? diff --git a/migration.sql b/migration.sql index dcff1ff..ea8d934 100644 --- a/migration.sql +++ b/migration.sql @@ -8,6 +8,8 @@ CREATE TABLE videos ( id TEXT PRIMARY KEY NOT NULL, user_id INTEGER, title TEXT NOT NULL, + description TEXT NOT NULL, + created_at TEXT NOT NULL, FOREIGN KEY(user_id) REFERENCES users(id) ); diff --git a/public/style.css b/public/style.css index d51fd76..1ec74b4 100644 --- a/public/style.css +++ b/public/style.css @@ -1,20 +1,39 @@ -*, *::before, *::after { - box-sizing: border-box; - appearance: none; -} - :root { color-scheme: light dark; --red: #c51e0e; } +@media (prefers-color-scheme: dark) { + :root { + --red: #F4511E; + } +} + +*, *::before, *::after { + box-sizing: border-box; + appearance: none; +} + +*:focus { + outline: 2px solid var(--red); +} + body { margin: 0 auto; padding: 0; text-align: center; } +a { + color: var(--red); +} + +textarea, input { + font-family: sans-serif; + font-size: 0.8em; +} + nav { margin-bottom: 20px; } @@ -135,7 +154,3 @@ input::file-selector-button { font-weight: bold; } -a { - color: var(--red); -} - diff --git a/public/upload/index.html b/public/upload/index.html index 9a264cb..a6e5296 100644 --- a/public/upload/index.html +++ b/public/upload/index.html @@ -5,6 +5,7 @@