From 6c1d1e1e71e09c819abca17e7b380c27ae90262b Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Wed, 28 Jan 2026 11:06:02 +0100 Subject: [PATCH] Refactor: NPMPlus / Default Login (#11262) --- frontend/public/json/npmplus.json | 10 +++---- install/npmplus-install.sh | 44 ++----------------------------- 2 files changed, 5 insertions(+), 49 deletions(-) diff --git a/frontend/public/json/npmplus.json b/frontend/public/json/npmplus.json index 681f55cd2..2e74d4e5b 100644 --- a/frontend/public/json/npmplus.json +++ b/frontend/public/json/npmplus.json @@ -39,8 +39,8 @@ } ], "default_credentials": { - "username": "admin@example.org", - "password": null + "username": "admin@local.com", + "password": "helper-scripts.com" }, "notes": [ { @@ -48,11 +48,7 @@ "type": "info" }, { - "text": "The initial starting process can be take 1-2min. ", - "type": "info" - }, - { - "text": "Application credentials: `cat /opt/.npm_pwd` - if file not exist in LXC check docker logs for password with `docker logs npmplus`", + "text": "The initial starting process can take 1-2min. ", "type": "info" } ] diff --git a/install/npmplus-install.sh b/install/npmplus-install.sh index 1d709e107..e546c18d2 100644 --- a/install/npmplus-install.sh +++ b/install/npmplus-install.sh @@ -59,8 +59,8 @@ read -r -p "${TAB3}Enter your ACME Email: " ACME_EMAIL_INPUT yq -i " .services.npmplus.environment |= - (map(select(. != \"TZ=*\" and . != \"ACME_EMAIL=*\")) + - [\"TZ=$TZ_INPUT\", \"ACME_EMAIL=$ACME_EMAIL_INPUT\"]) + (map(select(. != \"TZ=*\" and . != \"ACME_EMAIL=*\" and . != \"INITIAL_ADMIN_EMAIL=*\" and . != \"INITIAL_ADMIN_PASSWORD=*\")) + + [\"TZ=$TZ_INPUT\", \"ACME_EMAIL=$ACME_EMAIL_INPUT\", \"INITIAL_ADMIN_EMAIL=admin@local.com\", \"INITIAL_ADMIN_PASSWORD=helper-scripts.com\"]) " /opt/compose.yaml msg_info "Building and Starting NPMplus (Patience)" @@ -86,43 +86,3 @@ msg_ok "Builded and started NPMplus" motd_ssh customize - -msg_info "Retrieving Default Login (Patience)" -PASSWORD_FOUND=0 - -# Try to find password in existing logs (max 120 seconds) -for i in {1..60}; do - PASSWORD_LINE=$( - { awk '/Creating a new user:/{print; exit}' < <(docker logs "$CONTAINER_ID" 2>&1); } || true - ) - - if [[ -n "${PASSWORD_LINE:-}" ]]; then - PASSWORD="${PASSWORD_LINE#*password: }" - printf 'username: admin@example.org\npassword: %s\n' "$PASSWORD" >/opt/.npm_pwd - msg_ok "Saved default login to /opt/.npm_pwd" - PASSWORD_FOUND=1 - break - fi - sleep 2 -done - -# If not found, try live log stream (30s) -if [[ $PASSWORD_FOUND -eq 0 ]]; then - PASSWORD_LINE=$( - timeout 30s bash -c ' - docker logs -f --since=0s --tail=0 "$1" 2>&1 | awk "/Creating a new user:/{print; exit}" - ' _ "$CONTAINER_ID" 2>/dev/null || true - ) - if [[ -n "${PASSWORD_LINE:-}" ]]; then - PASSWORD="${PASSWORD_LINE#*password: }" - printf 'username: admin@example.org\npassword: %s\n' "$PASSWORD" >/opt/.npm_pwd - msg_ok "Saved default login to /opt/.npm_pwd" - PASSWORD_FOUND=1 - fi -fi - -if [[ $PASSWORD_FOUND -eq 0 ]]; then - msg_warn "Default login not found in logs (this is normal for NPMplus)" - msg_custom "💡" "${GN}" "NPMplus creates an admin account on first web access" - msg_custom "📋" "${GN}" "Visit http://:81 and create your admin user" -fi