Merge pull request 'main' (#1) from Ashley/poketube:main into main

Reviewed-on: https://codeberg.org/Korbs/poketube/pulls/1
This commit is contained in:
Korbs 2023-11-11 12:02:05 +00:00
commit 346898b9c9
11 changed files with 214 additions and 103 deletions

View file

@ -96,7 +96,7 @@ Once everythings installed, start your server with the following command:
node server.js node server.js
``` ```
Congrats, Poketube should now be running on `localhost:3000`! Congrats, Poketube should now be running on `localhost:6003`!
## PokeTube community! ## PokeTube community!

View file

@ -553,8 +553,8 @@ margin-right: -79px;
<img src="https://p.poketube.fun/<%=j.Channel?.Metadata.Banners.Thumbnail[2].$t%>"> <img src="https://p.poketube.fun/<%=j.Channel?.Metadata.Banners.Thumbnail[2].$t%>">
<% } %> <% } %>
<div class="channel-info" > <div class="channel-info" >
<a href="https://p.poketube.fun/<%=j.Channel?.Metadata.Avatars.Thumbnail?.$t%>" class="avatar"> <a href="/avatars/<%=j.Channel?.Metadata.Avatars.Thumbnail?.$t.replace("https://yt3.googleusercontent.com/", "")%>" class="avatar">
<img src="https://p.poketube.fun/<%=j.Channel?.Metadata.Avatars.Thumbnail?.$t%>" alt="Channel Avatar"> <img src="/avatars/<%=j.Channel?.Metadata.Avatars.Thumbnail?.$t.replace("https://yt3.googleusercontent.com", "")%>" alt="Channel Avatar">
</a> </a>
<% if (cinv?.authorVerified) { %> <% if (cinv?.authorVerified) { %>
@ -594,7 +594,7 @@ margin-right: -79px;
<p style="padding:0;font-weight:bold;max-inline-size: 37em;display: -webkit-box;-webkit-line-clamp: 3;-webkit-box-orient: vertical;"> <p style="padding:0;font-weight:bold;max-inline-size: 37em;display: -webkit-box;-webkit-line-clamp: 3;-webkit-box-orient: vertical;">
<% try { %> <% try { %>
<%- getFirstLine(desc).slice(0, 60) %> <%- getFirstLine(cinv.description).slice(0, 60) %>
<a href="/channel?id=<%= ID %>&tab=about"> <a href="/channel?id=<%= ID %>&tab=about">
<% } catch (error) { %> <% } catch (error) { %>
<!-- Handle the error here, if it occurs --> <!-- Handle the error here, if it occurs -->
@ -808,7 +808,7 @@ width: fit-content;
</p> </p>
</div> </div>
<p style="padding:0;font-weight:bold;"> <p style="padding:0;font-weight:bold;">
<%-getFirstLine(desc)%> <a href="/channel?id=<%=ID%>&tab=about"> <%-getFirstLine(cinv.description)%> <a href="/channel?id=<%=ID%>&tab=about">
<i class="fa-thin fa-angle-right"></i></a> <i class="fa-thin fa-angle-right"></i></a>
</p> </p>
<a href="/feeds/videos.xml?channel_id=<%=ID%>"><button class="subscribe-button">Rss feed</button> <a href="/feeds/videos.xml?channel_id=<%=ID%>"><button class="subscribe-button">Rss feed</button>
@ -1019,7 +1019,7 @@ width: fit-content;
<% tj.videos.forEach (x => { %> <% tj.videos.forEach (x => { %>
<a href="/watch?v=<%- x.videoId %>" class="video"> <a href="/watch?v=<%- x.videoId %>" class="video">
<div class="thumbnail" style="background-image: url('https://p.poketube.fun/https://i.ytimg.com/vi/<%= x.videoId %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw');border-radius: 10px;"><span class="video-length"><%- turntomins(x.lengthSeconds) %></span></div> <div class="thumbnail" style="background-image: url('/vi/<%= x.videoId %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw');border-radius: 10px;"><span class="video-length"><%- turntomins(x.lengthSeconds) %></span></div>
<div class="info"> <div class="info">
<span class="title max-lines-2" style="font-family:PokeTube flex,sans-serif;font-weight: 1000;font-stretch: ultra-expanded;"><%- x.title %></span> <span class="title max-lines-2" style="font-family:PokeTube flex,sans-serif;font-weight: 1000;font-stretch: ultra-expanded;"><%- x.title %></span>
@ -1067,7 +1067,7 @@ margin-left: 8em;" >
<% shorts.videos.forEach (x => { %> <% shorts.videos.forEach (x => { %>
<a href="/shorts/<%- x.videoId %>" class="s" > <a href="/shorts/<%- x.videoId %>" class="s" >
<img load="lazy" src='https://p.poketube.fun/https://i.ytimg.com/vi/<%= x.videoId %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw' style="border-radius: 10px;width: 31em;object-fit: cover;aspect-ratio: 19/9;height: 20em;object-position: 101% 51%;clip-path: inset(2px 139px);"> <img load="lazy" src='/vi/<%= x.videoId %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw' style="border-radius: 10px;width: 31em;object-fit: cover;aspect-ratio: 19/9;height: 20em;object-position: 101% 51%;clip-path: inset(2px 139px);">
@ -1142,7 +1142,7 @@ margin-left: 8em;" >
<% stream.videos.forEach (x => { %> <% stream.videos.forEach (x => { %>
<a href="/watch?v=<%- x.videoId %>" class="video"> <a href="/watch?v=<%- x.videoId %>" class="video">
<div class="thumbnail" style="background-image: url('https://p.poketube.fun/https://i.ytimg.com/vi/<%= x.videoId %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw');border-radius: 10px;"><span class="video-length"><%- turntomins(x.lengthSeconds) %></span></div> <div class="thumbnail" style="background-image: url('/vi/<%= x.videoId %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw');border-radius: 10px;"><span class="video-length"><%- turntomins(x.lengthSeconds) %></span></div>
<div class="info"> <div class="info">
<span class="title max-lines-2" style="font-family:PokeTube flex,sans-serif;font-weight: 1000;font-stretch: ultra-expanded;"><%- x.title %></span> <span class="title max-lines-2" style="font-family:PokeTube flex,sans-serif;font-weight: 1000;font-stretch: ultra-expanded;"><%- x.title %></span>
@ -1218,7 +1218,7 @@ margin-left: 8em;" >
<video class="player" style="border-radius: 16px; <video class="player" style="border-radius: 16px;
" controls " controls
poster="https://p.poketube.fun/https://i.ytimg.com/vi/<%=x.attachment.videoId%>/maxresdefault.jpg?v=607ddcd4"> poster="/vi/<%=x.attachment.videoId%>/maxresdefault.jpg?v=607ddcd4">
<source src="https://tube.kuylar.dev/proxy/media/<%=x.attachment.videoId%>/22" type="video/mp4; codecs=&quot;avc1.64001F, mp4a.40.2&quot;" label="hd720" selected="false"> <source src="https://tube.kuylar.dev/proxy/media/<%=x.attachment.videoId%>/22" type="video/mp4; codecs=&quot;avc1.64001F, mp4a.40.2&quot;" label="hd720" selected="false">
@ -1257,7 +1257,7 @@ margin-left: 8em;" >
<% if (desc) { %> <% if (desc) { %>
<p style="color:#fff;margin-left: 10px;font-weight: bold;"><%-desc.replace(/\n/g, " <br> ")%></p> <p style="color:#fff;margin-left: 10px;font-weight: bold;"><%-cinv.descriptionHtml%></p>
<% } %> <% } %>
<% if (wiki.extract_html) { %> <% if (wiki.extract_html) { %>
<h3 style="color:#fff;font-family:Ginto Nord,sans-serif;font-weight:900;padding: 0px;margin: 0;margin-top: 7px;margin-left: 10px;">From the web</h3> <h3 style="color:#fff;font-family:Ginto Nord,sans-serif;font-weight:900;padding: 0px;margin: 0;margin-top: 7px;margin-left: 10px;">From the web</h3>
@ -1282,13 +1282,7 @@ margin-left: 8em;" >
</p> </p>
<% } %> <% } %>
<div style="font-weight: bold;color:#fff;margin-left: 10px;"> <div style="font-weight: bold;color:#fff;margin-left: 10px;">
<% if (about.Location != "[object Object]") { %> YouTube removed the about tab ;_; fix for this soon lol
<p style="margin: 0px;margin-top: 2.5px;font-weight: bold;"><i class="fa-light fa-earth-americas"></i> <%- about.Location%> </p>
<% } %>
<p style="margin: 0px;margin-top: 2.5px;font-weight: bold;"><i class="fa-light fa-circle-info"></i> <%- about.Joined%> </p>
<p style="margin: 0px;margin-top: 2.5px;font-weight: bold;"> <i class="fa-light fa-arrow-trend-up"></i> <%- about.ViewCount%> </p>
</div> </div>
</div> </div>
<% } %> <% } %>

View file

@ -493,10 +493,10 @@ Discover Popular videos on poketube!
<div class="video-grid"> <div class="video-grid" style="border-radius:12px">
<% inv.forEach(x => { %> <% inv.forEach(x => { %>
<a href="/watch?v=<%- x.videoId %>" class="video"> <a href="/watch?v=<%- x.videoId %>" class="video">
<div class="thumbnail" style="background-image: url('https://p.poketube.fun/https://i.ytimg.com/vi/<%= x.videoId %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw');border-radius: 10px;"><span class="video-length"><%- turntomins(x.lengthSeconds) %></span></div> <div class="thumbnail" style="background-image: url('/vi/<%= x.videoId %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw');border-radius: 10px;"><span class="video-length"><%- turntomins(x.lengthSeconds) %></span></div>
<div class="info"> <div class="info">
<span class="title max-lines-2" title="<%- x.title %>" style="font-family:Inter,sans-serif;"><%- x.title %></span> <span class="title max-lines-2" title="<%- x.title %>" style="font-family:Inter,sans-serif;"><%- x.title %></span>
<span class="title max-lines-2" title="Video By <%- x.author %>" style="margin-top:1px">By <%- x.author %></span> <span class="title max-lines-2" title="Video By <%- x.author %>" style="margin-top:1px">By <%- x.author %></span>

View file

@ -210,11 +210,11 @@ font-family:Ubuntu
<div> <div>
<% if (!isMobile) { %> <% if (!isMobile) { %>
<img src="https://i.ytimg.com/vi/<%=v%>/maxresdefault.jpg" style="height: 15em;border-radius: 1em;box-shadow: 0 0 4.4em <%=color%>;"> <img src="/vi/<%=v%>/maxresdefault.jpg" style="height: 15em;border-radius: 1em;box-shadow: 0 0 4.4em <%=color%>;">
<% } %> <% } %>
<% if (isMobile) { %> <% if (isMobile) { %>
<img src="https://i.ytimg.com/vi/<%=v%>/maxresdefault.jpg" style="height: 11.9em;border-radius: 1em;box-shadow: 0 0 4.4em <%=color%>;"> <img src="/vi/<%=v%>/maxresdefault.jpg" style="height: 11.9em;border-radius: 1em;box-shadow: 0 0 4.4em <%=color%>;">
<% } %> <% } %>
<div> <div>
@ -267,7 +267,7 @@ font-family:Ubuntu
<!-- ignore this --> <!-- ignore this -->
<p style="visibility: hidden;"> <p style="visibility: hidden;">
gfhefdhgrdfhdfshfgddfsfdgdfsds gfhefdhgrdfhdfshfgddfsfdgdfsds we dont see the videos that you are downloading :P
</p> </p>
</div> </div>

View file

@ -62,6 +62,7 @@
</div> </div>
<div class="features"> <div class="features">
<a style="color: white; text-decoration: none;" href="https://war.ukraine.ua/donate/"><p><i class="fa-duotone fa-handshake-angle"></i> Support Ukraine </p></a> <a style="color: white; text-decoration: none;" href="https://war.ukraine.ua/donate/"><p><i class="fa-duotone fa-handshake-angle"></i> Support Ukraine </p></a>
<a style="color: white; text-decoration: none;" href="https://buildpalestine.com/2021/05/15/trusted-organizations-to-donate-to-palestine/"><p><i class="fa-duotone fa-handshake-angle"></i> Support Palestine</p></a>
</div> </div>
<div class="landing"> <div class="landing">
<h1>The Ultimate Privacy App</h1> <h1>The Ultimate Privacy App</h1>

View file

@ -29,7 +29,7 @@
--> -->
<!DOCTYPE html> <!DOCTYPE html>
<html class="poketube_desktop_player event" invidproxy="<%=u %>" universe="2" vid_id="<%=inv_vid.videoId%>" t="<%=btoa(Date.now())%>" version="browser_web"> <html class="poketube_desktop_player js event" invidproxy="<%=u%>" universe="2" vid_id="<%=inv_vid.videoId%>" t="<%=btoa(Date.now())%>" version="browser_web_<%=Date.now()%>">
<head> <head>
<% if (e === false) { %> <% if (e === false) { %>
@ -40,7 +40,6 @@
<meta content="<%=inv_vid.title%>" name=title> <meta content="<%=inv_vid.title%>" name=title>
<meta content="<%=color%>" name="theme-color"> <meta content="<%=color%>" name="theme-color">
<meta content="<%=k.Video.Channel.Name%>" name=twitter:author> <meta content="<%=k.Video.Channel.Name%>" name=twitter:author>
<meta content=@youtube name=twitter:site>
<meta content="https://poketube.fun/watch?v=<%=inv_vid.videoId%>" name=twitter:url> <meta content="https://poketube.fun/watch?v=<%=inv_vid.videoId%>" name=twitter:url>
<meta content="<%=inv_vid.title%> | PokeTube" name=twitter:title> <meta content="<%=inv_vid.title%> | PokeTube" name=twitter:title>
<meta content="Watch this video from <%=k.Video.Channel.Name%> On PokeTube! The Libre YouTube Front end!1!" property=twitter:description> <meta content="Watch this video from <%=k.Video.Channel.Name%> On PokeTube! The Libre YouTube Front end!1!" property=twitter:description>
@ -51,9 +50,11 @@
<% } %> <!-- close the } --> <% } %> <!-- close the } -->
<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> <ptd-event-chunks>
poketube.eventloader = this.eventloader poketube.eventloader = this.eventloader
load() load()
</ptd-event-chunks> </ptd-event-chunks>
<title> <%=inv_vid.title%> | PokeTube </title> <title> <%=inv_vid.title%> | PokeTube </title>
<style> <style>
@ -474,6 +475,60 @@ text-shadow: 1px 1px #000,1px 1px 0.1px #000;!important;
background: linear-gradient(to bottom, #1c1c1c, #101); background: linear-gradient(to bottom, #1c1c1c, #101);
} }
.account:hover {
background-color: #263850 !important;
}
.account > i {
margin-right: -3px;
}
.account {
height: 36px;
display: flex;
flex-direction: row;
gap: 8px;
color:#fff !important;
border: 1px solid var(--border-color);
justify-content: center;
align-items: center;
transition: background-color linear 100ms;
padding: 0 8px !important;
text-decoration: none;
user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-webkit-user-select: none;
border-radius: 18px;
width: fit-content;
background-color: #0000;
margin-right: -1em;
}
.settings-icon{
margin-right: 5.5px;
height: 36px;
display: flex;
flex-direction: row;
gap: 8px;
color: #fff !important;
border: 1px solid var(--border-color);
justify-content: center;
align-items: center;
transition: background-color linear 100ms;
padding: 0 8px !important;
text-decoration: none;
user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-webkit-user-select: none;
border-radius: 18px;
width: 1.5em;
background-color: #0000;
}
.new-button { .new-button {
border: 2.1px solid; border: 2.1px solid;
border-color: #cba6f7; border-color: #cba6f7;
@ -494,13 +549,13 @@ text-shadow: 1px 1px #000,1px 1px 0.1px #000;!important;
transition-duration: 150ms; transition-duration: 150ms;
} }
nav { nav {
z-index: 1; z-index: 1;
position: sticky; position: sticky;
background:#0A0608 background:#0009;
top: 0;
} }
</style> </style>
<% if(dm) { %> <% if(dm) { %>
<style> <style>
@ -644,17 +699,15 @@ But Please note that unofficial instances can add the same lock icon, so please
</div> </div>
<div class="right"> <div class="right">
<a><i style="display: block;margin-left: auto;margin-right: auto;visibility: collapse;" class="fa-light fa-server"></i> </a>
<a ><i class="fa-light fa-shield" style="visibility: collapse;margin-right: 1.5em;"></i></a>
<a href="/old?v=<%=inv_vid.videoId%>" ><i class="fa-light fa-clock-rotate-left" style="margin-right: 1.5em;"></i></a>
<p id="fetch-count"> <p id="fetch-count">
</p> </p>
<a class="settings-icon" href="/customize"><i class="fa-light fa-brush"></i>
</a>
<div class="icon-button dropdown settings-icon">
<div class="icon-button dropdown" style="margin-right: 4.5px;">
<input type="checkbox" id="loggedout-dropdown" autocomplete="off"> <input type="checkbox" id="loggedout-dropdown" autocomplete="off">
<label for="loggedout-dropdown"> <label for="loggedout-dropdown">
<i style="display: block;margin-left: auto;margin-right: auto;" class="fa-light fa-gear"></i> <i style="display: block;margin-left: auto;margin-right: auto;" class="fa-light fa-gear"></i>
@ -756,6 +809,7 @@ About
</a> </a>
</div> </div>
</div> </div>
<a href="/account-create" class="account"><i class="fa-light fa-user"></i>Account</a>
</div> </div>
</nav> </nav>
@ -991,7 +1045,7 @@ display: block; !important;" autoplay controls
<a name="chnl"></a> <a name="chnl"></a>
<a href="/channel?id=<%=video?.Channel.id || k.Video.Channel.id%>" class="avatar"> <a href="/channel?id=<%=video?.Channel.id || k.Video.Channel.id%>" class="avatar">
<img loading="lazy" src="https://p.poketube.fun/<%= k.Video.Channel.Avatar[1].$t %>"> <img loading="lazy" src="/avatars/<%= k.Video.Channel.Avatar[1].$t.replace("https://yt3.ggpht.com/", "") %>" %>">
</a> </a>
<div class="name" > <div class="name" >
<div> <div>
@ -1397,7 +1451,7 @@ display: block; !important;" autoplay controls
<div class="desc"> <div class="desc">
<h5 style="display: flex;margin-top: 7px;padding-top: 10px;"><div class="thumb"> <h5 style="display: flex;margin-top: 7px;padding-top: 10px;"><div class="thumb">
<a href="/channel?id=<%- x.authorId%>" class="avatar" style="width: 40px;height: 40px;"> <a href="/channel?id=<%- x.authorId%>" class="avatar" style="width: 40px;height: 40px;">
<img loading="lazy" src="https://p.poketube.fun/<%= x.authorThumbnails[1].url %>"> <img loading="lazy" src="/avatars/<%= x.authorThumbnails[1].url.replace("https://yt3.ggpht.com/", "") %>">
</a> </a>
</div> </div>
<% if (!x.authorIsChannelOwner) { %> <% if (!x.authorIsChannelOwner) { %>
@ -1525,11 +1579,11 @@ Recommended Videos
<div class="video fade-in" > <div class="video fade-in" >
<% if (!optout) { %> <% if (!optout) { %>
<a href="/watch?v=<%= x.id %>" alt="<%= x.Title %>" class="thumbnail " style="background-image: url('https://p.poketube.fun/https://i.ytimg.com/vi/<%= x.id %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw');border-radius: 9.5px;" > <span class="video-length"><%- x.duration || "LIVE"%></span> <a href="/watch?v=<%= x.id %>" alt="<%= x.Title %>" class="thumbnail " style="background-image: url('/vi/<%= x.id %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw');border-radius: 9.5px;" > <span class="video-length"><%- x.duration || "LIVE"%></span>
<% } %> <% } %>
<% if (optout) { %> <% if (optout) { %>
<a href="/watch?v=<%= x.id %>&m=f" alt="<%= x.Title %>" class="thumbnail" style="background-image: url('https://p.poketube.fun/https://i.ytimg.com/vi/<%= x.id %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw');border-radius: 9.5px;" > <span class="video-length"><%- x.duration || "LIVE"%></span> <a href="/watch?v=<%= x.id %>&m=f" alt="<%= x.Title %>" class="thumbnail" style="background-image: url('/vi/<%= x.id %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw');border-radius: 9.5px;" > <span class="video-length"><%- x.duration || "LIVE"%></span>
<% } %> <% } %>
</a> </a>
<div class="info"> <div class="info">
@ -1741,35 +1795,6 @@ lazyElements.forEach(element => {
observer.observe(element); observer.observe(element);
}); });
// Function to refresh the page
const refreshPage = () => {
location.reload();
};
// Check if a timer is already set in localStorage
const timer = localStorage.getItem('refreshTimer');
if (timer) {
// If a timer is already set, clear it before setting a new one
clearTimeout(timer);
}
// Check if it's the first time the user visits the page
const isFirstLoad = localStorage.getItem(userlocalStorageKey) === null;
// Set a new timer to refresh the page after 1 hour or on the first visit
const newTimer = setTimeout(() => {
refreshPage();
}, isFirstLoad ? 0 : 60 * 60 * 1000); // 1 hour in milliseconds
// Save the new timer in localStorage
localStorage.setItem('refreshTimer', newTimer);
// Save the first load flag in localStorage if it's the first visit
if (isFirstLoad) {
localStorage.setItem(userlocalStorageKey, 'visited');
}
</script> </script>
<script> <script>
const languageCode = localStorage.getItem("Language"); const languageCode = localStorage.getItem("Language");
@ -1780,6 +1805,32 @@ const urlParams = new URLSearchParams(window.location.search);
if (!urlParams.has('hl') && !urlParams.has('region') && languageCode && regionCode) { if (!urlParams.has('hl') && !urlParams.has('region') && languageCode && regionCode) {
location.href = currentURL + `&region=${regionCode}&hl=${languageCode}`; location.href = currentURL + `&region=${regionCode}&hl=${languageCode}`;
} }
let isMiddleButtonPressed = false;
// Function to change video speed
function changeVideoSpeed() {
if (isMiddleButtonPressed) {
video.playbackRate = 2; // Set the video speed to 2x
} else {
video.playbackRate = 1; // Set the video speed to 1x
}
}
// Event listener for mouse button press
document.addEventListener('mousedown', function (event) {
if (event.button === 1) {
isMiddleButtonPressed = true;
changeVideoSpeed();
}
});
// Event listener for mouse button release
document.addEventListener('mouseup', function (event) {
if (event.button === 1) {
isMiddleButtonPressed = false;
changeVideoSpeed();
}
});
var anchor = document.getElementById("sub"); var anchor = document.getElementById("sub");
@ -1874,7 +1925,7 @@ window.addEventListener("unload", cleanup)
border-radius: 18px; border-radius: 18px;
filter: blur(20px); filter: blur(20px);
transform: scale(1.1); transform: scale(1.1);
opacity: 0.3; opacity: 0.4;
z-index: -1; z-index: -1;
} }
</style> </style>
@ -2265,7 +2316,7 @@ font-size: 13px;margin:0;padding:0;white-space: nowrap;
<div class="thumb"> <div class="thumb">
<a href="/channel?id=<%- inv.comments[0].authorId%>" class="avatar" style="width: 40px;height: 40px;margin: 4px;"> <a href="/channel?id=<%- inv.comments[0].authorId%>" class="avatar" style="width: 40px;height: 40px;margin: 4px;">
<img src="https://p.poketube.fun/<%= inv.comments[0].authorThumbnails[1].url %>" style="width: 24px;height: 24px;margin-right: inherit;" > <img src="/avatars/<%= inv.comments[0].authorThumbnails[1].url.replace("https://yt3.ggpht.com/", "") %>" style="width: 24px;height: 24px;margin-right: inherit;" >
</a> </a>
</div> </div>
@ -2574,7 +2625,7 @@ More Epic options owo~
<div class="desc"> <div class="desc">
<h5 style="display: flex;margin-top: 7px;padding-top: 10px;"><div class="thumb"> <h5 style="display: flex;margin-top: 7px;padding-top: 10px;"><div class="thumb">
<a href="/channel?id=<%- x.authorId%>" class="avatar" style="width: 40px;height: 40px;"> <a href="/channel?id=<%- x.authorId%>" class="avatar" style="width: 40px;height: 40px;">
<img src="https://p.poketube.fun/<%= x.authorThumbnails[1].url %>" style="width: 40px;height: 40px;"> <img loading="lazy" src="/avatars/<%= x.authorThumbnails[1].url.replace("https://yt3.ggpht.com/", "") %>">
</a> </a>
</div> </div>
<% if (!x.authorIsChannelOwner) { %> <% if (!x.authorIsChannelOwner) { %>
@ -2682,11 +2733,11 @@ More Epic options owo~
<div class="video"> <div class="video">
<% if (!optout) { %> <% if (!optout) { %>
<a href="/watch?v=<%= x.id %>" class="thumbnail" style="background-image: url('https://p.poketube.fun/https://i.ytimg.com/vi/<%= x.id %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw');border-radius: 9.5px;border: 2px solid white;" > <span class="video-length"><%=x.duration %></span> <a href="/watch?v=<%= x.id %>" class="thumbnail" style="background-image: url('/vi/<%= x.id %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw');border-radius: 9.5px;border: 2px solid white;" > <span class="video-length"><%=x.duration %></span>
<% } %> <% } %>
<% if (optout) { %> <% if (optout) { %>
<a href="/watch?v=<%= x.id %>&m=f" class="thumbnail" style="background-image: url('https://p.poketube.fun/https://i.ytimg.com/vi/<%= x.id %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw');border-radius: 9.5px;border: 2px solid white;" > <span class="video-length"><%=x.duration %></span> <a href="/watch?v=<%= x.id %>&m=f" class="thumbnail" style="background-image: url('/vi/<%= x.id %>/hqdefault.jpg?sqp=-oaymwEbCKgBEF5IVfKriqkDDggBFQAAiEIYAXABwAEG&rs=AOn4CLBy_x4UUHLNDZtJtH0PXeQGoRFTgw');border-radius: 9.5px;border: 2px solid white;" > <span class="video-length"><%=x.duration %></span>
<% } %> <% } %>
</a> </a>
<div class="info"> <div class="info">

View file

@ -507,7 +507,7 @@ Web </a>
<a <a
href="/watch?v=<%= x.id %>" href="/watch?v=<%= x.id %>"
class="thumbnail" class="thumbnail"
style="background-image: url('https://p.poketube.fun/https://i.ytimg.com/vi/<%= x.id %>/hqdefault.jpg?sqp=-oaymwEXCNAFEJQDSFryq4qpAwkIARUAAIhCGAE=&amp;rs=AOn4CLBmAOZV7CM3NdDKlEFxGX7PpI5UWQ');border-radius: 10px;" style="background-image: url('/vi/<%= x.id %>/hqdefault.jpg?sqp=-oaymwEXCNAFEJQDSFryq4qpAwkIARUAAIhCGAE=&amp;rs=AOn4CLBmAOZV7CM3NdDKlEFxGX7PpI5UWQ');border-radius: 10px;"
><span class="video-length"><%=x.duration %></span></a> ><span class="video-length"><%=x.duration %></span></a>
<div class="info" style="color:#fff;text-align: left;font-weight: 1000;"> <div class="info" style="color:#fff;text-align: left;font-weight: 1000;">
<a style="font-family: 'PokeTube Flex';font-size: large;text-align: left;font-stretch: extra-expanded; <a style="font-family: 'PokeTube Flex';font-size: large;text-align: left;font-stretch: extra-expanded;

View file

@ -22,6 +22,7 @@ const URL_WHITELIST = [
"is3-ssl.mzstatic.com", "is3-ssl.mzstatic.com",
"twemoji.maxcdn.com", "twemoji.maxcdn.com",
"unpkg.com", "unpkg.com",
"lite.duckduckgo.com",
"youtube.com", "youtube.com",
"returnyoutubedislikeapi.com", "returnyoutubedislikeapi.com",
"cdn.zptr.cc", "cdn.zptr.cc",
@ -61,7 +62,7 @@ const proxy = async (req, res) => {
let url; let url;
try { try {
url = new URL("https://" + req.originalUrl.slice(10)); url = new URL("https://" + req.originalUrl.slice(8));
} catch (e) { } catch (e) {
console.log("==> Cannot parse URL: " + e); console.log("==> Cannot parse URL: " + e);
return res.status(400).send("Malformed URL"); return res.status(400).send("Malformed URL");
@ -93,7 +94,7 @@ const listener = (req, res) => {
app.get("/", (req, res) => { app.get("/", (req, res) => {
var json = { var json = {
status: "200", status: "200",
version: "1.0.0", version: "1.1.0",
URL_WHITELIST, URL_WHITELIST,
cache: "max-age-1848", cache: "max-age-1848",
}; };
@ -101,13 +102,18 @@ app.get("/", (req, res) => {
res.json(json); res.json(json);
}); });
const apiUrl = "https://returnyoutubedislikeapi.com/votes?videoId="; const apiUrls = [
"https://returnyoutubedislikeapi.com/votes?videoId=",
"https://prod-poketube.testing.poketube.fun/api?v=",
"https://ipv6-t.poketube.fun/api?v="
];
// Define a cache object // Define a cache object
const cache = {}; const cache = {};
app.get("/api", async (req, res) => { app.get("/api", async (req, res) => {
if (req.query.hash && req.query.hash === "d0550b6e28c8f93533a569c314d5b4e2") { const { fetch } = await import("undici")
try { try {
const cacheKey = req.query.v; const cacheKey = req.query.v;
@ -116,13 +122,16 @@ app.get("/api", async (req, res) => {
// If the cached result is less than 1 hour old, return it // If the cached result is less than 1 hour old, return it
const cachedData = cache[cacheKey].data; const cachedData = cache[cacheKey].data;
const cachedDate = new Date(cache[cacheKey].timestamp); const cachedDate = new Date(cache[cacheKey].timestamp);
return res.json({ data: cachedData, cachedDate }); return res.json(cachedData);
} }
// If the result is not cached or is older than 1 hour, fetch it from the API // Initialize an array to store errors when trying different URLs
const engagement = await fetch(apiUrl + req.query.v).then((res) => const errors = [];
res.json()
); for (const apiUrl of apiUrls) {
try {
// Fetch data from the current URL
const engagement = await fetch(apiUrl + req.query.v).then((res) => res.json());
// Cache the result for future requests // Cache the result for future requests
cache[cacheKey] = { cache[cacheKey] = {
@ -130,13 +139,33 @@ app.get("/api", async (req, res) => {
timestamp: Date.now(), timestamp: Date.now(),
}; };
res.json({ data: engagement, cachedDate: new Date() }); res.json(engagement);
} catch {} return; // Exit the loop if successful
} else { } catch (err) {
return res.send("no hash query found"); // Log the error for this URL and continue to the next URL
console.log(`Error fetching data from ${apiUrl}: ${err.message}`);
errors.push(err.message);
return "";
} }
}
// If all URLs fail, return an error response
res.status(500).json({ error: "All API endpoints failed", errors });
} catch (err) {
console.log(err);
}
});
app.get("/bangs", async (req, res) => {
let f = await fetch("https://lite.duckduckgo.com/lite/?q=" + req.query.q, {
method: req.method,
});
res.redirect(f);
}); });
app.all("/*", listener); app.all("/*", listener);
app.listen(3000, () => console.log("Listening on 0.0.0.0:3000")); app.listen(6014, () => console.log("Listening on 0.0.0.0:6014"));

View file

@ -38,6 +38,38 @@ module.exports = function (app, config, renderTemplate) {
res.send("Disabled until further notice"); res.send("Disabled until further notice");
}); });
app.get("/vi/:v/:t", async function (req, res) {
var url = `https://yt.sudovanilla.com/vi/${req.params.v}/${req.params.t}`
let f = await modules.fetch(url + `?cachefixer=${btoa(Date.now())}`, {
method: req.method,
});
f.body.pipe(res);
});
app.get("/avatars/:v", async function (req, res) {
var url = `https://yt.sudovanilla.com/ggpht/${req.params.v}`;
let f = await modules.fetch(url + `?cachefixer=${btoa(Date.now())}`, {
method: req.method,
});
f.body.pipe(res);
});
app.get("/avatars/ytc/:v", async function (req, res) {
var url = `https://yt.sudovanilla.com/ggpht/ytc/${req.params.v.replace("ytc", "")}`;
let f = await modules.fetch(url + `?cachefixer=${btoa(Date.now())}`, {
method: req.method,
});
f.body.pipe(res);
});
app.get("/api/search", async (req, res) => { app.get("/api/search", async (req, res) => {
const query = req.query.query; const query = req.query.query;

View file

@ -231,6 +231,10 @@ module.exports = function (app, config, renderTemplate) {
var vidurl = u.losslessurl var vidurl = u.losslessurl
} }
if(req.useragent.source.includes("Pardus")){
var vidurl = "https://yt.sudovanilla.com"
}
let badges = ""; let badges = "";
let comments = ""; let comments = "";
let nnn = ""; let nnn = "";

View file

@ -43,7 +43,7 @@ function initlog(args) {
* @param {string} [port="3000"] - The port to listen on * @param {string} [port="3000"] - The port to listen on
*/ */
function init(app, port) { function init(app, port) {
if (!port) port = "3000"; if (!port) port = "6003";
try { try {
app.listen(port, () => { app.listen(port, () => {
initlog("Loading Poketube: success!" + " on port " + port); initlog("Loading Poketube: success!" + " on port " + port);