add option to set youtube to patched

This commit is contained in:
localhost 2026-03-11 18:30:12 +01:00
parent ce02ade61d
commit f7e5ec529c
2 changed files with 22 additions and 15 deletions

View File

@ -28,13 +28,15 @@ app.get('/save', async ({ query: { url }, set, headers, error }) => {
if (healthStatus[process.env.METADATA!] != 'healthy') { if (healthStatus[process.env.METADATA!] != 'healthy') {
websocket = process.env.ALTERNATIVE_WEBSOCKET! websocket = process.env.ALTERNATIVE_WEBSOCKET!
} }
const ytPatched = (process.env.YT_PATCHED || '').toLowerCase() === 'true' || process.env.YT_PATCHED === '1'
set.headers['Content-Type'] = 'text/html; charset=utf-8' set.headers['Content-Type'] = 'text/html; charset=utf-8'
return await m(eta.render('./save', { return await m(eta.render('./save', {
title: 'Save Video | PreserveTube', title: 'Save Video | PreserveTube',
websocket, websocket,
sitekey: process.env.SITEKEY, sitekey: process.env.SITEKEY,
url url,
ytPatched
})) }))
}) })

View File

@ -1,7 +1,9 @@
<% layout('./layout') %> <% layout('./layout') %>
<% /* <div class="sorry"> <% if (it.ytPatched) { %>
Saving videos should be stable again. Will try some more experiments in the coming days. <div class="sorry">
</div> */ %> YouTube changed something, which caused saving to stop working. Will fix it ASAP.
</div>
<% } %>
<div id="backdrop" style="display: none;"> <div id="backdrop" style="display: none;">
<div id="save-intro-dialog"> <div id="save-intro-dialog">
@ -27,6 +29,7 @@
</div> </div>
</div> </div>
<% if (!it.ytPatched) { %>
<div id="logs" class="logs"> <div id="logs" class="logs">
<h1 id="title"></h1> <h1 id="title"></h1>
<div class="captcha" id="captcha"></div> <div class="captcha" id="captcha"></div>
@ -34,7 +37,9 @@
<noscript>This feature doesen't function properly unless JavaScript is enabled.</noscript> <noscript>This feature doesen't function properly unless JavaScript is enabled.</noscript>
</h3> </h3>
</div> </div>
<% } %>
<% if (!it.ytPatched) { %>
<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script> <script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script>
<script> <script>
const url = "<%= it.url %>" const url = "<%= it.url %>"
@ -141,17 +146,17 @@
runFirstSaveGate() runFirstSaveGate()
</script> </script>
<% } %>
<style> <style>
.sorry { .sorry {
margin-top: 10px; margin: 24px auto 80px auto;
position: relative; width: min(760px, calc(100vw - 28px));
background-color: #cfeeffff;
border-top: 2px dashed #5ebbdaff;
border-bottom: 2px dashed #5ebbdaff;
padding-top: 5px;
padding-bottom: 5px;
text-align: center; text-align: center;
padding: 8px 0;
font-size: 1.15rem;
font-weight: 400;
color: #000;
} }
#backdrop { #backdrop {