mirror of https://gitlab.com/bashrc2/epicyon
Extra architecture graphs
parent
0ae0208260
commit
c37f3ac004
|
@ -7,7 +7,7 @@ __email__ = "bob@freedombone.net"
|
|||
__status__ = "Production"
|
||||
__module_group__ = "ActivityPub"
|
||||
|
||||
from domainhandler import removeDomainPort
|
||||
from utils import removeDomainPort
|
||||
from utils import hasObjectDict
|
||||
from utils import removeIdEnding
|
||||
from utils import hasUsersPath
|
||||
|
|
|
@ -11,7 +11,7 @@ import os
|
|||
import json
|
||||
import time
|
||||
from datetime import datetime
|
||||
from domainhandler import removeDomainPort
|
||||
from utils import removeDomainPort
|
||||
from utils import hasObjectDict
|
||||
from utils import isAccountDir
|
||||
from utils import getCachedPostFilename
|
||||
|
|
|
@ -11,7 +11,7 @@ import os
|
|||
from pprint import pprint
|
||||
from webfinger import webfingerHandle
|
||||
from auth import createBasicAuthHeader
|
||||
from domainhandler import removeDomainPort
|
||||
from utils import removeDomainPort
|
||||
from utils import hasUsersPath
|
||||
from utils import getFullDomain
|
||||
from utils import removeIdEnding
|
||||
|
|
|
@ -11,7 +11,7 @@ import os
|
|||
import email.parser
|
||||
import urllib.parse
|
||||
from shutil import copyfile
|
||||
from domainhandler import removeDomainPort
|
||||
from utils import removeDomainPort
|
||||
from utils import isValidLanguage
|
||||
from utils import getImageExtensions
|
||||
from utils import loadJson
|
||||
|
|
|
@ -9,7 +9,7 @@ __module_group__ = "ActivityPub"
|
|||
|
||||
import os
|
||||
from datetime import datetime
|
||||
from domainhandler import removeDomainPort
|
||||
from utils import removeDomainPort
|
||||
from utils import hasUsersPath
|
||||
from utils import getFullDomain
|
||||
from utils import removeIdEnding
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
__filename__ = "domainhandler.py"
|
||||
__author__ = "Bob Mottram"
|
||||
__license__ = "AGPL3+"
|
||||
__version__ = "1.2.0"
|
||||
__maintainer__ = "Bob Mottram"
|
||||
__email__ = "bob@freedombone.net"
|
||||
__status__ = "Production"
|
||||
__module_group__ = "Core"
|
||||
|
||||
|
||||
def removeDomainPort(domain: str) -> str:
|
||||
"""If the domain has a port appended then remove it
|
||||
eg. mydomain.com:80 becomes mydomain.com
|
||||
"""
|
||||
if ':' in domain:
|
||||
if domain.startswith('did:'):
|
||||
return domain
|
||||
domain = domain.split(':')[0]
|
||||
return domain
|
||||
|
||||
|
||||
def getPortFromDomain(domain: str) -> int:
|
||||
"""If the domain has a port number appended then return it
|
||||
eg. mydomain.com:80 returns 80
|
||||
"""
|
||||
if ':' in domain:
|
||||
if domain.startswith('did:'):
|
||||
return None
|
||||
portStr = domain.split(':')[1]
|
||||
if portStr.isdigit():
|
||||
return int(portStr)
|
||||
return None
|
|
@ -61,8 +61,8 @@ from tests import testUpdateActor
|
|||
from tests import runAllTests
|
||||
from auth import storeBasicCredentials
|
||||
from auth import createPassword
|
||||
from domainhandler import removeDomainPort
|
||||
from domainhandler import getPortFromDomain
|
||||
from utils import removeDomainPort
|
||||
from utils import getPortFromDomain
|
||||
from utils import hasUsersPath
|
||||
from utils import getFullDomain
|
||||
from utils import setConfigParam
|
||||
|
|
|
@ -9,7 +9,7 @@ __module_group__ = "ActivityPub"
|
|||
|
||||
from pprint import pprint
|
||||
import os
|
||||
from domainhandler import removeDomainPort
|
||||
from utils import removeDomainPort
|
||||
from utils import hasObjectDict
|
||||
from utils import hasUsersPath
|
||||
from utils import getFullDomain
|
||||
|
|
|
@ -8,7 +8,18 @@ __status__ = "Production"
|
|||
__module_group__ = "Calendar"
|
||||
|
||||
import os
|
||||
from domainhandler import removeDomainPort
|
||||
|
||||
|
||||
def _portDomainRemove(domain: str) -> str:
|
||||
"""If the domain has a port appended then remove it
|
||||
eg. mydomain.com:80 becomes mydomain.com
|
||||
same as removeDomainPort in utils.py
|
||||
"""
|
||||
if ':' in domain:
|
||||
if domain.startswith('did:'):
|
||||
return domain
|
||||
domain = domain.split(':')[0]
|
||||
return domain
|
||||
|
||||
|
||||
def receivingCalendarEvents(baseDir: str, nickname: str, domain: str,
|
||||
|
@ -44,7 +55,7 @@ def _receiveCalendarEvents(baseDir: str, nickname: str, domain: str,
|
|||
indicating whether to receive calendar events from that account
|
||||
"""
|
||||
# check that a following file exists
|
||||
domain = removeDomainPort(domain)
|
||||
domain = _portDomainRemove(domain)
|
||||
followingFilename = baseDir + '/accounts/' + \
|
||||
nickname + '@' + domain + '/following.txt'
|
||||
if not os.path.isfile(followingFilename):
|
||||
|
|
4
inbox.py
4
inbox.py
|
@ -13,8 +13,8 @@ import datetime
|
|||
import time
|
||||
import random
|
||||
from linked_data_sig import verifyJsonSignature
|
||||
from domainhandler import removeDomainPort
|
||||
from domainhandler import getPortFromDomain
|
||||
from utils import removeDomainPort
|
||||
from utils import getPortFromDomain
|
||||
from utils import hasObjectDict
|
||||
from utils import dmAllowedFromDomain
|
||||
from utils import isRecentPost
|
||||
|
|
2
like.py
2
like.py
|
@ -7,7 +7,7 @@ __email__ = "bob@freedombone.net"
|
|||
__status__ = "Production"
|
||||
__module_group__ = "ActivityPub"
|
||||
|
||||
from domainhandler import removeDomainPort
|
||||
from utils import removeDomainPort
|
||||
from utils import hasObjectDict
|
||||
from utils import hasUsersPath
|
||||
from utils import getFullDomain
|
||||
|
|
|
@ -12,8 +12,8 @@ from follow import followedAccountAccepts
|
|||
from follow import followedAccountRejects
|
||||
from follow import removeFromFollowRequests
|
||||
from utils import loadJson
|
||||
from domainhandler import removeDomainPort
|
||||
from domainhandler import getPortFromDomain
|
||||
from utils import removeDomainPort
|
||||
from utils import getPortFromDomain
|
||||
|
||||
|
||||
def manualDenyFollowRequest(session, baseDir: str,
|
||||
|
|
|
@ -38,7 +38,7 @@ from roles import setRole
|
|||
from roles import setRolesFromList
|
||||
from roles import getActorRolesList
|
||||
from media import processMetaData
|
||||
from domainhandler import removeDomainPort
|
||||
from utils import removeDomainPort
|
||||
from utils import getStatusNumber
|
||||
from utils import getFullDomain
|
||||
from utils import validNickname
|
||||
|
|
4
posts.py
4
posts.py
|
@ -32,8 +32,8 @@ from session import postImage
|
|||
from webfinger import webfingerHandle
|
||||
from httpsig import createSignedHeader
|
||||
from siteactive import siteIsActive
|
||||
from domainhandler import removeDomainPort
|
||||
from domainhandler import getPortFromDomain
|
||||
from utils import removeDomainPort
|
||||
from utils import getPortFromDomain
|
||||
from utils import hasObjectDict
|
||||
from utils import rejectPostId
|
||||
from utils import removeInvalidChars
|
||||
|
|
2
roles.py
2
roles.py
|
@ -11,7 +11,7 @@ import os
|
|||
from utils import loadJson
|
||||
from utils import saveJson
|
||||
from utils import getStatusNumber
|
||||
from domainhandler import removeDomainPort
|
||||
from utils import removeDomainPort
|
||||
|
||||
|
||||
def _clearRoleStatus(baseDir: str, role: str) -> None:
|
||||
|
|
|
@ -20,7 +20,7 @@ from utils import loadJson
|
|||
from utils import saveJson
|
||||
from utils import getImageExtensions
|
||||
from utils import hasObjectDict
|
||||
from domainhandler import removeDomainPort
|
||||
from utils import removeDomainPort
|
||||
from media import processMetaData
|
||||
|
||||
|
||||
|
|
22
tests.py
22
tests.py
|
@ -2900,6 +2900,7 @@ def _moduleInGroups(modName: str, includeGroups: [], modGroups: {}) -> bool:
|
|||
|
||||
|
||||
def _diagramGroups(includeGroups: [],
|
||||
excludeExtraModules: [],
|
||||
modules: {}, modGroups: {},
|
||||
maxModuleCalls: int) -> None:
|
||||
"""Draws a dot diagram containing only the given module groups
|
||||
|
@ -2907,9 +2908,10 @@ def _diagramGroups(includeGroups: [],
|
|||
callGraphStr = 'digraph EpicyonGroups {\n\n'
|
||||
callGraphStr += ' graph [fontsize=10 fontname="Verdana" compound=true];\n'
|
||||
callGraphStr += ' node [fontsize=10 fontname="Verdana"];\n\n'
|
||||
excludeModulesFromDiagram = (
|
||||
excludeModulesFromDiagram = [
|
||||
'setup', 'tests', '__init__'
|
||||
)
|
||||
]
|
||||
excludeModulesFromDiagram += excludeExtraModules
|
||||
# colors of modules nodes
|
||||
for modName, modProperties in modules.items():
|
||||
if modName in excludeModulesFromDiagram:
|
||||
|
@ -3223,15 +3225,21 @@ def _testFunctions():
|
|||
modules[modName]['calls'] = [modCall]
|
||||
lineCtr += 1
|
||||
|
||||
_diagramGroups(['Commandline Interface', 'ActivityPub', 'Core'],
|
||||
_diagramGroups(['Commandline Interface', 'ActivityPub'], ['utils'],
|
||||
modules, modGroups, maxModuleCalls)
|
||||
_diagramGroups(['Timeline', 'Core'],
|
||||
_diagramGroups(['Commandline Interface', 'Core'], ['utils'],
|
||||
modules, modGroups, maxModuleCalls)
|
||||
_diagramGroups(['Web Interface', 'Core'],
|
||||
_diagramGroups(['Timeline', 'Core'], ['utils'],
|
||||
modules, modGroups, maxModuleCalls)
|
||||
_diagramGroups(['Web Interface Columns', 'Core'],
|
||||
_diagramGroups(['Web Interface', 'Core'], ['utils'],
|
||||
modules, modGroups, maxModuleCalls)
|
||||
_diagramGroups(['Core'],
|
||||
_diagramGroups(['Web Interface Columns', 'Core'], ['utils'],
|
||||
modules, modGroups, maxModuleCalls)
|
||||
_diagramGroups(['Core'], [],
|
||||
modules, modGroups, maxModuleCalls)
|
||||
_diagramGroups(['ActivityPub'], [],
|
||||
modules, modGroups, maxModuleCalls)
|
||||
_diagramGroups(['ActivityPub', 'Core'], ['utils'],
|
||||
modules, modGroups, maxModuleCalls)
|
||||
|
||||
callGraphStr = 'digraph Epicyon {\n\n'
|
||||
|
|
26
utils.py
26
utils.py
|
@ -16,8 +16,6 @@ import json
|
|||
import idna
|
||||
import locale
|
||||
from pprint import pprint
|
||||
from domainhandler import removeDomainPort
|
||||
from domainhandler import getPortFromDomain
|
||||
from followingCalendar import addPersonToCalendar
|
||||
from cryptography.hazmat.backends import default_backend
|
||||
from cryptography.hazmat.primitives import hashes
|
||||
|
@ -2453,3 +2451,27 @@ def getActorPropertyUrl(actorJson: {}, propertyName: str) -> str:
|
|||
continue
|
||||
return propertyValue['value']
|
||||
return ''
|
||||
|
||||
|
||||
def removeDomainPort(domain: str) -> str:
|
||||
"""If the domain has a port appended then remove it
|
||||
eg. mydomain.com:80 becomes mydomain.com
|
||||
"""
|
||||
if ':' in domain:
|
||||
if domain.startswith('did:'):
|
||||
return domain
|
||||
domain = domain.split(':')[0]
|
||||
return domain
|
||||
|
||||
|
||||
def getPortFromDomain(domain: str) -> int:
|
||||
"""If the domain has a port number appended then return it
|
||||
eg. mydomain.com:80 returns 80
|
||||
"""
|
||||
if ':' in domain:
|
||||
if domain.startswith('did:'):
|
||||
return None
|
||||
portStr = domain.split(':')[1]
|
||||
if portStr.isdigit():
|
||||
return int(portStr)
|
||||
return None
|
||||
|
|
|
@ -19,7 +19,7 @@ from utils import locatePost
|
|||
from utils import loadJson
|
||||
from utils import weekDayOfMonthStart
|
||||
from utils import getAltPath
|
||||
from domainhandler import removeDomainPort
|
||||
from utils import removeDomainPort
|
||||
from happening import getTodaysEvents
|
||||
from happening import getCalendarEvents
|
||||
from webapp_utils import htmlHeaderWithExternalStyle
|
||||
|
|
|
@ -11,7 +11,7 @@ import os
|
|||
from utils import getConfigParam
|
||||
from utils import getNicknameFromActor
|
||||
from utils import isEditor
|
||||
from domainhandler import removeDomainPort
|
||||
from utils import removeDomainPort
|
||||
from webapp_utils import sharesTimelineJson
|
||||
from webapp_utils import htmlPostSeparator
|
||||
from webapp_utils import getLeftImageFile
|
||||
|
|
|
@ -17,7 +17,7 @@ from utils import votesOnNewswireItem
|
|||
from utils import getNicknameFromActor
|
||||
from utils import isEditor
|
||||
from utils import getConfigParam
|
||||
from domainhandler import removeDomainPort
|
||||
from utils import removeDomainPort
|
||||
from posts import isModerator
|
||||
from webapp_utils import getRightImageFile
|
||||
from webapp_utils import htmlHeaderWithExternalStyle
|
||||
|
|
|
@ -17,7 +17,7 @@ from utils import loadJson
|
|||
from utils import loadJsonOnionify
|
||||
from utils import saveJson
|
||||
from utils import getProtocolPrefixes
|
||||
from domainhandler import removeDomainPort
|
||||
from utils import removeDomainPort
|
||||
|
||||
|
||||
def _parseHandle(handle: str) -> (str, str):
|
||||
|
|
Loading…
Reference in New Issue