@pipeup/updates 0.9.0 → 1.0.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.
- package/dist/pipeup+updates.min.js +2 -2
- package/dist/updates.esm.js +1 -1
- package/dist/updates.min.js +1 -1
- package/package.json +2 -2
package/dist/updates.esm.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var p=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.]+))?$/;function y(t,e){let n=p.exec(t),r=p.exec(e);if(!n||!r)return 0;for(let o=1;o<=3;o++)if(Number(n[o])!==Number(r[o]))return Number(n[o])-Number(r[o]);if(n[4]===r[4])return 0;if(n[4]===void 0)return 1;if(r[4]===void 0)return-1;let i=n[4].split("."),s=r[4].split(".");for(let o=0;o<Math.max(i.length,s.length);o++){if(i[o]===void 0)return-1;if(s[o]===void 0)return 1;let[a,u]=[Number(i[o]),Number(s[o])],f=Number.isNaN(a)||Number.isNaN(u)?i[o].localeCompare(s[o]):a-u;if(f)return f}return 0}function U(t,e){return/[<>]/.test(e)?e.split(/\s+/).filter(Boolean).every(n=>{let r=/^(<=|>=|<|>)(.+)$/.exec(n);if(!r)return!1;let i=y(t,r[2]);return r[1]==="<"?i<0:r[1]==="<="?i<=0:r[1]===">"?i>0:i>=0}):e.split(",").some(n=>n.trim()===t)}var B=(t,e)=>{let n=p.exec(t),r=p.exec(e);return n[1]!==r[1]||n[1]==="0"&&n[2]!==r[2]};function A(t,e){if(!p.test(e))return null;let n=t.versions[t.latest]?.notes??"",r=o=>t.advisories.find(a=>a.severity===o&&U(e,a.affects)),i=r("security");if(i)return{level:"security",id:i.id,text:`Security update: ${i.summary}${i.fixed?` Fixed in Pipeup ${i.fixed}.`:""}`,url:i.url};if(y(e,t.minimum)<0)return{level:"security",id:`minimum-${t.minimum}`,text:`This Pipeup (${e}) is no longer supported; ${t.minimum} is the oldest that is. The newest is ${t.latest}.`,url:n};let s=r("recommended");return s?{level:"recommended",id:s.id,text:s.summary,url:s.url}:y(t.latest,e)>0?{level:B(t.latest,e)?"recommended":"info",id:`latest-${t.latest}`,text:`Pipeup ${t.latest} is out (this page has ${e}).`,url:n}:null}var x=[{id:"k1",key:"ZBAKAHS4SodpGjCbD__Axq-VbdqAWw4G94aKDUA6Bwg"},{id:"k2",key:"nRDI2GcBcBArMPqE1BERTb9UO6VE1fvC3ZKl3Y6dufU"}];var v=x;function m(t){if(t===null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return`[${t.map(m).join(",")}]`;let e=t;return`{${Object.keys(e).filter(n=>e[n]!==void 0).sort().map(n=>`${JSON.stringify(n)}:${m(e[n])}`).join(",")}}`}var S=t=>{let e=atob(t.replace(/-/g,"+").replace(/_/g,"/")),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n};async function k(t,e,n=Date.now()){try{let r=JSON.parse(t),i=e.find(f=>f.id===r?.sig?.key);if(!i||r.v!==1||!(Date.parse(r.expires)>n))return null;let{sig:s,...o}=r,a=await crypto.subtle.importKey("raw",S(i.key),{name:"Ed25519"},!1,["verify"]),u=new TextEncoder().encode(m(o));return await crypto.subtle.verify({name:"Ed25519"},a,S(s.value),u)?r:null}catch{return null}}var c=(t,e)=>e?e.getAttribute(t):globalThis.Pipeup?.setting?.(t)??globalThis.document?.documentElement.getAttribute(t)??null;var ct=2n**256n-2n**32n-977n;var M="https://pipeup-ai.github.io/pipeup/updates.json",P=864e5,C=7*P,d={list:"pipeup:updates-list",dismissed:"pipeup:updates-dismissed"},L=["M12 19V5","M5 12l7-7 7 7"],_=["https://github.com/pipeup-ai/","https://pipeup-ai.github.io/"],b=t=>{try{return localStorage.getItem(t)??""}catch{return""}},w=(t,e)=>{try{localStorage.setItem(t,e)}catch{}};function I(t=location,e){let n=c("data-pipeup-updates",e);if(n==="off")return!1;if(n==="on"||n==="everyone")return!0;let r=t.hostname;return t.protocol==="file:"||r==="localhost"||r==="127.0.0.1"||r==="[::1]"||r.endsWith(".localhost")||r.endsWith(".test")}function K(t){try{let e=new URL(t);return e.protocol==="https:"&&_.some(n=>e.href.startsWith(n))?e.href:null}catch{return null}}function R(){return{id:"updates",api:1,version:"0.6.0",needs:["menu","notify"],network:{when:"page-configured",to:["pipeup-ai.github.io"],says:"Checks the Pipeup project's published update list (GitHub Pages) once a day, only on this computer or where the page's author asked; that service can see your network address."},setup(t){if(c("data-pipeup-updates")==="off")return t.off('the page switched it off (data-pipeup-updates="off")');if(!I())return t.off(`not the author's computer (add data-pipeup-updates="on" to the page to check here)`);j(t)}}}async function j(t){let e="",n=b(d.list),r=Number(b(`${d.list}-at`));if(n&&Date.now()-r<P)e=n;else try{let o=AbortSignal.timeout(4e3),a=await fetch(M,{credentials:"omit",referrerPolicy:"no-referrer",mode:"cors",signal:AbortSignal.any?AbortSignal.any([t.signal,o]):o});a.ok&&(e=await a.text(),w(d.list,e),w(`${d.list}-at`,String(Date.now())))}catch{return}let i=await k(e,v);if(!i||t.signal.aborted)return;let s=A(i,t.version);s&&H(t,s)}function H(t,e){let n=K(e.url),r=`pipeup: ${e.text}${n?` ${n}`:""}`;if(e.level==="info")return void console.info(r);console.warn(r);let i=JSON.parse(b(d.dismissed)||"{}"),s=i[e.id];s&&(e.level!=="security"||Date.now()-s<C)||(t.addMenuItem({id:"update",icon:L,label:()=>e.level==="security"?"Security update for Pipeup":"A newer Pipeup is out",hint:()=>e.text,select:()=>{n&&window.open(n,"_blank","noopener,noreferrer"),i[e.id]=Date.now(),w(d.dismissed,JSON.stringify(i))}}),e.level==="security"&&t.notify(e.text))}export{R as default};
|
package/dist/updates.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{function m(t){let e=globalThis;(e.pipeupAddons||=[]).push(t),typeof addEventListener=="function"&&addEventListener("load",()=>{e.Pipeup||console.error(`pipeup: the "${t.id}" add-on needs Pipeup on the page too; load pipeup.min.js.`)},{once:!0})}var p=(t,e)=>e?e.getAttribute(t):globalThis.Pipeup?.setting?.(t)??globalThis.document?.documentElement.getAttribute(t)??null;var st=2n**256n-2n**32n-977n;var c=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.]+))?$/;function h(t,e){let n=c.exec(t),r=c.exec(e);if(!n||!r)return 0;for(let
|
|
1
|
+
"use strict";(()=>{function m(t){let e=globalThis;(e.pipeupAddons||=[]).push(t),typeof addEventListener=="function"&&addEventListener("load",()=>{e.Pipeup||console.error(`pipeup: the "${t.id}" add-on needs Pipeup on the page too; load pipeup.min.js.`)},{once:!0})}var p=(t,e)=>e?e.getAttribute(t):globalThis.Pipeup?.setting?.(t)??globalThis.document?.documentElement.getAttribute(t)??null;var st=2n**256n-2n**32n-977n;var c=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.]+))?$/;function h(t,e){let n=c.exec(t),r=c.exec(e);if(!n||!r)return 0;for(let o=1;o<=3;o++)if(Number(n[o])!==Number(r[o]))return Number(n[o])-Number(r[o]);if(n[4]===r[4])return 0;if(n[4]===void 0)return 1;if(r[4]===void 0)return-1;let i=n[4].split("."),s=r[4].split(".");for(let o=0;o<Math.max(i.length,s.length);o++){if(i[o]===void 0)return-1;if(s[o]===void 0)return 1;let[a,u]=[Number(i[o]),Number(s[o])],f=Number.isNaN(a)||Number.isNaN(u)?i[o].localeCompare(s[o]):a-u;if(f)return f}return 0}function N(t,e){return/[<>]/.test(e)?e.split(/\s+/).filter(Boolean).every(n=>{let r=/^(<=|>=|<|>)(.+)$/.exec(n);if(!r)return!1;let i=h(t,r[2]);return r[1]==="<"?i<0:r[1]==="<="?i<=0:r[1]===">"?i>0:i>=0}):e.split(",").some(n=>n.trim()===t)}var M=(t,e)=>{let n=c.exec(t),r=c.exec(e);return n[1]!==r[1]||n[1]==="0"&&n[2]!==r[2]};function x(t,e){if(!c.test(e))return null;let n=t.versions[t.latest]?.notes??"",r=o=>t.advisories.find(a=>a.severity===o&&N(e,a.affects)),i=r("security");if(i)return{level:"security",id:i.id,text:`Security update: ${i.summary}${i.fixed?` Fixed in Pipeup ${i.fixed}.`:""}`,url:i.url};if(h(e,t.minimum)<0)return{level:"security",id:`minimum-${t.minimum}`,text:`This Pipeup (${e}) is no longer supported; ${t.minimum} is the oldest that is. The newest is ${t.latest}.`,url:n};let s=r("recommended");return s?{level:"recommended",id:s.id,text:s.summary,url:s.url}:h(t.latest,e)>0?{level:M(t.latest,e)?"recommended":"info",id:`latest-${t.latest}`,text:`Pipeup ${t.latest} is out (this page has ${e}).`,url:n}:null}var v=[{id:"k1",key:"ZBAKAHS4SodpGjCbD__Axq-VbdqAWw4G94aKDUA6Bwg"},{id:"k2",key:"nRDI2GcBcBArMPqE1BERTb9UO6VE1fvC3ZKl3Y6dufU"}];var S=v;function b(t){if(t===null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return`[${t.map(b).join(",")}]`;let e=t;return`{${Object.keys(e).filter(n=>e[n]!==void 0).sort().map(n=>`${JSON.stringify(n)}:${b(e[n])}`).join(",")}}`}var k=t=>{let e=atob(t.replace(/-/g,"+").replace(/_/g,"/")),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n};async function P(t,e,n=Date.now()){try{let r=JSON.parse(t),i=e.find(f=>f.id===r?.sig?.key);if(!i||r.v!==1||!(Date.parse(r.expires)>n))return null;let{sig:s,...o}=r,a=await crypto.subtle.importKey("raw",k(i.key),{name:"Ed25519"},!1,["verify"]),u=new TextEncoder().encode(b(o));return await crypto.subtle.verify({name:"Ed25519"},a,k(s.value),u)?r:null}catch{return null}}var L="https://pipeup-ai.github.io/pipeup/updates.json",U=864e5,_=7*U,d={list:"pipeup:updates-list",dismissed:"pipeup:updates-dismissed"},I=["M12 19V5","M5 12l7-7 7 7"],K=["https://github.com/pipeup-ai/","https://pipeup-ai.github.io/"],w=t=>{try{return localStorage.getItem(t)??""}catch{return""}},A=(t,e)=>{try{localStorage.setItem(t,e)}catch{}};function R(t=location,e){let n=p("data-pipeup-updates",e);if(n==="off")return!1;if(n==="on"||n==="everyone")return!0;let r=t.hostname;return t.protocol==="file:"||r==="localhost"||r==="127.0.0.1"||r==="[::1]"||r.endsWith(".localhost")||r.endsWith(".test")}function j(t){try{let e=new URL(t);return e.protocol==="https:"&&K.some(n=>e.href.startsWith(n))?e.href:null}catch{return null}}function B(){return{id:"updates",api:1,version:"0.6.0",needs:["menu","notify"],network:{when:"page-configured",to:["pipeup-ai.github.io"],says:"Checks the Pipeup project's published update list (GitHub Pages) once a day, only on this computer or where the page's author asked; that service can see your network address."},setup(t){if(p("data-pipeup-updates")==="off")return t.off('the page switched it off (data-pipeup-updates="off")');if(!R())return t.off(`not the author's computer (add data-pipeup-updates="on" to the page to check here)`);H(t)}}}async function H(t){let e="",n=w(d.list),r=Number(w(`${d.list}-at`));if(n&&Date.now()-r<U)e=n;else try{let o=AbortSignal.timeout(4e3),a=await fetch(L,{credentials:"omit",referrerPolicy:"no-referrer",mode:"cors",signal:AbortSignal.any?AbortSignal.any([t.signal,o]):o});a.ok&&(e=await a.text(),A(d.list,e),A(`${d.list}-at`,String(Date.now())))}catch{return}let i=await P(e,S);if(!i||t.signal.aborted)return;let s=x(i,t.version);s&&z(t,s)}function z(t,e){let n=j(e.url),r=`pipeup: ${e.text}${n?` ${n}`:""}`;if(e.level==="info")return void console.info(r);console.warn(r);let i=JSON.parse(w(d.dismissed)||"{}"),s=i[e.id];s&&(e.level!=="security"||Date.now()-s<_)||(t.addMenuItem({id:"update",icon:I,label:()=>e.level==="security"?"Security update for Pipeup":"A newer Pipeup is out",hint:()=>e.text,select:()=>{n&&window.open(n,"_blank","noopener,noreferrer"),i[e.id]=Date.now(),A(d.dismissed,JSON.stringify(i))}}),e.level==="security"&&t.notify(e.text))}m(B());})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipeup/updates",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Tells the author, on their own computer, when a newer Pipeup or a security fix is out, from the project's signed update list.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Pipeup contributors",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"LICENSE"
|
|
25
25
|
],
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"pipeup": "0.
|
|
27
|
+
"pipeup": "1.0.0"
|
|
28
28
|
},
|
|
29
29
|
"pipeup": {
|
|
30
30
|
"network": {
|