Merge pull request 'main' (#3) from ashley/poke:main into main

Reviewed-on: https://codeberg.org/Korbs/poke/pulls/3
This commit is contained in:
Korbs 2024-05-08 05:56:03 +00:00
commit 43cf7dc468
15 changed files with 442 additions and 369 deletions

25
ascii_txt.txt Normal file
View file

@ -0,0 +1,25 @@
_____ _______ _____ _____
/\ \ /::\ \ /\ \ /\ \
/::\ \ /::::\ \ /::\____\ /::\ \
/::::\ \ /::::::\ \ /:::/ / /::::\ \
/::::::\ \ /::::::::\ \ /:::/ / /::::::\ \
/:::/\:::\ \ /:::/~~\:::\ \ /:::/ / /:::/\:::\ \
/:::/__\:::\ \ /:::/ \:::\ \ /:::/____/ /:::/__\:::\ \
/::::\ \:::\ \ /:::/ / \:::\ \ /::::\ \ /::::\ \:::\ \
/::::::\ \:::\ \ /:::/____/ \:::\____\ /::::::\____\________ /::::::\ \:::\ \
/:::/\:::\ \:::\____\ |:::| | |:::| | /:::/\:::::::::::\ \ /:::/\:::\ \:::\ \
/:::/ \:::\ \:::| ||:::|____| |:::| |/:::/ |:::::::::::\____\/:::/__\:::\ \:::\____\
\::/ \:::\ /:::|____| \:::\ \ /:::/ / \::/ |::|~~~|~~~~~ \:::\ \:::\ \::/ /
\/_____/\:::\/:::/ / \:::\ \ /:::/ / \/____|::| | \:::\ \:::\ \/____/
\::::::/ / \:::\ /:::/ / |::| | \:::\ \:::\ \
\::::/ / \:::\__/:::/ / |::| | \:::\ \:::\____\
\::/____/ \::::::::/ / |::| | \:::\ \::/ /
~~ \::::::/ / |::| | \:::\ \/____/
\::::/ / |::| | \:::\ \
\::/____/ \::| | \:::\____\
~~ \:| | \::/ /
\|___| \/____/

View file

@ -5,7 +5,7 @@
"invchannel": "https://invid-api.poketube.fun/api/v1",
"p_url":"https://p.poketube.fun",
"media_proxy": "https://image-proxy.poketube.fun",
"videourl":"https://usa-proxy.poketube.fun",
"videourl":"https://eu-proxy.poketube.fun",
"email_main_url":"https://email-server.poketube.fun",
"mastodon_client_url":"https://fediverse.poketube.fun",
"libreoffice_online_url":"https://office.poketube.fun",

BIN
css/poke-screnshot-v2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,020 KiB

View file

@ -739,22 +739,22 @@ a.new-button:hover {
border-radius:10px;
height:fit-content;
padding:10px;
font-family: "ubuntu", sans-serif;
margin-left: -11em;
font-family:ubuntu,sans-serif;
width:43em;
position:absolute;
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: pre-wrap; /* css-3 */
word-wrap: break-word; /* Internet Explorer 5.5+ */
white-space: -webkit-pre-wrap; /* Newer versions of Chrome/Safari*/
white-space:-moz-pre-wrap!important;
white-space:-pre-wrap;
white-space:-o-pre-wrap;
white-space:pre-wrap;
word-wrap:break-word;
white-space:-webkit-pre-wrap;
word-break:break-all;
white-space:normal;
height:-moz-fit-content;
height:-webkit-fit-content;
max-width:708px;
max-height:185.6px;
margin-right: 13em;
}
@media screen and (min-width: 1400px) {

View file

@ -1,4 +1,4 @@
<%- include('error.ejs', {
error: "404",
description: "Very 1984 Innit? I dont think this webpage exist :p"
error: "404 ER_ROR",
description: "you are in violation. thEy mustn't know you were here. no one should ever find out About this. you can never tell anyone about thiS -- for The sake of the others' survIval, you muSt keep this silent. we mUst keeP silent. no one can know. no one can know. no o ne c an kn ow_ (Violation Code. 15398642_14)"
}) %>

View file

@ -107,7 +107,7 @@
<img src="/static/poke-chan-outfit-a.png" title="Poke-chan sitting :3">
<div style="display: flex; gap: 12px;">
<img src="/static/poke-screnshot-a.png" />
<img src="/static/poke-screnshot-v2.png" />
<img src="/static/Poke-Mobile.jpg" />
</div>

View file

@ -370,12 +370,12 @@ a[data-onclick="jump_to_time"] {
</style>
<!-- css files -->
<link href="/css/app-cdn.min.css" rel=stylesheet>
<link href="/css/app.main.css?v=44600" rel=stylesheet>
<link href="/css/watch.main.css" rel=stylesheet>
<link href="/css/watch-util.css" rel=stylesheet>
<link href="/css/watch-navbar.css" rel=stylesheet>
<link href="/css/poketube.css?v=989344" rel=stylesheet>
<link href="/css/app-cdn.min.css?v=9893448" rel=stylesheet>
<link href="/css/app.main.css?v=446008" rel=stylesheet>
<link href="/css/watch.main.css?v=9893448" rel=stylesheet>
<link href="/css/watch-util.css?v=9893448" rel=stylesheet>
<link href="/css/watch-navbar.css?v=9893448" rel=stylesheet>
<link href="/css/poketube.css?v=98934844" rel=stylesheet>
<% if (k.Video.Channel.Name == "7clouds") { %>
<style>
@ -395,6 +395,11 @@ a[data-onclick="jump_to_time"] {
.auto-play{
display:none !important;
}
.theather {
display:none !important;
}
.progress-container {
display:none !important;
}
@ -1061,11 +1066,16 @@ Privacy
<input type="checkbox" class="v" id="box" style="display:none">
<label class="h" for="box">
<div class="fnt">
<i title="Stats for nerdys" class="fa-light fa-bug"></i> Stats
<% if (Math.floor(Math.random() * 50) === 0) { %>
<i title="Stats for nerdys" class="fa-light fa-bug"></i> Stats For Puppies
<% } else { %>
<i title="Stats for nerdys" class="fa-light fa-bug"></i> Stats For Nerds
<% } %>
</div>
</label>
<a onclick="if(document.querySelector('.watch-page').style.display === 'grid') {document.querySelector('.watch-page').style.display = 'flex'} else {document.querySelector('.watch-page').style.display = 'grid'}"><i class="fa-sharp fa-light fa-up-right-and-down-left-from-center"></i> Theater</a>
<a onclick="if(document.querySelector('.watch-page').style.display === 'grid') {document.querySelector('.watch-page').style.display = 'flex'} else {document.querySelector('.watch-page').style.display = 'grid'}" class="theather"><i class="fa-sharp fa-light fa-up-right-and-down-left-from-center"></i> Theater</a>
<% if (inv.comments) { %>
<input type="checkbox" class="hj" id="j" style="display:none">

View file

@ -24,7 +24,7 @@
<link href=/css/yt-ukraine.svg?v=6 rel=icon>
<link href=/css/app-cdn.min.css rel=stylesheet>
<link href=/css/app.main.css?v=44600 rel=stylesheet>
<link href=/css/search.main.css?v=57 rel=stylesheet>
<link href=/css/search.main.css?v=547 rel=stylesheet>
<link href=/css/watch.main.css rel=stylesheet>
<meta name="darkreader-lock"> <!-- tells dark reader that the site has a dark theme and to turn itself off -->
<meta content="Searching <%=q%> - Poke" property=og:title>

6
infocards.json Normal file
View file

@ -0,0 +1,6 @@
{
"Open Source":{
"infocard":"<i>Open Source</i> is a wrong terminology",
"more_info":"https://gnu.org/not-open-source"
}
}

View file

@ -32,9 +32,19 @@
const media_proxy = require("./src/libpoketube/libpoketube-video.js");
const { sinit } = require("./src/libpoketube/init/superinit.js");
const innertube = require("./src/libpoketube/libpoketube-youtubei-objects.json");
const fs = require("fs");
const config = require("./config.json");
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(
"[Welcome] Welcome To Poke - The ultimate privacy app - :3 " +
@ -65,7 +75,6 @@
const sha384 = modules.hash;
const rateLimit = require("express-rate-limit");
const limiter = rateLimit({
windowMs: 45 * 1000, // 45 Seconds
max: 886, // limit each IP to 866 requests per windowMs
@ -79,7 +88,7 @@
app.use(modules.useragent.express());
app.use(modules.express.json()); // for parsing application/json
app.enable("trust proxy");
var toobusy = require('toobusy-js')
var toobusy = require("toobusy-js");
const renderTemplate = async (res, req, template, data = {}) => {
res.render(
@ -107,7 +116,6 @@ toobusy.maxLag(3500);
console.log("Event loop lag detected! Latency: " + currentLag + "ms");
});
const random_words = [
"banana pie",
"how to buy an atom bomb",
@ -140,8 +148,8 @@ toobusy.maxLag(3500);
res.header("secure-poketube-instance", "1");
// opt out of googles "FLOC" bullcrap :p See https://spreadprivacy.com/block-floc-with-duckduckgo/
res.header("Permissions-Policy", "interest-cohort=()")
res.header("software-name", "poke")
res.header("Permissions-Policy", "interest-cohort=()");
res.header("software-name", "poke");
next();
});
@ -162,10 +170,22 @@ toobusy.maxLag(3500);
});
app.use(function (req, res, next) {
res.header("X-PokeTube-Youtube-Client-Name", innertube.innertube.CONTEXT_CLIENT.INNERTUBE_CONTEXT_CLIENT_NAME);
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-Youtube-Client-Name",
innertube.innertube.CONTEXT_CLIENT.INNERTUBE_CONTEXT_CLIENT_NAME
);
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-HOSTNAME", req.hostname);
if (req.url.match(/^\/(css|js|img|font)\/.+/)) {

View file

@ -58,6 +58,7 @@ const splash = [
"not done, josh dun!",
"your the judge, oh no!",
"I dont wanna backslide",
"welcome back to trench!",
"sai is propaganda!",
" •|i|• Ø i+! ].[",
"stay alive! |-/",

View file

@ -31,13 +31,13 @@ const os = require('os');
const cnf = require("../../../config.json");
const innertube = require("../libpoketube-youtubei-objects.json");
const verfull = "v24.2801-JeSsIcA-MAJOR-stable-dev-nonLTS-git-MTcwNjQzMTc0OQ==";
const versmol = "v24.2801-JeSsIcA"
const verfull = "v24.0605-VeE-MINOR_UPDATE-stable-dev-nonLTS-git-MTcxNTAwOTczNQ==";
const versmol = "v24.0605-vEe"
const branch = "dev/master";
const codename = "jessica";
const versionnumber = "273";
const relaseunixdate = "MTcwNjQzMTc0OQ=="
const updatequote = "Empty your cup so that it may be filled; become devoid to gain totality. - Bruce Lee"
const codename = "vee";
const versionnumber = "291";
const relaseunixdate = "MTcxNTAwOTczNQ=="
const updatequote = "Love is the ultimate software update; embrace the patches, for they refine the code of our shared existence, hand in hand, heart to heard (unknown)"
module.exports = function (app, config, renderTemplate) {

View file

@ -110,9 +110,11 @@ module.exports = function (app, config, renderTemplate) {
if (query) {
let redirectTo = null;
let splitParam = ":";
if (query.includes("youtube.com/watch?v=")) {
redirectTo = "/watch?v=";
redirectTo = "/watch";
splitParam = "?v=";
} else if (query.includes("channel:")) {
redirectTo = "/channel?id=";
} else if (query.includes("video:")) {
@ -121,8 +123,8 @@ module.exports = function (app, config, renderTemplate) {
if (redirectTo) {
try {
const id = query.split(":")[1];
res.redirect(`${redirectTo}${id}`);
const id = query.split(splitParam)[1];
res.redirect(`${redirectTo}${splitParam}${id}`);
} catch {
return;
}
@ -229,7 +231,6 @@ module.exports = function (app, config, renderTemplate) {
let continuation = req.query.continuation || "";
try {
const results = web.web;
renderTemplate(res, req, "search-web.ejs", {

View file

@ -141,8 +141,8 @@ function lightOrDark(color) {
}
function isDntEnabled(req) {
const dntHeader = req.header('DNT');
return dntHeader && (dntHeader === '1' || dntHeader === 'true');
const dntHeader = req.header("DNT");
return dntHeader && (dntHeader === "1" || dntHeader === "true");
}
function IsInArray(array, id) {
@ -203,10 +203,11 @@ module.exports = function (app, config, renderTemplate) {
const secure = ["poketube.fun"].includes(req.hostname);
const verify = req.hostname === "poketube.sudovanilla.com";
INNERTUBE.getYouTubeApiVideo(f, v, contentlang, contentregion).then((data) => {
INNERTUBE.getYouTubeApiVideo(f, v, contentlang, contentregion).then(
(data) => {
try {
const k = data?.video;
const channel_uploads = data?.channel_uploads
const channel_uploads = data?.channel_uploads;
const json = data?.json;
const engagement = data?.engagement;
const inv_comments = data?.comments || "Disabled";
@ -218,7 +219,6 @@ module.exports = function (app, config, renderTemplate) {
d = desc.toString().replace(/\n/g, " <br> ");
}
const descriptionString = String(inv_vid?.description);
function extractInfo(regex) {
@ -234,12 +234,10 @@ module.exports = function (app, config, renderTemplate) {
const reddit = extractInfo(REDDIT_REGEX);
const instagram = extractInfo(INSTAGRAM_REGEX);
var proxyurl = config.p_url;
var vidurl = u.url;
var isvidious = u.isInvidiousURL;
var mediaproxy = config.media_proxy
var mediaproxy = config.media_proxy;
if (inv_vid?.genre === "Music") {
var vidurl = u.losslessurl;
@ -250,7 +248,7 @@ module.exports = function (app, config, renderTemplate) {
if (req.useragent.source.includes("Pardus")) {
var vidurl = "https://iv.ggtyler.dev";
var mediaproxy = "https://media-proxy.ashley0143.xyz"
var mediaproxy = "https://nyc1.pokejan.ggtyler.dev/";
var isvidious = true;
var isSchoolProxy = "";
}
@ -260,7 +258,7 @@ module.exports = function (app, config, renderTemplate) {
let comments = "";
let nnn = "";
const dnt_val = isDntEnabled(req)
const dnt_val = isDntEnabled(req);
if (
inv_vid?.error ===
@ -272,6 +270,12 @@ module.exports = function (app, config, renderTemplate) {
);
}
if (inv_vid?.error) {
renderTemplate(res, req, "404.ejs", {
v,
});
}
var uaos = req.useragent.os;
const browser = req.useragent.browser;
const IsOldWindows =
@ -344,7 +348,8 @@ module.exports = function (app, config, renderTemplate) {
console.error(error);
return res.redirect(`/watch?v=${req.query.v}&fx=1&err=${error}`);
}
});
}
);
});
app.get("/lite", async (req, res) => {
@ -367,10 +372,11 @@ module.exports = function (app, config, renderTemplate) {
const secure = ["poketube.fun"].includes(req.hostname);
const verify = req.hostname === "poketube.sudovanilla.com";
INNERTUBE.getYouTubeApiVideo(f, v, contentlang, contentregion).then((data) => {
INNERTUBE.getYouTubeApiVideo(f, v, contentlang, contentregion).then(
(data) => {
try {
const k = data?.video;
const channel_uploads = data?.channel_uploads
const channel_uploads = data?.channel_uploads;
const json = data?.json;
const engagement = data?.engagement;
const inv_comments = data?.comments || "Disabled";
@ -382,7 +388,6 @@ module.exports = function (app, config, renderTemplate) {
d = desc.toString().replace(/\n/g, " <br> ");
}
const descriptionString = String(inv_vid?.description);
function extractInfo(regex) {
@ -398,12 +403,10 @@ module.exports = function (app, config, renderTemplate) {
const reddit = extractInfo(REDDIT_REGEX);
const instagram = extractInfo(INSTAGRAM_REGEX);
var proxyurl = config.p_url;
var vidurl = u.url;
var isvidious = u.isInvidiousURL;
var mediaproxy = config.media_proxy
var mediaproxy = config.media_proxy;
if (inv_vid?.genre === "Music") {
var vidurl = u.losslessurl;
@ -414,7 +417,7 @@ module.exports = function (app, config, renderTemplate) {
if (req.useragent.source.includes("Pardus")) {
var vidurl = "https://iv.ggtyler.dev";
var mediaproxy = "https://media-proxy.ashley0143.xyz"
var mediaproxy = "https://media-proxy.ashley0143.xyz";
var isvidious = true;
var isSchoolProxy = "";
}
@ -424,7 +427,7 @@ module.exports = function (app, config, renderTemplate) {
let comments = "";
let nnn = "";
const dnt_val = isDntEnabled(req)
const dnt_val = isDntEnabled(req);
if (
inv_vid?.error ===
@ -504,7 +507,8 @@ module.exports = function (app, config, renderTemplate) {
console.error(error);
return res.redirect(`/watch?v=${req.query.v}&fx=1&err=${error}`);
}
});
}
);
});
app.get("/music", async function (req, res) {

View file

@ -30,7 +30,13 @@ class InnerTubePokeVidious {
this.config = config;
this.cache = {};
this.language = "hl=en-US";
this.param = "2AMB"
this.param_legacy = "CgIIAdgDAQ%3D%3D"
this.apikey = "AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8"
this.ANDROID_API_KEY = "AIzaSyA8eiZmM1FaDVjRy-df2KTyQ_vz_yYM39w"
this.ANDROID_APP_VERSION = "19.14.42"
this.ANDROID_VERSION = "13"
this.useragent = "com.google.android.youtube/19.14.42 (Linux; U; Android 12; US) gzip"
this.INNERTUBE_CONTEXT_CLIENT_VERSION = "1"
this.region = "region=US";
this.sqp = "-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw";