mirror of https://gitlab.com/bashrc2/epicyon
Module groups
parent
d7ad3733ff
commit
a194ada543
|
@ -5,7 +5,7 @@ __version__ = "1.2.0"
|
|||
__maintainer__ = "Bob Mottram"
|
||||
__email__ = "bob@freedombone.net"
|
||||
__status__ = "Production"
|
||||
__module_group__ = "Core"
|
||||
__module_group__ = "Profile Metadata"
|
||||
|
||||
import os
|
||||
from webfinger import webfingerHandle
|
||||
|
|
7
blog.py
7
blog.py
|
@ -26,6 +26,7 @@ from utils import getDomainFromActor
|
|||
from utils import locatePost
|
||||
from utils import loadJson
|
||||
from utils import firstParagraphFromString
|
||||
from utils import getActorPropertyUrl
|
||||
from posts import createBlogsTimeline
|
||||
from newswire import rss2Header
|
||||
from newswire import rss2Footer
|
||||
|
@ -884,3 +885,9 @@ def pathContainsBlogLink(baseDir: str,
|
|||
messageId = httpPrefix + '://' + domainFull + \
|
||||
'/users/' + nickname + '/statuses/' + userEnding2[1]
|
||||
return locatePost(baseDir, nickname, domain, messageId), nickname
|
||||
|
||||
|
||||
def getBlogAddress(actorJson: {}) -> str:
|
||||
"""Returns blog address for the given actor
|
||||
"""
|
||||
return getActorPropertyUrl(actorJson, 'Blog')
|
||||
|
|
2
cache.py
2
cache.py
|
@ -5,7 +5,7 @@ __version__ = "1.2.0"
|
|||
__maintainer__ = "Bob Mottram"
|
||||
__email__ = "bob@freedombone.net"
|
||||
__status__ = "Production"
|
||||
__module_group__ = "ActivityPub"
|
||||
__module_group__ = "Core"
|
||||
|
||||
import os
|
||||
import datetime
|
||||
|
|
2
city.py
2
city.py
|
@ -5,7 +5,7 @@ __version__ = "1.2.0"
|
|||
__maintainer__ = "Bob Mottram"
|
||||
__email__ = "bob@freedombone.net"
|
||||
__status__ = "Production"
|
||||
__module_group__ = "Spoofing"
|
||||
__module_group__ = "Metadata"
|
||||
|
||||
import os
|
||||
import datetime
|
||||
|
|
|
@ -140,13 +140,13 @@ from blog import htmlBlogView
|
|||
from blog import htmlBlogPage
|
||||
from blog import htmlBlogPost
|
||||
from blog import htmlEditBlog
|
||||
from blog import getBlogAddress
|
||||
from webapp_minimalbutton import setMinimal
|
||||
from webapp_minimalbutton import isMinimal
|
||||
from webapp_utils import getAvatarImageUrl
|
||||
from webapp_utils import htmlHashtagBlocked
|
||||
from webapp_utils import htmlFollowingList
|
||||
from webapp_utils import setBlogAddress
|
||||
from webapp_utils import getBlogAddress
|
||||
from webapp_calendar import htmlCalendarDeleteConfirm
|
||||
from webapp_calendar import htmlCalendar
|
||||
from webapp_about import htmlAbout
|
||||
|
|
|
@ -5,6 +5,7 @@ __version__ = "1.2.0"
|
|||
__maintainer__ = "Bob Mottram"
|
||||
__email__ = "bob@freedombone.net"
|
||||
__status__ = "Production"
|
||||
__module_group__ = "Security"
|
||||
|
||||
# REST API overview
|
||||
#
|
||||
|
|
|
@ -5,6 +5,7 @@ __version__ = "1.2.0"
|
|||
__maintainer__ = "Bob Mottram"
|
||||
__email__ = "bob@freedombone.net"
|
||||
__status__ = "Production"
|
||||
__module_group__ = "Moderation"
|
||||
|
||||
import os
|
||||
|
||||
|
|
2
git.py
2
git.py
|
@ -5,7 +5,7 @@ __version__ = "1.2.0"
|
|||
__maintainer__ = "Bob Mottram"
|
||||
__email__ = "bob@freedombone.net"
|
||||
__status__ = "Production"
|
||||
__module_group__ = "Core"
|
||||
__module_group__ = "Profile Metadata"
|
||||
|
||||
import os
|
||||
import html
|
||||
|
|
|
@ -5,7 +5,7 @@ __version__ = "1.2.0"
|
|||
__maintainer__ = "Bob Mottram"
|
||||
__email__ = "bob@freedombone.net"
|
||||
__status__ = "Production"
|
||||
__module_group__ = "Core"
|
||||
__module_group__ = "API"
|
||||
|
||||
import os
|
||||
from utils import loadJson
|
||||
|
|
|
@ -5,6 +5,7 @@ __version__ = "1.2.0"
|
|||
__maintainer__ = "Bob Mottram"
|
||||
__email__ = "bob@freedombone.net"
|
||||
__status__ = "Production"
|
||||
__module_group__ = "Core"
|
||||
|
||||
import os
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ JSON-LD.
|
|||
__copyright__ = 'Copyright (c) 2011-2014 Digital Bazaar, Inc.'
|
||||
__license__ = 'New BSD license'
|
||||
__version__ = '0.6.8'
|
||||
__module_group__ = "ActivityPub"
|
||||
__module_group__ = "Security"
|
||||
|
||||
__all__ = [
|
||||
'compact', 'expand', 'flatten', 'frame', 'link', 'from_rdf', 'to_rdf',
|
||||
|
|
1
roles.py
1
roles.py
|
@ -5,6 +5,7 @@ __version__ = "1.2.0"
|
|||
__maintainer__ = "Bob Mottram"
|
||||
__email__ = "bob@freedombone.net"
|
||||
__status__ = "Production"
|
||||
__module_group__ = "Profile Metadata"
|
||||
|
||||
import os
|
||||
from utils import loadJson
|
||||
|
|
|
@ -6,6 +6,7 @@ __version__ = "1.2.0"
|
|||
__maintainer__ = "Bob Mottram"
|
||||
__email__ = "bob@freedombone.net"
|
||||
__status__ = "Production"
|
||||
__module_group__ = "Core"
|
||||
|
||||
import http.client
|
||||
from urllib.parse import urlparse
|
||||
|
|
|
@ -5,6 +5,7 @@ __version__ = "1.2.0"
|
|||
__maintainer__ = "Bob Mottram"
|
||||
__email__ = "bob@freedombone.net"
|
||||
__status__ = "Production"
|
||||
__module_group__ = "Profile Metadata"
|
||||
|
||||
import os
|
||||
from webfinger import webfingerHandle
|
||||
|
|
|
@ -5,6 +5,7 @@ __version__ = "1.2.0"
|
|||
__maintainer__ = "Bob Mottram"
|
||||
__email__ = "bob@freedombone.net"
|
||||
__status__ = "Production"
|
||||
__module_group__ = "Moderation"
|
||||
|
||||
from session import createSession
|
||||
from webfinger import webfingerHandle
|
||||
|
|
|
@ -5,6 +5,7 @@ __version__ = "1.2.0"
|
|||
__maintainer__ = "Bob Mottram"
|
||||
__email__ = "bob@freedombone.net"
|
||||
__status__ = "Production"
|
||||
__module_group__ = "Client"
|
||||
|
||||
import os
|
||||
import html
|
||||
|
|
1
theme.py
1
theme.py
|
@ -5,6 +5,7 @@ __version__ = "1.2.0"
|
|||
__maintainer__ = "Bob Mottram"
|
||||
__email__ = "bob@freedombone.net"
|
||||
__status__ = "Production"
|
||||
__module_group__ = "Web Interface"
|
||||
|
||||
import os
|
||||
from utils import isAccountDir
|
||||
|
|
|
@ -5,6 +5,7 @@ __version__ = "1.2.0"
|
|||
__maintainer__ = "Bob Mottram"
|
||||
__email__ = "bob@freedombone.net"
|
||||
__status__ = "Production"
|
||||
__module_group__ = "Core"
|
||||
|
||||
import threading
|
||||
import sys
|
||||
|
|
52
utils.py
52
utils.py
|
@ -5,7 +5,7 @@ __version__ = "1.2.0"
|
|||
__maintainer__ = "Bob Mottram"
|
||||
__email__ = "bob@freedombone.net"
|
||||
__status__ = "Production"
|
||||
__module_group__ = "ActivityPu"
|
||||
__module_group__ = "Core"
|
||||
|
||||
import os
|
||||
import re
|
||||
|
@ -2403,3 +2403,53 @@ def hasObjectDict(postJsonObject: {}) -> bool:
|
|||
if isinstance(postJsonObject['object'], dict):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def getAltPath(actor: str, domainFull: str, callingDomain: str) -> str:
|
||||
"""Returns alternate path from the actor
|
||||
eg. https://clearnetdomain/path becomes http://oniondomain/path
|
||||
"""
|
||||
postActor = actor
|
||||
if callingDomain not in actor and domainFull in actor:
|
||||
if callingDomain.endswith('.onion') or \
|
||||
callingDomain.endswith('.i2p'):
|
||||
postActor = \
|
||||
'http://' + callingDomain + actor.split(domainFull)[1]
|
||||
print('Changed POST domain from ' + actor + ' to ' + postActor)
|
||||
return postActor
|
||||
|
||||
|
||||
def getActorPropertyUrl(actorJson: {}, propertyName: str) -> str:
|
||||
"""Returns a url property from an actor
|
||||
"""
|
||||
if not actorJson.get('attachment'):
|
||||
return ''
|
||||
propertyName = propertyName.lower()
|
||||
for propertyValue in actorJson['attachment']:
|
||||
if not propertyValue.get('name'):
|
||||
continue
|
||||
if not propertyValue['name'].lower().startswith(propertyName):
|
||||
continue
|
||||
if not propertyValue.get('type'):
|
||||
continue
|
||||
if not propertyValue.get('value'):
|
||||
continue
|
||||
if propertyValue['type'] != 'PropertyValue':
|
||||
continue
|
||||
propertyValue['value'] = propertyValue['value'].strip()
|
||||
prefixes = getProtocolPrefixes()
|
||||
prefixFound = False
|
||||
for prefix in prefixes:
|
||||
if propertyValue['value'].startswith(prefix):
|
||||
prefixFound = True
|
||||
break
|
||||
if not prefixFound:
|
||||
continue
|
||||
if '.' not in propertyValue['value']:
|
||||
continue
|
||||
if ' ' in propertyValue['value']:
|
||||
continue
|
||||
if ',' in propertyValue['value']:
|
||||
continue
|
||||
return propertyValue['value']
|
||||
return ''
|
||||
|
|
|
@ -18,12 +18,12 @@ from utils import getDomainFromActor
|
|||
from utils import locatePost
|
||||
from utils import loadJson
|
||||
from utils import weekDayOfMonthStart
|
||||
from utils import getAltPath
|
||||
from domainhandler import removeDomainPort
|
||||
from happening import getTodaysEvents
|
||||
from happening import getCalendarEvents
|
||||
from webapp_utils import htmlHeaderWithExternalStyle
|
||||
from webapp_utils import htmlFooter
|
||||
from webapp_utils import getAltPath
|
||||
from webapp_utils import htmlHideFromScreenReader
|
||||
from webapp_utils import htmlKeyboardNavigation
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ from utils import getDomainFromActor
|
|||
from utils import locatePost
|
||||
from utils import loadJson
|
||||
from utils import getConfigParam
|
||||
from webapp_utils import getAltPath
|
||||
from utils import getAltPath
|
||||
from webapp_utils import htmlHeaderWithExternalStyle
|
||||
from webapp_utils import htmlFooter
|
||||
from webapp_post import individualPostAsHtml
|
||||
|
|
|
@ -52,7 +52,7 @@ from webapp_utils import htmlFooter
|
|||
from webapp_utils import addEmojiToDisplayName
|
||||
from webapp_utils import getBannerFile
|
||||
from webapp_utils import htmlPostSeparator
|
||||
from webapp_utils import getBlogAddress
|
||||
from blog import getBlogAddress
|
||||
from webapp_post import individualPostAsHtml
|
||||
from webapp_timeline import htmlIndividualShare
|
||||
|
||||
|
|
|
@ -22,13 +22,13 @@ from utils import locatePost
|
|||
from utils import isPublicPost
|
||||
from utils import firstParagraphFromString
|
||||
from utils import searchBoxPosts
|
||||
from utils import getAltPath
|
||||
from skills import noOfActorSkills
|
||||
from skills import getSkillsFromList
|
||||
from categories import getHashtagCategory
|
||||
from feeds import rss2TagHeader
|
||||
from feeds import rss2TagFooter
|
||||
from webapp_utils import htmlKeyboardNavigation
|
||||
from webapp_utils import getAltPath
|
||||
from webapp_utils import htmlHeaderWithExternalStyle
|
||||
from webapp_utils import htmlFooter
|
||||
from webapp_utils import getSearchBannerFile
|
||||
|
|
|
@ -150,20 +150,6 @@ def headerButtonsFrontScreen(translate: {},
|
|||
return headerStr
|
||||
|
||||
|
||||
def getAltPath(actor: str, domainFull: str, callingDomain: str) -> str:
|
||||
"""Returns alternate path from the actor
|
||||
eg. https://clearnetdomain/path becomes http://oniondomain/path
|
||||
"""
|
||||
postActor = actor
|
||||
if callingDomain not in actor and domainFull in actor:
|
||||
if callingDomain.endswith('.onion') or \
|
||||
callingDomain.endswith('.i2p'):
|
||||
postActor = \
|
||||
'http://' + callingDomain + actor.split(domainFull)[1]
|
||||
print('Changed POST domain from ' + actor + ' to ' + postActor)
|
||||
return postActor
|
||||
|
||||
|
||||
def getContentWarningButton(postID: str, translate: {},
|
||||
content: str) -> str:
|
||||
"""Returns the markup for a content warning button
|
||||
|
@ -174,48 +160,6 @@ def getContentWarningButton(postID: str, translate: {},
|
|||
'</div></details>\n'
|
||||
|
||||
|
||||
def _getActorPropertyUrl(actorJson: {}, propertyName: str) -> str:
|
||||
"""Returns a url property from an actor
|
||||
"""
|
||||
if not actorJson.get('attachment'):
|
||||
return ''
|
||||
propertyName = propertyName.lower()
|
||||
for propertyValue in actorJson['attachment']:
|
||||
if not propertyValue.get('name'):
|
||||
continue
|
||||
if not propertyValue['name'].lower().startswith(propertyName):
|
||||
continue
|
||||
if not propertyValue.get('type'):
|
||||
continue
|
||||
if not propertyValue.get('value'):
|
||||
continue
|
||||
if propertyValue['type'] != 'PropertyValue':
|
||||
continue
|
||||
propertyValue['value'] = propertyValue['value'].strip()
|
||||
prefixes = getProtocolPrefixes()
|
||||
prefixFound = False
|
||||
for prefix in prefixes:
|
||||
if propertyValue['value'].startswith(prefix):
|
||||
prefixFound = True
|
||||
break
|
||||
if not prefixFound:
|
||||
continue
|
||||
if '.' not in propertyValue['value']:
|
||||
continue
|
||||
if ' ' in propertyValue['value']:
|
||||
continue
|
||||
if ',' in propertyValue['value']:
|
||||
continue
|
||||
return propertyValue['value']
|
||||
return ''
|
||||
|
||||
|
||||
def getBlogAddress(actorJson: {}) -> str:
|
||||
"""Returns blog address for the given actor
|
||||
"""
|
||||
return _getActorPropertyUrl(actorJson, 'Blog')
|
||||
|
||||
|
||||
def _setActorPropertyUrl(actorJson: {}, propertyName: str, url: str) -> None:
|
||||
"""Sets a url for the given actor property
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue