Files
next.orly.dev/app/web/rollup.config.js
woikos 7149cebb2f
Some checks failed
Go / build-and-release (push) Has been cancelled
feat(ui): add standalone dashboard mode and relay switching (v0.52.2)
- Add standalone mode for dashboard to connect to any ORLY relay
- Implement relay switcher dropdown in header for standalone mode
- Add mobile drawer sidebar at 640px breakpoint with hamburger menu
- Add dedicated fallback pool for profile/relay list/contact list fetches
- Fix relay URL display to show host instead of NIP-11 name
- Add filter validation and defensive checks in event fetching
- Auto-expand search window from 30 days to 6 months on few results
- Add CORS support for API endpoints with configurable origins
- Fetch user relay list (NIP-65 kind 10002) and contact list on login
- Fix light mode user name color visibility in header

Files modified:
- app/config/config.go: Add CORS configuration options
- app/server.go: Add CORS middleware for API endpoints
- app/handle-relayinfo.go: Include CORS in relay info
- app/web/src/config.js: New config module for standalone mode
- app/web/src/stores.js: Add relay URL and standalone mode stores
- app/web/src/nostr.js: Add fallback pool, filter validation, relay/contact fetch
- app/web/src/Header.svelte: Relay dropdown, mobile menu, static indicator
- app/web/src/Sidebar.svelte: Mobile drawer mode with overlay
- app/web/src/App.svelte: Relay switching, mobile menu state, NIP-65 fetch
- app/web/src/api.js: Use configurable base URL
- app/web/src/constants.js: Add fallback relays, dynamic relay URLs
- cmd/dashboard-server/main.go: New standalone dashboard server

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 11:53:33 +01:00

110 lines
3.2 KiB
JavaScript

import { spawn } from "child_process";
import svelte from "rollup-plugin-svelte";
import commonjs from "@rollup/plugin-commonjs";
import terser from "@rollup/plugin-terser";
import resolve from "@rollup/plugin-node-resolve";
import livereload from "rollup-plugin-livereload";
import css from "rollup-plugin-css-only";
import copy from "rollup-plugin-copy";
import replace from "@rollup/plugin-replace";
const production = !process.env.ROLLUP_WATCH;
// Standalone mode configuration (for dashboard that connects to remote relay)
const standaloneMode = process.env.STANDALONE_MODE === 'true';
const defaultRelayUrl = process.env.DEFAULT_RELAY_URL || '';
// In dev mode, output to public/ so sirv can serve it
// In production, output to dist/ for embedding
const outputDir = production ? "dist" : "public";
function serve() {
let server;
function toExit() {
if (server) server.kill(0);
}
return {
writeBundle() {
if (server) return;
server = spawn("npm", ["run", "start", "--", "--dev"], {
stdio: ["ignore", "inherit", "inherit"],
shell: true,
});
process.on("SIGTERM", toExit);
process.on("exit", toExit);
},
};
}
export default {
input: "src/main.js",
output: {
sourcemap: true,
format: "iife",
name: "app",
file: `${outputDir}/bundle.js`,
},
plugins: [
// Replace environment variables at build time (for standalone mode)
replace({
preventAssignment: true,
'process.env.STANDALONE_MODE': JSON.stringify(standaloneMode ? 'true' : 'false'),
'process.env.DEFAULT_RELAY_URL': JSON.stringify(defaultRelayUrl),
}),
svelte({
compilerOptions: {
// enable run-time checks when not in production
dev: !production,
},
}),
// we'll extract any component CSS out into
// a separate file - better for performance
css({ output: "bundle.css" }),
// If you have external dependencies installed from
// npm, you'll most likely need these plugins. In
// some cases you'll need additional configuration -
// consult the documentation for details:
// https://github.com/rollup/plugins/tree/master/packages/commonjs
resolve({
browser: true,
dedupe: ["svelte"],
exportConditions: ["svelte"],
}),
commonjs(),
// In dev mode, call `npm run start` once
// the bundle has been generated
!production && serve(),
// Watch the `public` directory and refresh the
// browser on changes when not in production
!production && livereload("public"),
// If we're building for production (npm run build
// instead of npm run dev), minify
production && terser(),
// Copy static files from public to dist (only in production)
production && copy({
targets: [
{ src: 'public/index.html', dest: 'dist' },
{ src: 'public/global.css', dest: 'dist' },
{ src: 'public/favicon.png', dest: 'dist' },
{ src: 'public/orly.png', dest: 'dist' },
{ src: 'public/manifest.json', dest: 'dist' },
{ src: 'public/sw.js', dest: 'dist' },
{ src: 'public/icon-192.png', dest: 'dist' },
{ src: 'public/icon-512.png', dest: 'dist' }
]
}),
],
watch: {
clearScreen: false,
},
};