mrmd-server 0.2.7 → 0.2.8

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. 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.7",
3
+ "version": "0.2.8",
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",
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
- // Validate token
80
- const response = await fetch(`/auth/validate?token=${encodeURIComponent(token)}`);
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('Invalid token. Check your access URL.');
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
- // Token is valid - load the full UI
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) {