From a345acd4d6b7f9d5b4ca5c633a3f540da5150179 Mon Sep 17 00:00:00 2001 From: NikkeDoy Date: Mon, 18 May 2026 22:09:30 +0300 Subject: [PATCH] :memo: | Fix documentation... again. --- docs/NGINX-STATIC-HOSTING.md | 88 ++++++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 33 deletions(-) diff --git a/docs/NGINX-STATIC-HOSTING.md b/docs/NGINX-STATIC-HOSTING.md index 7d38a9d..9facbc6 100644 --- a/docs/NGINX-STATIC-HOSTING.md +++ b/docs/NGINX-STATIC-HOSTING.md @@ -10,7 +10,7 @@ This guide walks you through hosting the built plugin files using NGINX on your ## Step 1: Prepare the Plugin Files -First, build the plugins locally using Lune: +First, build the plugins and static site using Lune: ```bash # Install pnpm if you haven't already @@ -19,22 +19,31 @@ npm install -g pnpm # Install dependencies pnpm install -# Build the plugins -pnpm lune ci -``` - -This creates the built plugin files in the `dist/` directory. Each plugin gets a folder matching its name (e.g., `dist/gpt-unslothed/`), containing: - -- `plugin.js` — the bundled plugin code (all JSX/JS sources are bundled into a single file) -- `plugin.json` — the plugin manifest - -Optionally, build the static website (SSG) for plugin documentation pages: - -```bash -# Build the static website (includes plugin pages and index) +# Build plugins and generate static website pnpm lune ssg ci ``` +The `dist/` directory contains: + +``` +dist/ +├── index.html # Plugin listing page +├── styles.css # Shared stylesheet +└── gpt-unslothed/ + ├── index.html # Plugin documentation page + ├── plugin.js # Bundled plugin code + └── plugin.json # Plugin manifest +``` + +Lune SSG (Static Site Generator) produces: +- `index.html` — a listing page for all plugins in your monorepo +- `/index.html` — individual documentation pages for each plugin +- `plugin.js` — the bundled plugin code (all JSX/JS sources bundled into a single file) +- `plugin.json` — the plugin manifest +- `styles.css` — the shared stylesheet + +**Note:** To build only the plugin bundles (without the static website), run `pnpm lune ci` instead. + ## Step 2: Set Up the Web Directory Create a directory for the static files: @@ -65,17 +74,11 @@ server { root /var/www/shelter-plugins; index index.html; - # Serve plugin files (JS and JSON) + # Serve plugin directories (each plugin has its own page and files) location /gpt-unslothed { try_files $uri $uri/ =404; } - # Serve preview images - location /previews { - default_type image/png; - try_files $uri $uri/ =404; - } - # Catch-all for 404 location = /404.html { internal; @@ -91,8 +94,8 @@ server { ### Configuration Notes - Change `plugins.your-domain.com` to your actual domain or IP address -- The `try_files` directive lets NGINX auto-detect the correct MIME type for each file -- The configuration serves plugins from paths like `http://plugins.your-domain.com/gpt-unslothed/` +- The `try_files` directive lets NGINX auto-detect the correct MIME type for each file (HTML, CSS, JS, JSON) +- Each plugin directory is served from its own URL path (e.g., `http://plugins.your-domain.com/gpt-unslothed/`) ## Step 4: Enable the Site @@ -109,7 +112,9 @@ sudo systemctl reload nginx ## Step 5: Use in Shelter -In Shelter, add the plugin using the URL: +### Installing plugins + +In Shelter, add the plugin using the plugin manifest URL: ``` http://plugins.your-domain.com/gpt-unslothed/plugin.json @@ -121,6 +126,24 @@ Or if using HTTPS (recommended): https://plugins.your-domain.com/gpt-unslothed/plugin.json ``` +### Viewing the plugin page + +Visiting the plugin directory URL serves the documentation page: + +``` +http://plugins.your-domain.com/gpt-unslothed/ +``` + +This displays the SSG-generated plugin page with a copy-to-clipboard button for the plugin URL. + +### Viewing the index page + +The main plugin listing page is served at: + +``` +http://plugins.your-domain.com/ +``` + ## Optional: Set Up HTTPS with Let's Encrypt Install Certbot and get an SSL certificate: @@ -146,12 +169,8 @@ To make updates easier, you can create a simple deployment script: set -e -# Build plugins -echo "Building plugins..." -pnpm lune ci - -# Build static website (optional, for documentation pages) -echo "Building static website..." +# Build plugins and static website +echo "Building plugins and static website..." pnpm lune ssg ci # Copy files @@ -171,15 +190,18 @@ chmod +x deploy.sh ./deploy.sh ``` -## File Structure +## Server File Structure After deployment, your server should look like this: ``` /var/www/shelter-plugins/ +├── index.html +├── styles.css └── gpt-unslothed/ - ├── plugin.json - └── plugin.js + ├── index.html + ├── plugin.js + └── plugin.json ``` ## Troubleshooting