From 5f32a489e10d6524356a2cf731362d96a447133e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lumi=C3=A8re=20=C3=89lev=C3=A9?= <88174309+PoneyClairDeLune@users.noreply.github.com> Date: Mon, 27 Mar 2023 03:10:18 +0100 Subject: [PATCH] Minimal working Web UI! --- CREDITS.md | 4 +- conf/service/pointer.json | 2 + dist/web.js.txt | 5 +++ libs/alpinejs/alpine.js | 5 +++ libs/lightfelt/main/cssClass.js | 8 ++++ libs/picocss/pico.css | 3 +- sh/build.sh | 7 ++-- src/core/common.js | 2 +- src/core/index.js | 29 ++++++++++--- src/core/ipinfo.js | 73 +++++++++++++++++++++++++++++++++ src/web/index.css | 2 +- src/web/index.htm | 2 +- src/web/index.js | 25 +++++++++++ src/web/web.txt | 2 - 14 files changed, 151 insertions(+), 18 deletions(-) create mode 100644 dist/web.js.txt create mode 100644 libs/alpinejs/alpine.js create mode 100644 libs/lightfelt/main/cssClass.js create mode 100644 src/web/index.js delete mode 100644 src/web/web.txt diff --git a/CREDITS.md b/CREDITS.md index c525d38..2f61f46 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -1,8 +1,8 @@ ### JavaScript -* Lumière Élevé (core code, Deno interface, Node.js interface) +* Lumière Élevé (core code, Deno interface, Node.js interface, Web UI) ### OS support * Lumière Élevé (Linux, Android, Windows, macOS, iOS) * Azure Star/Fauli1221 (Android tester, iOS tester, iSH `env` dump, iSH `uname` dump) * JayB (macOS `env` dump) -* Starshine (Windows tester, iOS tester) \ No newline at end of file +* Starshine (Windows tester, iOS tester) diff --git a/conf/service/pointer.json b/conf/service/pointer.json index aa20cc8..dbfcab4 100644 --- a/conf/service/pointer.json +++ b/conf/service/pointer.json @@ -7,6 +7,8 @@ "https://ponyplace.z19.web.core.windows.net/mask.png", "https://media.githubusercontent.com/media/r-ainbowroad/2023-minimap/main/mlp/mask.png" ], + "regions": [ + ], "offX": 0, "offY": 0 } \ No newline at end of file diff --git a/dist/web.js.txt b/dist/web.js.txt new file mode 100644 index 0000000..27afad3 --- /dev/null +++ b/dist/web.js.txt @@ -0,0 +1,5 @@ +"use strict";(()=>{var Tn={name:"Painted Palette",ver:"0.0.7"};(()=>{var k=!1,ke=!1,M=[],Se=-1;function Rn(e){In(e)}function In(e){M.includes(e)||M.push(e),Dn()}function ct(e){let t=M.indexOf(e);t!==-1&&t>Se&&M.splice(t,1)}function Dn(){!ke&&!k&&(k=!0,queueMicrotask(zn))}function zn(){k=!1,ke=!0;for(let e=0;ee.effect(t,{scheduler:n=>{Ce?Rn(n):n()}}),ft=e.raw}function dt(e){D=e}function Wn(e){let t=()=>{};return[n=>{let r=D(n);return e._x_effects||(e._x_effects=new Set,e._x_runEffects=()=>{e._x_effects.forEach(i=>i())}),e._x_effects.add(r),t=()=>{r!==void 0&&(e._x_effects.delete(r),V(r))},r},()=>{t()}]}var pt=[],_t=[],ht=[];function Fn(e){ht.push(e)}function mt(e,t){typeof t=="function"?(e._x_cleanups||(e._x_cleanups=[]),e._x_cleanups.push(t)):(t=e,_t.push(t))}function Un(e){pt.push(e)}function Vn(e,t,n){e._x_attributeCleanups||(e._x_attributeCleanups={}),e._x_attributeCleanups[t]||(e._x_attributeCleanups[t]=[]),e._x_attributeCleanups[t].push(n)}function gt(e,t){e._x_attributeCleanups&&Object.entries(e._x_attributeCleanups).forEach(([n,r])=>{(t===void 0||t.includes(n))&&(r.forEach(i=>i()),delete e._x_attributeCleanups[n])})}var je=new MutationObserver(Le),$e=!1;function Ne(){je.observe(document,{subtree:!0,childList:!0,attributes:!0,attributeOldValue:!0}),$e=!0}function xt(){Kn(),je.disconnect(),$e=!1}var K=[],Me=!1;function Kn(){K=K.concat(je.takeRecords()),K.length&&!Me&&(Me=!0,queueMicrotask(()=>{Hn(),Me=!1}))}function Hn(){Le(K),K.length=0}function x(e){if(!$e)return e();xt();let t=e();return Ne(),t}var Pe=!1,ie=[];function Jn(){Pe=!0}function Zn(){Pe=!1,Le(ie),ie=[]}function Le(e){if(Pe){ie=ie.concat(e);return}let t=[],n=[],r=new Map,i=new Map;for(let o=0;oa.nodeType===1&&t.push(a)),e[o].removedNodes.forEach(a=>a.nodeType===1&&n.push(a))),e[o].type==="attributes")){let a=e[o].target,l=e[o].attributeName,s=e[o].oldValue,u=()=>{r.has(a)||r.set(a,[]),r.get(a).push({name:l,value:a.getAttribute(l)})},c=()=>{i.has(a)||i.set(a,[]),i.get(a).push(l)};a.hasAttribute(l)&&s===null?u():a.hasAttribute(l)?(c(),u()):c()}i.forEach((o,a)=>{gt(a,o)}),r.forEach((o,a)=>{pt.forEach(l=>l(a,o))});for(let o of n)if(!t.includes(o)&&(_t.forEach(a=>a(o)),o._x_cleanups))for(;o._x_cleanups.length;)o._x_cleanups.pop()();t.forEach(o=>{o._x_ignoreSelf=!0,o._x_ignore=!0});for(let o of t)n.includes(o)||o.isConnected&&(delete o._x_ignoreSelf,delete o._x_ignore,ht.forEach(a=>a(o)),o._x_ignore=!0,o._x_ignoreSelf=!0);t.forEach(o=>{delete o._x_ignoreSelf,delete o._x_ignore}),t=null,n=null,r=null,i=null}function vt(e){return J(z(e))}function H(e,t,n){return e._x_dataStack=[t,...z(n||e)],()=>{e._x_dataStack=e._x_dataStack.filter(r=>r!==t)}}function yt(e,t){let n=e._x_dataStack[0];Object.entries(t).forEach(([r,i])=>{n[r]=i})}function z(e){return e._x_dataStack?e._x_dataStack:typeof ShadowRoot=="function"&&e instanceof ShadowRoot?z(e.host):e.parentNode?z(e.parentNode):[]}function J(e){let t=new Proxy({},{ownKeys:()=>Array.from(new Set(e.flatMap(n=>Object.keys(n)))),has:(n,r)=>e.some(i=>i.hasOwnProperty(r)),get:(n,r)=>(e.find(i=>{if(i.hasOwnProperty(r)){let o=Object.getOwnPropertyDescriptor(i,r);if(o.get&&o.get._x_alreadyBound||o.set&&o.set._x_alreadyBound)return!0;if((o.get||o.set)&&o.enumerable){let a=o.get,l=o.set,s=o;a=a&&a.bind(t),l=l&&l.bind(t),a&&(a._x_alreadyBound=!0),l&&(l._x_alreadyBound=!0),Object.defineProperty(i,r,{...s,get:a,set:l})}return!0}return!1})||{})[r],set:(n,r,i)=>{let o=e.find(a=>a.hasOwnProperty(r));return o?o[r]=i:e[e.length-1][r]=i,!0}});return t}function bt(e){let t=r=>typeof r=="object"&&!Array.isArray(r)&&r!==null,n=(r,i="")=>{Object.entries(Object.getOwnPropertyDescriptors(r)).forEach(([o,{value:a,enumerable:l}])=>{if(l===!1||a===void 0)return;let s=i===""?o:`${i}.${o}`;typeof a=="object"&&a!==null&&a._x_interceptor?r[o]=a.initialize(e,s,o):t(a)&&a!==r&&!(a instanceof Element)&&n(a,s)})};return n(e)}function wt(e,t=()=>{}){let n={initialValue:void 0,_x_interceptor:!0,initialize(r,i,o){return e(this.initialValue,()=>Yn(r,i),a=>Et(r,i,a),i,o)}};return t(n),r=>{if(typeof r=="object"&&r!==null&&r._x_interceptor){let i=n.initialize.bind(n);n.initialize=(o,a,l)=>{let s=r.initialize(o,a,l);return n.initialValue=s,i(o,a,l)}}else n.initialValue=r;return n}}function Yn(e,t){return t.split(".").reduce((n,r)=>n[r],e)}function Et(e,t,n){if(typeof t=="string"&&(t=t.split(".")),t.length===1)e[t[0]]=n;else{if(t.length===0)throw error;return e[t[0]]||(e[t[0]]={}),Et(e[t[0]],t.slice(1),n)}}var At={};function w(e,t){At[e]=t}function Te(e,t){return Object.entries(At).forEach(([n,r])=>{Object.defineProperty(e,`$${n}`,{get(){let[i,o]=jt(t);return i={interceptor:wt,...i},mt(t,o),r(t,i)},enumerable:!1})}),e}function Gn(e,t,n,...r){try{return n(...r)}catch(i){Z(i,e,t)}}function Z(e,t,n=void 0){Object.assign(e,{el:t,expression:n}),console.warn(`Alpine Expression Error: ${e.message} + +${n?'Expression: "'+n+`" + +`:""}`,t),setTimeout(()=>{throw e},0)}var oe=!0;function Qn(e){let t=oe;oe=!1,e(),oe=t}function q(e,t,n={}){let r;return y(e,t)(i=>r=i,n),r}function y(...e){return Ot(...e)}var Ot=kt;function Xn(e){Ot=e}function kt(e,t){let n={};Te(n,e);let r=[n,...z(e)],i=typeof t=="function"?er(r,t):nr(r,t,e);return Gn.bind(null,e,t,i)}function er(e,t){return(n=()=>{},{scope:r={},params:i=[]}={})=>{let o=t.apply(J([r,...e]),i);ae(n,o)}}var Re={};function tr(e,t){if(Re[e])return Re[e];let n=Object.getPrototypeOf(async function(){}).constructor,r=/^[\n\s]*if.*\(.*\)/.test(e)||/^(let|const)\s/.test(e)?`(async()=>{ ${e} })()`:e,i=(()=>{try{return new n(["__self","scope"],`with (scope) { __self.result = ${r} }; __self.finished = true; return __self.result;`)}catch(o){return Z(o,t,e),Promise.resolve()}})();return Re[e]=i,i}function nr(e,t,n){let r=tr(t,n);return(i=()=>{},{scope:o={},params:a=[]}={})=>{r.result=void 0,r.finished=!1;let l=J([o,...e]);if(typeof r=="function"){let s=r(r,l).catch(u=>Z(u,n,t));r.finished?(ae(i,r.result,l,a,n),r.result=void 0):s.then(u=>{ae(i,u,l,a,n)}).catch(u=>Z(u,n,t)).finally(()=>r.result=void 0)}}}function ae(e,t,n,r,i){if(oe&&typeof t=="function"){let o=t.apply(n,r);o instanceof Promise?o.then(a=>ae(e,a,n,r)).catch(a=>Z(a,i,t)):e(o)}else typeof t=="object"&&t instanceof Promise?t.then(o=>e(o)):e(t)}var Ie="x-";function B(e=""){return Ie+e}function rr(e){Ie=e}var De={};function m(e,t){return De[e]=t,{before(n){if(!De[n]){console.warn("Cannot find directive `${directive}`. `${name}` will use the default order of execution");return}let r=P.indexOf(n);P.splice(r>=0?r:P.indexOf("DEFAULT"),0,e)}}}function ze(e,t,n){if(t=Array.from(t),e._x_virtualDirectives){let i=Object.entries(e._x_virtualDirectives).map(([a,l])=>({name:a,value:l})),o=St(i);i=i.map(a=>o.find(l=>l.name===a.name)?{name:`x-bind:${a.name}`,value:`"${a.value}"`}:a),t=t.concat(i)}let r={};return t.map(Mt((i,o)=>r[i]=o)).filter(Lt).map(ar(r,n)).sort(lr).map(i=>or(e,i))}function St(e){return Array.from(e).map(Mt()).filter(t=>!Lt(t))}var qe=!1,Y=new Map,Ct=Symbol();function ir(e){qe=!0;let t=Symbol();Ct=t,Y.set(t,[]);let n=()=>{for(;Y.get(t).length;)Y.get(t).shift()();Y.delete(t)},r=()=>{qe=!1,n()};e(n),r()}function jt(e){let t=[],n=o=>t.push(o),[r,i]=Wn(e);return t.push(i),[{Alpine:te,effect:r,cleanup:n,evaluateLater:y.bind(y,e),evaluate:q.bind(q,e)},()=>t.forEach(o=>o())]}function or(e,t){let n=()=>{},r=De[t.type]||n,[i,o]=jt(e);Vn(e,t.original,o);let a=()=>{e._x_ignore||e._x_ignoreSelf||(r.inline&&r.inline(e,t,i),r=r.bind(r,e,t,i),qe?Y.get(Ct).push(r):r())};return a.runCleanups=o,a}var $t=(e,t)=>({name:n,value:r})=>(n.startsWith(e)&&(n=n.replace(e,t)),{name:n,value:r}),Nt=e=>e;function Mt(e=()=>{}){return({name:t,value:n})=>{let{name:r,value:i}=Pt.reduce((o,a)=>a(o),{name:t,value:n});return r!==t&&e(r,t),{name:r,value:i}}}var Pt=[];function Be(e){Pt.push(e)}function Lt({name:e}){return Tt().test(e)}var Tt=()=>new RegExp(`^${Ie}([^:^.]+)\\b`);function ar(e,t){return({name:n,value:r})=>{let i=n.match(Tt()),o=n.match(/:([a-zA-Z0-9\-:]+)/),a=n.match(/\.[^.\]]+(?=[^\]]*$)/g)||[],l=t||e[n]||n;return{type:i?i[1]:null,value:o?o[1]:null,modifiers:a.map(s=>s.replace(".","")),expression:r,original:l}}}var We="DEFAULT",P=["ignore","ref","data","id","bind","init","for","model","modelable","transition","show","if",We,"teleport"];function lr(e,t){let n=P.indexOf(e.type)===-1?We:e.type,r=P.indexOf(t.type)===-1?We:t.type;return P.indexOf(n)-P.indexOf(r)}function G(e,t,n={}){e.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0,cancelable:!0}))}function S(e,t){if(typeof ShadowRoot=="function"&&e instanceof ShadowRoot){Array.from(e.children).forEach(i=>S(i,t));return}let n=!1;if(t(e,()=>n=!0),n)return;let r=e.firstElementChild;for(;r;)S(r,t,!1),r=r.nextElementSibling}function W(e,...t){console.warn(`Alpine Warning: ${e}`,...t)}function sr(){document.body||W("Unable to initialize. Trying to load Alpine before `` is available. Did you forget to add `defer` in Alpine's `
AccountNext inActivePlacedFocusActions
ExampleStandbyYes 12114, 514Toggle Remove
Dummy3sYes 61919, 810Toggle Remove
+Painted Palette Web UI
AccountNext inActivePlacedFocusActions
ExampleStandbyYes 12114, 514Toggle Remove
Dummy3sYes 61919, 810Toggle Remove
IP info
ProxyIPCountryASNAS Name
IPCountryASNAS Name
Managed Stats
Accounts0
Placed Pixels0
Uptime0d 00:00:00

About

Version
Developed byLumière Élevé
Tested byLumière Élevé
Fauli1221
Starshine
Produced byLightingale Community
diff --git a/src/web/index.js b/src/web/index.js new file mode 100644 index 0000000..f211afc --- /dev/null +++ b/src/web/index.js @@ -0,0 +1,25 @@ +// Only place minimized files here +"use strict"; + +// Import common values +import {BuildInfo} from "../core/common.js"; + +// Initialize Alpine +import {} from "../../libs/alpinejs/alpine.js"; + +let infoThread = 0; + +// Some serious work +document.addEventListener("alpine:init", () => { + Alpine.store("buildInfo", BuildInfo); + infoThread = setInterval(async () => { + let data = await (await fetch("/info")).json(); + Alpine.store("info", { + ip: data.ip.ip || "127.0.0.1", + cc: data.ip.cc || "UN", + asn: data.ip.asn || 0, + as: data.ip.as || "Invalid ASN", + proxy: data.proxy + }); + }, 5000); +}); diff --git a/src/web/web.txt b/src/web/web.txt deleted file mode 100644 index 9dc4353..0000000 --- a/src/web/web.txt +++ /dev/null @@ -1,2 +0,0 @@ -// Only place minimized files here -"use strict";