Skip to content

Commit

Permalink
Merge pull request #29 from aymene69/dev
Browse files Browse the repository at this point in the history
Added selfhost configuration files
  • Loading branch information
aymene69 authored Jan 26, 2024
2 parents 5cc5d0c + fa2bb45 commit df24d34
Show file tree
Hide file tree
Showing 9 changed files with 1,052 additions and 8 deletions.
225 changes: 225 additions & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
body {
background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)),
url("https://upload.wikimedia.org/wikipedia/commons/thumb/0/00/Flag_of_Palestine.svg/1280px-Flag_of_Palestine.svg.png")
no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
font-family: "Roboto", sans-serif;
}
</style>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@300&display=swap"
rel="stylesheet"
/>
<link
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN"
crossorigin="anonymous"
/>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
crossorigin="anonymous"
></script>
<title>Stremio-Jackett by Aymene69</title>
</head>
<body>
<section class="vh-100">
<div class="container py-5 h-100">
<div class="row d-flex justify-content-center align-items-center h-100">
<div class="col-12 col-md-8 col-lg-6 col-xl-5">
<div class="card bg-dark text-white" style="border-radius: 1rem">
<div class="card-body p-5 text-center">
<div class="mb-md-5 mt-md-4 pb-5">
<img
src="https://user-images.githubusercontent.com/27040483/28728094-99f3e3f6-73c7-11e7-8f8d-28912dc6ac0d.png"
class="img-fluid mb-5"
alt="logo"
width="100"
height="100"
/>
<h2 class="fw-bold mb-2 text-uppercase">Stremio-Jackett</h2>
<p class="text-white-50 mb-5">1.0.0</p>
<h3 class="text-white mb-5">Configuration page</h3>
<p class="text-white-50 mb-5">
Please fill in the following fields to install Stremio-Jackett
</p>

<div class="form-outline form-white mb-4">
<label class="form-label"
>Stream service (direct torrent or debrid service)</label
>
<select
required
class="form-select"
aria-label=""
id="serviceProvider"
onchange="updateLink()"
>
<option value="torrent">torrent</option>
<option value="realdebrid">realdebrid</option>
<option value="alldebrid">alldebrid</option>
</select>
</div>

<div class="form-outline form-white mb-4" id="realDebridApiDiv">
<label class="form-label"
>Real-Debrid API key (you can get it
<a href="https://real-debrid.com/apitoken" target="_blank"
>here</a
>)</label
>
<input
required
class="form-control form-control-lg"
placeholder="Enter your Real-Debrid service API key"
id="realDebridApi"
oninput="updateLink()"
/>
</div>

<div class="form-outline form-white mb-4" id="allDebridApiDiv">
<label class="form-label"
>All-Debrid API key (you can get it
<a href="https://alldebrid.fr/apikeys/" target="_blank"
>here</a
>)</label
>
<input
required
class="form-control form-control-lg"
placeholder="Enter your All-Debrid service API key"
id="allDebridApi"
oninput="updateLink()"
/>
</div>

<div class="form-outline form-white mb-4" id="maxResultDiv">
<label class="form-label">Number of results per search </label>
<input
required
class="form-control form-control-lg"
placeholder="Enter maximum results per search"
oninput="updateLink()"
onchange="onChangeMaxResults()"
id="maxResults"
/>
</div>

<div class="form-outline form-white mb-4">
<label class="form-label">Jackett URL</label>
<input
required
class="form-control form-control-lg"
placeholder="For example 'http(s)://jackett_url:port'"
oninput="updateLink()"
id="jackettUrl"
/>
</div>

<div class="form-outline form-white mb-4">
<label class="form-label">Jackett API Key</label>
<input
required
class="form-control form-control-lg"
placeholder="Enter your Jackett API key"
oninput="updateLink()"
id="jackettApi"
/>
</div>

<a id="configureLink" href="" class="btn btn-primary">Install</a>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<script>
document.getElementById("realDebridApiDiv").style.display = "none";
document.getElementById("allDebridApiDiv").style.display = "none";

function onChangeMaxResults() {
let addonType = document.getElementById("serviceProvider").value;
let maxResultsInput = document.getElementById("maxResults");

if (addonType !== "torrent" && Number(maxResultsInput.value) > 15) {
maxResultsInput.value = String(15);
}
}

function updateLink() {
let serviceProvider = document.getElementById("serviceProvider").value;
let realDebridApi = document.getElementById("realDebridApi").value;
let allDebridApi = document.getElementById("allDebridApi").value;
let maxResults = document.getElementById("maxResults").value;
let jackettUrl = document.getElementById("jackettUrl").value;
let jackettApi = document.getElementById("jackettApi").value;

if (jackettUrl.at(-1) === "/") {
jackettUrl = jackettUrl.slice(0, -1);
}

let dynamicLink = document.getElementById("configureLink");

if (serviceProvider === "torrent") {
document.getElementById("realDebridApiDiv").style.display = "none";
document.getElementById("allDebridApiDiv").style.display = "none";
let dataJson = {
streamService: serviceProvider,
jackettUrl: jackettUrl,
jackettApiKey: jackettApi,
maxResults: maxResults,
};
dynamicLink.href = `stremio://${
window.location.host
}${window.location.pathname.replace("/configure", "")}/${btoa(
JSON.stringify(dataJson)
)}/manifest.json`;
} else if (serviceProvider === "realdebrid") {
document.getElementById("realDebridApiDiv").style.display = "block";
document.getElementById("allDebridApiDiv").style.display = "none";
let dataJson = {
streamService: serviceProvider,
jackettUrl: jackettUrl,
jackettApiKey: jackettApi,
debridApiKey: realDebridApi,
maxResults: maxResults,
};
dynamicLink.href = `stremio://${
window.location.host
}${window.location.pathname.replace("/configure", "")}/${btoa(
JSON.stringify(dataJson)
)}/manifest.json`;
} else if (serviceProvider === "alldebrid") {
document.getElementById("realDebridApiDiv").style.display = "none";
document.getElementById("allDebridApiDiv").style.display = "block";
let dataJson = {
streamService: serviceProvider,
jackettUrl: jackettUrl,
jackettApiKey: jackettApi,
debridApiKey: allDebridApi,
maxResults: maxResults,
};
dynamicLink.href = `stremio://${
window.location.host
}${window.location.pathname.replace("/configure", "")}/${btoa(
JSON.stringify(dataJson)
)}/manifest.json`;
}
}
</script>
</body>
</html>
Loading

0 comments on commit df24d34

Please sign in to comment.