diff --git a/rootfs/standard/usr/share/mynode_apps/canary/app_data/docker-compose.yml b/rootfs/standard/usr/share/mynode_apps/canary/app_data/docker-compose.yml index ecc3644c..dcede9f5 100644 --- a/rootfs/standard/usr/share/mynode_apps/canary/app_data/docker-compose.yml +++ b/rootfs/standard/usr/share/mynode_apps/canary/app_data/docker-compose.yml @@ -8,6 +8,8 @@ services: stop_grace_period: 30s volumes: - /mnt/hdd/mynode/canary:/app/data + env_file: + - /mnt/hdd/mynode/canary/canary.env environment: CANARY_DATA_DIR: /app/data CANARY_ELECTRUM_URL: tcp://127.0.0.1:50001 @@ -24,4 +26,4 @@ services: - backend environment: API_URL: http://127.0.0.1:3004 - PORT: "3005" \ No newline at end of file + PORT: "3005" diff --git a/rootfs/standard/usr/share/mynode_apps/canary/canary.json b/rootfs/standard/usr/share/mynode_apps/canary/canary.json index e8cde289..d3ce7853 100644 --- a/rootfs/standard/usr/share/mynode_apps/canary/canary.json +++ b/rootfs/standard/usr/share/mynode_apps/canary/canary.json @@ -16,7 +16,7 @@ "Get instant notifications when your bitcoins move via ntfy push notifications.", "Features include: transaction monitoring, RBF/CPFP detection, balance alerts, and deep wallet scanning." ], - "latest_version": "v1.4.0", + "latest_version": "v1.5.0", "supported_archs": ["amd64", "arm64"], "download_skip": true, "requires_docker_image_installation": true, @@ -29,7 +29,9 @@ "app_tile_name": "Canary", "app_tile_running_status_text": "Monitoring", "app_tile_default_status_text": "Wallet Monitor", - "app_tile_button_open_app_directly": true, + "app_tile_button_text": "Info", + "app_tile_button_href": "/app/canary/info", + "app_tile_button_open_app_directly": false, "can_uninstall": true, "can_reinstall": true, "can_enable_disable": true, diff --git a/rootfs/standard/usr/share/mynode_apps/canary/scripts/install_canary.sh b/rootfs/standard/usr/share/mynode_apps/canary/scripts/install_canary.sh index 10a0d986..31776da7 100755 --- a/rootfs/standard/usr/share/mynode_apps/canary/scripts/install_canary.sh +++ b/rootfs/standard/usr/share/mynode_apps/canary/scripts/install_canary.sh @@ -9,6 +9,8 @@ set -e echo "==================== INSTALLING APP ====================" +VERSION="${VERSION:-v1.5.0}" + mkdir -p /opt/mynode/canary || true mkdir -p /mnt/hdd/mynode/canary || true diff --git a/rootfs/standard/usr/share/mynode_apps/canary/scripts/pre_canary.sh b/rootfs/standard/usr/share/mynode_apps/canary/scripts/pre_canary.sh index 69b10ac0..bcae1c46 100755 --- a/rootfs/standard/usr/share/mynode_apps/canary/scripts/pre_canary.sh +++ b/rootfs/standard/usr/share/mynode_apps/canary/scripts/pre_canary.sh @@ -2,9 +2,33 @@ set -e -# Keep the compose file in sync with the packaged app data. +DATA_DIR="/mnt/hdd/mynode/canary" +ADMIN_PASSWORD_FILE="$DATA_DIR/admin_password" +JWT_SECRET_FILE="$DATA_DIR/jwt_secret" +ENV_FILE="$DATA_DIR/canary.env" + +generate_secret() { + local length="$1" + tr -dc A-Za-z0-9 < /dev/urandom | head -c "$length" +} + cp -f app_data/docker-compose.yml docker-compose.yml # Ensure data directory exists before starting. -mkdir -p /mnt/hdd/mynode/canary -chown -R bitcoin:bitcoin /mnt/hdd/mynode/canary +mkdir -p "$DATA_DIR" + +if [ ! -s "$ADMIN_PASSWORD_FILE" ]; then + generate_secret 32 > "$ADMIN_PASSWORD_FILE" +fi + +if [ ! -s "$JWT_SECRET_FILE" ]; then + generate_secret 64 > "$JWT_SECRET_FILE" +fi + +cat > "$ENV_FILE" </dev/null || true /usr/local/bin/docker-compose down --remove-orphans 2>/dev/null || true - remove_docker_images_by_name "canary-backend" remove_docker_images_by_name "canary-frontend" +remove_docker_images_by_name "schjonhaug/canary-backend" +remove_docker_images_by_name "schjonhaug/canary-frontend" rm -rf /mnt/hdd/mynode/canary diff --git a/rootfs/standard/usr/share/mynode_apps/canary/www/python/canary.py b/rootfs/standard/usr/share/mynode_apps/canary/www/python/canary.py index 1ef25df5..52ab9005 100644 --- a/rootfs/standard/usr/share/mynode_apps/canary/www/python/canary.py +++ b/rootfs/standard/usr/share/mynode_apps/canary/www/python/canary.py @@ -2,10 +2,20 @@ from user_management import check_logged_in from application_info import get_application, get_application_status, get_application_status_color from device_info import read_ui_settings +import os mynode_canary = Blueprint("mynode_canary", __name__) +CANARY_PASSWORD_FILE = "/mnt/hdd/mynode/canary/admin_password" + + +def get_canary_password(): + if not os.path.isfile(CANARY_PASSWORD_FILE): + return "" + with open(CANARY_PASSWORD_FILE, "r") as password_file: + return password_file.read().strip() + @mynode_canary.route("/info") def canary_page(): @@ -21,5 +31,7 @@ def canary_page(): "app_status": app_status, "app_status_color": app_status_color, "app": app, + "canary_username": "admin@local", + "canary_password": get_canary_password(), } - return render_template("/app/generic_app.html", **template_data) + return render_template("/app/canary/canary.html", **template_data) diff --git a/rootfs/standard/usr/share/mynode_apps/canary/www/templates/canary.html b/rootfs/standard/usr/share/mynode_apps/canary/www/templates/canary.html new file mode 100644 index 00000000..1725053f --- /dev/null +++ b/rootfs/standard/usr/share/mynode_apps/canary/www/templates/canary.html @@ -0,0 +1,210 @@ + + + {{app.name}} + {% include 'includes/head.html' %} + + + + + + + + + {% include 'includes/logo_header.html' %} +
+ +
+ +
{{app.name}}
+
+ +
+
 
+
+ +
+ + {% if not app.hide_status_icon %} +
+ {% endif %} +

{{app_status}}

+ +
+ + {% if not app.is_installed %} + + {% else %} + + {% if app.is_enabled and app.app_page_show_open_button %} + {% if app.http_port != "" or app.https_port != "" %} + + +
+ {% endif %} + {% endif %} + + {% if app.is_enabled %} + + + {% if app.is_enabled and app.data_manageable %} + + {% endif %} + + {% for btn in app.app_page_additional_buttons %} + + {% endfor %} + +
+ {% endif %} + + {% if app.can_enable_disable %} + {% if not app.is_enabled %} + + {% else %} + + {% endif %} + {% endif %} + {% endif %} + +
+ +
+
+
Info
+
+
+ + + + + + {% if app.author.name is defined %} + + + + + {% endif %} + {% if app.website.name is defined and app.website.link is defined %} + + + + + {% endif %} +
Installed Version + {% if app.is_installed %} + {{app.current_version}} + {% else %} + Not Installed + {% endif %} +
Author + {% if app.author.link is defined and app.author.link != "" %} + {{app.author.name}} + {% else %} + {{app.author.name}} + {% endif %} +
Website + {{app.website.name}} +
+
+ +
+
Credentials
+
+
+ + + + + + + + + +
Username{{canary_username}}
Password + {% if canary_password %} + + + show password + {% else %} + Not generated yet + {% endif %} +
+
+ + {% if app.app_page_content is defined and app.app_page_content|length > 0 %} + {% for section in app.app_page_content %} +
+
{{section.heading}}
+
+
+ {% for parapraph in section.content %} +

{{parapraph}}

+ {% endfor %} +
+ {% endfor %} + {% endif %} + +
+ +
+
+ +
+ + + + {% include 'includes/footer.html' %} + +