@staff0rd/assist 0.973.0 → 0.974.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,6 +32,7 @@
32
32
  "extension_pages": "script-src 'self'"
33
33
  },
34
34
  "permissions": ["storage", "alarms"],
35
+ "optional_permissions": ["userScripts"],
35
36
  "host_permissions": ["http://localhost/*", "http://127.0.0.1/*"],
36
37
  "options_ui": {
37
38
  "page": "options.html"
@@ -28,6 +28,15 @@
28
28
  <button type="submit">Save</button>
29
29
  <span data-status role="status"></span>
30
30
  </form>
31
+ <section>
32
+ <h2>Approved scripts</h2>
33
+ <p>
34
+ <code>assist browser run</code> shows each script on the page and runs
35
+ it only when you click Run. Running needs the userScripts permission.
36
+ </p>
37
+ <button type="button" data-grant-scripts>Allow scripts</button>
38
+ <span data-scripts-status role="status"></span>
39
+ </section>
31
40
  <script src="options.js"></script>
32
41
  </body>
33
42
  </html>
@@ -1 +1 @@
1
- "use strict";(()=>{function n(){return globalThis.browser?.storage?.local}function o(t){let e;try{e=new URL(t.trim())}catch{return}if(!(e.protocol!=="http:"&&e.protocol!=="https:"))return e.origin}var c="http://localhost:3100",s="serverUrl";async function u(){let e=(await n()?.get(s).catch(()=>{}))?.[s];return typeof e=="string"&&o(e)||c}function a(t,e){let r=t.querySelector(e);if(!r)throw new Error(`options page is missing ${e}`);return r}async function d(t=document){let e=a(t,"form"),r=a(t,"input[name=serverUrl]"),l=a(t,"[data-status]");r.value=await u(),e.addEventListener("submit",async m=>{m.preventDefault();let i=o(r.value);if(!i){l.textContent="Enter an http:// or https:// URL";return}await n()?.set({[s]:i}),r.value=i,l.textContent="Saved"})}typeof document<"u"&&document.querySelector("form")&&d();})();
1
+ "use strict";(()=>{function i(){return globalThis.browser?.storage?.local}function a(t){let e;try{e=new URL(t.trim())}catch{return}if(!(e.protocol!=="http:"&&e.protocol!=="https:"))return e.origin}var d="http://localhost:3100",c="serverUrl";async function u(){let e=(await i()?.get(c).catch(()=>{}))?.[c];return typeof e=="string"&&a(e)||d}var m={permissions:["userScripts"]};function f(){return globalThis.browser?.permissions}async function p(t=document){let e=t.querySelector("[data-grant-scripts]"),r=t.querySelector("[data-scripts-status]"),n=f();if(!e||!r||!n)return;let s=o=>{r.textContent=o?"Allowed":"Not allowed",e.hidden=o};s(await n.contains(m)),e.addEventListener("click",async()=>{s(await n.request(m).catch(()=>!1))})}function l(t,e){let r=t.querySelector(e);if(!r)throw new Error(`options page is missing ${e}`);return r}async function S(t=document){let e=l(t,"form"),r=l(t,"input[name=serverUrl]"),n=l(t,"[data-status]");r.value=await u(),e.addEventListener("submit",async s=>{s.preventDefault();let o=a(r.value);if(!o){n.textContent="Enter an http:// or https:// URL";return}await i()?.set({[c]:o}),r.value=o,n.textContent="Saved"})}typeof document<"u"&&document.querySelector("form")&&(S(),p());})();