mrmd-server 0.2.7 → 0.2.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/package.json +2 -1
- package/static/index.html +11 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mrmd-server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "HTTP server for mrmd - run mrmd in any browser, access from anywhere",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"multer": "^1.4.5-lts.1",
|
|
47
47
|
"chokidar": "^3.6.0",
|
|
48
48
|
"fzf": "^0.5.2",
|
|
49
|
+
"mrmd-electron": "^0.5.4",
|
|
49
50
|
"mrmd-project": "^0.1.2",
|
|
50
51
|
"mrmd-sync": "^0.3.3"
|
|
51
52
|
}
|
package/static/index.html
CHANGED
|
@@ -65,28 +65,27 @@
|
|
|
65
65
|
</div>
|
|
66
66
|
|
|
67
67
|
<script>
|
|
68
|
-
// Validate token and load the full UI
|
|
68
|
+
// Validate token (or no-auth mode) and load the full UI
|
|
69
69
|
async function init() {
|
|
70
70
|
const params = new URLSearchParams(window.location.search);
|
|
71
|
-
const token = params.get('token');
|
|
72
|
-
|
|
73
|
-
if (!token) {
|
|
74
|
-
showError('No token provided. Add ?token=YOUR_TOKEN to the URL.');
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
71
|
+
const token = params.get('token') || '';
|
|
77
72
|
|
|
78
73
|
try {
|
|
79
|
-
//
|
|
80
|
-
const
|
|
74
|
+
// Ask the server — it returns { valid: true } when --no-auth is set
|
|
75
|
+
const url = token
|
|
76
|
+
? `/auth/validate?token=${encodeURIComponent(token)}`
|
|
77
|
+
: `/auth/validate`;
|
|
78
|
+
const response = await fetch(url);
|
|
81
79
|
const result = await response.json();
|
|
82
80
|
|
|
83
81
|
if (!result.valid) {
|
|
84
|
-
showError(
|
|
82
|
+
showError(token
|
|
83
|
+
? 'Invalid token. Check your access URL.'
|
|
84
|
+
: 'No token provided. Add ?token=YOUR_TOKEN to the URL.');
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
//
|
|
89
|
-
// We'll redirect to the main app or load it inline
|
|
88
|
+
// Auth passed — load the full UI
|
|
90
89
|
loadMainApp();
|
|
91
90
|
|
|
92
91
|
} catch (err) {
|