Merge branch 'main' into main

This commit is contained in:
Kiril Misnikov 2023-12-03 08:15:32 +00:00
commit 76435c2c84
5 changed files with 79 additions and 78 deletions

View file

@ -3,7 +3,7 @@
"invapi": "https://invid-api.poketube.fun/api/v1", "invapi": "https://invid-api.poketube.fun/api/v1",
"dislikes": "https://returnyoutubedislikeapi.com/votes?videoId=", "dislikes": "https://returnyoutubedislikeapi.com/votes?videoId=",
"invchannel": "https://invid-api.poketube.fun/api/v1", "invchannel": "https://invid-api.poketube.fun/api/v1",
"cacher_max_age": "1800", "cacher_max_age": "864000",
"enablealwayshttps": false, "enablealwayshttps": false,
"t_url": "https://t.poketube.fun/", "t_url": "https://t.poketube.fun/",
"server_port": "6003" "server_port": "6003"

View file

@ -52,11 +52,6 @@
<link href="/css/yt-ukraine.svg?v=3" rel=icon> <link href="/css/yt-ukraine.svg?v=3" rel=icon>
<link href=/css/snow.css rel=stylesheet> <link href=/css/snow.css rel=stylesheet>
<ptd-event-chunks>
poketube.eventloader = this.eventloader
load()
</ptd-event-chunks>
<title> <%=inv_vid.title%> | PokeTube </title> <title> <%=inv_vid.title%> | PokeTube </title>
<style> <style>
@ -357,12 +352,12 @@ a[data-onclick="jump_to_time"] {
</style> </style>
<!-- css files --> <!-- css files -->
<link href="/css/app-cdn.min.css?v=<%=btoa(Date.now())%>" rel=stylesheet> <link href="/css/app-cdn.min.css" rel=stylesheet>
<link href="/css/app.main.css?v=<%=btoa(Date.now())%>" rel=stylesheet> <link href="/css/app.main.css" rel=stylesheet>
<link href="/css/watch.main.css?v=<%=btoa(Date.now())%>" rel=stylesheet> <link href="/css/watch.main.css" rel=stylesheet>
<link href="/css/watch-util.css?v=<%=btoa(Date.now())%>" rel=stylesheet> <link href="/css/watch-util.css" rel=stylesheet>
<link href="/css/watch-navbar.css?v=<%=btoa(Date.now())%>" rel=stylesheet> <link href="/css/watch-navbar.css" rel=stylesheet>
<link href="/css/poketube.css?v=<%=btoa(Date.now())%>" rel=stylesheet> <link href="/css/poketube.css" rel=stylesheet>
<!-- ICONS --> <!-- ICONS -->
<link href="https://p.poketube.fun/https://site-assets.fontawesome.com/releases/v6.1.1/css/all.css" rel=stylesheet> <link href="https://p.poketube.fun/https://site-assets.fontawesome.com/releases/v6.1.1/css/all.css" rel=stylesheet>
@ -1812,7 +1807,10 @@ window.addEventListener("unload", cleanup)
} }
</style> </style>
<% } %> <% } %>
<script src="/static/app.bundle.js?ver=<%-btoa("1f739d93") %>&bundledat=<%- Date.now() %>"></script>
<script src="/static/app.bundle.js" > </script>
<% if(secure) { %> <% if(secure) { %>
<!-- Matomo --> <!-- Matomo -->
@ -1880,7 +1878,8 @@ if (Ashley && !Ashley.dntEnabled()) {
<% } %> <% } %>
<style> img.emoji {height: 1em;width: 1em;margin: 0 .05em 0 .1em;vertical-align: -0.1em;}</style> <style> img.emoji {height: 1em;width: 1em;margin: 0 .05em 0 .1em;vertical-align: -0.1em;}</style>
<script>twemoji.parse(document.body,{ base: 'https://cdn.zptr.cc/twemoji/' })</script><script> <script>twemoji.parse(document.body,{ base: 'https://cdn.zptr.cc/twemoji/' }) </script>
<script>
window.GLOBAL_ENV = { window.GLOBAL_ENV = {
API_ENDPOINT_INVID:"https://invid-api.poketube.fun/api/v1", API_ENDPOINT_INVID:"https://invid-api.poketube.fun/api/v1",
API_ENDPOINT_INNER:"https://inner-api.poketube.fun/api/", API_ENDPOINT_INNER:"https://inner-api.poketube.fun/api/",
@ -2060,7 +2059,7 @@ a {
<div class="video-player-container" style="background-color:#000"> <div class="video-player-container" style="background-color:#000">
<% if (lightOrDark(color) == "dark") { %> <% if (lightOrDark(color) == "dark") { %>
<video class="player" id="video" style="border-radius: 6px;box-shadow: 0 10em 7em <%=color2 <video class="player" id="video" style="border-radius: 6px;box-shadow: 0 13em 14em <%=color2
%>;" autoplay controls %>;" autoplay controls
poster="https://p.poketube.fun/https://i.ytimg.com/vi/<%=inv_vid.videoId%>/maxresdefault.jpg?v=607ddcd4"> poster="https://p.poketube.fun/https://i.ytimg.com/vi/<%=inv_vid.videoId%>/maxresdefault.jpg?v=607ddcd4">
@ -2068,7 +2067,7 @@ a {
<% } %> <% } %>
<% if (lightOrDark(color) == "light") { %> <% if (lightOrDark(color) == "light") { %>
<video class="player" id="video" style="border-radius: 6px;box-shadow: 0 10em 7em <%=color <video class="player" id="video" style="border-radius: 6px;box-shadow: 0 13em 14em <%=color
%>;" autoplay controls %>;" autoplay controls
poster="https://p.poketube.fun/https://i.ytimg.com/vi/<%=inv_vid.videoId%>/maxresdefault.jpg?v=607ddcd4"> poster="https://p.poketube.fun/https://i.ytimg.com/vi/<%=inv_vid.videoId%>/maxresdefault.jpg?v=607ddcd4">
@ -2147,7 +2146,7 @@ font-size: 13px;margin:0;padding:0;white-space: nowrap;
<div class="name" style="font-family:var(--text-font-primary);font-weight:var(--text-header-weight);"> <div class="name" style="font-family:var(--text-font-primary);font-weight:var(--text-header-weight);">
<div> <div>
<a href="/channel?id=<%=k.Video.Channel.id%>" style="color:#fff;max-width: 9.8em;" class="max-lines-1"> <a href="/channel?id=<%=k.Video.Channel.id%>" style="color:#fff;max-width: 7.8em;" class="max-lines-1">
<%=k.Video.Channel.Name%></a> <%=k.Video.Channel.Name%></a>
<div class="subscriber-count" style="write-space:nowraap"> <div class="subscriber-count" style="write-space:nowraap">
@ -2274,45 +2273,60 @@ font-size: 13px;margin:0;padding:0;white-space: nowrap;
--> -->
</div> </div>
<% let randomNumber = Math.floor(Math.random() * 2) + 1; %>
<% if (Array.isArray( inv.comments)) { %>
<div class="comment-mini" style="padding: 0em;background: #0009;border-radius: 16px;align-self: center;align-items: center;margin-left: 8px;margin-right: 12px;padding-bottom: 0;padding-top:1em;<%= randomNumber === 2 ? 'visibility: collapse;' : '' %>"> <a id="language-button" href="#comments-container" style="" class="switch"> <div class="fromtheweb-inner" style="margin-left: 8px;margin-right: 12px;margin-bottom:6px;">
<div style="display: flex;gap: 3px;">
<div class="video-title" style="font-family:'PokeTube flex';font-weight:1000;white-space:yes;margin-top: -0.5em;margin-left: 0.8em;">Comments - <%- convert(inv.commentCount) %> <% if (twitter) { %>
<div style="background: #000;width: fit-content;padding: 5px;border-radius: 6px;margin-bottom: -15px;">
<img src="https://p.poketube.fun/https://cdn.glitch.global/d68d17bb-f2c0-4bc3-993f-50902734f652/8473b88f-36a4-437f-8c14-fb9e38a623d9.image.png?v=1693424579898" class="loaded" style="width: 22px;height: 23px;vertical-align: -7px;"><a style="margin: 1px;" href="https://nitter.net/<%- twitter.name %>"> @<%- twitter.name %></a>
</div> </div>
<div class="" style="padding: 0em !important;margin-left: 0.3em;">
<div class="desc" style="display: flex;font-size: small;padding: 0;margin: -10px;margin-left: -0.5em">
<h5 style="display: flex;margin-top: 7px;padding-top: 10px;margin-left: 12px;">
<div class="thumb">
<div class="thumb">
<a href="/channel?id=<%- inv.comments[0].authorId%>" class="avatar" style="width: 40px;height: 40px;margin: 4px;">
<img src="/avatars/<%= inv.comments[0].authorThumbnails[1].url.replace("https://yt3.ggpht.com/", "") %>" style="width: 24px;height: 24px;margin-right: inherit;" >
</a>
</div>
</h5>
<p class="comment" style="font-weight: bold;color: #fff; word-wrap: break-word; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; text-overflow: ellipsis; max-width: 19em;align-self:center;">
<%- inv.comments[0].contentHtml %>
</p>
</div>
</div>
</a>
</div>
<% } %> <% } %>
<% if (discord) { %>
<div style="background: #000;width: fit-content;padding: 5px;border-radius: 6px;margin-bottom: -15px;">
<img src="https://p.poketube.fun/https://cdn.glitch.global/d68d17bb-f2c0-4bc3-993f-50902734f652/34e2accb-41ec-4b10-a1e8-a0d647ea6e76.image.png" class="loaded" style="width: 22px;height: 23px;vertical-align: -7px;"><a style="margin: 1px;" href="https://discord.gg/<%- discord.name %>"> /<%- discord.name %></a>
</div> </div>
<% } %>
<% if (twitch) { %>
<div style="background: #000;width: fit-content;padding: 5px;border-radius: 6px;margin-bottom: -15px;">
<img src="https://p.poketube.fun/https://cdn.glitch.global/d68d17bb-f2c0-4bc3-993f-50902734f652/d277ed96-59cd-44fe-a75a-56b3170fa634.image.png?v=1693429282139" class="loaded" style="width: 22px;height: 23px;vertical-align: -7px;"><a style="margin: 1px;" href="https://twitch.tv/<%- twitch.name %>"> /<%- twitch.name %></a>
</div>
<% } %>
<% if (reddit) { %>
<div style="background: #000;width: fit-content;padding: 5px;border-radius: 6px;margin-bottom: -15px;">
<img src="https://p.poketube.fun/https://cdn.glitch.global/d68d17bb-f2c0-4bc3-993f-50902734f652/3bea1171-8723-4719-b0ee-d98d1abbd174.image.png?v=1693429333706" class="loaded" style="width: 22px;height: 23px;vertical-align: -7px;"><a style="margin: 1px;" href="https://reddit.com/r/<%- reddit.name %>"> r/<%- reddit.name %></a>
</div>
<% } %>
<% if (instagram) { %>
<div style="background: #0009;width: fit-content;padding: 5px;border-radius: 6px;margin-bottom: -15px;">
<img src="https://p.poketube.fun/https://cdn.glitch.global/d68d17bb-f2c0-4bc3-993f-50902734f652/52704940-684c-41e8-b0de-cca642fa39f8.image.png?v=1693429793193" class="loaded" style="width: 22px;height: 23px;vertical-align: -7px;"><a style="margin: 1px;" href="https://instagram.com/<%- instagram.name %>"> <%- instagram.name %></a>
</div>
<% } %>
<% if (!twitter) { %>
<% if (!discord) { %>
<% if (!reddit) { %>
<% if (!twitch) { %>
<% if (!instagram) { %>
<div style="margin-top: 10px;">
Nyo connections found ;_;
</div>
<% } %>
<% } %>
<% } %>
<% } %> <% } %>
</div>
@ -2404,7 +2418,7 @@ the channels social media accounts!
<div style="display: flex;gap: 3px;"> <div style="display: flex;gap: 3px;">
<% if (twitter) { %> <% if (twitter) { %>
<div style="background: #0009;width: fit-content;padding: 5px;border-radius: 6px;margin-bottom: -15px;"> <div style="background: #0009;width: fit-content;padding: 5px;border-radius: 6px;margin-bottom: -15px;">
<img src="https://p.poketube.fun/https://cdn.glitch.global/d68d17bb-f2c0-4bc3-993f-50902734f652/8473b88f-36a4-437f-8c14-fb9e38a623d9.image.png?v=1693424579898" class="loaded" style="width: 22px;height: 23px;vertical-align: -7px;"><a style="margin: 1px;" href="https://x.com/<%- twitter.name %>"> @<%- twitter.name %></a> <img src="https://p.poketube.fun/https://cdn.glitch.global/d68d17bb-f2c0-4bc3-993f-50902734f652/8473b88f-36a4-437f-8c14-fb9e38a623d9.image.png?v=1693424579898" class="loaded" style="width: 22px;height: 23px;vertical-align: -7px;"><a style="margin: 1px;" href="https://nitter.net/<%- twitter.name %>"> @<%- twitter.name %></a>
</div> </div>
<% } %> <% } %>

View file

@ -98,7 +98,7 @@ const listener = (req, res) => {
app.get("/", (req, res) => { app.get("/", (req, res) => {
var json = { var json = {
status: "200", status: "200",
version: "1.1.0", version: "1.2.0",
URL_WHITELIST, URL_WHITELIST,
cache: "max-age-232337763", cache: "max-age-232337763",
}; };

View file

@ -52,7 +52,7 @@ module.exports = function (app, config, renderTemplate) {
}); });
app.get("/vi/:v/:t", async function (req, res) { app.get("/vi/:v/:t", async function (req, res) {
var url = `https://invid-api.poketube.fun/vi/${req.params.v}/${req.params.t}` var url = `https://invidious.snopyta.org/vi/${req.params.v}/${req.params.t}`
let f = await modules.fetch(url + `?cachefixer=${btoa(Date.now())}`, { let f = await modules.fetch(url + `?cachefixer=${btoa(Date.now())}`, {
method: req.method, method: req.method,
@ -63,7 +63,7 @@ module.exports = function (app, config, renderTemplate) {
}); });
app.get("/avatars/:v", async function (req, res) { app.get("/avatars/:v", async function (req, res) {
var url = `https://invid-api.poketube.fun/ggpht/${req.params.v}`; var url = `https://invidious.snopyta.org/ggpht/${req.params.v}`;
let f = await modules.fetch(url + `?cachefixer=${btoa(Date.now())}`, { let f = await modules.fetch(url + `?cachefixer=${btoa(Date.now())}`, {
method: req.method, method: req.method,
@ -73,7 +73,7 @@ app.get("/avatars/:v", async function (req, res) {
}); });
app.get("/ggpht/:v", async function (req, res) { app.get("/ggpht/:v", async function (req, res) {
var url = `https://invid-api.poketube.fun/ggpht/${req.params.v}`; var url = `https://invidious.snopyta.org/ggpht/${req.params.v}`;
let f = await modules.fetch(url + `?cachefixer=${btoa(Date.now())}`, { let f = await modules.fetch(url + `?cachefixer=${btoa(Date.now())}`, {
method: req.method, method: req.method,
@ -84,7 +84,7 @@ app.get("/avatars/:v", async function (req, res) {
app.get("/avatars/ytc/:v", async function (req, res) { app.get("/avatars/ytc/:v", async function (req, res) {
var url = `https://invid-api.poketube.fun/ggpht/ytc/${req.params.v.replace("ytc", "")}`; var url = `https://invidious.snopyta.org/ggpht/ytc/${req.params.v.replace("ytc", "")}`;
let f = await modules.fetch(url + `?cachefixer=${btoa(Date.now())}`, { let f = await modules.fetch(url + `?cachefixer=${btoa(Date.now())}`, {
method: req.method, method: req.method,

View file

@ -24,26 +24,13 @@ function init(app, config, rendertemplate) {
initlog("wait a few mins... pt on timeout rn"); initlog("wait a few mins... pt on timeout rn");
function isChromeOS(userAgent) { app.get("/*", function (req, res, next) {
return userAgent.includes('CrOS');
}
// Middleware to handle the Chrome OS check
function checkChromeOS(req, res, next) {
if (isChromeOS(req.headers['user-agent'])) {
res.status(403).send('Forbidden for Chrome OS');
} else {
next();
}
}
// Your existing route with the Chrome OS check
app.get("/*", checkChromeOS, (req, res, next) => {
if (didstart) return next(); if (didstart) return next();
return rendertemplate(res, req, "timeout.ejs"); return rendertemplate(res, req, "timeout.ejs");
}); });
setTimeout(function () { setTimeout(function () {
didstart = true; didstart = true;