Bug
When mashlibModule is set in config, unauthenticated requests still get the classic mashlib HTML (referencing /mashlib.min.js and /mash.css) instead of the ES module HTML. This causes 404 errors since the local mashlib files aren't installed.
Cause
In src/auth/middleware.js line 127-129, handleUnauthorized() doesn't check request.mashlibModule:
const html = request.solidosUiEnabled
? generateSolidosUiHtml()
: generateDatabrowserHtml(request.url, request.mashlibCdn ? request.mashlibVersion : null);
It only checks solidosUiEnabled and mashlibCdn, missing the mashlibModule path entirely. The generateModuleDatabrowserHtml function is also not imported.
Fix
Add the import and mashlibModule check:
import { generateDatabrowserHtml, generateModuleDatabrowserHtml, generateSolidosUiHtml } from '../mashlib/index.js';
// In handleUnauthorized:
const html = request.solidosUiEnabled
? generateSolidosUiHtml()
: request.mashlibModule
? generateModuleDatabrowserHtml(request.mashlibModule)
: generateDatabrowserHtml(request.url, request.mashlibCdn ? request.mashlibVersion : null);
Steps to reproduce
- Set
"mashlibModule": "https://unpkg.com/mashlib-next@0.0.8/mashlib.js" in config
- Remove/unset
mashlib, mashlibCdn, mashlibVersion
- Visit any pod resource without authentication
- See old mashlib HTML with 404 errors for
/mashlib.min.js and /mash.css
Bug
When
mashlibModuleis set in config, unauthenticated requests still get the classic mashlib HTML (referencing/mashlib.min.jsand/mash.css) instead of the ES module HTML. This causes 404 errors since the local mashlib files aren't installed.Cause
In
src/auth/middleware.jsline 127-129,handleUnauthorized()doesn't checkrequest.mashlibModule:It only checks
solidosUiEnabledandmashlibCdn, missing themashlibModulepath entirely. ThegenerateModuleDatabrowserHtmlfunction is also not imported.Fix
Add the import and mashlibModule check:
Steps to reproduce
"mashlibModule": "https://unpkg.com/mashlib-next@0.0.8/mashlib.js"in configmashlib,mashlibCdn,mashlibVersion/mashlib.min.jsand/mash.css