chatgpt-api/third-party/nopecha-chrome-extension/setup.js

4 wiersze
876 B
JavaScript

(async()=>{function e(){try{function t(t){return`<p style='font-family: monospace; font-size: 12px; white-space: pre;'>${t}</p>`}var e=[];for(const n of arguments)e.push(t(n));e.push(t('Join us on <a href="https://nopecha.com/discord" target="_blank">Discord</a>')),document.body.innerHTML=e.join("<hr>")}catch(t){}}try{var t,n;document.location.hash?(e("Importing settings..."),await BG.exec("Settings.get"),t=SettingsManager.import(document.location.hash),await BG.exec("Settings.update",{settings:t}),e(`Visiting this URL will import your NopeCHA settings.
<a href="${n=window.location.href}">${n}</a>`,`Successfully imported settings.
`+JSON.stringify(t,null,4))):e("Invalid URL.\nPlease set the URL hash and reload the page.","Example: https://nopecha.com/setup#TESTKEY123")}catch(t){e("Failed to import settings.\nPlease verify that your URL is formed properly.")}})();