Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings panels blank on desktop; working on iOS/mobile? #659

Closed
2 tasks done
joestump opened this issue Apr 30, 2024 · 15 comments
Closed
2 tasks done

Settings panels blank on desktop; working on iOS/mobile? #659

joestump opened this issue Apr 30, 2024 · 15 comments
Labels
bug 🐛 Something isn't working Workaround provided ⚒️ A workaround for the issue was provided so no further actions will be taken.

Comments

@joestump
Copy link

Is there an existing issue for this?

Current Behavior

Not entirely sure what's going on here, but settings only show up for me when I use Safari on iOS. On Firefox, Safari, and Chrome on the desktop all of the setting sections show up blank save the "Read more in the docs" links. The following two screenshots are the same settings page - one taken from Chrome on MacOS and one taken from Safari on iOS.

Working settings on iOS:

signal-2024-04-30-071323_002

Blank settings on desktop:

image

Expected Behavior

Settings are confgurable from desktop and mobile browsers.

Steps To Reproduce

  1. Set up a fresh install using jokobsk/netalertx:latest
  2. Go to Settings on the Desktop

I even did an rm -fr on the bind mount, deleted the container, and started from scratch.

app.conf

#-----------------AUTOGENERATED FILE-----------------#
#                                                    #
#         Generated:  2022-12-30_22-19-40            #
#                                                    #
#   Config file for the LAN intruder detection app:  #
#      https://github.com/jokob-sk/NetAlertX          #
#                                                    #
#-----------------AUTOGENERATED FILE-----------------#

# 🔺 Use the Settings UI - only edit when necessary 🔺


# General
#---------------------------
# Scan using interface eth0
# SCAN_SUBNETS    = ['192.168.1.0/24 --interface=eth0']
#
# Scan multiple interfaces (eth1 and eth0):
# SCAN_SUBNETS    = [ '192.168.1.0/24 --interface=eth1', '192.168.1.0/24 --interface=eth0' ]

SCAN_SUBNETS=['192.168.1.0/24 --interface=eth1']

TIMEZONE='America/Los_Angeles'
PIALERT_WEB_PROTECTION=False
PIALERT_WEB_PASSWORD='8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92'
DAYS_TO_KEEP_EVENTS=90
# Used for generating links in emails. Make sure not to add a trailing slash!
REPORT_DASHBOARD_URL='http://netalertx'


# Email
#---------------------------
SMTP_RUN='disabled'  # use 'on_notification' to enable
SMTP_SERVER='smtp.gmail.com'
SMTP_PORT=587
SMTP_REPORT_TO='user@gmail.com'
SMTP_REPORT_FROM='NetAlertX <user@gmail.com>'
SMTP_SKIP_LOGIN=False
SMTP_USER='user@gmail.com'
SMTP_PASS='password'
SMTP_SKIP_TLS=False


# Webhooks
#---------------------------
WEBHOOK_RUN='disabled'  # use 'on_notification' to enable
WEBHOOK_URL='http://n8n.local:5555/webhook-test/aaaaaaaa-aaaa-aaaa-aaaaa-aaaaaaaaaaaa'
WEBHOOK_PAYLOAD='json'                 # webhook payload data format for the "body > attachements > text" attribute 
                                       # in https://github.com/jokob-sk/NetAlertX/blob/main/docs/webhook_json_sample.json 
                                       #   supported values: 'json', 'html' or 'text'
                                       #   e.g.: for discord use 'html'
WEBHOOK_REQUEST_METHOD='GET'


# Apprise
#---------------------------
APPRISE_RUN='disabled'  # use 'on_notification' to enable
APPRISE_HOST='http://localhost:8000/notify'
APPRISE_URL='mailto://smtp-relay.sendinblue.com:587?from=user@gmail.com&name=apprise&user=user@gmail.com&pass=password&to=user@gmail.com'


# NTFY
#---------------------------
NTFY_RUN='disabled'  # use 'on_notification' to enable
NTFY_HOST='https://ntfy.sh'
NTFY_TOPIC='replace_my_secure_topicname_91h889f28'
NTFY_USER='user'
NTFY_PASSWORD='passw0rd'


# PUSHSAFER
#---------------------------
PUSHSAFER_RUN='disabled'  # use 'on_notification' to enable
PUSHSAFER_TOKEN='ApiKey'


# MQTT
#---------------------------
MQTT_RUN='disabled'  # use 'on_notification' to enable
MQTT_BROKER='192.168.1.2'
MQTT_PORT=1883
MQTT_USER='mqtt'
MQTT_PASSWORD='passw0rd'
MQTT_QOS=0
MQTT_DELAY_SEC=2


#-------------------IMPORTANT INFO-------------------#
#   This file is ingested by a python script, so if  #
#        modified it needs to use python syntax      #
#-------------------IMPORTANT INFO-------------------#

docker-compose.yml

---
- name: NetAlertX
  hosts: int01
  vars:
    defaults:
      netalertx:
        image: jokobsk/netalertx:latest
        enabled: true
        port: 20211
        dns: netalertx
        homepage:
          group: Network
          weight: 350
    conf: "{{ defaults.netalertx | combine(netalertx, recursive=true) }}"
  tasks:
  - name: Create main {{ conf.dns }} directory
    file:
      path: "{{ paths.local }}/{{ conf.dns }}"
      state: directory

  - name: Create {{ conf.dns }} directories
    file:
      path: "{{ paths.local }}/{{ conf.dns }}/{{ item }}"
      state: directory
    loop: 
      - config
      - db

  - name: Docker Compose
    community.docker.docker_compose:
      project_name: netalertx
      definition:
        version: "3"
        services:
          netalertx:
            image: "{{ conf.image }}"
            container_name: netalertx
            network_mode: "host"
            labels:
              homepage.group: "{{ conf.homepage.group }}"
              homepage.name: NetAlertX
              homepage.icon: pi-alert
              homepage.href: https://{{ conf.dns }}.{{ dns.wtf }}
              homepage.description: Networkg device monitor on {{ inventory_hostname }}
              homepage.weight: "{{ conf.homepage.weight }}"
              homepage.widget.type: netalertx
              homepage.widget.url: https://{{ conf.dns }}.{{ dns.wtf }}
              com.centurylinklabs.watchtower.enable: "{{ conf.watchtower | default('true')}}"
              caddy: "{{ conf.dns }}.{{ dns.wtf }}"
              caddy.reverse_proxy: "{{ ansible_host }}:{{ conf.port }}"
            environment:
              PORT: "{{ conf.port }}"
              TZ: "{{ tz }}"
              REPORT_DASHBOARD_URL: "https://{{ conf.dns }}.{{ dns.wtf }}"
            volumes:
              - "{{ paths.local }}/{{ conf.dns }}/config:/app/config"
              - "{{ paths.local }}/{{ conf.dns }}/db:/app/db"
            restart: "unless-stopped"

  - name: CNAME {{ conf.dns }}.{{ dns.wtf }} to {{ ansible_host }}
    amazon.aws.route53:
      state: present
      overwrite: true
      zone: "{{ dns.wtf }}"
      record: "{{ conf.dns }}.{{ dns.wtf }}"
      type: CNAME
      value: "{{ ansible_host }}"
      ttl: 60

What branch are you running?

Production

app.log

04:20:31 ------------------------------------------------
04:20:31   /config/app.conf |  READ  | True
04:20:31   /config/app.conf |  WRITE | True
04:20:31   /db/app.db       |  READ  | True
04:20:31   /db/app.db       |  WRITE | True
04:20:31 ------------------------------------------------
04:20:31 [Setup] Attempting to fix permissions.
04:20:31 [Setup] Attempting to fix permissions.
04:20:31 [Database] Opening DB
04:20:31 [upgradeDB] Re-creating Settings table
04:20:31 [upgradeDB] Re-creating Pholus_Scan table
04:20:31 [upgradeDB] Re-creating Parameters table
04:20:32 [Version check] Running the latest version.
04:20:32 [Config] reading config file
04:20:32 [Config] Plugins: Number of dynamically loaded plugins: 29
04:20:32 [Plugin utils] ---------------------------------------------
04:20:32 [Plugin utils] display_name: Services & Ports (NMAP)
04:20:32 [Plugin utils] description: This plugin shows all services discovered by NMAP scans.
04:20:32 [Plugin utils] ---------------------------------------------
04:20:32 [Plugin utils] display_name: NTFY publisher
04:20:32 [Plugin utils] description: A plugin to publish a notification via the NTFY gateway.
04:20:33 [Plugin utils] ---------------------------------------------
04:20:33 [Plugin utils] display_name: Arp-Scan (Network scan)
04:20:33 [Plugin utils] description: This plugin is to execute an arp-scan on the local network
04:20:33 [Plugin utils] ---------------------------------------------
04:20:33 [Plugin utils] display_name: Website monitor
04:20:33 [Plugin utils] description: This plugin is to monitor status changes of services or websites.
04:20:33 [Plugin utils] ---------------------------------------------
04:20:33 [Plugin utils] display_name: Notification Processing
04:20:33 [Plugin utils] description: A plugin to for advanced notification processing.
04:20:33 [Plugin utils] ---------------------------------------------
04:20:33 [Plugin utils] display_name: Vendor update
04:20:33 [Plugin utils] description: A plugin to schedule vendor database updates for mac based vendor resolution.
04:20:33 [Plugin utils] ---------------------------------------------
04:20:33 [Plugin utils] display_name: DHCP Leases (Device import)
04:20:33 [Plugin utils] description: This plugin is to import devices from dhcp.leases files.
04:20:33 [Plugin utils] ---------------------------------------------
04:20:33 [Plugin utils] display_name: UniFi import
04:20:33 [Plugin utils] description: This plugin is used to import devices from an UNIFI controller.
04:20:33 [Plugin utils] ---------------------------------------------
04:20:33 [Plugin utils] display_name: Un-Discoverable Devices
04:20:33 [Plugin utils] description: This plugin is to import undiscoverable devices from a file.
04:20:33 [Plugin utils] ---------------------------------------------
04:20:33 [Plugin utils] display_name: CSV backup
04:20:33 [Plugin utils] description: A plugin to auto-generate devices.csv backups.
04:20:33 [Plugin utils] ---------------------------------------------
04:20:33 [Plugin utils] display_name: SNMP discovery
04:20:33 [Plugin utils] description: This plugin is used to discover devices via the arp table(s) of a RFC1213 compliant router or switch.
04:20:33 [Plugin utils] ---------------------------------------------
04:20:34 [Plugin utils] ---------------------------------------------
04:20:34 [Plugin utils] display_name: DDNS update
04:20:34 [Plugin utils] description: A plugin update the DDNS record.
04:20:34 [Plugin utils] ---------------------------------------------
04:20:34 [Plugin utils] display_name: Apprise publisher
04:20:34 [Plugin utils] description: A plugin to publish a notification via the Apprise gateway.
04:20:34 [Plugin utils] ---------------------------------------------
04:20:34 [Plugin utils] display_name: Set password
04:20:34 [Plugin utils] description: A simple plugin to set the web ui password on app start.
04:20:34 [Plugin utils] ---------------------------------------------
04:20:34 [Plugin utils] display_name: Pholus (Name discovery)
04:20:34 [Plugin utils] description: This plugin is to execute a Pholus (name discovery) on the local network
04:20:34 [Plugin utils] ---------------------------------------------
04:20:34 [Plugin utils] display_name: PiHole (Device sync)
04:20:34 [Plugin utils] description: This plugin syncs devices from the PiHole database
04:20:34 [Plugin utils] ---------------------------------------------
04:20:34 [Plugin utils] display_name: Internet-Check
04:20:34 [Plugin utils] description: A plugin to check your internet connectivity and IP.
04:20:34 [Plugin utils] ---------------------------------------------
04:20:34 [Plugin utils] display_name: New Devices
04:20:34 [Plugin utils] description: The template used for new devices.
04:20:34 [Plugin utils] ---------------------------------------------
04:20:34 [Plugin utils] display_name: Rogue DHCP
04:20:34 [Plugin utils] description: This plugin is to use NMAP to monitor for rogue DHCP servers.
04:20:34 [Plugin utils] --------------------------------------------
04:20:34 [Plugin utils] display_name: DB cleanup
04:20:34 [Plugin utils] description: A plugin to schedule database cleanup & upkeep tasks.
04:20:34 [Plugin utils] ---------------------------------------------
04:20:34 [Plugin utils] display_name: Webhook publisher
04:20:34 [Plugin utils] description: A plugin to publish a notification via Webhooks.
04:20:34 [Plugin utils] ---------------------------------------------
04:20:34 [Plugin utils] display_name: Email publisher (SMTP)
04:20:34 [Plugin utils] description: A plugin to publish a notification via Email (SMTP) gateway.
04:20:34 [Plugin utils] ---------------------------------------------
04:20:34 [Plugin utils] display_name: Pushsafer publisher
04:20:34 [Plugin utils] description: A plugin to publish a notification via the Pushsafer gateway.
04:20:35 [Plugin utils] ---------------------------------------------
04:20:35 [Plugin utils] display_name: Workflows
04:20:35 [Plugin utils] description: A plugin to adjust behavior of workflows.
04:20:35 [Plugin utils] ---------------------------------------------
04:20:35 [Plugin utils] display_name: MQTT publisher
04:20:35 [Plugin utils] description: A plugin to publish a notification via the Apprise gateway.
04:20:35 [Plugin utils] ---------------------------------------------
04:20:35 [Plugin utils] display_name: Internet speedtest
04:20:35 [Plugin utils] description: A plugin to perform a scheduled internet speedtest.
04:20:35 [Plugin utils] ---------------------------------------------
04:20:35 [Plugin utils] display_name: NSLOOKUP (Name discovery)
04:20:35 [Plugin utils] description: A plugin to discover device names.
04:20:35 [Plugin utils] ---------------------------------------------
04:20:35 [Plugin utils] display_name: Pushover publisher
04:20:35 [Plugin utils] description: A plugin to publish a notification via the pushover.net
04:20:36 [API] Updating table_settings.json file in /front/api
04:20:36 [Config] Imported new config
04:20:36 [API] Updating table_appevents.json file in /front/api
04:20:36 [API] Updating table_devices.json file in /front/api
04:20:36 [API] Updating table_events_pending_alert.json file in /front/api
04:20:36 [API] Updating table_plugins_events.json file in /front/api
04:20:36 [API] Updating table_plugins_history.json file in /front/api
04:20:36 [API] Updating table_plugins_objects.json file in /front/api
04:20:36 [API] Updating table_plugins_language_strings.json file in /front/api
04:20:36 [API] Updating table_notifications.json file in /front/api
04:20:36 [API] Updating table_custom_endpoint.json file in /front/api
04:20:36 [Plugin utils] ---------------------------------------------
04:20:36 [Plugin utils] display_name: NSLOOKUP (Name discovery)

Debug enabled

  • I have read and followed the steps in the wiki link above and provided the required debug logs and the log section covers the time when the issue occurs.
@joestump joestump added the bug 🐛 Something isn't working label Apr 30, 2024
@joestump
Copy link
Author

It's the most broken on Firefox:

netalertx-firefox

@jokob-sk
Copy link
Owner

Hi there,

Can you please try to refresh the cache by clicking this button:

image

@jokob-sk jokob-sk added the Waiting for reply⏳ Waiting for the original poster to respond, or discussion in progress. label Apr 30, 2024
@joestump
Copy link
Author

@jokob-sk that fixed it. 👍🏼 How do I avoid in the future?

@jokob-sk
Copy link
Owner

I will keep imroving the app - the current cache expiration and re-caching mechanism isn't too reliable so I will have a look how to improve it. Thanks for the patience. If anyone wants to help, have a look at the common.js file first initialization sequence, below this section:

// -----------------------------------------------------------------------------
// initialize
// -----------------------------------------------------------------------------

// initialize

@jokob-sk
Copy link
Owner

In the mean time I already implemented some changes so if you'd like feel free to test the netalertx-dev image to check, if the issues are still occurring.

@jokob-sk jokob-sk added Workaround provided ⚒️ A workaround for the issue was provided so no further actions will be taken. and removed Waiting for reply⏳ Waiting for the original poster to respond, or discussion in progress. labels Apr 30, 2024
@joestump
Copy link
Author

@jokob-sk no worries at all; I think I speak for many when I say I'm stoked with all you've done with NetAlertX. 😄

Sadly, the netalertx-dev didn't work out for me. The settings page failed to load. Nothing amiss in the logs:

16:43:43 [API] Updating table_settings.json file in /front/api
16:43:43 [Config] Imported new config
16:43:43 [API] Updating table_appevents.json file in /front/api
16:43:43 [API] Updating table_devices.json file in /front/api
16:43:43 [API] Updating table_events_pending_alert.json file in /front/api
16:43:43 [API] Updating table_plugins_events.json file in /front/api
16:43:43 [API] Updating table_plugins_history.json file in /front/api
16:43:43 [API] Updating table_plugins_objects.json file in /front/api
16:43:43 [API] Updating table_plugins_language_strings.json file in /front/api
16:43:43 [API] Updating table_notifications.json file in /front/api

Firefox:

image

Chrome:

image

@joestump
Copy link
Author

Firefox console:

image

jokob-sk pushed a commit that referenced this issue May 1, 2024
@jokob-sk
Copy link
Owner

jokob-sk commented May 1, 2024

Hey, thanks for the kind words!

Trying something out (adding a version in the query string of requested js files to expire the cache) - you can test the netalertx-dev image again if interested. Ideally in a new / incognito session and then existing session.

@joestump
Copy link
Author

joestump commented May 1, 2024

It works/loads fine in a cognito window, but not in the normal windows. Clicking the refresh icon doesn't seem to clear/help either. Here's a video:

Screen.Recording.2024-05-01.at.8.29.13.AM.mov

Here's what I did:

  1. Delete the container + image via Portainer.
  2. Re-run docker compose to pull/start new container.
  3. Go to Chrome and start an incognito session. All is well.
  4. Flip back to regular Chrome with existing session. Page never fully loads, filter UI shown, and the settings page just keeps reloading.

I'm free this weekend if you'd like to schedule a screen sharing session to debug in real-time. It's a weird one for sure! For now I can use the regular container and reload whenever settings doesn't refresh.

@jokob-sk
Copy link
Owner

jokob-sk commented May 1, 2024

  • Delete the container + image via Portainer.

  • Re-run docker compose to pull/start new container.

  • Go to Chrome and start an incognito session. All is well.

And I think that's the best we can do at this point. I think the old session has the js files cached and strings cached/not cached and they have to expire for the new assets to load and be initialized properly.

Empty strings indicate that the strings were not cached correctly, and I hope I'm slowly making this more solid for a first-time load (again, anyone reading - please help out, I'm a bit tired looking at this part of the code 😩)

@joestump
Copy link
Author

joestump commented May 1, 2024

@jokob-sk as we often say, there are two big problems in programming: naming, cache invalidation, and off-by-one errors. 😁 There's a very simple/easy workaround for now: click the refresh button in the application's UI.

I just noticed in your change 584fdb7 the following detail:

You will have to run the container on the host network.

This explains why my NetAlertX ARP scanner isn't finding anything. 😅 I wonder if this is related to this bug? I'm going to go back to latest and move to network_mode: host. Will report back.

@jokob-sk
Copy link
Owner

jokob-sk commented May 1, 2024

This explains why my NetAlertX ARP scanner isn't finding anything. 😅 I wonder if this is related to this bug?

I don't think so but worth a shot. Definitely having the container on the host network will however correct other things. I still think the -dev image is now in a better state regarding the caching issues. 🤞

@joestump
Copy link
Author

joestump commented May 1, 2024

Okay, I verified it's network_mode: host, but the ARP scans aren't finding my devices. I strongly suspect this is due to a poorly configured VLAN setup on my end. I'm fiddling with the subnets docs to see if I can get somewhere.

@jokob-sk
Copy link
Owner

jokob-sk commented May 2, 2024

Can't help on that front as I don't use vlans on my end. However there's a discussion going on over here: #654

@jokob-sk
Copy link
Owner

jokob-sk commented May 9, 2024

released/workaround provided -> closing for now

@jokob-sk jokob-sk closed this as completed May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working Workaround provided ⚒️ A workaround for the issue was provided so no further actions will be taken.
Projects
None yet
Development

No branches or pull requests

2 participants