Skip to content

Fix several bugs in Pi-hole v6 API integration#33

Open
jpwalsh1 wants to merge 2 commits into
johnholbrook:mainfrom
jpwalsh1:main
Open

Fix several bugs in Pi-hole v6 API integration#33
jpwalsh1 wants to merge 2 commits into
johnholbrook:mainfrom
jpwalsh1:main

Conversation

@jpwalsh1

@jpwalsh1 jpwalsh1 commented Apr 7, 2026

Copy link
Copy Markdown
  • Fix session expiry logic using sessionCreatedAt instead of lastUpdateTime (lastUpdateTime was overwritten every second so sessions never reconnected)
  • Fix polling interval to use fixed 1000ms instead of response.took * 1000
  • Fix onclose handler to iterate all instances rather than undefined context
  • Fix implicit global data variables in XHR callbacks (add let)
  • Fix percent_blocked null crash with ?? 0 guard and try/catch in process_stat
  • Fix json.parse -> JSON.parse crash in Property Inspector message handler
  • Remove alert("logging!") debug popup from Property Inspector
  • Remove dead updateSettings function

jpwalsh1 and others added 2 commits April 6, 2026 20:53
- Fix session expiry logic using sessionCreatedAt instead of lastUpdateTime
  (lastUpdateTime was overwritten every second so sessions never reconnected)
- Fix polling interval to use fixed 1000ms instead of response.took * 1000
- Fix onclose handler to iterate all instances rather than undefined context
- Fix implicit global `data` variables in XHR callbacks (add let)
- Fix percent_blocked null crash with ?? 0 guard and try/catch in process_stat
- Fix json.parse -> JSON.parse crash in Property Inspector message handler
- Remove alert("logging!") debug popup from Property Inspector
- Remove dead updateSettings function

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Slow poll interval from 1s to 5s to reduce Pi-hole request volume
- Add 5s timeouts to all XHR requests (status, stats, session delete) so
  slow/unreachable Pi-hole can't pile up open connections
- Add in-flight guard to pollPihole to skip overlapping requests
- Skip reconnect in writeSettings when connection params haven't changed,
  preventing double-connect on willAppear + didReceiveSettings
- Guard keyUp handler against missing instance (race on first press)
- Add default case to process_stat to avoid 'undefined' button title
- Fall back to 300s in temporarily_disable when disable_time is empty
- Fix implicit global jsonObj in pi.js; remove unused log function

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant