neoctl-web 0.1.14 → 0.1.16
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/README.md +34 -256
- package/dist/assets/App-Bn6HVDCw.js +105 -0
- package/dist/assets/{index-Ckm5fgYu.js → index-BkoW_zgA.js} +2 -2
- package/dist/index.html +1 -1
- package/package.json +14 -13
- package/plugins/downloads/README.md +1 -1
- package/plugins/video-share/README.md +1 -1
- package/server.mjs +1 -42
- package/control-protocol.mjs +0 -44
- package/control-sync.mjs +0 -420
- package/dist/assets/App--pG9o2Yv.js +0 -105
- package/plugins/downloads/downloads.test.mjs +0 -83
- package/plugins/video-share/video-share.test.mjs +0 -182
- package/plugins/xhs-artifact/version.test.mjs +0 -151
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/App
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/App-Bn6HVDCw.js","assets/App-DmtsTXw2.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();/**
|
|
3
3
|
* @vue/shared v3.5.34
|
|
4
4
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
@@ -15,4 +15,4 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/App--pG9o2Yv.js
|
|
|
15
15
|
* @vue/runtime-dom v3.5.34
|
|
16
16
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
17
17
|
* @license MIT
|
|
18
|
-
**/let as;const cr=typeof window<"u"&&window.trustedTypes;if(cr)try{as=cr.createPolicy("vue",{createHTML:e=>e})}catch{}const Hi=as?e=>as.createHTML(e):e=>e,Zl="http://www.w3.org/2000/svg",Ql="http://www.w3.org/1998/Math/MathML",We=typeof document<"u"?document:null,fr=We&&We.createElement("template"),ec={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,s)=>{const r=t==="svg"?We.createElementNS(Zl,e):t==="mathml"?We.createElementNS(Ql,e):n?We.createElement(e,{is:n}):We.createElement(e);return e==="select"&&s&&s.multiple!=null&&r.setAttribute("multiple",s.multiple),r},createText:e=>We.createTextNode(e),createComment:e=>We.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>We.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,s,r,i){const o=n?n.previousSibling:t.lastChild;if(r&&(r===i||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===i||!(r=r.nextSibling)););else{fr.innerHTML=Hi(s==="svg"?`<svg>${e}</svg>`:s==="mathml"?`<math>${e}</math>`:e);const l=fr.content;if(s==="svg"||s==="mathml"){const c=l.firstChild;for(;c.firstChild;)l.appendChild(c.firstChild);l.removeChild(c)}t.insertBefore(l,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},tt="transition",Ht="animation",Pt=Symbol("_vtc"),ji={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},tc=ie({},Go,ji),pt=(e,t=[])=>{I(e)?e.forEach(n=>n(...t)):e&&e(...t)},ar=e=>e?I(e)?e.some(t=>t.length>1):e.length>1:!1;function nc(e){const t={};for(const A in e)A in ji||(t[A]=e[A]);if(e.css===!1)return t;const{name:n="v",type:s,duration:r,enterFromClass:i=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:l=`${n}-enter-to`,appearFromClass:c=i,appearActiveClass:u=o,appearToClass:a=l,leaveFromClass:h=`${n}-leave-from`,leaveActiveClass:p=`${n}-leave-active`,leaveToClass:v=`${n}-leave-to`}=e,C=sc(r),x=C&&C[0],N=C&&C[1],{onBeforeEnter:D,onEnter:M,onEnterCancelled:F,onLeave:O,onLeaveCancelled:V,onBeforeAppear:se=D,onAppear:j=M,onAppearCancelled:G=F}=t,P=(A,X,oe,Ke)=>{A._enterCancelled=Ke,rt(A,X?a:l),rt(A,X?u:o),oe&&oe()},K=(A,X)=>{A._isLeaving=!1,rt(A,h),rt(A,v),rt(A,p),X&&X()},J=A=>(X,oe)=>{const Ke=A?j:M,ce=()=>P(X,A,oe);pt(Ke,[X,ce]),ur(()=>{rt(X,A?c:i),Ne(X,A?a:l),ar(Ke)||dr(X,s,x,ce)})};return ie(t,{onBeforeEnter(A){pt(D,[A]),Ne(A,i),Ne(A,o)},onBeforeAppear(A){pt(se,[A]),Ne(A,c),Ne(A,u)},onEnter:J(!1),onAppear:J(!0),onLeave(A,X){A._isLeaving=!0;const oe=()=>K(A,X);Ne(A,h),A._enterCancelled?(Ne(A,p),us(A)):(us(A),Ne(A,p)),ur(()=>{A._isLeaving&&(rt(A,h),Ne(A,v),ar(O)||dr(A,s,N,oe))}),pt(O,[A,oe])},onEnterCancelled(A){P(A,!1,void 0,!0),pt(F,[A])},onAppearCancelled(A){P(A,!0,void 0,!0),pt(G,[A])},onLeaveCancelled(A){K(A),pt(V,[A])}})}function sc(e){if(e==null)return null;if(q(e))return[Gn(e.enter),Gn(e.leave)];{const t=Gn(e);return[t,t]}}function Gn(e){return Xi(e)}function Ne(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Pt]||(e[Pt]=new Set)).add(t)}function rt(e,t){t.split(/\s+/).forEach(s=>s&&e.classList.remove(s));const n=e[Pt];n&&(n.delete(t),n.size||(e[Pt]=void 0))}function ur(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let rc=0;function dr(e,t,n,s){const r=e._endId=++rc,i=()=>{r===e._endId&&s()};if(n!=null)return setTimeout(i,n);const{type:o,timeout:l,propCount:c}=Vi(e,t);if(!o)return s();const u=o+"end";let a=0;const h=()=>{e.removeEventListener(u,p),i()},p=v=>{v.target===e&&++a>=c&&h()};setTimeout(()=>{a<c&&h()},l+1),e.addEventListener(u,p)}function Vi(e,t){const n=window.getComputedStyle(e),s=C=>(n[C]||"").split(", "),r=s(`${tt}Delay`),i=s(`${tt}Duration`),o=hr(r,i),l=s(`${Ht}Delay`),c=s(`${Ht}Duration`),u=hr(l,c);let a=null,h=0,p=0;t===tt?o>0&&(a=tt,h=o,p=i.length):t===Ht?u>0&&(a=Ht,h=u,p=c.length):(h=Math.max(o,u),a=h>0?o>u?tt:Ht:null,p=a?a===tt?i.length:c.length:0);const v=a===tt&&/\b(?:transform|all)(?:,|$)/.test(s(`${tt}Property`).toString());return{type:a,timeout:h,propCount:p,hasTransform:v}}function hr(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,s)=>pr(n)+pr(e[s])))}function pr(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function us(e){return(e?e.ownerDocument:document).body.offsetHeight}function ic(e,t,n){const s=e[Pt];s&&(t=(t?[t,...s]:[...s]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const gr=Symbol("_vod"),oc=Symbol("_vsh"),lc=Symbol(""),cc=/(?:^|;)\s*display\s*:/;function fc(e,t,n){const s=e.style,r=te(n);let i=!1;if(n&&!r){if(t)if(te(t))for(const o of t.split(";")){const l=o.slice(0,o.indexOf(":")).trim();n[l]==null&&Ut(s,l,"")}else for(const o in t)n[o]==null&&Ut(s,o,"");for(const o in n){o==="display"&&(i=!0);const l=n[o];l!=null?uc(e,o,!te(t)&&t?t[o]:void 0,l)||Ut(s,o,l):Ut(s,o,"")}}else if(r){if(t!==n){const o=s[lc];o&&(n+=";"+o),s.cssText=n,i=cc.test(n)}}else t&&e.removeAttribute("style");gr in e&&(e[gr]=i?s.display:"",e[oc]&&(s.display="none"))}const mr=/\s*!important$/;function Ut(e,t,n){if(I(n))n.forEach(s=>Ut(e,t,s));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const s=ac(e,t);mr.test(n)?e.setProperty(ft(s),n.replace(mr,""),"important"):e[s]=n}}const _r=["Webkit","Moz","ms"],Jn={};function ac(e,t){const n=Jn[t];if(n)return n;let s=_e(t);if(s!=="filter"&&s in e)return Jn[t]=s;s=An(s);for(let r=0;r<_r.length;r++){const i=_r[r]+s;if(i in e)return Jn[t]=i}return t}function uc(e,t,n,s){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&te(s)&&n===s}const yr="http://www.w3.org/1999/xlink";function br(e,t,n,s,r,i=so(t)){s&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(yr,t.slice(6,t.length)):e.setAttributeNS(yr,t,n):n==null||i&&!$r(n)?e.removeAttribute(t):e.setAttribute(t,i?"":Be(n)?String(n):n)}function vr(e,t,n,s,r){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Hi(n):n);return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const l=i==="OPTION"?e.getAttribute("value")||"":e.value,c=n==null?e.type==="checkbox"?"on":"":String(n);(l!==c||!("_value"in e))&&(e.value=c),n==null&&e.removeAttribute(t),e._value=n;return}let o=!1;if(n===""||n==null){const l=typeof e[t];l==="boolean"?n=$r(n):n==null&&l==="string"?(n="",o=!0):l==="number"&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(r||t)}function Ye(e,t,n,s){e.addEventListener(t,n,s)}function dc(e,t,n,s){e.removeEventListener(t,n,s)}const xr=Symbol("_vei");function hc(e,t,n,s,r=null){const i=e[xr]||(e[xr]={}),o=i[t];if(s&&o)o.value=s;else{const[l,c]=pc(t);if(s){const u=i[t]=_c(s,r);Ye(e,l,u,c)}else o&&(dc(e,l,o,c),i[t]=void 0)}}const wr=/(?:Once|Passive|Capture)$/;function pc(e){let t;if(wr.test(e)){t={};let s;for(;s=e.match(wr);)e=e.slice(0,e.length-s[0].length),t[s[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):ft(e.slice(2)),t]}let Yn=0;const gc=Promise.resolve(),mc=()=>Yn||(gc.then(()=>Yn=0),Yn=Date.now());function _c(e,t){const n=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=n.attached)return;Pe(yc(s,n.value),t,5,[s])};return n.value=e,n.attached=mc(),n}function yc(e,t){if(I(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(s=>r=>!r._stopped&&s&&s(r))}else return t}const Sr=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,bc=(e,t,n,s,r,i)=>{const o=r==="svg";t==="class"?ic(e,s,o):t==="style"?fc(e,n,s):Cn(t)?Tn(t)||hc(e,t,n,s,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):vc(e,t,s,o))?(vr(e,t,s),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&br(e,t,s,o,i,t!=="value")):e._isVueCE&&(xc(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!te(s)))?vr(e,_e(t),s,i,t):(t==="true-value"?e._trueValue=s:t==="false-value"&&(e._falseValue=s),br(e,t,s,o))};function vc(e,t,n,s){if(s)return!!(t==="innerHTML"||t==="textContent"||t in e&&Sr(t)&&H(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const r=e.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return Sr(t)&&te(n)?!1:t in e}function xc(e,t){const n=e._def.props;if(!n)return!1;const s=_e(t);return Array.isArray(n)?n.some(r=>_e(r)===s):Object.keys(n).some(r=>_e(r)===s)}const Ui=new WeakMap,Bi=new WeakMap,Sn=Symbol("_moveCb"),Cr=Symbol("_enterCb"),wc=e=>(delete e.props.mode,e),Sc=wc({name:"TransitionGroup",props:ie({},tc,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=Di(),s=qo();let r,i;return hi(()=>{if(!r.length)return;const o=e.moveClass||`${e.name||"v"}-move`;if(!Ac(r[0].el,n.vnode.el,o)){r=[];return}r.forEach(Cc),r.forEach(Tc);const l=r.filter(Ec);us(n.vnode.el),l.forEach(c=>{const u=c.el,a=u.style;Ne(u,o),a.transform=a.webkitTransform=a.transitionDuration="";const h=u[Sn]=p=>{p&&p.target!==u||(!p||p.propertyName.endsWith("transform"))&&(u.removeEventListener("transitionend",h),u[Sn]=null,rt(u,o))};u.addEventListener("transitionend",h)}),r=[]}),()=>{const o=k(e),l=nc(o);let c=o.tag||Ce;if(r=[],i)for(let u=0;u<i.length;u++){const a=i[u];a.el&&a.el instanceof Element&&(r.push(a),Zt(a,rs(a,l,s,n)),Ui.set(a,Ki(a.el)))}i=t.default?ui(t.default()):[];for(let u=0;u<i.length;u++){const a=i[u];a.key!=null&&Zt(a,rs(a,l,s,n))}return ye(c,null,i)}}}),Mf=Sc;function Cc(e){const t=e.el;t[Sn]&&t[Sn](),t[Cr]&&t[Cr]()}function Tc(e){Bi.set(e,Ki(e.el))}function Ec(e){const t=Ui.get(e),n=Bi.get(e),s=t.left-n.left,r=t.top-n.top;if(s||r){const i=e.el,o=i.style,l=i.getBoundingClientRect();let c=1,u=1;return i.offsetWidth&&(c=l.width/i.offsetWidth),i.offsetHeight&&(u=l.height/i.offsetHeight),(!Number.isFinite(c)||c===0)&&(c=1),(!Number.isFinite(u)||u===0)&&(u=1),Math.abs(c-1)<.01&&(c=1),Math.abs(u-1)<.01&&(u=1),o.transform=o.webkitTransform=`translate(${s/c}px,${r/u}px)`,o.transitionDuration="0s",e}}function Ki(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top}}function Ac(e,t,n){const s=e.cloneNode(),r=e[Pt];r&&r.forEach(l=>{l.split(/\s+/).forEach(c=>c&&s.classList.remove(c))}),n.split(/\s+/).forEach(l=>l&&s.classList.add(l)),s.style.display="none";const i=t.nodeType===1?t:t.parentNode;i.appendChild(s);const{hasTransform:o}=Vi(s);return i.removeChild(s),o}const ct=e=>{const t=e.props["onUpdate:modelValue"]||!1;return I(t)?n=>hn(t,n):t};function Mc(e){e.target.composing=!0}function Tr(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Ee=Symbol("_assign");function Er(e,t,n){return t&&(e=e.trim()),n&&(e=Mn(e)),e}const ds={created(e,{modifiers:{lazy:t,trim:n,number:s}},r){e[Ee]=ct(r);const i=s||r.props&&r.props.type==="number";Ye(e,t?"change":"input",o=>{o.target.composing||e[Ee](Er(e.value,n,i))}),(n||i)&&Ye(e,"change",()=>{e.value=Er(e.value,n,i)}),t||(Ye(e,"compositionstart",Mc),Ye(e,"compositionend",Tr),Ye(e,"change",Tr))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:s,trim:r,number:i}},o){if(e[Ee]=ct(o),e.composing)return;const l=(i||e.type==="number")&&!/^0\d/.test(e.value)?Mn(e.value):e.value,c=t??"";if(l===c)return;const u=e.getRootNode();(u instanceof Document||u instanceof ShadowRoot)&&u.activeElement===e&&e.type!=="range"&&(s&&t===n||r&&e.value.trim()===c)||(e.value=c)}},Oc={deep:!0,created(e,t,n){e[Ee]=ct(n),Ye(e,"change",()=>{const s=e._modelValue,r=Rt(e),i=e.checked,o=e[Ee];if(I(s)){const l=_s(s,r),c=l!==-1;if(i&&!c)o(s.concat(r));else if(!i&&c){const u=[...s];u.splice(l,1),o(u)}}else if(It(s)){const l=new Set(s);i?l.add(r):l.delete(r),o(l)}else o(ki(e,i))})},mounted:Ar,beforeUpdate(e,t,n){e[Ee]=ct(n),Ar(e,t,n)}};function Ar(e,{value:t,oldValue:n},s){e._modelValue=t;let r;if(I(t))r=_s(t,s.props.value)>-1;else if(It(t))r=t.has(s.props.value);else{if(t===n)return;r=lt(t,ki(e,!0))}e.checked!==r&&(e.checked=r)}const Pc={created(e,{value:t},n){e.checked=lt(t,n.props.value),e[Ee]=ct(n),Ye(e,"change",()=>{e[Ee](Rt(e))})},beforeUpdate(e,{value:t,oldValue:n},s){e[Ee]=ct(s),t!==n&&(e.checked=lt(t,s.props.value))}},Rc={deep:!0,created(e,{value:t,modifiers:{number:n}},s){const r=It(t);Ye(e,"change",()=>{const i=Array.prototype.filter.call(e.options,o=>o.selected).map(o=>n?Mn(Rt(o)):Rt(o));e[Ee](e.multiple?r?new Set(i):i:i[0]),e._assigning=!0,si(()=>{e._assigning=!1})}),e[Ee]=ct(s)},mounted(e,{value:t}){Mr(e,t)},beforeUpdate(e,t,n){e[Ee]=ct(n)},updated(e,{value:t}){e._assigning||Mr(e,t)}};function Mr(e,t){const n=e.multiple,s=I(t);if(!(n&&!s&&!It(t))){for(let r=0,i=e.options.length;r<i;r++){const o=e.options[r],l=Rt(o);if(n)if(s){const c=typeof l;c==="string"||c==="number"?o.selected=t.some(u=>String(u)===String(l)):o.selected=_s(t,l)>-1}else o.selected=t.has(l);else if(lt(Rt(o),t)){e.selectedIndex!==r&&(e.selectedIndex=r);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Rt(e){return"_value"in e?e._value:e.value}function ki(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const Ic={created(e,t,n){dn(e,t,n,null,"created")},mounted(e,t,n){dn(e,t,n,null,"mounted")},beforeUpdate(e,t,n,s){dn(e,t,n,s,"beforeUpdate")},updated(e,t,n,s){dn(e,t,n,s,"updated")}};function Fc(e,t){switch(e){case"SELECT":return Rc;case"TEXTAREA":return ds;default:switch(t){case"checkbox":return Oc;case"radio":return Pc;default:return ds}}}function dn(e,t,n,s,r){const o=Fc(e.tagName,n.props&&n.props.type)[r];o&&o(e,t,n,s)}const Lc=["ctrl","shift","alt","meta"],Dc={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>Lc.some(n=>e[`${n}Key`]&&!t.includes(n))},Nc=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),s=t.join(".");return n[s]||(n[s]=(r,...i)=>{for(let o=0;o<t.length;o++){const l=Dc[t[o]];if(l&&l(r,t))return}return e(r,...i)})},$c={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Of=(e,t)=>{const n=e._withKeys||(e._withKeys={}),s=t.join(".");return n[s]||(n[s]=r=>{if(!("key"in r))return;const i=ft(r.key);if(t.some(o=>o===i||$c[o]===i))return e(r)})},Hc=ie({patchProp:bc},ec);let Or;function jc(){return Or||(Or=Rl(Hc))}const Vc=(...e)=>{const t=jc().createApp(...e),{mount:n}=t;return t.mount=s=>{const r=Bc(s);if(!r)return;const i=t._component;!H(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const o=n(r,!1,Uc(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),o},t};function Uc(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Bc(e){return te(e)?document.querySelector(e):e}const Kc="modulepreload",kc=function(e){return"/"+e},Pr={},Wc=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=Promise.allSettled(n.map(c=>{if(c=kc(c),c in Pr)return;Pr[c]=!0;const u=c.endsWith(".css"),a=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${a}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":Kc,u||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),u)return new Promise((p,v)=>{h.addEventListener("load",p),h.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return r.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},ge=In({ready:!1,isolation:!1,user:null,adminOwnerUsername:""}),qc=()=>{var e;return ge.isolation&&((e=ge.user)==null?void 0:e.role)==="admin"},Pf=()=>{var e;return ge.isolation?`.user.${((e=ge.user)==null?void 0:e.username)||"anonymous"}`:""};function Gc(e,t="/",n=(s=>(s=globalThis.location)==null?void 0:s.origin)()||"http://localhost"){if(typeof e!="string"&&!(e instanceof URL))return e;const r=String(e);if(!r.startsWith("/")&&!/^https?:\/\//i.test(r))return e;const i=new URL(r,n);if(i.origin!==n||!/^\/(api(?:\/|$)|events(?:\/|$)|vendor(?:\/|$))/.test(i.pathname))return e;const o=`/${t.split("/").filter(Boolean).join("/")}`;return o==="/"?e:(i.pathname=o+i.pathname,`${i.pathname}${i.search}${i.hash}`)}const Jc=e=>Gc(Yc(e));function Yc(e){var s;if(!qc()||!ge.adminOwnerUsername||typeof e!="string"&&!(e instanceof URL))return e;const t=((s=globalThis.location)==null?void 0:s.origin)||"http://localhost",n=new URL(String(e),t);return n.origin!==t||!/^\/(api(?:\/|$)|events(?:\/|$))/.test(n.pathname)||/^\/api\/(auth|admin|login|memory|cpa-quota|cpa-config|prompt-config|plugins|tools)(?:\/|$)/.test(n.pathname)?e:(n.searchParams.set("ownerUsername",ge.adminOwnerUsername),`${n.pathname}${n.search}${n.hash}`)}const Rr=async(e,t)=>{var s;const n=await globalThis.fetch(Jc(e),t);return n.status===401&&!String(e).includes("/api/auth/")&&((s=globalThis.dispatchEvent)==null||s.call(globalThis,new Event("neo-auth-required"))),n},zc=(e,t)=>{const n=e.__vccOpts||e;for(const[s,r]of t)n[s]=r;return n},Xc={key:1,class:"auth-screen","aria-label":"用户登录"},Zc=["aria-busy"],Qc={class:"auth-fields"},ef={class:"icon-field"},tf=["aria-invalid","aria-describedby"],nf={class:"icon-field"},sf=["type","aria-invalid","aria-describedby"],rf=["aria-label","aria-pressed"],of={viewBox:"0 0 24 24","aria-hidden":"true"},lf={key:0,d:"m3 3 18 18"},cf={class:"auth-actions"},ff={class:"status-slot"},af={key:0,id:"auth-error",class:"auth-error",role:"alert"},uf={class:"sr-only"},df=["aria-label","disabled"],hf={key:0,class:"spinner","aria-hidden":"true"},pf={key:1,viewBox:"0 0 24 24","aria-hidden":"true"},gf={key:1,class:"connecting",role:"status","aria-label":"正在连接服务"},mf={key:1,class:"spinner","aria-hidden":"true"},_f={key:2,class:"sr-only",role:"alert"},yf={__name:"AuthGate",setup(e){const t=Xo(()=>Wc(()=>import("./App--pG9o2Yv.js"),__vite__mapDeps([0,1]))),n=ot(""),s=ot(""),r=ot(""),i=ot(!1),o=ot(!1);async function l(){r.value="";try{const h=await Rr("/api/auth/status",{cache:"no-store"});if(!h.ok)throw new Error("无法读取登录状态");const p=await h.json();if(typeof p.isolation!="boolean")throw new Error("登录状态无效");Object.assign(ge,p,{ready:!0})}catch(h){r.value=h.message}}async function c(){var h;if(!i.value){if(!n.value||!s.value){r.value="请输入用户名和密码",(h=document.getElementById(n.value?"auth-password":"auth-username"))==null||h.focus();return}i.value=!0,r.value="";try{const p=await Rr("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n.value,password:s.value})}),v=await p.json();if(!p.ok)throw new Error(v.error||"登录失败");s.value="",location.reload()}catch(p){r.value=p.message}finally{i.value=!1}}}const u=()=>{ge.user=null,s.value=""};let a;return Ms(async()=>{window.addEventListener("neo-auth-required",u),await l(),a=setInterval(()=>{ge.isolation&&ge.user&&l()},3e4)}),Os(()=>{clearInterval(a),window.removeEventListener("neo-auth-required",u)}),(h,p)=>{var v;return gt(ge).ready&&(!gt(ge).isolation||gt(ge).user)?(ve(),Ii(gt(t),{key:((v=gt(ge).user)==null?void 0:v.username)||"local"})):(ve(),Ae("main",Xc,[p[12]||(p[12]=B("div",{class:"motion-field","aria-hidden":"true"},[B("i",{class:"flow flow-a"}),B("i",{class:"flow flow-b"})],-1)),B("form",{class:Pn(["auth-card",{shaking:r.value}]),"aria-label":"用户登录","aria-busy":i.value,novalidate:"",onSubmit:Nc(c,["prevent"])},[gt(ge).ready?(ve(),Ae(Ce,{key:0},[B("div",Qc,[B("div",ef,[ks(B("input",{id:"auth-username","onUpdate:modelValue":p[0]||(p[0]=C=>n.value=C),"aria-label":"用户名",name:"username",autocomplete:"username",autocapitalize:"none",spellcheck:!1,maxlength:"100",enterkeyhint:"next",required:"","aria-invalid":!!r.value,"aria-describedby":r.value?"auth-error":void 0},null,8,tf),[[ds,n.value]]),p[3]||(p[3]=B("svg",{class:"field-icon",viewBox:"0 0 24 24","aria-hidden":"true"},[B("circle",{cx:"12",cy:"8",r:"3.5"}),B("path",{d:"M5 20c0-4 2.5-6 7-6s7 2 7 6"})],-1)),p[4]||(p[4]=B("i",{class:"field-line","aria-hidden":"true"},null,-1))]),B("div",nf,[ks(B("input",{id:"auth-password","onUpdate:modelValue":p[1]||(p[1]=C=>s.value=C),"aria-label":"密码",name:"password",type:o.value?"text":"password",autocomplete:"current-password",enterkeyhint:"go",required:"","aria-invalid":!!r.value,"aria-describedby":r.value?"auth-error":void 0},null,8,sf),[[Ic,s.value]]),p[7]||(p[7]=B("svg",{class:"field-icon",viewBox:"0 0 24 24","aria-hidden":"true"},[B("rect",{x:"5",y:"10",width:"14",height:"11",rx:"3"}),B("path",{d:"M8 10V7a4 4 0 0 1 8 0v3M12 14v3"})],-1)),p[8]||(p[8]=B("i",{class:"field-line","aria-hidden":"true"},null,-1)),B("button",{class:"password-toggle",type:"button","aria-label":o.value?"隐藏密码":"显示密码","aria-pressed":o.value,onClick:p[2]||(p[2]=C=>o.value=!o.value)},[(ve(),Ae("svg",of,[p[5]||(p[5]=B("path",{d:"M2 12s4-6 10-6 10 6 10 6-4 6-10 6-10-6-10-6Z"},null,-1)),p[6]||(p[6]=B("circle",{cx:"12",cy:"12",r:"3"},null,-1)),o.value?(ve(),Ae("path",lf)):qn("",!0)]))],8,rf)])]),B("div",cf,[B("div",ff,[r.value?(ve(),Ae("div",af,[p[9]||(p[9]=B("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},[B("circle",{cx:"12",cy:"12",r:"9"}),B("path",{d:"M12 7v6m0 3h.01"})],-1)),B("span",uf,zn(r.value),1)])):qn("",!0)]),B("button",{class:"submit-button",type:"submit","aria-label":i.value?"正在验证":"登录",disabled:i.value},[i.value?(ve(),Ae("i",hf)):(ve(),Ae("svg",pf,[...p[10]||(p[10]=[B("path",{d:"M5 12h14m-6-6 6 6-6 6"},null,-1)])]))],8,df)])],64)):(ve(),Ae("div",gf,[r.value?(ve(),Ae("button",{key:0,class:"retry-button",type:"button","aria-label":"重试",onClick:l},[...p[11]||(p[11]=[B("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},[B("path",{d:"M20 7v5h-5M20 12a8 8 0 1 0-2 6"})],-1)])])):(ve(),Ae("i",mf)),r.value?(ve(),Ae("span",_f,zn(r.value),1)):qn("",!0)]))],42,Zc)]))}}},bf=zc(yf,[["__scopeId","data-v-67ef8410"]]);Vc(bf).mount("#app");export{ms as A,Ii as B,qc as C,ge as D,Pf as E,Ce as F,Af as G,ye as H,Jc as I,$o as J,Mf as K,Ic as L,Oc as M,Pc as N,Cf as T,zc as _,ve as a,qn as b,Ae as c,Rr as d,Ef as e,B as f,ot as g,Sf as h,xf as i,zl as j,Ms as k,si as l,jl as m,Pn as n,Os as o,ks as p,ds as q,In as r,wf as s,zn as t,gt as u,Rc as v,Kn as w,Of as x,Nc as y,Tf as z};
|
|
18
|
+
**/let as;const cr=typeof window<"u"&&window.trustedTypes;if(cr)try{as=cr.createPolicy("vue",{createHTML:e=>e})}catch{}const Hi=as?e=>as.createHTML(e):e=>e,Zl="http://www.w3.org/2000/svg",Ql="http://www.w3.org/1998/Math/MathML",We=typeof document<"u"?document:null,fr=We&&We.createElement("template"),ec={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,s)=>{const r=t==="svg"?We.createElementNS(Zl,e):t==="mathml"?We.createElementNS(Ql,e):n?We.createElement(e,{is:n}):We.createElement(e);return e==="select"&&s&&s.multiple!=null&&r.setAttribute("multiple",s.multiple),r},createText:e=>We.createTextNode(e),createComment:e=>We.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>We.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,s,r,i){const o=n?n.previousSibling:t.lastChild;if(r&&(r===i||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===i||!(r=r.nextSibling)););else{fr.innerHTML=Hi(s==="svg"?`<svg>${e}</svg>`:s==="mathml"?`<math>${e}</math>`:e);const l=fr.content;if(s==="svg"||s==="mathml"){const c=l.firstChild;for(;c.firstChild;)l.appendChild(c.firstChild);l.removeChild(c)}t.insertBefore(l,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},tt="transition",Ht="animation",Pt=Symbol("_vtc"),ji={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},tc=ie({},Go,ji),pt=(e,t=[])=>{I(e)?e.forEach(n=>n(...t)):e&&e(...t)},ar=e=>e?I(e)?e.some(t=>t.length>1):e.length>1:!1;function nc(e){const t={};for(const A in e)A in ji||(t[A]=e[A]);if(e.css===!1)return t;const{name:n="v",type:s,duration:r,enterFromClass:i=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:l=`${n}-enter-to`,appearFromClass:c=i,appearActiveClass:u=o,appearToClass:a=l,leaveFromClass:h=`${n}-leave-from`,leaveActiveClass:p=`${n}-leave-active`,leaveToClass:v=`${n}-leave-to`}=e,C=sc(r),x=C&&C[0],N=C&&C[1],{onBeforeEnter:D,onEnter:M,onEnterCancelled:F,onLeave:O,onLeaveCancelled:V,onBeforeAppear:se=D,onAppear:j=M,onAppearCancelled:G=F}=t,P=(A,X,oe,Ke)=>{A._enterCancelled=Ke,rt(A,X?a:l),rt(A,X?u:o),oe&&oe()},K=(A,X)=>{A._isLeaving=!1,rt(A,h),rt(A,v),rt(A,p),X&&X()},J=A=>(X,oe)=>{const Ke=A?j:M,ce=()=>P(X,A,oe);pt(Ke,[X,ce]),ur(()=>{rt(X,A?c:i),Ne(X,A?a:l),ar(Ke)||dr(X,s,x,ce)})};return ie(t,{onBeforeEnter(A){pt(D,[A]),Ne(A,i),Ne(A,o)},onBeforeAppear(A){pt(se,[A]),Ne(A,c),Ne(A,u)},onEnter:J(!1),onAppear:J(!0),onLeave(A,X){A._isLeaving=!0;const oe=()=>K(A,X);Ne(A,h),A._enterCancelled?(Ne(A,p),us(A)):(us(A),Ne(A,p)),ur(()=>{A._isLeaving&&(rt(A,h),Ne(A,v),ar(O)||dr(A,s,N,oe))}),pt(O,[A,oe])},onEnterCancelled(A){P(A,!1,void 0,!0),pt(F,[A])},onAppearCancelled(A){P(A,!0,void 0,!0),pt(G,[A])},onLeaveCancelled(A){K(A),pt(V,[A])}})}function sc(e){if(e==null)return null;if(q(e))return[Gn(e.enter),Gn(e.leave)];{const t=Gn(e);return[t,t]}}function Gn(e){return Xi(e)}function Ne(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Pt]||(e[Pt]=new Set)).add(t)}function rt(e,t){t.split(/\s+/).forEach(s=>s&&e.classList.remove(s));const n=e[Pt];n&&(n.delete(t),n.size||(e[Pt]=void 0))}function ur(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let rc=0;function dr(e,t,n,s){const r=e._endId=++rc,i=()=>{r===e._endId&&s()};if(n!=null)return setTimeout(i,n);const{type:o,timeout:l,propCount:c}=Vi(e,t);if(!o)return s();const u=o+"end";let a=0;const h=()=>{e.removeEventListener(u,p),i()},p=v=>{v.target===e&&++a>=c&&h()};setTimeout(()=>{a<c&&h()},l+1),e.addEventListener(u,p)}function Vi(e,t){const n=window.getComputedStyle(e),s=C=>(n[C]||"").split(", "),r=s(`${tt}Delay`),i=s(`${tt}Duration`),o=hr(r,i),l=s(`${Ht}Delay`),c=s(`${Ht}Duration`),u=hr(l,c);let a=null,h=0,p=0;t===tt?o>0&&(a=tt,h=o,p=i.length):t===Ht?u>0&&(a=Ht,h=u,p=c.length):(h=Math.max(o,u),a=h>0?o>u?tt:Ht:null,p=a?a===tt?i.length:c.length:0);const v=a===tt&&/\b(?:transform|all)(?:,|$)/.test(s(`${tt}Property`).toString());return{type:a,timeout:h,propCount:p,hasTransform:v}}function hr(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,s)=>pr(n)+pr(e[s])))}function pr(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function us(e){return(e?e.ownerDocument:document).body.offsetHeight}function ic(e,t,n){const s=e[Pt];s&&(t=(t?[t,...s]:[...s]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const gr=Symbol("_vod"),oc=Symbol("_vsh"),lc=Symbol(""),cc=/(?:^|;)\s*display\s*:/;function fc(e,t,n){const s=e.style,r=te(n);let i=!1;if(n&&!r){if(t)if(te(t))for(const o of t.split(";")){const l=o.slice(0,o.indexOf(":")).trim();n[l]==null&&Ut(s,l,"")}else for(const o in t)n[o]==null&&Ut(s,o,"");for(const o in n){o==="display"&&(i=!0);const l=n[o];l!=null?uc(e,o,!te(t)&&t?t[o]:void 0,l)||Ut(s,o,l):Ut(s,o,"")}}else if(r){if(t!==n){const o=s[lc];o&&(n+=";"+o),s.cssText=n,i=cc.test(n)}}else t&&e.removeAttribute("style");gr in e&&(e[gr]=i?s.display:"",e[oc]&&(s.display="none"))}const mr=/\s*!important$/;function Ut(e,t,n){if(I(n))n.forEach(s=>Ut(e,t,s));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const s=ac(e,t);mr.test(n)?e.setProperty(ft(s),n.replace(mr,""),"important"):e[s]=n}}const _r=["Webkit","Moz","ms"],Jn={};function ac(e,t){const n=Jn[t];if(n)return n;let s=_e(t);if(s!=="filter"&&s in e)return Jn[t]=s;s=An(s);for(let r=0;r<_r.length;r++){const i=_r[r]+s;if(i in e)return Jn[t]=i}return t}function uc(e,t,n,s){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&te(s)&&n===s}const yr="http://www.w3.org/1999/xlink";function br(e,t,n,s,r,i=so(t)){s&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(yr,t.slice(6,t.length)):e.setAttributeNS(yr,t,n):n==null||i&&!$r(n)?e.removeAttribute(t):e.setAttribute(t,i?"":Be(n)?String(n):n)}function vr(e,t,n,s,r){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Hi(n):n);return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const l=i==="OPTION"?e.getAttribute("value")||"":e.value,c=n==null?e.type==="checkbox"?"on":"":String(n);(l!==c||!("_value"in e))&&(e.value=c),n==null&&e.removeAttribute(t),e._value=n;return}let o=!1;if(n===""||n==null){const l=typeof e[t];l==="boolean"?n=$r(n):n==null&&l==="string"?(n="",o=!0):l==="number"&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(r||t)}function Ye(e,t,n,s){e.addEventListener(t,n,s)}function dc(e,t,n,s){e.removeEventListener(t,n,s)}const xr=Symbol("_vei");function hc(e,t,n,s,r=null){const i=e[xr]||(e[xr]={}),o=i[t];if(s&&o)o.value=s;else{const[l,c]=pc(t);if(s){const u=i[t]=_c(s,r);Ye(e,l,u,c)}else o&&(dc(e,l,o,c),i[t]=void 0)}}const wr=/(?:Once|Passive|Capture)$/;function pc(e){let t;if(wr.test(e)){t={};let s;for(;s=e.match(wr);)e=e.slice(0,e.length-s[0].length),t[s[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):ft(e.slice(2)),t]}let Yn=0;const gc=Promise.resolve(),mc=()=>Yn||(gc.then(()=>Yn=0),Yn=Date.now());function _c(e,t){const n=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=n.attached)return;Pe(yc(s,n.value),t,5,[s])};return n.value=e,n.attached=mc(),n}function yc(e,t){if(I(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(s=>r=>!r._stopped&&s&&s(r))}else return t}const Sr=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,bc=(e,t,n,s,r,i)=>{const o=r==="svg";t==="class"?ic(e,s,o):t==="style"?fc(e,n,s):Cn(t)?Tn(t)||hc(e,t,n,s,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):vc(e,t,s,o))?(vr(e,t,s),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&br(e,t,s,o,i,t!=="value")):e._isVueCE&&(xc(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!te(s)))?vr(e,_e(t),s,i,t):(t==="true-value"?e._trueValue=s:t==="false-value"&&(e._falseValue=s),br(e,t,s,o))};function vc(e,t,n,s){if(s)return!!(t==="innerHTML"||t==="textContent"||t in e&&Sr(t)&&H(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const r=e.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return Sr(t)&&te(n)?!1:t in e}function xc(e,t){const n=e._def.props;if(!n)return!1;const s=_e(t);return Array.isArray(n)?n.some(r=>_e(r)===s):Object.keys(n).some(r=>_e(r)===s)}const Ui=new WeakMap,Bi=new WeakMap,Sn=Symbol("_moveCb"),Cr=Symbol("_enterCb"),wc=e=>(delete e.props.mode,e),Sc=wc({name:"TransitionGroup",props:ie({},tc,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=Di(),s=qo();let r,i;return hi(()=>{if(!r.length)return;const o=e.moveClass||`${e.name||"v"}-move`;if(!Ac(r[0].el,n.vnode.el,o)){r=[];return}r.forEach(Cc),r.forEach(Tc);const l=r.filter(Ec);us(n.vnode.el),l.forEach(c=>{const u=c.el,a=u.style;Ne(u,o),a.transform=a.webkitTransform=a.transitionDuration="";const h=u[Sn]=p=>{p&&p.target!==u||(!p||p.propertyName.endsWith("transform"))&&(u.removeEventListener("transitionend",h),u[Sn]=null,rt(u,o))};u.addEventListener("transitionend",h)}),r=[]}),()=>{const o=k(e),l=nc(o);let c=o.tag||Ce;if(r=[],i)for(let u=0;u<i.length;u++){const a=i[u];a.el&&a.el instanceof Element&&(r.push(a),Zt(a,rs(a,l,s,n)),Ui.set(a,Ki(a.el)))}i=t.default?ui(t.default()):[];for(let u=0;u<i.length;u++){const a=i[u];a.key!=null&&Zt(a,rs(a,l,s,n))}return ye(c,null,i)}}}),Mf=Sc;function Cc(e){const t=e.el;t[Sn]&&t[Sn](),t[Cr]&&t[Cr]()}function Tc(e){Bi.set(e,Ki(e.el))}function Ec(e){const t=Ui.get(e),n=Bi.get(e),s=t.left-n.left,r=t.top-n.top;if(s||r){const i=e.el,o=i.style,l=i.getBoundingClientRect();let c=1,u=1;return i.offsetWidth&&(c=l.width/i.offsetWidth),i.offsetHeight&&(u=l.height/i.offsetHeight),(!Number.isFinite(c)||c===0)&&(c=1),(!Number.isFinite(u)||u===0)&&(u=1),Math.abs(c-1)<.01&&(c=1),Math.abs(u-1)<.01&&(u=1),o.transform=o.webkitTransform=`translate(${s/c}px,${r/u}px)`,o.transitionDuration="0s",e}}function Ki(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top}}function Ac(e,t,n){const s=e.cloneNode(),r=e[Pt];r&&r.forEach(l=>{l.split(/\s+/).forEach(c=>c&&s.classList.remove(c))}),n.split(/\s+/).forEach(l=>l&&s.classList.add(l)),s.style.display="none";const i=t.nodeType===1?t:t.parentNode;i.appendChild(s);const{hasTransform:o}=Vi(s);return i.removeChild(s),o}const ct=e=>{const t=e.props["onUpdate:modelValue"]||!1;return I(t)?n=>hn(t,n):t};function Mc(e){e.target.composing=!0}function Tr(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Ee=Symbol("_assign");function Er(e,t,n){return t&&(e=e.trim()),n&&(e=Mn(e)),e}const ds={created(e,{modifiers:{lazy:t,trim:n,number:s}},r){e[Ee]=ct(r);const i=s||r.props&&r.props.type==="number";Ye(e,t?"change":"input",o=>{o.target.composing||e[Ee](Er(e.value,n,i))}),(n||i)&&Ye(e,"change",()=>{e.value=Er(e.value,n,i)}),t||(Ye(e,"compositionstart",Mc),Ye(e,"compositionend",Tr),Ye(e,"change",Tr))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:s,trim:r,number:i}},o){if(e[Ee]=ct(o),e.composing)return;const l=(i||e.type==="number")&&!/^0\d/.test(e.value)?Mn(e.value):e.value,c=t??"";if(l===c)return;const u=e.getRootNode();(u instanceof Document||u instanceof ShadowRoot)&&u.activeElement===e&&e.type!=="range"&&(s&&t===n||r&&e.value.trim()===c)||(e.value=c)}},Oc={deep:!0,created(e,t,n){e[Ee]=ct(n),Ye(e,"change",()=>{const s=e._modelValue,r=Rt(e),i=e.checked,o=e[Ee];if(I(s)){const l=_s(s,r),c=l!==-1;if(i&&!c)o(s.concat(r));else if(!i&&c){const u=[...s];u.splice(l,1),o(u)}}else if(It(s)){const l=new Set(s);i?l.add(r):l.delete(r),o(l)}else o(ki(e,i))})},mounted:Ar,beforeUpdate(e,t,n){e[Ee]=ct(n),Ar(e,t,n)}};function Ar(e,{value:t,oldValue:n},s){e._modelValue=t;let r;if(I(t))r=_s(t,s.props.value)>-1;else if(It(t))r=t.has(s.props.value);else{if(t===n)return;r=lt(t,ki(e,!0))}e.checked!==r&&(e.checked=r)}const Pc={created(e,{value:t},n){e.checked=lt(t,n.props.value),e[Ee]=ct(n),Ye(e,"change",()=>{e[Ee](Rt(e))})},beforeUpdate(e,{value:t,oldValue:n},s){e[Ee]=ct(s),t!==n&&(e.checked=lt(t,s.props.value))}},Rc={deep:!0,created(e,{value:t,modifiers:{number:n}},s){const r=It(t);Ye(e,"change",()=>{const i=Array.prototype.filter.call(e.options,o=>o.selected).map(o=>n?Mn(Rt(o)):Rt(o));e[Ee](e.multiple?r?new Set(i):i:i[0]),e._assigning=!0,si(()=>{e._assigning=!1})}),e[Ee]=ct(s)},mounted(e,{value:t}){Mr(e,t)},beforeUpdate(e,t,n){e[Ee]=ct(n)},updated(e,{value:t}){e._assigning||Mr(e,t)}};function Mr(e,t){const n=e.multiple,s=I(t);if(!(n&&!s&&!It(t))){for(let r=0,i=e.options.length;r<i;r++){const o=e.options[r],l=Rt(o);if(n)if(s){const c=typeof l;c==="string"||c==="number"?o.selected=t.some(u=>String(u)===String(l)):o.selected=_s(t,l)>-1}else o.selected=t.has(l);else if(lt(Rt(o),t)){e.selectedIndex!==r&&(e.selectedIndex=r);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Rt(e){return"_value"in e?e._value:e.value}function ki(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const Ic={created(e,t,n){dn(e,t,n,null,"created")},mounted(e,t,n){dn(e,t,n,null,"mounted")},beforeUpdate(e,t,n,s){dn(e,t,n,s,"beforeUpdate")},updated(e,t,n,s){dn(e,t,n,s,"updated")}};function Fc(e,t){switch(e){case"SELECT":return Rc;case"TEXTAREA":return ds;default:switch(t){case"checkbox":return Oc;case"radio":return Pc;default:return ds}}}function dn(e,t,n,s,r){const o=Fc(e.tagName,n.props&&n.props.type)[r];o&&o(e,t,n,s)}const Lc=["ctrl","shift","alt","meta"],Dc={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>Lc.some(n=>e[`${n}Key`]&&!t.includes(n))},Nc=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),s=t.join(".");return n[s]||(n[s]=(r,...i)=>{for(let o=0;o<t.length;o++){const l=Dc[t[o]];if(l&&l(r,t))return}return e(r,...i)})},$c={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Of=(e,t)=>{const n=e._withKeys||(e._withKeys={}),s=t.join(".");return n[s]||(n[s]=r=>{if(!("key"in r))return;const i=ft(r.key);if(t.some(o=>o===i||$c[o]===i))return e(r)})},Hc=ie({patchProp:bc},ec);let Or;function jc(){return Or||(Or=Rl(Hc))}const Vc=(...e)=>{const t=jc().createApp(...e),{mount:n}=t;return t.mount=s=>{const r=Bc(s);if(!r)return;const i=t._component;!H(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const o=n(r,!1,Uc(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),o},t};function Uc(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Bc(e){return te(e)?document.querySelector(e):e}const Kc="modulepreload",kc=function(e){return"/"+e},Pr={},Wc=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));r=Promise.allSettled(n.map(c=>{if(c=kc(c),c in Pr)return;Pr[c]=!0;const u=c.endsWith(".css"),a=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${a}`))return;const h=document.createElement("link");if(h.rel=u?"stylesheet":Kc,u||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),u)return new Promise((p,v)=>{h.addEventListener("load",p),h.addEventListener("error",()=>v(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return r.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},ge=In({ready:!1,isolation:!1,user:null,adminOwnerUsername:""}),qc=()=>{var e;return ge.isolation&&((e=ge.user)==null?void 0:e.role)==="admin"},Pf=()=>{var e;return ge.isolation?`.user.${((e=ge.user)==null?void 0:e.username)||"anonymous"}`:""};function Gc(e,t="/",n=(s=>(s=globalThis.location)==null?void 0:s.origin)()||"http://localhost"){if(typeof e!="string"&&!(e instanceof URL))return e;const r=String(e);if(!r.startsWith("/")&&!/^https?:\/\//i.test(r))return e;const i=new URL(r,n);if(i.origin!==n||!/^\/(api(?:\/|$)|events(?:\/|$)|vendor(?:\/|$))/.test(i.pathname))return e;const o=`/${t.split("/").filter(Boolean).join("/")}`;return o==="/"?e:(i.pathname=o+i.pathname,`${i.pathname}${i.search}${i.hash}`)}const Jc=e=>Gc(Yc(e));function Yc(e){var s;if(!qc()||!ge.adminOwnerUsername||typeof e!="string"&&!(e instanceof URL))return e;const t=((s=globalThis.location)==null?void 0:s.origin)||"http://localhost",n=new URL(String(e),t);return n.origin!==t||!/^\/(api(?:\/|$)|events(?:\/|$))/.test(n.pathname)||/^\/api\/(auth|admin|login|memory|cpa-quota|cpa-config|prompt-config|plugins|tools)(?:\/|$)/.test(n.pathname)?e:(n.searchParams.set("ownerUsername",ge.adminOwnerUsername),`${n.pathname}${n.search}${n.hash}`)}const Rr=async(e,t)=>{var s;const n=await globalThis.fetch(Jc(e),t);return n.status===401&&!String(e).includes("/api/auth/")&&((s=globalThis.dispatchEvent)==null||s.call(globalThis,new Event("neo-auth-required"))),n},zc=(e,t)=>{const n=e.__vccOpts||e;for(const[s,r]of t)n[s]=r;return n},Xc={key:1,class:"auth-screen","aria-label":"用户登录"},Zc=["aria-busy"],Qc={class:"auth-fields"},ef={class:"icon-field"},tf=["aria-invalid","aria-describedby"],nf={class:"icon-field"},sf=["type","aria-invalid","aria-describedby"],rf=["aria-label","aria-pressed"],of={viewBox:"0 0 24 24","aria-hidden":"true"},lf={key:0,d:"m3 3 18 18"},cf={class:"auth-actions"},ff={class:"status-slot"},af={key:0,id:"auth-error",class:"auth-error",role:"alert"},uf={class:"sr-only"},df=["aria-label","disabled"],hf={key:0,class:"spinner","aria-hidden":"true"},pf={key:1,viewBox:"0 0 24 24","aria-hidden":"true"},gf={key:1,class:"connecting",role:"status","aria-label":"正在连接服务"},mf={key:1,class:"spinner","aria-hidden":"true"},_f={key:2,class:"sr-only",role:"alert"},yf={__name:"AuthGate",setup(e){const t=Xo(()=>Wc(()=>import("./App-Bn6HVDCw.js"),__vite__mapDeps([0,1]))),n=ot(""),s=ot(""),r=ot(""),i=ot(!1),o=ot(!1);async function l(){r.value="";try{const h=await Rr("/api/auth/status",{cache:"no-store"});if(!h.ok)throw new Error("无法读取登录状态");const p=await h.json();if(typeof p.isolation!="boolean")throw new Error("登录状态无效");Object.assign(ge,p,{ready:!0})}catch(h){r.value=h.message}}async function c(){var h;if(!i.value){if(!n.value||!s.value){r.value="请输入用户名和密码",(h=document.getElementById(n.value?"auth-password":"auth-username"))==null||h.focus();return}i.value=!0,r.value="";try{const p=await Rr("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:n.value,password:s.value})}),v=await p.json();if(!p.ok)throw new Error(v.error||"登录失败");s.value="",location.reload()}catch(p){r.value=p.message}finally{i.value=!1}}}const u=()=>{ge.user=null,s.value=""};let a;return Ms(async()=>{window.addEventListener("neo-auth-required",u),await l(),a=setInterval(()=>{ge.isolation&&ge.user&&l()},3e4)}),Os(()=>{clearInterval(a),window.removeEventListener("neo-auth-required",u)}),(h,p)=>{var v;return gt(ge).ready&&(!gt(ge).isolation||gt(ge).user)?(ve(),Ii(gt(t),{key:((v=gt(ge).user)==null?void 0:v.username)||"local"})):(ve(),Ae("main",Xc,[p[12]||(p[12]=B("div",{class:"motion-field","aria-hidden":"true"},[B("i",{class:"flow flow-a"}),B("i",{class:"flow flow-b"})],-1)),B("form",{class:Pn(["auth-card",{shaking:r.value}]),"aria-label":"用户登录","aria-busy":i.value,novalidate:"",onSubmit:Nc(c,["prevent"])},[gt(ge).ready?(ve(),Ae(Ce,{key:0},[B("div",Qc,[B("div",ef,[ks(B("input",{id:"auth-username","onUpdate:modelValue":p[0]||(p[0]=C=>n.value=C),"aria-label":"用户名",name:"username",autocomplete:"username",autocapitalize:"none",spellcheck:!1,maxlength:"100",enterkeyhint:"next",required:"","aria-invalid":!!r.value,"aria-describedby":r.value?"auth-error":void 0},null,8,tf),[[ds,n.value]]),p[3]||(p[3]=B("svg",{class:"field-icon",viewBox:"0 0 24 24","aria-hidden":"true"},[B("circle",{cx:"12",cy:"8",r:"3.5"}),B("path",{d:"M5 20c0-4 2.5-6 7-6s7 2 7 6"})],-1)),p[4]||(p[4]=B("i",{class:"field-line","aria-hidden":"true"},null,-1))]),B("div",nf,[ks(B("input",{id:"auth-password","onUpdate:modelValue":p[1]||(p[1]=C=>s.value=C),"aria-label":"密码",name:"password",type:o.value?"text":"password",autocomplete:"current-password",enterkeyhint:"go",required:"","aria-invalid":!!r.value,"aria-describedby":r.value?"auth-error":void 0},null,8,sf),[[Ic,s.value]]),p[7]||(p[7]=B("svg",{class:"field-icon",viewBox:"0 0 24 24","aria-hidden":"true"},[B("rect",{x:"5",y:"10",width:"14",height:"11",rx:"3"}),B("path",{d:"M8 10V7a4 4 0 0 1 8 0v3M12 14v3"})],-1)),p[8]||(p[8]=B("i",{class:"field-line","aria-hidden":"true"},null,-1)),B("button",{class:"password-toggle",type:"button","aria-label":o.value?"隐藏密码":"显示密码","aria-pressed":o.value,onClick:p[2]||(p[2]=C=>o.value=!o.value)},[(ve(),Ae("svg",of,[p[5]||(p[5]=B("path",{d:"M2 12s4-6 10-6 10 6 10 6-4 6-10 6-10-6-10-6Z"},null,-1)),p[6]||(p[6]=B("circle",{cx:"12",cy:"12",r:"3"},null,-1)),o.value?(ve(),Ae("path",lf)):qn("",!0)]))],8,rf)])]),B("div",cf,[B("div",ff,[r.value?(ve(),Ae("div",af,[p[9]||(p[9]=B("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},[B("circle",{cx:"12",cy:"12",r:"9"}),B("path",{d:"M12 7v6m0 3h.01"})],-1)),B("span",uf,zn(r.value),1)])):qn("",!0)]),B("button",{class:"submit-button",type:"submit","aria-label":i.value?"正在验证":"登录",disabled:i.value},[i.value?(ve(),Ae("i",hf)):(ve(),Ae("svg",pf,[...p[10]||(p[10]=[B("path",{d:"M5 12h14m-6-6 6 6-6 6"},null,-1)])]))],8,df)])],64)):(ve(),Ae("div",gf,[r.value?(ve(),Ae("button",{key:0,class:"retry-button",type:"button","aria-label":"重试",onClick:l},[...p[11]||(p[11]=[B("svg",{viewBox:"0 0 24 24","aria-hidden":"true"},[B("path",{d:"M20 7v5h-5M20 12a8 8 0 1 0-2 6"})],-1)])])):(ve(),Ae("i",mf)),r.value?(ve(),Ae("span",_f,zn(r.value),1)):qn("",!0)]))],42,Zc)]))}}},bf=zc(yf,[["__scopeId","data-v-67ef8410"]]);Vc(bf).mount("#app");export{ms as A,Ii as B,qc as C,ge as D,Pf as E,Ce as F,Af as G,ye as H,Jc as I,$o as J,Mf as K,Ic as L,Oc as M,Pc as N,Cf as T,zc as _,ve as a,qn as b,Ae as c,Rr as d,Ef as e,B as f,ot as g,Sf as h,xf as i,zl as j,Ms as k,si as l,jl as m,Pn as n,Os as o,ks as p,ds as q,In as r,wf as s,zn as t,gt as u,Rc as v,Kn as w,Of as x,Nc as y,Tf as z};
|
package/dist/index.html
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
})()
|
|
20
20
|
</script>
|
|
21
21
|
<title>neo runtime</title>
|
|
22
|
-
<script type="module" crossorigin src="/assets/index-
|
|
22
|
+
<script type="module" crossorigin src="/assets/index-BkoW_zgA.js"></script>
|
|
23
23
|
<link rel="stylesheet" crossorigin href="/assets/index-Dgfhk2Ym.css">
|
|
24
24
|
</head>
|
|
25
25
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neoctl-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "Neo browser workspace with an embedded agent runtime.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -11,15 +11,14 @@
|
|
|
11
11
|
"dev": "node scripts/dev.mjs --core local",
|
|
12
12
|
"dev:package": "node scripts/dev.mjs --core package",
|
|
13
13
|
"dev:ui": "vite",
|
|
14
|
-
"test:xhs": "node --test artifacts.test.mjs",
|
|
15
|
-
"test:runtime": "node --test runtime-router-cleanup.test.mjs runtime-workspaces.test.mjs",
|
|
16
|
-
"test:isolation": "npm --prefix ../engine run build && node --test isolation.test.mjs isolation-startup.test.mjs",
|
|
17
|
-
"test:plugins": "npm --prefix ../engine run build && node --test plugins.test.mjs plugin-settings.test.mjs tool-settings.test.mjs",
|
|
18
|
-
"test:monitoring": "node --test cpa-quota.test.mjs memory-monitor.test.mjs",
|
|
19
|
-
"test:
|
|
20
|
-
"test:image-create-browser": "npm run build && node image-create-browser.test.mjs",
|
|
14
|
+
"test:xhs": "node --test tests/artifacts.test.mjs",
|
|
15
|
+
"test:runtime": "node --test tests/runtime-router-cleanup.test.mjs tests/runtime-workspaces.test.mjs",
|
|
16
|
+
"test:isolation": "npm --prefix ../engine run build && node --test tests/isolation.test.mjs tests/isolation-startup.test.mjs",
|
|
17
|
+
"test:plugins": "npm --prefix ../engine run build && node --test tests/plugins.test.mjs tests/plugin-settings.test.mjs tests/tool-settings.test.mjs",
|
|
18
|
+
"test:monitoring": "node --test tests/cpa-quota.test.mjs tests/memory-monitor.test.mjs",
|
|
19
|
+
"test:image-create-browser": "npm run build && node tests/image-create-browser.test.mjs",
|
|
21
20
|
"build": "vite build",
|
|
22
|
-
"test:cli": "node --test neow.test.mjs",
|
|
21
|
+
"test:cli": "node --test tests/neow.test.mjs",
|
|
23
22
|
"prestart": "npm run build",
|
|
24
23
|
"start": "node server.mjs",
|
|
25
24
|
"preview": "vite preview",
|
|
@@ -27,13 +26,17 @@
|
|
|
27
26
|
"neo:web": "neo -web",
|
|
28
27
|
"neo:login": "neo -login",
|
|
29
28
|
"neo:help": "neo -help",
|
|
30
|
-
"prepack": "npm run build && npm run test:cli"
|
|
29
|
+
"prepack": "npm run build && npm run test:cli",
|
|
30
|
+
"test": "node tests/run-unit-tests.mjs",
|
|
31
|
+
"test:unit": "node tests/run-unit-tests.mjs",
|
|
32
|
+
"test:observability": "node tests/run-observability-checks.mjs",
|
|
33
|
+
"test:server": "node --test tests/server-startup.test.mjs"
|
|
31
34
|
},
|
|
32
35
|
"dependencies": {
|
|
33
36
|
"@tanstack/vue-virtual": "^3.13.36",
|
|
34
37
|
"highlight.js": "^11.11.1",
|
|
35
38
|
"marked": "^18.0.3",
|
|
36
|
-
"neoctl": "
|
|
39
|
+
"neoctl": "0.2.42",
|
|
37
40
|
"streaming-markdown": "^0.2.15",
|
|
38
41
|
"vue": "^3.5.13"
|
|
39
42
|
},
|
|
@@ -49,8 +52,6 @@
|
|
|
49
52
|
"dist",
|
|
50
53
|
"plugins",
|
|
51
54
|
"server.mjs",
|
|
52
|
-
"control-sync.mjs",
|
|
53
|
-
"control-protocol.mjs",
|
|
54
55
|
"core-runtime.mjs",
|
|
55
56
|
"execution-backend.mjs",
|
|
56
57
|
"isolation.mjs",
|
|
@@ -49,7 +49,7 @@ $env:NEO_VIDEO_SHARE_PUBLIC_ORIGIN = 'https://videos.example.com'
|
|
|
49
49
|
|
|
50
50
|
```powershell
|
|
51
51
|
cd C:\Users\qyq\Desktop\work\neoctl\web\plugins\video-share
|
|
52
|
-
node --test video-share.test.mjs
|
|
52
|
+
node --test ../../tests/plugins/video-share/video-share.test.mjs
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
测试使用带容器头的合成字节验证 HTTP、Range、HEAD、零复制、移动/删除失效、原文件更新、持久性、撤销安全、旧版边界、输入校验、转义、并发和独立进程恢复;它不是浏览器真实视频解码测试。
|
package/server.mjs
CHANGED
|
@@ -4,15 +4,6 @@ import fs from 'node:fs';
|
|
|
4
4
|
import fsp from 'node:fs/promises';
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
|
-
// Consume the private launcher secret before importing application/runtime modules.
|
|
8
|
-
// Imports can initialize plugins or spawn children; none may inherit this value.
|
|
9
|
-
let desktopControlConfig;
|
|
10
|
-
{
|
|
11
|
-
const raw = process.env.NEO_DESKTOP_CONTROL_CONFIG;
|
|
12
|
-
delete process.env.NEO_DESKTOP_CONTROL_CONFIG;
|
|
13
|
-
try { desktopControlConfig = raw ? JSON.parse(raw) : undefined; } catch {}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
7
|
const { containerMode, workspaceFs, deliverUpload, verifyExecutionBackend } = await import('./execution-backend.mjs');
|
|
17
8
|
await verifyExecutionBackend();
|
|
18
9
|
const { coreRuntimeInfo, createWebRuntime, loadNeoPlugins, runWebServer } = await import('./core-runtime.mjs');
|
|
@@ -24,12 +15,6 @@ const { installRuntimeRouterIdleCleanup } = await import('./runtime-router-clean
|
|
|
24
15
|
const { createCpaQuotaMonitor } = await import('./cpa-quota.mjs');
|
|
25
16
|
const { createMemoryMonitor } = await import('./memory-monitor.mjs');
|
|
26
17
|
const { resolveWebStorage } = await import('./platform-paths.mjs');
|
|
27
|
-
const { createControlSync, createLoginApplier, validateControlConfig } = await import('./control-sync.mjs');
|
|
28
|
-
|
|
29
|
-
const controlConfig = validateControlConfig(desktopControlConfig);
|
|
30
|
-
desktopControlConfig = undefined;
|
|
31
|
-
const controlEnabled = Boolean(controlConfig);
|
|
32
|
-
|
|
33
18
|
installRuntimeRouterIdleCleanup();
|
|
34
19
|
console.log(`neo core: ${coreRuntimeInfo.source} ${coreRuntimeInfo.version} (${coreRuntimeInfo.location})`);
|
|
35
20
|
process.env.NEO_CORE_VERSION = coreRuntimeInfo.version;
|
|
@@ -72,17 +57,6 @@ const memoryMonitor = createMemoryMonitor({
|
|
|
72
57
|
maxPersistedSamples: process.env.NEO_MEMORY_MAX_PERSISTED_SAMPLES,
|
|
73
58
|
maxPersistedBytes: process.env.NEO_MEMORY_MAX_PERSISTED_BYTES,
|
|
74
59
|
});
|
|
75
|
-
// Weak references do not defeat the existing router's idle-session cleanup.
|
|
76
|
-
const controlRepls = new Set();
|
|
77
|
-
function activeControlRepls() {
|
|
78
|
-
const active = [];
|
|
79
|
-
for (const reference of controlRepls) {
|
|
80
|
-
const repl = reference.deref();
|
|
81
|
-
if (repl) active.push(repl);
|
|
82
|
-
else controlRepls.delete(reference);
|
|
83
|
-
}
|
|
84
|
-
return active;
|
|
85
|
-
}
|
|
86
60
|
const workspaceRuntime = createWorkspaceRuntimeManager({
|
|
87
61
|
projectRoot: process.cwd(),
|
|
88
62
|
workspaceRoot,
|
|
@@ -101,7 +75,6 @@ const workspaceRuntime = createWorkspaceRuntimeManager({
|
|
|
101
75
|
|
|
102
76
|
const { createIsolationMode } = await import('./isolation.mjs');
|
|
103
77
|
const isolation = await createIsolationMode({ dataRoot, workspaceRoot, pluginDir, pluginSettings, toolSettings, cpaQuotaMonitor, memoryState: () => memoryMonitor.getPublicState() });
|
|
104
|
-
if (isolation.enabled && controlEnabled) throw new Error('Isolation mode cannot use desktop control sync');
|
|
105
78
|
|
|
106
79
|
const DEFAULT_APP_PROMPT_LIBRARY = [];
|
|
107
80
|
|
|
@@ -142,26 +115,12 @@ await new Promise((resolve, reject) => {
|
|
|
142
115
|
});
|
|
143
116
|
});
|
|
144
117
|
|
|
145
|
-
// Optional Desktop-only background work starts after HTTP listen and never delays UI.
|
|
146
|
-
if (controlEnabled) {
|
|
147
|
-
const controlSync = createControlSync({
|
|
148
|
-
config: controlConfig,
|
|
149
|
-
dataDir: dataRoot,
|
|
150
|
-
applyProfile: embedRuntime ? createLoginApplier({ runtimeUrl: runtimeTarget, getActiveRepls: activeControlRepls }) : undefined,
|
|
151
|
-
}).start();
|
|
152
|
-
server.once('close', () => { void controlSync.stop(); });
|
|
153
|
-
}
|
|
154
|
-
|
|
155
118
|
async function startEmbeddedRuntime() {
|
|
156
119
|
const runtimeHost = runtimeTarget.hostname || '127.0.0.1';
|
|
157
120
|
const runtimePort = runtimeTarget.port || '3101';
|
|
158
121
|
await runWebServer(['--host', runtimeHost, '--port', runtimePort], {
|
|
159
122
|
createRuntime: workspaceRuntime.createRuntime,
|
|
160
|
-
createRepl
|
|
161
|
-
const repl = workspaceRuntime.createRepl(runtime);
|
|
162
|
-
if (controlEnabled) controlRepls.add(new WeakRef(repl));
|
|
163
|
-
return repl;
|
|
164
|
-
},
|
|
123
|
+
createRepl: workspaceRuntime.createRepl,
|
|
165
124
|
});
|
|
166
125
|
}
|
|
167
126
|
|
package/control-protocol.mjs
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// Browser + Node >=20 native Web Crypto; no Node-only imports.
|
|
2
|
-
const encoder = new TextEncoder();
|
|
3
|
-
const decoder = new TextDecoder('utf-8', { fatal: true });
|
|
4
|
-
const directions = new Set(['up', 'down']);
|
|
5
|
-
export function decodeBase64(value) {
|
|
6
|
-
if (typeof value !== 'string' || value.length % 4 !== 0 || !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(value)) throw new Error('Invalid base64');
|
|
7
|
-
const binary = atob(value);
|
|
8
|
-
const bytes = Uint8Array.from(binary, c => c.charCodeAt(0));
|
|
9
|
-
if (encodeBase64(bytes) !== value) throw new Error('Invalid base64');
|
|
10
|
-
return bytes;
|
|
11
|
-
}
|
|
12
|
-
export function encodeBase64(bytes) {
|
|
13
|
-
let binary = '';
|
|
14
|
-
for (let i = 0; i < bytes.length; i += 8192) binary += String.fromCharCode(...bytes.subarray(i, i + 8192));
|
|
15
|
-
return btoa(binary);
|
|
16
|
-
}
|
|
17
|
-
function aad(deviceId, direction) {
|
|
18
|
-
if (typeof deviceId !== 'string' || !/^[A-Za-z0-9_-]{1,128}$/.test(deviceId) || !directions.has(direction)) throw new Error('Invalid context');
|
|
19
|
-
return encoder.encode(JSON.stringify([deviceId, direction]));
|
|
20
|
-
}
|
|
21
|
-
async function importKey(keyBase64, usage) {
|
|
22
|
-
const bytes = decodeBase64(keyBase64);
|
|
23
|
-
if (bytes.byteLength !== 32) throw new Error('Key must be 32 bytes');
|
|
24
|
-
return crypto.subtle.importKey('raw', bytes, 'AES-GCM', false, [usage]);
|
|
25
|
-
}
|
|
26
|
-
export async function seal(keyBase64, deviceId, direction, payload) {
|
|
27
|
-
const additionalData = aad(deviceId, direction);
|
|
28
|
-
const key = await importKey(keyBase64, 'encrypt');
|
|
29
|
-
const nonce = crypto.getRandomValues(new Uint8Array(12));
|
|
30
|
-
const plaintext = JSON.stringify(payload);
|
|
31
|
-
if (plaintext === undefined) throw new Error('Payload must be JSON');
|
|
32
|
-
const encrypted = await crypto.subtle.encrypt({ name: 'AES-GCM', iv: nonce, additionalData, tagLength: 128 }, key, encoder.encode(plaintext));
|
|
33
|
-
return { v: 1, nonce: encodeBase64(nonce), ciphertext: encodeBase64(new Uint8Array(encrypted)) };
|
|
34
|
-
}
|
|
35
|
-
export async function open(keyBase64, deviceId, direction, envelope) {
|
|
36
|
-
const additionalData = aad(deviceId, direction);
|
|
37
|
-
if (!envelope || envelope.v !== 1) throw new Error('Invalid envelope');
|
|
38
|
-
const nonce = decodeBase64(envelope.nonce);
|
|
39
|
-
const ciphertext = decodeBase64(envelope.ciphertext);
|
|
40
|
-
if (nonce.length !== 12 || ciphertext.length < 16) throw new Error('Invalid envelope');
|
|
41
|
-
const key = await importKey(keyBase64, 'decrypt');
|
|
42
|
-
const plaintext = await crypto.subtle.decrypt({ name: 'AES-GCM', iv: nonce, additionalData, tagLength: 128 }, key, ciphertext);
|
|
43
|
-
return JSON.parse(decoder.decode(plaintext));
|
|
44
|
-
}
|