The sources form no longer insists on prehraj.to

The addon accepts either host on its own as of stremio_prehrajto 7ef248d, so the
page that mints the URLs stops claiming otherwise. Each host stays all-or-nothing
and at least one must be complete — the same rule /encode enforces, checked here
too so the message arrives in Czech rather than as a 400.
This commit is contained in:
Claude 2026-08-07 09:09:56 +02:00
parent 36d7bb11b0
commit 5bfc45cd23

View file

@ -227,25 +227,25 @@
<p class="sub">Amber si z tvých přihlašovacích údajů poskládá adresy
zdrojů sám. Údaje jdou přímo do doplňku, přes náš server neprojdou.</p>
<h2 style="margin-top:18px">prehraj.to</h2>
<h2 style="margin-top:18px">prehraj.to <span style="color:var(--muted);font-weight:400">— nebo webshare níž</span></h2>
<div class="row">
<div><label for="byPtUser">Jméno</label>
<input id="byPtUser" type="text" autocomplete="off" spellcheck="false"></div>
<div><label for="byPtPass">Heslo</label>
<input id="byPtPass" type="password" autocomplete="off"></div>
</div>
<p class="hint">Povinné — český doplněk stojí na prehraj.to a bez něj
se nespustí. webshare se přidává k němu, samostatně zatím nefunguje.</p>
<p class="hint">Vyplň prehraj.to, webshare, nebo obojí — stačí jeden
z nich. Obojí najde nejvíc.</p>
<h2 style="margin-top:18px">webshare.cz <span style="color:var(--muted);font-weight:400">— volitelné</span></h2>
<h2 style="margin-top:18px">webshare.cz</h2>
<div class="row">
<div><label for="byWsUser">Jméno</label>
<input id="byWsUser" type="text" autocomplete="off" spellcheck="false"></div>
<div><label for="byWsPass">Heslo</label>
<input id="byWsPass" type="password" autocomplete="off"></div>
</div>
<p class="hint">Druhý český host. Buď obojí, nebo nic — půlka údajů
selže při každém hledání.</p>
<p class="hint">Druhý český host, funguje i sám o sobě. U každého
hosta ale buď obojí, nebo nic — půlka údajů selže při každém hledání.</p>
<h2 style="margin-top:18px">TorBox <span style="color:var(--muted);font-weight:400">— volitelné, ale doporučené</span></h2>
<label for="byTbKey">API klíč</label>
@ -688,14 +688,20 @@ $("byGo").onclick=async function(){
var ptU=$("byPtUser").value.trim(), ptP=$("byPtPass").value;
var wsU=$("byWsUser").value.trim(), wsP=$("byWsPass").value;
var tb=$("byTbKey").value.trim(), tmdb=$("byTmdb").value.trim();
if(!ptU || !ptP){
setMsg($("adMsg"),"prehraj.to je zatím povinný — bez něj český doplněk nefunguje.","err");
// Each host is all-or-nothing, and at least one must be complete — the same
// rule the addon's own /encode enforces, checked here so the message is Czech.
if ((ptU && !ptP) || (!ptU && ptP)){
setMsg($("adMsg"),"U prehraj.to vyplň jméno i heslo, nebo obojí nech prázdné.","err");
return;
}
if ((wsU && !wsP) || (!wsU && wsP)){
setMsg($("adMsg"),"U webshare vyplň jméno i heslo, nebo obojí nech prázdné.","err");
return;
}
if (!(ptU && ptP) && !(wsU && wsP)){
setMsg($("adMsg"),"Vyplň aspoň jednoho hosta — prehraj.to nebo webshare.","err");
return;
}
busy($("byGo"),true,"Nastavuji…"); setMsg($("adMsg"),"");
var out={ tmdbKey:tmdb };
try {
@ -703,7 +709,7 @@ $("byGo").onclick=async function(){
// from this browser to the addon and never through our server.
var enc=await fetch(PREHRAJTO_BASE+"/encode",{
method:"POST", headers:{"Content-Type":"application/json"},
body:JSON.stringify({ username:ptU, password:ptP,
body:JSON.stringify({ username:ptU||"", password:ptP||"",
wsUsername:wsU||"", wsPassword:wsP||"" })});
var ed=await enc.json();
if(!enc.ok || !ed.token) throw new Error(ed.error||"encode failed");