javascript-solid-server 0.0.70 → 0.0.71
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 +1 -1
- package/src/auth/middleware.js +12 -5
package/package.json
CHANGED
package/src/auth/middleware.js
CHANGED
|
@@ -9,6 +9,7 @@ import { checkAccess, getRequiredMode } from '../wac/checker.js';
|
|
|
9
9
|
import { AccessMode } from '../wac/parser.js';
|
|
10
10
|
import * as storage from '../storage/filesystem.js';
|
|
11
11
|
import { getEffectiveUrlPath } from '../utils/url.js';
|
|
12
|
+
import { generateDatabrowserHtml } from '../mashlib/index.js';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Check if request is authorized
|
|
@@ -113,6 +114,12 @@ export function handleUnauthorized(request, reply, isAuthenticated, wacAllow, au
|
|
|
113
114
|
// Check if browser wants HTML
|
|
114
115
|
const accept = request.headers.accept || '';
|
|
115
116
|
if (accept.includes('text/html')) {
|
|
117
|
+
// If mashlib is enabled, serve mashlib instead of static error page
|
|
118
|
+
// Mashlib has built-in login functionality via panes.runDataBrowser()
|
|
119
|
+
if (request.mashlibEnabled) {
|
|
120
|
+
const cdnVersion = request.mashlibCdn ? request.mashlibVersion : null;
|
|
121
|
+
return reply.code(statusCode).type('text/html').send(generateDatabrowserHtml(request.url, cdnVersion));
|
|
122
|
+
}
|
|
116
123
|
return reply.code(statusCode).type('text/html').send(getErrorPage(statusCode, isAuthenticated, request));
|
|
117
124
|
}
|
|
118
125
|
|
|
@@ -315,12 +322,12 @@ function getErrorPage(statusCode, isAuthenticated, request) {
|
|
|
315
322
|
<p class="subtitle">${subtitle}</p>
|
|
316
323
|
|
|
317
324
|
<div class="actions">
|
|
318
|
-
|
|
325
|
+
${is401 ? `<a href="https://solidos.solidcommunity.net/?uri=${encodeURIComponent(baseUrl + request.url)}" class="btn btn-primary">
|
|
326
|
+
Open in Data Browser
|
|
327
|
+
</a>` : ''}
|
|
328
|
+
<a href="${baseUrl}/" class="btn btn-secondary">
|
|
319
329
|
Go to Homepage
|
|
320
330
|
</a>
|
|
321
|
-
${is401 ? `<a href="${baseUrl}/idp/register" class="btn btn-secondary">
|
|
322
|
-
Create Account
|
|
323
|
-
</a>` : ''}
|
|
324
331
|
</div>
|
|
325
332
|
|
|
326
333
|
<div class="divider"><span>What is this?</span></div>
|
|
@@ -330,7 +337,7 @@ function getErrorPage(statusCode, isAuthenticated, request) {
|
|
|
330
337
|
<p>
|
|
331
338
|
This is a <strong>Solid Pod</strong> — a personal data store where you control your own data.
|
|
332
339
|
Resources can be private, shared with specific people, or public.
|
|
333
|
-
${is401 ? "
|
|
340
|
+
${is401 ? "The Data Browser lets you sign in with your WebID to access protected content." : 'Ask the owner to grant you access.'}
|
|
334
341
|
</p>
|
|
335
342
|
</div>
|
|
336
343
|
|