diff --git a/packages/voidauth/frontend.nix b/packages/voidauth/frontend.nix index 543b394c..04b1905b 100644 --- a/packages/voidauth/frontend.nix +++ b/packages/voidauth/frontend.nix @@ -6,12 +6,12 @@ nix-update-script, }: buildNpmPackage (finalAttrs: { - pname = "voidauth"; + pname = "voidauth-frontend"; inherit src version; sourceRoot = "${finalAttrs.src.name}/frontend"; - npmDepsHash = "sha256-xsOqxQGrwF9p40tdK5agMMAQ3/BWMk6AUz2h3KLN8Gw="; + npmDepsHash = "sha256-a6Hskz2R9aMwU2BJgSgisZUT4Nyb/jeKCOpSD4OQRgw="; npmBuildScript = "build"; nativeBuildInputs = [ diff --git a/packages/voidauth/override-frontend-path.patch b/packages/voidauth/override-frontend-path.patch index bf48479c..0f20e5df 100644 --- a/packages/voidauth/override-frontend-path.patch +++ b/packages/voidauth/override-frontend-path.patch @@ -1,8 +1,8 @@ diff --git c/docs/Getting-Started.md w/docs/Getting-Started.md -index a8ce6f4..61d5c0d 100644 +index 2effedc..7a864a6 100644 --- c/docs/Getting-Started.md +++ w/docs/Getting-Started.md -@@ -119,6 +119,7 @@ VoidAuth is configurable primarily by environment variable. The available enviro +@@ -125,6 +125,7 @@ VoidAuth is configurable primarily by environment variable. The available enviro | APP_COLOR | `#906bc7` | Theme color, rgb format; ex. #xxyyzz | | ✅ | | APP_FONT | `monospace` | Font used in the web interface and sent emails. Safe fonts should be used, if a font is missing it will fallback to default. Multiple font families may be chosen in fallback-font format. ex. `APP_FONT: "Tahoma, Verdana, sans-serif"` | | | | CONTACT_EMAIL | | The email address used for 'Contact' links, which are shown on most end-user pages if this is set. | | | @@ -10,38 +10,39 @@ index a8ce6f4..61d5c0d 100644 #### Database Settings When using the `sqlite` database adapter type, no additional database connection variables are required. You will need a mounted volume to hold the generated `db.sqlite` file, as shown in the SQLite docker compose example above. -@@ -189,4 +190,3 @@ For information on how to change the email templates used for invitations, passw +@@ -198,4 +199,3 @@ For information on how to change the email templates used for invitations, passw ### Multi-Domain Protection You can secure multiple domains you own by running multiple instances of VoidAuth using the same database. They should have the same **STORAGE_KEY** and **DB_\*** variables, but may otherwise have completely different configurations. The **APP_URL** variables of each would cover a different domain. If the domains you were trying to secure were `example.com` and `your-domain.net` you might set the **APP_URL** variables like `https://auth.example.com` and `https://id.your-domain.net`. These two instances would share everything in the shared DB, including users, OIDC Apps, ProxyAuth Domains, etc. - diff --git c/server/cli/server.ts w/server/cli/server.ts -index bfd6e25..9d7b676 100644 +index f076cf2..39253b0 100644 --- c/server/cli/server.ts +++ w/server/cli/server.ts -@@ -18,9 +18,6 @@ import { createInitialAdmin } from '../db/user' - import { logger } from '../util/logger' - import { standardRateLimit } from '../util/rateLimit' +@@ -20,7 +20,9 @@ import { sensitiveRateLimit, standardRateLimit } from '../util/rateLimit' + import { FORBIDDEN_PATHS, NOT_FOUND_PATHS } from '@shared/constants' --const PROCESS_ROOT = path.dirname(process.argv[1] ?? '.') + const PROCESS_ROOT = path.dirname(process.argv[1] ?? '.') -const FE_ROOT = path.join(PROCESS_ROOT, '../frontend/dist/browser') -- ++const FE_ROOT = process.env.FRONTEND_PATH ++ ? path.resolve(process.env.FRONTEND_PATH) ++ : path.join(PROCESS_ROOT, '../frontend/dist/browser') + export async function serve() { // Do not wait for theme to generate before starting - void generateTheme() -@@ -138,7 +135,7 @@ export async function serve() { - }) - - // frontend -- app.use(`${basePath()}/`, express.static(FE_ROOT, { -+ app.use(`${basePath()}/`, express.static(appConfig.FRONTEND_PATH, { - index: false, - fallthrough: true, - })) -@@ -172,7 +169,8 @@ export async function serve() { +@@ -217,7 +219,7 @@ export async function serve() { + } + next() + }, +- express.static(FE_ROOT, { ++ express.static(appConfig.FRONTEND_PATH, { + index: false, + fallthrough: true, + }), +@@ -272,7 +274,8 @@ export async function serve() { function modifyIndex() { - // add APP_TITLE + // add APP_TITLE - let index = fs.readFileSync(path.join(FE_ROOT, './index.html')).toString().replace('', '<title>' + appConfig.APP_TITLE) + const indexPath = path.join(appConfig.FRONTEND_PATH, './index.html') + let index = fs.readFileSync(indexPath).toString().replace('<title>', '<title>' + appConfig.APP_TITLE) @@ -49,13 +50,13 @@ index bfd6e25..9d7b676 100644 // Replace base href with path of APP_URL index = index.replace(/<base[^>]*href=[^>]*>/g, `<base href="${basePath()}/"/>`) diff --git c/server/util/config.ts w/server/util/config.ts -index 1e43667..e9f7efa 100644 +index 16a3a57..7801278 100644 --- c/server/util/config.ts +++ w/server/util/config.ts -@@ -7,12 +7,16 @@ import type { ClientResponse } from '@shared/api-response/ClientResponse.js' - import Docker from 'dockerode' - import { clientUpsertValidator } from '@shared/api-request/admin/ClientUpsert' +@@ -8,12 +8,16 @@ import { clientUpsertValidator } from '@shared/api-request/admin/ClientUpsert' import zod from 'zod' + import type { SecureVersion } from 'node:tls' + import { randomBytes } from 'node:crypto' +import path from 'node:path' + +const PROCESS_ROOT = path.dirname(process.argv[1] ?? '.') diff --git a/packages/voidauth/package.nix b/packages/voidauth/package.nix index 58bd85e8..d0265862 100644 --- a/packages/voidauth/package.nix +++ b/packages/voidauth/package.nix @@ -9,13 +9,13 @@ }: buildNpmPackage (finalAttrs: { pname = "voidauth"; - version = "1.11.2"; + version = "1.12.2"; src = fetchFromGitHub { owner = "voidauth"; repo = "voidauth"; tag = "v${finalAttrs.version}"; - hash = "sha256-KMKwg2V/epw5oKhcboWH3xcEZbjvA86A3kv5pooa2HE="; + hash = "sha256-JbxwlgKldI6UoZ5PSX3nfiHsWqeVbMS7wyC7QKdbdpk="; }; # Override frontend path with an environment variable so we don't need to copy it around @@ -48,7 +48,7 @@ buildNpmPackage (finalAttrs: { echo '!dist/index.mjs' >> .npmignore ''; - npmDepsHash = "sha256-AWIy/DeStXoTHJv8Sk/Sqz0xJugOVg+zLq5TUv2PJ9U="; + npmDepsHash = "sha256-36HGJ8Kg8kRg9n0q1MHVEyaJ+VCXcMecqsLk+Wgw0yc="; npmBuildScript = "server:build"; postInstall = ''