mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 03:08:38 +01:00
add ascii txt :3
This commit is contained in:
parent
19fa78253c
commit
8c3692d94a
1 changed files with 53 additions and 33 deletions
56
server.js
56
server.js
|
@ -32,9 +32,19 @@
|
||||||
const media_proxy = require("./src/libpoketube/libpoketube-video.js");
|
const media_proxy = require("./src/libpoketube/libpoketube-video.js");
|
||||||
const { sinit } = require("./src/libpoketube/init/superinit.js");
|
const { sinit } = require("./src/libpoketube/init/superinit.js");
|
||||||
const innertube = require("./src/libpoketube/libpoketube-youtubei-objects.json");
|
const innertube = require("./src/libpoketube/libpoketube-youtubei-objects.json");
|
||||||
|
const fs = require("fs");
|
||||||
const config = require("./config.json");
|
const config = require("./config.json");
|
||||||
const u = await media_proxy();
|
const u = await media_proxy();
|
||||||
|
|
||||||
|
fs.readFile("ascii_txt.txt", "utf8", (err, data) => {
|
||||||
|
if (err) {
|
||||||
|
console.error("Error reading the file:", err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Log the ASCII art to the console
|
||||||
|
console.log(data);
|
||||||
|
});
|
||||||
initlog("Loading...");
|
initlog("Loading...");
|
||||||
initlog(
|
initlog(
|
||||||
"[Welcome] Welcome To Poke - The ultimate privacy app - :3 " +
|
"[Welcome] Welcome To Poke - The ultimate privacy app - :3 " +
|
||||||
|
@ -65,9 +75,8 @@
|
||||||
const sha384 = modules.hash;
|
const sha384 = modules.hash;
|
||||||
const rateLimit = require("express-rate-limit");
|
const rateLimit = require("express-rate-limit");
|
||||||
|
|
||||||
|
|
||||||
const limiter = rateLimit({
|
const limiter = rateLimit({
|
||||||
windowMs:45 * 1000, // 45 Seconds
|
windowMs: 45 * 1000, // 45 Seconds
|
||||||
max: 886, // limit each IP to 866 requests per windowMs
|
max: 886, // limit each IP to 866 requests per windowMs
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -79,7 +88,7 @@
|
||||||
app.use(modules.useragent.express());
|
app.use(modules.useragent.express());
|
||||||
app.use(modules.express.json()); // for parsing application/json
|
app.use(modules.express.json()); // for parsing application/json
|
||||||
app.enable("trust proxy");
|
app.enable("trust proxy");
|
||||||
var toobusy = require('toobusy-js')
|
var toobusy = require("toobusy-js");
|
||||||
|
|
||||||
const renderTemplate = async (res, req, template, data = {}) => {
|
const renderTemplate = async (res, req, template, data = {}) => {
|
||||||
res.render(
|
res.render(
|
||||||
|
@ -89,24 +98,23 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set check interval to a faster value. This will catch more latency spikes
|
// Set check interval to a faster value. This will catch more latency spikes
|
||||||
// but may cause the check to be too sensitive.
|
// but may cause the check to be too sensitive.
|
||||||
toobusy.interval(110);
|
toobusy.interval(110);
|
||||||
|
|
||||||
toobusy.maxLag(3500);
|
toobusy.maxLag(3500);
|
||||||
|
|
||||||
app.use(function(req, res, next) {
|
app.use(function (req, res, next) {
|
||||||
if (toobusy()) {
|
if (toobusy()) {
|
||||||
res.send(503, "I'm busy right now, sorry.");
|
res.send(503, "I'm busy right now, sorry.");
|
||||||
} else {
|
} else {
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
toobusy.onLag(function(currentLag) {
|
toobusy.onLag(function (currentLag) {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
console.log("Event loop lag detected! Latency: " + currentLag + "ms");
|
console.log("Event loop lag detected! Latency: " + currentLag + "ms");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
const random_words = [
|
const random_words = [
|
||||||
"banana pie",
|
"banana pie",
|
||||||
|
@ -140,8 +148,8 @@ toobusy.maxLag(3500);
|
||||||
res.header("secure-poketube-instance", "1");
|
res.header("secure-poketube-instance", "1");
|
||||||
|
|
||||||
// opt out of googles "FLOC" bullcrap :p See https://spreadprivacy.com/block-floc-with-duckduckgo/
|
// opt out of googles "FLOC" bullcrap :p See https://spreadprivacy.com/block-floc-with-duckduckgo/
|
||||||
res.header("Permissions-Policy", "interest-cohort=()")
|
res.header("Permissions-Policy", "interest-cohort=()");
|
||||||
res.header("software-name", "poke")
|
res.header("software-name", "poke");
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -162,10 +170,22 @@ toobusy.maxLag(3500);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use(function (req, res, next) {
|
app.use(function (req, res, next) {
|
||||||
res.header("X-PokeTube-Youtube-Client-Name", innertube.innertube.CONTEXT_CLIENT.INNERTUBE_CONTEXT_CLIENT_NAME);
|
res.header(
|
||||||
res.header("Hey-there", "Do u wanna help poke? contributons are welcome :3 https://codeberg.org/Ashley/poke")
|
"X-PokeTube-Youtube-Client-Name",
|
||||||
res.header("X-PokeTube-Youtube-Client-Version", innertube.innertube.CLIENT.clientVersion);
|
innertube.innertube.CONTEXT_CLIENT.INNERTUBE_CONTEXT_CLIENT_NAME
|
||||||
res.header("X-PokeTube-Client-name", innertube.innertube.CLIENT.projectClientName);
|
);
|
||||||
|
res.header(
|
||||||
|
"Hey-there",
|
||||||
|
"Do u wanna help poke? contributons are welcome :3 https://codeberg.org/Ashley/poke"
|
||||||
|
);
|
||||||
|
res.header(
|
||||||
|
"X-PokeTube-Youtube-Client-Version",
|
||||||
|
innertube.innertube.CLIENT.clientVersion
|
||||||
|
);
|
||||||
|
res.header(
|
||||||
|
"X-PokeTube-Client-name",
|
||||||
|
innertube.innertube.CLIENT.projectClientName
|
||||||
|
);
|
||||||
res.header("X-PokeTube-Speeder", "3 seconds no cache, 280ms w/cache");
|
res.header("X-PokeTube-Speeder", "3 seconds no cache, 280ms w/cache");
|
||||||
res.header("X-HOSTNAME", req.hostname);
|
res.header("X-HOSTNAME", req.hostname);
|
||||||
if (req.url.match(/^\/(css|js|img|font)\/.+/)) {
|
if (req.url.match(/^\/(css|js|img|font)\/.+/)) {
|
||||||
|
|
Loading…
Reference in a new issue