Skip to content

feat: improve IP blacklist import feedback#1183

Merged
GyulyVGC merged 5 commits into
GyulyVGC:mainfrom
TheMasterOfDisasters:feature/ip-blacklist-import-feedback
May 9, 2026
Merged

feat: improve IP blacklist import feedback#1183
GyulyVGC merged 5 commits into
GyulyVGC:mainfrom
TheMasterOfDisasters:feature/ip-blacklist-import-feedback

Conversation

@TheMasterOfDisasters
Copy link
Copy Markdown
Contributor

Summary

This PR improves feedback for imported IP blacklist files.

Previously, when an imported blacklist file could not be used, the settings page only showed the path in the danger/error style. It was not clear whether the file could not be read, was empty, or did not contain any valid blacklist entries.

With this change, the settings page now displays a short status message for the IP blacklist import.

What changed

  • Added an IpBlacklistLoadStatus enum to represent blacklist loading/import state.
  • Replaced the separate loading flag with the load status.
  • Added status details for:
    • no blacklist file selected
    • blacklist loading
    • file read error
    • no valid IP/CIDR entries found
    • successful load with parsed entry counts
  • Display the current blacklist import status in the General settings page.
  • Added translations for the new status messages.
  • Added tests for read errors and loading status.
  • Extended existing blacklist tests to verify load status details.

Motivation

After adding CIDR support, the blacklist import became more useful with public blacklist sources, but failed imports were still difficult to understand from the UI.

For example, if a file was invalid or unreadable, users only saw an error-colored path without a clear explanation. This PR makes the blacklist import state visible so users can understand what happened and how to fix it.

Testing

Tested locally with:

cargo fmt
cargo check
cargo test ip_blacklist
cargo test
cargo build

Screenshots

No blacklist selected:
noselect
Invalid blacklist file:
invalid
Valid blacklist loaded:
valid

@GyulyVGC GyulyVGC added the enhancement New feature, request, or improvement label May 8, 2026
@GyulyVGC GyulyVGC added this to the v1.5.1 milestone May 8, 2026
@GyulyVGC
Copy link
Copy Markdown
Owner

GyulyVGC commented May 8, 2026

Hey @TheMasterOfDisasters I like the idea but I prefer to keep things simple and show only a success message with the number of IPs and CIDRs.

So can you please remove the translations and all the statuses?

I'd like something just like this (not showing one of the two if it's zero):

  • (IPs: 999)
  • (CIDRs: 999)
  • (IPs: 999, CIDRs: 999)

@TheMasterOfDisasters
Copy link
Copy Markdown
Contributor Author

Thanks @GeorgeLS for the feedback.

I’ll move this back to draft while I simplify it and keep only the IP/CIDR counts as requested.

@TheMasterOfDisasters TheMasterOfDisasters marked this pull request as draft May 8, 2026 14:02
@TheMasterOfDisasters
Copy link
Copy Markdown
Contributor Author

Hey @GyulyVGC, updated as requested.

I removed the translations and extra statuses, and kept only the IP/CIDR counts.

Tested:

no blacklist selected
invalid blacklist file
valid blacklist with IPs and CIDRs
valid blacklist with IPs only
valid blacklist with CIDRs only

No blacklist selected:
image

Invalid blacklist file:
image

Valid blacklist loaded:
image

Valid blacklist IP only :
image

Valid blacklist CIDR only:
image

@TheMasterOfDisasters TheMasterOfDisasters marked this pull request as ready for review May 8, 2026 14:36
@GyulyVGC
Copy link
Copy Markdown
Owner

GyulyVGC commented May 8, 2026

Awesome, thanks for the quick update

@GyulyVGC GyulyVGC merged commit bd8b8bd into GyulyVGC:main May 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature, request, or improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants