-
-
Notifications
You must be signed in to change notification settings - Fork 269
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
Allow an instance to disable federation #3421
base: main
Are you sure you want to change the base?
Conversation
04ab58e
to
ebc60ab
Compare
Did I do this right?
ebc60ab
to
595cc24
Compare
Thank you for implementing this. If federation also includes book edits from remote instances, this might be a partial solution for #2841 |
It does prevent book data federation, but it’s not granular at all |
@bookwyrm-social/code-review It would be great to get a check-over on this one |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to work as advertised.
I take your point about following of external users probably being an unusual case, but it feels like something that might be reasonably easily fixable. e.g. you could just add this to snippets/follow_button.html
:
{% if request.user == user or not request.user.is_authenticated %}
{# nothing to see here -- either it's yourself or your logged out #}
{% elif site.disable_federation and not user.local %}
{# can't follow remote users without federation #}
{% else %}
In line with your comment about following external users silently failing, I also noticed that the get-started
flow still includes external users when federation is turned off. This doesn't provide any indication that following will fail, so it's not ideal.
We could fix this fairly easily by adjusting the signature for get_suggestions
, something like this but ideally a little less verbose:
def get_suggestions(self, user, local=models.SiteSettings.get().disable_federation):
We only have the local
arg because I needed it to be False
for groups (which still don't federate 🙁) - so aligning this with the value of disable_federation
makes sense to me.
def host_meta(request): | ||
"""meta of the host""" | ||
return TemplateResponse(request, "host_meta.xml", {"DOMAIN": DOMAIN}) | ||
|
||
|
||
@require_GET | ||
@require_federation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not clear about why this requires federation. e.g. maybe I want to add an instance to my "search engines" in my browser.
Description
This allows an instance to turn off all contact with other ActivityPub services. The instance would still be able to connect to OpenLibrary and Inventaire. If there's existing federated data, there can be some odd behavior (like blocking an existing remote user will "work" but not propagate the block to the other server, and following that user would fail silently), but since I expect this to either be used from the outset or as a stopgap for some unforeseen issue, I didn't bother to clarify those situations in the UI (besides putting up a banner on the user page).
What type of Pull Request is this?
Does this PR change settings or dependencies, or break something?
Details of breaking or configuration changes (if any of above checked)
Documentation
Tests