mirror of
https://github.com/community-scripts/ProxmoxVED.git
synced 2026-04-05 08:54:03 -04:00
feat(ente): automate first-start setup with ente-setup script
- Add hardcoded OTT (123456) for all emails in museum.yaml so users don't need to search logs for verification codes - Replace separate helper scripts with single 'ente-setup' command that handles: admin whitelisting (user_id from DB), CLI account add, and subscription upgrade in one guided flow - Simplify JSON notes to single first-start instruction
This commit is contained in:
@@ -106,14 +106,10 @@ key:
|
|||||||
jwt:
|
jwt:
|
||||||
secret: $SECRET_JWT
|
secret: $SECRET_JWT
|
||||||
|
|
||||||
# SMTP not configured - verification codes will appear in logs
|
internal:
|
||||||
# To configure SMTP, add:
|
hardcoded-ott:
|
||||||
# smtp:
|
local-domain-suffix: "@"
|
||||||
# host: your-smtp-server
|
local-domain-value: 123456
|
||||||
# port: 587
|
|
||||||
# username: your-username
|
|
||||||
# password: your-password
|
|
||||||
# email: noreply@yourdomain.com
|
|
||||||
EOF
|
EOF
|
||||||
msg_ok "Created museum.yaml"
|
msg_ok "Created museum.yaml"
|
||||||
|
|
||||||
@@ -294,40 +290,59 @@ systemctl reload caddy
|
|||||||
msg_ok "Configured Caddy"
|
msg_ok "Configured Caddy"
|
||||||
|
|
||||||
msg_info "Creating helper scripts"
|
msg_info "Creating helper scripts"
|
||||||
cat <<'EOF' >/usr/local/bin/ente-get-verification
|
cat <<'EOF' >/usr/local/bin/ente-setup
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
echo "Searching for verification codes in museum logs..."
|
set -e
|
||||||
journalctl -u ente-museum --no-pager | grep -i "verification\|verify\|code" | tail -20
|
|
||||||
EOF
|
|
||||||
chmod +x /usr/local/bin/ente-get-verification
|
|
||||||
|
|
||||||
cat <<'EOF' >/usr/local/bin/ente-upgrade-subscription
|
echo "=== Ente First-Time Setup ==="
|
||||||
#!/usr/bin/env bash
|
echo ""
|
||||||
if [ -z "$1" ]; then
|
echo "Prerequisites:"
|
||||||
echo "Usage: ente-upgrade-subscription <email>"
|
echo " 1. Create your account via the web UI (port 3000)"
|
||||||
echo "Example: ente-upgrade-subscription user@example.com"
|
echo " 2. Use verification code: 123456"
|
||||||
|
echo ""
|
||||||
|
read -r -p "Enter your account email: " EMAIL
|
||||||
|
if [ -z "$EMAIL" ]; then
|
||||||
|
echo "Error: Email is required"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
EMAIL="$1"
|
|
||||||
DB_NAME="$(grep -A1 '^db:' /opt/ente/server/museum.yaml | awk '/name:/{print $2}')"
|
DB_NAME="$(grep -A4 '^db:' /opt/ente/server/museum.yaml | awk '/name:/{print $2}')"
|
||||||
DB_USER="$(grep -A2 '^db:' /opt/ente/server/museum.yaml | awk '/user:/{print $2}')"
|
DB_USER="$(grep -A4 '^db:' /opt/ente/server/museum.yaml | awk '/user:/{print $2}')"
|
||||||
USER_ID=$(psql -U "$DB_USER" -d "$DB_NAME" -tAc "SELECT user_id FROM users WHERE email='$EMAIL' LIMIT 1;")
|
USER_ID=$(psql -U "$DB_USER" -d "$DB_NAME" -tAc "SELECT user_id FROM users WHERE email='$EMAIL' LIMIT 1;")
|
||||||
if [ -z "$USER_ID" ]; then
|
if [ -z "$USER_ID" ]; then
|
||||||
echo "Error: No user found with email $EMAIL"
|
echo "Error: No user found with email $EMAIL"
|
||||||
|
echo "Make sure you created and verified the account via the web UI first."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Found user ID: $USER_ID for $EMAIL"
|
echo "Found user ID: $USER_ID"
|
||||||
if ! grep -q "^internal:" /opt/ente/server/museum.yaml; then
|
|
||||||
printf '\ninternal:\n admin: %s\n' "$USER_ID" >> /opt/ente/server/museum.yaml
|
echo ""
|
||||||
echo "Added admin entry to museum.yaml"
|
echo "Step 1/3: Whitelisting admin in museum.yaml..."
|
||||||
systemctl restart ente-museum
|
if grep -q "^internal:" /opt/ente/server/museum.yaml; then
|
||||||
sleep 2
|
sed -i "/^internal:/,/^[^ ]/{/^ admin:/d}" /opt/ente/server/museum.yaml
|
||||||
|
sed -i "/^internal:/a\\ admin: $USER_ID" /opt/ente/server/museum.yaml
|
||||||
else
|
else
|
||||||
echo "internal: section already exists in museum.yaml — verify admin is set"
|
printf '\ninternal:\n admin: %s\n' "$USER_ID" >> /opt/ente/server/museum.yaml
|
||||||
fi
|
fi
|
||||||
|
systemctl restart ente-museum
|
||||||
|
sleep 2
|
||||||
|
echo "Done."
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Step 2/3: Adding account to Ente CLI..."
|
||||||
|
mkdir -p /photos
|
||||||
|
export ENTE_CLI_SECRETS_PATH=/opt/ente/cli-config/secrets.txt
|
||||||
|
ente account add
|
||||||
|
echo "Done."
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Step 3/3: Upgrading subscription (unlimited storage)..."
|
||||||
ente admin update-subscription -a "$EMAIL" -u "$EMAIL" --no-limit True
|
ente admin update-subscription -a "$EMAIL" -u "$EMAIL" --no-limit True
|
||||||
|
echo ""
|
||||||
|
echo "=== Setup Complete ==="
|
||||||
|
echo "You can now use Ente Photos/Auth with unlimited storage."
|
||||||
EOF
|
EOF
|
||||||
chmod +x /usr/local/bin/ente-upgrade-subscription
|
chmod +x /usr/local/bin/ente-setup
|
||||||
|
|
||||||
msg_ok "Created helper scripts"
|
msg_ok "Created helper scripts"
|
||||||
|
|
||||||
|
|||||||
@@ -33,19 +33,7 @@
|
|||||||
},
|
},
|
||||||
"notes": [
|
"notes": [
|
||||||
{
|
{
|
||||||
"text": "First-Start: Create your first user account via the web UI at port 3000",
|
"text": "First-Start: Create your account via the web UI (port 3000), use verification code `123456`, then run `ente-setup`",
|
||||||
"type": "warning"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "First-Start: Check museum logs for the email verification code: `journalctl -u ente-museum -n 100 | grep -i 'verification'`",
|
|
||||||
"type": "warning"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "First-Start: Add your account to the CLI first: `ente account add` (export dir: any path, e.g. /photos)",
|
|
||||||
"type": "warning"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"text": "First-Start: Whitelist admin and remove subscription limit: `ente-upgrade-subscription <email>`",
|
|
||||||
"type": "warning"
|
"type": "warning"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user