From ff0f22371bee62d74b9a7767b9b4e310d0c475db Mon Sep 17 00:00:00 2001 From: Goldy <153996346+g0ldyy@users.noreply.github.com> Date: Fri, 28 Jun 2024 23:05:20 +0200 Subject: [PATCH] fix copy --- comet/templates/index.html | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/comet/templates/index.html b/comet/templates/index.html index d4f0a67..33341e5 100644 --- a/comet/templates/index.html +++ b/comet/templates/index.html @@ -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) { @@ -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(); });