stop 'add remote' from duplicating local communities

This commit is contained in:
rimu 2024-08-16 11:48:56 +12:00
parent 5211c64c2a
commit 4cf7e067d6
2 changed files with 5 additions and 1 deletions

View file

@ -219,7 +219,7 @@ The site will still run without federation. You can create local communities and
My way around this is to use ngrok.com, which is a quick and simple way to create a temporary VPN with a domain and SSL. The free plan comes with ephermeral domain names that change every few days, which will break federation, or one randomly-named static domain that will need re-launching every few days. $10 per month will get you https://yourwhatever.ngrok.app which won't change. My way around this is to use ngrok.com, which is a quick and simple way to create a temporary VPN with a domain and SSL. The free plan comes with ephermeral domain names that change every few days, which will break federation, or one randomly-named static domain that will need re-launching every few days. $10 per month will get you https://yourwhatever.ngrok.app which won't change.
Once you have ngrok working, edit the `.env` file and change the `SERVER_NAME` variable to your new domain name. Once you have ngrok working, edit the `.env` file and change the `SERVER_NAME` variable to your new domain name (all lower case).
<div id="running-piefed-in-production"></div> <div id="running-piefed-in-production"></div>

View file

@ -36,6 +36,10 @@ def search_for_community(address: str):
reason = f" Reason: {banned.reason}" if banned.reason is not None else '' reason = f" Reason: {banned.reason}" if banned.reason is not None else ''
raise Exception(f"{server} is blocked.{reason}") # todo: create custom exception class hierarchy raise Exception(f"{server} is blocked.{reason}") # todo: create custom exception class hierarchy
if current_app.config['SERVER_NAME'] == server:
already_exists = Community.query.filter_by(name=name, ap_id=None).first()
return already_exists
already_exists = Community.query.filter_by(ap_id=address[1:]).first() already_exists = Community.query.filter_by(ap_id=address[1:]).first()
if already_exists: if already_exists:
return already_exists return already_exists