Skip to content

feat: add Get-PiHoleAuthApp; clearer error when gravity is already running - #146

Merged
mikemadeja merged 2 commits into
developfrom
feature/flush-arp-app-password
Oct 24, 2026
Merged

mikemadeja merged 2 commits into
developfrom
feature/flush-arp-app-password

Conversation

@mikemadeja

Copy link
Copy Markdown
Owner

Summary

This follows a re-audit against the live API spec (FTL v6.8). The module covers 88 of the spec's 92 operations; this PR covers one of the remaining four and fixes an error message.

  • New Get-PiHoleAuthApp (GET /api/auth/app) generates a new application password and its hash.
    • It doesn't activate the password. The help explains how to switch to it by setting webserver.api.app_pwhash with Set-PiHoleConfig.
    • Tested against a live server: generating a password leaves the current app password and all active sessions working. Only applying the hash replaces them.
    • Added to the export lists in PiHoleShell.psm1 and PiHoleShell.psd1, the README command reference, and docs/EXAMPLES.md. The example shows a real generated password that was never activated.
  • Update-PiHoleActionsGravity fix: FTL v6.8 returns 409 when gravity is already running. The function now reports Pi-hole's own message, Gravity is already running, instead of 409 (Conflict), using the existing ConvertTo-PiHoleFriendlyErrorMessage helper.

Not wrapped: POST /action/flush/arp is marked deprecated in the spec as an alias of /action/flush/network, which Invoke-PiHoleFlushNetwork already covers. The branch name still mentions it.

Test plan

  • Get-PiHoleAuthApp integration tests (5) pass against a live Pi-hole, including one that checks the current password still works afterwards
  • Gravity integration tests (4) pass, including a new one that starts a background run and checks a second call reports Gravity is already running (adds about 100s to that file's run time)
  • Module tests (11) pass; PSScriptAnalyzer reports nothing
  • README command reference regenerated with tools/Update-ReadmeCommandReference.ps1

🤖 Generated with Claude Code

mikemadeja and others added 2 commits October 19, 2026 17:00
Wraps GET /api/auth/app. It only generates a password and its hash; the
help explains how to activate it by setting webserver.api.app_pwhash with
Set-PiHoleConfig. Checked against a live server: generating a password
leaves the current app password and active sessions untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
FTL v6.8 answers POST /api/action/gravity with 409 while another run is in
progress. Use ConvertTo-PiHoleFriendlyErrorMessage so the caller sees
Pi-hole's own message, and add an integration test that starts a
background run and checks a second call reports it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@mikemadeja
mikemadeja merged commit 630f270 into develop Oct 24, 2026
4 checks passed
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