mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-22 05:37:58 +01:00
add ascii txt :3
This commit is contained in:
parent
19fa78253c
commit
8c3692d94a
1 changed files with 53 additions and 33 deletions
86
server.js
86
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,12 +75,11 @@
|
||||||
const sha384 = modules.hash;
|
const sha384 = modules.hash;
|
||||||
const rateLimit = require("express-rate-limit");
|
const rateLimit = require("express-rate-limit");
|
||||||
|
|
||||||
|
const limiter = rateLimit({
|
||||||
|
windowMs: 45 * 1000, // 45 Seconds
|
||||||
|
max: 886, // limit each IP to 866 requests per windowMs
|
||||||
|
});
|
||||||
|
|
||||||
const limiter = rateLimit({
|
|
||||||
windowMs:45 * 1000, // 45 Seconds
|
|
||||||
max: 886, // limit each IP to 866 requests per windowMs
|
|
||||||
});
|
|
||||||
|
|
||||||
var app = modules.express();
|
var app = modules.express();
|
||||||
app.use(limiter);
|
app.use(limiter);
|
||||||
initlog("Loaded express.js");
|
initlog("Loaded express.js");
|
||||||
|
@ -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(
|
||||||
|
@ -87,26 +96,25 @@
|
||||||
Object.assign(data)
|
Object.assign(data)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set check interval to a faster value. This will catch more latency spikes
|
|
||||||
// but may cause the check to be too sensitive.
|
|
||||||
toobusy.interval(110);
|
|
||||||
|
|
||||||
toobusy.maxLag(3500);
|
// Set check interval to a faster value. This will catch more latency spikes
|
||||||
|
// but may cause the check to be too sensitive.
|
||||||
app.use(function(req, res, next) {
|
toobusy.interval(110);
|
||||||
if (toobusy()) {
|
|
||||||
res.send(503, "I'm busy right now, sorry.");
|
toobusy.maxLag(3500);
|
||||||
} else {
|
|
||||||
next();
|
app.use(function (req, res, next) {
|
||||||
}
|
if (toobusy()) {
|
||||||
});
|
res.send(503, "I'm busy right now, sorry.");
|
||||||
|
} else {
|
||||||
toobusy.onLag(function(currentLag) {
|
next();
|
||||||
process.exit(1);
|
}
|
||||||
console.log("Event loop lag detected! Latency: " + currentLag + "ms");
|
});
|
||||||
});
|
|
||||||
|
toobusy.onLag(function (currentLag) {
|
||||||
|
process.exit(1);
|
||||||
|
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)\/.+/)) {
|
||||||
|
@ -177,7 +197,7 @@ toobusy.maxLag(3500);
|
||||||
}
|
}
|
||||||
|
|
||||||
const a = 890;
|
const a = 890;
|
||||||
|
|
||||||
if (!req.url.match(/^\/(css|js|img|font)\/.+/)) {
|
if (!req.url.match(/^\/(css|js|img|font)\/.+/)) {
|
||||||
res.setHeader("Cache-Control", "public, max-age=" + a); // cache header
|
res.setHeader("Cache-Control", "public, max-age=" + a); // cache header
|
||||||
res.setHeader("poketube-cacher", "PAGE");
|
res.setHeader("poketube-cacher", "PAGE");
|
||||||
|
|
Loading…
Reference in a new issue