small-package/luci-app-quickstart/root/www/luci-static/quickstart/index.js

4 lines
335 KiB
JavaScript
Raw Normal View History

2023-02-03 17:09:06 +08:00
var _a=Object.defineProperty,ha=Object.defineProperties;var xa=Object.getOwnPropertyDescriptors;var qe=Object.getOwnPropertySymbols;var ka=Object.prototype.hasOwnProperty,wa=Object.prototype.propertyIsEnumerable;var we=(e,a,o)=>a in e?_a(e,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[a]=o,X=(e,a)=>{for(var o in a||(a={}))ka.call(a,o)&&we(e,o,a[o]);if(qe)for(var o of qe(a))wa.call(a,o)&&we(e,o,a[o]);return e},nt=(e,a)=>ha(e,xa(a));var ya=(e,a)=>()=>(a||e((a={exports:{}}).exports,a),a.exports);var Kt=(e,a,o)=>(we(e,typeof a!="symbol"?a+"":a,o),o);var A=(e,a,o)=>new Promise((n,s)=>{var m=u=>{try{f(o.next(u))}catch(c){s(c)}},v=u=>{try{f(o.throw(u))}catch(c){s(c)}},f=u=>u.done?n(u.value):Promise.resolve(u.value).then(m,v);f((o=o.apply(e,a)).next())});import{d as te,a as T,c as H,u as y,o as i,b as r,e as t,t as k,n as Gt,f as $,r as ut,g as z,h as ct,i as It,j as M,w as q,k as Lt,l as Fa,m as F,p as At,q as Wt,s as Ca,v as Ea,x as $a,y as Da,z as Ba,A as Ya,B as Aa,C as it,T as xt,D as O,E as N,F as tt,G as L,H as P,I as Q,J as V,K as J,L as Sa,M as rt,N as Ft,O as K,P as Vt,Q as vt,R as ue,S as Ee,U as za,V as Pa,W as le,X as Je,Y as Ta,Z as Ia,_ as La}from"./vendor.js?v=ecba491a";var Kw=ya(Ce=>{const Ma=function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const m of s)if(m.type==="childList")for(const v of m.addedNodes)v.tagName==="LINK"&&v.rel==="modulepreload"&&n(v)}).observe(document,{childList:!0,subtree:!0});function o(s){const m={};return s.integrity&&(m.integrity=s.integrity),s.referrerpolicy&&(m.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?m.credentials="include":s.crossorigin==="anonymous"?m.credentials="omit":m.credentials="same-origin",m}function n(s){if(s.ep)return;s.ep=!0;const m=o(s);fetch(s.href,m)}};Ma();const Oa=(e,a)=>A(Ce,null,function*(){return new Promise((o,n)=>A(Ce,null,function*(){try{const s=yield fetch(e,a);if(Math.floor(s.status/100)!=2)throw s.status+" "+s.statusText;const m=X({},s);m.data=yield s.json(),o(m)}catch(s){n(s)}}))});class $e{constructor(a){Kt(this,"config",{baseURL:"",headers:{}});Kt(this,"useRequest",a=>a);Kt(this,"useResponse",a=>a);Kt(this,"useError",a=>a);a.baseURL&&(this.config.baseURL=a.baseURL),a.headers&&(this.config.headers=a.headers)}static create(a){return new $e(a)}Do(a,o){return A(this,null,function*(){return new Promise((n,s)=>A(this,null,function*(){try{const m=this.useRequest({baseURL:this.config.baseURL,headers:this.config.headers});a=`${m.baseURL||""}${a}`,o.headers==null&&(o.headers={}),m.headers&&(o.headers=X({},m.headers));const f=yield fetch(a,o),u=X({},f);u.data=yield f.json(),n(this.useResponse(u))}catch(m){this.useError(m),s(m)}}))})}TEXT(a,o){return A(this,null,function*(){return new Promise((n,s)=>A(this,null,function*(){try{const m=this.useRequest({baseURL:this.config.baseURL,headers:this.config.headers});a=`${m.baseURL||""}${a}`,o.headers==null&&(o.headers={}),m.headers&&(o.headers=X({},m.headers));const f=yield fetch(a,o),u=X({},f);u.data=yield f.text(),n(u)}catch(m){this.useError(m),s(m)}}))})}interceptors(){const a=this;return{requset:{use(o){a.useRequest=o}},response:{use(o,n){a.useResponse=o,n&&(a.useError=n)}}}}}const Ke=$e.create({});Ke.interceptors().requset.use(e=>e);Ke.interceptors().response.use(e=>(e.data&&e.data.success==null&&e.data.success==0,e));const Na="/cgi-bin/luci/istore";let Re=!1;const I=(e,a)=>(e.indexOf("//")==-1&&(e=`${Na}${e}`),Oa(e,a).then(o=>(o!=null&&o.data&&o.data.success==-1001&&o.data.error=="Forbidden"&&(Re||(Re=!0,alert("\u767B\u5F55\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55"),location.reload())),o))),ja={Statistics:{GET(){return I("/network/statistics/",{method:"GET"})}},Status:{GET(){return I("/network/status/",{method:"GET"})}},Device:{List:{GET(){return I("/network/device/list/",{method:"GET"})}}},Homebox:{Enable:{POST(){return I("/network/homebox/enable/",{method:"POST",headers:{"Content-Type":"application/json;chars
2022-11-29 20:20:30 +08:00
`+m.value+`
2023-02-01 19:20:23 +08:00
`+n.value,disabled:""},null,8,Zh)]),t("div",Hh,[t("div",{class:"close",onClick:u,disabled:o.value},"\u5173\u95ED",8,Jh),o.value?$("",!0):(i(),r("div",{key:0,class:"next",onClick:c,disabled:o.value},"\u8FD0\u884C",8,Kh))])])]),_:1}))}});var Qh=S(Xh,[["__scopeId","data-v-45dd818a"]]);const qt=e=>(O("data-v-7d3ebf99"),e=e(),N(),e),tx={class:"actioner-container"},ex={class:"actioner-container_header"},ax={class:"tabs"},ox=qt(()=>t("a",null,"\u8BBE\u5907\u4FE1\u606F",-1)),nx=[ox],ix=qt(()=>t("a",null,"\u5C5E\u6027",-1)),rx=[ix],sx=qt(()=>t("a",null,"\u81EA\u68C0\u65E5\u5FD7",-1)),dx=[sx],cx=qt(()=>t("a",null,"\u6269\u5C55\u4FE1\u606F",-1)),ux=[cx],lx={class:"actioner-container_body"},px={key:0,class:"table"},fx={class:"tr"},mx=qt(()=>t("td",{class:"td left"},"\u8BBE\u5907",-1)),bx={class:"td left"},vx={class:"tr"},gx=qt(()=>t("td",{class:"td left"},"\u578B\u53F7",-1)),_x={class:"td left"},hx={class:"tr"},xx=qt(()=>t("td",{class:"td left"},"\u5E8F\u53F7",-1)),kx={class:"td left"},wx=["value"],yx=["value"],Fx=["value"],Cx={class:"actioner-container_footer"},Ex=["disabled"],$x=T({props:{close:{type:Function,required:!0},disk:{type:Object,required:!0}},setup(e){const a=e,o=F(!1),n=F("info"),s=d=>{switch(n.value=d,d){case"info":break;case"attribute":u();break;case"log":f();break;case"extend":c();break}},m=()=>{o.value=!0,a.close()},v=rt({log:"",attribute:"",extend:""}),f=()=>A(this,null,function*(){try{const d=yield Y.Smart.Test.Result.POST({type:"selftest",devicePath:a.disk.path||""});if(d.data){const{result:b,error:l}=d.data;b&&b.result&&(v.log=b.result),l&&(v.log=l)}}catch(d){v.log=d}}),u=()=>A(this,null,function*(){try{const d=yield Y.Smart.Attribute.Result.POST({devicePath:a.disk.path||""});if(d.data){const{result:b,error:l}=d.data;b&&b.result&&(v.attribute=b.result),l&&(v.attribute=l)}}catch(d){v.attribute=d}}),c=()=>A(this,null,function*(){try{const d=yield Y.Smart.Extend.Result.POST({devicePath:a.disk.path||""});if(d.data){const{result:b,error:l}=d.data;b&&b.result&&(v.extend=b.result),l&&(v.extend=l)}}catch(d){v.extend=d}});return(d,b)=>(i(),M(xe,null,{default:q(()=>[t("div",tx,[t("div",ex,[t("ul",ax,[t("li",{class:ct({"active cbi-tab":n.value=="info"}),onClick:b[0]||(b[0]=l=>s("info"))},nx,2),t("li",{class:ct({"active cbi-tab":n.value=="attribute"}),onClick:b[1]||(b[1]=l=>s("attribute"))},rx,2),t("li",{class:ct({"active cbi-tab":n.value=="log"}),onClick:b[2]||(b[2]=l=>s("log"))},dx,2),t("li",{class:ct({"active cbi-tab":n.value=="extend"}),onClick:b[3]||(b[3]=l=>s("extend"))},ux,2)])]),t("div",lx,[n.value=="info"?(i(),r("table",px,[t("tr",fx,[mx,t("td",bx,k(e.disk.path),1)]),t("tr",vx,[gx,t("td",_x,k(e.disk.model),1)]),t("tr",hx,[xx,t("td",kx,k(e.disk.serial),1)])])):n.value=="attribute"?(i(),r("textarea",{key:1,disabled:"",value:y(v).attribute},null,8,wx)):n.value=="log"?(i(),r("textarea",{key:2,disabled:"",value:y(v).log},null,8,yx)):n.value=="extend"?(i(),r("textarea",{key:3,disabled:"",value:y(v).extend},null,8,Fx)):$("",!0)]),t("div",Cx,[t("div",{class:"close",onClick:m,disabled:o.value},"\u5173\u95ED",8,Ex)])])]),_:1}))}});var Dx=S($x,[["__scopeId","data-v-7d3ebf99"]]);const Bx=e=>{const a=document.createElement("div");document.body.appendChild(a);const o=z(th,nt(X({},e),{close:()=>{n()}})),n=()=>{a.remove()};le(o,a)},Yx=e=>{const a=document.createElement("div");document.body.appendChild(a);const o=z(Rh,nt(X({},e),{close:()=>{n()}})),n=()=>{a.remove()};le(o,a)},Ax=e=>{const a=document.createElement("div");document.body.appendChild(a);const o=z(Qh,nt(X({},e),{close:()=>{n()}})),n=()=>{a.remove()};le(o,a)},Sx=e=>{const a=document.createElement("div");document.body.appendChild(a);const o=z(Dx,nt(X({},e),{close:()=>{n()}})),n=()=>{a.remove()};le(o,a)},zx={class:"cbi-section"},Px={class:"cbi-value"},Tx=t("label",{class:"cbi-value-title"}," \u542F\u7528 ",-1),Ix={class:"cbi-value-field"},Lx={class:"cbi-checkbox"},Mx=["value"],Ox={class:"cbi-value"},Nx=t("label",{class:"cbi-value-title"}," \u7535\u6E90\u6A21\u5F0F ",-1),jx={class:"cbi-value-field"},qx={class:"cbi-checkbox"},Rx=t("option",{value:"never"},"\u6C38\u4E0D",-1)