mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-25 09:18:55 +01:00
Merge pull request 'main' (#5) from ashley/poke:main into main
Reviewed-on: https://codeberg.org/Korbs/poke/pulls/5
This commit is contained in:
commit
e3b35a4426
11 changed files with 3200 additions and 3653 deletions
33
css/maps.js
Normal file
33
css/maps.js
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
var bbox = "?bbox=-165.76171875000003%2C-3.864254615721396%2C30.410156250000004%2C72.44879155730672&layer=mapnik"
|
||||||
|
var iframe = document.getElementById('myFrame');
|
||||||
|
iframe.src=`https://www.openstreetmap.org/export/embed.html${bbox}`
|
||||||
|
iframe.addEventListener('load', function() {
|
||||||
|
var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
|
||||||
|
var links = iframeDocument.getElementsByTagName('a');
|
||||||
|
for (var i = 0; i < links.length; i++) {
|
||||||
|
links[i].addEventListener('click', function(event) {
|
||||||
|
var url = event.target.href;
|
||||||
|
if (url.includes('www.openstreetmap.org')) {
|
||||||
|
event.preventDefault();
|
||||||
|
iframe.src = url;
|
||||||
|
window.history.pushState(null, '', url);
|
||||||
|
} else {
|
||||||
|
window.location.href = url;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
window.onpopstate = function(event) {
|
||||||
|
iframe.src = window.location.href;
|
||||||
|
};
|
||||||
|
|
||||||
|
iframe.addEventListener('load', function() {
|
||||||
|
var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
|
||||||
|
var elements = iframeDocument.querySelectorAll('[style*="//dka575ofm4ao0.cloudfront.net"]');
|
||||||
|
for (var i = 0; i < elements.length; i++) {
|
||||||
|
var style = elements[i].style.backgroundImage;
|
||||||
|
var newStyle = style.replace('//dka575ofm4ao0.cloudfront.net', 'https://p.poketube.fun/https://dka575ofm4ao0.cloudfront.net');
|
||||||
|
elements[i].style.backgroundImage = newStyle;
|
||||||
|
}
|
||||||
|
});
|
|
@ -63,10 +63,10 @@ var apiurl = "https://poketube.fun/api"
|
||||||
if(!localStorage.getItem("UserID")) {
|
if(!localStorage.getItem("UserID")) {
|
||||||
localStorage.setItem('UserID', `<%- userid %>`);
|
localStorage.setItem('UserID', `<%- userid %>`);
|
||||||
<% db.set(`user.${userid}`, userid) %>
|
<% db.set(`user.${userid}`, userid) %>
|
||||||
location.href = "/my-acc?ID=" + `<%- userid %>`
|
location.href = "/my-acc?ID=" + `<%- userid %>` + "&rparam=1"
|
||||||
}
|
}
|
||||||
|
|
||||||
if(localStorage.getItem("UserID")) {
|
if(localStorage.getItem("UserID")) {
|
||||||
location.href = "/my-acc?ID=" + localStorage.getItem("UserID")
|
location.href = "/my-acc?ID=" + localStorage.getItem("UserID") + "&rparam=1"
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
36
html/map.ejs
36
html/map.ejs
|
@ -44,40 +44,6 @@
|
||||||
|
|
||||||
//--><!]]>
|
//--><!]]>
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script src="/static/maps.js"></script><script src="/static/data-mobile.js"></script>
|
||||||
var bbox = "?bbox=-165.76171875000003%2C-3.864254615721396%2C30.410156250000004%2C72.44879155730672&layer=mapnik"
|
|
||||||
var iframe = document.getElementById('myFrame');
|
|
||||||
iframe.src=`https://www.openstreetmap.org/export/embed.html${bbox}`
|
|
||||||
iframe.addEventListener('load', function() {
|
|
||||||
var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
|
|
||||||
var links = iframeDocument.getElementsByTagName('a');
|
|
||||||
for (var i = 0; i < links.length; i++) {
|
|
||||||
links[i].addEventListener('click', function(event) {
|
|
||||||
var url = event.target.href;
|
|
||||||
if (url.includes('www.openstreetmap.org')) {
|
|
||||||
event.preventDefault();
|
|
||||||
iframe.src = url;
|
|
||||||
window.history.pushState(null, '', url);
|
|
||||||
} else {
|
|
||||||
window.location.href = url;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
window.onpopstate = function(event) {
|
|
||||||
iframe.src = window.location.href;
|
|
||||||
};
|
|
||||||
|
|
||||||
iframe.addEventListener('load', function() {
|
|
||||||
var iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
|
|
||||||
var elements = iframeDocument.querySelectorAll('[style*="//dka575ofm4ao0.cloudfront.net"]');
|
|
||||||
for (var i = 0; i < elements.length; i++) {
|
|
||||||
var style = elements[i].style.backgroundImage;
|
|
||||||
var newStyle = style.replace('//dka575ofm4ao0.cloudfront.net', 'https://p.poketube.fun/https://dka575ofm4ao0.cloudfront.net');
|
|
||||||
elements[i].style.backgroundImage = newStyle;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
1277
html/poketube.ejs
1277
html/poketube.ejs
File diff suppressed because it is too large
Load diff
|
@ -17,7 +17,9 @@
|
||||||
NodeList.prototype.forEach = Array.prototype.forEach;
|
NodeList.prototype.forEach = Array.prototype.forEach;
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
* {
|
||||||
|
font-family: "poketube flex" !important
|
||||||
|
}
|
||||||
@keyframes gradient {
|
@keyframes gradient {
|
||||||
0% {
|
0% {
|
||||||
background-position: 0 50%;
|
background-position: 0 50%;
|
||||||
|
@ -36,18 +38,27 @@
|
||||||
background-size: 400% 400%;
|
background-size: 400% 400%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #fff;
|
||||||
|
font-weight: 686;
|
||||||
|
font-stretch: extra-expanded;
|
||||||
|
}
|
||||||
|
|
||||||
.downnav {
|
.downnav {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
padding:10px;
|
padding:10px;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 100%;
|
|
||||||
margin: auto;
|
margin: auto;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
color:#fff;
|
color:#fff;
|
||||||
background-color: #0f0f0f;
|
background-color: #0007;
|
||||||
}</style>
|
border-radius: 5px;
|
||||||
|
width: calc(100% - 33px);
|
||||||
|
margin-left: 6px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<script>
|
<script>
|
||||||
<!--//--><![CDATA[//><!--
|
<!--//--><![CDATA[//><!--
|
||||||
/**
|
/**
|
||||||
|
@ -219,18 +230,16 @@
|
||||||
<input placeholder="Search the web" name="query" autocomplete="off" id="search_form_input_homepage" class="search__input" type="text" autofocus />
|
<input placeholder="Search the web" name="query" autocomplete="off" id="search_form_input_homepage" class="search__input" type="text" autofocus />
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button class="btn btn-success" type="submit" style="margin-top: 1em;margin-left: auto;text-align: center;display: flex;flex-direction: column;background: #fff;background-color: #303134;border: 1px solid #303134;border-radius: 4px;color: #e8eaed;font-family: arial,sans-serif;font-size: 14px;padding: 0 16px;line-height: 27px;height: 36px;min-width: 54px;margin-right: 13em;text-align: center;cursor: pointer;user-select: none;">
|
<button class="btn btn-success" type="submit" style="margin-top: 1em;margin-left: auto;text-align: center;display: flex;flex-direction: column;background: #fff;background-color: #303134;border: 1px solid #303134;border-radius: 4px;color: #e8eaed;font-family: arial,sans-serif;font-size: 14px;padding: 0 16px;line-height: 27px;height: 36px;min-width: 54px;margin-right: 9em;text-align: center;cursor: pointer;user-select: none;">
|
||||||
<p style="margin-top: auto;margin-bottom: auto;font-weight: 1000;margin-left: 6px;font-stretch: ultra-expanded;font-family:"poketube flex";Poketube flex;">Search Poke</p>
|
<p style="margin-top: auto;margin-bottom: auto;font-weight: 1000;margin-left: 6px;font-stretch: ultra-expanded;font-family:"poketube flex";Poketube flex;">Search Poke</p>
|
||||||
</button>
|
</button>
|
||||||
|
<div style="margin-left: 5.5em;margin-right: auto;width: fit-content;color: #fff;font-weight: 1000;font-stretch: ultra-expanded;font-size: 33px;margin-bottom: -1em;margin-top: 6px;" id="clock"></div>
|
||||||
<button class="btn btn-success" name="lucky" value="true" type="submit" style="margin-top: 1em;margin-left: auto;text-align: center;display: flex;flex-direction: column;background: #fff;background-color: #303134;border: 1px solid #303134;border-radius: 4px;color: #e8eaed;font-family: arial,sans-serif;font-size: 14px;padding: 0 16px;line-height: 27px;height: 36px;min-width: 54px;margin-right: 9em;text-align: center;cursor: pointer;user-select: none;margin-top: -38px;margin-left: 21em;">
|
<span style="color:#fff;margin-left: auto;margin-right: 8em;text-align: center;display: flex;width: fit-content;margin-top: 2em;font-size: ;" id="weatherInfo"></span>
|
||||||
<p style="margin-top: auto;margin-bottom: auto;font-weight: 1000;margin-left: 6px;font-stretch: ultra-expanded;font-family:"poketube flex";Poketube flex;">Im feeling lucky</p>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="downnav">
|
<div class="downnav">
|
||||||
<span style="color:#fff;" id="weatherInfo"></span> - <a style="color:#fff" href="/translate"> Translate </a> - <a style="color:#fff" href="/map"> PokeMaps </a> - <a style="color:#fff" href="/account-create">My Account</a> - <a style="color:#fff" href="/privacy">Privacy</a> - <a style="color:#fff" href="https://codeberg.org/ashley/poketube">Git</a>
|
<a style="color:#fff" href="/translate"> Translate </a> - <a style="color:#fff" href="/map"> PokeMaps </a> - <a style="color:#fff" href="/account-create">My Account</a> - <a style="color:#fff" href="/privacy">Privacy</a> - <a style="color:#fff" href="https://codeberg.org/ashley/poketube">Git</a>
|
||||||
<div style="float: right;">
|
<div style="float: right;">
|
||||||
<a style="color:#fff" id="osInfo"></a> <a style="color:#fff;margin-right: 1em;" href="/license">License</a>
|
<a style="color:#fff" id="osInfo"></a> <a style="color:#fff;margin-right: 1em;" href="/license">License</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -257,6 +266,27 @@ if (userAgent.includes("windows")) {
|
||||||
|
|
||||||
const osInfoElement = document.getElementById("osInfo");
|
const osInfoElement = document.getElementById("osInfo");
|
||||||
osInfoElement.textContent = `${osName} - `;
|
osInfoElement.textContent = `${osName} - `;
|
||||||
|
|
||||||
|
function updateClock() {
|
||||||
|
var now = new Date();
|
||||||
|
var hours = now.getHours();
|
||||||
|
var minutes = now.getMinutes();
|
||||||
|
var seconds = now.getSeconds();
|
||||||
|
|
||||||
|
// Add leading zeros to minutes and seconds
|
||||||
|
minutes = (minutes < 10 ? "0" : "") + minutes;
|
||||||
|
seconds = (seconds < 10 ? "0" : "") + seconds;
|
||||||
|
|
||||||
|
// Display the time in the "clock" div
|
||||||
|
document.getElementById("clock").innerHTML = hours + ":" + minutes + ":" + seconds;
|
||||||
|
|
||||||
|
// Update the clock every second
|
||||||
|
setTimeout(updateClock, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call the function to initially display the clock
|
||||||
|
updateClock();
|
||||||
|
|
||||||
</script> <script>
|
</script> <script>
|
||||||
const css = localStorage.getItem("poke-custom-css");
|
const css = localStorage.getItem("poke-custom-css");
|
||||||
|
|
||||||
|
@ -320,7 +350,7 @@ if (window.location.hostname === "poketube.fun" && config.plausible_enabled == t
|
||||||
|
|
||||||
// Call the fetchAndDisplayWeather function when the page loads
|
// Call the fetchAndDisplayWeather function when the page loads
|
||||||
fetchAndDisplayWeather();
|
fetchAndDisplayWeather();
|
||||||
</script><script src="/static/emojis.js"></script><style> img.emoji {height: 1em;width: 1em;margin: 0 .05em 0 .1em;vertical-align: -0.1em;}</style>
|
</script><script src="/static/emojis.js"></script><script src="/static/data-mobile.js"></script><style> img.emoji {height: 1em;width: 1em;margin: 0 .05em 0 .1em;vertical-align: -0.1em;}</style>
|
||||||
<script>twemoji.parse(document.body,{ base: 'https://p.poketube.fun/https://cdn.zptr.cc/twemoji/' })</script></div>
|
<script>twemoji.parse(document.body,{ base: 'https://p.poketube.fun/https://cdn.zptr.cc/twemoji/' })</script></div>
|
||||||
</div> <!-- id="content_homepage" -->
|
</div> <!-- id="content_homepage" -->
|
||||||
</div> <!-- id="content_wrapper_homepage" -->
|
</div> <!-- id="content_wrapper_homepage" -->
|
||||||
|
|
|
@ -546,6 +546,7 @@ font-weight: 1000;
|
||||||
<div style="display: flex; flex-direction: column; row-gap: 8px;font-weight:bold">
|
<div style="display: flex; flex-direction: column; row-gap: 8px;font-weight:bold">
|
||||||
<a href="/watch?v=<%= x.videoId %>"><span><%= x.viewCountText %></span> <span>•</span> <span><%= x.publishedText %></span></a>
|
<a href="/watch?v=<%= x.videoId %>"><span><%= x.viewCountText %></span> <span>•</span> <span><%= x.publishedText %></span></a>
|
||||||
<a href="/channel?id=<%= x.authorId %>"><%=x.author %></a>
|
<a href="/channel?id=<%= x.authorId %>"><%=x.author %></a>
|
||||||
|
<a href="/download?v=<%= x.videoId %>" style="display: flex;align-self: end;"><i class="fa-light fa-download" style="display: flex;align-self: end;margin-top: 3.1em;font-size: 19px;padding: 5px;border-radius: 18px;margin-left: 16em;"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -47,6 +47,7 @@ const splash = [
|
||||||
"pika!",
|
"pika!",
|
||||||
"fsf.org",
|
"fsf.org",
|
||||||
"ssfffssfssfffaassssfsdf!",
|
"ssfffssfssfffaassssfsdf!",
|
||||||
|
"𝓯𝓻𝓮𝓪𝓴𝔂poke",
|
||||||
"can you save my hds?",
|
"can you save my hds?",
|
||||||
"sahlo folina!",
|
"sahlo folina!",
|
||||||
"we come for you!",
|
"we come for you!",
|
||||||
|
@ -79,6 +80,7 @@ const splash = [
|
||||||
"men are handsome!",
|
"men are handsome!",
|
||||||
"enbys are cute!",
|
"enbys are cute!",
|
||||||
"you are cute :3",
|
"you are cute :3",
|
||||||
|
"read if cute!",
|
||||||
"stallmansupport.org!!!"
|
"stallmansupport.org!!!"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -70,17 +70,17 @@ app.get("/api/set-channel-subs", async function (req, res) {
|
||||||
channelName: channelToSubName,
|
channelName: channelToSubName,
|
||||||
avatar: avatar, // Store the avatar URL along with the subscription
|
avatar: avatar, // Store the avatar URL along with the subscription
|
||||||
});
|
});
|
||||||
res.json("user subbed");
|
res.redirect("/account-create")
|
||||||
} else if (!db.get(`user.${userid}.subs.${channelToSub}`)) {
|
} else if (!db.get(`user.${userid}.subs.${channelToSub}`)) {
|
||||||
// If the user has 'subs' but not this particular subscription, add it
|
// If the user has 'subs' but not this particular subscription, add it
|
||||||
db.set(`user.${userid}.subs.${channelToSub}`, {
|
db.set(`user.${userid}.subs.${channelToSub}`, {
|
||||||
channelName: channelToSubName,
|
channelName: channelToSubName,
|
||||||
avatar: avatar, // Store the avatar URL along with the subscription
|
avatar: avatar, // Store the avatar URL along with the subscription
|
||||||
});
|
});
|
||||||
res.json("user subbed");
|
res.redirect("/account-create")
|
||||||
} else {
|
} else {
|
||||||
// If the user is already subscribed to this channel, send a message indicating so
|
// If the user is already subscribed to this channel, send a message indicating so
|
||||||
res.json("user already subscribed");
|
res.json("ur already subscribed");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -105,9 +105,16 @@ app.get("/account-create", async function (req, res) {
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/my-acc", async function (req, res) {
|
app.get("/my-acc", async function (req, res) {
|
||||||
var userid = req.query.ID
|
var userid = req.query.ID;
|
||||||
var userSubs = db.get(`user.${userid}.subs`)
|
|
||||||
renderTemplate(res, req, "account-me.ejs", { userid, userSubs });
|
|
||||||
|
|
||||||
|
// Check if userid is more than 7 characters
|
||||||
|
if (userid.length > 7) {
|
||||||
|
return res.status(400).json({ error: "IDs can be 7 characters max silly :3" });
|
||||||
|
}
|
||||||
|
|
||||||
|
var userSubs = db.get(`user.${userid}.subs`);
|
||||||
|
|
||||||
|
renderTemplate(res, req, "account-me.ejs", { userid, userSubs });
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -190,6 +190,13 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
return res.redirect("/");
|
return res.redirect("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const regex = new RegExp("^([a-zA-Z0-9_-]{11})");
|
||||||
|
const isMatch = regex.test(v);
|
||||||
|
|
||||||
|
if (!isMatch) {
|
||||||
|
return res.redirect("/");
|
||||||
|
}
|
||||||
|
|
||||||
var contentlang = hl || "en-US";
|
var contentlang = hl || "en-US";
|
||||||
var contentregion = region || "US";
|
var contentregion = region || "US";
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,9 @@ class InnerTubePokeVidious {
|
||||||
*/
|
*/
|
||||||
isvalidvideo(v) {
|
isvalidvideo(v) {
|
||||||
if (v != "assets" && v != "cdn-cgi" && v != "404") {
|
if (v != "assets" && v != "cdn-cgi" && v != "404") {
|
||||||
return true;
|
const regex = new RegExp("^([a-zA-Z0-9_-]{11})");
|
||||||
|
const isMatch = regex.test(v);
|
||||||
|
return isMatch;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ class PokeTubeDislikesAPIManager {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
async _getEngagementData() {
|
async _getEngagementData() {
|
||||||
const apiUrl = `https://ryd.ggtyler.dev/votes/${this.videoId}&hash=d0550b6e28c8f93533a569c314d5b4e2`;
|
const apiUrl = `https://ryd-proxy.kavin.rocks/votes/${this.videoId}&hash=d0550b6e28c8f93533a569c314d5b4e2`;
|
||||||
const fallbackUrl = `https://returnyoutubedislikeapi.com/votes?videoId=${this.videoId}`;
|
const fallbackUrl = `https://returnyoutubedislikeapi.com/votes?videoId=${this.videoId}`;
|
||||||
|
|
||||||
const { fetch } = await import("undici");
|
const { fetch } = await import("undici");
|
||||||
|
|
Loading…
Reference in a new issue