@bananacool467/authtics-host 0.2.1 → 0.2.3

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 CHANGED
@@ -1,20 +1,17 @@
1
1
  # Authtics Host
2
2
 
3
- Version 0.2.1
3
+ Version 0.2.3
4
4
  License: MIT
5
5
 
6
6
  Authtics Host is a web framework inspired by Next.js. Authtics Host supports SSR (Server-Side Rendering) and uses esbuild. This is not to be confused with auth platforms.
7
7
 
8
8
  **(NOTE: The short name for Authtics Host is HostJS or Host.js)**
9
9
 
10
- **(Fixes we're applied on this version, babel support had to be removed)**
11
-
12
- **(From the Developer: I am having 2 small issues:**
10
+ **(From the Developer: I am having 1 small issue:**
13
11
 
14
12
  1. **Web Socket Connections** are **not showing** in the DevPanel's Network tab
15
- 2. The page doesnt **refresh properly**. (Have to refresh by doing: refresh -> cancel -> refresh to prevent halting)
16
13
 
17
- **I need help fixing those)**
14
+ **I need help fixing that)**
18
15
 
19
16
  ## Setting Up
20
17
 
@@ -233,7 +230,7 @@ export function Component() {
233
230
  The developer might also redesign the UI for the DevPanel using [UI Tools](https://npmjs.com/package/@bananakitssu/ui-tools).
234
231
 
235
232
  > **Warning**:
236
- > Asking AI about HostJS is not recommended, it will give an Auth platform and call HostJS/Authtics Host a typo, say it doesn't exist, say it was renamed, it is private, or the account doesn't exist. Or if it knows, it may swap your server script with regular **Node.js**/**ExpressJS**/**Next.js** or use **Next.js**-like code because this framework is **Next.js-inspired**
233
+ > Asking AI about HostJS is not recommended, it will give an Auth platform and call HostJS/Authtics Host a typo, say it doesn't exist, say it was renamed, it is private, or the account doesn't exist. Or if it knows, it may swap your server script with regular **Node.js**/**ExpressJS**/**Next.js** or use **Next.js-like** code because this framework is **Next.js-inspired**
237
234
 
238
235
  ## Developer Panel Notes And DAT (Developer Access Token)
239
236
 
package/dist/cli.d.ts CHANGED
@@ -3,6 +3,7 @@ import { IncomingMessage, ServerResponse } from "node:http";
3
3
  export default class App {
4
4
  server: any;
5
5
  constructor();
6
+ startServer(): Promise<void>;
6
7
  get(routePath: string, handler: (req: IncomingMessage, res: ServerResponse) => void): void;
7
8
  registerApp(route: string): void;
8
9
  post(routePath: string, handler: (req: IncomingMessage, res: ServerResponse) => void): void;
package/dist/cli.js CHANGED
@@ -139,7 +139,8 @@ async function getJsonBody(req) {
139
139
  export default class App {
140
140
  server;
141
141
  constructor() {
142
- this.server = start();
142
+ this.server = null;
143
+ this.startServer();
143
144
  this.post('/__authtics_host_apis__/set-users-paused', async (req, res) => {
144
145
  let datMatched = false;
145
146
  if (config_.dat && config_.dat == req.cookies.dat)
@@ -379,6 +380,14 @@ export default class App {
379
380
  }
380
381
  });
381
382
  }
383
+ async startServer() {
384
+ try {
385
+ this.server = await start();
386
+ }
387
+ catch (error) {
388
+ console.error("Server failed to start:", error);
389
+ }
390
+ }
382
391
  get(routePath, handler) {
383
392
  routes.set(`GET:${routePath}`, handler);
384
393
  }
package/dist/devPanel.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useState, useEffect, useRef } from 'react';
3
- import { ShieldCheck, CircleX, ChevronDown, ChevronUp, Bug, AlertTriangle, Info, ArrowLeft, Wifi, Terminal, Route, Globe, ChevronRight, ChevronLeft, Server, TriangleAlert, Eye, Zap } from 'lucide-react';
3
+ import { ShieldCheck, CircleX, ChevronDown, ChevronUp, Bug, AlertTriangle, Info, ArrowLeft, Wifi, Terminal, Route, Globe, ChevronRight, ChevronLeft, Server, TriangleAlert, Eye, Zap, Power } from 'lucide-react';
4
4
  function getCallerSource() {
5
5
  try {
6
6
  const stack = new Error().stack ?? '';
@@ -55,7 +55,8 @@ function Sparkline({ data, color, label, unit }) {
55
55
  return `${x},${y}`;
56
56
  }).join(' ');
57
57
  const latest = data[data.length - 1] ?? 0;
58
- return (_jsxs("div", { style: { background: '#fff', borderRadius: '8px', border: '1px solid #eee', padding: '8px 10px' }, children: [_jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '4px' }, children: [_jsx("span", { style: { fontSize: '10px', color: '#888' }, children: label }), _jsxs("span", { style: { fontSize: '11px', fontFamily: 'monospace', color }, children: [latest, unit] })] }), _jsxs("svg", { width: W, height: H, style: { display: 'block', overflow: 'visible' }, children: [_jsx("defs", { children: _jsxs("linearGradient", { id: `grad-${label}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [_jsx("stop", { offset: "0%", stopColor: color, stopOpacity: "0.18" }), _jsx("stop", { offset: "100%", stopColor: color, stopOpacity: "0.01" })] }) }), data.length > 1 && (_jsxs(_Fragment, { children: [_jsx("polygon", { points: `0,${H} ${points} ${W},${H}`, fill: `url(#grad-${label})` }), _jsx("polyline", { points: points, fill: "none", stroke: color, strokeWidth: "1.5", strokeLinejoin: "round", strokeLinecap: "round" }), (() => {
58
+ const id = `grad-${label.replace(' ', '').toLowerCase()}`;
59
+ return (_jsxs("div", { style: { background: '#fff', borderRadius: '8px', border: '1px solid #eee', padding: '8px 10px' }, children: [_jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '4px' }, children: [_jsx("span", { style: { fontSize: '10px', color: '#888' }, children: label }), _jsxs("span", { style: { fontSize: '11px', fontFamily: 'monospace', color }, children: [latest, unit] })] }), _jsxs("svg", { width: W, height: H, style: { display: 'block', overflow: 'visible' }, children: [_jsx("defs", { children: _jsxs("linearGradient", { id: id, x1: "0", y1: "0", x2: "0", y2: "1", children: [_jsx("stop", { offset: "0%", stopColor: color, stopOpacity: "0.18" }), _jsx("stop", { offset: "100%", stopColor: color, stopOpacity: "0.01" })] }) }), data.length > 1 && (_jsxs(_Fragment, { children: [_jsx("polygon", { points: `0,${H} ${points} ${W},${H}`, fill: `url(#${id})` }), _jsx("polyline", { points: points, fill: "none", stroke: color, strokeWidth: "1.5", strokeLinejoin: "round", strokeLinecap: "round" }), (() => {
59
60
  const last = points.split(' ').pop().split(',');
60
61
  return _jsx("circle", { cx: last[0], cy: last[1], r: "2.5", fill: color });
61
62
  })()] }))] })] }));
@@ -294,9 +295,12 @@ function installConsoleInterceptor() {
294
295
  });
295
296
  }
296
297
  function SecuredTab() {
297
- return (_jsxs("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column', padding: '10px 10px', textAlign: 'center', gap: '8px' }, children: [_jsx(CircleX, { size: 32, color: 'red' }), _jsx("span", { style: { color: 'red', fontSize: 24 }, children: "This Tab Is Currently Not Accessible" }), _jsx("span", { style: { color: 'red', fontSize: 12 }, children: "To access this tab, you need to set \"dat\" in the Authtics Host config to set restriction and then restart." })] }));
298
+ return (_jsxs("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column', padding: '10px 10px', textAlign: 'center', gap: '8px' }, children: [_jsx(CircleX, { size: 32, color: '#ff7d7d' }), _jsx("span", { style: { color: '#ff7d7d', fontSize: 24 }, children: "This tab is currently not accessible" }), _jsx("span", { style: { color: '#ff7d7d', fontSize: 12 }, children: "To access this tab, you need to set \"dat\" to your current DAT in the Authtics Host config to set restriction and then restart." })] }));
298
299
  }
299
- function PanelButton({ onClick, onClick2, children, style, fullWidth, disabled }) {
300
+ function ShutdownTab() {
301
+ return (_jsxs("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column', padding: '10px 10px', textAlign: 'center', gap: '8px' }, children: [_jsx(Power, { size: 32, color: 'grey' }), _jsx("span", { style: { color: 'grey', fontSize: 24 }, children: "The server was shutdown by you." })] }));
302
+ }
303
+ function PanelButton({ onClick, onClick2, children, style, fullWidth, disabled, background }) {
300
304
  const [hovered, setHovered] = useState(false);
301
305
  const [pressed, setPressed] = useState(false);
302
306
  return (_jsx("div", { onClick: (e) => {
@@ -317,7 +321,13 @@ function PanelButton({ onClick, onClick2, children, style, fullWidth, disabled }
317
321
  width: fullWidth ? '100%' : undefined,
318
322
  boxSizing: 'border-box',
319
323
  userSelect: 'none',
320
- background: pressed ? 'rgba(0,0,0,0.12)' : hovered ? 'rgba(0,0,0,0.06)' : 'rgba(0,0,0,0.03)',
324
+ background: disabled
325
+ ? '#bdbdbd'
326
+ : pressed
327
+ ? `color-mix(in srgb, ${background} 12%, transparent)`
328
+ : hovered
329
+ ? `color-mix(in srgb, ${background} 6%, transparent)`
330
+ : background ?? '#fff',
321
331
  transition: 'background 0.15s ease',
322
332
  ...style,
323
333
  }, children: children }));
@@ -339,6 +349,8 @@ export default function DevPanel() {
339
349
  const [clientInfoOpen, setClientInfoOpen] = useState(false);
340
350
  const [aboutHostOpen, setAboutHostOpen] = useState(false);
341
351
  const [serverInfoOpen, setServerInfoOpen] = useState(false);
352
+ const [shutdown, setShutdown] = useState(false);
353
+ const [shuttingDown, setShuttingDown] = useState(false);
342
354
  const [hasIssue, setHasIssue] = useState(false);
343
355
  const [ping__, setPing__] = useState(0);
344
356
  const [networkFetches, setNetworkFetches] = useState([]);
@@ -565,19 +577,21 @@ export default function DevPanel() {
565
577
  });
566
578
  };
567
579
  const shutDown = async () => {
580
+ setShuttingDown(true);
568
581
  await fetch('/__authtics_host_apis__/shutdown', {
569
582
  method: 'POST',
570
583
  headers: { 'Content-Type': 'application/json' },
571
584
  body: JSON.stringify({})
572
585
  });
586
+ setShutdown(true);
573
587
  };
574
588
  useEffect(() => {
575
589
  const animationId = requestAnimationFrame(loop);
576
590
  const intervalId = setInterval(() => {
577
591
  if (fpsSpanRef.current) {
578
592
  fpsSpanRef.current.textContent = frameCount.current.toString();
579
- frames.current = frameCount.current;
580
593
  }
594
+ frames.current = frameCount.current;
581
595
  frameCount.current = 0;
582
596
  }, 1000);
583
597
  return () => {
@@ -591,6 +605,7 @@ export default function DevPanel() {
591
605
  const [receivedHistory, setReceivedHistory] = useState(Array(MAX_POINTS).fill(0));
592
606
  const [cpuUsageHistory, setCpuUsageHistory] = useState(Array(MAX_POINTS).fill(0));
593
607
  const [heapUsageHistory, setHeapUsageHistory] = useState(Array(MAX_POINTS).fill(0));
608
+ const [fpsHistory, setFpsHistory] = useState(Array(MAX_POINTS).fill(0));
594
609
  const drawerHeight = !open
595
610
  ? '0px'
596
611
  : consoleOpen || networkOpen || routeOpen || webpageInfoOpen || clientInfoOpen || aboutHostOpen
@@ -621,6 +636,7 @@ export default function DevPanel() {
621
636
  const r = pendingReceived.current;
622
637
  const c = cpuUsage.current;
623
638
  const h = heapUsage.current;
639
+ const f = frames.current;
624
640
  pendingSent.current = 0;
625
641
  pendingReceived.current = 0;
626
642
  cpuUsage.current = 0;
@@ -629,19 +645,20 @@ export default function DevPanel() {
629
645
  setHeapUsageHistory(prev => [...prev.slice(-(MAX_POINTS - 1)), h]);
630
646
  setSentHistory(prev => [...prev.slice(-(MAX_POINTS - 1)), s]);
631
647
  setReceivedHistory(prev => [...prev.slice(-(MAX_POINTS - 1)), r]);
648
+ setFpsHistory(prev => [...prev.slice(-(MAX_POINTS - 1)), f]);
632
649
  }, 1000);
633
650
  return () => clearInterval(interval);
634
651
  }, []);
635
652
  useEffect(() => {
636
653
  installConsoleInterceptor();
637
- installNetworkInterceptor((f) => setNetworkFetches(prev => [...prev.slice(-49), f]), (f) => setNetworkFetches(prev => prev.map(p => p.id === f.id ? f : p)), (f) => setEventSources(prev => [...prev.slice(-49), f]), (f) => setEventSources(prev => prev.map(p => p.id === f.id ? f : p)), (f) => setWebSockets(prev => [...prev.slice(-49), f]), (f) => setWebSockets(prev => prev.map(p => p.id === f.id ? f : p)), (f) => setResourcesFound(prev => [...prev.slice(-49), f]), (f) => setResourcesFound(prev => prev.map(p => p.id === f.id ? f : p)), (f) => setResourcesFound(prev => prev.filter(p => p.id !== f.id)), (sent) => {
654
+ installNetworkInterceptor((f) => setNetworkFetches(prev => [...prev.slice(-499), f]), (f) => setNetworkFetches(prev => prev.map(p => p.id === f.id ? f : p)), (f) => setEventSources(prev => [...prev.slice(-499), f]), (f) => setEventSources(prev => prev.map(p => p.id === f.id ? f : p)), (f) => setWebSockets(prev => [...prev.slice(-499), f]), (f) => setWebSockets(prev => prev.map(p => p.id === f.id ? f : p)), (f) => setResourcesFound(prev => [...prev.slice(-499), f]), (f) => setResourcesFound(prev => prev.map(p => p.id === f.id ? f : p)), (f) => setResourcesFound(prev => prev.filter(p => p.id !== f.id)), (sent) => {
638
655
  pendingSent.current += sent;
639
656
  }, (received) => {
640
657
  pendingReceived.current += received;
641
658
  });
642
659
  const handler = (e) => {
643
660
  const detail = e.detail;
644
- setLogs(prev => [...prev.slice(-99), { ...detail, id: Date.now() + Math.random() }]);
661
+ setLogs(prev => [...prev.slice(-19999), { ...detail, id: Date.now() + Math.random() }]);
645
662
  if (detail.type === 'Error') {
646
663
  setHasIssue(true);
647
664
  setErrorMsgs(prev => [...prev, detail.message]);
@@ -650,7 +667,11 @@ export default function DevPanel() {
650
667
  ;
651
668
  };
652
669
  try {
653
- const existingToken = cookie.get('dat');
670
+ let existingToken = null;
671
+ try {
672
+ existingToken = localStorage.getItem('dat');
673
+ }
674
+ catch (e) { }
654
675
  if (existingToken) {
655
676
  setToken(existingToken);
656
677
  let length_ = existingToken?.split('');
@@ -846,6 +867,7 @@ export default function DevPanel() {
846
867
  flexDirection: 'column',
847
868
  alignItems: 'flex-end',
848
869
  gap: '8px',
870
+ pointerEvents: 'none',
849
871
  }, children: [_jsx("div", { style: {
850
872
  maxHeight: drawerHeight,
851
873
  opacity: open ? 1 : 0,
@@ -853,9 +875,9 @@ export default function DevPanel() {
853
875
  overflow: (!consoleOpen && !networkOpen && !aboutHostOpen && !webpageInfoOpen && !clientInfoOpen ? 'hidden auto' : 'hidden'),
854
876
  borderRadius: '10px',
855
877
  transition: 'max-height 0.35s ease, opacity 0.25s ease',
856
- }, children: _jsx("div", { style: {
878
+ border: '1px solid #e6e3e3',
879
+ }, children: _jsxs("div", { style: {
857
880
  background: '#f7f7f7',
858
- border: '1px solid #e6e3e3',
859
881
  borderRadius: '10px',
860
882
  width: '320px',
861
883
  display: 'flex',
@@ -863,349 +885,344 @@ export default function DevPanel() {
863
885
  boxShadow: '0 8px 32px rgba(0,0,0,0.15)',
864
886
  boxSizing: 'border-box',
865
887
  overflow: 'hidden',
866
- }, children: consoleOpen ? (_jsxs(_Fragment, { children: [_jsxs("div", { style: {
867
- padding: '6px 8px',
868
- borderBottom: '1px solid #ddd',
869
- background: '#fff',
870
- display: 'flex',
871
- alignItems: 'center',
872
- gap: '6px',
873
- }, children: [_jsxs(PanelButton, { onClick: () => setConsoleOpen(false), style: { color: '#555' }, children: [_jsx(ArrowLeft, { size: 12 }), " Back"] }), _jsxs("span", { style: { fontSize: '12px', display: 'flex', alignItems: 'center', gap: '4px', color: '#333' }, children: [_jsx(Terminal, { size: 12, color: "#16a34a" }), " Console"] }), _jsxs("span", { style: { fontSize: '10px', color: '#aaa', marginLeft: '2px' }, children: [filteredLogs.length, " message", filteredLogs.length !== 1 ? 's' : '', " shown, ", logs.length, " in total"] }), _jsx(PanelButton, { onClick: () => setLogs([]), style: { color: '#aaa', marginLeft: 'auto' }, children: "Clear" })] }), _jsx("div", { style: {
874
- display: 'flex',
875
- gap: '4px',
876
- padding: '5px 8px',
877
- borderBottom: '1px solid #eee',
878
- background: '#fafafa',
879
- flexWrap: 'wrap',
880
- }, children: [...LOG_TYPES].map(type => (_jsxs("label", { style: {
888
+ }, children: [shutdown ? (_jsx(ShutdownTab, {})) : (_jsx(_Fragment, {})), consoleOpen && !shutdown ? (_jsxs(_Fragment, { children: [_jsxs("div", { style: {
889
+ padding: '6px 8px',
890
+ borderBottom: '1px solid #ddd',
891
+ background: '#fff',
881
892
  display: 'flex',
882
893
  alignItems: 'center',
883
- gap: '3px',
884
- fontSize: '10px',
885
- color: filters[type] ? FILTER_COLORS[type] : '#bbb',
886
- cursor: 'pointer',
887
- padding: '2px 6px',
888
- borderRadius: '10px',
889
- background: filters[type] ? `${FILTER_COLORS[type]}18` : 'transparent',
890
- border: `1px solid ${filters[type] ? FILTER_COLORS[type] + '44' : '#e0e0e0'}`,
891
- transition: 'all 0.15s ease',
892
- userSelect: 'none',
893
- }, children: [_jsx("input", { type: "checkbox", checked: filters[type], onChange: () => toggleFilter(type), style: { display: 'none' } }), type] }, type))) }), _jsx("div", { style: { overflowY: 'auto', maxHeight: '220px' }, ref: consoleScrollRef, onScroll: handleScroll, children: filteredLogs.length === 0
894
- ? _jsx("div", { style: { padding: '16px 12px', color: '#aaa', fontSize: '12px' }, children: "No logs yet." })
895
- : [...filteredLogs].map(log => {
896
- const s = TYPE_STYLE[log.type];
897
- return (_jsxs("div", { style: {
898
- display: 'flex',
899
- gap: '8px',
900
- padding: '5px 10px',
901
- background: s.bg,
902
- borderBottom: '1px solid #f0f0f0',
903
- alignItems: 'flex-start',
904
- }, children: [s.icon && (_jsx("span", { style: { color: s.color, marginTop: '1px', flexShrink: 0, display: 'flex' }, children: s.icon })), _jsx("span", { style: {
905
- color: s.textColor ?? '#555',
906
- fontSize: '11px',
907
- fontFamily: 'monospace',
908
- wordBreak: 'break-all',
909
- }, children: log.message })] }, log.id));
910
- }) })] })) : networkOpen ? (_jsxs(_Fragment, { children: [_jsxs("div", { style: {
911
- padding: '6px 8px',
912
- borderBottom: '1px solid #ddd',
913
- background: '#fff',
914
- display: 'flex',
915
- alignItems: 'center',
916
- gap: '6px',
917
- }, children: [_jsxs(PanelButton, { onClick: () => setNetworkOpen(false), style: { color: '#555' }, children: [_jsx(ArrowLeft, { size: 12 }), " Back"] }), _jsxs("span", { style: { fontSize: '12px', display: 'flex', alignItems: 'center', gap: '4px', color: '#333' }, children: [_jsx(Wifi, { size: 12, color: "#3b82f6" }), " Network"] })] }), _jsxs("div", { style: { overflowY: 'auto', maxHeight: '260px', padding: '10px', display: 'flex', flexDirection: 'column', gap: '8px' }, children: [_jsxs("div", { style: {
894
+ gap: '6px',
895
+ }, children: [_jsxs(PanelButton, { onClick: () => setConsoleOpen(false), style: { color: '#555' }, children: [_jsx(ArrowLeft, { size: 12 }), " Back"] }), _jsxs("span", { style: { fontSize: '12px', display: 'flex', alignItems: 'center', gap: '4px', color: '#333' }, children: [_jsx(Terminal, { size: 12, color: "#16a34a" }), " Console"] }), _jsxs("span", { style: { fontSize: '10px', color: '#aaa', marginLeft: '2px' }, children: [filteredLogs.length, " message", filteredLogs.length !== 1 ? 's' : '', " shown, ", logs.length, " in total"] }), _jsx(PanelButton, { onClick: () => setLogs([]), style: { color: '#aaa', marginLeft: 'auto' }, children: "Clear" })] }), _jsx("div", { style: {
896
+ display: 'flex',
897
+ gap: '4px',
898
+ padding: '5px 8px',
899
+ borderBottom: '1px solid #eee',
900
+ background: '#fafafa',
901
+ flexWrap: 'wrap',
902
+ }, children: [...LOG_TYPES].map(type => (_jsxs("label", { style: {
918
903
  display: 'flex',
919
- justifyContent: 'space-between',
920
- padding: '6px 10px',
921
- background: '#fff',
904
+ alignItems: 'center',
905
+ gap: '3px',
906
+ fontSize: '10px',
907
+ color: filters[type] ? FILTER_COLORS[type] : '#bbb',
908
+ cursor: 'pointer',
909
+ padding: '2px 6px',
922
910
  borderRadius: '10px',
923
- border: '1px solid #eee',
924
- fontSize: '12px',
925
- color: '#333',
926
- }, children: [_jsx("span", { children: "Ping" }), _jsx("span", { style: { color: ping__ < 100 ? '#16a34a' : ping__ < 300 ? '#d97706' : '#e53e3e', fontFamily: 'monospace' }, children: ping__ > 0 ? `${ping__}ms` : '??ms' })] }), datRestrictionMissing ? (_jsxs("span", { style: { display: 'flex', opacity: 0.5, fontSize: 10, justifyContent: 'center', alignItems: 'center', gap: '4px' }, children: [_jsx(Info, { size: 10 }), "this analytic is unavaliable. Set \"dat\" in the Authtics Host config to set restriction and then restart."] })) : (_jsx(_Fragment, {})), _jsx(Sparkline, { data: receivedHistory, color: "#3b82f6", label: "Received", unit: " bytes" }), _jsx(Sparkline, { data: sentHistory, color: "#16a34a", label: "Sent", unit: " bytes" }), _jsxs("span", { style: { fontSize: '15px', color: '#333', fontWeight: 'bold' }, children: ["Fetches \u2014 ", networkFetches.length, " total fetches"] }), networkFetches.length === 0
927
- ? _jsx("div", { style: { color: '#aaa', fontSize: '12px', padding: '4px 2px' }, children: "No network requests yet." })
928
- : [...networkFetches].reverse().map((f, i) => (_jsxs("div", { style: {
911
+ background: filters[type] ? `${FILTER_COLORS[type]}18` : 'transparent',
912
+ border: `1px solid ${filters[type] ? FILTER_COLORS[type] + '44' : '#e0e0e0'}`,
913
+ transition: 'all 0.15s ease',
914
+ userSelect: 'none',
915
+ }, children: [_jsx("input", { type: "checkbox", checked: filters[type], onChange: () => toggleFilter(type), style: { display: 'none' } }), type] }, type))) }), _jsx("div", { style: { overflowY: 'auto', maxHeight: '220px' }, ref: consoleScrollRef, onScroll: handleScroll, children: filteredLogs.length === 0
916
+ ? _jsx("div", { style: { padding: '16px 12px', color: '#aaa', fontSize: '12px' }, children: "No logs yet." })
917
+ : [...filteredLogs].map(log => {
918
+ const s = TYPE_STYLE[log.type];
919
+ return (_jsxs("div", { style: {
920
+ display: 'flex',
921
+ gap: '8px',
922
+ padding: '5px 10px',
923
+ background: s.bg,
924
+ borderBottom: '1px solid #f0f0f0',
925
+ alignItems: 'flex-start',
926
+ }, children: [s.icon && (_jsx("span", { style: { color: s.color, marginTop: '1px', flexShrink: 0, display: 'flex' }, children: s.icon })), _jsx("span", { style: {
927
+ color: s.textColor ?? '#555',
928
+ fontSize: '11px',
929
+ fontFamily: 'monospace',
930
+ wordBreak: 'break-all',
931
+ }, children: log.message })] }, log.id));
932
+ }) })] })) : networkOpen && !shutdown ? (_jsxs(_Fragment, { children: [_jsxs("div", { style: {
933
+ padding: '6px 8px',
934
+ borderBottom: '1px solid #ddd',
935
+ background: '#fff',
936
+ display: 'flex',
937
+ alignItems: 'center',
938
+ gap: '6px',
939
+ }, children: [_jsxs(PanelButton, { onClick: () => setNetworkOpen(false), style: { color: '#555' }, children: [_jsx(ArrowLeft, { size: 12 }), " Back"] }), _jsxs("span", { style: { fontSize: '12px', display: 'flex', alignItems: 'center', gap: '4px', color: '#333' }, children: [_jsx(Wifi, { size: 12, color: "#3b82f6" }), " Network"] })] }), _jsxs("div", { style: { overflowY: 'auto', maxHeight: '260px', padding: '10px', display: 'flex', flexDirection: 'column', gap: '8px' }, children: [_jsxs("div", { style: {
940
+ display: 'flex',
941
+ justifyContent: 'space-between',
942
+ padding: '6px 10px',
929
943
  background: '#fff',
944
+ borderRadius: '10px',
945
+ border: '1px solid #eee',
946
+ fontSize: '12px',
947
+ color: '#333',
948
+ }, children: [_jsx("span", { children: "Ping" }), _jsx("span", { style: { color: ping__ < 100 ? '#16a34a' : ping__ < 300 ? '#d97706' : '#e53e3e', fontFamily: 'monospace' }, children: ping__ > 0 ? `${ping__}ms` : '??ms' })] }), datRestrictionMissing ? (_jsxs("span", { style: { display: 'flex', opacity: 0.5, fontSize: 10, justifyContent: 'center', alignItems: 'center', gap: '8px' }, children: [_jsx(Info, { size: 30 }), "This analytic is unavaliable. Set \"dat\" to your current DAT in the Authtics Host config to set restriction and then restart."] })) : (_jsx(_Fragment, {})), _jsx(Sparkline, { data: receivedHistory, color: "#3b82f6", label: "Received", unit: " bytes" }), _jsx(Sparkline, { data: sentHistory, color: "#16a34a", label: "Sent", unit: " bytes" }), _jsxs("span", { style: { fontSize: '15px', color: '#333', fontWeight: 'bold' }, children: ["Fetches \u2014 ", networkFetches.length, " total fetches"] }), networkFetches.length === 0
949
+ ? _jsx("div", { style: { color: '#aaa', fontSize: '12px', padding: '4px 2px' }, children: "No network requests yet." })
950
+ : [...networkFetches].reverse().map((f, i) => (_jsxs("div", { style: {
951
+ background: '#fff',
952
+ display: 'flex',
953
+ flexDirection: 'column',
954
+ borderRadius: '10px',
955
+ border: '1px solid #eee',
956
+ fontSize: '11px',
957
+ fontFamily: 'monospace',
958
+ whiteSpace: 'normal',
959
+ wordBreak: 'break-word',
960
+ }, children: [_jsxs("div", { style: { display: 'flex',
961
+ justifyContent: 'space-between', gap: '8px', padding: '6px 10px', borderBottom: '1px solid #eee' }, children: [_jsx("span", { style: { color: '#3b82f6' }, children: f.method }), _jsx("span", { style: { flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', color: '#333' }, children: f.url }), _jsx("span", { style: { color: f.status ? (f.status < 400 ? '#16a34a' : '#e53e3e') : 'orange' }, children: f.status || "Awaiting for response..." })] }), f.method === "POST" && f.sent?.trim() ? (_jsxs("div", { style: { padding: '10px 10px', display: 'flex', flexDirection: 'column', gap: '8px' }, children: [_jsx("p", { style: { color: 'orange', fontFamily: 'system-ui, sans-serif', margin: 0 }, children: "Sent: " }), _jsx("div", { children: f.sent })] })) : (_jsx(_Fragment, {})), _jsxs("div", { style: { padding: '10px 10px', display: 'flex', flexDirection: 'column', gap: '8px' }, children: [_jsx("p", { style: { color: 'green', fontFamily: 'system-ui, sans-serif', margin: 0 }, children: "Received: " }), _jsx(TruncatedText, { content: f.response || "...", id: `${f.id}_fetch` })] }), f.response ? (f.response.split('').length > 100 ? (_jsxs(PanelButton, { onClick2: (e) => { const obj___ = document.getElementById(`${f.id}_fetch`); if (obj___ && !obj___.hasAttribute('expanded')) {
962
+ obj___.innerText = f.response;
963
+ obj___.setAttribute('expanded', '');
964
+ e.currentTarget.innerText = 'View less';
965
+ }
966
+ else if (obj___ && obj___.hasAttribute('expanded')) {
967
+ obj___.innerText = f.response?.slice(0, 100) + "...";
968
+ obj___.removeAttribute('expanded');
969
+ e.currentTarget.innerText = `View more (${f.response ? (f.response.split('').length - 100) : 0} bytes hidden)`;
970
+ } }, style: { padding: '8px 10px', borderRadius: '10px', background: '#34a8eb', color: '#fff', border: 'none', cursor: 'pointer', margin: '10px', textAlign: 'center', fontFamily: 'system-ui, sans-serif' }, children: ["View more (", f.response ? (f.response.split('').length - 100) : 0, " bytes hidden)"] })) : (_jsx(_Fragment, {}))) : (_jsx(_Fragment, {}))] }, i))), _jsx("span", { style: { fontSize: '15px', color: '#333', fontWeight: 'bold' }, children: "Active connections" }), eventSources.length === 0 ? (_jsx("div", { style: { color: '#aaa', fontSize: '12px', padding: '4px 2px' }, children: "No active connections." })) :
971
+ [...eventSources, ...webSockets].reverse().map((es, i) => (_jsx("div", { style: {
972
+ background: '#fff',
973
+ display: 'flex',
974
+ flexDirection: 'column',
975
+ borderRadius: '10px',
976
+ border: '1px solid #eee',
977
+ fontSize: '11px',
978
+ fontFamily: 'monospace'
979
+ }, children: _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', gap: '8px', padding: '6px 10px' }, children: [_jsxs("span", { style: { color: '#3b82f6', display: 'flex', gap: '4px', justifyContent: 'center', alignItems: 'center' }, children: [es.type === "EventSource" ? _jsx(Zap, { color: "green", size: 12 }) : es.type === "WebSocket" ? _jsx(Globe, { color: "green", size: 12 }) : _jsx(_Fragment, {}), es.type === "EventSource" ? "Event Source" : es.type === "WebSocket" ? "Web Socket" : "???"] }), _jsx("span", { style: { flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', color: '#333' }, children: es.url }), _jsx("span", { style: { color: es.status === 'Connected' ? '#16a34a' : es.status === 'Disconnected' ? '#e53e3e' : 'orange' }, children: es.status === 'Connected' ? 'Active' : es.status === 'Disconnected' ? 'Disconnected' : es.status === 'Connecting...' ? '...' : es.status === 'Connection Failed' ? 'Failed' : 'Unknown' })] }) }, i))), _jsxs("span", { style: { fontSize: '15px', color: '#333', fontWeight: 'bold' }, children: ["Resources Found \u2014 ", resourcesFound.length, " total resources"] }), resourcesFound.length === 0 ? (_jsx("div", { style: { color: '#aaa', fontSize: '12px', padding: '4px 2px' }, children: "No resources found." })) :
980
+ [...resourcesFound].reverse().map((r, i) => (_jsx("div", { style: {
981
+ background: '#fff',
982
+ display: 'flex',
983
+ flexDirection: 'column',
984
+ borderRadius: '10px',
985
+ border: '1px solid #eee',
986
+ fontSize: '11px',
987
+ fontFamily: 'monospace',
988
+ whiteSpace: 'normal',
989
+ wordBreak: 'break-word',
990
+ }, children: _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', gap: '8px', padding: '6px 10px' }, children: [_jsx("span", { style: { color: '#3b82f6', display: 'flex', gap: '4px', justifyContent: 'center', alignItems: 'center' }, children: r.type }), _jsx("span", { style: { flex: 1, color: '#333' }, children: r.url })] }) }, i)))] })] })) : routeOpen && !shutdown ? (_jsxs(_Fragment, { children: [_jsxs("div", { style: {
991
+ padding: '6px 8px',
992
+ borderBottom: '1px solid #ddd',
993
+ background: '#fff',
994
+ display: 'flex',
995
+ alignItems: 'center',
996
+ gap: '6px',
997
+ }, children: [_jsxs(PanelButton, { onClick: () => setRouteOpen(false), style: { color: '#555' }, children: [_jsx(ArrowLeft, { size: 12 }), " Back"] }), _jsxs("span", { style: { fontSize: '12px', display: 'flex', alignItems: 'center', gap: '4px', color: '#333' }, children: [_jsx(Route, { size: 12, color: "#3b82f6" }), " Route"] }), _jsx("span", { style: { fontSize: '10px', color: '#aaa', marginLeft: '2px' }, children: pathName })] }), datRestrictionMissing ? (_jsx(SecuredTab, {})) : (_jsx(_Fragment, {})), _jsxs("div", { style: { overflowY: 'auto', maxHeight: '260px', padding: '10px', display: (datRestrictionMissing ? 'none' : 'flex'), flexDirection: 'column', gap: '8px' }, children: [_jsx("span", { style: { fontSize: '24px', color: '#333', fontWeight: 'bold' }, children: pathName }), _jsxs("div", { style: {
930
998
  display: 'flex',
931
- flexDirection: 'column',
999
+ justifyContent: 'space-between',
1000
+ padding: '6px 10px',
1001
+ background: '#fff',
932
1002
  borderRadius: '10px',
933
1003
  border: '1px solid #eee',
934
- fontSize: '11px',
935
- fontFamily: 'monospace',
936
- }, children: [_jsxs("div", { style: { display: 'flex',
937
- justifyContent: 'space-between', gap: '8px', padding: '6px 10px', borderBottom: '1px solid #eee' }, children: [_jsx("span", { style: { color: '#3b82f6' }, children: f.method }), _jsx("span", { style: { flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', color: '#333' }, children: f.url }), _jsx("span", { style: { color: f.status ? (f.status < 400 ? '#16a34a' : '#e53e3e') : 'orange' }, children: f.status || "Awaiting for response..." })] }), f.method === "POST" ? (_jsxs("div", { style: { padding: '10px 10px', display: 'flex', flexDirection: 'column', gap: '8px' }, children: [_jsx("p", { style: { color: 'orange', fontFamily: 'system-ui, sans-serif', margin: 0 }, children: "Sent: " }), _jsx("div", { children: f.sent })] })) : (_jsx(_Fragment, {})), _jsxs("div", { style: { padding: '10px 10px', display: 'flex', flexDirection: 'column', gap: '8px' }, children: [_jsx("p", { style: { color: 'green', fontFamily: 'system-ui, sans-serif', margin: 0 }, children: "Received: " }), _jsx(TruncatedText, { content: f.response || "...", id: `${f.id}_fetch` })] }), f.response ? (f.response.split('').length > 100 ? (_jsxs(PanelButton, { onClick2: (e) => { const obj___ = document.getElementById(`${f.id}_fetch`); if (obj___ && !obj___.hasAttribute('expanded')) {
938
- obj___.innerText = f.response;
939
- obj___.setAttribute('expanded', '');
940
- e.currentTarget.innerText = 'View less';
941
- }
942
- else if (obj___ && obj___.hasAttribute('expanded')) {
943
- obj___.innerText = f.response?.slice(0, 100) + "...";
944
- obj___.removeAttribute('expanded');
945
- e.currentTarget.innerText = `View more (${f.response ? (f.response.split('').length - 100) : 0} bytes hidden)`;
946
- } }, style: { padding: '8px 10px', borderRadius: '10px', background: '#34a8eb', color: '#fff', border: 'none', cursor: 'pointer', margin: '10px', textAlign: 'center', fontFamily: 'system-ui, sans-serif' }, children: ["View more (", f.response ? (f.response.split('').length - 100) : 0, " bytes hidden)"] })) : (_jsx(_Fragment, {}))) : (_jsx(_Fragment, {}))] }, i))), _jsx("span", { style: { fontSize: '15px', color: '#333', fontWeight: 'bold' }, children: "Active connections" }), eventSources.length === 0 ? (_jsx("div", { style: { color: '#aaa', fontSize: '12px', padding: '4px 2px' }, children: "No active connections." })) :
947
- [...eventSources, ...webSockets].reverse().map((es, i) => (_jsx("div", { style: {
1004
+ fontSize: '12px',
1005
+ color: '#333',
1006
+ }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Load Status Code" }), _jsx("span", { style: { color: status === 200 ? '#16a34a' : '#e53e3e', fontFamily: 'monospace' }, children: status })] }), _jsxs("div", { style: {
1007
+ display: 'flex',
1008
+ justifyContent: 'space-between',
1009
+ padding: '6px 10px',
948
1010
  background: '#fff',
1011
+ borderRadius: '10px',
1012
+ border: '1px solid #eee',
1013
+ fontSize: '12px',
1014
+ color: '#333',
1015
+ }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "File Path" }), _jsx("span", { style: { color: 'blue', fontFamily: 'monospace' }, children: path })] }), _jsxs("div", { style: {
949
1016
  display: 'flex',
950
- flexDirection: 'column',
1017
+ justifyContent: 'space-between',
1018
+ padding: '6px 10px',
1019
+ background: '#fff',
951
1020
  borderRadius: '10px',
952
1021
  border: '1px solid #eee',
953
- fontSize: '11px',
954
- fontFamily: 'monospace'
955
- }, children: _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', gap: '8px', padding: '6px 10px' }, children: [_jsxs("span", { style: { color: '#3b82f6', display: 'flex', gap: '4px', justifyContent: 'center', alignItems: 'center' }, children: [es.type === "EventSource" ? _jsx(Zap, { color: "green", size: 12 }) : es.type === "WebSocket" ? _jsx(Globe, { color: "green", size: 12 }) : _jsx(_Fragment, {}), es.type === "EventSource" ? "Event Source" : es.type === "WebSocket" ? "Web Socket" : "???"] }), _jsx("span", { style: { flex: 1, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', color: '#333' }, children: es.url }), _jsx("span", { style: { color: es.status === 'Connected' ? '#16a34a' : es.status === 'Disconnected' ? '#e53e3e' : 'orange' }, children: es.status === 'Connected' ? 'Active' : es.status === 'Disconnected' ? 'Disconnected' : es.status === 'Connecting...' ? '...' : es.status === 'Connection Failed' ? 'Failed' : 'Unknown' })] }) }, i))), _jsxs("span", { style: { fontSize: '15px', color: '#333', fontWeight: 'bold' }, children: ["Resources Found \u2014 ", resourcesFound.length, " total resources"] }), resourcesFound.length === 0 ? (_jsx("div", { style: { color: '#aaa', fontSize: '12px', padding: '4px 2px' }, children: "No resources found." })) :
956
- [...resourcesFound].reverse().map((r, i) => (_jsx("div", { style: {
1022
+ fontSize: '12px',
1023
+ color: '#333',
1024
+ }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "File Name" }), _jsx("span", { style: { color: 'blue', fontFamily: 'monospace' }, children: path?.split('/').pop() })] })] })] })) : webpageInfoOpen && !shutdown ? (_jsxs(_Fragment, { children: [_jsxs("div", { style: {
1025
+ padding: '6px 8px',
1026
+ borderBottom: '1px solid #ddd',
1027
+ background: '#fff',
1028
+ display: 'flex',
1029
+ alignItems: 'center',
1030
+ gap: '6px',
1031
+ }, children: [_jsxs(PanelButton, { onClick: () => setWebpageInfoOpen(false), style: { color: '#555' }, children: [_jsx(ArrowLeft, { size: 12 }), " Back"] }), _jsxs("span", { style: { fontSize: '12px', display: 'flex', alignItems: 'center', gap: '4px', color: '#333' }, children: [_jsx(Globe, { size: 12, color: "#3b82f6" }), " Webpage Info"] })] }), datRestrictionMissing ? (_jsx(SecuredTab, {})) : (_jsx(_Fragment, {})), _jsxs("div", { style: { overflowY: 'auto', maxHeight: '260px', padding: '10px', display: (datRestrictionMissing ? 'none' : 'flex'), flexDirection: 'column', gap: '8px' }, children: [_jsxs("span", { style: { fontSize: '12px', color: '#333' }, children: [_jsx("span", { style: { fontSize: '24px', color: '#333', fontWeight: 'bold' }, children: pathName }), " on ", _jsx("span", { style: { fontSize: '12px', color: '#333', fontWeight: 'bold' }, children: hostName })] }), _jsxs("div", { style: {
1032
+ display: 'flex',
1033
+ justifyContent: 'space-between',
1034
+ padding: '6px 10px',
957
1035
  background: '#fff',
1036
+ borderRadius: '10px',
1037
+ border: '1px solid #eee',
1038
+ fontSize: '12px',
1039
+ color: '#333',
1040
+ }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Protocol" }), _jsx("span", { style: { fontSize: '12px', color: 'orange' }, children: protocol })] }), _jsxs("div", { style: {
958
1041
  display: 'flex',
959
- flexDirection: 'column',
1042
+ justifyContent: 'space-between',
1043
+ padding: '6px 10px',
1044
+ background: '#fff',
960
1045
  borderRadius: '10px',
961
1046
  border: '1px solid #eee',
962
- fontSize: '11px',
963
- fontFamily: 'monospace'
964
- }, children: _jsxs("div", { style: { display: 'flex', justifyContent: 'space-between', gap: '8px', padding: '6px 10px' }, children: [_jsx("span", { style: { color: '#3b82f6', display: 'flex', gap: '4px', justifyContent: 'center', alignItems: 'center' }, children: r.type }), _jsx("span", { style: { flex: 1, color: '#333' }, children: r.url })] }) }, i)))] })] })) : routeOpen ? (_jsxs(_Fragment, { children: [_jsxs("div", { style: {
965
- padding: '6px 8px',
966
- borderBottom: '1px solid #ddd',
967
- background: '#fff',
968
- display: 'flex',
969
- alignItems: 'center',
970
- gap: '6px',
971
- }, children: [_jsxs(PanelButton, { onClick: () => setRouteOpen(false), style: { color: '#555' }, children: [_jsx(ArrowLeft, { size: 12 }), " Back"] }), _jsxs("span", { style: { fontSize: '12px', display: 'flex', alignItems: 'center', gap: '4px', color: '#333' }, children: [_jsx(Route, { size: 12, color: "#3b82f6" }), " Route"] }), _jsx("span", { style: { fontSize: '10px', color: '#aaa', marginLeft: '2px' }, children: pathName })] }), datRestrictionMissing ? (_jsx(SecuredTab, {})) : (_jsx(_Fragment, {})), _jsxs("div", { style: { overflowY: 'auto', maxHeight: '260px', padding: '10px', display: (datRestrictionMissing ? 'none' : 'flex'), flexDirection: 'column', gap: '8px' }, children: [_jsx("span", { style: { fontSize: '24px', color: '#333', fontWeight: 'bold' }, children: pathName }), _jsxs("div", { style: {
972
- display: 'flex',
973
- justifyContent: 'space-between',
974
- padding: '6px 10px',
975
- background: '#fff',
976
- borderRadius: '10px',
977
- border: '1px solid #eee',
978
- fontSize: '12px',
979
- color: '#333',
980
- }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Load Status Code" }), _jsx("span", { style: { color: status === 200 ? '#16a34a' : '#e53e3e', fontFamily: 'monospace' }, children: status })] }), _jsxs("div", { style: {
981
- display: 'flex',
982
- justifyContent: 'space-between',
983
- padding: '6px 10px',
984
- background: '#fff',
985
- borderRadius: '10px',
986
- border: '1px solid #eee',
987
- fontSize: '12px',
988
- color: '#333',
989
- }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "File Path" }), _jsx("span", { style: { color: 'blue', fontFamily: 'monospace' }, children: path })] }), _jsxs("div", { style: {
990
- display: 'flex',
991
- justifyContent: 'space-between',
992
- padding: '6px 10px',
993
- background: '#fff',
994
- borderRadius: '10px',
995
- border: '1px solid #eee',
996
- fontSize: '12px',
997
- color: '#333',
998
- }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "File Name" }), _jsx("span", { style: { color: 'blue', fontFamily: 'monospace' }, children: path?.split('/').pop() })] })] })] })) : webpageInfoOpen ? (_jsxs(_Fragment, { children: [_jsxs("div", { style: {
999
- padding: '6px 8px',
1000
- borderBottom: '1px solid #ddd',
1001
- background: '#fff',
1002
- display: 'flex',
1003
- alignItems: 'center',
1004
- gap: '6px',
1005
- }, children: [_jsxs(PanelButton, { onClick: () => setWebpageInfoOpen(false), style: { color: '#555' }, children: [_jsx(ArrowLeft, { size: 12 }), " Back"] }), _jsxs("span", { style: { fontSize: '12px', display: 'flex', alignItems: 'center', gap: '4px', color: '#333' }, children: [_jsx(Globe, { size: 12, color: "#3b82f6" }), " Webpage Info"] })] }), datRestrictionMissing ? (_jsx(SecuredTab, {})) : (_jsx(_Fragment, {})), _jsxs("div", { style: { overflowY: 'auto', maxHeight: '260px', padding: '10px', display: (datRestrictionMissing ? 'none' : 'flex'), flexDirection: 'column', gap: '8px' }, children: [_jsxs("span", { style: { fontSize: '12px', color: '#333' }, children: [_jsx("span", { style: { fontSize: '24px', color: '#333', fontWeight: 'bold' }, children: pathName }), " on ", _jsx("span", { style: { fontSize: '12px', color: '#333', fontWeight: 'bold' }, children: hostName })] }), _jsxs("div", { style: {
1006
- display: 'flex',
1007
- justifyContent: 'space-between',
1008
- padding: '6px 10px',
1009
- background: '#fff',
1010
- borderRadius: '10px',
1011
- border: '1px solid #eee',
1012
- fontSize: '12px',
1013
- color: '#333',
1014
- }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Protocol" }), _jsx("span", { style: { fontSize: '12px', color: 'orange' }, children: protocol })] }), _jsxs("div", { style: {
1015
- display: 'flex',
1016
- justifyContent: 'space-between',
1017
- padding: '6px 10px',
1018
- background: '#fff',
1019
- borderRadius: '10px',
1020
- border: '1px solid #eee',
1021
- fontSize: '12px',
1022
- color: '#333',
1023
- }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "SSL" }), _jsx("span", { style: { fontSize: '12px', color: (protocol === 'HTTPS' ? '#16a34a' : '#e53e3e') }, children: protocol === 'HTTPS' ? 'Yes' : 'No' })] }), _jsxs("div", { style: {
1024
- display: 'flex',
1025
- justifyContent: 'space-between',
1026
- padding: '6px 10px',
1027
- background: '#fff',
1028
- borderRadius: '10px',
1029
- border: '1px solid #eee',
1030
- fontSize: '12px',
1031
- color: '#333',
1032
- }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Renderer Type" }), _jsx("span", { style: { fontSize: '12px', color: 'blue' }, children: isSsr ? 'SSR (Server-Side Rendering)' : 'CSR (Client-Side Rendering)' })] }), _jsxs("div", { style: {
1033
- display: 'flex',
1034
- justifyContent: 'space-between',
1035
- padding: '6px 10px',
1036
- background: '#fff',
1037
- borderRadius: '10px',
1038
- border: '1px solid #eee',
1039
- fontSize: '12px',
1040
- color: '#333',
1041
- }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Compiler Type" }), _jsx("span", { style: { fontSize: '12px', color: 'blue' }, children: compilerType })] })] })] })) : clientInfoOpen ? (_jsxs(_Fragment, { children: [_jsxs("div", { style: {
1042
- padding: '6px 8px',
1043
- borderBottom: '1px solid #ddd',
1044
- background: '#fff',
1045
- display: 'flex',
1046
- alignItems: 'center',
1047
- gap: '6px',
1048
- }, children: [_jsxs(PanelButton, { onClick: () => setClientInfoOpen(false), style: { color: '#555' }, children: [_jsx(ArrowLeft, { size: 12 }), " Back"] }), _jsxs("span", { style: { fontSize: '12px', display: 'flex', alignItems: 'center', gap: '4px', color: '#333' }, children: [_jsx(Info, { size: 12, color: "#3b82f6" }), " Client Info"] })] }), datRestrictionMissing ? (_jsx(SecuredTab, {})) : (_jsx(_Fragment, {})), _jsxs("div", { style: { overflowY: 'auto', maxHeight: '260px', padding: '10px', display: (datRestrictionMissing ? 'none' : 'flex'), flexDirection: 'column', gap: '8px' }, children: [_jsxs("div", { style: {
1049
- display: 'flex',
1050
- justifyContent: 'space-between',
1051
- padding: '6px 10px',
1052
- background: '#fff',
1053
- borderRadius: '10px',
1054
- border: '1px solid #eee',
1055
- fontSize: '12px',
1056
- color: '#333',
1057
- }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "HTTP Version" }), _jsx("span", { style: { fontSize: '12px', color: 'blue' }, children: "v" + httpVersion })] }), _jsxs("div", { style: {
1058
- display: 'flex',
1059
- justifyContent: 'space-between',
1060
- padding: '6px 10px',
1061
- background: '#fff',
1062
- borderRadius: '10px',
1063
- border: '1px solid #eee',
1064
- fontSize: '12px',
1065
- color: '#333',
1066
- }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "User Agent" }), _jsx("span", { style: { fontSize: '12px', color: 'blue' }, children: navigator.userAgent })] }), _jsxs("div", { style: {
1067
- display: 'flex',
1068
- justifyContent: 'space-between',
1069
- padding: '6px 10px',
1070
- background: '#fff',
1071
- borderRadius: '10px',
1072
- border: '1px solid #eee',
1073
- fontSize: '12px',
1074
- color: '#333',
1075
- }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "OS" }), _jsx("span", { style: { fontSize: '12px', color: 'blue' }, children: getOS() })] }), _jsxs("div", { style: {
1076
- display: 'flex',
1077
- justifyContent: 'space-between',
1078
- padding: '6px 10px',
1079
- background: '#fff',
1080
- borderRadius: '10px',
1081
- border: '1px solid #eee',
1082
- fontSize: '12px',
1083
- color: '#333',
1084
- }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "FPS" }), _jsx("span", { style: { fontSize: '12px', color: (frames.current < 30 ? '#e53e3e' : frames.current < 60 ? '#d97706' : '#16a34a') }, ref: fpsSpanRef, children: "\u2014" })] })] })] })) : aboutHostOpen ? (_jsxs(_Fragment, { children: [_jsxs("div", { style: {
1085
- padding: '6px 8px',
1086
- borderBottom: '1px solid #ddd',
1087
- background: '#fff',
1088
- display: 'flex',
1089
- alignItems: 'center',
1090
- gap: '6px',
1091
- }, children: [_jsxs(PanelButton, { onClick: () => setAboutHostOpen(false), style: { color: '#555' }, children: [_jsx(ArrowLeft, { size: 12 }), " Back"] }), _jsxs("span", { style: { fontSize: '12px', display: 'flex', alignItems: 'center', gap: '4px', color: '#333' }, children: [_jsx(ShieldCheck, { size: 12, color: "#f472b6" }), " About Host"] })] }), datRestrictionMissing ? (_jsx(SecuredTab, {})) : (_jsx(_Fragment, {})), _jsxs("div", { style: { overflowY: 'auto', maxHeight: '260px', padding: '10px', display: (datRestrictionMissing ? 'none' : 'flex'), flexDirection: 'column', gap: '8px' }, children: [_jsxs("span", { style: { fontSize: '24px', color: '#333', fontWeight: 'bold', textAlign: 'center', display: 'flex', alignItems: 'center', flexDirection: 'column', gap: '6px' }, children: [_jsx(ShieldCheck, { size: 36, color: "#f472b6" }), "Authtics Host"] }), _jsx("span", { style: { fontSize: '12px', color: '#333', textAlign: 'center' }, children: "A lightweight, fast, and secure web server for modern web applications." }), _jsxs("div", { style: {
1092
- display: 'flex',
1093
- justifyContent: 'space-between',
1094
- padding: '6px 10px',
1095
- background: '#fff',
1096
- borderRadius: '10px',
1097
- border: '1px solid #eee',
1098
- fontSize: '12px',
1099
- color: '#333',
1100
- }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Version" }), _jsxs("span", { style: { fontSize: '12px', color: 'blue' }, children: ["v", hostVersion] })] }), _jsxs("div", { style: {
1101
- display: 'flex',
1102
- justifyContent: 'space-between',
1103
- padding: '6px 10px',
1104
- background: '#fff',
1105
- borderRadius: '10px',
1106
- border: '1px solid #eee',
1107
- fontSize: '12px',
1108
- color: '#333',
1109
- }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Made By" }), _jsx("span", { style: { fontSize: '12px', color: 'orange' }, children: "bananakitssu" })] }), _jsxs("a", { style: {
1110
- display: 'flex',
1111
- justifyContent: 'space-between',
1112
- padding: '6px 10px',
1113
- background: '#fff',
1114
- borderRadius: '10px',
1115
- border: '1px solid #eee',
1116
- fontSize: '12px',
1117
- color: '#333',
1118
- cursor: 'pointer',
1119
- textDecoration: 'none'
1120
- }, href: "https://www.npmjs.com/package/@bananacool467/authtics-host", children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Documentation" }), _jsx("span", { style: { fontSize: '12px', color: '#333' }, children: _jsx(ChevronRight, { size: 12 }) })] })] })] })) : serverInfoOpen ? (_jsxs(_Fragment, { children: [_jsxs("div", { style: {
1121
- padding: '6px 8px',
1122
- borderBottom: '1px solid #ddd',
1123
- background: '#fff',
1124
- display: 'flex',
1125
- alignItems: 'center',
1126
- gap: '6px',
1127
- }, children: [_jsxs(PanelButton, { onClick: () => setServerInfoOpen(false), style: { color: '#555' }, children: [_jsx(ArrowLeft, { size: 12 }), " Back"] }), _jsxs("span", { style: { fontSize: '12px', display: 'flex', alignItems: 'center', gap: '4px', color: '#333' }, children: [_jsx(Server, { size: 12, color: "#f472b6" }), " Server Info"] })] }), datRestrictionMissing ? (_jsx(SecuredTab, {})) : (_jsx(_Fragment, {})), _jsxs("div", { style: { overflowY: 'auto', maxHeight: '260px', padding: '10px', display: (datRestrictionMissing ? 'none' : 'flex'), flexDirection: 'column', gap: '8px' }, children: [_jsxs("div", { style: {
1128
- display: 'flex',
1129
- justifyContent: 'space-between',
1130
- padding: '6px 10px',
1131
- background: '#fff',
1132
- borderRadius: '10px',
1133
- border: '1px solid #eee',
1134
- fontSize: '12px',
1135
- color: '#333',
1136
- }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Server uptime" }), _jsx("span", { style: { fontSize: '12px', color: 'blue' }, children: uptime })] }), _jsxs("div", { style: {
1137
- display: 'flex',
1138
- justifyContent: 'space-between',
1139
- padding: '6px 10px',
1140
- background: '#fff',
1141
- borderRadius: '10px',
1142
- border: '1px solid #eee',
1143
- fontSize: '12px',
1144
- color: '#333',
1145
- }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Total requests" }), _jsx("span", { style: { fontSize: '12px', color: 'blue' }, children: requests })] }), _jsxs("div", { style: {
1146
- display: 'flex',
1147
- justifyContent: 'space-between',
1148
- padding: '6px 10px',
1149
- background: '#fff',
1150
- borderRadius: '10px',
1151
- border: '1px solid #eee',
1152
- fontSize: '12px',
1153
- color: '#333',
1154
- }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Total current users" }), _jsx("span", { style: { fontSize: '12px', color: 'blue' }, children: users })] }), _jsx(Sparkline, { data: cpuUsageHistory, color: "#3b82f6", label: "CPU Usage", unit: "" }), _jsx(Sparkline, { data: heapUsageHistory, color: "#3b82f6", label: "Heap Used", unit: "" })] })] })) : (_jsxs(_Fragment, { children: [_jsxs("div", { style: { padding: '8px', gap: '4px', display: 'flex', flexDirection: 'column' }, children: [_jsxs(PanelButton, { onClick: () => setConsoleOpen(true), fullWidth: true, style: { color: '#333', justifyContent: 'space-between', height: '32px' }, children: [_jsxs("span", { style: { display: 'flex', alignItems: 'center', gap: '6px' }, children: [_jsx(Terminal, { size: 12, color: "#16a34a" }), " Console"] }), logs.length > 0 && (_jsx("span", { style: { color: '#111', borderRadius: '100px', padding: '1px 6px', fontSize: '10px' }, children: logs.length }))] }), _jsxs(PanelButton, { onClick: () => setRouteOpen(true), fullWidth: true, style: { color: '#333', justifyContent: 'space-between', height: '32px' }, children: [_jsxs("span", { style: { display: 'flex', alignItems: 'center', gap: '6px' }, children: [_jsx(Route, { size: 12, color: "#3b82f6" }), " Route"] }), _jsxs("span", { style: { color: '#111', borderRadius: '100px', padding: '1px 6px', fontSize: '10px', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: '4px' }, children: [datRestrictionMissing && _jsx(TriangleAlert, { size: 12, color: "orange" }), pathName] })] }), _jsxs(PanelButton, { onClick: () => setWebpageInfoOpen(true), fullWidth: true, style: { color: '#333', justifyContent: 'space-between', height: '32px' }, children: [_jsxs("span", { style: { display: 'flex', alignItems: 'center', gap: '6px' }, children: [_jsx(Globe, { size: 12, color: "#3b82f6" }), " Webpage Info"] }), datRestrictionMissing && _jsx(TriangleAlert, { size: 12, color: "orange" })] }), _jsx(PanelButton, { onClick: () => setNetworkOpen(true), fullWidth: true, style: { color: '#333', justifyContent: 'space-between', height: '32px' }, children: _jsxs("span", { style: { display: 'flex', alignItems: 'center', gap: '6px' }, children: [_jsx(Wifi, { size: 12, color: "#3b82f6" }), " Network"] }) }), _jsxs(PanelButton, { onClick: () => setClientInfoOpen(true), fullWidth: true, style: { color: '#333', justifyContent: 'space-between', height: '32px' }, children: [_jsxs("span", { style: { display: 'flex', alignItems: 'center', gap: '6px' }, children: [_jsx(Info, { size: 12, color: "#3b82f6" }), " Client Info"] }), datRestrictionMissing && _jsx(TriangleAlert, { size: 12, color: "orange" })] }), _jsxs(PanelButton, { onClick: () => setAboutHostOpen(true), fullWidth: true, style: { color: '#333', justifyContent: 'space-between', height: '32px' }, children: [_jsxs("span", { style: { display: 'flex', alignItems: 'center', gap: '6px' }, children: [_jsx(ShieldCheck, { size: 12, color: "#f472b6" }), " About Host"] }), datRestrictionMissing && _jsx(TriangleAlert, { size: 12, color: "orange" })] }), _jsxs(PanelButton, { onClick: () => setServerInfoOpen(true), fullWidth: true, style: { color: '#333', justifyContent: 'space-between', height: '32px' }, children: [_jsxs("span", { style: { display: 'flex', alignItems: 'center', gap: '6px' }, children: [_jsx(Server, { size: 12, color: "#f472b6" }), " Server Info"] }), datRestrictionMissing && _jsx(TriangleAlert, { size: 12, color: "orange" })] })] }), _jsxs("div", { style: {
1155
- padding: '6px 8px',
1156
- borderTop: '1px solid #ddd',
1157
- background: '#fff',
1158
- display: 'flex',
1159
- gap: '6px',
1160
- overflowY: 'auto',
1161
- maxHeight: '260px',
1162
- flexDirection: 'column',
1163
- }, children: [_jsxs("div", { style: {
1164
- justifyContent: 'space-between',
1165
- padding: '6px 10px',
1166
- background: '#fff',
1167
- borderRadius: '10px',
1168
- border: '1px solid #eee',
1169
- fontSize: '12px',
1170
- color: '#333',
1171
- display: 'flex'
1172
- }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333', position: 'relative' }, children: "DAT (Developer Access Token)" }), _jsxs("div", { style: { position: 'relative',
1173
- display: 'inline-flex' }, children: [_jsx("span", { style: { fontSize: '12px', color: 'blue' }, children: token }), tokenHidden && (_jsxs("div", { style: {
1174
- position: 'absolute',
1175
- top: 0, left: 0,
1176
- marginTop: '-2.5px',
1177
- width: '100%', height: '100%',
1178
- backdropFilter: 'blur(10px)',
1179
- backgroundColor: 'rgba(255,255,255,0.3)',
1180
- cursor: 'pointer',
1181
- padding: '2.5px 2.5px',
1182
- borderRadius: '8px',
1183
- textAlign: 'center',
1184
- display: 'flex',
1185
- justifyContent: 'center',
1186
- alignItems: 'center',
1187
- gap: '4px'
1188
- }, onClick: () => setTokenHidden(false), children: [_jsx(Eye, { size: 12 }), "Click to reveal"] }))] })] }), tokenLength !== 16 ? (_jsx(_Fragment, { children: _jsxs("div", { style: {
1047
+ fontSize: '12px',
1048
+ color: '#333',
1049
+ }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "SSL" }), _jsx("span", { style: { fontSize: '12px', color: (protocol === 'HTTPS' ? '#16a34a' : '#e53e3e') }, children: protocol === 'HTTPS' ? 'Yes' : 'No' })] }), _jsxs("div", { style: {
1050
+ display: 'flex',
1051
+ justifyContent: 'space-between',
1052
+ padding: '6px 10px',
1053
+ background: '#fff',
1054
+ borderRadius: '10px',
1055
+ border: '1px solid #eee',
1056
+ fontSize: '12px',
1057
+ color: '#333',
1058
+ }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Renderer Type" }), _jsx("span", { style: { fontSize: '12px', color: 'blue' }, children: isSsr ? 'SSR (Server-Side Rendering)' : 'CSR (Client-Side Rendering)' })] }), _jsxs("div", { style: {
1189
1059
  display: 'flex',
1190
- background: '#ba4e4e',
1060
+ justifyContent: 'space-between',
1061
+ padding: '6px 10px',
1062
+ background: '#fff',
1063
+ borderRadius: '10px',
1064
+ border: '1px solid #eee',
1065
+ fontSize: '12px',
1066
+ color: '#333',
1067
+ }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Compiler Type" }), _jsx("span", { style: { fontSize: '12px', color: 'blue' }, children: compilerType })] })] })] })) : clientInfoOpen && !shutdown ? (_jsxs(_Fragment, { children: [_jsxs("div", { style: {
1068
+ padding: '6px 8px',
1069
+ borderBottom: '1px solid #ddd',
1070
+ background: '#fff',
1071
+ display: 'flex',
1072
+ alignItems: 'center',
1073
+ gap: '6px',
1074
+ }, children: [_jsxs(PanelButton, { onClick: () => setClientInfoOpen(false), style: { color: '#555' }, children: [_jsx(ArrowLeft, { size: 12 }), " Back"] }), _jsxs("span", { style: { fontSize: '12px', display: 'flex', alignItems: 'center', gap: '4px', color: '#333' }, children: [_jsx(Info, { size: 12, color: "#3b82f6" }), " Client Info"] })] }), datRestrictionMissing ? (_jsx(SecuredTab, {})) : (_jsx(_Fragment, {})), _jsxs("div", { style: { overflowY: 'auto', maxHeight: '260px', padding: '10px', display: (datRestrictionMissing ? 'none' : 'flex'), flexDirection: 'column', gap: '8px' }, children: [_jsxs("div", { style: {
1075
+ display: 'flex',
1076
+ justifyContent: 'space-between',
1077
+ padding: '6px 10px',
1078
+ background: '#fff',
1191
1079
  borderRadius: '10px',
1080
+ border: '1px solid #eee',
1081
+ fontSize: '12px',
1082
+ color: '#333',
1083
+ }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "HTTP Version" }), _jsx("span", { style: { fontSize: '12px', color: 'blue' }, children: "v" + httpVersion })] }), _jsxs("div", { style: {
1084
+ display: 'flex',
1085
+ justifyContent: 'space-between',
1192
1086
  padding: '6px 10px',
1193
- justifyContent: 'left',
1194
- alignItems: 'center',
1195
- gap: '6px',
1196
- color: '#fff',
1197
- flexDirection: 'row',
1198
- }, children: [_jsx(CircleX, { size: 12 }), "Invalid Developer Access Token (DAT)"] }) })) : (_jsx(_Fragment, {})), hostVersion === "0.0.1-beta.9" ? (_jsx(_Fragment, { children: _jsx("div", { style: {
1087
+ background: '#fff',
1088
+ borderRadius: '10px',
1089
+ border: '1px solid #eee',
1090
+ fontSize: '12px',
1091
+ color: '#333',
1092
+ }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "User Agent" }), _jsx("span", { style: { fontSize: '12px', color: 'blue' }, children: navigator.userAgent })] }), _jsxs("div", { style: {
1199
1093
  display: 'flex',
1200
- background: 'orange',
1094
+ justifyContent: 'space-between',
1095
+ padding: '6px 10px',
1096
+ background: '#fff',
1201
1097
  borderRadius: '10px',
1098
+ border: '1px solid #eee',
1099
+ fontSize: '12px',
1100
+ color: '#333',
1101
+ }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "OS" }), _jsx("span", { style: { fontSize: '12px', color: 'blue' }, children: getOS() })] }), _jsx(Sparkline, { data: fpsHistory, color: frames.current < 30 ? '#e53e3e' : frames.current < 60 ? '#d97706' : '#16a34a', label: "FPS", unit: " frames" })] })] })) : aboutHostOpen && !shutdown ? (_jsxs(_Fragment, { children: [_jsxs("div", { style: {
1102
+ padding: '6px 8px',
1103
+ borderBottom: '1px solid #ddd',
1104
+ background: '#fff',
1105
+ display: 'flex',
1106
+ alignItems: 'center',
1107
+ gap: '6px',
1108
+ }, children: [_jsxs(PanelButton, { onClick: () => setAboutHostOpen(false), style: { color: '#555' }, children: [_jsx(ArrowLeft, { size: 12 }), " Back"] }), _jsxs("span", { style: { fontSize: '12px', display: 'flex', alignItems: 'center', gap: '4px', color: '#333' }, children: [_jsx(ShieldCheck, { size: 12, color: "#f472b6" }), " About Host"] })] }), datRestrictionMissing ? (_jsx(SecuredTab, {})) : (_jsx(_Fragment, {})), _jsxs("div", { style: { overflowY: 'auto', maxHeight: '260px', padding: '10px', display: (datRestrictionMissing ? 'none' : 'flex'), flexDirection: 'column', gap: '8px' }, children: [_jsxs("span", { style: { fontSize: '24px', color: '#333', fontWeight: 'bold', textAlign: 'center', display: 'flex', alignItems: 'center', flexDirection: 'column', gap: '6px' }, children: [_jsx(ShieldCheck, { size: 36, color: "#f472b6" }), "Authtics Host"] }), _jsx("span", { style: { fontSize: '12px', color: '#333', textAlign: 'center' }, children: "A lightweight, fast, and secure web framework for modern web applications." }), _jsxs("div", { style: {
1109
+ display: 'flex',
1110
+ justifyContent: 'space-between',
1202
1111
  padding: '6px 10px',
1203
- justifyContent: 'left',
1204
- alignItems: 'center',
1205
- gap: '6px',
1206
- color: '#fff',
1207
- flexDirection: 'row',
1208
- }, children: "Updates to security. Apps with version 0.0.1-beta.9 and over will now require DAT restriction to access remote features like restarting and shutting down the app." }) })) : (_jsx(_Fragment, {})), _jsx(PanelButton, { onClick: () => { restart(); }, fullWidth: true, style: { color: '#fff', justifyContent: 'center', height: '32px', background: '#ba4e4e' }, disabled: datRestrictionMissing, children: _jsx("span", { style: { display: 'flex', alignItems: 'center', gap: '6px', textAlign: 'center' }, children: "Restart App" }) }), datRestrictionMissing ? (_jsxs("span", { style: { display: 'flex', opacity: 0.5, fontSize: 10, justifyContent: 'center', alignItems: 'center', gap: '4px' }, children: [_jsx(Info, { size: 10 }), "Restarting the app is unavaliable. Set \"dat\" in the Authtics Host config to set restriction and then restart."] })) : (_jsx(_Fragment, {})), _jsx(PanelButton, { onClick: () => { shutDown(); }, fullWidth: true, style: { color: '#fff', justifyContent: 'center', height: '32px', background: '#ba4e4e' }, disabled: datRestrictionMissing, children: _jsx("span", { style: { display: 'flex', alignItems: 'center', gap: '6px', textAlign: 'center' }, children: "Shut Down App" }) }), datRestrictionMissing ? (_jsxs("span", { style: { display: 'flex', opacity: 0.5, fontSize: 10, justifyContent: 'center', alignItems: 'center', gap: '4px' }, children: [_jsx(Info, { size: 10 }), "Shutting down the app is unavaliable. Set \"dat\" in the Authtics Host config to set restriction and then restart."] })) : (_jsx(_Fragment, {})), _jsx(PanelButton, { onClick: () => { pause_Resume_Users(); }, fullWidth: true, style: { color: '#fff', justifyContent: 'center', height: '32px', background: '#ba4e4e' }, disabled: datRestrictionMissing, children: _jsx("span", { style: { display: 'flex', alignItems: 'center', gap: '6px', textAlign: 'center' }, children: usersPausedRealInfo ? "Resume Users" : "Pause Users" }) }), datRestrictionMissing ? (_jsxs("span", { style: { display: 'flex', opacity: 0.5, fontSize: 10, justifyContent: 'center', alignItems: 'center', gap: '4px' }, children: [_jsx(Info, { size: 10 }), "Pausing users from accessing the app is unavaliable. Set \"dat\" in the Authtics Host config to set restriction and then restart."] })) : (_jsx(_Fragment, {}))] })] })) }) }), datMatch ? (_jsxs("div", { onClick: () => setOpen(o => !o), style: {
1112
+ background: '#fff',
1113
+ borderRadius: '10px',
1114
+ border: '1px solid #eee',
1115
+ fontSize: '12px',
1116
+ color: '#333',
1117
+ }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Version" }), _jsxs("span", { style: { fontSize: '12px', color: 'blue' }, children: ["v", hostVersion] })] }), _jsxs("div", { style: {
1118
+ display: 'flex',
1119
+ justifyContent: 'space-between',
1120
+ padding: '6px 10px',
1121
+ background: '#fff',
1122
+ borderRadius: '10px',
1123
+ border: '1px solid #eee',
1124
+ fontSize: '12px',
1125
+ color: '#333',
1126
+ }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Made By" }), _jsx("span", { style: { fontSize: '12px', color: 'orange' }, children: "bananakitssu" })] }), _jsxs("a", { style: {
1127
+ display: 'flex',
1128
+ justifyContent: 'space-between',
1129
+ padding: '6px 10px',
1130
+ background: '#fff',
1131
+ borderRadius: '10px',
1132
+ border: '1px solid #eee',
1133
+ fontSize: '12px',
1134
+ color: '#333',
1135
+ cursor: 'pointer',
1136
+ textDecoration: 'none'
1137
+ }, href: "https://www.npmjs.com/package/@bananacool467/authtics-host", children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Documentation" }), _jsx("span", { style: { fontSize: '12px', color: '#333' }, children: _jsx(ChevronRight, { size: 12 }) })] })] })] })) : serverInfoOpen && !shutdown ? (_jsxs(_Fragment, { children: [_jsxs("div", { style: {
1138
+ padding: '6px 8px',
1139
+ borderBottom: '1px solid #ddd',
1140
+ background: '#fff',
1141
+ display: 'flex',
1142
+ alignItems: 'center',
1143
+ gap: '6px',
1144
+ }, children: [_jsxs(PanelButton, { onClick: () => setServerInfoOpen(false), style: { color: '#555' }, children: [_jsx(ArrowLeft, { size: 12 }), " Back"] }), _jsxs("span", { style: { fontSize: '12px', display: 'flex', alignItems: 'center', gap: '4px', color: '#333' }, children: [_jsx(Server, { size: 12, color: "#f472b6" }), " Server Info"] })] }), datRestrictionMissing ? (_jsx(SecuredTab, {})) : (_jsx(_Fragment, {})), _jsxs("div", { style: { overflowY: 'auto', maxHeight: '260px', padding: '10px', display: (datRestrictionMissing ? 'none' : 'flex'), flexDirection: 'column', gap: '8px' }, children: [_jsxs("div", { style: {
1145
+ display: 'flex',
1146
+ justifyContent: 'space-between',
1147
+ padding: '6px 10px',
1148
+ background: '#fff',
1149
+ borderRadius: '10px',
1150
+ border: '1px solid #eee',
1151
+ fontSize: '12px',
1152
+ color: '#333',
1153
+ }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Server uptime" }), _jsx("span", { style: { fontSize: '12px', color: 'blue' }, children: uptime })] }), _jsxs("div", { style: {
1154
+ display: 'flex',
1155
+ justifyContent: 'space-between',
1156
+ padding: '6px 10px',
1157
+ background: '#fff',
1158
+ borderRadius: '10px',
1159
+ border: '1px solid #eee',
1160
+ fontSize: '12px',
1161
+ color: '#333',
1162
+ }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Total requests" }), _jsx("span", { style: { fontSize: '12px', color: 'blue' }, children: requests })] }), _jsxs("div", { style: {
1163
+ display: 'flex',
1164
+ justifyContent: 'space-between',
1165
+ padding: '6px 10px',
1166
+ background: '#fff',
1167
+ borderRadius: '10px',
1168
+ border: '1px solid #eee',
1169
+ fontSize: '12px',
1170
+ color: '#333',
1171
+ }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333' }, children: "Total current users" }), _jsx("span", { style: { fontSize: '12px', color: 'blue' }, children: users })] }), _jsx(Sparkline, { data: cpuUsageHistory, color: "#3b82f6", label: "CPU Usage", unit: "" }), _jsx(Sparkline, { data: heapUsageHistory, color: "#3b82f6", label: "Heap Used", unit: "" })] })] })) : !shutdown ? (_jsxs(_Fragment, { children: [_jsxs("div", { style: { padding: '8px', gap: '4px', display: 'flex', flexDirection: 'column' }, children: [_jsxs(PanelButton, { onClick: () => setConsoleOpen(true), fullWidth: true, style: { color: '#333', justifyContent: 'space-between', height: '32px' }, children: [_jsxs("span", { style: { display: 'flex', alignItems: 'center', gap: '6px' }, children: [_jsx(Terminal, { size: 12, color: "#16a34a" }), " Console"] }), logs.length > 0 && (_jsx("span", { style: { color: '#111', borderRadius: '100px', padding: '1px 6px', fontSize: '10px' }, children: logs.length }))] }), _jsxs(PanelButton, { onClick: () => setRouteOpen(true), fullWidth: true, style: { color: '#333', justifyContent: 'space-between', height: '32px' }, children: [_jsxs("span", { style: { display: 'flex', alignItems: 'center', gap: '6px' }, children: [_jsx(Route, { size: 12, color: "#3b82f6" }), " Route"] }), _jsxs("span", { style: { color: '#111', borderRadius: '100px', padding: '1px 6px', fontSize: '10px', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: '4px' }, children: [datRestrictionMissing && _jsx(TriangleAlert, { size: 12, color: "orange" }), pathName] })] }), _jsxs(PanelButton, { onClick: () => setWebpageInfoOpen(true), fullWidth: true, style: { color: '#333', justifyContent: 'space-between', height: '32px' }, children: [_jsxs("span", { style: { display: 'flex', alignItems: 'center', gap: '6px' }, children: [_jsx(Globe, { size: 12, color: "#3b82f6" }), " Webpage Info"] }), datRestrictionMissing && _jsx(TriangleAlert, { size: 12, color: "orange" })] }), _jsx(PanelButton, { onClick: () => setNetworkOpen(true), fullWidth: true, style: { color: '#333', justifyContent: 'space-between', height: '32px' }, children: _jsxs("span", { style: { display: 'flex', alignItems: 'center', gap: '6px' }, children: [_jsx(Wifi, { size: 12, color: "#3b82f6" }), " Network"] }) }), _jsxs(PanelButton, { onClick: () => setClientInfoOpen(true), fullWidth: true, style: { color: '#333', justifyContent: 'space-between', height: '32px' }, children: [_jsxs("span", { style: { display: 'flex', alignItems: 'center', gap: '6px' }, children: [_jsx(Info, { size: 12, color: "#3b82f6" }), " Client Info"] }), datRestrictionMissing && _jsx(TriangleAlert, { size: 12, color: "orange" })] }), _jsxs(PanelButton, { onClick: () => setAboutHostOpen(true), fullWidth: true, style: { color: '#333', justifyContent: 'space-between', height: '32px' }, children: [_jsxs("span", { style: { display: 'flex', alignItems: 'center', gap: '6px' }, children: [_jsx(ShieldCheck, { size: 12, color: "#f472b6" }), " About HostJS"] }), datRestrictionMissing && _jsx(TriangleAlert, { size: 12, color: "orange" })] }), _jsxs(PanelButton, { onClick: () => setServerInfoOpen(true), fullWidth: true, style: { color: '#333', justifyContent: 'space-between', height: '32px' }, children: [_jsxs("span", { style: { display: 'flex', alignItems: 'center', gap: '6px' }, children: [_jsx(Server, { size: 12, color: "#f472b6" }), " Server Info"] }), datRestrictionMissing && _jsx(TriangleAlert, { size: 12, color: "orange" })] })] }), _jsxs("div", { style: {
1172
+ padding: '6px 8px',
1173
+ borderTop: '1px solid #ddd',
1174
+ background: '#fff',
1175
+ display: 'flex',
1176
+ gap: '6px',
1177
+ overflowY: 'auto',
1178
+ maxHeight: '260px',
1179
+ flexDirection: 'column',
1180
+ }, children: [_jsxs("div", { style: {
1181
+ justifyContent: 'space-between',
1182
+ padding: '6px 10px',
1183
+ background: '#fff',
1184
+ borderRadius: '10px',
1185
+ border: '1px solid #eee',
1186
+ fontSize: '12px',
1187
+ color: '#333',
1188
+ display: 'flex'
1189
+ }, children: [_jsx("span", { style: { fontSize: '12px', color: '#333', position: 'relative' }, children: "DAT (Developer Access Token)" }), _jsxs("div", { style: { position: 'relative',
1190
+ display: 'inline-flex' }, children: [_jsx("span", { style: { fontSize: '12px', color: 'blue' }, children: token }), tokenHidden && (_jsxs("div", { style: {
1191
+ position: 'absolute',
1192
+ top: 0, left: 0,
1193
+ marginTop: '-2.5px',
1194
+ width: '100%', height: '100%',
1195
+ backdropFilter: 'blur(10px)',
1196
+ backgroundColor: 'rgba(255,255,255,0.3)',
1197
+ cursor: 'pointer',
1198
+ padding: '2.5px 2.5px',
1199
+ borderRadius: '8px',
1200
+ textAlign: 'center',
1201
+ display: 'flex',
1202
+ justifyContent: 'center',
1203
+ alignItems: 'center',
1204
+ gap: '4px'
1205
+ }, onClick: () => setTokenHidden(false), children: [_jsx(Eye, { size: 12 }), "Click to reveal"] }))] })] }), tokenLength !== 16 ? (_jsx(_Fragment, { children: _jsxs("div", { style: {
1206
+ display: 'flex',
1207
+ background: '#ba4e4e',
1208
+ borderRadius: '10px',
1209
+ padding: '6px 10px',
1210
+ justifyContent: 'left',
1211
+ alignItems: 'center',
1212
+ gap: '6px',
1213
+ color: '#fff',
1214
+ flexDirection: 'row',
1215
+ }, children: [_jsx(CircleX, { size: 12 }), "Invalid Developer Access Token (DAT)"] }) })) : (_jsx(_Fragment, {})), hostVersion === "0.0.1-beta.9" ? (_jsx(_Fragment, { children: _jsx("div", { style: {
1216
+ display: 'flex',
1217
+ background: 'orange',
1218
+ borderRadius: '10px',
1219
+ padding: '6px 10px',
1220
+ justifyContent: 'left',
1221
+ alignItems: 'center',
1222
+ gap: '6px',
1223
+ color: '#fff',
1224
+ flexDirection: 'row',
1225
+ }, children: "Updates to security. Apps with version 0.0.1-beta.9 and over will now require DAT restriction to access remote features like restarting and shutting down the app." }) })) : (_jsx(_Fragment, {})), _jsx(PanelButton, { onClick: () => { restart(); }, fullWidth: true, style: { color: '#fff', justifyContent: 'center', height: '32px', background: (datRestrictionMissing ? '#bdbdbd' : '#ba4e4e') }, disabled: datRestrictionMissing, children: _jsx("span", { style: { display: 'flex', alignItems: 'center', gap: '6px', textAlign: 'center' }, children: "Restart App" }) }), datRestrictionMissing ? (_jsxs("span", { style: { display: 'flex', opacity: 0.5, fontSize: 10, justifyContent: 'center', alignItems: 'center', gap: '8px' }, children: [_jsx(Info, { size: 30 }), "Restarting the app is unavaliable. Set \"dat\" to your current DAT in the Authtics Host config to set restriction and then restart."] })) : (_jsx(_Fragment, {})), _jsx(PanelButton, { onClick: () => { shutDown(); }, fullWidth: true, style: { color: '#fff', justifyContent: 'center', height: '32px', background: (datRestrictionMissing ? '#bdbdbd' : '#ba4e4e') }, disabled: datRestrictionMissing, children: _jsx("span", { style: { display: 'flex', alignItems: 'center', gap: '6px', textAlign: 'center' }, children: "Shut Down App" }) }), datRestrictionMissing ? (_jsxs("span", { style: { display: 'flex', opacity: 0.5, fontSize: 10, justifyContent: 'center', alignItems: 'center', gap: '8px' }, children: [_jsx(Info, { size: 30 }), "Shutting down the app is unavaliable. Set \"dat\" to your current DAT in the Authtics Host config to set restriction and then restart."] })) : (_jsx(_Fragment, {})), _jsx(PanelButton, { onClick: () => { pause_Resume_Users(); }, fullWidth: true, style: { color: (datRestrictionMissing ? '#fff' : '#333'), justifyContent: 'center', height: '32px', background: (datRestrictionMissing ? '#bdbdbd' : '#f2f2f2') }, disabled: datRestrictionMissing, children: _jsx("span", { style: { display: 'flex', alignItems: 'center', gap: '6px', textAlign: 'center' }, children: usersPausedRealInfo ? "Resume Users" : "Pause Users" }) }), datRestrictionMissing ? (_jsxs("span", { style: { display: 'flex', opacity: 0.5, fontSize: 10, justifyContent: 'center', alignItems: 'center', gap: '8px' }, children: [_jsx(Info, { size: 30 }), "Pausing users from accessing the app is unavaliable. Set \"dat\" to your current DAT in the Authtics Host config to set restriction and then restart."] })) : (_jsx(_Fragment, {}))] })] })) : (_jsx(_Fragment, {}))] }) }), datMatch ? (_jsxs("div", { onClick: () => setOpen(o => !o), style: {
1209
1226
  display: 'flex',
1210
1227
  flexDirection: 'row',
1211
1228
  alignItems: 'center',
@@ -1222,6 +1239,7 @@ export default function DevPanel() {
1222
1239
  width: 'fit-content',
1223
1240
  boxSizing: 'border-box',
1224
1241
  lineHeight: '1',
1242
+ pointerEvents: 'auto',
1225
1243
  }, children: [_jsx(ShieldCheck, { size: 16, color: "#f472b6", style: { flexShrink: 0 } }), _jsx("div", { style: {
1226
1244
  maxWidth: hasIssue ? '160px' : '0px',
1227
1245
  opacity: hasIssue ? 1 : 0,
@@ -5,6 +5,8 @@ import * as esbuild from "esbuild";
5
5
  import React from "react";
6
6
  import { renderToString } from "react-dom/server";
7
7
  import { tempFileForTsx, writeTempFile, readTempFile, ensureTempDirs, } from "./rendererTempFiles.js";
8
+ import { createRequire } from "node:module";
9
+ const customRequire = createRequire(import.meta.url);
8
10
  const __filename = fileURLToPath(import.meta.url);
9
11
  const __dirname = path.dirname(__filename);
10
12
  const NODE_BUILTINS = [
@@ -155,6 +157,10 @@ function isCacheValid(tsxPath, tempPath, serverCjsPath, templatePath, devPanelPa
155
157
  }
156
158
  const HMR_SCRIPT = `<script>(function(){
157
159
  var reloading=false;
160
+ window.addEventListener('beforeunload', function() {
161
+ reloading = true;
162
+ });
163
+
158
164
  var es=new EventSource('/hmr');
159
165
  es.onmessage=function(e){
160
166
  if(e.data==='reload'&&!reloading){
@@ -164,11 +170,12 @@ const HMR_SCRIPT = `<script>(function(){
164
170
  }
165
171
  };
166
172
  es.onerror=function(){
167
- // onerror fires on both server-down AND on page-unload (SSE closed by navigation).
168
- // Guard with reloading so a navigate-away never schedules a second reload.
169
173
  if(!reloading){
170
174
  setTimeout(function(){
171
- if(!reloading){reloading=true;window.location.reload();}
175
+ if(!reloading){
176
+ reloading=true;
177
+ window.location.reload();
178
+ }
172
179
  },1500);
173
180
  }
174
181
  };
@@ -227,14 +234,20 @@ export async function renderPage(tsxPath, reqUrl, showPanel = true, compiler = '
227
234
  serverCode = await buildWithEsbuild(virtualServer, process.cwd(), 'node');
228
235
  clientCode = await buildWithEsbuild(virtualClient, process.cwd(), 'browser');
229
236
  }
230
- fs.writeFileSync(serverCjsPath, serverCode || "", "utf-8");
237
+ await fs.promises.writeFile(serverCjsPath, serverCode || "", "utf-8");
231
238
  writeTempFile(tempPath, JSON.stringify({ clientCode }));
232
239
  freshWrite = true;
233
240
  }
234
241
  fileHandler ? fileHandler(clientCode || "", `/${path.basename(tempPath).replace(".json", ".js").replace(".tsx_", ".").toLowerCase()}`) : null;
235
- const serverModule = await import(freshWrite ? `${serverCjsPath}?t=${Date.now()}` : serverCjsPath);
236
- const exports = serverModule.default ?? serverModule;
237
- const PageComponent = exports.default ?? exports.Page ?? exports.page ?? null;
242
+ const absoluteServerPath = path.resolve(serverCjsPath);
243
+ delete customRequire.cache[absoluteServerPath];
244
+ const serverModule = customRequire(absoluteServerPath);
245
+ const exports = serverModule.__esModule ? serverModule.default : serverModule;
246
+ const PageComponent = exports?.default?.default ??
247
+ exports?.default ??
248
+ exports?.Page ??
249
+ exports?.page ??
250
+ (typeof exports === 'function' ? exports : null);
238
251
  const DevPanelComponent = usesDevPanel ? (exports.DevPanel ?? null) : null;
239
252
  if (!PageComponent) {
240
253
  throw new Error(`renderPage: no default export found in ${tsxPath}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bananacool467/authtics-host",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Authtics Host, A Next.js-inspired SSR framework for Node.js with TypeScript and JSX support.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",