diff --git a/api/app.js b/api/app.js index c0f72ca..d0beedd 100644 --- a/api/app.js +++ b/api/app.js @@ -30,12 +30,6 @@ mongoose // Statik dosyaların servis edilmesi app.use(express.static("build")); - -// React uygulamasının web arayüzüne erişim -//app.get("/react-ui", (req, res) => { -// res.sendFile(path.join(__dirname, "public", "index.html")); -//}); - // Device Set Route app.use("/api/get", require("./route/device.get.route")); // Save Route @@ -44,15 +38,10 @@ app.use("/api/save", require("./route/save.route")); app.use("/api/set", require("./route/device.set.route")); // Device Log Route app.use("/api/device-log", require("./route/device.log.route")); -// 404 Not Found Endpoint -app.use((req, res) => { - res.status(404).json({ error: true, message: error.message }); -}); // Root public route -app.use("*", (req, res) => { - // res.sendFile("public/", { root: __dirname }); - res.sendStatus(400); -}); +// app.use("*", (req, res) => { +// res.sendStatus(400); +// }); // Server Listening server.listen(configs.port, () => { console.log(chalk.yellowBright.bold.red("Listening: " + configs.port)); diff --git a/api/build/assets/index-B9rnkQc0.css b/api/build/assets/index-B9rnkQc0.css new file mode 100644 index 0000000..ff6d6e7 --- /dev/null +++ b/api/build/assets/index-B9rnkQc0.css @@ -0,0 +1 @@ +:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body{margin:0;padding:0;background-color:#f2f2f2;width:100vw}.head.svelte-1ymrnsc{background-color:#fff;width:100vw;height:70px;display:flex;align-items:center;justify-content:flex-start;padding-left:20px;box-shadow:0 2px 4px #0000030d}.table-wrapper.svelte-8jhh26{display:flex;justify-content:center;align-items:center;margin-top:20px;flex-direction:column;background-color:#fff;width:95%;border-radius:4px;box-shadow:0 2px 4px #0000030d}.table.svelte-8jhh26{width:100%;display:flex;flex-direction:column;align-items:center}.table-head-item.svelte-8jhh26{width:100%;display:flex;justify-content:start;align-items:center;padding:5px 10px 10px;color:#535151;font-size:16px}.table-row.svelte-8jhh26{display:flex;width:100%;text-decoration:none;color:inherit}.table-body-item.svelte-8jhh26{width:calc(100% / 7);display:flex;justify-content:start;padding:5px 10px 10px}.table-head.svelte-8jhh26{font-size:15px}.divider.svelte-8jhh26{width:100%;background-color:#f2f2f2;height:1px}.svelte-routing-link{display:flex;width:100%;text-decoration:none;color:inherit}.svelte-routing-link:hover{cursor:pointer;display:flex;width:100%;text-decoration:none;color:inherit;background-color:#f3f3f3}.body.svelte-1ecf7vt{display:flex;align-items:center;justify-content:center;flex-direction:column} diff --git a/api/build/assets/index-DgqqTNsd.js b/api/build/assets/index-DgqqTNsd.js new file mode 100644 index 0000000..1edb427 --- /dev/null +++ b/api/build/assets/index-DgqqTNsd.js @@ -0,0 +1,4 @@ +var St=Object.defineProperty;var $t=(t,e,n)=>e in t?St(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var je=(t,e,n)=>($t(t,typeof e!="symbol"?e+"":e,n),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.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)}})();function v(){}const lt=t=>t;function Q(t,e){for(const n in e)t[n]=e[n];return t}function Pt(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function ct(t){return t()}function Be(){return Object.create(null)}function X(t){t.forEach(ct)}function he(t){return typeof t=="function"}function D(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function jt(t){return Object.keys(t).length===0}function ke(t,...e){if(t==null){for(const s of e)s(void 0);return v}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function G(t,e,n){t.$$.on_destroy.push(ke(e,n))}function we(t,e,n,s){if(t){const r=ut(t,e,n,s);return t[0](r)}}function ut(t,e,n,s){return t[1]&&s?Q(n.ctx.slice(),t[1](s(e))):n.ctx}function Se(t,e,n,s){if(t[2]&&s){const r=t[2](s(n));if(e.dirty===void 0)return r;if(typeof r=="object"){const i=[],o=Math.max(e.dirty.length,r.length);for(let c=0;c32){const e=[],n=t.ctx.length/32;for(let s=0;swindow.performance.now():()=>Date.now(),De=at?t=>requestAnimationFrame(t):v;const ie=new Set;function dt(t){ie.forEach(e=>{e.c(t)||(ie.delete(e),e.f())}),ie.size!==0&&De(dt)}function ht(t){let e;return ie.size===0&&De(dt),{promise:new Promise(n=>{ie.add(e={c:t,f:n})}),abort(){ie.delete(e)}}}function L(t,e){t.appendChild(e)}function _t(t){if(!t)return document;const e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function Rt(t){const e=j("style");return e.textContent="/* empty */",Et(_t(t),e),e.sheet}function Et(t,e){return L(t.head||t,e),e.sheet}function g(t,e,n){t.insertBefore(e,n||null)}function p(t){t.parentNode&&t.parentNode.removeChild(t)}function mt(t,e){for(let n=0;nt.removeEventListener(e,n,s)}function N(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}const Nt=["width","height"];function Ke(t,e){const n=Object.getOwnPropertyDescriptors(t.__proto__);for(const s in e)e[s]==null?t.removeAttribute(s):s==="style"?t.style.cssText=e[s]:s==="__value"?t.value=t[s]=e[s]:n[s]&&n[s].set&&Nt.indexOf(s)===-1?t[s]=e[s]:N(t,s,e[s])}function Ot(t){return Array.from(t.childNodes)}function W(t,e){e=""+e,t.data!==e&&(t.data=e)}function pt(t,e,{bubbles:n=!1,cancelable:s=!1}={}){return new CustomEvent(t,{detail:e,bubbles:n,cancelable:s})}function Ye(t,e){return new t(e)}const pe=new Map;let ve=0;function Mt(t){let e=5381,n=t.length;for(;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}function Ct(t,e){const n={stylesheet:Rt(e),rules:{}};return pe.set(t,n),n}function vt(t,e,n,s,r,i,o,c=0){const u=16.666/s;let l=`{ +`;for(let y=0;y<=1;y+=u){const w=e+(n-e)*i(y);l+=y*100+`%{${o(w,1-w)}} +`}const f=l+`100% {${o(n,1-n)}} +}`,a=`__svelte_${Mt(f)}_${c}`,_=_t(t),{stylesheet:b,rules:d}=pe.get(_)||Ct(_,t);d[a]||(d[a]=!0,b.insertRule(`@keyframes ${a} ${f}`,b.cssRules.length));const k=t.style.animation||"";return t.style.animation=`${k?`${k}, `:""}${a} ${s}ms linear ${r}ms 1 both`,ve+=1,a}function Ce(t,e){const n=(t.style.animation||"").split(", "),s=n.filter(e?i=>i.indexOf(e)<0:i=>i.indexOf("__svelte")===-1),r=n.length-s.length;r&&(t.style.animation=s.join(", "),ve-=r,ve||At())}function At(){De(()=>{ve||(pe.forEach(t=>{const{ownerNode:e}=t.stylesheet;e&&p(e)}),pe.clear())})}let fe;function q(t){fe=t}function ue(){if(!fe)throw new Error("Function called outside component initialization");return fe}function He(t){ue().$$.on_mount.push(t)}function Tt(t){ue().$$.on_destroy.push(t)}function It(){const t=ue();return(e,n,{cancelable:s=!1}={})=>{const r=t.$$.callbacks[e];if(r){const i=pt(e,n,{cancelable:s});return r.slice().forEach(o=>{o.call(t,i)}),!i.defaultPrevented}return!0}}function Re(t,e){return ue().$$.context.set(t,e),e}function oe(t){return ue().$$.context.get(t)}const re=[],Fe=[];let le=[];const We=[],Dt=Promise.resolve();let Ae=!1;function Ht(){Ae||(Ae=!0,Dt.then(Ue))}function ce(t){le.push(t)}const Ee=new Set;let ne=0;function Ue(){if(ne!==0)return;const t=fe;do{try{for(;net.indexOf(s)===-1?e.push(s):n.push(s)),n.forEach(s=>s()),le=e}let ae;function bt(){return ae||(ae=Promise.resolve(),ae.then(()=>{ae=null})),ae}function be(t,e,n){t.dispatchEvent(pt(`${e?"intro":"outro"}${n}`))}const me=new Set;let V;function ee(){V={r:0,c:[],p:V}}function te(){V.r||X(V.c),V=V.p}function $(t,e){t&&t.i&&(me.delete(t),t.i(e))}function P(t,e,n,s){if(t&&t.o){if(me.has(t))return;me.add(t),V.c.push(()=>{me.delete(t),s&&(n&&t.d(1),s())}),t.o(e)}else s&&s()}const gt={duration:0};function zt(t,e,n){const s={direction:"in"};let r=e(t,n,s),i=!1,o,c,u=0;function l(){o&&Ce(t,o)}function f(){const{delay:_=0,duration:b=300,easing:d=lt,tick:k=v,css:y}=r||gt;y&&(o=vt(t,0,1,b,_,d,y,u++)),k(0,1);const w=ft()+_,O=w+b;c&&c.abort(),i=!0,ce(()=>be(t,!0,"start")),c=ht(R=>{if(i){if(R>=O)return k(1,0),be(t,!0,"end"),l(),i=!1;if(R>=w){const C=d((R-w)/b);k(C,1-C)}}return i})}let a=!1;return{start(){a||(a=!0,Ce(t),he(r)?(r=r(s),bt().then(f)):f())},invalidate(){a=!1},end(){i&&(l(),i=!1)}}}function Kt(t,e,n){const s={direction:"out"};let r=e(t,n,s),i=!0,o;const c=V;c.r+=1;let u;function l(){const{delay:f=0,duration:a=300,easing:_=lt,tick:b=v,css:d}=r||gt;d&&(o=vt(t,1,0,a,f,_,d));const k=ft()+f,y=k+a;ce(()=>be(t,!1,"start")),"inert"in t&&(u=t.inert,t.inert=!0),ht(w=>{if(i){if(w>=y)return b(0,1),be(t,!1,"end"),--c.r||X(c.c),!1;if(w>=k){const O=_((w-k)/a);b(1-O,O)}}return i})}return he(r)?bt().then(()=>{r=r(s),l()}):l(),{end(f){f&&"inert"in t&&(t.inert=u),f&&r.tick&&r.tick(1,0),i&&(o&&Ce(t,o),i=!1)}}}function qe(t,e){const n=e.token={};function s(r,i,o,c){if(e.token!==n)return;e.resolved=c;let u=e.ctx;o!==void 0&&(u=u.slice(),u[o]=c);const l=r&&(e.current=r)(u);let f=!1;e.block&&(e.blocks?e.blocks.forEach((a,_)=>{_!==i&&a&&(ee(),P(a,1,1,()=>{e.blocks[_]===a&&(e.blocks[_]=null)}),te())}):e.block.d(1),l.c(),$(l,1),l.m(e.mount(),e.anchor),f=!0),e.block=l,e.blocks&&(e.blocks[i]=l),f&&Ue()}if(Pt(t)){const r=ue();if(t.then(i=>{q(r),s(e.then,1,e.value,i),q(null)},i=>{if(q(r),s(e.catch,2,e.error,i),q(null),!e.hasCatch)throw i}),e.current!==e.pending)return s(e.pending,0),!0}else{if(e.current!==e.then)return s(e.then,1,e.value,t),!0;e.resolved=t}}function Yt(t,e,n){const s=e.slice(),{resolved:r}=t;t.current===t.then&&(s[t.value]=r),t.current===t.catch&&(s[t.error]=r),t.block.p(s,n)}function ge(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function Te(t,e){const n={},s={},r={$$scope:1};let i=t.length;for(;i--;){const o=t[i],c=e[i];if(c){for(const u in o)u in c||(s[u]=1);for(const u in c)r[u]||(n[u]=c[u],r[u]=1);t[i]=c}else for(const u in o)r[u]=1}for(const o in s)o in n||(n[o]=void 0);return n}function _e(t){return typeof t=="object"&&t!==null?t:{}}function z(t){t&&t.c()}function U(t,e,n){const{fragment:s,after_update:r}=t.$$;s&&s.m(e,n),ce(()=>{const i=t.$$.on_mount.map(ct).filter(he);t.$$.on_destroy?t.$$.on_destroy.push(...i):X(i),t.$$.on_mount=[]}),r.forEach(ce)}function B(t,e){const n=t.$$;n.fragment!==null&&(Bt(n.after_update),X(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function Ft(t,e){t.$$.dirty[0]===-1&&(re.push(t),Ht(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const d=b.length?b[0]:_;return l.ctx&&r(l.ctx[a],l.ctx[a]=d)&&(!l.skip_bound&&l.bound[a]&&l.bound[a](d),f&&Ft(t,a)),_}):[],l.update(),f=!0,X(l.before_update),l.fragment=s?s(l.ctx):!1,e.target){if(e.hydrate){const a=Ot(e.target);l.fragment&&l.fragment.l(a),a.forEach(p)}else l.fragment&&l.fragment.c();e.intro&&$(t.$$.fragment),U(t,e.target,e.anchor),Ue()}q(u)}class Y{constructor(){je(this,"$$");je(this,"$$set")}$destroy(){B(this,1),this.$destroy=v}$on(e,n){if(!he(n))return v;const s=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return s.push(n),()=>{const r=s.indexOf(n);r!==-1&&s.splice(r,1)}}$set(e){this.$$set&&!jt(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Wt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Wt);function qt(t){let e;return{c(){e=j("div"),e.textContent="SMART HOME",N(e,"class","head svelte-1ymrnsc")},m(n,s){g(n,e,s)},p:v,i:v,o:v,d(n){n&&p(e)}}}class Vt extends Y{constructor(e){super(),K(this,e,null,qt,D,{})}}const Ie={},ye={},yt={},kt=/^:(.+)/,Ve=4,Qt=3,Zt=2,Gt=1,Jt=1,de=t=>t.replace(/(^\/+|\/+$)/g,"").split("/"),Le=t=>t.replace(/(^\/+|\/+$)/g,""),Xt=(t,e)=>{const n=t.default?0:de(t.path).reduce((s,r)=>(s+=Ve,r===""?s+=Jt:kt.test(r)?s+=Zt:r[0]==="*"?s-=Ve+Gt:s+=Qt,s),0);return{route:t,score:n,index:e}},xt=t=>t.map(Xt).sort((e,n)=>e.scoren.score?-1:e.index-n.index),Qe=(t,e)=>{let n,s;const[r]=e.split("?"),i=de(r),o=i[0]==="",c=xt(t);for(let u=0,l=c.length;u"u"){a=!0;break}const O=kt.exec(y);if(O&&!o){const R=decodeURIComponent(w);b[O[1]]=R}else if(y!==w){a=!0;break}}if(!a){n={route:f,params:b,uri:"/"+i.slice(0,k).join("/")};break}}return n||s||null},Ne=(t,e)=>t+(e?`?${e}`:""),en=(t,e)=>{if(t.startsWith("/"))return t;const[n,s]=t.split("?"),[r]=e.split("?"),i=de(n),o=de(r);if(i[0]==="")return Ne(r,s);if(!i[0].startsWith(".")){const l=o.concat(i).join("/");return Ne((r==="/"?"":"/")+l,s)}const c=o.concat(i),u=[];return c.forEach(l=>{l===".."?u.pop():l!=="."&&u.push(l)}),Ne("/"+u.join("/"),s)},Ze=(t,e)=>`${Le(e==="/"?t:`${Le(t)}/${Le(e)}`)}/`,tn=t=>!t.defaultPrevented&&t.button===0&&!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey),wt=()=>typeof window<"u"&&"document"in window&&"location"in window,nn=t=>({active:t&4}),Ge=t=>({active:!!t[2]});function sn(t){let e,n,s,r;const i=t[17].default,o=we(i,t,t[16],Ge);let c=[{href:t[0]},{"aria-current":t[2]},t[1],t[6]],u={};for(let l=0;l({})}=e,{preserveScroll:d=!1}=e;const k=oe(Ie);G(t,k,S=>n(14,o=S));const{base:y}=oe(ye);G(t,y,S=>n(15,c=S));const{navigate:w}=oe(yt),O=It();let R,C,I,F;const Z=S=>{if(O("click",S),tn(S)){S.preventDefault();const h=o.pathname===R||a;w(R,{state:_,replace:h,preserveScroll:d})}};return t.$$set=S=>{e=Q(Q({},e),Me(S)),n(6,i=ze(e,r)),"to"in S&&n(7,f=S.to),"replace"in S&&n(8,a=S.replace),"state"in S&&n(9,_=S.state),"getProps"in S&&n(10,b=S.getProps),"preserveScroll"in S&&n(11,d=S.preserveScroll),"$$scope"in S&&n(16,l=S.$$scope)},t.$$.update=()=>{t.$$.dirty&32896&&n(0,R=en(f,c.uri)),t.$$.dirty&16385&&n(12,C=o.pathname.startsWith(R)),t.$$.dirty&16385&&n(13,I=R===o.pathname),t.$$.dirty&8192&&n(2,s=I?"page":void 0),n(1,F=b({location:o,href:R,isPartiallyCurrent:C,isCurrent:I,existingProps:i}))},[R,F,s,k,y,Z,i,f,a,_,b,d,C,I,o,c,l,u]}class on extends Y{constructor(e){super(),K(this,e,rn,sn,D,{to:7,replace:8,state:9,getProps:10,preserveScroll:11})}}const ln=t=>({params:t&4}),Je=t=>({params:t[2]});function Xe(t){let e,n,s,r;const i=[un,cn],o=[];function c(u,l){return u[0]?0:1}return e=c(t),n=o[e]=i[e](t),{c(){n.c(),s=x()},m(u,l){o[e].m(u,l),g(u,s,l),r=!0},p(u,l){let f=e;e=c(u),e===f?o[e].p(u,l):(ee(),P(o[f],1,1,()=>{o[f]=null}),te(),n=o[e],n?n.p(u,l):(n=o[e]=i[e](u),n.c()),$(n,1),n.m(s.parentNode,s))},i(u){r||($(n),r=!0)},o(u){P(n),r=!1},d(u){u&&p(s),o[e].d(u)}}}function cn(t){let e;const n=t[8].default,s=we(n,t,t[7],Je);return{c(){s&&s.c()},m(r,i){s&&s.m(r,i),e=!0},p(r,i){s&&s.p&&(!e||i&132)&&$e(s,n,r,r[7],e?Se(n,r[7],i,ln):Pe(r[7]),Je)},i(r){e||($(s,r),e=!0)},o(r){P(s,r),e=!1},d(r){s&&s.d(r)}}}function un(t){let e,n,s,r={ctx:t,current:null,token:null,hasCatch:!1,pending:dn,then:fn,catch:an,value:12,blocks:[,,,]};return qe(n=t[0],r),{c(){e=x(),r.block.c()},m(i,o){g(i,e,o),r.block.m(i,r.anchor=o),r.mount=()=>e.parentNode,r.anchor=e,s=!0},p(i,o){t=i,r.ctx=t,o&1&&n!==(n=t[0])&&qe(n,r)||Yt(r,t,o)},i(i){s||($(r.block),s=!0)},o(i){for(let o=0;o<3;o+=1){const c=r.blocks[o];P(c)}s=!1},d(i){i&&p(e),r.block.d(i),r.token=null,r=null}}}function an(t){return{c:v,m:v,p:v,i:v,o:v,d:v}}function fn(t){var c;let e,n,s;const r=[t[2],t[3]];var i=((c=t[12])==null?void 0:c.default)||t[12];function o(u,l){let f={};for(let a=0;a{B(a,1)}),te()}i?(e=Ye(i,o(u,l)),z(e.$$.fragment),$(e.$$.fragment,1),U(e,n.parentNode,n)):e=null}else if(i){const a=l&12?Te(r,[l&4&&_e(u[2]),l&8&&_e(u[3])]):{};e.$set(a)}},i(u){s||(e&&$(e.$$.fragment,u),s=!0)},o(u){e&&P(e.$$.fragment,u),s=!1},d(u){u&&p(n),e&&B(e,u)}}}function dn(t){return{c:v,m:v,p:v,i:v,o:v,d:v}}function hn(t){let e,n,s=t[1]&&t[1].route===t[5]&&Xe(t);return{c(){s&&s.c(),e=x()},m(r,i){s&&s.m(r,i),g(r,e,i),n=!0},p(r,[i]){r[1]&&r[1].route===r[5]?s?(s.p(r,i),i&2&&$(s,1)):(s=Xe(r),s.c(),$(s,1),s.m(e.parentNode,e)):s&&(ee(),P(s,1,1,()=>{s=null}),te())},i(r){n||($(s),n=!0)},o(r){P(s),n=!1},d(r){r&&p(e),s&&s.d(r)}}}function _n(t,e,n){let s,{$$slots:r={},$$scope:i}=e,{path:o=""}=e,{component:c=null}=e,u={},l={};const{registerRoute:f,unregisterRoute:a,activeRoute:_}=oe(ye);G(t,_,d=>n(1,s=d));const b={path:o,default:o===""};return f(b),Tt(()=>{a(b)}),t.$$set=d=>{n(11,e=Q(Q({},e),Me(d))),"path"in d&&n(6,o=d.path),"component"in d&&n(0,c=d.component),"$$scope"in d&&n(7,i=d.$$scope)},t.$$.update=()=>{if(s&&s.route===b){n(2,u=s.params);const{component:d,path:k,...y}=e;n(3,l=y),d&&(d.toString().startsWith("class ")?n(0,c=d):n(0,c=d())),wt()&&!s.preserveScroll&&(window==null||window.scrollTo(0,0))}},e=Me(e),[c,s,u,l,_,b,o,i,r]}class xe extends Y{constructor(e){super(),K(this,e,_n,hn,D,{path:6,component:0})}}const se=[];function mn(t,e){return{subscribe:J(t,e).subscribe}}function J(t,e=v){let n;const s=new Set;function r(c){if(D(t,c)&&(t=c,n)){const u=!se.length;for(const l of s)l[1](),se.push(l,t);if(u){for(let l=0;l{s.delete(l),s.size===0&&n&&(n(),n=null)}}return{set:r,update:i,subscribe:o}}function pn(t,e,n){const s=!Array.isArray(t),r=s?[t]:t;if(!r.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const i=e.length<2;return mn(n,(o,c)=>{let u=!1;const l=[];let f=0,a=v;const _=()=>{if(f)return;a();const d=e(s?l[0]:l,o,c);i?o(d):a=he(d)?d:v},b=r.map((d,k)=>ke(d,y=>{l[k]=y,f&=~(1<{f|=1<({...t.location,state:t.history.state,key:t.history.state&&t.history.state.key||"initial"}),vn=t=>{const e=[];let n=Oe(t);return{get location(){return n},listen(s){e.push(s);const r=()=>{n=Oe(t),s({location:n,action:"POP"})};return t.addEventListener("popstate",r),()=>{t.removeEventListener("popstate",r);const i=e.indexOf(s);e.splice(i,1)}},navigate(s,{state:r,replace:i=!1,preserveScroll:o=!1,blurActiveElement:c=!0}={}){r={...r,key:Date.now()+""};try{i?t.history.replaceState(r,"",s):t.history.pushState(r,"",s)}catch{t.location[i?"replace":"assign"](s)}n=Oe(t),e.forEach(u=>u({location:n,action:"PUSH",preserveScroll:o})),c&&document.activeElement.blur()}}},bn=(t="/")=>{let e=0;const n=[{pathname:t,search:""}],s=[];return{get location(){return n[e]},addEventListener(r,i){},removeEventListener(r,i){},history:{get entries(){return n},get index(){return e},get state(){return s[e]},pushState(r,i,o){const[c,u=""]=o.split("?");e++,n.push({pathname:c,search:u}),s.push(r)},replaceState(r,i,o){const[c,u=""]=o.split("?");n[e]={pathname:c,search:u},s[e]=r}}}},gn=vn(wt()?window:bn()),yn=t=>({route:t&4,location:t&2}),et=t=>({route:t[2]&&t[2].uri,location:t[1]}),kn=t=>({route:t&4,location:t&2}),tt=t=>({route:t[2]&&t[2].uri,location:t[1]});function wn(t){let e;const n=t[15].default,s=we(n,t,t[14],et);return{c(){s&&s.c()},m(r,i){s&&s.m(r,i),e=!0},p(r,i){s&&s.p&&(!e||i&16390)&&$e(s,n,r,r[14],e?Se(n,r[14],i,yn):Pe(r[14]),et)},i(r){e||($(s,r),e=!0)},o(r){P(s,r),e=!1},d(r){s&&s.d(r)}}}function Sn(t){let e=t[1].pathname,n,s,r=nt(t);return{c(){r.c(),n=x()},m(i,o){r.m(i,o),g(i,n,o),s=!0},p(i,o){o&2&&D(e,e=i[1].pathname)?(ee(),P(r,1,1,v),te(),r=nt(i),r.c(),$(r,1),r.m(n.parentNode,n)):r.p(i,o)},i(i){s||($(r),s=!0)},o(i){P(r),s=!1},d(i){i&&p(n),r.d(i)}}}function nt(t){let e,n,s,r;const i=t[15].default,o=we(i,t,t[14],tt);return{c(){e=j("div"),o&&o.c()},m(c,u){g(c,e,u),o&&o.m(e,null),r=!0},p(c,u){o&&o.p&&(!r||u&16390)&&$e(o,i,c,c[14],r?Se(i,c[14],u,kn):Pe(c[14]),tt)},i(c){r||($(o,c),c&&ce(()=>{r&&(s&&s.end(1),n=zt(e,t[3],{}),n.start())}),r=!0)},o(c){P(o,c),n&&n.invalidate(),c&&(s=Kt(e,t[3],{})),r=!1},d(c){c&&p(e),o&&o.d(c),c&&s&&s.end()}}}function $n(t){let e,n,s,r;const i=[Sn,wn],o=[];function c(u,l){return u[0]?0:1}return e=c(t),n=o[e]=i[e](t),{c(){n.c(),s=x()},m(u,l){o[e].m(u,l),g(u,s,l),r=!0},p(u,[l]){let f=e;e=c(u),e===f?o[e].p(u,l):(ee(),P(o[f],1,1,()=>{o[f]=null}),te(),n=o[e],n?n.p(u,l):(n=o[e]=i[e](u),n.c()),$(n,1),n.m(s.parentNode,s))},i(u){r||($(n),r=!0)},o(u){P(n),r=!1},d(u){u&&p(s),o[e].d(u)}}}function Pn(t,e,n){let s,r,i,o,{$$slots:c={},$$scope:u}=e,{basepath:l="/"}=e,{url:f=null}=e,{viewtransition:a=null}=e,{history:_=gn}=e;const b=(h,M,A)=>{const m=a(A);return typeof(m==null?void 0:m.fn)=="function"?m.fn(h,m):m};Re(yt,_);const d=oe(Ie),k=oe(ye),y=J([]);G(t,y,h=>n(12,r=h));const w=J(null);G(t,w,h=>n(2,o=h));let O=!1;const R=d||J(f?{pathname:f}:_.location);G(t,R,h=>n(1,s=h));const C=k?k.routerBase:J({path:l,uri:l});G(t,C,h=>n(13,i=h));const I=pn([C,w],([h,M])=>{if(!M)return h;const{path:A}=h,{route:m,uri:E}=M;return{path:m.default?A:m.path.replace(/\*.*$/,""),uri:E}}),F=h=>{const{path:M}=i;let{path:A}=h;if(h._path=A,h.path=Ze(M,A),typeof window>"u"){if(O)return;const m=Qe([h],s.pathname);m&&(w.set(m),O=!0)}else y.update(m=>[...m,h])},Z=h=>{y.update(M=>M.filter(A=>A!==h))};let S=!1;return d||(He(()=>_.listen(M=>{n(11,S=M.preserveScroll||!1),R.set(M.location)})),Re(Ie,R)),Re(ye,{activeRoute:w,base:C,routerBase:I,registerRoute:F,unregisterRoute:Z}),t.$$set=h=>{"basepath"in h&&n(8,l=h.basepath),"url"in h&&n(9,f=h.url),"viewtransition"in h&&n(0,a=h.viewtransition),"history"in h&&n(10,_=h.history),"$$scope"in h&&n(14,u=h.$$scope)},t.$$.update=()=>{if(t.$$.dirty&8192){const{path:h}=i;y.update(M=>M.map(A=>Object.assign(A,{path:Ze(h,A._path)})))}if(t.$$.dirty&6146){const h=Qe(r,s.pathname);w.set(h&&{...h,preserveScroll:S})}},[a,s,o,b,y,w,R,C,l,f,_,S,r,i,u,c]}class jn extends Y{constructor(e){super(),K(this,e,Pn,$n,D,{basepath:8,url:9,viewtransition:0,history:10})}}function st(t,e,n){const s=t.slice();return s[2]=e[n],s}function Rn(t){let e;return{c(){e=j("div"),e.textContent="door switch"},m(n,s){g(n,e,s)},p:v,d(n){n&&p(e)}}}function En(t){let e,n=t[2].sensor_value+"",s,r,i,o=t[2].battery_life+"",c;return{c(){e=j("div"),s=H(n),r=T(),i=j("div"),c=H(o)},m(u,l){g(u,e,l),L(e,s),g(u,r,l),g(u,i,l),L(i,c)},p(u,l){l&2&&n!==(n=u[2].sensor_value+"")&&W(s,n),l&2&&o!==(o=u[2].battery_life+"")&&W(c,o)},d(u){u&&(p(e),p(r),p(i))}}}function rt(t){let e;function n(i,o){return i[2].sensor_value!=null?En:Rn}let s=n(t),r=s(t);return{c(){r.c(),e=x()},m(i,o){r.m(i,o),g(i,e,o)},p(i,o){s===(s=n(i))&&r?r.p(i,o):(r.d(1),r=s(i),r&&(r.c(),r.m(e.parentNode,e)))},d(i){i&&p(e),r.d(i)}}}function Ln(t){let e,n,s,r,i,o,c=ge(t[1]),u=[];for(let l=0;l
Name
Type
Manufacturer
Serial Number
Model
Version
IP Address
',s=T(),r=j("div");for(let l=0;l(r(),r=ke(o,c=>n(1,s=c)),o);t.$$.on_destroy.push(()=>r());let{deviceLog:o}=e;return i(),t.$$set=c=>{"deviceLog"in c&&i(n(0,o=c.deviceLog))},[o,s]}class On extends Y{constructor(e){super(),K(this,e,Nn,Ln,D,{deviceLog:0})}}function Mn(t){let e,n,s;return n=new On({props:{deviceLog:t[0]}}),{c(){e=j("div"),z(n.$$.fragment)},m(r,i){g(r,e,i),U(n,e,null),s=!0},p:v,i(r){s||($(n.$$.fragment,r),s=!0)},o(r){P(n.$$.fragment,r),s=!1},d(r){r&&p(e),B(n)}}}function Cn(t,e,n){let{deviceId:s}=e;const r="/api/get/R8Re9mMYDTMbPa2kkgueZtoSg/"+s,i=J([]);return He(async()=>{try{const u=await(await fetch(r)).json();i.set(u.result.device_log)}catch(c){console.log(c)}}),t.$$set=c=>{"deviceId"in c&&n(1,s=c.deviceId)},[i,s]}class An extends Y{constructor(e){super(),K(this,e,Cn,Mn,D,{deviceId:1})}}function it(t,e,n){const s=t.slice();return s[2]=e[n],s}function Tn(t){let e,n=t[2].device_name+"",s,r,i,o=t[2].device_type+"",c,u,l,f=t[2].manifactor+"",a,_,b,d=t[2].serial_number+"",k,y,w,O=t[2].model+"",R,C,I,F=t[2].firmware_version+"",Z,S,h,M=t[2].device_ip_address+"",A;return{c(){e=j("div"),s=H(n),r=T(),i=j("div"),c=H(o),u=T(),l=j("div"),a=H(f),_=T(),b=j("div"),k=H(d),y=T(),w=j("div"),R=H(O),C=T(),I=j("div"),Z=H(F),S=T(),h=j("div"),A=H(M),N(e,"class","table-body-item svelte-8jhh26"),N(i,"class","table-body-item svelte-8jhh26"),N(l,"class","table-body-item svelte-8jhh26"),N(b,"class","table-body-item svelte-8jhh26"),N(w,"class","table-body-item svelte-8jhh26"),N(I,"class","table-body-item svelte-8jhh26"),N(h,"class","table-body-item svelte-8jhh26")},m(m,E){g(m,e,E),L(e,s),g(m,r,E),g(m,i,E),L(i,c),g(m,u,E),g(m,l,E),L(l,a),g(m,_,E),g(m,b,E),L(b,k),g(m,y,E),g(m,w,E),L(w,R),g(m,C,E),g(m,I,E),L(I,Z),g(m,S,E),g(m,h,E),L(h,A)},p(m,E){E&2&&n!==(n=m[2].device_name+"")&&W(s,n),E&2&&o!==(o=m[2].device_type+"")&&W(c,o),E&2&&f!==(f=m[2].manifactor+"")&&W(a,f),E&2&&d!==(d=m[2].serial_number+"")&&W(k,d),E&2&&O!==(O=m[2].model+"")&&W(R,O),E&2&&F!==(F=m[2].firmware_version+"")&&W(Z,F),E&2&&M!==(M=m[2].device_ip_address+"")&&W(A,M)},d(m){m&&(p(e),p(r),p(i),p(u),p(l),p(_),p(b),p(y),p(w),p(C),p(I),p(S),p(h))}}}function ot(t){let e,n,s,r;return e=new on({props:{to:"/details/"+t[2]._id,class:"svelte-routing-link",style:"text-decoration: none; color: inherit;",$$slots:{default:[Tn]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment),n=T(),s=j("div"),N(s,"class","divider svelte-8jhh26")},m(i,o){U(e,i,o),g(i,n,o),g(i,s,o),r=!0},p(i,o){const c={};o&2&&(c.to="/details/"+i[2]._id),o&34&&(c.$$scope={dirty:o,ctx:i}),e.$set(c)},i(i){r||($(e.$$.fragment,i),r=!0)},o(i){P(e.$$.fragment,i),r=!1},d(i){i&&(p(n),p(s)),B(e,i)}}}function In(t){let e,n,s,r,i,o=ge(t[1]),c=[];for(let l=0;lP(c[l],1,1,()=>{c[l]=null});return{c(){e=j("div"),n=j("div"),n.innerHTML='
Name
Type
Manufacturer
Serial Number
Model
Version
IP Address
',s=T(),r=j("div");for(let l=0;l(r(),r=ke(o,c=>n(1,s=c)),o);t.$$.on_destroy.push(()=>r());let{devices:o}=e;return i(),t.$$set=c=>{"devices"in c&&i(n(0,o=c.devices))},[o,s]}class Hn extends Y{constructor(e){super(),K(this,e,Dn,In,D,{devices:0})}}function Un(t){let e,n,s;return n=new Hn({props:{devices:t[0]}}),{c(){e=j("div"),z(n.$$.fragment),N(e,"class","body svelte-1ecf7vt")},m(r,i){g(r,e,i),U(n,e,null),s=!0},p:v,i(r){s||($(n.$$.fragment,r),s=!0)},o(r){P(n.$$.fragment,r),s=!1},d(r){r&&p(e),B(n)}}}function Bn(t){const e="/api/get/R8Re9mMYDTMbPa2kkgueZtoSg",n=J([]);return He(async()=>{try{const i=await(await fetch(e)).json();n.set(i.result),n.subscribe(o=>{})}catch(r){console.log(r)}}),[n]}class zn extends Y{constructor(e){super(),K(this,e,Bn,Un,D,{})}}function Kn(t){let e,n,s,r;return e=new xe({props:{path:"/details/:deviceId",component:An}}),s=new xe({props:{path:"/",component:zn}}),{c(){z(e.$$.fragment),n=T(),z(s.$$.fragment)},m(i,o){U(e,i,o),g(i,n,o),U(s,i,o),r=!0},p:v,i(i){r||($(e.$$.fragment,i),$(s.$$.fragment,i),r=!0)},o(i){P(e.$$.fragment,i),P(s.$$.fragment,i),r=!1},d(i){i&&p(n),B(e,i),B(s,i)}}}function Yn(t){let e,n;return e=new jn({props:{url:t[0],$$slots:{default:[Kn]},$$scope:{ctx:t}}}),{c(){z(e.$$.fragment)},m(s,r){U(e,s,r),n=!0},p(s,[r]){const i={};r&1&&(i.url=s[0]),r&2&&(i.$$scope={dirty:r,ctx:s}),e.$set(i)},i(s){n||($(e.$$.fragment,s),n=!0)},o(s){P(e.$$.fragment,s),n=!1},d(s){B(e,s)}}}function Fn(t,e,n){let{url:s=""}=e;return t.$$set=r=>{"url"in r&&n(0,s=r.url)},[s]}class Wn extends Y{constructor(e){super(),K(this,e,Fn,Yn,D,{url:0})}}function qn(t){let e,n,s,r,i;return n=new Vt({}),r=new Wn({}),{c(){e=j("main"),z(n.$$.fragment),s=T(),z(r.$$.fragment)},m(o,c){g(o,e,c),U(n,e,null),L(e,s),U(r,e,null),i=!0},p:v,i(o){i||($(n.$$.fragment,o),$(r.$$.fragment,o),i=!0)},o(o){P(n.$$.fragment,o),P(r.$$.fragment,o),i=!1},d(o){o&&p(e),B(n),B(r)}}}class Vn extends Y{constructor(e){super(),K(this,e,null,qn,D,{})}}new Vn({target:document.getElementById("app")}); diff --git a/api/build/index.html b/api/build/index.html new file mode 100644 index 0000000..bd44a38 --- /dev/null +++ b/api/build/index.html @@ -0,0 +1,14 @@ + + + + + + + Vite + Svelte + + + + +
+ + diff --git a/api/build/vite.svg b/api/build/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/api/build/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/package.json b/package.json index ce12ba1..40a80bc 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,11 @@ { "name": "smarthome-web", - "proxy": "http://localhost:9095", "private": true, "version": "0.0.0", "type": "module", "scripts": { "dev": "vite", - "build": "rm -rf api/build && vite build --out-dir api/build && rm -rf dist", + "build": "node ./scripts/build.cjs", "preview": "vite preview" }, "devDependencies": { diff --git a/scripts/build.cjs b/scripts/build.cjs new file mode 100644 index 0000000..a95ba0c --- /dev/null +++ b/scripts/build.cjs @@ -0,0 +1,14 @@ +const { execSync } = require('child_process'); +const { platform } = require('os'); + +const isWindows = platform() === 'win32'; + +if (isWindows) { + execSync('del /s /q api\\build', { stdio: 'inherit' }); + execSync('del /s /q dist', { stdio: 'inherit' }); +} else { + execSync('rm -rf api/build', { stdio: 'inherit' }); + execSync('rm -rf dist', { stdio: 'inherit' }); +} + +execSync('vite build --out-dir api/build', { stdio: 'inherit' });