mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
114e6c7bf4
commit
34e533f289
33
daemon.py
33
daemon.py
|
@ -24,13 +24,13 @@ from shutil import copyfile
|
|||
from session import create_session
|
||||
from webfinger import webfinger_meta
|
||||
from webfinger import webfinger_node_info
|
||||
from webfinger import webfingerLookup
|
||||
from webfinger import webfingerUpdate
|
||||
from mastoapiv1 import mastoApiV1Response
|
||||
from metadata import metaDataNodeInfo
|
||||
from metadata import metadataCustomEmoji
|
||||
from enigma import getEnigmaPubKey
|
||||
from enigma import setEnigmaPubKey
|
||||
from webfinger import webfinger_lookup
|
||||
from webfinger import webfinger_update
|
||||
from mastoapiv1 import masto_api_v1_response
|
||||
from metadata import meta_data_node_info
|
||||
from metadata import metadata_custom_emoji
|
||||
from enigma import get_enigma_pub_key
|
||||
from enigma import set_enigma_pub_key
|
||||
from pgp import getEmailAddress
|
||||
from pgp import setEmailAddress
|
||||
from pgp import getPGPpubKey
|
||||
|
@ -1062,7 +1062,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self._update_known_crawlers(uaStr)
|
||||
|
||||
broch_mode = broch_modeIsActive(base_dir)
|
||||
sendJson, sendJsonStr = mastoApiV1Response(path,
|
||||
sendJson, sendJsonStr = \
|
||||
masto_api_v1_response(path,
|
||||
calling_domain,
|
||||
uaStr,
|
||||
authorized,
|
||||
|
@ -1146,7 +1147,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
instanceUrl = self._get_instance_url(calling_domain)
|
||||
aboutUrl = instanceUrl + '/about'
|
||||
termsOfServiceUrl = instanceUrl + '/terms'
|
||||
info = metaDataNodeInfo(self.server.base_dir,
|
||||
info = meta_data_node_info(self.server.base_dir,
|
||||
aboutUrl, termsOfServiceUrl,
|
||||
self.server.registration,
|
||||
nodeInfoVersion,
|
||||
|
@ -1243,7 +1244,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
print('DEBUG: WEBFINGER lookup ' + self.path + ' ' +
|
||||
str(self.server.base_dir))
|
||||
wfResult = \
|
||||
webfingerLookup(self.path, self.server.base_dir,
|
||||
webfinger_lookup(self.path, self.server.base_dir,
|
||||
self.server.domain, self.server.onion_domain,
|
||||
self.server.port, self.server.debug)
|
||||
if wfResult:
|
||||
|
@ -5382,15 +5383,15 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
actorChanged = True
|
||||
|
||||
# change Enigma public key
|
||||
currentEnigmaPubKey = getEnigmaPubKey(actor_json)
|
||||
currentEnigmaPubKey = get_enigma_pub_key(actor_json)
|
||||
if fields.get('enigmapubkey'):
|
||||
if fields['enigmapubkey'] != currentEnigmaPubKey:
|
||||
setEnigmaPubKey(actor_json,
|
||||
set_enigma_pub_key(actor_json,
|
||||
fields['enigmapubkey'])
|
||||
actorChanged = True
|
||||
else:
|
||||
if currentEnigmaPubKey:
|
||||
setEnigmaPubKey(actor_json, '')
|
||||
set_enigma_pub_key(actor_json, '')
|
||||
actorChanged = True
|
||||
|
||||
# change PGP public key
|
||||
|
@ -6488,7 +6489,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
addActorUpdateTimestamp(actor_json)
|
||||
# save the actor
|
||||
save_json(actor_json, actorFilename)
|
||||
webfingerUpdate(base_dir,
|
||||
webfinger_update(base_dir,
|
||||
nickname, domain,
|
||||
onion_domain,
|
||||
self.server.cached_webfingers)
|
||||
|
@ -7121,7 +7122,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
jamiAddress = getJamiAddress(actor_json)
|
||||
cwtchAddress = getCwtchAddress(actor_json)
|
||||
emailAddress = getEmailAddress(actor_json)
|
||||
EnigmaPubKey = getEnigmaPubKey(actor_json)
|
||||
EnigmaPubKey = get_enigma_pub_key(actor_json)
|
||||
PGPpubKey = getPGPpubKey(actor_json)
|
||||
PGPfingerprint = getPGPfingerprint(actor_json)
|
||||
if actor_json.get('alsoKnownAs'):
|
||||
|
@ -18795,7 +18796,7 @@ def runDaemon(content_license_url: str,
|
|||
|
||||
# get the list of custom emoji, for use by the mastodon api
|
||||
httpd.customEmoji = \
|
||||
metadataCustomEmoji(base_dir, http_prefix, httpd.domain_full)
|
||||
metadata_custom_emoji(base_dir, http_prefix, httpd.domain_full)
|
||||
|
||||
# whether to enable broch mode, which locks down the instance
|
||||
setBrochMode(base_dir, httpd.domain_full, broch_mode)
|
||||
|
|
|
@ -8,7 +8,7 @@ __status__ = "Production"
|
|||
__module_group__ = "Profile Metadata"
|
||||
|
||||
|
||||
def getEnigmaPubKey(actor_json: {}) -> str:
|
||||
def get_enigma_pub_key(actor_json: {}) -> str:
|
||||
"""Returns Enigma public key for the given actor
|
||||
"""
|
||||
if not actor_json.get('attachment'):
|
||||
|
@ -28,7 +28,7 @@ def getEnigmaPubKey(actor_json: {}) -> str:
|
|||
return ''
|
||||
|
||||
|
||||
def setEnigmaPubKey(actor_json: {}, enigmaPubKey: str) -> None:
|
||||
def set_enigma_pub_key(actor_json: {}, enigmaPubKey: str) -> None:
|
||||
"""Sets a Enigma public key for the given actor
|
||||
"""
|
||||
removeKey = False
|
||||
|
|
|
@ -81,7 +81,7 @@ def _getMastoApiV1Account(base_dir: str, nickname: str, domain: str) -> {}:
|
|||
return mastoAccountJson
|
||||
|
||||
|
||||
def mastoApiV1Response(path: str, calling_domain: str,
|
||||
def masto_api_v1_response(path: str, calling_domain: str,
|
||||
uaStr: str,
|
||||
authorized: bool,
|
||||
http_prefix: str,
|
||||
|
|
|
@ -31,7 +31,7 @@ def _getStatusCount(base_dir: str) -> int:
|
|||
return statusCtr
|
||||
|
||||
|
||||
def metaDataNodeInfo(base_dir: str,
|
||||
def meta_data_node_info(base_dir: str,
|
||||
aboutUrl: str,
|
||||
termsOfServiceUrl: str,
|
||||
registration: bool, version: str,
|
||||
|
@ -207,7 +207,7 @@ def metaDataInstance(showAccounts: bool,
|
|||
return instance
|
||||
|
||||
|
||||
def metadataCustomEmoji(base_dir: str,
|
||||
def metadata_custom_emoji(base_dir: str,
|
||||
http_prefix: str, domain_full: str) -> {}:
|
||||
"""Returns the custom emoji
|
||||
Endpoint /api/v1/custom_emojis
|
||||
|
|
|
@ -47,7 +47,7 @@ from ssb import getSSBAddress
|
|||
from pgp import getEmailAddress
|
||||
from pgp import getPGPfingerprint
|
||||
from pgp import getPGPpubKey
|
||||
from enigma import getEnigmaPubKey
|
||||
from enigma import get_enigma_pub_key
|
||||
from tox import getToxAddress
|
||||
from briar import getBriarAddress
|
||||
from jami import getJamiAddress
|
||||
|
@ -635,7 +635,7 @@ def htmlProfile(signing_priv_key_pem: str,
|
|||
donateUrl = getDonationUrl(profile_json)
|
||||
websiteUrl = getWebsite(profile_json, translate)
|
||||
blogAddress = getBlogAddress(profile_json)
|
||||
EnigmaPubKey = getEnigmaPubKey(profile_json)
|
||||
EnigmaPubKey = get_enigma_pub_key(profile_json)
|
||||
PGPpubKey = getPGPpubKey(profile_json)
|
||||
PGPfingerprint = getPGPfingerprint(profile_json)
|
||||
emailAddress = getEmailAddress(profile_json)
|
||||
|
@ -2141,7 +2141,7 @@ def htmlEditProfile(css_cache: {}, translate: {}, base_dir: str, path: str,
|
|||
jamiAddress = getJamiAddress(actor_json)
|
||||
cwtchAddress = getCwtchAddress(actor_json)
|
||||
emailAddress = getEmailAddress(actor_json)
|
||||
EnigmaPubKey = getEnigmaPubKey(actor_json)
|
||||
EnigmaPubKey = get_enigma_pub_key(actor_json)
|
||||
PGPpubKey = getPGPpubKey(actor_json)
|
||||
PGPfingerprint = getPGPfingerprint(actor_json)
|
||||
if actor_json.get('name'):
|
||||
|
|
12
webfinger.py
12
webfinger.py
|
@ -214,7 +214,7 @@ def webfinger_meta(http_prefix: str, domain_full: str) -> str:
|
|||
return metaStr
|
||||
|
||||
|
||||
def webfingerLookup(path: str, base_dir: str,
|
||||
def webfinger_lookup(path: str, base_dir: str,
|
||||
domain: str, onion_domain: str,
|
||||
port: int, debug: bool) -> {}:
|
||||
"""Lookup the webfinger endpoint for an account
|
||||
|
@ -279,7 +279,7 @@ def webfingerLookup(path: str, base_dir: str,
|
|||
return wfJson
|
||||
|
||||
|
||||
def _webfingerUpdateAvatar(wfJson: {}, actor_json: {}) -> bool:
|
||||
def _webfinger_updateAvatar(wfJson: {}, actor_json: {}) -> bool:
|
||||
"""Updates the avatar image link
|
||||
"""
|
||||
found = False
|
||||
|
@ -337,7 +337,7 @@ def _webfingerAddBlogLink(wfJson: {}, actor_json: {}) -> bool:
|
|||
return True
|
||||
|
||||
|
||||
def _webfingerUpdateFromProfile(wfJson: {}, actor_json: {}) -> bool:
|
||||
def _webfinger_updateFromProfile(wfJson: {}, actor_json: {}) -> bool:
|
||||
"""Updates webfinger Email/blog/xmpp links from profile
|
||||
Returns true if one or more tags has been changed
|
||||
"""
|
||||
|
@ -411,7 +411,7 @@ def _webfingerUpdateFromProfile(wfJson: {}, actor_json: {}) -> bool:
|
|||
wfJson['aliases'].remove(fullAlias)
|
||||
changed = True
|
||||
|
||||
if _webfingerUpdateAvatar(wfJson, actor_json):
|
||||
if _webfinger_updateAvatar(wfJson, actor_json):
|
||||
changed = True
|
||||
|
||||
if _webfingerAddBlogLink(wfJson, actor_json):
|
||||
|
@ -420,7 +420,7 @@ def _webfingerUpdateFromProfile(wfJson: {}, actor_json: {}) -> bool:
|
|||
return changed
|
||||
|
||||
|
||||
def webfingerUpdate(base_dir: str, nickname: str, domain: str,
|
||||
def webfinger_update(base_dir: str, nickname: str, domain: str,
|
||||
onion_domain: str,
|
||||
cached_webfingers: {}) -> None:
|
||||
handle = nickname + '@' + domain
|
||||
|
@ -446,6 +446,6 @@ def webfingerUpdate(base_dir: str, nickname: str, domain: str,
|
|||
if not actor_json:
|
||||
return
|
||||
|
||||
if _webfingerUpdateFromProfile(wfJson, actor_json):
|
||||
if _webfinger_updateFromProfile(wfJson, actor_json):
|
||||
if save_json(wfJson, filename):
|
||||
storeWebfingerInCache(handle, wfJson, cached_webfingers)
|
||||
|
|
Loading…
Reference in New Issue