.
This commit is contained in:
parent
46082780e1
commit
97096357e5
2337
public/s/font-awesome-4.7.0/css/font-awesome.css
vendored
2337
public/s/font-awesome-4.7.0/css/font-awesome.css
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 434 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
7
public/s/js/bootstrap.min.js
vendored
7
public/s/js/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
3772
public/s/js/plyr.js
3772
public/s/js/plyr.js
File diff suppressed because it is too large
Load Diff
@ -20,9 +20,8 @@ const speaker = () => {
|
||||
const k = document.querySelector("body");
|
||||
if(localStorage.selectedTheme && localStorage.selectedTheme === "f0ck95")
|
||||
k.document.createElement("div");
|
||||
else {
|
||||
else
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
var customCss;
|
||||
|
@ -2,4 +2,7 @@ export default new class {
|
||||
formatSize(size, i = ~~(Math.log(size) / Math.log(1024))) {
|
||||
return (size / Math.pow(1024, i)).toFixed(2) * 1 + " " + ["B", "kB", "MB", "GB", "TB"][i];
|
||||
}
|
||||
calcSpeed(b, s) {
|
||||
return `${(Math.round((b * 8 / s / 1e6) * 1e4) / 1e4).toFixed(2)} Mbit/s`;
|
||||
}
|
||||
};
|
||||
|
@ -84,23 +84,15 @@ router.get(/^\/api\/p\/([0-9]+)/, async (req, res) => { // legacy
|
||||
router.get(/^\/api\/item\/[0-9]+$/, async (req, res) => {
|
||||
try {
|
||||
const rows = await sql.query(queries.item, Array(3).fill(req.url.split[2]));
|
||||
const data = rows[0].length > 0 ? {
|
||||
...rows[0][0], ...{
|
||||
thumb: `${cfg.main.url}/t/${rows[0][0].id}.png`,
|
||||
srchost: parse(rows[0][0].src).hostname,
|
||||
next: rows[1].length ? rows[1][0].id : null,
|
||||
prev: rows[2].length ? rows[2][0].id : null,
|
||||
}
|
||||
} : {
|
||||
error: true
|
||||
};
|
||||
res
|
||||
.writeHead(200, { "Content-Type": "application/json" })
|
||||
.end(JSON.stringify(data), "utf-8");
|
||||
res.reply({
|
||||
type: "application/json",
|
||||
body: JSON.stringify(rows?.shift() || [])
|
||||
});
|
||||
} catch(err) {
|
||||
res
|
||||
.writeHead(500)
|
||||
.end(JSON.stringify(err), "utf-8");
|
||||
res.reply({
|
||||
code: 500,
|
||||
body: JSON.stringify(err)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -109,13 +101,14 @@ router.get(/^\/api\/user\/.*(\/[0-9]+)?$/, async (req, res) => { // auf qs umste
|
||||
const eps = Math.min(req.url.split[3] || 50, 50);
|
||||
try {
|
||||
const rows = await sql.query(queries.user, [ user, eps ]);
|
||||
res
|
||||
.writeHead(200, { "Content-Type": "application/json" })
|
||||
.end(JSON.stringify(rows.length > 0 ? rows : []), "utf-8");
|
||||
res.reply({
|
||||
type: "application/json",
|
||||
body: JSON.stringify(rows.length > 0 ? rows : [])
|
||||
});
|
||||
} catch(err) {
|
||||
res
|
||||
.writeHead(500)
|
||||
.end(JSON.stringify(err), "utf-8");
|
||||
res.reply({
|
||||
code: 500,
|
||||
body: JSON.stringify(err)
|
||||
});
|
||||
}
|
||||
db.end();
|
||||
});
|
||||
|
@ -9,9 +9,10 @@ export const queries = {
|
||||
main: "select id, mime, size, username, userchannel, usernetwork, stamp, dest, src from items ",
|
||||
where: where => `${where?`where ${where}`:""} order by rand() limit 1`
|
||||
},
|
||||
item: "select id, mime, dest, size, src, stamp, userchannel, username, usernetwork from items where id = ? limit 1;"
|
||||
+ "select id from items where id = (select min(id) from items where id > ?);"
|
||||
+ "select id from items where id = (select max(id) from items where id < ?)",
|
||||
item: "select id, mime, dest, size, src, stamp, userchannel, username, usernetwork, "
|
||||
+ "(select id from items where id = (select min(id) from items where id > ?)) as next, "
|
||||
+ "(select id from items where id = (select max(id) from items where id < ?)) as prev "
|
||||
+ "from items where items.id = ? limit 1",
|
||||
p: (trend, order) => `select id, mime from items where id ${trend} ? order by id ${order} limit ?`,
|
||||
user: "select id, mime, size, src, stamp, userchannel, username, usernetwork from items where username = ? limit ?"
|
||||
};
|
||||
|
@ -10,7 +10,7 @@ export default new class {
|
||||
[ "elseif", t => `}else if(${t.slice(6).trim()}){` ],
|
||||
[ "else", () => "}else{" ],
|
||||
[ "/if", () => "}" ],
|
||||
[ "include", (t, data) => `html+='${this.render(t.slice(7).trim(), data)}';` ], //`html+=util.include("${t.slice(7).trim()}", data);`], // parse them aswell
|
||||
[ "include", (t, data) => `html+='${this.render(t.slice(7).trim(), data)}';` ],
|
||||
[ "=", t => `html+=${t.slice(1).trim()};` ]
|
||||
];
|
||||
readdir(dir, root = dir, rel = dir.replace(`${root}/`, "")) {
|
||||
|
@ -35,7 +35,7 @@ export default async bot => {
|
||||
e.reply(`${tmp.length}, ${rows.length}, ${dir.length}`);
|
||||
break;
|
||||
default:
|
||||
return e.reply("lul");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
@ -1,5 +1,6 @@
|
||||
import cfg from "../../../config.json";
|
||||
import sql from "../sql.mjs";
|
||||
import lib from "../lib.mjs";
|
||||
|
||||
import fs from "fs";
|
||||
import { exec as _exec } from "child_process";
|
||||
@ -8,6 +9,10 @@ const exec = promisify(_exec);
|
||||
|
||||
const regex = /https?:\/\/[\w\S(\.|:|/)]+/gi;
|
||||
|
||||
console.log(
|
||||
lib.calcSpeed(123456, 56432)
|
||||
);
|
||||
|
||||
export default async bot => {
|
||||
|
||||
return [{
|
||||
@ -40,9 +45,11 @@ export default async bot => {
|
||||
const filename = `${uuid}.${meta.ext}`;
|
||||
|
||||
// download data
|
||||
const source = (await exec(`youtube-dl "${link}" --max-filesize 100m -o ./tmp/${filename}`)).stdout.trim();
|
||||
const start = new Date();
|
||||
const source = (await exec(`youtube-dl "${link}" --max-filesize 10000m -o ./tmp/${filename}`)).stdout.trim();
|
||||
if(source.match(/larger than/))
|
||||
return e.reply("too large lol");
|
||||
const end = ~~((new Date() - start) / 1e3);
|
||||
|
||||
// generate checksum
|
||||
const checksum = (await exec(`sha256sum ./tmp/${filename}`)).stdout.trim().split(" ")[0];
|
||||
@ -81,8 +88,8 @@ export default async bot => {
|
||||
|
||||
e.reply([
|
||||
`title: ${meta.fulltitle}`,
|
||||
`name: ${filename}`,
|
||||
`size: ${size}`,
|
||||
`size: ${lib.formatSize(size)}`,
|
||||
`speed: ${lib.calcSpeed(size, end)}`,
|
||||
`link: ${cfg.main.url}/${insertq.insertId}`
|
||||
]);
|
||||
|
||||
|
@ -38,13 +38,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="metadata">
|
||||
<span class="badge badge-dark"><a href="/{{=item.id}}" class="id-link">{{=item.id}} </a> by {{=user.name}}</span>
|
||||
<span class="badge badge-dark"><a href="/{{=item.id}}" class="id-link">{{=item.id}}</a> by {{=user.name}}</span>
|
||||
<span class="badge badge-dark">{{=user.network}} / {{=user.channel}}</span>
|
||||
<span class="badge badge-dark"><a id="post_source" href="{{=item.src.long}}"
|
||||
target="_blank">{{=item.src.short}}</a></span>
|
||||
<span class="badge badge-dark"><a id="post_source" href="{{=item.src.long}}" target="_blank">{{=item.src.short}}</a></span>
|
||||
<span class="badge badge-dark">{{=item.size}}</span>
|
||||
<span class="badge badge-dark"><time class="timeago" title="{{=item.timestamp}}" datetime="{{=item.timestamp}}">
|
||||
</time></span>
|
||||
<span class="badge badge-dark"><time class="timeago" title="{{=item.timestamp}}" datetime="{{=item.timestamp}}"></time></span>
|
||||
<span class="badge badge-dark" id="themes"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user