Auto-provision admin user
This commit is contained in:
parent
fe41da40f7
commit
29a8c7e31d
3 changed files with 31 additions and 0 deletions
15
Justfile
15
Justfile
|
|
@ -13,3 +13,18 @@ bundle:
|
||||||
# Build only the Navidrome sidecar binary.
|
# Build only the Navidrome sidecar binary.
|
||||||
sidecar:
|
sidecar:
|
||||||
./desktop/scripts/build.sh --skip-tauri
|
./desktop/scripts/build.sh --skip-tauri
|
||||||
|
|
||||||
|
# Remove Navidrome's persistent state (database, cache, backups) for a clean
|
||||||
|
# first-run. Your music files are NOT touched. Quit the app first.
|
||||||
|
clean-state:
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
case "$(uname -s)" in
|
||||||
|
Darwin) dir="$HOME/Library/Application Support/com.quintodrome.desktop" ;;
|
||||||
|
Linux) dir="${XDG_DATA_HOME:-$HOME/.local/share}/com.quintodrome.desktop" ;;
|
||||||
|
MINGW*|MSYS*|CYGWIN*) dir="${APPDATA:-$HOME/AppData/Roaming}/com.quintodrome.desktop" ;;
|
||||||
|
*) echo "unsupported OS" >&2; exit 1 ;;
|
||||||
|
esac
|
||||||
|
echo "Removing: $dir"
|
||||||
|
rm -rf "$dir"
|
||||||
|
echo "Done. Next launch starts fresh (first-run setup)."
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,11 @@ On launch the app:
|
||||||
4. On exit, sends `SIGTERM` to the spawned server so it shuts down gracefully
|
4. On exit, sends `SIGTERM` to the spawned server so it shuts down gracefully
|
||||||
(falls back to a hard kill after 3s).
|
(falls back to a hard kill after 3s).
|
||||||
|
|
||||||
|
On a **fresh install** (no existing Navidrome data) the app also auto-creates
|
||||||
|
the initial admin user (`admin` / `admin`) behind the scenes, so you skip
|
||||||
|
Navidrome's "create an admin user" first-run screen. Change the password in
|
||||||
|
Navidrome settings afterwards; override it via `QUINTODROME_ADMIN_PASSWORD`.
|
||||||
|
|
||||||
## How to launch
|
## How to launch
|
||||||
|
|
||||||
From the repo root:
|
From the repo root:
|
||||||
|
|
@ -105,6 +110,7 @@ Environment variables override the defaults:
|
||||||
| `QUINTODROME_HOST` | `127.0.0.1` | Address the webview connects to |
|
| `QUINTODROME_HOST` | `127.0.0.1` | Address the webview connects to |
|
||||||
| `QUINTODROME_PORT` | `4533` | Port for the Navidrome server |
|
| `QUINTODROME_PORT` | `4533` | Port for the Navidrome server |
|
||||||
| `QUINTODROME_MUSIC_FOLDER` | OS music dir (e.g. `~/Music`) | Where your music lives |
|
| `QUINTODROME_MUSIC_FOLDER` | OS music dir (e.g. `~/Music`) | Where your music lives |
|
||||||
|
| `QUINTODROME_ADMIN_PASSWORD` | `admin` | Password for the auto-created admin user (fresh installs only) |
|
||||||
| `QUINTODROME_PUBLIC_URL` | `http://quintodrome` | Friendly origin shown in the address bar |
|
| `QUINTODROME_PUBLIC_URL` | `http://quintodrome` | Friendly origin shown in the address bar |
|
||||||
|
|
||||||
The data folder (DB, cache) is always the OS app-data directory
|
The data folder (DB, cache) is always the OS app-data directory
|
||||||
|
|
|
||||||
|
|
@ -104,9 +104,19 @@ fn spawn(handle: &AppHandle, navidrome: &Navidrome) -> Result<(), ServerError> {
|
||||||
music_folder,
|
music_folder,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Auto-provision the first admin user on a fresh install. Navidrome only
|
||||||
|
// honors this during initial setup (when no users/data exist), so an
|
||||||
|
// existing installation is left untouched.
|
||||||
|
let admin_password =
|
||||||
|
std::env::var("QUINTODROME_ADMIN_PASSWORD").unwrap_or_else(|_| "admin".to_string());
|
||||||
|
|
||||||
let (mut rx, child) = handle
|
let (mut rx, child) = handle
|
||||||
.shell()
|
.shell()
|
||||||
.sidecar("navidrome")?
|
.sidecar("navidrome")?
|
||||||
|
.env(
|
||||||
|
"ND_DEVAUTOCREATEADMINPASSWORD",
|
||||||
|
admin_password.as_str(),
|
||||||
|
)
|
||||||
.args(args)
|
.args(args)
|
||||||
.spawn()?;
|
.spawn()?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue