@bananacool467/authtics-host 0.0.2-beta.1 → 0.0.2-beta.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,6 +1,6 @@
1
1
  # Authtics Host
2
2
 
3
- Version 0.0.2-beta.1
3
+ Version 0.0.2-beta.3
4
4
  License: MIT
5
5
 
6
6
  **(NOTE: This version is in BETA, bugs are expected)**
package/dist/cli.js CHANGED
@@ -134,8 +134,6 @@ export default class App {
134
134
  let datMatched = false;
135
135
  if (config_.dat && config_.dat == reqBody.dat)
136
136
  datMatched = true;
137
- if (config_.dat == undefined)
138
- datMatched = true;
139
137
  if (config_.dat && Array.isArray(config_.dat) && config_.dat.includes(reqBody.dat))
140
138
  datMatched = true;
141
139
  if (datMatched) {
@@ -153,8 +151,6 @@ export default class App {
153
151
  let datMatched = false;
154
152
  if (config_.dat && config_.dat == reqBody.dat)
155
153
  datMatched = true;
156
- if (config_.dat == undefined)
157
- datMatched = true;
158
154
  if (config_.dat && Array.isArray(config_.dat) && config_.dat.includes(reqBody.dat))
159
155
  datMatched = true;
160
156
  if (datMatched) {
@@ -169,8 +165,6 @@ export default class App {
169
165
  let datMatched = false;
170
166
  if (config_.dat && config_.dat == reqBody.dat)
171
167
  datMatched = true;
172
- if (config_.dat == undefined)
173
- datMatched = true;
174
168
  if (config_.dat && Array.isArray(config_.dat) && config_.dat.includes(reqBody.dat))
175
169
  datMatched = true;
176
170
  if (datMatched) {
@@ -219,8 +213,6 @@ export default class App {
219
213
  let datMatched = false;
220
214
  if (config_.dat && config_.dat == reqBody.dat)
221
215
  datMatched = true;
222
- if (config_.dat == undefined)
223
- datMatched = true;
224
216
  if (config_.dat && Array.isArray(config_.dat) && config_.dat.includes(reqBody.dat))
225
217
  datMatched = true;
226
218
  if (datMatched) {
@@ -235,8 +227,6 @@ export default class App {
235
227
  let datMatched = false;
236
228
  if (config_.dat && config_.dat == reqBody.dat)
237
229
  datMatched = true;
238
- if (config_.dat == undefined)
239
- datMatched = true;
240
230
  if (config_.dat && Array.isArray(config_.dat) && config_.dat.includes(reqBody.dat))
241
231
  datMatched = true;
242
232
  if (datMatched) {
@@ -251,8 +241,6 @@ export default class App {
251
241
  let datMatched = false;
252
242
  if (config_.dat && config_.dat == reqBody.dat)
253
243
  datMatched = true;
254
- if (config_.dat == undefined)
255
- datMatched = true;
256
244
  if (config_.dat && Array.isArray(config_.dat) && config_.dat.includes(reqBody.dat))
257
245
  datMatched = true;
258
246
  if (datMatched) {
@@ -272,8 +260,6 @@ export default class App {
272
260
  let datMatched = false;
273
261
  if (config_.dat && config_.dat == reqBody.dat)
274
262
  datMatched = true;
275
- if (config_.dat == undefined)
276
- datMatched = true;
277
263
  if (config_.dat && Array.isArray(config_.dat) && config_.dat.includes(reqBody.dat))
278
264
  datMatched = true;
279
265
  if (datMatched) {
@@ -294,8 +280,6 @@ export default class App {
294
280
  let datMatched = false;
295
281
  if (config_.dat && config_.dat == reqBody.dat)
296
282
  datMatched = true;
297
- if (config_.dat == undefined)
298
- datMatched = true;
299
283
  if (config_.dat && Array.isArray(config_.dat) && config_.dat.includes(reqBody.dat))
300
284
  datMatched = true;
301
285
  if (datMatched) {
@@ -308,8 +292,6 @@ export default class App {
308
292
  let datMatched = false;
309
293
  if (config_.dat && config_.dat == reqBody.dat)
310
294
  datMatched = true;
311
- if (config_.dat == undefined)
312
- datMatched = true;
313
295
  if (config_.dat && Array.isArray(config_.dat) && config_.dat.includes(reqBody.dat))
314
296
  datMatched = true;
315
297
  if (datMatched) {
@@ -318,30 +300,6 @@ export default class App {
318
300
  httpVersion: req.httpVersion
319
301
  }));
320
302
  }
321
- else {
322
- const { url = "/", method } = req;
323
- const showPanel = config_.devMode !== false;
324
- const compiler = config_.compilerType === 'babel' ? 'babel' : 'esbuild';
325
- const hotReload = config_.hotReload === true;
326
- const notFoundPath = path.join(__dirname, '404.js');
327
- if (fs.existsSync(notFoundPath)) {
328
- try {
329
- let html = await renderPage(notFoundPath, url, showPanel, compiler, hotReload, (config_.autoPage != false));
330
- res.setHeader("Content-Type", "text/html");
331
- res.writeHead(404);
332
- html = html.replace("<script>", "<script>\nwindow.__status_code__ = 404;");
333
- res.end(html);
334
- }
335
- catch (e) {
336
- res.writeHead(404);
337
- res.end(`<html><head></head><body><center><b>404</b> | Not found: ${url}</center></body></html>`);
338
- }
339
- }
340
- else {
341
- res.writeHead(404);
342
- res.end(`<html><head></head><body><center><b>404</b> | Not found: ${url}</center></body></html>`);
343
- }
344
- }
345
303
  });
346
304
  }
347
305
  get(routePath, handler) {
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 React, { useState, useEffect, useRef } from 'react';
3
- import { ShieldCheck, CircleX, ChevronDown, ChevronUp, Bug, AlertTriangle, Info, ArrowLeft, Wifi, Terminal, Route, Globe, ChevronRight, ChevronLeft, Server } from 'lucide-react';
3
+ import { ShieldCheck, CircleX, ChevronDown, ChevronUp, Bug, AlertTriangle, Info, ArrowLeft, Wifi, Terminal, Route, Globe, ChevronRight, ChevronLeft, Server, TriangleAlert } from 'lucide-react';
4
4
  import Prism from 'prismjs';
5
5
  import 'prismjs/components/prism-javascript';
6
6
  Prism.languages.javascript['builtin'] = /\b(window|document|console|navigator|localStorage|sessionStorage|fetch|Promise|setTimeout|setInterval|clearTimeout|clearInterval|requestAnimationFrame|Math|JSON|Object|Array|String|Number|Boolean|Date|RegExp|Error|Map|Set|Symbol|Proxy|Reflect|performance|history|location|screen|crypto|indexedDB|alert|confirm|prompt)\b/;
@@ -121,6 +121,9 @@ function installConsoleInterceptor() {
121
121
  };
122
122
  });
123
123
  }
124
+ function SecuredTab() {
125
+ return (_jsxs("div", { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', flexDirection: 'column', padding: '8px 10px', textAlign: 'center', gap: '8px' }, children: [_jsx(CircleX, { size: 32, color: 'red' }), _jsx("span", { style: { color: 'red', fontSize: 24 }, children: "Tab Isn't 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." })] }));
126
+ }
124
127
  function PanelButton({ onClick, onClick2, children, style, fullWidth, disabled }) {
125
128
  const [hovered, setHovered] = useState(false);
126
129
  const [pressed, setPressed] = useState(false);
@@ -349,20 +352,22 @@ export default function DevPanel() {
349
352
  setUsers(data.users);
350
353
  }
351
354
  };
352
- setTimeout(() => {
353
- getPath();
354
- getCompilerType();
355
- getHttpVersion();
356
- isSSR();
357
- userSettings();
358
- getHostVersion();
359
- getDatMatching();
360
- setInterval(() => {
361
- getUsage();
362
- }, 250);
363
- setInterval(() => {
364
- update();
365
- }, 500);
355
+ setTimeout(async () => {
356
+ await getDatMatching();
357
+ if (datRestrictionMissing === false) {
358
+ getPath();
359
+ getCompilerType();
360
+ getHttpVersion();
361
+ isSSR();
362
+ userSettings();
363
+ getHostVersion();
364
+ setInterval(() => {
365
+ getUsage();
366
+ }, 250);
367
+ setInterval(() => {
368
+ update();
369
+ }, 500);
370
+ }
366
371
  }, 250);
367
372
  }, []);
368
373
  const restart = async () => {
@@ -707,7 +712,7 @@ export default function DevPanel() {
707
712
  border: '1px solid #eee',
708
713
  fontSize: '12px',
709
714
  color: '#333',
710
- }, children: [_jsx("span", { children: "Ping" }), _jsx("span", { style: { color: ping__ < 100 ? '#16a34a' : ping__ < 300 ? '#d97706' : '#e53e3e', fontFamily: 'monospace' }, children: ping__ > 0 ? `${ping__}ms` : '??ms' })] }), _jsx(Sparkline, { data: receivedHistory, color: "#3b82f6", label: "Received", unit: " bytes" }), _jsx(Sparkline, { data: sentHistory, color: "#16a34a", label: "Sent", unit: " bytes" }), networkFetches.length === 0
715
+ }, 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" }), networkFetches.length === 0
711
716
  ? _jsx("div", { style: { color: '#aaa', fontSize: '12px', padding: '4px 2px' }, children: "No network requests yet." })
712
717
  : [...networkFetches].reverse().map((f, i) => (_jsxs("div", { style: {
713
718
  background: '#fff',
@@ -734,7 +739,7 @@ export default function DevPanel() {
734
739
  display: 'flex',
735
740
  alignItems: 'center',
736
741
  gap: '6px',
737
- }, 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 })] }), _jsxs("div", { style: { overflowY: 'auto', maxHeight: '260px', padding: '10px', display: 'flex', flexDirection: 'column', gap: '8px' }, children: [_jsx("span", { style: { fontSize: '24px', color: '#333', fontWeight: 'bold' }, children: pathName }), _jsxs("div", { style: {
742
+ }, 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: {
738
743
  display: 'flex',
739
744
  justifyContent: 'space-between',
740
745
  padding: '6px 10px',
@@ -768,7 +773,7 @@ export default function DevPanel() {
768
773
  display: 'flex',
769
774
  alignItems: 'center',
770
775
  gap: '6px',
771
- }, 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"] })] }), _jsxs("div", { style: { overflowY: 'auto', maxHeight: '260px', padding: '10px', display: '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: {
776
+ }, 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: {
772
777
  display: 'flex',
773
778
  justifyContent: 'space-between',
774
779
  padding: '6px 10px',
@@ -811,7 +816,7 @@ export default function DevPanel() {
811
816
  display: 'flex',
812
817
  alignItems: 'center',
813
818
  gap: '6px',
814
- }, 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"] })] }), _jsxs("div", { style: { overflowY: 'auto', maxHeight: '260px', padding: '10px', display: 'flex', flexDirection: 'column', gap: '8px' }, children: [_jsxs("div", { style: {
819
+ }, 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: {
815
820
  display: 'flex',
816
821
  justifyContent: 'space-between',
817
822
  padding: '6px 10px',
@@ -854,7 +859,7 @@ export default function DevPanel() {
854
859
  display: 'flex',
855
860
  alignItems: 'center',
856
861
  gap: '6px',
857
- }, 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"] })] }), _jsxs("div", { style: { overflowY: 'auto', maxHeight: '260px', padding: '10px', display: '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: {
862
+ }, 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: {
858
863
  display: 'flex',
859
864
  justifyContent: 'space-between',
860
865
  padding: '6px 10px',
@@ -890,7 +895,7 @@ export default function DevPanel() {
890
895
  display: 'flex',
891
896
  alignItems: 'center',
892
897
  gap: '6px',
893
- }, 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"] })] }), _jsxs("div", { style: { overflowY: 'auto', maxHeight: '260px', padding: '10px', display: 'flex', flexDirection: 'column', gap: '8px' }, children: [_jsxs("div", { style: {
898
+ }, 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: {
894
899
  display: 'flex',
895
900
  justifyContent: 'space-between',
896
901
  padding: '6px 10px',
@@ -917,7 +922,7 @@ export default function DevPanel() {
917
922
  border: '1px solid #eee',
918
923
  fontSize: '12px',
919
924
  color: '#333',
920
- }, 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"] }), _jsx("span", { style: { color: '#111', borderRadius: '100px', padding: '1px 6px', fontSize: '10px' }, children: pathName })] }), _jsx(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"] }) }), _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"] }) }), _jsx(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"] }) }), _jsx(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"] }) }), _jsx(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"] }) })] }), _jsxs("div", { style: {
925
+ }, 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: {
921
926
  padding: '6px 8px',
922
927
  borderTop: '1px solid #ddd',
923
928
  background: '#fff',
@@ -955,7 +960,7 @@ export default function DevPanel() {
955
960
  gap: '6px',
956
961
  color: '#fff',
957
962
  flexDirection: 'row',
958
- }, 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."] })) : (_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."] })) : (_jsx(_Fragment, {}))] })] })) }) }), datMatch ? (_jsxs("div", { onClick: () => setOpen(o => !o), style: {
963
+ }, 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, {}))] })] })) }) }), datMatch ? (_jsxs("div", { onClick: () => setOpen(o => !o), style: {
959
964
  display: 'flex',
960
965
  flexDirection: 'row',
961
966
  alignItems: 'center',
@@ -1,30 +1,20 @@
1
1
  import path from "node:path";
2
2
  import fs from "node:fs";
3
3
  import { fileURLToPath } from "node:url";
4
- import { createRequire } from "node:module";
5
4
  import * as esbuild from "esbuild";
5
+ import * as babel from "@babel/core";
6
+ import * as babelPresetEnv from "@babel/preset-env";
6
7
  import React from "react";
7
8
  import { renderToString } from "react-dom/server";
8
9
  import { tempFileForTsx, writeTempFile, readTempFile, ensureTempDirs, } from "./rendererTempFiles.js";
9
10
  const __filename = fileURLToPath(import.meta.url);
10
11
  const __dirname = path.dirname(__filename);
11
- const require = createRequire(import.meta.url);
12
12
  async function buildWithBabel(entryPath, virtualContent, platform) {
13
- let babel;
14
- try {
15
- babel = require('@babel/core');
16
- }
17
- catch {
18
- throw new Error('[authtics] compilerType is "babel" but @babel/core is not installed.\n' +
19
- 'Run: npm install --save-dev @babel/core @babel/preset-env @babel/preset-react @babel/preset-typescript');
20
- }
21
13
  const presets = [
22
- [require('@babel/preset-env'), {
14
+ [babelPresetEnv, {
23
15
  targets: platform === 'node' ? { node: 'current' } : { browsers: '>0.5%, not dead' },
24
16
  modules: platform === 'node' ? 'commonjs' : false,
25
17
  }],
26
- [require('@babel/preset-react'), { runtime: 'automatic' }],
27
- [require('@babel/preset-typescript'), {}],
28
18
  ];
29
19
  const result = await babel.transformAsync(virtualContent, {
30
20
  filename: entryPath,
@@ -121,7 +111,6 @@ function buildHtml(opts) {
121
111
  <head>
122
112
  <meta charset="utf-8" />
123
113
  <meta name="viewport" content="width=device-width, initial-scale=1" />
124
- <title>Authtics</title>
125
114
  </head>
126
115
  <body>
127
116
  <div id="root">${pageHtml}</div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bananacool467/authtics-host",
3
- "version": "0.0.2-beta.1",
3
+ "version": "0.0.2-beta.3",
4
4
  "description": "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",
@@ -40,25 +40,27 @@
40
40
  "author": "bananacool467",
41
41
  "license": "MIT",
42
42
  "dependencies": {
43
+ "@babel/core": "^7.29.0",
44
+ "@babel/preset-env": "^7.29.0",
45
+ "@babel/preset-react": "^7.28.5",
46
+ "@babel/preset-typescript": "^7.28.5",
47
+ "@types/babel__core": "^7.20.5",
48
+ "@types/babel__preset-env": "^7.10.0",
43
49
  "esbuild": "^0.27.3",
44
50
  "jiti": "^2.6.1",
45
51
  "lucide-react": "^0.577.0",
46
52
  "prismjs": "^1.30.0",
47
- "react-device-detect": "^2.2.3",
48
- "@babel/core": "^7.29.0",
49
- "@babel/preset-env": "^7.29.0",
50
- "@babel/preset-react": "^7.28.5",
51
- "@babel/preset-typescript": "^7.28.5"
53
+ "react-device-detect": "^2.2.3"
52
54
  },
53
55
  "peerDependencies": {
54
56
  "react": "^19.2.4",
55
57
  "react-dom": "^19.2.4"
56
58
  },
57
59
  "devDependencies": {
60
+ "@types/node": "^22.13.11",
61
+ "@types/prismjs": "^1.26.6",
58
62
  "@types/react": "^19.2.14",
59
63
  "@types/react-dom": "^19.2.3",
60
- "@types/react-syntax-highlighter": "^15.5.13",
61
- "@types/node": "^22.13.11",
62
- "@types/prismjs": "^1.26.6"
64
+ "@types/react-syntax-highlighter": "^15.5.13"
63
65
  }
64
66
  }