is anyone reading these commit msgs
This commit is contained in:
parent
dabbc7d862
commit
40f9c219b8
9 changed files with 66 additions and 10 deletions
|
@ -1,10 +1,17 @@
|
||||||
import Route from "../route.js";
|
import Route from "../route.js";
|
||||||
import auth from "../form/auth.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 main = new Route([auth], async function (req, res, input) {
|
||||||
let { username } = input;
|
let { username } = input;
|
||||||
|
let videos = await db.all('SELECT * FROM video ORDER BY date DESC', [
|
||||||
|
req.query.id
|
||||||
|
]);
|
||||||
return res.render('main', {
|
return res.render('main', {
|
||||||
username
|
username,
|
||||||
|
videos
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ let main = new Route([auth], async function (req, res, input) {
|
||||||
data: [
|
data: [
|
||||||
{ label: "Video file", type: "file", name: "file" },
|
{ label: "Video file", type: "file", name: "file" },
|
||||||
{ label: "Name", type: "text", name: "title" },
|
{ label: "Name", type: "text", name: "title" },
|
||||||
{ label: "Description", type: "text", name: "desc" }
|
{ label: "Description", type: "textarea", name: "desc" }
|
||||||
],
|
],
|
||||||
'route': '/api/upload/upload',
|
'route': '/api/upload/upload',
|
||||||
'title': 'Upload Content',
|
'title': 'Upload Content',
|
||||||
|
|
2
db.js
2
db.js
|
@ -14,7 +14,7 @@ async function initDb() {
|
||||||
await db.run(`CREATE TABLE IF NOT EXISTS auth (username TEXT, password TEXT);`);
|
await db.run(`CREATE TABLE IF NOT EXISTS auth (username TEXT, password TEXT);`);
|
||||||
await db.run(`CREATE TABLE IF NOT EXISTS token (username TEXT, token TEXT);`);
|
await db.run(`CREATE TABLE IF NOT EXISTS token (username TEXT, token TEXT);`);
|
||||||
|
|
||||||
await db.run(`CREATE TABLE IF NOT EXISTS video (id TEXT, title TEXT, desc TEXT, username TEXT);`);
|
await db.run(`CREATE TABLE IF NOT EXISTS video (id TEXT, title TEXT, desc TEXT, username TEXT, date REAL);`);
|
||||||
|
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,15 +21,17 @@ let main = new Route([auth], async function (req, res, input) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await execP(`ffmpeg -i ${path} videos/${id}.mp4`);
|
await execP(`ffmpeg -i ${path} videos/${id}.mp4`);
|
||||||
|
await execP(`ffmpeg -i videos/${id}.mp4 -frames:v 1 videos/${id}.png`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
return { 'success': false, 'message': 'Video is invalid'}
|
return { 'success': false, 'message': 'Video is invalid'}
|
||||||
}
|
}
|
||||||
|
|
||||||
await db.run('INSERT INTO video (id, title, desc, username) VALUES (?, ?, ?, ?)', [
|
await db.run('INSERT INTO video (id, title, desc, username, date) VALUES (?, ?, ?, ?, ?)', [
|
||||||
id,
|
id,
|
||||||
title,
|
title,
|
||||||
desc,
|
desc,
|
||||||
username
|
username,
|
||||||
|
+new Date()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return { 'message': 'Video created', 'success': true, 'redirect': '/client/video?id='+id };
|
return { 'message': 'Video created', 'success': true, 'redirect': '/client/video?id='+id };
|
||||||
|
|
|
@ -35,7 +35,8 @@ input,
|
||||||
textarea,
|
textarea,
|
||||||
.button,
|
.button,
|
||||||
.area,
|
.area,
|
||||||
form {
|
form,
|
||||||
|
.video {
|
||||||
border: solid var(--dark-2) 3px;
|
border: solid var(--dark-2) 3px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
|
||||||
|
@ -114,3 +115,21 @@ form {
|
||||||
video {
|
video {
|
||||||
width: 690px;
|
width: 690px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.video img {
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.videos {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.videos a{
|
||||||
|
color: var(--dark-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
display: block;
|
||||||
|
}
|
|
@ -7,7 +7,13 @@
|
||||||
<% for (let elem of data) { %>
|
<% for (let elem of data) { %>
|
||||||
<span class='form-entry'> <span class='form-key'>
|
<span class='form-entry'> <span class='form-key'>
|
||||||
<%= elem.label %>
|
<%= elem.label %>
|
||||||
</span> <input type='<%= elem.type %>' name='<%= elem.name %>'></span>
|
</span>
|
||||||
|
<% if (elem.type=='textarea' ) { %>
|
||||||
|
<textarea name='<%= elem.name %>'></textarea>
|
||||||
|
<% } else { %>
|
||||||
|
<input type='<%= elem.type %>' name='<%= elem.name %>'>
|
||||||
|
</span>
|
||||||
|
<% } %>
|
||||||
<% } %>
|
<% } %>
|
||||||
<input type='Submit' name='Submit'>
|
<input type='Submit' name='Submit'>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -3,12 +3,19 @@
|
||||||
<h1>BiglyChat</h1>
|
<h1>BiglyChat</h1>
|
||||||
<p><b>Collab on videos... make creative animations... and more!</b></p>
|
<p><b>Collab on videos... make creative animations... and more!</b></p>
|
||||||
<h2>About</h2>
|
<h2>About</h2>
|
||||||
<p><i>I am <a href='https://zenoverse.net/'>Onez</a>, a self-taught developer from a young age. Following the unexpected growth
|
<p><i>I am <a href='https://zenoverse.net/'>Onez</a>, a self-taught developer from a young age. Following the
|
||||||
of <i>Video Bot Thing</i>, I made this as a home for the logo editing community. View the <a
|
unexpected growth
|
||||||
|
of <i>Video Bot Thing</i>, I made this as a home for the video editing community. View the <a
|
||||||
href='https://codeberg.org/onezDerv/bigly-chat'>source</a> if you want to contribute or make a
|
href='https://codeberg.org/onezDerv/bigly-chat'>source</a> if you want to contribute or make a
|
||||||
fork.</i></p>
|
fork.</i></p>
|
||||||
<%if (username=='!nobody' ) { %>
|
<%if (username=='!nobody' ) { %>
|
||||||
<div class="button"><a href="/client/register">Join</a></div>
|
<div class="button"><a href="/client/register">Join</a></div>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
|
<div class='area'>
|
||||||
|
<h1>Recent Videos</h1>
|
||||||
|
<div class=' videos'>
|
||||||
|
<%- include('videos.ejs') -%>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<%- include('footer.ejs') -%>
|
<%- include('footer.ejs') -%>
|
|
@ -9,6 +9,7 @@
|
||||||
<div>by <a href="/client/user?id=<%= videoData.username %>">
|
<div>by <a href="/client/user?id=<%= videoData.username %>">
|
||||||
<%= videoData.username %>
|
<%= videoData.username %>
|
||||||
</a></div>
|
</a></div>
|
||||||
|
<pre><%= videoData.desc %></pre>
|
||||||
<!-- todo: custom video player-->
|
<!-- todo: custom video player-->
|
||||||
</div>
|
</div>
|
||||||
<%- include('footer.ejs') -%>
|
<%- include('footer.ejs') -%>
|
14
views/videos.ejs
Normal file
14
views/videos.ejs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<%for (videoData of videos) { %>
|
||||||
|
<a href='/client/video?id=<%= videoData.id %>'>
|
||||||
|
<div class='video'>
|
||||||
|
<img src='/videos/<%= videoData.id %>.png'>
|
||||||
|
<div><b>
|
||||||
|
<%= videoData.title %>
|
||||||
|
</b>
|
||||||
|
</div>
|
||||||
|
<div>by <a href="/client/user?id=<%= videoData.username %>">
|
||||||
|
<%= videoData.username %>
|
||||||
|
</a></div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<% } %>
|
Loading…
Reference in a new issue