move apkeys out of RelayConfig and rename relay_software_names
This commit is contained in:
parent
b0851c0652
commit
90234a9724
|
@ -9,23 +9,22 @@ from urllib.parse import urlparse
|
||||||
from .misc import DotDict, boolean
|
from .misc import DotDict, boolean
|
||||||
|
|
||||||
|
|
||||||
relay_software_names = [
|
RELAY_SOFTWARE = [
|
||||||
'activityrelay', # https://git.pleroma.social/pleroma/relay
|
'activityrelay', # https://git.pleroma.social/pleroma/relay
|
||||||
'aoderelay', # https://git.asonix.dog/asonix/relay
|
'aoderelay', # https://git.asonix.dog/asonix/relay
|
||||||
'feditools-relay' # https://git.ptzo.gdn/feditools/relay
|
'feditools-relay' # https://git.ptzo.gdn/feditools/relay
|
||||||
]
|
]
|
||||||
|
|
||||||
|
APKEYS = [
|
||||||
class RelayConfig(DotDict):
|
|
||||||
apkeys = {
|
|
||||||
'host',
|
'host',
|
||||||
'whitelist_enabled',
|
'whitelist_enabled',
|
||||||
'blocked_software',
|
'blocked_software',
|
||||||
'blocked_instances',
|
'blocked_instances',
|
||||||
'whitelist'
|
'whitelist'
|
||||||
}
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class RelayConfig(DotDict):
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
DotDict.__init__(self, {})
|
DotDict.__init__(self, {})
|
||||||
|
|
||||||
|
@ -243,7 +242,7 @@ class RelayConfig(DotDict):
|
||||||
'workers': self.workers,
|
'workers': self.workers,
|
||||||
'json_cache': self.json_cache,
|
'json_cache': self.json_cache,
|
||||||
'timeout': self.timeout,
|
'timeout': self.timeout,
|
||||||
'ap': {key: self[key] for key in self.apkeys}
|
'ap': {key: self[key] for key in APKEYS}
|
||||||
}
|
}
|
||||||
|
|
||||||
with open(self._path, 'w') as fd:
|
with open(self._path, 'w') as fd:
|
||||||
|
|
|
@ -8,7 +8,7 @@ from urllib.parse import urlparse
|
||||||
|
|
||||||
from . import misc, __version__
|
from . import misc, __version__
|
||||||
from .application import Application
|
from .application import Application
|
||||||
from .config import relay_software_names
|
from .config import RELAY_SOFTWARE
|
||||||
|
|
||||||
|
|
||||||
app = None
|
app = None
|
||||||
|
@ -314,7 +314,7 @@ def cli_software_ban(name, fetch_nodeinfo):
|
||||||
'Ban software. Use RELAYS for NAME to ban relays'
|
'Ban software. Use RELAYS for NAME to ban relays'
|
||||||
|
|
||||||
if name == 'RELAYS':
|
if name == 'RELAYS':
|
||||||
for name in relay_software_names:
|
for name in RELAY_SOFTWARE:
|
||||||
app.config.ban_software(name)
|
app.config.ban_software(name)
|
||||||
|
|
||||||
app.config.save()
|
app.config.save()
|
||||||
|
@ -344,7 +344,7 @@ def cli_software_unban(name, fetch_nodeinfo):
|
||||||
'Ban software. Use RELAYS for NAME to unban relays'
|
'Ban software. Use RELAYS for NAME to unban relays'
|
||||||
|
|
||||||
if name == 'RELAYS':
|
if name == 'RELAYS':
|
||||||
for name in relay_software_names:
|
for name in RELAY_SOFTWARE:
|
||||||
app.config.unban_software(name)
|
app.config.unban_software(name)
|
||||||
|
|
||||||
app.config.save()
|
app.config.save()
|
||||||
|
|
Loading…
Reference in a new issue