Skip to content

Commit

Permalink
fix copy
Browse files Browse the repository at this point in the history
  • Loading branch information
g0ldyy authored Jun 28, 2024
1 parent a1763c2 commit ff0f223
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions comet/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -507,16 +507,13 @@
let defaultResolutions = [];

document.addEventListener("DOMContentLoaded", function() {
fetch("/static/config.json")
.then(response => response.json())
.then(data => {
populateSelect("indexers", data.indexers);
populateSelect("languages", data.languages);
populateSelect("resolutions", data.resolutions);

defaultLanguages = data.languages;
defaultResolutions = data.resolutions;
});
const webConfig = {{webConfig|tojson}};
populateSelect("indexers", webConfig.indexers);
populateSelect("languages", webConfig.languages);
populateSelect("resolutions", webConfig.resolutions);

defaultLanguages = webConfig.languages;
defaultResolutions = webConfig.resolutions;
});

function populateSelect(selectId, options) {
Expand Down Expand Up @@ -551,10 +548,14 @@
resolutions: selectedResolutions,
languages: selectedLanguages
};

navigator.clipboard.writeText(`${window.location.origin}/${btoa(JSON.stringify(settings))}/manifest.json`).then(() => {
alert.toast();
});

const textarea = document.createElement("textarea");
textarea.value = `${window.location.origin}/${btoa(JSON.stringify(settings))}/manifest.json`;
document.body.appendChild(textarea);
textarea.select();
document.execCommand("copy");
document.body.removeChild(textarea);
alert.toast();
});
</script>
</div>
Expand Down

0 comments on commit ff0f223

Please sign in to comment.