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

Blocklist import #77

Merged
merged 2 commits into from
Jul 6, 2021
Merged

Blocklist import #77

merged 2 commits into from
Jul 6, 2021

Conversation

tsmethurst
Copy link
Contributor

@tsmethurst tsmethurst commented Jul 6, 2021

This PR adds importable domain blocklists via the /api/v1/admin/domain_blocks endpoint.

A list of domains should be a json-formatted file that looks like this:

[
    {"domain":"whatever.com"},
    {"domain":"another_domain.org"}
]

To import a list of domain blocks:

curl -H 'Authorization: Bearer SOME_BEARER_TOKEN' -X POST -F domains=@./domains.json https://your.instance.host/api/v1/admin/domain_blocks?import=true

Domain blocks in the file will then be created one-by-one, with the side effects processed asynchronously.

This was tested by uploading a list of ~700 domains taken from the rage.love blocklist, and the upload and initialization of blocking side effects took ~8-10 seconds.

This PR also ensures that domain blocks can be deleted, and accounts that were suspended as part of the deleted domain block will be unsuspended correctly.

@tsmethurst tsmethurst merged commit 3568579 into main Jul 6, 2021
@tsmethurst tsmethurst deleted the blocklist_import branch July 6, 2021 11:29
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