mirror of
				https://codeberg.org/ashley/poke
				synced 2025-07-17 16:52:11 +00:00 
			
		
		
		
	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:
		
						commit
						346898b9c9
					
				| @ -96,7 +96,7 @@ Once everythings installed, start your server with the following command: | ||||
| node server.js | ||||
| ``` | ||||
| 
 | ||||
| Congrats, Poketube should now be running on `localhost:3000`! | ||||
| Congrats, Poketube should now be running on `localhost:6003`! | ||||
| 
 | ||||
| ## PokeTube community! | ||||
| 
 | ||||
|  | ||||
| @ -553,8 +553,8 @@ margin-right: -79px; | ||||
|           <img src="https://p.poketube.fun/<%=j.Channel?.Metadata.Banners.Thumbnail[2].$t%>"> | ||||
|                                <% } %> | ||||
| 		<div class="channel-info" > | ||||
| 			<a href="https://p.poketube.fun/<%=j.Channel?.Metadata.Avatars.Thumbnail?.$t%>" class="avatar"> | ||||
| 				<img src="https://p.poketube.fun/<%=j.Channel?.Metadata.Avatars.Thumbnail?.$t%>" alt="Channel Avatar"> | ||||
| 			<a href="/avatars/<%=j.Channel?.Metadata.Avatars.Thumbnail?.$t.replace("https://yt3.googleusercontent.com/", "")%>" class="avatar"> | ||||
| 				<img src="/avatars/<%=j.Channel?.Metadata.Avatars.Thumbnail?.$t.replace("https://yt3.googleusercontent.com", "")%>" alt="Channel Avatar"> | ||||
| 			</a> | ||||
|        | ||||
|               <% 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;">  | ||||
|   | ||||
| <% try { %> | ||||
|   <%- getFirstLine(desc).slice(0, 60) %> | ||||
|   <%- getFirstLine(cinv.description).slice(0, 60) %> | ||||
|   <a href="/channel?id=<%= ID %>&tab=about"> | ||||
| <% } catch (error) { %> | ||||
|   <!-- Handle the error here, if it occurs --> | ||||
| @ -808,7 +808,7 @@ width: fit-content; | ||||
|         </p> | ||||
|  			</div> | ||||
|       <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> | ||||
|         </p> | ||||
|          <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 =>  { %> | ||||
| 			<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"> | ||||
| 					<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 =>  { %> | ||||
|       | ||||
| 			<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 =>  { %> | ||||
| 			<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"> | ||||
| 					<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; | ||||
| "  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="avc1.64001F, mp4a.40.2"" label="hd720" selected="false"> | ||||
| @ -1257,7 +1257,7 @@ margin-left: 8em;" > | ||||
| 
 | ||||
|      <% 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) { %>  | ||||
|                      <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> | ||||
|                      <% } %>    | ||||
|                        <div style="font-weight: bold;color:#fff;margin-left: 10px;"> | ||||
|      <% if (about.Location != "[object Object]")  { %> | ||||
| <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> | ||||
| 
 | ||||
|     YouTube removed the about tab ;_; fix for this soon lol | ||||
|   </div> | ||||
|                        </div> | ||||
|    <% } %> | ||||
|  | ||||
| @ -493,10 +493,10 @@ Discover Popular videos on poketube! | ||||
| 
 | ||||
| 
 | ||||
|                                   | ||||
|     	<div class="video-grid"> | ||||
|     	<div class="video-grid" style="border-radius:12px"> | ||||
|    <% inv.forEach(x =>  { %> | ||||
| 			<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"> | ||||
| 					<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> | ||||
|  | ||||
| @ -210,11 +210,11 @@ font-family:Ubuntu | ||||
|        <div> | ||||
|        <% 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) { %> | ||||
| 
 | ||||
|          <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> | ||||
| @ -267,7 +267,7 @@ font-family:Ubuntu | ||||
|          | ||||
|               <!-- ignore this --> | ||||
|         <p style="visibility: hidden;"> | ||||
|  gfhefdhgrdfhdfshfgddfsfdgdfsds gfhefdhgrdfhdfshfgddfsfdgdfsds | ||||
|  we dont see the videos that you are downloading :P | ||||
|           </p> | ||||
| 		</div> | ||||
| 	  | ||||
|  | ||||
| @ -61,7 +61,8 @@ | ||||
|       </div> | ||||
|     </div> | ||||
|     <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 class="landing"> | ||||
|       <h1>The Ultimate Privacy App</h1> | ||||
|  | ||||
| @ -29,7 +29,7 @@ | ||||
| 
 | ||||
| --> | ||||
| <!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> | ||||
|    | ||||
|     <% if (e === false) { %>   | ||||
| @ -40,7 +40,6 @@ | ||||
| <meta content="<%=inv_vid.title%>" name=title> | ||||
| <meta content="<%=color%>" name="theme-color"> | ||||
| <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="<%=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> | ||||
| @ -51,9 +50,11 @@ | ||||
|  <% } %> <!-- close the } --> | ||||
| <link href="/css/yt-ukraine.svg?v=3" rel=icon> | ||||
| <link href=/css/snow.css rel=stylesheet>  | ||||
| 
 | ||||
| <ptd-event-chunks> | ||||
|   poketube.eventloader = this.eventloader | ||||
|   load() | ||||
| 
 | ||||
| </ptd-event-chunks> | ||||
| <title> <%=inv_vid.title%> | PokeTube </title>   | ||||
| <style> | ||||
| @ -474,6 +475,60 @@ text-shadow: 1px 1px #000,1px 1px 0.1px #000;!important; | ||||
|    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 { | ||||
|      border: 2.1px solid; | ||||
|      border-color: #cba6f7; | ||||
| @ -494,13 +549,13 @@ text-shadow: 1px 1px #000,1px 1px 0.1px #000;!important; | ||||
|   transition-duration: 150ms; | ||||
|    } | ||||
|     | ||||
|     | ||||
|    nav { | ||||
|    z-index: 1; | ||||
|    position: sticky;  | ||||
|    background:#0A0608  | ||||
|     | ||||
|    background:#0009;  | ||||
|     top: 0; | ||||
| } | ||||
|     | ||||
| </style> | ||||
|              <% if(dm) { %> | ||||
|              <style> | ||||
| @ -644,17 +699,15 @@ But Please note that unofficial instances can add the same lock icon, so please | ||||
| 
 | ||||
|       </div> | ||||
|       <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> | ||||
|          | ||||
|        | ||||
|       <a class="settings-icon" href="/customize"><i  class="fa-light fa-brush"></i> | ||||
| </a> | ||||
|          | ||||
|           <div class="icon-button dropdown" style="margin-right: 4.5px;"> | ||||
|           <div class="icon-button dropdown settings-icon"> | ||||
| 			<input type="checkbox" id="loggedout-dropdown" autocomplete="off"> | ||||
| 			<label for="loggedout-dropdown"> | ||||
|                   <i style="display: block;margin-left: auto;margin-right: auto;" class="fa-light  fa-gear"></i> | ||||
| @ -756,6 +809,7 @@ About | ||||
|         </a>     | ||||
| 			</div> | ||||
| 		</div> | ||||
|         <a href="/account-create" class="account"><i  class="fa-light fa-user"></i>Account</a> | ||||
| 
 | ||||
|       </div> | ||||
|     </nav> | ||||
| @ -991,7 +1045,7 @@ display: block; !important;" autoplay controls | ||||
|   <a name="chnl"></a> | ||||
| 
 | ||||
| 				<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> | ||||
| 				<div class="name" > | ||||
|          <div> | ||||
| @ -1397,7 +1451,7 @@ display: block; !important;" autoplay controls | ||||
|             <div class="desc"> | ||||
|                    <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;"> | ||||
| 					<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> | ||||
|             </div> | ||||
|                                                           <%  if (!x.authorIsChannelOwner) { %>  | ||||
| @ -1525,11 +1579,11 @@ Recommended Videos | ||||
|  						<div class="video fade-in"  > | ||||
|                     <% 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) { %>  | ||||
| 
 | ||||
|       <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> | ||||
| 							<div class="info"> | ||||
| @ -1740,36 +1794,7 @@ const observer = new IntersectionObserver((entries, observer) => { | ||||
| lazyElements.forEach(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> | ||||
| 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) { | ||||
|   location.href = currentURL + `®ion=${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"); | ||||
| 
 | ||||
| @ -1874,7 +1925,7 @@ window.addEventListener("unload", cleanup) | ||||
|   border-radius: 18px; | ||||
|   filter: blur(20px); | ||||
|   transform: scale(1.1); | ||||
|   opacity: 0.3; | ||||
|   opacity: 0.4; | ||||
|   z-index: -1; | ||||
| } | ||||
| </style> | ||||
| @ -2265,7 +2316,7 @@ font-size: 13px;margin:0;padding:0;white-space: nowrap; | ||||
|                       | ||||
|                      <div class="thumb"> | ||||
| 				<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> | ||||
|             </div> | ||||
|                        | ||||
| @ -2574,8 +2625,8 @@ More Epic options owo~ | ||||
|             <div class="desc"> | ||||
|                    <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;"> | ||||
| 					<img src="https://p.poketube.fun/<%= x.authorThumbnails[1].url %>" style="width: 40px;height: 40px;"> | ||||
|                      </a> | ||||
| 					<img loading="lazy" src="/avatars/<%= x.authorThumbnails[1].url.replace("https://yt3.ggpht.com/", "") %>"> | ||||
|                                </a> | ||||
|             </div> | ||||
|                                                           <%  if (!x.authorIsChannelOwner) { %>  | ||||
| 
 | ||||
| @ -2682,11 +2733,11 @@ More Epic options owo~ | ||||
|  						<div class="video"> | ||||
|                     <% 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) { %>  | ||||
| 
 | ||||
|       <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> | ||||
| 							<div class="info"> | ||||
|  | ||||
| @ -507,7 +507,7 @@ Web              </a> | ||||
|       <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=-oaymwEXCNAFEJQDSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLBmAOZV7CM3NdDKlEFxGX7PpI5UWQ');border-radius: 10px;" | ||||
|         style="background-image: url('/vi/<%= x.id %>/hqdefault.jpg?sqp=-oaymwEXCNAFEJQDSFryq4qpAwkIARUAAIhCGAE=&rs=AOn4CLBmAOZV7CM3NdDKlEFxGX7PpI5UWQ');border-radius: 10px;" | ||||
|          ><span class="video-length"><%=x.duration %></span></a> | ||||
| <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; | ||||
|  | ||||
							
								
								
									
										85
									
								
								p/server.js
									
									
									
									
									
								
							
							
						
						
									
										85
									
								
								p/server.js
									
									
									
									
									
								
							| @ -22,6 +22,7 @@ const URL_WHITELIST = [ | ||||
|   "is3-ssl.mzstatic.com", | ||||
|   "twemoji.maxcdn.com", | ||||
|   "unpkg.com", | ||||
|   "lite.duckduckgo.com", | ||||
|   "youtube.com", | ||||
|   "returnyoutubedislikeapi.com", | ||||
|   "cdn.zptr.cc", | ||||
| @ -61,7 +62,7 @@ const proxy = async (req, res) => { | ||||
|     let url; | ||||
| 
 | ||||
|     try { | ||||
|       url = new URL("https://" + req.originalUrl.slice(10)); | ||||
|       url = new URL("https://" + req.originalUrl.slice(8)); | ||||
|     } catch (e) { | ||||
|       console.log("==> Cannot parse URL: " + e); | ||||
|       return res.status(400).send("Malformed URL"); | ||||
| @ -93,7 +94,7 @@ const listener = (req, res) => { | ||||
| app.get("/", (req, res) => { | ||||
|   var json = { | ||||
|     status: "200", | ||||
|     version: "1.0.0", | ||||
|     version: "1.1.0", | ||||
|     URL_WHITELIST, | ||||
|     cache: "max-age-1848", | ||||
|   }; | ||||
| @ -101,42 +102,70 @@ app.get("/", (req, res) => { | ||||
|   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
 | ||||
| const cache = {}; | ||||
| 
 | ||||
| app.get("/api", async (req, res) => { | ||||
|   if (req.query.hash && req.query.hash === "d0550b6e28c8f93533a569c314d5b4e2") { | ||||
|     try { | ||||
|       const cacheKey = req.query.v; | ||||
| const { fetch } = await import("undici") | ||||
| 
 | ||||
|       // Check if the result is already cached
 | ||||
|       if (cache[cacheKey] && Date.now() - cache[cacheKey].timestamp < 3600000) { | ||||
|         // If the cached result is less than 1 hour old, return it
 | ||||
|         const cachedData = cache[cacheKey].data; | ||||
|         const cachedDate = new Date(cache[cacheKey].timestamp); | ||||
|         return res.json({ data: cachedData, cachedDate }); | ||||
|   try { | ||||
|     const cacheKey = req.query.v; | ||||
| 
 | ||||
|     // Check if the result is already cached
 | ||||
|     if (cache[cacheKey] && Date.now() - cache[cacheKey].timestamp < 3600000) { | ||||
|       // If the cached result is less than 1 hour old, return it
 | ||||
|       const cachedData = cache[cacheKey].data; | ||||
|       const cachedDate = new Date(cache[cacheKey].timestamp); | ||||
|       return res.json(cachedData); | ||||
|     } | ||||
| 
 | ||||
|     // Initialize an array to store errors when trying different URLs
 | ||||
|     const errors = []; | ||||
| 
 | ||||
|     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[cacheKey] = { | ||||
|           data: engagement, | ||||
|           timestamp: Date.now(), | ||||
|         }; | ||||
| 
 | ||||
|         res.json(engagement); | ||||
|         return; // Exit the loop if successful
 | ||||
|       } catch (err) { | ||||
|         // 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 the result is not cached or is older than 1 hour, fetch it from the API
 | ||||
|       const engagement = await fetch(apiUrl + req.query.v).then((res) => | ||||
|         res.json() | ||||
|       ); | ||||
| 
 | ||||
|       // Cache the result for future requests
 | ||||
|       cache[cacheKey] = { | ||||
|         data: engagement, | ||||
|         timestamp: Date.now(), | ||||
|       }; | ||||
| 
 | ||||
|       res.json({ data: engagement, cachedDate: new Date() }); | ||||
|     } catch {} | ||||
|   } else { | ||||
|     return res.send("no hash query found"); | ||||
|     // 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.listen(3000, () => console.log("Listening on 0.0.0.0:3000")); | ||||
| app.listen(6014, () => console.log("Listening on 0.0.0.0:6014")); | ||||
| @ -37,7 +37,39 @@ module.exports = function (app, config, renderTemplate) { | ||||
|   app.get("/embed/:v", async function (req, res) { | ||||
|     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) => { | ||||
|     const query = req.query.query; | ||||
| 
 | ||||
|  | ||||
| @ -229,6 +229,10 @@ module.exports = function (app, config, renderTemplate) { | ||||
|          | ||||
|         if(inv_vid.genre === "Music") { | ||||
|           var vidurl = u.losslessurl | ||||
|         }  | ||||
|          | ||||
|          if(req.useragent.source.includes("Pardus")){ | ||||
|            var vidurl = "https://yt.sudovanilla.com" | ||||
|         } | ||||
| 
 | ||||
|         let badges = ""; | ||||
|  | ||||
| @ -43,7 +43,7 @@ function initlog(args) { | ||||
|  * @param {string} [port="3000"] - The port to listen on | ||||
|  */ | ||||
| function init(app, port) { | ||||
|   if (!port) port = "3000"; | ||||
|   if (!port) port = "6003"; | ||||
|   try { | ||||
|     app.listen(port, () => { | ||||
|       initlog("Loading Poketube: success!" + " on port " + port); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Korbs
						Korbs