@bananacool467/authtics-host 0.0.1-beta.8 → 0.0.1-beta.9
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 +3 -1
- package/dist/cli.js +19 -4
- package/dist/devPanel.js +25 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
# Authtics Host
|
|
2
2
|
|
|
3
|
-
Version 0.0.1-beta.
|
|
3
|
+
Version 0.0.1-beta.9
|
|
4
4
|
License: MIT
|
|
5
5
|
|
|
6
|
+
**(UPDATE (Security Update): Now versions, 0.0.1-beta.9 and over now requires DAT (Developer Access Token) restriction to access remote controls such as: Restarting and Shutting Down)**
|
|
7
|
+
|
|
6
8
|
**(NOTE: This version is in BETA, bugs are expected)**
|
|
7
9
|
|
|
8
10
|
Authtics Host is a framework inspired by Next.js. Authtics Host supports SSR (Server-Side Rendering) and uses esbuild.
|
package/dist/cli.js
CHANGED
|
@@ -110,6 +110,25 @@ export default class App {
|
|
|
110
110
|
server;
|
|
111
111
|
constructor() {
|
|
112
112
|
this.server = start();
|
|
113
|
+
this.post('/__authtics_host_apis__/get-dat-restriction-missing', async (req, res) => {
|
|
114
|
+
const reqBody = (await getJsonBody(req));
|
|
115
|
+
let datMatched = false;
|
|
116
|
+
let datRestrictedEnv = false;
|
|
117
|
+
if (config_.dat && config_.dat == reqBody.dat)
|
|
118
|
+
datMatched = true;
|
|
119
|
+
if (config_.dat == undefined)
|
|
120
|
+
datMatched = true;
|
|
121
|
+
if (config_.dat && Array.isArray(config_.dat) && config_.dat.includes(reqBody.dat))
|
|
122
|
+
datMatched = true;
|
|
123
|
+
if (datMatched) {
|
|
124
|
+
if (config_.dat !== undefined)
|
|
125
|
+
datRestrictedEnv = true;
|
|
126
|
+
res.writeHead(200, { "Content-Type": "application/json" });
|
|
127
|
+
res.end(JSON.stringify({
|
|
128
|
+
enabled: datRestrictedEnv
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
});
|
|
113
132
|
this.post('/__authtics_host_apis__/get-dat-matching', async (req, res) => {
|
|
114
133
|
const reqBody = (await getJsonBody(req));
|
|
115
134
|
let datMatched = false;
|
|
@@ -180,8 +199,6 @@ export default class App {
|
|
|
180
199
|
let datMatched = false;
|
|
181
200
|
if (config_.dat && config_.dat == reqBody.dat)
|
|
182
201
|
datMatched = true;
|
|
183
|
-
if (config_.dat == undefined)
|
|
184
|
-
datMatched = true;
|
|
185
202
|
if (config_.dat && Array.isArray(config_.dat) && config_.dat.includes(reqBody.dat))
|
|
186
203
|
datMatched = true;
|
|
187
204
|
if (datMatched) {
|
|
@@ -203,8 +220,6 @@ export default class App {
|
|
|
203
220
|
let datMatched = false;
|
|
204
221
|
if (config_.dat && config_.dat == reqBody.dat)
|
|
205
222
|
datMatched = true;
|
|
206
|
-
if (config_.dat == undefined)
|
|
207
|
-
datMatched = true;
|
|
208
223
|
if (config_.dat && Array.isArray(config_.dat) && config_.dat.includes(reqBody.dat))
|
|
209
224
|
datMatched = true;
|
|
210
225
|
if (datMatched) {
|
package/dist/devPanel.js
CHANGED
|
@@ -138,14 +138,14 @@ function installConsoleInterceptor() {
|
|
|
138
138
|
};
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
|
-
function PanelButton({ onClick, onClick2, children, style, fullWidth }) {
|
|
141
|
+
function PanelButton({ onClick, onClick2, children, style, fullWidth, disabled }) {
|
|
142
142
|
const [hovered, setHovered] = useState(false);
|
|
143
143
|
const [pressed, setPressed] = useState(false);
|
|
144
144
|
return (_jsx("div", { onClick: (e) => {
|
|
145
|
-
if (onClick) {
|
|
145
|
+
if (onClick && !disabled) {
|
|
146
146
|
onClick();
|
|
147
147
|
}
|
|
148
|
-
else if (onClick2) {
|
|
148
|
+
else if (onClick2 && !disabled) {
|
|
149
149
|
onClick2(e);
|
|
150
150
|
}
|
|
151
151
|
}, onMouseEnter: () => setHovered(true), onMouseLeave: () => { setHovered(false); setPressed(false); }, onMouseDown: () => setPressed(true), onMouseUp: () => setPressed(false), style: {
|
|
@@ -213,6 +213,7 @@ export default function DevPanel() {
|
|
|
213
213
|
const frames = useRef(0);
|
|
214
214
|
const consoleScrollRef = useRef(null);
|
|
215
215
|
const [isAtBottom, setIsAtBottom] = useState(true);
|
|
216
|
+
const [datRestrictionMissing, setDatRestrictionMissing] = useState(true);
|
|
216
217
|
const [pos, setPos] = React.useState({ x: 20, y: 20 });
|
|
217
218
|
const [dragging, setDragging] = React.useState(false);
|
|
218
219
|
const offset = React.useRef({ x: 0, y: 0 });
|
|
@@ -489,6 +490,16 @@ useEffect(() => {
|
|
|
489
490
|
setDatMatch(data.isMatching);
|
|
490
491
|
if (!data.isMatching) {
|
|
491
492
|
doc?.getElementById('authtics-dev-panel-root')?.remove();
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
const resp2 = await fetch('/__authtics_host_apis__/get-dat-restriction-missing', {
|
|
496
|
+
method: 'POST',
|
|
497
|
+
headers: { 'Content-Type': 'application/json' },
|
|
498
|
+
body: JSON.stringify({ dat: localStorage.getItem('dat') })
|
|
499
|
+
});
|
|
500
|
+
if (resp2.status === 200) {
|
|
501
|
+
const data = await resp2.json();
|
|
502
|
+
setDatRestrictionMissing(!data.enabled);
|
|
492
503
|
}
|
|
493
504
|
}
|
|
494
505
|
};
|
|
@@ -671,17 +682,6 @@ useEffect(() => {
|
|
|
671
682
|
}, []);
|
|
672
683
|
// Chart tick every 2 seconds — snapshot pending bytes then reset
|
|
673
684
|
useEffect(() => {
|
|
674
|
-
/*let nE;
|
|
675
|
-
const navigationEntries = performance.getEntriesByType("navigation");
|
|
676
|
-
if (navigationEntries.length > 0) {
|
|
677
|
-
const navigationEntry = navigationEntries[0] as PerformanceNavigationTiming;
|
|
678
|
-
nE = navigationEntry;
|
|
679
|
-
}
|
|
680
|
-
let statusCode = 404;
|
|
681
|
-
if (nE instanceof PerformanceNavigationTiming) {
|
|
682
|
-
statusCode = nE.responseStatus;
|
|
683
|
-
}
|
|
684
|
-
setStatus(statusCode);*/
|
|
685
685
|
const interval = setInterval(() => {
|
|
686
686
|
const s = pendingSent.current;
|
|
687
687
|
const r = pendingReceived.current;
|
|
@@ -1215,7 +1215,17 @@ useEffect(() => {
|
|
|
1215
1215
|
gap: '6px',
|
|
1216
1216
|
color: '#fff',
|
|
1217
1217
|
flexDirection: 'row',
|
|
1218
|
-
}, children: [_jsx(CircleX, { size: 12 }), "Invalid Developer Access Token (DAT)"] }) })) : (_jsx(_Fragment, {})),
|
|
1218
|
+
}, children: [_jsx(CircleX, { size: 12 }), "Invalid Developer Access Token (DAT)"] }) })) : (_jsx(_Fragment, {})), hostVersion === "0.0.1-beta.9" ? (_jsx(_Fragment, { children: _jsx("div", { style: {
|
|
1219
|
+
display: 'flex',
|
|
1220
|
+
background: 'orange',
|
|
1221
|
+
borderRadius: '10px',
|
|
1222
|
+
padding: '6px 10px',
|
|
1223
|
+
justifyContent: 'left',
|
|
1224
|
+
alignItems: 'center',
|
|
1225
|
+
gap: '6px',
|
|
1226
|
+
color: '#fff',
|
|
1227
|
+
flexDirection: 'row',
|
|
1228
|
+
}, 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: {
|
|
1219
1229
|
display: 'flex',
|
|
1220
1230
|
flexDirection: 'row',
|
|
1221
1231
|
alignItems: 'center',
|
package/package.json
CHANGED