diff --git a/README.md b/README.md index 9bdd026b..f5aa1085 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,7 @@ jss --help # Show help | `--base-domain ` | Base domain for subdomains | - | | `--mashlib` | Enable Mashlib (local mode) | false | | `--mashlib-cdn` | Enable Mashlib (CDN mode) | false | +| `--mashlib-module ` | Enable ES module data browser from a URL | - | | `--mashlib-version ` | Mashlib CDN version | 2.0.0 | | `--solidos-ui` | Enable modern SolidOS UI (requires --mashlib) | false | | `--git` | Enable Git HTTP backend | false | @@ -161,6 +162,7 @@ export JSS_CONNEG=true export JSS_SUBDOMAINS=true export JSS_BASE_DOMAIN=example.com export JSS_MASHLIB=true +export JSS_MASHLIB_MODULE=https://example.com/mashlib.js export JSS_NOSTR=true export JSS_INVITE_ONLY=true export JSS_WEBID_TLS=true @@ -367,6 +369,12 @@ cd src/mashlib-local npm install && npm run build ``` +**ES Module Mode** (for custom or next-gen mashlib builds): +```bash +jss start --mashlib-module https://example.com/mashlib.js +``` +Loads an ES module-based data browser from any URL. Uses `
`; } +/** + * Generate ES module-based databrowser HTML + * + * @param {string} moduleUrl - URL to the ES module entry point + * @returns {string} HTML content + */ +export function generateModuleDatabrowserHtml(moduleUrl) { + const cssUrl = moduleUrl.replace(/\.js$/, '.css'); + return ` + +Solid Data Browser + +
+ +`; +} + /** * Check if request wants HTML and mashlib should handle it * @param {object} request - Fastify request diff --git a/src/server.js b/src/server.js index da0c5245..8cbde42c 100644 --- a/src/server.js +++ b/src/server.js @@ -54,7 +54,9 @@ export function createServer(options = {}) { const baseDomain = options.baseDomain || null; // Mashlib data browser is OFF by default // mashlibCdn: if true, load from CDN; if false, serve locally - const mashlibEnabled = options.mashlib ?? false; + // mashlibModule: URL to ES module entry point (alternative to classic mashlib) + const mashlibModule = options.mashlibModule ?? false; + const mashlibEnabled = options.mashlib || !!mashlibModule; const mashlibCdn = options.mashlibCdn ?? false; const mashlibVersion = options.mashlibVersion ?? '2.0.0'; // SolidOS UI (modern Nextcloud-style interface) - requires mashlib @@ -147,6 +149,7 @@ export function createServer(options = {}) { fastify.decorateRequest('mashlibEnabled', null); fastify.decorateRequest('mashlibCdn', null); fastify.decorateRequest('mashlibVersion', null); + fastify.decorateRequest('mashlibModule', null); fastify.decorateRequest('solidosUiEnabled', null); fastify.decorateRequest('defaultQuota', null); fastify.decorateRequest('config', null); @@ -160,6 +163,7 @@ export function createServer(options = {}) { request.mashlibEnabled = mashlibEnabled; request.mashlibCdn = mashlibCdn; request.mashlibVersion = mashlibVersion; + request.mashlibModule = mashlibModule; request.solidosUiEnabled = solidosUiEnabled; request.defaultQuota = defaultQuota; request.config = { public: options.public, readOnly: options.readOnly };