mirror of https://gitlab.com/bashrc2/epicyon
Snake case
parent
dcafa28ee4
commit
a151710ce2
|
@ -16,7 +16,7 @@ from utils import getDomainFromActor
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import domainPermitted
|
from utils import domainPermitted
|
||||||
from utils import followPerson
|
from utils import followPerson
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import hasGroupType
|
from utils import hasGroupType
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from utils import hasActor
|
from utils import hasActor
|
||||||
|
@ -150,7 +150,7 @@ def _accept_follow(base_dir: str, domain: str, message_json: {},
|
||||||
|
|
||||||
# has this person already been unfollowed?
|
# has this person already been unfollowed?
|
||||||
unfollowed_filename = \
|
unfollowed_filename = \
|
||||||
acctDir(base_dir, nickname, accepted_domain_full) + '/unfollowed.txt'
|
acct_dir(base_dir, nickname, accepted_domain_full) + '/unfollowed.txt'
|
||||||
if os.path.isfile(unfollowed_filename):
|
if os.path.isfile(unfollowed_filename):
|
||||||
if followed_nickname + '@' + followed_domain_full in \
|
if followed_nickname + '@' + followed_domain_full in \
|
||||||
open(unfollowed_filename).read():
|
open(unfollowed_filename).read():
|
||||||
|
|
|
@ -18,7 +18,7 @@ from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import getDomainFromActor
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import saveJson
|
from utils import saveJson
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from utils import hasActor
|
from utils import hasActor
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ def setAvailability(base_dir: str, nickname: str, domain: str,
|
||||||
# avoid giant strings
|
# avoid giant strings
|
||||||
if len(status) > 128:
|
if len(status) > 128:
|
||||||
return False
|
return False
|
||||||
actorFilename = acctDir(base_dir, nickname, domain) + '.json'
|
actorFilename = acct_dir(base_dir, nickname, domain) + '.json'
|
||||||
if not os.path.isfile(actorFilename):
|
if not os.path.isfile(actorFilename):
|
||||||
return False
|
return False
|
||||||
actor_json = loadJson(actorFilename)
|
actor_json = loadJson(actorFilename)
|
||||||
|
@ -43,7 +43,7 @@ def setAvailability(base_dir: str, nickname: str, domain: str,
|
||||||
def getAvailability(base_dir: str, nickname: str, domain: str) -> str:
|
def getAvailability(base_dir: str, nickname: str, domain: str) -> str:
|
||||||
"""Returns the availability for a given person
|
"""Returns the availability for a given person
|
||||||
"""
|
"""
|
||||||
actorFilename = acctDir(base_dir, nickname, domain) + '.json'
|
actorFilename = acct_dir(base_dir, nickname, domain) + '.json'
|
||||||
if not os.path.isfile(actorFilename):
|
if not os.path.isfile(actorFilename):
|
||||||
return False
|
return False
|
||||||
actor_json = loadJson(actorFilename)
|
actor_json = loadJson(actorFilename)
|
||||||
|
|
12
blocking.py
12
blocking.py
|
@ -30,7 +30,7 @@ from utils import locatePost
|
||||||
from utils import evilIncarnate
|
from utils import evilIncarnate
|
||||||
from utils import getDomainFromActor
|
from utils import getDomainFromActor
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from utils import hasActor
|
from utils import hasActor
|
||||||
from conversation import muteConversation
|
from conversation import muteConversation
|
||||||
|
@ -80,14 +80,14 @@ def addBlock(base_dir: str, nickname: str, domain: str,
|
||||||
return False
|
return False
|
||||||
|
|
||||||
domain = removeDomainPort(domain)
|
domain = removeDomainPort(domain)
|
||||||
blockingFilename = acctDir(base_dir, nickname, domain) + '/blocking.txt'
|
blockingFilename = acct_dir(base_dir, nickname, domain) + '/blocking.txt'
|
||||||
blockHandle = blockNickname + '@' + blockDomain
|
blockHandle = blockNickname + '@' + blockDomain
|
||||||
if os.path.isfile(blockingFilename):
|
if os.path.isfile(blockingFilename):
|
||||||
if blockHandle + '\n' in open(blockingFilename).read():
|
if blockHandle + '\n' in open(blockingFilename).read():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# if we are following then unfollow
|
# if we are following then unfollow
|
||||||
followingFilename = acctDir(base_dir, nickname, domain) + '/following.txt'
|
followingFilename = acct_dir(base_dir, nickname, domain) + '/following.txt'
|
||||||
if os.path.isfile(followingFilename):
|
if os.path.isfile(followingFilename):
|
||||||
if blockHandle + '\n' in open(followingFilename).read():
|
if blockHandle + '\n' in open(followingFilename).read():
|
||||||
followingStr = ''
|
followingStr = ''
|
||||||
|
@ -109,7 +109,7 @@ def addBlock(base_dir: str, nickname: str, domain: str,
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# if they are a follower then remove them
|
# if they are a follower then remove them
|
||||||
followersFilename = acctDir(base_dir, nickname, domain) + '/followers.txt'
|
followersFilename = acct_dir(base_dir, nickname, domain) + '/followers.txt'
|
||||||
if os.path.isfile(followersFilename):
|
if os.path.isfile(followersFilename):
|
||||||
if blockHandle + '\n' in open(followersFilename).read():
|
if blockHandle + '\n' in open(followersFilename).read():
|
||||||
followersStr = ''
|
followersStr = ''
|
||||||
|
@ -203,7 +203,7 @@ def removeBlock(base_dir: str, nickname: str, domain: str,
|
||||||
"""Unblock the given account
|
"""Unblock the given account
|
||||||
"""
|
"""
|
||||||
domain = removeDomainPort(domain)
|
domain = removeDomainPort(domain)
|
||||||
unblockingFilename = acctDir(base_dir, nickname, domain) + '/blocking.txt'
|
unblockingFilename = acct_dir(base_dir, nickname, domain) + '/blocking.txt'
|
||||||
unblockHandle = unblockNickname + '@' + unblockDomain
|
unblockHandle = unblockNickname + '@' + unblockDomain
|
||||||
if os.path.isfile(unblockingFilename):
|
if os.path.isfile(unblockingFilename):
|
||||||
if unblockHandle in open(unblockingFilename).read():
|
if unblockHandle in open(unblockingFilename).read():
|
||||||
|
@ -397,7 +397,7 @@ def isBlocked(base_dir: str, nickname: str, domain: str,
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# account level allow list
|
# account level allow list
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
allowFilename = accountDir + '/allowedinstances.txt'
|
allowFilename = accountDir + '/allowedinstances.txt'
|
||||||
if os.path.isfile(allowFilename):
|
if os.path.isfile(allowFilename):
|
||||||
if blockDomain not in open(allowFilename).read():
|
if blockDomain not in open(allowFilename).read():
|
||||||
|
|
22
blog.py
22
blog.py
|
@ -32,7 +32,7 @@ from utils import locatePost
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import firstParagraphFromString
|
from utils import firstParagraphFromString
|
||||||
from utils import getActorPropertyUrl
|
from utils import getActorPropertyUrl
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from posts import createBlogsTimeline
|
from posts import createBlogsTimeline
|
||||||
from newswire import rss2Header
|
from newswire import rss2Header
|
||||||
from newswire import rss2Footer
|
from newswire import rss2Footer
|
||||||
|
@ -54,7 +54,7 @@ def _noOfBlogReplies(base_dir: str, http_prefix: str, translate: {},
|
||||||
boxFound = False
|
boxFound = False
|
||||||
for postBox in tryPostBox:
|
for postBox in tryPostBox:
|
||||||
postFilename = \
|
postFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/' + postBox + '/' + \
|
acct_dir(base_dir, nickname, domain) + '/' + postBox + '/' + \
|
||||||
postId.replace('/', '#') + '.replies'
|
postId.replace('/', '#') + '.replies'
|
||||||
if os.path.isfile(postFilename):
|
if os.path.isfile(postFilename):
|
||||||
boxFound = True
|
boxFound = True
|
||||||
|
@ -63,7 +63,7 @@ def _noOfBlogReplies(base_dir: str, http_prefix: str, translate: {},
|
||||||
# post may exist but has no replies
|
# post may exist but has no replies
|
||||||
for postBox in tryPostBox:
|
for postBox in tryPostBox:
|
||||||
postFilename = \
|
postFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/' + postBox + '/' + \
|
acct_dir(base_dir, nickname, domain) + '/' + postBox + '/' + \
|
||||||
postId.replace('/', '#')
|
postId.replace('/', '#')
|
||||||
if os.path.isfile(postFilename):
|
if os.path.isfile(postFilename):
|
||||||
return 1
|
return 1
|
||||||
|
@ -123,7 +123,7 @@ def _getBlogReplies(base_dir: str, http_prefix: str, translate: {},
|
||||||
boxFound = False
|
boxFound = False
|
||||||
for postBox in tryPostBox:
|
for postBox in tryPostBox:
|
||||||
postFilename = \
|
postFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/' + postBox + '/' + \
|
acct_dir(base_dir, nickname, domain) + '/' + postBox + '/' + \
|
||||||
postId.replace('/', '#') + '.replies'
|
postId.replace('/', '#') + '.replies'
|
||||||
if os.path.isfile(postFilename):
|
if os.path.isfile(postFilename):
|
||||||
boxFound = True
|
boxFound = True
|
||||||
|
@ -132,10 +132,10 @@ def _getBlogReplies(base_dir: str, http_prefix: str, translate: {},
|
||||||
# post may exist but has no replies
|
# post may exist but has no replies
|
||||||
for postBox in tryPostBox:
|
for postBox in tryPostBox:
|
||||||
postFilename = \
|
postFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/' + postBox + '/' + \
|
acct_dir(base_dir, nickname, domain) + '/' + postBox + '/' + \
|
||||||
postId.replace('/', '#') + '.json'
|
postId.replace('/', '#') + '.json'
|
||||||
if os.path.isfile(postFilename):
|
if os.path.isfile(postFilename):
|
||||||
postFilename = acctDir(base_dir, nickname, domain) + \
|
postFilename = acct_dir(base_dir, nickname, domain) + \
|
||||||
'/postcache/' + \
|
'/postcache/' + \
|
||||||
postId.replace('/', '#') + '.html'
|
postId.replace('/', '#') + '.html'
|
||||||
if os.path.isfile(postFilename):
|
if os.path.isfile(postFilename):
|
||||||
|
@ -159,7 +159,7 @@ def _getBlogReplies(base_dir: str, http_prefix: str, translate: {},
|
||||||
replyPostId = replyPostId.replace('\n', '').replace('\r', '')
|
replyPostId = replyPostId.replace('\n', '').replace('\r', '')
|
||||||
replyPostId = replyPostId.replace('.json', '')
|
replyPostId = replyPostId.replace('.json', '')
|
||||||
replyPostId = replyPostId.replace('.replies', '')
|
replyPostId = replyPostId.replace('.replies', '')
|
||||||
postFilename = acctDir(base_dir, nickname, domain) + \
|
postFilename = acct_dir(base_dir, nickname, domain) + \
|
||||||
'/postcache/' + \
|
'/postcache/' + \
|
||||||
replyPostId.replace('/', '#') + '.html'
|
replyPostId.replace('/', '#') + '.html'
|
||||||
if not os.path.isfile(postFilename):
|
if not os.path.isfile(postFilename):
|
||||||
|
@ -525,7 +525,7 @@ def htmlBlogPage(authorized: bool, session,
|
||||||
blogStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
blogStr = htmlHeaderWithExternalStyle(cssFilename, instanceTitle, None)
|
||||||
_htmlBlogRemoveCwButton(blogStr, translate)
|
_htmlBlogRemoveCwButton(blogStr, translate)
|
||||||
|
|
||||||
blogsIndex = acctDir(base_dir, nickname, domain) + '/tlblogs.index'
|
blogsIndex = acct_dir(base_dir, nickname, domain) + '/tlblogs.index'
|
||||||
if not os.path.isfile(blogsIndex):
|
if not os.path.isfile(blogsIndex):
|
||||||
return blogStr + htmlFooter()
|
return blogStr + htmlFooter()
|
||||||
|
|
||||||
|
@ -615,7 +615,7 @@ def htmlBlogPageRSS2(authorized: bool, session,
|
||||||
blogRSS2 = rss2Header(http_prefix, nickname, domain_full,
|
blogRSS2 = rss2Header(http_prefix, nickname, domain_full,
|
||||||
'Blog', translate)
|
'Blog', translate)
|
||||||
|
|
||||||
blogsIndex = acctDir(base_dir, nickname, domain) + '/tlblogs.index'
|
blogsIndex = acct_dir(base_dir, nickname, domain) + '/tlblogs.index'
|
||||||
if not os.path.isfile(blogsIndex):
|
if not os.path.isfile(blogsIndex):
|
||||||
if includeHeader:
|
if includeHeader:
|
||||||
return blogRSS2 + rss2Footer()
|
return blogRSS2 + rss2Footer()
|
||||||
|
@ -667,7 +667,7 @@ def htmlBlogPageRSS3(authorized: bool, session,
|
||||||
|
|
||||||
blogRSS3 = ''
|
blogRSS3 = ''
|
||||||
|
|
||||||
blogsIndex = acctDir(base_dir, nickname, domain) + '/tlblogs.index'
|
blogsIndex = acct_dir(base_dir, nickname, domain) + '/tlblogs.index'
|
||||||
if not os.path.isfile(blogsIndex):
|
if not os.path.isfile(blogsIndex):
|
||||||
return blogRSS3
|
return blogRSS3
|
||||||
|
|
||||||
|
@ -937,7 +937,7 @@ def pathContainsBlogLink(base_dir: str,
|
||||||
if not userEnding2[1].isdigit():
|
if not userEnding2[1].isdigit():
|
||||||
return None, None
|
return None, None
|
||||||
# check for blog posts
|
# check for blog posts
|
||||||
blogIndexFilename = acctDir(base_dir, nickname, domain) + '/tlblogs.index'
|
blogIndexFilename = acct_dir(base_dir, nickname, domain) + '/tlblogs.index'
|
||||||
if not os.path.isfile(blogIndexFilename):
|
if not os.path.isfile(blogIndexFilename):
|
||||||
return None, None
|
return None, None
|
||||||
if '#' + userEnding2[1] + '.' not in open(blogIndexFilename).read():
|
if '#' + userEnding2[1] + '.' not in open(blogIndexFilename).read():
|
||||||
|
|
|
@ -24,7 +24,7 @@ from utils import getCachedPostFilename
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import saveJson
|
from utils import saveJson
|
||||||
from utils import has_object_dict
|
from utils import has_object_dict
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from utils import hasActor
|
from utils import hasActor
|
||||||
from utils import hasObjectStringType
|
from utils import hasObjectStringType
|
||||||
|
@ -60,7 +60,7 @@ def undoBookmarksCollectionEntry(recentPostsCache: {},
|
||||||
|
|
||||||
# remove from the index
|
# remove from the index
|
||||||
bookmarksIndexFilename = \
|
bookmarksIndexFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/bookmarks.index'
|
acct_dir(base_dir, nickname, domain) + '/bookmarks.index'
|
||||||
if not os.path.isfile(bookmarksIndexFilename):
|
if not os.path.isfile(bookmarksIndexFilename):
|
||||||
return
|
return
|
||||||
if '/' in postFilename:
|
if '/' in postFilename:
|
||||||
|
@ -224,7 +224,7 @@ def updateBookmarksCollection(recentPostsCache: {},
|
||||||
|
|
||||||
# prepend to the index
|
# prepend to the index
|
||||||
bookmarksIndexFilename = \
|
bookmarksIndexFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/bookmarks.index'
|
acct_dir(base_dir, nickname, domain) + '/bookmarks.index'
|
||||||
bookmarkIndex = postFilename.split('/')[-1]
|
bookmarkIndex = postFilename.split('/')[-1]
|
||||||
if os.path.isfile(bookmarksIndexFilename):
|
if os.path.isfile(bookmarksIndexFilename):
|
||||||
if bookmarkIndex not in open(bookmarksIndexFilename).read():
|
if bookmarkIndex not in open(bookmarksIndexFilename).read():
|
||||||
|
|
4
city.py
4
city.py
|
@ -12,7 +12,7 @@ import datetime
|
||||||
import random
|
import random
|
||||||
import math
|
import math
|
||||||
from random import randint
|
from random import randint
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
|
|
||||||
# states which the simulated city dweller can be in
|
# states which the simulated city dweller can be in
|
||||||
PERSON_SLEEP = 0
|
PERSON_SLEEP = 0
|
||||||
|
@ -314,7 +314,7 @@ def getSpoofedCity(city: str, base_dir: str,
|
||||||
image metadata
|
image metadata
|
||||||
"""
|
"""
|
||||||
city = ''
|
city = ''
|
||||||
cityFilename = acctDir(base_dir, nickname, domain) + '/city.txt'
|
cityFilename = acct_dir(base_dir, nickname, domain) + '/city.txt'
|
||||||
if os.path.isfile(cityFilename):
|
if os.path.isfile(cityFilename):
|
||||||
try:
|
try:
|
||||||
with open(cityFilename, 'r') as fp:
|
with open(cityFilename, 'r') as fp:
|
||||||
|
|
|
@ -22,7 +22,7 @@ from utils import getLinkPrefixes
|
||||||
from utils import dangerousMarkup
|
from utils import dangerousMarkup
|
||||||
from utils import isPGPEncrypted
|
from utils import isPGPEncrypted
|
||||||
from utils import containsPGPPublicKey
|
from utils import containsPGPPublicKey
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import isfloat
|
from utils import isfloat
|
||||||
from utils import getCurrencies
|
from utils import getCurrencies
|
||||||
from utils import removeHtml
|
from utils import removeHtml
|
||||||
|
@ -223,7 +223,7 @@ def switchWords(base_dir: str, nickname: str, domain: str, content: str,
|
||||||
|
|
||||||
if not rules:
|
if not rules:
|
||||||
switchWordsFilename = \
|
switchWordsFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/replacewords.txt'
|
acct_dir(base_dir, nickname, domain) + '/replacewords.txt'
|
||||||
if not os.path.isfile(switchWordsFilename):
|
if not os.path.isfile(switchWordsFilename):
|
||||||
return content
|
return content
|
||||||
try:
|
try:
|
||||||
|
@ -784,7 +784,7 @@ def _loadAutoTags(base_dir: str, nickname: str, domain: str) -> []:
|
||||||
"""Loads automatic tags file and returns a list containing
|
"""Loads automatic tags file and returns a list containing
|
||||||
the lines of the file
|
the lines of the file
|
||||||
"""
|
"""
|
||||||
filename = acctDir(base_dir, nickname, domain) + '/autotags.txt'
|
filename = acct_dir(base_dir, nickname, domain) + '/autotags.txt'
|
||||||
if not os.path.isfile(filename):
|
if not os.path.isfile(filename):
|
||||||
return []
|
return []
|
||||||
try:
|
try:
|
||||||
|
@ -856,7 +856,7 @@ def addHtmlTags(base_dir: str, http_prefix: str,
|
||||||
emojiDict = {}
|
emojiDict = {}
|
||||||
originalDomain = domain
|
originalDomain = domain
|
||||||
domain = removeDomainPort(domain)
|
domain = removeDomainPort(domain)
|
||||||
followingFilename = acctDir(base_dir, nickname, domain) + '/following.txt'
|
followingFilename = acct_dir(base_dir, nickname, domain) + '/following.txt'
|
||||||
|
|
||||||
# read the following list so that we can detect just @nick
|
# read the following list so that we can detect just @nick
|
||||||
# in addition to @nick@domain
|
# in addition to @nick@domain
|
||||||
|
|
|
@ -9,7 +9,7 @@ __module_group__ = "Timeline"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from utils import has_object_dict
|
from utils import has_object_dict
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import removeIdEnding
|
from utils import removeIdEnding
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ def _getConversationFilename(base_dir: str, nickname: str, domain: str,
|
||||||
return None
|
return None
|
||||||
if not post_json_object['object'].get('id'):
|
if not post_json_object['object'].get('id'):
|
||||||
return None
|
return None
|
||||||
conversationDir = acctDir(base_dir, nickname, domain) + '/conversation'
|
conversationDir = acct_dir(base_dir, nickname, domain) + '/conversation'
|
||||||
if not os.path.isdir(conversationDir):
|
if not os.path.isdir(conversationDir):
|
||||||
os.mkdir(conversationDir)
|
os.mkdir(conversationDir)
|
||||||
conversationId = post_json_object['object']['conversation']
|
conversationId = post_json_object['object']['conversation']
|
||||||
|
@ -63,7 +63,7 @@ def muteConversation(base_dir: str, nickname: str, domain: str,
|
||||||
conversationId: str) -> None:
|
conversationId: str) -> None:
|
||||||
"""Mutes the given conversation
|
"""Mutes the given conversation
|
||||||
"""
|
"""
|
||||||
conversationDir = acctDir(base_dir, nickname, domain) + '/conversation'
|
conversationDir = acct_dir(base_dir, nickname, domain) + '/conversation'
|
||||||
conversationFilename = \
|
conversationFilename = \
|
||||||
conversationDir + '/' + conversationId.replace('/', '#')
|
conversationDir + '/' + conversationId.replace('/', '#')
|
||||||
if not os.path.isfile(conversationFilename):
|
if not os.path.isfile(conversationFilename):
|
||||||
|
@ -81,7 +81,7 @@ def unmuteConversation(base_dir: str, nickname: str, domain: str,
|
||||||
conversationId: str) -> None:
|
conversationId: str) -> None:
|
||||||
"""Unmutes the given conversation
|
"""Unmutes the given conversation
|
||||||
"""
|
"""
|
||||||
conversationDir = acctDir(base_dir, nickname, domain) + '/conversation'
|
conversationDir = acct_dir(base_dir, nickname, domain) + '/conversation'
|
||||||
conversationFilename = \
|
conversationFilename = \
|
||||||
conversationDir + '/' + conversationId.replace('/', '#')
|
conversationDir + '/' + conversationId.replace('/', '#')
|
||||||
if not os.path.isfile(conversationFilename):
|
if not os.path.isfile(conversationFilename):
|
||||||
|
|
105
daemon.py
105
daemon.py
|
@ -255,7 +255,7 @@ from utils import isfloat
|
||||||
from utils import validPassword
|
from utils import validPassword
|
||||||
from utils import removeLineEndings
|
from utils import removeLineEndings
|
||||||
from utils import get_base_content_from_post
|
from utils import get_base_content_from_post
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import getImageExtensionFromMimeType
|
from utils import getImageExtensionFromMimeType
|
||||||
from utils import getImageMimeType
|
from utils import getImageMimeType
|
||||||
from utils import has_object_dict
|
from utils import has_object_dict
|
||||||
|
@ -472,7 +472,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
"""Sends a reply to a question
|
"""Sends a reply to a question
|
||||||
"""
|
"""
|
||||||
votesFilename = \
|
votesFilename = \
|
||||||
acctDir(self.server.base_dir, nickname, self.server.domain) + \
|
acct_dir(self.server.base_dir, nickname, self.server.domain) + \
|
||||||
'/questions.txt'
|
'/questions.txt'
|
||||||
|
|
||||||
if os.path.isfile(votesFilename):
|
if os.path.isfile(votesFilename):
|
||||||
|
@ -1766,7 +1766,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# This produces a deterministic token based
|
# This produces a deterministic token based
|
||||||
# on nick+password+salt
|
# on nick+password+salt
|
||||||
saltFilename = \
|
saltFilename = \
|
||||||
acctDir(base_dir, loginNickname, domain) + '/.salt'
|
acct_dir(base_dir, loginNickname, domain) + '/.salt'
|
||||||
salt = createPassword(32)
|
salt = createPassword(32)
|
||||||
if os.path.isfile(saltFilename):
|
if os.path.isfile(saltFilename):
|
||||||
try:
|
try:
|
||||||
|
@ -2109,7 +2109,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
if saveKeys:
|
if saveKeys:
|
||||||
accessKeysFilename = \
|
accessKeysFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/accessKeys.json'
|
acct_dir(base_dir, nickname, domain) + '/accessKeys.json'
|
||||||
saveJson(accessKeys, accessKeysFilename)
|
saveJson(accessKeys, accessKeysFilename)
|
||||||
if not self.server.keyShortcuts.get(nickname):
|
if not self.server.keyShortcuts.get(nickname):
|
||||||
self.server.keyShortcuts[nickname] = accessKeys.copy()
|
self.server.keyShortcuts[nickname] = accessKeys.copy()
|
||||||
|
@ -2492,8 +2492,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
postsToNews = optionsConfirmParams.split('postsToNews=')[1]
|
postsToNews = optionsConfirmParams.split('postsToNews=')[1]
|
||||||
if '&' in postsToNews:
|
if '&' in postsToNews:
|
||||||
postsToNews = postsToNews.split('&')[0]
|
postsToNews = postsToNews.split('&')[0]
|
||||||
accountDir = acctDir(self.server.base_dir,
|
accountDir = acct_dir(self.server.base_dir,
|
||||||
optionsNickname, optionsDomain)
|
optionsNickname, optionsDomain)
|
||||||
newswireBlockedFilename = accountDir + '/.nonewswire'
|
newswireBlockedFilename = accountDir + '/.nonewswire'
|
||||||
if postsToNews == 'on':
|
if postsToNews == 'on':
|
||||||
if os.path.isfile(newswireBlockedFilename):
|
if os.path.isfile(newswireBlockedFilename):
|
||||||
|
@ -2538,8 +2538,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
optionsConfirmParams.split('postsToFeatures=')[1]
|
optionsConfirmParams.split('postsToFeatures=')[1]
|
||||||
if '&' in postsToFeatures:
|
if '&' in postsToFeatures:
|
||||||
postsToFeatures = postsToFeatures.split('&')[0]
|
postsToFeatures = postsToFeatures.split('&')[0]
|
||||||
accountDir = acctDir(self.server.base_dir,
|
accountDir = acct_dir(self.server.base_dir,
|
||||||
optionsNickname, optionsDomain)
|
optionsNickname, optionsDomain)
|
||||||
featuresBlockedFilename = accountDir + '/.nofeatures'
|
featuresBlockedFilename = accountDir + '/.nofeatures'
|
||||||
if postsToFeatures == 'on':
|
if postsToFeatures == 'on':
|
||||||
if os.path.isfile(featuresBlockedFilename):
|
if os.path.isfile(featuresBlockedFilename):
|
||||||
|
@ -2584,8 +2584,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
optionsConfirmParams.split('modNewsPosts=')[1]
|
optionsConfirmParams.split('modNewsPosts=')[1]
|
||||||
if '&' in modPostsToNews:
|
if '&' in modPostsToNews:
|
||||||
modPostsToNews = modPostsToNews.split('&')[0]
|
modPostsToNews = modPostsToNews.split('&')[0]
|
||||||
accountDir = acctDir(self.server.base_dir,
|
accountDir = acct_dir(self.server.base_dir,
|
||||||
optionsNickname, optionsDomain)
|
optionsNickname, optionsDomain)
|
||||||
newswireModFilename = accountDir + '/.newswiremoderated'
|
newswireModFilename = accountDir + '/.newswiremoderated'
|
||||||
if modPostsToNews != 'on':
|
if modPostsToNews != 'on':
|
||||||
if os.path.isfile(newswireModFilename):
|
if os.path.isfile(newswireModFilename):
|
||||||
|
@ -3777,7 +3777,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.POSTbusy = False
|
self.server.POSTbusy = False
|
||||||
return
|
return
|
||||||
self.postFromNickname = pathUsersSection.split('/')[0]
|
self.postFromNickname = pathUsersSection.split('/')[0]
|
||||||
accountsDir = acctDir(base_dir, self.postFromNickname, domain)
|
accountsDir = acct_dir(base_dir, self.postFromNickname, domain)
|
||||||
if not os.path.isdir(accountsDir):
|
if not os.path.isdir(accountsDir):
|
||||||
self._404()
|
self._404()
|
||||||
self.server.POSTbusy = False
|
self.server.POSTbusy = False
|
||||||
|
@ -4464,7 +4464,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
nickname = getNicknameFromActor(actorStr)
|
nickname = getNicknameFromActor(actorStr)
|
||||||
|
|
||||||
citationsFilename = \
|
citationsFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/.citations.txt'
|
acct_dir(base_dir, nickname, domain) + '/.citations.txt'
|
||||||
# remove any existing citations file
|
# remove any existing citations file
|
||||||
if os.path.isfile(citationsFilename):
|
if os.path.isfile(citationsFilename):
|
||||||
try:
|
try:
|
||||||
|
@ -4783,7 +4783,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
filenameBase)
|
filenameBase)
|
||||||
else:
|
else:
|
||||||
filenameBase = \
|
filenameBase = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/' + mType + '.temp'
|
'/' + mType + '.temp'
|
||||||
|
|
||||||
filename, attachmentMediaType = \
|
filename, attachmentMediaType = \
|
||||||
|
@ -4883,7 +4883,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# load the json for the actor for this user
|
# load the json for the actor for this user
|
||||||
actorFilename = \
|
actorFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '.json'
|
acct_dir(base_dir, nickname, domain) + '.json'
|
||||||
if os.path.isfile(actorFilename):
|
if os.path.isfile(actorFilename):
|
||||||
actor_json = loadJson(actorFilename)
|
actor_json = loadJson(actorFilename)
|
||||||
if actor_json:
|
if actor_json:
|
||||||
|
@ -4983,7 +4983,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# change city
|
# change city
|
||||||
if fields.get('cityDropdown'):
|
if fields.get('cityDropdown'):
|
||||||
cityFilename = \
|
cityFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/city.txt'
|
acct_dir(base_dir, nickname, domain) + '/city.txt'
|
||||||
try:
|
try:
|
||||||
with open(cityFilename, 'w+') as fp:
|
with open(cityFilename, 'w+') as fp:
|
||||||
fp.write(fields['cityDropdown'])
|
fp.write(fields['cityDropdown'])
|
||||||
|
@ -5979,7 +5979,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# only receive DMs from accounts you follow
|
# only receive DMs from accounts you follow
|
||||||
followDMsFilename = \
|
followDMsFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/.followDMs'
|
acct_dir(base_dir, nickname, domain) + '/.followDMs'
|
||||||
if onFinalWelcomeScreen:
|
if onFinalWelcomeScreen:
|
||||||
# initial default setting created via
|
# initial default setting created via
|
||||||
# the welcome screen
|
# the welcome screen
|
||||||
|
@ -6013,7 +6013,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# remove Twitter retweets
|
# remove Twitter retweets
|
||||||
removeTwitterFilename = \
|
removeTwitterFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/.removeTwitter'
|
'/.removeTwitter'
|
||||||
removeTwitterActive = False
|
removeTwitterActive = False
|
||||||
if fields.get('removeTwitter'):
|
if fields.get('removeTwitter'):
|
||||||
|
@ -6037,10 +6037,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# hide Like button
|
# hide Like button
|
||||||
hideLikeButtonFile = \
|
hideLikeButtonFile = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/.hideLikeButton'
|
'/.hideLikeButton'
|
||||||
notifyLikesFilename = \
|
notifyLikesFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/.notifyLikes'
|
'/.notifyLikes'
|
||||||
hideLikeButtonActive = False
|
hideLikeButtonActive = False
|
||||||
if fields.get('hideLikeButton'):
|
if fields.get('hideLikeButton'):
|
||||||
|
@ -6071,10 +6071,10 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# hide Reaction button
|
# hide Reaction button
|
||||||
hideReactionButtonFile = \
|
hideReactionButtonFile = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/.hideReactionButton'
|
'/.hideReactionButton'
|
||||||
notifyReactionsFilename = \
|
notifyReactionsFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/.notifyReactions'
|
'/.notifyReactions'
|
||||||
hideReactionButtonActive = False
|
hideReactionButtonActive = False
|
||||||
if fields.get('hideReactionButton'):
|
if fields.get('hideReactionButton'):
|
||||||
|
@ -6137,7 +6137,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
notifyLikesFilename)
|
notifyLikesFilename)
|
||||||
|
|
||||||
notifyReactionsFilename = \
|
notifyReactionsFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/.notifyReactions'
|
'/.notifyReactions'
|
||||||
if onFinalWelcomeScreen:
|
if onFinalWelcomeScreen:
|
||||||
# default setting from welcome screen
|
# default setting from welcome screen
|
||||||
|
@ -6221,7 +6221,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# save filtered words list
|
# save filtered words list
|
||||||
filterFilename = \
|
filterFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/filters.txt'
|
'/filters.txt'
|
||||||
if fields.get('filteredWords'):
|
if fields.get('filteredWords'):
|
||||||
try:
|
try:
|
||||||
|
@ -6241,7 +6241,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# save filtered words within bio list
|
# save filtered words within bio list
|
||||||
filterBioFilename = \
|
filterBioFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/filters_bio.txt'
|
'/filters_bio.txt'
|
||||||
if fields.get('filteredWordsBio'):
|
if fields.get('filteredWordsBio'):
|
||||||
try:
|
try:
|
||||||
|
@ -6261,7 +6261,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# word replacements
|
# word replacements
|
||||||
switchFilename = \
|
switchFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/replacewords.txt'
|
'/replacewords.txt'
|
||||||
if fields.get('switchWords'):
|
if fields.get('switchWords'):
|
||||||
try:
|
try:
|
||||||
|
@ -6281,7 +6281,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# autogenerated tags
|
# autogenerated tags
|
||||||
autoTagsFilename = \
|
autoTagsFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/autotags.txt'
|
'/autotags.txt'
|
||||||
if fields.get('autoTags'):
|
if fields.get('autoTags'):
|
||||||
try:
|
try:
|
||||||
|
@ -6301,7 +6301,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# autogenerated content warnings
|
# autogenerated content warnings
|
||||||
autoCWFilename = \
|
autoCWFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/autocw.txt'
|
'/autocw.txt'
|
||||||
if fields.get('autoCW'):
|
if fields.get('autoCW'):
|
||||||
try:
|
try:
|
||||||
|
@ -6321,7 +6321,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# save blocked accounts list
|
# save blocked accounts list
|
||||||
blockedFilename = \
|
blockedFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/blocking.txt'
|
'/blocking.txt'
|
||||||
if fields.get('blocked'):
|
if fields.get('blocked'):
|
||||||
try:
|
try:
|
||||||
|
@ -6343,7 +6343,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# The allow list for incoming DMs,
|
# The allow list for incoming DMs,
|
||||||
# if the .followDMs flag file exists
|
# if the .followDMs flag file exists
|
||||||
dmAllowedInstancesFilename = \
|
dmAllowedInstancesFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/dmAllowedinstances.txt'
|
'/dmAllowedinstances.txt'
|
||||||
if fields.get('dmAllowedInstances'):
|
if fields.get('dmAllowedInstances'):
|
||||||
try:
|
try:
|
||||||
|
@ -6365,7 +6365,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# save allowed instances list
|
# save allowed instances list
|
||||||
# This is the account level allow list
|
# This is the account level allow list
|
||||||
allowedInstancesFilename = \
|
allowedInstancesFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/allowedinstances.txt'
|
'/allowedinstances.txt'
|
||||||
if fields.get('allowedInstances'):
|
if fields.get('allowedInstances'):
|
||||||
try:
|
try:
|
||||||
|
@ -6457,7 +6457,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
# save git project names list
|
# save git project names list
|
||||||
gitProjectsFilename = \
|
gitProjectsFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/gitprojects.txt'
|
'/gitprojects.txt'
|
||||||
if fields.get('gitProjects'):
|
if fields.get('gitProjects'):
|
||||||
try:
|
try:
|
||||||
|
@ -6745,7 +6745,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if '/' in nickname:
|
if '/' in nickname:
|
||||||
nickname = nickname.split('/')[0]
|
nickname = nickname.split('/')[0]
|
||||||
speakerFilename = \
|
speakerFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/speaker.json'
|
acct_dir(base_dir, nickname, domain) + '/speaker.json'
|
||||||
if not os.path.isfile(speakerFilename):
|
if not os.path.isfile(speakerFilename):
|
||||||
self._404()
|
self._404()
|
||||||
return
|
return
|
||||||
|
@ -6857,7 +6857,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if '/' in nickname:
|
if '/' in nickname:
|
||||||
nickname = nickname.split('/')[0]
|
nickname = nickname.split('/')[0]
|
||||||
if not nickname.startswith('rss.'):
|
if not nickname.startswith('rss.'):
|
||||||
accountDir = acctDir(self.server.base_dir, nickname, domain)
|
accountDir = acct_dir(self.server.base_dir, nickname, domain)
|
||||||
if os.path.isdir(accountDir):
|
if os.path.isdir(accountDir):
|
||||||
if not self._establishSession("RSS request"):
|
if not self._establishSession("RSS request"):
|
||||||
return
|
return
|
||||||
|
@ -7025,7 +7025,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if '/' in nickname:
|
if '/' in nickname:
|
||||||
nickname = nickname.split('/')[0]
|
nickname = nickname.split('/')[0]
|
||||||
if not nickname.startswith('rss.'):
|
if not nickname.startswith('rss.'):
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
if os.path.isdir(accountDir):
|
if os.path.isdir(accountDir):
|
||||||
if not self._establishSession("getRSS3Feed"):
|
if not self._establishSession("getRSS3Feed"):
|
||||||
self._404()
|
self._404()
|
||||||
|
@ -9451,7 +9451,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
boxname = 'outbox'
|
boxname = 'outbox'
|
||||||
# get the replies file
|
# get the replies file
|
||||||
postDir = \
|
postDir = \
|
||||||
acctDir(base_dir, nickname, domain) + '/' + boxname
|
acct_dir(base_dir, nickname, domain) + '/' + boxname
|
||||||
postRepliesFilename = \
|
postRepliesFilename = \
|
||||||
postDir + '/' + \
|
postDir + '/' + \
|
||||||
http_prefix + ':##' + domain_full + '#users#' + \
|
http_prefix + ':##' + domain_full + '#users#' + \
|
||||||
|
@ -9658,7 +9658,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
|
|
||||||
postSections = namedStatus.split('/')
|
postSections = namedStatus.split('/')
|
||||||
nickname = postSections[0]
|
nickname = postSections[0]
|
||||||
actorFilename = acctDir(base_dir, nickname, domain) + '.json'
|
actorFilename = acct_dir(base_dir, nickname, domain) + '.json'
|
||||||
if not os.path.isfile(actorFilename):
|
if not os.path.isfile(actorFilename):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -9766,7 +9766,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
if '/' in namedStatus:
|
if '/' in namedStatus:
|
||||||
postSections = namedStatus.split('/')
|
postSections = namedStatus.split('/')
|
||||||
nickname = postSections[0]
|
nickname = postSections[0]
|
||||||
actorFilename = acctDir(base_dir, nickname, domain) + '.json'
|
actorFilename = acct_dir(base_dir, nickname, domain) + '.json'
|
||||||
if os.path.isfile(actorFilename):
|
if os.path.isfile(actorFilename):
|
||||||
actor_json = loadJson(actorFilename)
|
actor_json = loadJson(actorFilename)
|
||||||
if actor_json:
|
if actor_json:
|
||||||
|
@ -9924,7 +9924,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
postFilename = \
|
postFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/outbox/' + \
|
acct_dir(base_dir, nickname, domain) + '/outbox/' + \
|
||||||
http_prefix + ':##' + domain_full + '#users#' + nickname + \
|
http_prefix + ':##' + domain_full + '#users#' + nickname + \
|
||||||
'#statuses#' + statusNumber + '.json'
|
'#statuses#' + statusNumber + '.json'
|
||||||
|
|
||||||
|
@ -10082,7 +10082,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
postFilename = \
|
postFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/outbox/' + \
|
acct_dir(base_dir, nickname, domain) + '/outbox/' + \
|
||||||
http_prefix + ':##' + domain_full + '#users#' + nickname + \
|
http_prefix + ':##' + domain_full + '#users#' + nickname + \
|
||||||
'#statuses#' + statusNumber + '.json'
|
'#statuses#' + statusNumber + '.json'
|
||||||
|
|
||||||
|
@ -12516,7 +12516,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
nickname = getNicknameFromActor(path)
|
nickname = getNicknameFromActor(path)
|
||||||
savePersonQrcode(base_dir, nickname, domain, port)
|
savePersonQrcode(base_dir, nickname, domain, port)
|
||||||
qrFilename = \
|
qrFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/qrcode.png'
|
acct_dir(base_dir, nickname, domain) + '/qrcode.png'
|
||||||
if os.path.isfile(qrFilename):
|
if os.path.isfile(qrFilename):
|
||||||
if self._etag_exists(qrFilename):
|
if self._etag_exists(qrFilename):
|
||||||
# The file has not changed
|
# The file has not changed
|
||||||
|
@ -12556,7 +12556,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
"""
|
"""
|
||||||
nickname = getNicknameFromActor(path)
|
nickname = getNicknameFromActor(path)
|
||||||
bannerFilename = \
|
bannerFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/search_banner.png'
|
acct_dir(base_dir, nickname, domain) + '/search_banner.png'
|
||||||
if not os.path.isfile(bannerFilename):
|
if not os.path.isfile(bannerFilename):
|
||||||
if os.path.isfile(base_dir + '/theme/default/search_banner.png'):
|
if os.path.isfile(base_dir + '/theme/default/search_banner.png'):
|
||||||
copyfile(base_dir + '/theme/default/search_banner.png',
|
copyfile(base_dir + '/theme/default/search_banner.png',
|
||||||
|
@ -12604,7 +12604,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self._404()
|
self._404()
|
||||||
return True
|
return True
|
||||||
bannerFilename = \
|
bannerFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/' + side + '_col_image.png'
|
acct_dir(base_dir, nickname, domain) + '/' + \
|
||||||
|
side + '_col_image.png'
|
||||||
if os.path.isfile(bannerFilename):
|
if os.path.isfile(bannerFilename):
|
||||||
if self._etag_exists(bannerFilename):
|
if self._etag_exists(bannerFilename):
|
||||||
# The file has not changed
|
# The file has not changed
|
||||||
|
@ -12813,7 +12814,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
elif avatarFile.startswith('right_col_image'):
|
elif avatarFile.startswith('right_col_image'):
|
||||||
avatarFile = 'right_col_image.' + avatarFileExt
|
avatarFile = 'right_col_image.' + avatarFileExt
|
||||||
avatarFilename = \
|
avatarFilename = \
|
||||||
acctDir(base_dir, avatarNickname, domain) + '/' + avatarFile
|
acct_dir(base_dir, avatarNickname, domain) + '/' + avatarFile
|
||||||
if not os.path.isfile(avatarFilename):
|
if not os.path.isfile(avatarFilename):
|
||||||
originalExt = avatarFileExt
|
originalExt = avatarFileExt
|
||||||
originalAvatarFile = avatarFile
|
originalAvatarFile = avatarFile
|
||||||
|
@ -12826,7 +12827,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
originalAvatarFile.replace('.' + originalExt,
|
originalAvatarFile.replace('.' + originalExt,
|
||||||
'.' + alt)
|
'.' + alt)
|
||||||
avatarFilename = \
|
avatarFilename = \
|
||||||
acctDir(base_dir, avatarNickname, domain) + \
|
acct_dir(base_dir, avatarNickname, domain) + \
|
||||||
'/' + avatarFile
|
'/' + avatarFile
|
||||||
if os.path.isfile(avatarFilename):
|
if os.path.isfile(avatarFilename):
|
||||||
altFound = True
|
altFound = True
|
||||||
|
@ -14373,8 +14374,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.path.endswith('/followingaccounts'):
|
self.path.endswith('/followingaccounts'):
|
||||||
nickname = getNicknameFromActor(self.path)
|
nickname = getNicknameFromActor(self.path)
|
||||||
followingFilename = \
|
followingFilename = \
|
||||||
acctDir(self.server.base_dir,
|
acct_dir(self.server.base_dir,
|
||||||
nickname, self.server.domain) + '/following.txt'
|
nickname, self.server.domain) + '/following.txt'
|
||||||
if not os.path.isfile(followingFilename):
|
if not os.path.isfile(followingFilename):
|
||||||
self._404()
|
self._404()
|
||||||
return
|
return
|
||||||
|
@ -16484,8 +16485,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# Note: a .temp extension is used here so that at no time is
|
# Note: a .temp extension is used here so that at no time is
|
||||||
# an image with metadata publicly exposed, even for a few mS
|
# an image with metadata publicly exposed, even for a few mS
|
||||||
filenameBase = \
|
filenameBase = \
|
||||||
acctDir(self.server.base_dir,
|
acct_dir(self.server.base_dir,
|
||||||
nickname, self.server.domain) + '/upload.temp'
|
nickname, self.server.domain) + '/upload.temp'
|
||||||
|
|
||||||
filename, attachmentMediaType = \
|
filename, attachmentMediaType = \
|
||||||
saveMediaInFormPOST(mediaBytes, self.server.debug,
|
saveMediaInFormPOST(mediaBytes, self.server.debug,
|
||||||
|
@ -16582,8 +16583,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
# since epoch when an attempt to post something was made.
|
# since epoch when an attempt to post something was made.
|
||||||
# This is then used for active monthly users counts
|
# This is then used for active monthly users counts
|
||||||
lastUsedFilename = \
|
lastUsedFilename = \
|
||||||
acctDir(self.server.base_dir,
|
acct_dir(self.server.base_dir,
|
||||||
nickname, self.server.domain) + '/.lastUsed'
|
nickname, self.server.domain) + '/.lastUsed'
|
||||||
try:
|
try:
|
||||||
with open(lastUsedFilename, 'w+') as lastUsedFile:
|
with open(lastUsedFilename, 'w+') as lastUsedFile:
|
||||||
lastUsedFile.write(str(int(time.time())))
|
lastUsedFile.write(str(int(time.time())))
|
||||||
|
@ -16748,8 +16749,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
post_json_object = loadJson(postFilename)
|
post_json_object = loadJson(postFilename)
|
||||||
if post_json_object:
|
if post_json_object:
|
||||||
cachedFilename = \
|
cachedFilename = \
|
||||||
acctDir(self.server.base_dir,
|
acct_dir(self.server.base_dir,
|
||||||
nickname, self.server.domain) + \
|
nickname, self.server.domain) + \
|
||||||
'/postcache/' + \
|
'/postcache/' + \
|
||||||
fields['postUrl'].replace('/', '#') + '.html'
|
fields['postUrl'].replace('/', '#') + '.html'
|
||||||
if os.path.isfile(cachedFilename):
|
if os.path.isfile(cachedFilename):
|
||||||
|
|
|
@ -33,7 +33,7 @@ __module_group__ = "Security"
|
||||||
import os
|
import os
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import saveJson
|
from utils import saveJson
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ def E2EEremoveDevice(base_dir: str, nickname: str, domain: str,
|
||||||
deviceId: str) -> bool:
|
deviceId: str) -> bool:
|
||||||
"""Unregisters a device for e2ee
|
"""Unregisters a device for e2ee
|
||||||
"""
|
"""
|
||||||
personDir = acctDir(base_dir, nickname, domain)
|
personDir = acct_dir(base_dir, nickname, domain)
|
||||||
deviceFilename = personDir + '/devices/' + deviceId + '.json'
|
deviceFilename = personDir + '/devices/' + deviceId + '.json'
|
||||||
if os.path.isfile(deviceFilename):
|
if os.path.isfile(deviceFilename):
|
||||||
try:
|
try:
|
||||||
|
@ -116,7 +116,7 @@ def E2EEaddDevice(base_dir: str, nickname: str, domain: str,
|
||||||
'?' in deviceId or '#' in deviceId or \
|
'?' in deviceId or '#' in deviceId or \
|
||||||
'.' in deviceId:
|
'.' in deviceId:
|
||||||
return False
|
return False
|
||||||
personDir = acctDir(base_dir, nickname, domain)
|
personDir = acct_dir(base_dir, nickname, domain)
|
||||||
if not os.path.isdir(personDir):
|
if not os.path.isdir(personDir):
|
||||||
return False
|
return False
|
||||||
if not os.path.isdir(personDir + '/devices'):
|
if not os.path.isdir(personDir + '/devices'):
|
||||||
|
@ -143,7 +143,7 @@ def E2EEdevicesCollection(base_dir: str, nickname: str, domain: str,
|
||||||
domain_full: str, http_prefix: str) -> {}:
|
domain_full: str, http_prefix: str) -> {}:
|
||||||
"""Returns a list of registered devices
|
"""Returns a list of registered devices
|
||||||
"""
|
"""
|
||||||
personDir = acctDir(base_dir, nickname, domain)
|
personDir = acct_dir(base_dir, nickname, domain)
|
||||||
if not os.path.isdir(personDir):
|
if not os.path.isdir(personDir):
|
||||||
return {}
|
return {}
|
||||||
personId = local_actor_url(http_prefix, nickname, domain_full)
|
personId = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
|
|
10
epicyon.py
10
epicyon.py
|
@ -76,7 +76,7 @@ from utils import getNicknameFromActor
|
||||||
from utils import followPerson
|
from utils import followPerson
|
||||||
from utils import validNickname
|
from utils import validNickname
|
||||||
from utils import getProtocolPrefixes
|
from utils import getProtocolPrefixes
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from media import archiveMedia
|
from media import archiveMedia
|
||||||
from media import getAttachmentMediaType
|
from media import getAttachmentMediaType
|
||||||
from delete import sendDeleteViaServer
|
from delete import sendDeleteViaServer
|
||||||
|
@ -1235,7 +1235,7 @@ if args.followerspending:
|
||||||
print('Specify a nickname with the --nickname option')
|
print('Specify a nickname with the --nickname option')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
accountsDir = acctDir(base_dir, args.nickname, domain)
|
accountsDir = acct_dir(base_dir, args.nickname, domain)
|
||||||
approveFollowsFilename = accountsDir + '/followrequests.txt'
|
approveFollowsFilename = accountsDir + '/followrequests.txt'
|
||||||
approveCtr = 0
|
approveCtr = 0
|
||||||
if os.path.isfile(approveFollowsFilename):
|
if os.path.isfile(approveFollowsFilename):
|
||||||
|
@ -2283,7 +2283,7 @@ if args.addaccount:
|
||||||
if len(args.password.strip()) < 8:
|
if len(args.password.strip()) < 8:
|
||||||
print('Password should be at least 8 characters')
|
print('Password should be at least 8 characters')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
if os.path.isdir(accountDir):
|
if os.path.isdir(accountDir):
|
||||||
print('Account already exists')
|
print('Account already exists')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
@ -2326,7 +2326,7 @@ if args.addgroup:
|
||||||
if len(args.password.strip()) < 8:
|
if len(args.password.strip()) < 8:
|
||||||
print('Password should be at least 8 characters')
|
print('Password should be at least 8 characters')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
if os.path.isdir(accountDir):
|
if os.path.isdir(accountDir):
|
||||||
print('Group already exists')
|
print('Group already exists')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
@ -2410,7 +2410,7 @@ if args.changepassword:
|
||||||
if len(newPassword) < 8:
|
if len(newPassword) < 8:
|
||||||
print('Password should be at least 8 characters')
|
print('Password should be at least 8 characters')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
if not os.path.isdir(accountDir):
|
if not os.path.isdir(accountDir):
|
||||||
print('Account ' + nickname + '@' + domain + ' not found')
|
print('Account ' + nickname + '@' + domain + ' not found')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
12
filters.py
12
filters.py
|
@ -8,13 +8,13 @@ __status__ = "Production"
|
||||||
__module_group__ = "Moderation"
|
__module_group__ = "Moderation"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
|
|
||||||
|
|
||||||
def addFilter(base_dir: str, nickname: str, domain: str, words: str) -> bool:
|
def addFilter(base_dir: str, nickname: str, domain: str, words: str) -> bool:
|
||||||
"""Adds a filter for particular words within the content of a incoming posts
|
"""Adds a filter for particular words within the content of a incoming posts
|
||||||
"""
|
"""
|
||||||
filtersFilename = acctDir(base_dir, nickname, domain) + '/filters.txt'
|
filtersFilename = acct_dir(base_dir, nickname, domain) + '/filters.txt'
|
||||||
if os.path.isfile(filtersFilename):
|
if os.path.isfile(filtersFilename):
|
||||||
if words in open(filtersFilename).read():
|
if words in open(filtersFilename).read():
|
||||||
return False
|
return False
|
||||||
|
@ -50,7 +50,7 @@ def removeFilter(base_dir: str, nickname: str, domain: str,
|
||||||
words: str) -> bool:
|
words: str) -> bool:
|
||||||
"""Removes a word filter
|
"""Removes a word filter
|
||||||
"""
|
"""
|
||||||
filtersFilename = acctDir(base_dir, nickname, domain) + '/filters.txt'
|
filtersFilename = acct_dir(base_dir, nickname, domain) + '/filters.txt'
|
||||||
if not os.path.isfile(filtersFilename):
|
if not os.path.isfile(filtersFilename):
|
||||||
return False
|
return False
|
||||||
if words not in open(filtersFilename).read():
|
if words not in open(filtersFilename).read():
|
||||||
|
@ -154,7 +154,7 @@ def isFilteredBio(base_dir: str, nickname: str, domain: str, bio: str) -> bool:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
accountFiltersFilename = \
|
accountFiltersFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/filters_bio.txt'
|
acct_dir(base_dir, nickname, domain) + '/filters_bio.txt'
|
||||||
return _isFilteredBase(accountFiltersFilename, bio)
|
return _isFilteredBase(accountFiltersFilename, bio)
|
||||||
|
|
||||||
|
|
||||||
|
@ -172,11 +172,11 @@ def isFiltered(base_dir: str, nickname: str, domain: str,
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# optionally remove retweets
|
# optionally remove retweets
|
||||||
removeTwitter = acctDir(base_dir, nickname, domain) + '/.removeTwitter'
|
removeTwitter = acct_dir(base_dir, nickname, domain) + '/.removeTwitter'
|
||||||
if os.path.isfile(removeTwitter):
|
if os.path.isfile(removeTwitter):
|
||||||
if _isTwitterPost(content):
|
if _isTwitterPost(content):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
accountFiltersFilename = \
|
accountFiltersFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/filters.txt'
|
acct_dir(base_dir, nickname, domain) + '/filters.txt'
|
||||||
return _isFilteredBase(accountFiltersFilename, content)
|
return _isFilteredBase(accountFiltersFilename, content)
|
||||||
|
|
14
follow.py
14
follow.py
|
@ -27,7 +27,7 @@ from utils import loadJson
|
||||||
from utils import saveJson
|
from utils import saveJson
|
||||||
from utils import isAccountDir
|
from utils import isAccountDir
|
||||||
from utils import getUserPaths
|
from utils import getUserPaths
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import hasGroupType
|
from utils import hasGroupType
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from acceptreject import createAccept
|
from acceptreject import createAccept
|
||||||
|
@ -221,7 +221,7 @@ def getFollowerDomains(base_dir: str, nickname: str, domain: str) -> []:
|
||||||
"""Returns a list of domains for followers
|
"""Returns a list of domains for followers
|
||||||
"""
|
"""
|
||||||
domain = removeDomainPort(domain)
|
domain = removeDomainPort(domain)
|
||||||
followersFile = acctDir(base_dir, nickname, domain) + '/followers.txt'
|
followersFile = acct_dir(base_dir, nickname, domain) + '/followers.txt'
|
||||||
if not os.path.isfile(followersFile):
|
if not os.path.isfile(followersFile):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ def isFollowerOfPerson(base_dir: str, nickname: str, domain: str,
|
||||||
print('No followerNickname for ' + followerDomain)
|
print('No followerNickname for ' + followerDomain)
|
||||||
return False
|
return False
|
||||||
domain = removeDomainPort(domain)
|
domain = removeDomainPort(domain)
|
||||||
followersFile = acctDir(base_dir, nickname, domain) + '/followers.txt'
|
followersFile = acct_dir(base_dir, nickname, domain) + '/followers.txt'
|
||||||
if not os.path.isfile(followersFile):
|
if not os.path.isfile(followersFile):
|
||||||
return False
|
return False
|
||||||
handle = followerNickname + '@' + followerDomain
|
handle = followerNickname + '@' + followerDomain
|
||||||
|
@ -749,7 +749,7 @@ def followedAccountAccepts(session, base_dir: str, http_prefix: str,
|
||||||
if removeFollowActivity:
|
if removeFollowActivity:
|
||||||
# remove the follow request json
|
# remove the follow request json
|
||||||
followActivityfilename = \
|
followActivityfilename = \
|
||||||
acctDir(base_dir, nicknameToFollow, domainToFollow) + \
|
acct_dir(base_dir, nicknameToFollow, domainToFollow) + \
|
||||||
'/requests/' + \
|
'/requests/' + \
|
||||||
nickname + '@' + domain + '.follow'
|
nickname + '@' + domain + '.follow'
|
||||||
if os.path.isfile(followActivityfilename):
|
if os.path.isfile(followActivityfilename):
|
||||||
|
@ -797,7 +797,7 @@ def followedAccountRejects(session, base_dir: str, http_prefix: str,
|
||||||
|
|
||||||
# get the json for the original follow request
|
# get the json for the original follow request
|
||||||
followActivityfilename = \
|
followActivityfilename = \
|
||||||
acctDir(base_dir, nicknameToFollow, domainToFollow) + '/requests/' + \
|
acct_dir(base_dir, nicknameToFollow, domainToFollow) + '/requests/' + \
|
||||||
nickname + '@' + domain + '.follow'
|
nickname + '@' + domain + '.follow'
|
||||||
followJson = loadJson(followActivityfilename)
|
followJson = loadJson(followActivityfilename)
|
||||||
if not followJson:
|
if not followJson:
|
||||||
|
@ -886,7 +886,7 @@ def sendFollowRequest(session, base_dir: str,
|
||||||
|
|
||||||
# remove follow handle from unfollowed.txt
|
# remove follow handle from unfollowed.txt
|
||||||
unfollowedFilename = \
|
unfollowedFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/unfollowed.txt'
|
acct_dir(base_dir, nickname, domain) + '/unfollowed.txt'
|
||||||
if os.path.isfile(unfollowedFilename):
|
if os.path.isfile(unfollowedFilename):
|
||||||
if followHandle in open(unfollowedFilename).read():
|
if followHandle in open(unfollowedFilename).read():
|
||||||
unfollowedFile = None
|
unfollowedFile = None
|
||||||
|
@ -1432,7 +1432,7 @@ def followerApprovalActive(base_dir: str, nickname: str, domain: str) -> bool:
|
||||||
"""Returns true if the given account requires follower approval
|
"""Returns true if the given account requires follower approval
|
||||||
"""
|
"""
|
||||||
manuallyApprovesFollowers = False
|
manuallyApprovesFollowers = False
|
||||||
actorFilename = acctDir(base_dir, nickname, domain) + '.json'
|
actorFilename = acct_dir(base_dir, nickname, domain) + '.json'
|
||||||
if os.path.isfile(actorFilename):
|
if os.path.isfile(actorFilename):
|
||||||
actor_json = loadJson(actorFilename)
|
actor_json = loadJson(actorFilename)
|
||||||
if actor_json:
|
if actor_json:
|
||||||
|
|
8
git.py
8
git.py
|
@ -9,7 +9,7 @@ __module_group__ = "Profile Metadata"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import html
|
import html
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import hasObjectStringType
|
from utils import hasObjectStringType
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ def _getGitProjectName(base_dir: str, nickname: str, domain: str,
|
||||||
holder wants to receive
|
holder wants to receive
|
||||||
"""
|
"""
|
||||||
gitProjectsFilename = \
|
gitProjectsFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/gitprojects.txt'
|
acct_dir(base_dir, nickname, domain) + '/gitprojects.txt'
|
||||||
if not os.path.isfile(gitProjectsFilename):
|
if not os.path.isfile(gitProjectsFilename):
|
||||||
return None
|
return None
|
||||||
subjectLineWords = subject.lower().split(' ')
|
subjectLineWords = subject.lower().split(' ')
|
||||||
|
@ -186,7 +186,7 @@ def receiveGitPatch(base_dir: str, nickname: str, domain: str,
|
||||||
patchLines = patchStr.split('\n')
|
patchLines = patchStr.split('\n')
|
||||||
patchFilename = None
|
patchFilename = None
|
||||||
projectDir = None
|
projectDir = None
|
||||||
patchesDir = acctDir(base_dir, nickname, domain) + '/patches'
|
patchesDir = acct_dir(base_dir, nickname, domain) + '/patches'
|
||||||
# get the subject line and turn it into a filename
|
# get the subject line and turn it into a filename
|
||||||
for line in patchLines:
|
for line in patchLines:
|
||||||
if line.startswith('Subject:'):
|
if line.startswith('Subject:'):
|
||||||
|
@ -212,7 +212,7 @@ def receiveGitPatch(base_dir: str, nickname: str, domain: str,
|
||||||
with open(patchFilename, 'w+') as patchFile:
|
with open(patchFilename, 'w+') as patchFile:
|
||||||
patchFile.write(patchStr)
|
patchFile.write(patchStr)
|
||||||
patchNotifyFilename = \
|
patchNotifyFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/.newPatchContent'
|
acct_dir(base_dir, nickname, domain) + '/.newPatchContent'
|
||||||
with open(patchNotifyFilename, 'w+') as patchFile:
|
with open(patchNotifyFilename, 'w+') as patchFile:
|
||||||
patchFile.write(patchStr)
|
patchFile.write(patchStr)
|
||||||
return True
|
return True
|
||||||
|
|
12
happening.py
12
happening.py
|
@ -17,7 +17,7 @@ from utils import loadJson
|
||||||
from utils import saveJson
|
from utils import saveJson
|
||||||
from utils import locatePost
|
from utils import locatePost
|
||||||
from utils import has_object_dict
|
from utils import has_object_dict
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
|
|
||||||
|
|
||||||
def _validUuid(testUuid: str, version: int):
|
def _validUuid(testUuid: str, version: int):
|
||||||
|
@ -194,7 +194,7 @@ def getTodaysEvents(base_dir: str, nickname: str, domain: str,
|
||||||
dayNumber = currDayOfMonth
|
dayNumber = currDayOfMonth
|
||||||
|
|
||||||
calendarFilename = \
|
calendarFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/calendar/' + str(year) + '/' + str(monthNumber) + '.txt'
|
'/calendar/' + str(year) + '/' + str(monthNumber) + '.txt'
|
||||||
events = {}
|
events = {}
|
||||||
if not os.path.isfile(calendarFilename):
|
if not os.path.isfile(calendarFilename):
|
||||||
|
@ -271,7 +271,7 @@ def dayEventsCheck(base_dir: str, nickname: str, domain: str,
|
||||||
dayNumber = currDate.day
|
dayNumber = currDate.day
|
||||||
|
|
||||||
calendarFilename = \
|
calendarFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/calendar/' + str(year) + '/' + str(monthNumber) + '.txt'
|
'/calendar/' + str(year) + '/' + str(monthNumber) + '.txt'
|
||||||
if not os.path.isfile(calendarFilename):
|
if not os.path.isfile(calendarFilename):
|
||||||
return False
|
return False
|
||||||
|
@ -324,7 +324,7 @@ def getThisWeeksEvents(base_dir: str, nickname: str, domain: str) -> {}:
|
||||||
monthNumber = now.month
|
monthNumber = now.month
|
||||||
|
|
||||||
calendarFilename = \
|
calendarFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/calendar/' + str(year) + '/' + str(monthNumber) + '.txt'
|
'/calendar/' + str(year) + '/' + str(monthNumber) + '.txt'
|
||||||
|
|
||||||
events = {}
|
events = {}
|
||||||
|
@ -389,7 +389,7 @@ def getCalendarEvents(base_dir: str, nickname: str, domain: str,
|
||||||
Event and Place activities
|
Event and Place activities
|
||||||
"""
|
"""
|
||||||
calendarFilename = \
|
calendarFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/calendar/' + str(year) + '/' + str(monthNumber) + '.txt'
|
'/calendar/' + str(year) + '/' + str(monthNumber) + '.txt'
|
||||||
|
|
||||||
events = {}
|
events = {}
|
||||||
|
@ -454,7 +454,7 @@ def removeCalendarEvent(base_dir: str, nickname: str, domain: str,
|
||||||
"""Removes a calendar event
|
"""Removes a calendar event
|
||||||
"""
|
"""
|
||||||
calendarFilename = \
|
calendarFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/calendar/' + str(year) + '/' + str(monthNumber) + '.txt'
|
'/calendar/' + str(year) + '/' + str(monthNumber) + '.txt'
|
||||||
if not os.path.isfile(calendarFilename):
|
if not os.path.isfile(calendarFilename):
|
||||||
return
|
return
|
||||||
|
|
18
inbox.py
18
inbox.py
|
@ -29,7 +29,7 @@ from utils import getReplyIntervalHours
|
||||||
from utils import canReplyTo
|
from utils import canReplyTo
|
||||||
from utils import getUserPaths
|
from utils import getUserPaths
|
||||||
from utils import get_base_content_from_post
|
from utils import get_base_content_from_post
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import removeDomainPort
|
from utils import removeDomainPort
|
||||||
from utils import getPortFromDomain
|
from utils import getPortFromDomain
|
||||||
from utils import has_object_dict
|
from utils import has_object_dict
|
||||||
|
@ -143,7 +143,7 @@ def _storeLastPostId(base_dir: str, nickname: str, domain: str,
|
||||||
postId = removeIdEnding(post_json_object['id'])
|
postId = removeIdEnding(post_json_object['id'])
|
||||||
if not actor:
|
if not actor:
|
||||||
return
|
return
|
||||||
lastpostDir = acctDir(base_dir, nickname, domain) + '/lastpost'
|
lastpostDir = acct_dir(base_dir, nickname, domain) + '/lastpost'
|
||||||
if not os.path.isdir(lastpostDir):
|
if not os.path.isdir(lastpostDir):
|
||||||
os.mkdir(lastpostDir)
|
os.mkdir(lastpostDir)
|
||||||
actorFilename = lastpostDir + '/' + actor.replace('/', '#')
|
actorFilename = lastpostDir + '/' + actor.replace('/', '#')
|
||||||
|
@ -160,7 +160,7 @@ def _updateCachedHashtagSwarm(base_dir: str, nickname: str, domain: str,
|
||||||
"""Updates the hashtag swarm stored as a file
|
"""Updates the hashtag swarm stored as a file
|
||||||
"""
|
"""
|
||||||
cachedHashtagSwarmFilename = \
|
cachedHashtagSwarmFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/.hashtagSwarm'
|
acct_dir(base_dir, nickname, domain) + '/.hashtagSwarm'
|
||||||
saveSwarm = True
|
saveSwarm = True
|
||||||
if os.path.isfile(cachedHashtagSwarmFilename):
|
if os.path.isfile(cachedHashtagSwarmFilename):
|
||||||
lastModified = fileLastModified(cachedHashtagSwarmFilename)
|
lastModified = fileLastModified(cachedHashtagSwarmFilename)
|
||||||
|
@ -325,7 +325,7 @@ def validInbox(base_dir: str, nickname: str, domain: str) -> bool:
|
||||||
"""Checks whether files were correctly saved to the inbox
|
"""Checks whether files were correctly saved to the inbox
|
||||||
"""
|
"""
|
||||||
domain = removeDomainPort(domain)
|
domain = removeDomainPort(domain)
|
||||||
inboxDir = acctDir(base_dir, nickname, domain) + '/inbox'
|
inboxDir = acct_dir(base_dir, nickname, domain) + '/inbox'
|
||||||
if not os.path.isdir(inboxDir):
|
if not os.path.isdir(inboxDir):
|
||||||
return True
|
return True
|
||||||
for subdir, dirs, files in os.walk(inboxDir):
|
for subdir, dirs, files in os.walk(inboxDir):
|
||||||
|
@ -347,7 +347,7 @@ def validInboxFilenames(base_dir: str, nickname: str, domain: str,
|
||||||
domain names within saved post filenames
|
domain names within saved post filenames
|
||||||
"""
|
"""
|
||||||
domain = removeDomainPort(domain)
|
domain = removeDomainPort(domain)
|
||||||
inboxDir = acctDir(base_dir, nickname, domain) + '/inbox'
|
inboxDir = acct_dir(base_dir, nickname, domain) + '/inbox'
|
||||||
if not os.path.isdir(inboxDir):
|
if not os.path.isdir(inboxDir):
|
||||||
print('Not an inbox directory: ' + inboxDir)
|
print('Not an inbox directory: ' + inboxDir)
|
||||||
return True
|
return True
|
||||||
|
@ -2771,7 +2771,7 @@ def _updateLastSeen(base_dir: str, handle: str, actor: str) -> None:
|
||||||
nickname = handle.split('@')[0]
|
nickname = handle.split('@')[0]
|
||||||
domain = handle.split('@')[1]
|
domain = handle.split('@')[1]
|
||||||
domain = removeDomainPort(domain)
|
domain = removeDomainPort(domain)
|
||||||
accountPath = acctDir(base_dir, nickname, domain)
|
accountPath = acct_dir(base_dir, nickname, domain)
|
||||||
if not os.path.isdir(accountPath):
|
if not os.path.isdir(accountPath):
|
||||||
return
|
return
|
||||||
if not isFollowingActor(base_dir, nickname, domain, actor):
|
if not isFollowingActor(base_dir, nickname, domain, actor):
|
||||||
|
@ -2900,7 +2900,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
|
|
||||||
# check for the flag file which indicates to
|
# check for the flag file which indicates to
|
||||||
# only receive DMs from people you are following
|
# only receive DMs from people you are following
|
||||||
followDMsFilename = acctDir(base_dir, nickname, domain) + '/.followDMs'
|
followDMsFilename = acct_dir(base_dir, nickname, domain) + '/.followDMs'
|
||||||
if not os.path.isfile(followDMsFilename):
|
if not os.path.isfile(followDMsFilename):
|
||||||
# dm index will be updated
|
# dm index will be updated
|
||||||
updateIndexList.append('dm')
|
updateIndexList.append('dm')
|
||||||
|
@ -2909,7 +2909,7 @@ def _isValidDM(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# get the file containing following handles
|
# get the file containing following handles
|
||||||
followingFilename = acctDir(base_dir, nickname, domain) + '/following.txt'
|
followingFilename = acct_dir(base_dir, nickname, domain) + '/following.txt'
|
||||||
# who is sending a DM?
|
# who is sending a DM?
|
||||||
if not post_json_object.get('actor'):
|
if not post_json_object.get('actor'):
|
||||||
return False
|
return False
|
||||||
|
@ -4000,7 +4000,7 @@ def _receiveFollowRequest(session, base_dir: str, http_prefix: str,
|
||||||
print('Follow request does not require approval ' + approveHandle)
|
print('Follow request does not require approval ' + approveHandle)
|
||||||
# update the followers
|
# update the followers
|
||||||
accountToBeFollowed = \
|
accountToBeFollowed = \
|
||||||
acctDir(base_dir, nicknameToFollow, domainToFollow)
|
acct_dir(base_dir, nicknameToFollow, domainToFollow)
|
||||||
if os.path.isdir(accountToBeFollowed):
|
if os.path.isdir(accountToBeFollowed):
|
||||||
followersFilename = accountToBeFollowed + '/followers.txt'
|
followersFilename = accountToBeFollowed + '/followers.txt'
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ from utils import loadJson
|
||||||
from utils import removeDomainPort
|
from utils import removeDomainPort
|
||||||
from utils import getPortFromDomain
|
from utils import getPortFromDomain
|
||||||
from utils import getUserPaths
|
from utils import getUserPaths
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from threads import threadWithTrace
|
from threads import threadWithTrace
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ def manualDenyFollowRequest(session, base_dir: str,
|
||||||
signing_priv_key_pem: str) -> None:
|
signing_priv_key_pem: str) -> None:
|
||||||
"""Manually deny a follow request
|
"""Manually deny a follow request
|
||||||
"""
|
"""
|
||||||
accountsDir = acctDir(base_dir, nickname, domain)
|
accountsDir = acct_dir(base_dir, nickname, domain)
|
||||||
|
|
||||||
# has this handle already been rejected?
|
# has this handle already been rejected?
|
||||||
rejectedFollowsFilename = accountsDir + '/followrejects.txt'
|
rejectedFollowsFilename = accountsDir + '/followrejects.txt'
|
||||||
|
|
|
@ -10,7 +10,7 @@ __module_group__ = "API"
|
||||||
import os
|
import os
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from metadata import metaDataInstance
|
from metadata import metaDataInstance
|
||||||
|
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ def _getMastoApiV1Account(base_dir: str, nickname: str, domain: str) -> {}:
|
||||||
blob/master/Using-the-API/API.md#account
|
blob/master/Using-the-API/API.md#account
|
||||||
Authorization has already been performed
|
Authorization has already been performed
|
||||||
"""
|
"""
|
||||||
accountFilename = acctDir(base_dir, nickname, domain) + '.json'
|
accountFilename = acct_dir(base_dir, nickname, domain) + '.json'
|
||||||
if not os.path.isfile(accountFilename):
|
if not os.path.isfile(accountFilename):
|
||||||
return {}
|
return {}
|
||||||
accountJson = loadJson(accountFilename)
|
accountJson = loadJson(accountFilename)
|
||||||
|
|
4
media.py
4
media.py
|
@ -22,7 +22,7 @@ from utils import getVideoExtensions
|
||||||
from utils import getAudioExtensions
|
from utils import getAudioExtensions
|
||||||
from utils import getMediaExtensions
|
from utils import getMediaExtensions
|
||||||
from utils import has_object_dict
|
from utils import has_object_dict
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
from shutil import move
|
from shutil import move
|
||||||
|
@ -116,7 +116,7 @@ def _spoofMetaData(base_dir: str, nickname: str, domain: str,
|
||||||
return
|
return
|
||||||
|
|
||||||
# get the random seed used to generate a unique pattern for this account
|
# get the random seed used to generate a unique pattern for this account
|
||||||
decoySeedFilename = acctDir(base_dir, nickname, domain) + '/decoyseed'
|
decoySeedFilename = acct_dir(base_dir, nickname, domain) + '/decoyseed'
|
||||||
decoySeed = 63725
|
decoySeed = 63725
|
||||||
if os.path.isfile(decoySeedFilename):
|
if os.path.isfile(decoySeedFilename):
|
||||||
with open(decoySeedFilename, 'r') as fp:
|
with open(decoySeedFilename, 'r') as fp:
|
||||||
|
|
|
@ -23,8 +23,8 @@ def _getStatusCount(base_dir: str) -> int:
|
||||||
for acct in dirs:
|
for acct in dirs:
|
||||||
if not isAccountDir(acct):
|
if not isAccountDir(acct):
|
||||||
continue
|
continue
|
||||||
acctDir = os.path.join(accountsDir, acct + '/outbox')
|
acct_dir = os.path.join(accountsDir, acct + '/outbox')
|
||||||
for subdir2, dirs2, files2 in os.walk(acctDir):
|
for subdir2, dirs2, files2 in os.walk(acct_dir):
|
||||||
statusCtr += len(files2)
|
statusCtr += len(files2)
|
||||||
break
|
break
|
||||||
break
|
break
|
||||||
|
|
10
migrate.py
10
migrate.py
|
@ -11,7 +11,7 @@ import os
|
||||||
from utils import isAccountDir
|
from utils import isAccountDir
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import getDomainFromActor
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import hasGroupType
|
from utils import hasGroupType
|
||||||
from webfinger import webfingerHandle
|
from webfinger import webfingerHandle
|
||||||
from blocking import isBlocked
|
from blocking import isBlocked
|
||||||
|
@ -28,7 +28,7 @@ def _moveFollowingHandlesForAccount(base_dir: str, nickname: str, domain: str,
|
||||||
"""Goes through all follows for an account and updates any that have moved
|
"""Goes through all follows for an account and updates any that have moved
|
||||||
"""
|
"""
|
||||||
ctr = 0
|
ctr = 0
|
||||||
followingFilename = acctDir(base_dir, nickname, domain) + '/following.txt'
|
followingFilename = acct_dir(base_dir, nickname, domain) + '/following.txt'
|
||||||
if not os.path.isfile(followingFilename):
|
if not os.path.isfile(followingFilename):
|
||||||
return ctr
|
return ctr
|
||||||
with open(followingFilename, 'r') as f:
|
with open(followingFilename, 'r') as f:
|
||||||
|
@ -116,7 +116,7 @@ def _updateMovedHandle(base_dir: str, nickname: str, domain: str,
|
||||||
debug, group_account, 'following.txt')
|
debug, group_account, 'following.txt')
|
||||||
return ctr
|
return ctr
|
||||||
|
|
||||||
followingFilename = acctDir(base_dir, nickname, domain) + '/following.txt'
|
followingFilename = acct_dir(base_dir, nickname, domain) + '/following.txt'
|
||||||
if os.path.isfile(followingFilename):
|
if os.path.isfile(followingFilename):
|
||||||
with open(followingFilename, 'r') as f:
|
with open(followingFilename, 'r') as f:
|
||||||
followingHandles = f.readlines()
|
followingHandles = f.readlines()
|
||||||
|
@ -125,7 +125,7 @@ def _updateMovedHandle(base_dir: str, nickname: str, domain: str,
|
||||||
handleLower = handle.lower()
|
handleLower = handle.lower()
|
||||||
|
|
||||||
refollowFilename = \
|
refollowFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/refollow.txt'
|
acct_dir(base_dir, nickname, domain) + '/refollow.txt'
|
||||||
|
|
||||||
# unfollow the old handle
|
# unfollow the old handle
|
||||||
with open(followingFilename, 'w+') as f:
|
with open(followingFilename, 'w+') as f:
|
||||||
|
@ -153,7 +153,7 @@ def _updateMovedHandle(base_dir: str, nickname: str, domain: str,
|
||||||
f.write(movedToHandle + '\n')
|
f.write(movedToHandle + '\n')
|
||||||
|
|
||||||
followersFilename = \
|
followersFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/followers.txt'
|
acct_dir(base_dir, nickname, domain) + '/followers.txt'
|
||||||
if os.path.isfile(followersFilename):
|
if os.path.isfile(followersFilename):
|
||||||
with open(followersFilename, 'r') as f:
|
with open(followersFilename, 'r') as f:
|
||||||
followerHandles = f.readlines()
|
followerHandles = f.readlines()
|
||||||
|
|
|
@ -31,7 +31,7 @@ from utils import isSuspended
|
||||||
from utils import containsInvalidChars
|
from utils import containsInvalidChars
|
||||||
from utils import removeHtml
|
from utils import removeHtml
|
||||||
from utils import isAccountDir
|
from utils import isAccountDir
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from blocking import isBlockedDomain
|
from blocking import isBlockedDomain
|
||||||
from blocking import isBlockedHashtag
|
from blocking import isBlockedHashtag
|
||||||
|
@ -1019,7 +1019,7 @@ def _addAccountBlogsToNewswire(base_dir: str, nickname: str, domain: str,
|
||||||
|
|
||||||
# local blogs can potentially be moderated
|
# local blogs can potentially be moderated
|
||||||
moderatedFilename = \
|
moderatedFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/.newswiremoderated'
|
acct_dir(base_dir, nickname, domain) + '/.newswiremoderated'
|
||||||
if os.path.isfile(moderatedFilename):
|
if os.path.isfile(moderatedFilename):
|
||||||
moderated = True
|
moderated = True
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ __module_group__ = "Calendar"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from utils import removeDomainPort
|
from utils import removeDomainPort
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
|
|
||||||
|
|
||||||
def _notifyOnPostArrival(base_dir: str, nickname: str, domain: str,
|
def _notifyOnPostArrival(base_dir: str, nickname: str, domain: str,
|
||||||
|
@ -21,7 +21,7 @@ def _notifyOnPostArrival(base_dir: str, nickname: str, domain: str,
|
||||||
"""
|
"""
|
||||||
# check that a following file exists
|
# check that a following file exists
|
||||||
domain = removeDomainPort(domain)
|
domain = removeDomainPort(domain)
|
||||||
followingFilename = acctDir(base_dir, nickname, domain) + '/following.txt'
|
followingFilename = acct_dir(base_dir, nickname, domain) + '/following.txt'
|
||||||
if not os.path.isfile(followingFilename):
|
if not os.path.isfile(followingFilename):
|
||||||
print("WARN: following.txt doesn't exist for " +
|
print("WARN: following.txt doesn't exist for " +
|
||||||
nickname + '@' + domain)
|
nickname + '@' + domain)
|
||||||
|
@ -34,7 +34,7 @@ def _notifyOnPostArrival(base_dir: str, nickname: str, domain: str,
|
||||||
return
|
return
|
||||||
|
|
||||||
notifyOnPostFilename = \
|
notifyOnPostFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/notifyOnPost.txt'
|
acct_dir(base_dir, nickname, domain) + '/notifyOnPost.txt'
|
||||||
|
|
||||||
# get the contents of the notifyOnPost file, which is
|
# get the contents of the notifyOnPost file, which is
|
||||||
# a set of handles
|
# a set of handles
|
||||||
|
@ -95,7 +95,7 @@ def notifyWhenPersonPosts(base_dir: str, nickname: str, domain: str,
|
||||||
if followingNickname == nickname and followingDomain == domain:
|
if followingNickname == nickname and followingDomain == domain:
|
||||||
return False
|
return False
|
||||||
notifyOnPostFilename = \
|
notifyOnPostFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/notifyOnPost.txt'
|
acct_dir(base_dir, nickname, domain) + '/notifyOnPost.txt'
|
||||||
handle = followingNickname + '@' + followingDomain
|
handle = followingNickname + '@' + followingDomain
|
||||||
if not os.path.isfile(notifyOnPostFilename):
|
if not os.path.isfile(notifyOnPostFilename):
|
||||||
# create a new notifyOnPost file
|
# create a new notifyOnPost file
|
||||||
|
|
|
@ -27,7 +27,7 @@ from utils import dangerousMarkup
|
||||||
from utils import isFeaturedWriter
|
from utils import isFeaturedWriter
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import saveJson
|
from utils import saveJson
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from utils import hasActor
|
from utils import hasActor
|
||||||
from blocking import isBlockedDomain
|
from blocking import isBlockedDomain
|
||||||
|
@ -119,7 +119,7 @@ def _outboxPersonReceiveUpdate(recentPostsCache: {},
|
||||||
return
|
return
|
||||||
updatedActorJson = message_json['object']
|
updatedActorJson = message_json['object']
|
||||||
# load actor from file
|
# load actor from file
|
||||||
actorFilename = acctDir(base_dir, nickname, domain) + '.json'
|
actorFilename = acct_dir(base_dir, nickname, domain) + '.json'
|
||||||
if not os.path.isfile(actorFilename):
|
if not os.path.isfile(actorFilename):
|
||||||
print('actorFilename not found: ' + actorFilename)
|
print('actorFilename not found: ' + actorFilename)
|
||||||
return
|
return
|
||||||
|
|
35
person.py
35
person.py
|
@ -55,7 +55,7 @@ from utils import getProtocolPrefixes
|
||||||
from utils import hasUsersPath
|
from utils import hasUsersPath
|
||||||
from utils import getImageExtensions
|
from utils import getImageExtensions
|
||||||
from utils import isImageFile
|
from utils import isImageFile
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import getUserPaths
|
from utils import getUserPaths
|
||||||
from utils import getGroupPaths
|
from utils import getGroupPaths
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
|
@ -168,7 +168,7 @@ def _accountExists(base_dir: str, nickname: str, domain: str) -> bool:
|
||||||
"""Returns true if the given account exists
|
"""Returns true if the given account exists
|
||||||
"""
|
"""
|
||||||
domain = removeDomainPort(domain)
|
domain = removeDomainPort(domain)
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
return os.path.isdir(accountDir) or \
|
return os.path.isdir(accountDir) or \
|
||||||
os.path.isdir(base_dir + '/deactivated/' + nickname + '@' + domain)
|
os.path.isdir(base_dir + '/deactivated/' + nickname + '@' + domain)
|
||||||
|
|
||||||
|
@ -583,7 +583,7 @@ def savePersonQrcode(base_dir: str,
|
||||||
"""Saves a qrcode image for the handle of the person
|
"""Saves a qrcode image for the handle of the person
|
||||||
This helps to transfer onion or i2p handles to a mobile device
|
This helps to transfer onion or i2p handles to a mobile device
|
||||||
"""
|
"""
|
||||||
qrcodeFilename = acctDir(base_dir, nickname, domain) + '/qrcode.png'
|
qrcodeFilename = acct_dir(base_dir, nickname, domain) + '/qrcode.png'
|
||||||
if os.path.isfile(qrcodeFilename):
|
if os.path.isfile(qrcodeFilename):
|
||||||
return
|
return
|
||||||
handle = getFullDomain('@' + nickname + '@' + domain, port)
|
handle = getFullDomain('@' + nickname + '@' + domain, port)
|
||||||
|
@ -635,12 +635,13 @@ def createPerson(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
|
|
||||||
if not os.path.isdir(base_dir + '/accounts'):
|
if not os.path.isdir(base_dir + '/accounts'):
|
||||||
os.mkdir(base_dir + '/accounts')
|
os.mkdir(base_dir + '/accounts')
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
if not os.path.isdir(accountDir):
|
if not os.path.isdir(accountDir):
|
||||||
os.mkdir(accountDir)
|
os.mkdir(accountDir)
|
||||||
|
|
||||||
if manual_follower_approval:
|
if manual_follower_approval:
|
||||||
followDMsFilename = acctDir(base_dir, nickname, domain) + '/.followDMs'
|
followDMsFilename = \
|
||||||
|
acct_dir(base_dir, nickname, domain) + '/.followDMs'
|
||||||
try:
|
try:
|
||||||
with open(followDMsFilename, 'w+') as fFile:
|
with open(followDMsFilename, 'w+') as fFile:
|
||||||
fFile.write('\n')
|
fFile.write('\n')
|
||||||
|
@ -650,7 +651,7 @@ def createPerson(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
# notify when posts are liked
|
# notify when posts are liked
|
||||||
if nickname != 'news':
|
if nickname != 'news':
|
||||||
notifyLikesFilename = \
|
notifyLikesFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/.notifyLikes'
|
acct_dir(base_dir, nickname, domain) + '/.notifyLikes'
|
||||||
try:
|
try:
|
||||||
with open(notifyLikesFilename, 'w+') as nFile:
|
with open(notifyLikesFilename, 'w+') as nFile:
|
||||||
nFile.write('\n')
|
nFile.write('\n')
|
||||||
|
@ -660,7 +661,7 @@ def createPerson(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
# notify when posts have emoji reactions
|
# notify when posts have emoji reactions
|
||||||
if nickname != 'news':
|
if nickname != 'news':
|
||||||
notifyReactionsFilename = \
|
notifyReactionsFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/.notifyReactions'
|
acct_dir(base_dir, nickname, domain) + '/.notifyReactions'
|
||||||
try:
|
try:
|
||||||
with open(notifyReactionsFilename, 'w+') as nFile:
|
with open(notifyReactionsFilename, 'w+') as nFile:
|
||||||
nFile.write('\n')
|
nFile.write('\n')
|
||||||
|
@ -673,13 +674,13 @@ def createPerson(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
|
|
||||||
if nickname != 'news':
|
if nickname != 'news':
|
||||||
if os.path.isfile(base_dir + '/img/default-avatar.png'):
|
if os.path.isfile(base_dir + '/img/default-avatar.png'):
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
copyfile(base_dir + '/img/default-avatar.png',
|
copyfile(base_dir + '/img/default-avatar.png',
|
||||||
accountDir + '/avatar.png')
|
accountDir + '/avatar.png')
|
||||||
else:
|
else:
|
||||||
newsAvatar = base_dir + '/theme/' + theme + '/icons/avatar_news.png'
|
newsAvatar = base_dir + '/theme/' + theme + '/icons/avatar_news.png'
|
||||||
if os.path.isfile(newsAvatar):
|
if os.path.isfile(newsAvatar):
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
copyfile(newsAvatar, accountDir + '/avatar.png')
|
copyfile(newsAvatar, accountDir + '/avatar.png')
|
||||||
|
|
||||||
defaultProfileImageFilename = base_dir + '/theme/default/image.png'
|
defaultProfileImageFilename = base_dir + '/theme/default/image.png'
|
||||||
|
@ -688,7 +689,7 @@ def createPerson(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
defaultProfileImageFilename = \
|
defaultProfileImageFilename = \
|
||||||
base_dir + '/theme/' + theme + '/image.png'
|
base_dir + '/theme/' + theme + '/image.png'
|
||||||
if os.path.isfile(defaultProfileImageFilename):
|
if os.path.isfile(defaultProfileImageFilename):
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
copyfile(defaultProfileImageFilename, accountDir + '/image.png')
|
copyfile(defaultProfileImageFilename, accountDir + '/image.png')
|
||||||
defaultBannerFilename = base_dir + '/theme/default/banner.png'
|
defaultBannerFilename = base_dir + '/theme/default/banner.png'
|
||||||
if theme:
|
if theme:
|
||||||
|
@ -696,7 +697,7 @@ def createPerson(base_dir: str, nickname: str, domain: str, port: int,
|
||||||
defaultBannerFilename = \
|
defaultBannerFilename = \
|
||||||
base_dir + '/theme/' + theme + '/banner.png'
|
base_dir + '/theme/' + theme + '/banner.png'
|
||||||
if os.path.isfile(defaultBannerFilename):
|
if os.path.isfile(defaultBannerFilename):
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
copyfile(defaultBannerFilename, accountDir + '/banner.png')
|
copyfile(defaultBannerFilename, accountDir + '/banner.png')
|
||||||
if nickname != 'news' and remainingConfigExists:
|
if nickname != 'news' and remainingConfigExists:
|
||||||
registrationsRemaining -= 1
|
registrationsRemaining -= 1
|
||||||
|
@ -1074,13 +1075,13 @@ def suspendAccount(base_dir: str, nickname: str, domain: str) -> None:
|
||||||
if moderator.strip('\n').strip('\r') == nickname:
|
if moderator.strip('\n').strip('\r') == nickname:
|
||||||
return
|
return
|
||||||
|
|
||||||
saltFilename = acctDir(base_dir, nickname, domain) + '/.salt'
|
saltFilename = acct_dir(base_dir, nickname, domain) + '/.salt'
|
||||||
if os.path.isfile(saltFilename):
|
if os.path.isfile(saltFilename):
|
||||||
try:
|
try:
|
||||||
os.remove(saltFilename)
|
os.remove(saltFilename)
|
||||||
except OSError:
|
except OSError:
|
||||||
print('EX: suspendAccount unable to delete ' + saltFilename)
|
print('EX: suspendAccount unable to delete ' + saltFilename)
|
||||||
tokenFilename = acctDir(base_dir, nickname, domain) + '/.token'
|
tokenFilename = acct_dir(base_dir, nickname, domain) + '/.token'
|
||||||
if os.path.isfile(tokenFilename):
|
if os.path.isfile(tokenFilename):
|
||||||
try:
|
try:
|
||||||
os.remove(tokenFilename)
|
os.remove(tokenFilename)
|
||||||
|
@ -1304,7 +1305,7 @@ def isPersonSnoozed(base_dir: str, nickname: str, domain: str,
|
||||||
snoozeActor: str) -> bool:
|
snoozeActor: str) -> bool:
|
||||||
"""Returns true if the given actor is snoozed
|
"""Returns true if the given actor is snoozed
|
||||||
"""
|
"""
|
||||||
snoozedFilename = acctDir(base_dir, nickname, domain) + '/snoozed.txt'
|
snoozedFilename = acct_dir(base_dir, nickname, domain) + '/snoozed.txt'
|
||||||
if not os.path.isfile(snoozedFilename):
|
if not os.path.isfile(snoozedFilename):
|
||||||
return False
|
return False
|
||||||
if snoozeActor + ' ' not in open(snoozedFilename).read():
|
if snoozeActor + ' ' not in open(snoozedFilename).read():
|
||||||
|
@ -1347,7 +1348,7 @@ def personSnooze(base_dir: str, nickname: str, domain: str,
|
||||||
snoozeActor: str) -> None:
|
snoozeActor: str) -> None:
|
||||||
"""Temporarily ignores the given actor
|
"""Temporarily ignores the given actor
|
||||||
"""
|
"""
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
if not os.path.isdir(accountDir):
|
if not os.path.isdir(accountDir):
|
||||||
print('ERROR: unknown account ' + accountDir)
|
print('ERROR: unknown account ' + accountDir)
|
||||||
return
|
return
|
||||||
|
@ -1367,7 +1368,7 @@ def personUnsnooze(base_dir: str, nickname: str, domain: str,
|
||||||
snoozeActor: str) -> None:
|
snoozeActor: str) -> None:
|
||||||
"""Undoes a temporarily ignore of the given actor
|
"""Undoes a temporarily ignore of the given actor
|
||||||
"""
|
"""
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
if not os.path.isdir(accountDir):
|
if not os.path.isdir(accountDir):
|
||||||
print('ERROR: unknown account ' + accountDir)
|
print('ERROR: unknown account ' + accountDir)
|
||||||
return
|
return
|
||||||
|
@ -1402,7 +1403,7 @@ def setPersonNotes(base_dir: str, nickname: str, domain: str,
|
||||||
return False
|
return False
|
||||||
if handle.startswith('@'):
|
if handle.startswith('@'):
|
||||||
handle = handle[1:]
|
handle = handle[1:]
|
||||||
notesDir = acctDir(base_dir, nickname, domain) + '/notes'
|
notesDir = acct_dir(base_dir, nickname, domain) + '/notes'
|
||||||
if not os.path.isdir(notesDir):
|
if not os.path.isdir(notesDir):
|
||||||
os.mkdir(notesDir)
|
os.mkdir(notesDir)
|
||||||
notesFilename = notesDir + '/' + handle + '.txt'
|
notesFilename = notesDir + '/' + handle + '.txt'
|
||||||
|
|
|
@ -8,7 +8,7 @@ __status__ = "Production"
|
||||||
__module_group__ = "Core"
|
__module_group__ = "Core"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
|
|
||||||
|
|
||||||
def setPetName(base_dir: str, nickname: str, domain: str,
|
def setPetName(base_dir: str, nickname: str, domain: str,
|
||||||
|
@ -23,7 +23,7 @@ def setPetName(base_dir: str, nickname: str, domain: str,
|
||||||
handle = handle[1:]
|
handle = handle[1:]
|
||||||
if petname.startswith('@'):
|
if petname.startswith('@'):
|
||||||
petname = petname[1:]
|
petname = petname[1:]
|
||||||
petnamesFilename = acctDir(base_dir, nickname, domain) + '/petnames.txt'
|
petnamesFilename = acct_dir(base_dir, nickname, domain) + '/petnames.txt'
|
||||||
entry = petname + ' ' + handle + '\n'
|
entry = petname + ' ' + handle + '\n'
|
||||||
|
|
||||||
# does this entry already exist?
|
# does this entry already exist?
|
||||||
|
@ -75,7 +75,7 @@ def getPetName(base_dir: str, nickname: str, domain: str,
|
||||||
return ''
|
return ''
|
||||||
if handle.startswith('@'):
|
if handle.startswith('@'):
|
||||||
handle = handle[1:]
|
handle = handle[1:]
|
||||||
petnamesFilename = acctDir(base_dir, nickname, domain) + '/petnames.txt'
|
petnamesFilename = acct_dir(base_dir, nickname, domain) + '/petnames.txt'
|
||||||
|
|
||||||
if not os.path.isfile(petnamesFilename):
|
if not os.path.isfile(petnamesFilename):
|
||||||
return ''
|
return ''
|
||||||
|
@ -102,7 +102,7 @@ def _getPetNameHandle(base_dir: str, nickname: str, domain: str,
|
||||||
"""
|
"""
|
||||||
if petname.startswith('@'):
|
if petname.startswith('@'):
|
||||||
petname = petname[1:]
|
petname = petname[1:]
|
||||||
petnamesFilename = acctDir(base_dir, nickname, domain) + '/petnames.txt'
|
petnamesFilename = acct_dir(base_dir, nickname, domain) + '/petnames.txt'
|
||||||
|
|
||||||
if not os.path.isfile(petnamesFilename):
|
if not os.path.isfile(petnamesFilename):
|
||||||
return ''
|
return ''
|
||||||
|
|
24
posts.py
24
posts.py
|
@ -67,7 +67,7 @@ from utils import locateNewsArrival
|
||||||
from utils import votesOnNewswireItem
|
from utils import votesOnNewswireItem
|
||||||
from utils import removeHtml
|
from utils import removeHtml
|
||||||
from utils import dangerousMarkup
|
from utils import dangerousMarkup
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from media import attachMedia
|
from media import attachMedia
|
||||||
from media import replaceYouTube
|
from media import replaceYouTube
|
||||||
|
@ -1009,7 +1009,7 @@ def _loadAutoCW(base_dir: str, nickname: str, domain: str) -> []:
|
||||||
"""Loads automatic CWs file and returns a list containing
|
"""Loads automatic CWs file and returns a list containing
|
||||||
the lines of the file
|
the lines of the file
|
||||||
"""
|
"""
|
||||||
filename = acctDir(base_dir, nickname, domain) + '/autocw.txt'
|
filename = acct_dir(base_dir, nickname, domain) + '/autocw.txt'
|
||||||
if not os.path.isfile(filename):
|
if not os.path.isfile(filename):
|
||||||
return []
|
return []
|
||||||
with open(filename, 'r') as f:
|
with open(filename, 'r') as f:
|
||||||
|
@ -1638,7 +1638,7 @@ def pinPost(base_dir: str, nickname: str, domain: str,
|
||||||
pinnedContent: str, followersOnly: bool) -> None:
|
pinnedContent: str, followersOnly: bool) -> None:
|
||||||
"""Pins the given post Id to the profile of then given account
|
"""Pins the given post Id to the profile of then given account
|
||||||
"""
|
"""
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
pinnedFilename = accountDir + '/pinToProfile.txt'
|
pinnedFilename = accountDir + '/pinToProfile.txt'
|
||||||
try:
|
try:
|
||||||
with open(pinnedFilename, 'w+') as pinFile:
|
with open(pinnedFilename, 'w+') as pinFile:
|
||||||
|
@ -1650,7 +1650,7 @@ def pinPost(base_dir: str, nickname: str, domain: str,
|
||||||
def undoPinnedPost(base_dir: str, nickname: str, domain: str) -> None:
|
def undoPinnedPost(base_dir: str, nickname: str, domain: str) -> None:
|
||||||
"""Removes pinned content for then given account
|
"""Removes pinned content for then given account
|
||||||
"""
|
"""
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
pinnedFilename = accountDir + '/pinToProfile.txt'
|
pinnedFilename = accountDir + '/pinToProfile.txt'
|
||||||
if os.path.isfile(pinnedFilename):
|
if os.path.isfile(pinnedFilename):
|
||||||
try:
|
try:
|
||||||
|
@ -1664,7 +1664,7 @@ def getPinnedPostAsJson(base_dir: str, http_prefix: str,
|
||||||
domain_full: str, system_language: str) -> {}:
|
domain_full: str, system_language: str) -> {}:
|
||||||
"""Returns the pinned profile post as json
|
"""Returns the pinned profile post as json
|
||||||
"""
|
"""
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
pinnedFilename = accountDir + '/pinToProfile.txt'
|
pinnedFilename = accountDir + '/pinToProfile.txt'
|
||||||
pinnedPostJson = {}
|
pinnedPostJson = {}
|
||||||
actor = local_actor_url(http_prefix, nickname, domain_full)
|
actor = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
|
@ -1728,7 +1728,7 @@ def regenerateIndexForBox(base_dir: str,
|
||||||
"""Generates an index for the given box if it doesn't exist
|
"""Generates an index for the given box if it doesn't exist
|
||||||
Used by unit tests to artificially create an index
|
Used by unit tests to artificially create an index
|
||||||
"""
|
"""
|
||||||
boxDir = acctDir(base_dir, nickname, domain) + '/' + boxName
|
boxDir = acct_dir(base_dir, nickname, domain) + '/' + boxName
|
||||||
boxIndexFilename = boxDir + '.index'
|
boxIndexFilename = boxDir + '.index'
|
||||||
|
|
||||||
if not os.path.isdir(boxDir):
|
if not os.path.isdir(boxDir):
|
||||||
|
@ -1810,7 +1810,7 @@ def _appendCitationsToBlogPost(base_dir: str,
|
||||||
"""
|
"""
|
||||||
# append citations tags, stored in a file
|
# append citations tags, stored in a file
|
||||||
citationsFilename = \
|
citationsFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/.citations.txt'
|
acct_dir(base_dir, nickname, domain) + '/.citations.txt'
|
||||||
if not os.path.isfile(citationsFilename):
|
if not os.path.isfile(citationsFilename):
|
||||||
return
|
return
|
||||||
citationsSeparator = '#####'
|
citationsSeparator = '#####'
|
||||||
|
@ -3724,7 +3724,7 @@ def _createBoxIndexed(recentPostsCache: {},
|
||||||
postUrlsInBox = []
|
postUrlsInBox = []
|
||||||
|
|
||||||
indexFilename = \
|
indexFilename = \
|
||||||
acctDir(base_dir, timelineNickname, originalDomain) + \
|
acct_dir(base_dir, timelineNickname, originalDomain) + \
|
||||||
'/' + indexBoxName + '.index'
|
'/' + indexBoxName + '.index'
|
||||||
totalPostsCount = 0
|
totalPostsCount = 0
|
||||||
postsAddedToTimeline = 0
|
postsAddedToTimeline = 0
|
||||||
|
@ -4444,7 +4444,7 @@ def populateRepliesJson(base_dir: str, nickname: str, domain: str,
|
||||||
for boxname in repliesBoxes:
|
for boxname in repliesBoxes:
|
||||||
messageId2 = messageId.replace('\n', '').replace('\r', '')
|
messageId2 = messageId.replace('\n', '').replace('\r', '')
|
||||||
searchFilename = \
|
searchFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/' + \
|
acct_dir(base_dir, nickname, domain) + '/' + \
|
||||||
boxname + '/' + \
|
boxname + '/' + \
|
||||||
messageId2.replace('/', '#') + '.json'
|
messageId2.replace('/', '#') + '.json'
|
||||||
if os.path.isfile(searchFilename):
|
if os.path.isfile(searchFilename):
|
||||||
|
@ -4747,7 +4747,7 @@ def isMuted(base_dir: str, nickname: str, domain: str, postId: str,
|
||||||
"""
|
"""
|
||||||
if conversationId:
|
if conversationId:
|
||||||
convMutedFilename = \
|
convMutedFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/conversation/' + \
|
acct_dir(base_dir, nickname, domain) + '/conversation/' + \
|
||||||
conversationId.replace('/', '#') + '.muted'
|
conversationId.replace('/', '#') + '.muted'
|
||||||
if os.path.isfile(convMutedFilename):
|
if os.path.isfile(convMutedFilename):
|
||||||
return True
|
return True
|
||||||
|
@ -5108,7 +5108,7 @@ def postIsMuted(base_dir: str, nickname: str, domain: str,
|
||||||
return isMuted
|
return isMuted
|
||||||
|
|
||||||
isMuted = False
|
isMuted = False
|
||||||
postDir = acctDir(base_dir, nickname, domain)
|
postDir = acct_dir(base_dir, nickname, domain)
|
||||||
muteFilename = \
|
muteFilename = \
|
||||||
postDir + '/inbox/' + messageId.replace('/', '#') + '.json.muted'
|
postDir + '/inbox/' + messageId.replace('/', '#') + '.json.muted'
|
||||||
if os.path.isfile(muteFilename):
|
if os.path.isfile(muteFilename):
|
||||||
|
@ -5206,7 +5206,7 @@ def editedPostFilename(base_dir: str, nickname: str, domain: str,
|
||||||
return ''
|
return ''
|
||||||
actor = post_json_object['object']['attributedTo']
|
actor = post_json_object['object']['attributedTo']
|
||||||
actorFilename = \
|
actorFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/lastpost/' + \
|
acct_dir(base_dir, nickname, domain) + '/lastpost/' + \
|
||||||
actor.replace('/', '#')
|
actor.replace('/', '#')
|
||||||
if not os.path.isfile(actorFilename):
|
if not os.path.isfile(actorFilename):
|
||||||
return ''
|
return ''
|
||||||
|
|
6
roles.py
6
roles.py
|
@ -12,7 +12,7 @@ from utils import loadJson
|
||||||
from utils import saveJson
|
from utils import saveJson
|
||||||
from utils import getStatusNumber
|
from utils import getStatusNumber
|
||||||
from utils import removeDomainPort
|
from utils import removeDomainPort
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
|
|
||||||
|
|
||||||
def _clearRoleStatus(base_dir: str, role: str) -> None:
|
def _clearRoleStatus(base_dir: str, role: str) -> None:
|
||||||
|
@ -99,7 +99,7 @@ def _addRole(base_dir: str, nickname: str, domain: str,
|
||||||
f.write(roleNickname + '\n')
|
f.write(roleNickname + '\n')
|
||||||
else:
|
else:
|
||||||
with open(roleFile, 'w+') as f:
|
with open(roleFile, 'w+') as f:
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
if os.path.isdir(accountDir):
|
if os.path.isdir(accountDir):
|
||||||
f.write(nickname + '\n')
|
f.write(nickname + '\n')
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ def setRole(base_dir: str, nickname: str, domain: str,
|
||||||
# avoid giant strings
|
# avoid giant strings
|
||||||
if len(role) > 128:
|
if len(role) > 128:
|
||||||
return False
|
return False
|
||||||
actorFilename = acctDir(base_dir, nickname, domain) + '.json'
|
actorFilename = acct_dir(base_dir, nickname, domain) + '.json'
|
||||||
if not os.path.isfile(actorFilename):
|
if not os.path.isfile(actorFilename):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ from utils import has_object_dict
|
||||||
from utils import getStatusNumber
|
from utils import getStatusNumber
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import isAccountDir
|
from utils import isAccountDir
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from outbox import postMessageToOutbox
|
from outbox import postMessageToOutbox
|
||||||
|
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ def removeScheduledPosts(base_dir: str, nickname: str, domain: str) -> None:
|
||||||
"""
|
"""
|
||||||
# remove the index
|
# remove the index
|
||||||
scheduleIndexFilename = \
|
scheduleIndexFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/schedule.index'
|
acct_dir(base_dir, nickname, domain) + '/schedule.index'
|
||||||
if os.path.isfile(scheduleIndexFilename):
|
if os.path.isfile(scheduleIndexFilename):
|
||||||
try:
|
try:
|
||||||
os.remove(scheduleIndexFilename)
|
os.remove(scheduleIndexFilename)
|
||||||
|
@ -210,7 +210,7 @@ def removeScheduledPosts(base_dir: str, nickname: str, domain: str) -> None:
|
||||||
print('EX: removeScheduledPosts unable to delete ' +
|
print('EX: removeScheduledPosts unable to delete ' +
|
||||||
scheduleIndexFilename)
|
scheduleIndexFilename)
|
||||||
# remove the scheduled posts
|
# remove the scheduled posts
|
||||||
scheduledDir = acctDir(base_dir, nickname, domain) + '/scheduled'
|
scheduledDir = acct_dir(base_dir, nickname, domain) + '/scheduled'
|
||||||
if not os.path.isdir(scheduledDir):
|
if not os.path.isdir(scheduledDir):
|
||||||
return
|
return
|
||||||
for scheduledPostFilename in os.listdir(scheduledDir):
|
for scheduledPostFilename in os.listdir(scheduledDir):
|
||||||
|
|
14
shares.py
14
shares.py
|
@ -33,7 +33,7 @@ from utils import saveJson
|
||||||
from utils import getImageExtensions
|
from utils import getImageExtensions
|
||||||
from utils import removeDomainPort
|
from utils import removeDomainPort
|
||||||
from utils import isAccountDir
|
from utils import isAccountDir
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import isfloat
|
from utils import isfloat
|
||||||
from utils import getCategoryTypes
|
from utils import getCategoryTypes
|
||||||
from utils import getSharesFilesList
|
from utils import getSharesFilesList
|
||||||
|
@ -125,7 +125,7 @@ def removeSharedItem(base_dir: str, nickname: str, domain: str,
|
||||||
"""Removes a share for a person
|
"""Removes a share for a person
|
||||||
"""
|
"""
|
||||||
sharesFilename = \
|
sharesFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/' + sharesFileType + '.json'
|
acct_dir(base_dir, nickname, domain) + '/' + sharesFileType + '.json'
|
||||||
if not os.path.isfile(sharesFilename):
|
if not os.path.isfile(sharesFilename):
|
||||||
print('ERROR: remove shared item, missing ' +
|
print('ERROR: remove shared item, missing ' +
|
||||||
sharesFileType + '.json ' + sharesFilename)
|
sharesFileType + '.json ' + sharesFilename)
|
||||||
|
@ -317,7 +317,7 @@ def addShare(base_dir: str,
|
||||||
print('Shared item was filtered due to content')
|
print('Shared item was filtered due to content')
|
||||||
return
|
return
|
||||||
sharesFilename = \
|
sharesFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/' + sharesFileType + '.json'
|
acct_dir(base_dir, nickname, domain) + '/' + sharesFileType + '.json'
|
||||||
sharesJson = {}
|
sharesJson = {}
|
||||||
if os.path.isfile(sharesFilename):
|
if os.path.isfile(sharesFilename):
|
||||||
sharesJson = loadJson(sharesFilename, 1, 2)
|
sharesJson = loadJson(sharesFilename, 1, 2)
|
||||||
|
@ -338,7 +338,7 @@ def addShare(base_dir: str,
|
||||||
moveImage = False
|
moveImage = False
|
||||||
if not imageFilename:
|
if not imageFilename:
|
||||||
sharesImageFilename = \
|
sharesImageFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/upload'
|
acct_dir(base_dir, nickname, domain) + '/upload'
|
||||||
formats = getImageExtensions()
|
formats = getImageExtensions()
|
||||||
for ext in formats:
|
for ext in formats:
|
||||||
if os.path.isfile(sharesImageFilename + '.' + ext):
|
if os.path.isfile(sharesImageFilename + '.' + ext):
|
||||||
|
@ -490,7 +490,7 @@ def getSharesFeedForPerson(base_dir: str,
|
||||||
|
|
||||||
handleDomain = removeDomainPort(domain)
|
handleDomain = removeDomainPort(domain)
|
||||||
sharesFilename = \
|
sharesFilename = \
|
||||||
acctDir(base_dir, nickname, handleDomain) + '/' + \
|
acct_dir(base_dir, nickname, handleDomain) + '/' + \
|
||||||
sharesFileType + '.json'
|
sharesFileType + '.json'
|
||||||
|
|
||||||
if headerOnly:
|
if headerOnly:
|
||||||
|
@ -1192,7 +1192,7 @@ def sharesCatalogAccountEndpoint(base_dir: str, http_prefix: str,
|
||||||
currDateStr = currDate.strftime("%Y-%m-%d")
|
currDateStr = currDate.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
sharesFilename = \
|
sharesFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/' + sharesFileType + '.json'
|
acct_dir(base_dir, nickname, domain) + '/' + sharesFileType + '.json'
|
||||||
if not os.path.isfile(sharesFilename):
|
if not os.path.isfile(sharesFilename):
|
||||||
if debug:
|
if debug:
|
||||||
print(sharesFileType + '.json file not found: ' + sharesFilename)
|
print(sharesFileType + '.json file not found: ' + sharesFilename)
|
||||||
|
@ -1286,7 +1286,7 @@ def sharesCatalogEndpoint(base_dir: str, http_prefix: str,
|
||||||
owner = local_actor_url(http_prefix, nickname, domain_full)
|
owner = local_actor_url(http_prefix, nickname, domain_full)
|
||||||
|
|
||||||
sharesFilename = \
|
sharesFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/' + \
|
acct_dir(base_dir, nickname, domain) + '/' + \
|
||||||
sharesFileType + '.json'
|
sharesFileType + '.json'
|
||||||
if not os.path.isfile(sharesFilename):
|
if not os.path.isfile(sharesFilename):
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -19,7 +19,7 @@ from utils import getDomainFromActor
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import getOccupationSkills
|
from utils import getOccupationSkills
|
||||||
from utils import setOccupationSkillsList
|
from utils import setOccupationSkillsList
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from utils import hasActor
|
from utils import hasActor
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ def setSkillLevel(base_dir: str, nickname: str, domain: str,
|
||||||
"""
|
"""
|
||||||
if skillLevelPercent < 0 or skillLevelPercent > 100:
|
if skillLevelPercent < 0 or skillLevelPercent > 100:
|
||||||
return False
|
return False
|
||||||
actorFilename = acctDir(base_dir, nickname, domain) + '.json'
|
actorFilename = acct_dir(base_dir, nickname, domain) + '.json'
|
||||||
if not os.path.isfile(actorFilename):
|
if not os.path.isfile(actorFilename):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ def setSkillLevel(base_dir: str, nickname: str, domain: str,
|
||||||
def getSkills(base_dir: str, nickname: str, domain: str) -> []:
|
def getSkills(base_dir: str, nickname: str, domain: str) -> []:
|
||||||
"""Returns the skills for a given person
|
"""Returns the skills for a given person
|
||||||
"""
|
"""
|
||||||
actorFilename = acctDir(base_dir, nickname, domain) + '.json'
|
actorFilename = acct_dir(base_dir, nickname, domain) + '.json'
|
||||||
if not os.path.isfile(actorFilename):
|
if not os.path.isfile(actorFilename):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ from utils import loadJson
|
||||||
from utils import saveJson
|
from utils import saveJson
|
||||||
from utils import isPGPEncrypted
|
from utils import isPGPEncrypted
|
||||||
from utils import has_object_dict
|
from utils import has_object_dict
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from content import htmlReplaceQuoteMarks
|
from content import htmlReplaceQuoteMarks
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ def getSSMLbox(base_dir: str, path: str,
|
||||||
if '/' in nickname:
|
if '/' in nickname:
|
||||||
nickname = nickname.split('/')[0]
|
nickname = nickname.split('/')[0]
|
||||||
speakerFilename = \
|
speakerFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/speaker.json'
|
acct_dir(base_dir, nickname, domain) + '/speaker.json'
|
||||||
if not os.path.isfile(speakerFilename):
|
if not os.path.isfile(speakerFilename):
|
||||||
return None
|
return None
|
||||||
speakerJson = loadJson(speakerFilename)
|
speakerJson = loadJson(speakerFilename)
|
||||||
|
@ -495,7 +495,7 @@ def _postToSpeakerJson(base_dir: str, http_prefix: str,
|
||||||
|
|
||||||
followRequestsExist = False
|
followRequestsExist = False
|
||||||
followRequestsList = []
|
followRequestsList = []
|
||||||
accountsDir = acctDir(base_dir, nickname, domain_full)
|
accountsDir = acct_dir(base_dir, nickname, domain_full)
|
||||||
approveFollowsFilename = accountsDir + '/followrequests.txt'
|
approveFollowsFilename = accountsDir + '/followrequests.txt'
|
||||||
if os.path.isfile(approveFollowsFilename):
|
if os.path.isfile(approveFollowsFilename):
|
||||||
with open(approveFollowsFilename, 'r') as fp:
|
with open(approveFollowsFilename, 'r') as fp:
|
||||||
|
@ -548,5 +548,5 @@ def updateSpeaker(base_dir: str, http_prefix: str,
|
||||||
post_json_object, person_cache,
|
post_json_object, person_cache,
|
||||||
translate, announcingActor,
|
translate, announcingActor,
|
||||||
theme_name)
|
theme_name)
|
||||||
speakerFilename = acctDir(base_dir, nickname, domain) + '/speaker.json'
|
speakerFilename = acct_dir(base_dir, nickname, domain) + '/speaker.json'
|
||||||
saveJson(speakerJson, speakerFilename)
|
saveJson(speakerJson, speakerFilename)
|
||||||
|
|
6
tests.py
6
tests.py
|
@ -84,7 +84,7 @@ from utils import getStatusNumber
|
||||||
from utils import getFollowersOfPerson
|
from utils import getFollowersOfPerson
|
||||||
from utils import removeHtml
|
from utils import removeHtml
|
||||||
from utils import dangerousMarkup
|
from utils import dangerousMarkup
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from pgp import extractPGPPublicKey
|
from pgp import extractPGPPublicKey
|
||||||
from pgp import pgpPublicKeyUpload
|
from pgp import pgpPublicKeyUpload
|
||||||
from utils import containsPGPPublicKey
|
from utils import containsPGPPublicKey
|
||||||
|
@ -2618,7 +2618,7 @@ def _testFollows(base_dir: str) -> None:
|
||||||
followPerson(base_dir, nickname, domain, 'giraffe', 'trees.com',
|
followPerson(base_dir, nickname, domain, 'giraffe', 'trees.com',
|
||||||
federation_list, False, False)
|
federation_list, False, False)
|
||||||
|
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
f = open(accountDir + '/following.txt', 'r')
|
f = open(accountDir + '/following.txt', 'r')
|
||||||
domainFound = False
|
domainFound = False
|
||||||
for followingDomain in f:
|
for followingDomain in f:
|
||||||
|
@ -2654,7 +2654,7 @@ def _testFollows(base_dir: str) -> None:
|
||||||
followerOfPerson(base_dir, nickname, domain, 'giraffe', 'trees.com',
|
followerOfPerson(base_dir, nickname, domain, 'giraffe', 'trees.com',
|
||||||
federation_list, False, False)
|
federation_list, False, False)
|
||||||
|
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
f = open(accountDir + '/followers.txt', 'r')
|
f = open(accountDir + '/followers.txt', 'r')
|
||||||
for followerDomain in f:
|
for followerDomain in f:
|
||||||
testDomain = followerDomain.split('@')[1]
|
testDomain = followerDomain.split('@')[1]
|
||||||
|
|
4
theme.py
4
theme.py
|
@ -13,7 +13,7 @@ from utils import loadJson
|
||||||
from utils import saveJson
|
from utils import saveJson
|
||||||
from utils import getImageExtensions
|
from utils import getImageExtensions
|
||||||
from utils import copytree
|
from utils import copytree
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import dangerousSVG
|
from utils import dangerousSVG
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
|
@ -799,7 +799,7 @@ def setNewsAvatar(base_dir: str, name: str,
|
||||||
print('EX: setNewsAvatar unable to delete ' + filename)
|
print('EX: setNewsAvatar unable to delete ' + filename)
|
||||||
if os.path.isdir(base_dir + '/cache/avatars'):
|
if os.path.isdir(base_dir + '/cache/avatars'):
|
||||||
copyfile(newFilename, filename)
|
copyfile(newFilename, filename)
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
copyfile(newFilename, accountDir + '/avatar.png')
|
copyfile(newFilename, accountDir + '/avatar.png')
|
||||||
|
|
||||||
|
|
||||||
|
|
35
utils.py
35
utils.py
|
@ -118,7 +118,7 @@ def get_base_content_from_post(post_json_object: {},
|
||||||
return this_post_json['content']
|
return this_post_json['content']
|
||||||
|
|
||||||
|
|
||||||
def acctDir(base_dir: str, nickname: str, domain: str) -> str:
|
def acct_dir(base_dir: str, nickname: str, domain: str) -> str:
|
||||||
return base_dir + '/accounts/' + nickname + '@' + domain
|
return base_dir + '/accounts/' + nickname + '@' + domain
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ def isFeaturedWriter(base_dir: str, nickname: str, domain: str) -> bool:
|
||||||
timeline on news instances?
|
timeline on news instances?
|
||||||
"""
|
"""
|
||||||
featuresBlockedFilename = \
|
featuresBlockedFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/.nofeatures'
|
acct_dir(base_dir, nickname, domain) + '/.nofeatures'
|
||||||
return not os.path.isfile(featuresBlockedFilename)
|
return not os.path.isfile(featuresBlockedFilename)
|
||||||
|
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ def isDormant(base_dir: str, nickname: str, domain: str, actor: str,
|
||||||
"""Is the given followed actor dormant, from the standpoint
|
"""Is the given followed actor dormant, from the standpoint
|
||||||
of the given account
|
of the given account
|
||||||
"""
|
"""
|
||||||
lastSeenFilename = acctDir(base_dir, nickname, domain) + \
|
lastSeenFilename = acct_dir(base_dir, nickname, domain) + \
|
||||||
'/lastseen/' + actor.replace('/', '#') + '.txt'
|
'/lastseen/' + actor.replace('/', '#') + '.txt'
|
||||||
|
|
||||||
if not os.path.isfile(lastSeenFilename):
|
if not os.path.isfile(lastSeenFilename):
|
||||||
|
@ -550,7 +550,7 @@ def getFollowersList(base_dir: str,
|
||||||
followFile='following.txt') -> []:
|
followFile='following.txt') -> []:
|
||||||
"""Returns a list of followers for the given account
|
"""Returns a list of followers for the given account
|
||||||
"""
|
"""
|
||||||
filename = acctDir(base_dir, nickname, domain) + '/' + followFile
|
filename = acct_dir(base_dir, nickname, domain) + '/' + followFile
|
||||||
|
|
||||||
if not os.path.isfile(filename):
|
if not os.path.isfile(filename):
|
||||||
return []
|
return []
|
||||||
|
@ -1105,7 +1105,7 @@ def _setDefaultPetName(base_dir: str, nickname: str, domain: str,
|
||||||
This helps especially when using onion or i2p address
|
This helps especially when using onion or i2p address
|
||||||
"""
|
"""
|
||||||
domain = removeDomainPort(domain)
|
domain = removeDomainPort(domain)
|
||||||
userPath = acctDir(base_dir, nickname, domain)
|
userPath = acct_dir(base_dir, nickname, domain)
|
||||||
petnamesFilename = userPath + '/petnames.txt'
|
petnamesFilename = userPath + '/petnames.txt'
|
||||||
|
|
||||||
petnameLookupEntry = followNickname + ' ' + \
|
petnameLookupEntry = followNickname + ' ' + \
|
||||||
|
@ -1340,7 +1340,7 @@ def locatePost(base_dir: str, nickname: str, domain: str,
|
||||||
|
|
||||||
# search boxes
|
# search boxes
|
||||||
boxes = ('inbox', 'outbox', 'tlblogs')
|
boxes = ('inbox', 'outbox', 'tlblogs')
|
||||||
accountDir = acctDir(base_dir, nickname, domain) + '/'
|
accountDir = acct_dir(base_dir, nickname, domain) + '/'
|
||||||
for boxName in boxes:
|
for boxName in boxes:
|
||||||
postFilename = accountDir + boxName + '/' + postUrl
|
postFilename = accountDir + boxName + '/' + postUrl
|
||||||
if os.path.isfile(postFilename):
|
if os.path.isfile(postFilename):
|
||||||
|
@ -1384,7 +1384,7 @@ def getReplyIntervalHours(base_dir: str, nickname: str, domain: str,
|
||||||
during which replies are allowed
|
during which replies are allowed
|
||||||
"""
|
"""
|
||||||
replyIntervalFilename = \
|
replyIntervalFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/.replyIntervalHours'
|
acct_dir(base_dir, nickname, domain) + '/.replyIntervalHours'
|
||||||
if os.path.isfile(replyIntervalFilename):
|
if os.path.isfile(replyIntervalFilename):
|
||||||
with open(replyIntervalFilename, 'r') as fp:
|
with open(replyIntervalFilename, 'r') as fp:
|
||||||
hoursStr = fp.read()
|
hoursStr = fp.read()
|
||||||
|
@ -1400,7 +1400,7 @@ def setReplyIntervalHours(base_dir: str, nickname: str, domain: str,
|
||||||
during which replies are allowed
|
during which replies are allowed
|
||||||
"""
|
"""
|
||||||
replyIntervalFilename = \
|
replyIntervalFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/.replyIntervalHours'
|
acct_dir(base_dir, nickname, domain) + '/.replyIntervalHours'
|
||||||
with open(replyIntervalFilename, 'w+') as fp:
|
with open(replyIntervalFilename, 'w+') as fp:
|
||||||
try:
|
try:
|
||||||
fp.write(str(replyIntervalHours))
|
fp.write(str(replyIntervalHours))
|
||||||
|
@ -1513,7 +1513,8 @@ def _isReplyToBlogPost(base_dir: str, nickname: str, domain: str,
|
||||||
return False
|
return False
|
||||||
if not isinstance(post_json_object['object']['inReplyTo'], str):
|
if not isinstance(post_json_object['object']['inReplyTo'], str):
|
||||||
return False
|
return False
|
||||||
blogsIndexFilename = acctDir(base_dir, nickname, domain) + '/tlblogs.index'
|
blogsIndexFilename = \
|
||||||
|
acct_dir(base_dir, nickname, domain) + '/tlblogs.index'
|
||||||
if not os.path.isfile(blogsIndexFilename):
|
if not os.path.isfile(blogsIndexFilename):
|
||||||
return False
|
return False
|
||||||
postId = removeIdEnding(post_json_object['object']['inReplyTo'])
|
postId = removeIdEnding(post_json_object['object']['inReplyTo'])
|
||||||
|
@ -1555,7 +1556,7 @@ def _isBookmarked(base_dir: str, nickname: str, domain: str,
|
||||||
"""Returns True if the given post is bookmarked
|
"""Returns True if the given post is bookmarked
|
||||||
"""
|
"""
|
||||||
bookmarksIndexFilename = \
|
bookmarksIndexFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/bookmarks.index'
|
acct_dir(base_dir, nickname, domain) + '/bookmarks.index'
|
||||||
if os.path.isfile(bookmarksIndexFilename):
|
if os.path.isfile(bookmarksIndexFilename):
|
||||||
bookmarkIndex = postFilename.split('/')[-1] + '\n'
|
bookmarkIndex = postFilename.split('/')[-1] + '\n'
|
||||||
if bookmarkIndex in open(bookmarksIndexFilename).read():
|
if bookmarkIndex in open(bookmarksIndexFilename).read():
|
||||||
|
@ -1675,7 +1676,7 @@ def _deleteConversationPost(base_dir: str, nickname: str, domain: str,
|
||||||
return False
|
return False
|
||||||
if not post_json_object['object'].get('id'):
|
if not post_json_object['object'].get('id'):
|
||||||
return False
|
return False
|
||||||
conversationDir = acctDir(base_dir, nickname, domain) + '/conversation'
|
conversationDir = acct_dir(base_dir, nickname, domain) + '/conversation'
|
||||||
conversationId = post_json_object['object']['conversation']
|
conversationId = post_json_object['object']['conversation']
|
||||||
conversationId = conversationId.replace('/', '#')
|
conversationId = conversationId.replace('/', '#')
|
||||||
postId = post_json_object['object']['id']
|
postId = post_json_object['object']['id']
|
||||||
|
@ -1983,7 +1984,7 @@ def copytree(src: str, dst: str, symlinks: str = False, ignore: bool = None):
|
||||||
def getCachedPostDirectory(base_dir: str, nickname: str, domain: str) -> str:
|
def getCachedPostDirectory(base_dir: str, nickname: str, domain: str) -> str:
|
||||||
"""Returns the directory where the html post cache exists
|
"""Returns the directory where the html post cache exists
|
||||||
"""
|
"""
|
||||||
htmlPostCacheDir = acctDir(base_dir, nickname, domain) + '/postcache'
|
htmlPostCacheDir = acct_dir(base_dir, nickname, domain) + '/postcache'
|
||||||
return htmlPostCacheDir
|
return htmlPostCacheDir
|
||||||
|
|
||||||
|
|
||||||
|
@ -2101,10 +2102,10 @@ def _searchVirtualBoxPosts(base_dir: str, nickname: str, domain: str,
|
||||||
"""Searches through a virtual box, which is typically an index on the inbox
|
"""Searches through a virtual box, which is typically an index on the inbox
|
||||||
"""
|
"""
|
||||||
indexFilename = \
|
indexFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/' + boxName + '.index'
|
acct_dir(base_dir, nickname, domain) + '/' + boxName + '.index'
|
||||||
if boxName == 'bookmarks':
|
if boxName == 'bookmarks':
|
||||||
boxName = 'inbox'
|
boxName = 'inbox'
|
||||||
path = acctDir(base_dir, nickname, domain) + '/' + boxName
|
path = acct_dir(base_dir, nickname, domain) + '/' + boxName
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
@ -2153,7 +2154,7 @@ def searchBoxPosts(base_dir: str, nickname: str, domain: str,
|
||||||
"""Search your posts and return a list of the filenames
|
"""Search your posts and return a list of the filenames
|
||||||
containing matching strings
|
containing matching strings
|
||||||
"""
|
"""
|
||||||
path = acctDir(base_dir, nickname, domain) + '/' + boxName
|
path = acct_dir(base_dir, nickname, domain) + '/' + boxName
|
||||||
# is this a virtual box, such as direct messages?
|
# is this a virtual box, such as direct messages?
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
if os.path.isfile(path + '.index'):
|
if os.path.isfile(path + '.index'):
|
||||||
|
@ -2707,7 +2708,7 @@ def dmAllowedFromDomain(base_dir: str,
|
||||||
a few particular instances that you trust
|
a few particular instances that you trust
|
||||||
"""
|
"""
|
||||||
dmAllowedInstancesFilename = \
|
dmAllowedInstancesFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/dmAllowedInstances.txt'
|
acct_dir(base_dir, nickname, domain) + '/dmAllowedInstances.txt'
|
||||||
if not os.path.isfile(dmAllowedInstancesFilename):
|
if not os.path.isfile(dmAllowedInstancesFilename):
|
||||||
return False
|
return False
|
||||||
if sendingActorDomain + '\n' in open(dmAllowedInstancesFilename).read():
|
if sendingActorDomain + '\n' in open(dmAllowedInstancesFilename).read():
|
||||||
|
@ -3031,7 +3032,7 @@ def isGroupActor(base_dir: str, actor: str, person_cache: {},
|
||||||
def isGroupAccount(base_dir: str, nickname: str, domain: str) -> bool:
|
def isGroupAccount(base_dir: str, nickname: str, domain: str) -> bool:
|
||||||
"""Returns true if the given account is a group
|
"""Returns true if the given account is a group
|
||||||
"""
|
"""
|
||||||
accountFilename = acctDir(base_dir, nickname, domain) + '.json'
|
accountFilename = acct_dir(base_dir, nickname, domain) + '.json'
|
||||||
if not os.path.isfile(accountFilename):
|
if not os.path.isfile(accountFilename):
|
||||||
return False
|
return False
|
||||||
if '"type": "Group"' in open(accountFilename).read():
|
if '"type": "Group"' in open(accountFilename).read():
|
||||||
|
|
|
@ -11,7 +11,7 @@ import os
|
||||||
from utils import isAccountDir
|
from utils import isAccountDir
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from webapp_utils import htmlHeaderWithExternalStyle
|
from webapp_utils import htmlHeaderWithExternalStyle
|
||||||
from webapp_utils import htmlFooter
|
from webapp_utils import htmlFooter
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ def htmlAccessKeys(cssCache: {}, base_dir: str,
|
||||||
"""Show and edit key shortcuts
|
"""Show and edit key shortcuts
|
||||||
"""
|
"""
|
||||||
accessKeysFilename = \
|
accessKeysFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/accessKeys.json'
|
acct_dir(base_dir, nickname, domain) + '/accessKeys.json'
|
||||||
if os.path.isfile(accessKeysFilename):
|
if os.path.isfile(accessKeysFilename):
|
||||||
accessKeysFromFile = loadJson(accessKeysFilename)
|
accessKeysFromFile = loadJson(accessKeysFilename)
|
||||||
if accessKeysFromFile:
|
if accessKeysFromFile:
|
||||||
|
|
|
@ -19,7 +19,7 @@ from utils import loadJson
|
||||||
from utils import weekDayOfMonthStart
|
from utils import weekDayOfMonthStart
|
||||||
from utils import getAltPath
|
from utils import getAltPath
|
||||||
from utils import removeDomainPort
|
from utils import removeDomainPort
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from utils import replaceUsersWithAt
|
from utils import replaceUsersWithAt
|
||||||
from happening import getTodaysEvents
|
from happening import getTodaysEvents
|
||||||
|
@ -103,7 +103,7 @@ def _htmlCalendarDay(person_cache: {}, cssCache: {}, translate: {},
|
||||||
monthName: str, actor: str) -> str:
|
monthName: str, actor: str) -> str:
|
||||||
"""Show a day within the calendar
|
"""Show a day within the calendar
|
||||||
"""
|
"""
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
calendarFile = accountDir + '/.newCalendar'
|
calendarFile = accountDir + '/.newCalendar'
|
||||||
if os.path.isfile(calendarFile):
|
if os.path.isfile(calendarFile):
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -21,7 +21,7 @@ from utils import getNicknameFromActor
|
||||||
from utils import isEditor
|
from utils import isEditor
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
from utils import removeDomainPort
|
from utils import removeDomainPort
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from posts import isModerator
|
from posts import isModerator
|
||||||
from newswire import getNewswireFaviconUrl
|
from newswire import getNewswireFaviconUrl
|
||||||
from webapp_utils import getRightImageFile
|
from webapp_utils import getRightImageFile
|
||||||
|
@ -343,7 +343,7 @@ def htmlCitations(base_dir: str, nickname: str, domain: str,
|
||||||
# create a list of dates for citations
|
# create a list of dates for citations
|
||||||
# these can then be used to re-select checkboxes later
|
# these can then be used to re-select checkboxes later
|
||||||
citationsFilename = \
|
citationsFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/.citations.txt'
|
acct_dir(base_dir, nickname, domain) + '/.citations.txt'
|
||||||
citationsSelected = []
|
citationsSelected = []
|
||||||
if os.path.isfile(citationsFilename):
|
if os.path.isfile(citationsFilename):
|
||||||
citationsSeparator = '#####'
|
citationsSeparator = '#####'
|
||||||
|
|
|
@ -16,7 +16,7 @@ from utils import locatePost
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
from utils import getAltPath
|
from utils import getAltPath
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from webapp_utils import setCustomBackground
|
from webapp_utils import setCustomBackground
|
||||||
from webapp_utils import htmlHeaderWithExternalStyle
|
from webapp_utils import htmlHeaderWithExternalStyle
|
||||||
from webapp_utils import htmlFooter
|
from webapp_utils import htmlFooter
|
||||||
|
@ -116,7 +116,7 @@ def htmlConfirmRemoveSharedItem(cssCache: {}, translate: {}, base_dir: str,
|
||||||
domain, port = getDomainFromActor(actor)
|
domain, port = getDomainFromActor(actor)
|
||||||
domain_full = getFullDomain(domain, port)
|
domain_full = getFullDomain(domain, port)
|
||||||
sharesFile = \
|
sharesFile = \
|
||||||
acctDir(base_dir, nickname, domain) + '/' + sharesFileType + '.json'
|
acct_dir(base_dir, nickname, domain) + '/' + sharesFileType + '.json'
|
||||||
if not os.path.isfile(sharesFile):
|
if not os.path.isfile(sharesFile):
|
||||||
print('ERROR: no ' + sharesFileType + ' file ' + sharesFile)
|
print('ERROR: no ' + sharesFileType + ' file ' + sharesFile)
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -14,7 +14,7 @@ from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import getDomainFromActor
|
||||||
from utils import getMediaFormats
|
from utils import getMediaFormats
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import getCurrencies
|
from utils import getCurrencies
|
||||||
from utils import getCategoryTypes
|
from utils import getCategoryTypes
|
||||||
from webapp_utils import getBannerFile
|
from webapp_utils import getBannerFile
|
||||||
|
@ -32,7 +32,7 @@ def _htmlFollowingDataList(base_dir: str, nickname: str,
|
||||||
"""
|
"""
|
||||||
listStr = '<datalist id="followingHandles">\n'
|
listStr = '<datalist id="followingHandles">\n'
|
||||||
followingFilename = \
|
followingFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/following.txt'
|
acct_dir(base_dir, nickname, domain) + '/following.txt'
|
||||||
msg = None
|
msg = None
|
||||||
if os.path.isfile(followingFilename):
|
if os.path.isfile(followingFilename):
|
||||||
with open(followingFilename, 'r') as followingFile:
|
with open(followingFilename, 'r') as followingFile:
|
||||||
|
@ -43,7 +43,7 @@ def _htmlFollowingDataList(base_dir: str, nickname: str,
|
||||||
if msg:
|
if msg:
|
||||||
# include petnames
|
# include petnames
|
||||||
petnamesFilename = \
|
petnamesFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/petnames.txt'
|
acct_dir(base_dir, nickname, domain) + '/petnames.txt'
|
||||||
if os.path.isfile(petnamesFilename):
|
if os.path.isfile(petnamesFilename):
|
||||||
followingList = []
|
followingList = []
|
||||||
with open(petnamesFilename, 'r') as petnamesFile:
|
with open(petnamesFilename, 'r') as petnamesFile:
|
||||||
|
@ -572,7 +572,7 @@ def htmlNewPost(cssCache: {}, media_instance: bool, translate: {},
|
||||||
citationsStr = ''
|
citationsStr = ''
|
||||||
if endpoint == 'newblog':
|
if endpoint == 'newblog':
|
||||||
citationsFilename = \
|
citationsFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/.citations.txt'
|
acct_dir(base_dir, nickname, domain) + '/.citations.txt'
|
||||||
if os.path.isfile(citationsFilename):
|
if os.path.isfile(citationsFilename):
|
||||||
citationsStr = '<div class="container">\n'
|
citationsStr = '<div class="container">\n'
|
||||||
citationsStr += '<p><label class="labels">' + \
|
citationsStr += '<p><label class="labels">' + \
|
||||||
|
|
|
@ -10,7 +10,7 @@ __module_group__ = "Timeline"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
from happening import dayEventsCheck
|
from happening import dayEventsCheck
|
||||||
|
@ -93,7 +93,7 @@ def headerButtonsTimeline(defaultTimeline: str,
|
||||||
'</span></button></a>'
|
'</span></button></a>'
|
||||||
|
|
||||||
repliesIndexFilename = \
|
repliesIndexFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/tlreplies.index'
|
acct_dir(base_dir, nickname, domain) + '/tlreplies.index'
|
||||||
if os.path.isfile(repliesIndexFilename):
|
if os.path.isfile(repliesIndexFilename):
|
||||||
tlStr += \
|
tlStr += \
|
||||||
'<a href="' + usersPath + '/tlreplies" tabindex="-1">' + \
|
'<a href="' + usersPath + '/tlreplies" tabindex="-1">' + \
|
||||||
|
|
|
@ -8,14 +8,14 @@ __status__ = "Production"
|
||||||
__module_group__ = "Timeline"
|
__module_group__ = "Timeline"
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
|
|
||||||
|
|
||||||
def isMinimal(base_dir: str, domain: str, nickname: str) -> bool:
|
def isMinimal(base_dir: str, domain: str, nickname: str) -> bool:
|
||||||
"""Returns true if minimal buttons should be shown
|
"""Returns true if minimal buttons should be shown
|
||||||
for the given account
|
for the given account
|
||||||
"""
|
"""
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
if not os.path.isdir(accountDir):
|
if not os.path.isdir(accountDir):
|
||||||
return True
|
return True
|
||||||
minimalFilename = accountDir + '/.notminimal'
|
minimalFilename = accountDir + '/.notminimal'
|
||||||
|
@ -28,7 +28,7 @@ def setMinimal(base_dir: str, domain: str, nickname: str,
|
||||||
minimal: bool) -> None:
|
minimal: bool) -> None:
|
||||||
"""Sets whether an account should display minimal buttons
|
"""Sets whether an account should display minimal buttons
|
||||||
"""
|
"""
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
if not os.path.isdir(accountDir):
|
if not os.path.isdir(accountDir):
|
||||||
return
|
return
|
||||||
minimalFilename = accountDir + '/.notminimal'
|
minimalFilename = accountDir + '/.notminimal'
|
||||||
|
|
|
@ -19,7 +19,7 @@ from utils import removeHtml
|
||||||
from utils import getDomainFromActor
|
from utils import getDomainFromActor
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import isFeaturedWriter
|
from utils import isFeaturedWriter
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from blocking import isBlocked
|
from blocking import isBlocked
|
||||||
from follow import isFollowerOfPerson
|
from follow import isFollowerOfPerson
|
||||||
from follow import isFollowingActor
|
from follow import isFollowingActor
|
||||||
|
@ -406,7 +406,7 @@ def htmlPersonOptions(defaultTimeline: str,
|
||||||
personNotes = ''
|
personNotes = ''
|
||||||
if originPathStr == '/users/' + nickname:
|
if originPathStr == '/users/' + nickname:
|
||||||
personNotesFilename = \
|
personNotesFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + \
|
acct_dir(base_dir, nickname, domain) + \
|
||||||
'/notes/' + handle + '.txt'
|
'/notes/' + handle + '.txt'
|
||||||
if os.path.isfile(personNotesFilename):
|
if os.path.isfile(personNotesFilename):
|
||||||
with open(personNotesFilename, 'r') as fp:
|
with open(personNotesFilename, 'r') as fp:
|
||||||
|
|
|
@ -50,7 +50,7 @@ from utils import updateRecentPostsCache
|
||||||
from utils import removeIdEnding
|
from utils import removeIdEnding
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import getDomainFromActor
|
from utils import getDomainFromActor
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from content import limitRepeatedWords
|
from content import limitRepeatedWords
|
||||||
from content import replaceEmojiFromTags
|
from content import replaceEmojiFromTags
|
||||||
|
@ -1668,14 +1668,14 @@ def individualPostAsHtml(signing_priv_key_pem: str,
|
||||||
|
|
||||||
# whether to show a like button
|
# whether to show a like button
|
||||||
hideLikeButtonFile = \
|
hideLikeButtonFile = \
|
||||||
acctDir(base_dir, nickname, domain) + '/.hideLikeButton'
|
acct_dir(base_dir, nickname, domain) + '/.hideLikeButton'
|
||||||
showLikeButton = True
|
showLikeButton = True
|
||||||
if os.path.isfile(hideLikeButtonFile):
|
if os.path.isfile(hideLikeButtonFile):
|
||||||
showLikeButton = False
|
showLikeButton = False
|
||||||
|
|
||||||
# whether to show a reaction button
|
# whether to show a reaction button
|
||||||
hideReactionButtonFile = \
|
hideReactionButtonFile = \
|
||||||
acctDir(base_dir, nickname, domain) + '/.hideReactionButton'
|
acct_dir(base_dir, nickname, domain) + '/.hideReactionButton'
|
||||||
showReactionButton = True
|
showReactionButton = True
|
||||||
if os.path.isfile(hideReactionButtonFile):
|
if os.path.isfile(hideReactionButtonFile):
|
||||||
showReactionButton = False
|
showReactionButton = False
|
||||||
|
|
|
@ -25,7 +25,7 @@ from utils import removeHtml
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
from utils import getImageFormats
|
from utils import getImageFormats
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import getSupportedLanguages
|
from utils import getSupportedLanguages
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from utils import getReplyIntervalHours
|
from utils import getReplyIntervalHours
|
||||||
|
@ -731,7 +731,7 @@ def htmlProfile(signing_priv_key_pem: str,
|
||||||
|
|
||||||
# are there any follow requests?
|
# are there any follow requests?
|
||||||
followRequestsFilename = \
|
followRequestsFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/followrequests.txt'
|
acct_dir(base_dir, nickname, domain) + '/followrequests.txt'
|
||||||
if os.path.isfile(followRequestsFilename):
|
if os.path.isfile(followRequestsFilename):
|
||||||
with open(followRequestsFilename, 'r') as f:
|
with open(followRequestsFilename, 'r') as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
|
@ -835,7 +835,7 @@ def htmlProfile(signing_priv_key_pem: str,
|
||||||
'://' + domain_full + '/users/')
|
'://' + domain_full + '/users/')
|
||||||
|
|
||||||
# get pinned post content
|
# get pinned post content
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
pinnedFilename = accountDir + '/pinToProfile.txt'
|
pinnedFilename = accountDir + '/pinToProfile.txt'
|
||||||
pinnedContent = None
|
pinnedContent = None
|
||||||
if os.path.isfile(pinnedFilename):
|
if os.path.isfile(pinnedFilename):
|
||||||
|
@ -1561,7 +1561,7 @@ def _htmlEditProfileGitProjects(base_dir: str, nickname: str, domain: str,
|
||||||
"""
|
"""
|
||||||
gitProjectsStr = ''
|
gitProjectsStr = ''
|
||||||
gitProjectsFilename = \
|
gitProjectsFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/gitprojects.txt'
|
acct_dir(base_dir, nickname, domain) + '/gitprojects.txt'
|
||||||
if os.path.isfile(gitProjectsFilename):
|
if os.path.isfile(gitProjectsFilename):
|
||||||
with open(gitProjectsFilename, 'r') as gitProjectsFile:
|
with open(gitProjectsFilename, 'r') as gitProjectsFile:
|
||||||
gitProjectsStr = gitProjectsFile.read()
|
gitProjectsStr = gitProjectsFile.read()
|
||||||
|
@ -1605,56 +1605,56 @@ def _htmlEditProfileFiltering(base_dir: str, nickname: str, domain: str,
|
||||||
"""
|
"""
|
||||||
filterStr = ''
|
filterStr = ''
|
||||||
filterFilename = \
|
filterFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/filters.txt'
|
acct_dir(base_dir, nickname, domain) + '/filters.txt'
|
||||||
if os.path.isfile(filterFilename):
|
if os.path.isfile(filterFilename):
|
||||||
with open(filterFilename, 'r') as filterfile:
|
with open(filterFilename, 'r') as filterfile:
|
||||||
filterStr = filterfile.read()
|
filterStr = filterfile.read()
|
||||||
|
|
||||||
filterBioStr = ''
|
filterBioStr = ''
|
||||||
filterBioFilename = \
|
filterBioFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/filters_bio.txt'
|
acct_dir(base_dir, nickname, domain) + '/filters_bio.txt'
|
||||||
if os.path.isfile(filterBioFilename):
|
if os.path.isfile(filterBioFilename):
|
||||||
with open(filterBioFilename, 'r') as filterfile:
|
with open(filterBioFilename, 'r') as filterfile:
|
||||||
filterBioStr = filterfile.read()
|
filterBioStr = filterfile.read()
|
||||||
|
|
||||||
switchStr = ''
|
switchStr = ''
|
||||||
switchFilename = \
|
switchFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/replacewords.txt'
|
acct_dir(base_dir, nickname, domain) + '/replacewords.txt'
|
||||||
if os.path.isfile(switchFilename):
|
if os.path.isfile(switchFilename):
|
||||||
with open(switchFilename, 'r') as switchfile:
|
with open(switchFilename, 'r') as switchfile:
|
||||||
switchStr = switchfile.read()
|
switchStr = switchfile.read()
|
||||||
|
|
||||||
autoTags = ''
|
autoTags = ''
|
||||||
autoTagsFilename = \
|
autoTagsFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/autotags.txt'
|
acct_dir(base_dir, nickname, domain) + '/autotags.txt'
|
||||||
if os.path.isfile(autoTagsFilename):
|
if os.path.isfile(autoTagsFilename):
|
||||||
with open(autoTagsFilename, 'r') as autoTagsFile:
|
with open(autoTagsFilename, 'r') as autoTagsFile:
|
||||||
autoTags = autoTagsFile.read()
|
autoTags = autoTagsFile.read()
|
||||||
|
|
||||||
autoCW = ''
|
autoCW = ''
|
||||||
autoCWFilename = \
|
autoCWFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/autocw.txt'
|
acct_dir(base_dir, nickname, domain) + '/autocw.txt'
|
||||||
if os.path.isfile(autoCWFilename):
|
if os.path.isfile(autoCWFilename):
|
||||||
with open(autoCWFilename, 'r') as autoCWFile:
|
with open(autoCWFilename, 'r') as autoCWFile:
|
||||||
autoCW = autoCWFile.read()
|
autoCW = autoCWFile.read()
|
||||||
|
|
||||||
blockedStr = ''
|
blockedStr = ''
|
||||||
blockedFilename = \
|
blockedFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/blocking.txt'
|
acct_dir(base_dir, nickname, domain) + '/blocking.txt'
|
||||||
if os.path.isfile(blockedFilename):
|
if os.path.isfile(blockedFilename):
|
||||||
with open(blockedFilename, 'r') as blockedfile:
|
with open(blockedFilename, 'r') as blockedfile:
|
||||||
blockedStr = blockedfile.read()
|
blockedStr = blockedfile.read()
|
||||||
|
|
||||||
dmAllowedInstancesStr = ''
|
dmAllowedInstancesStr = ''
|
||||||
dmAllowedInstancesFilename = \
|
dmAllowedInstancesFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/dmAllowedInstances.txt'
|
acct_dir(base_dir, nickname, domain) + '/dmAllowedInstances.txt'
|
||||||
if os.path.isfile(dmAllowedInstancesFilename):
|
if os.path.isfile(dmAllowedInstancesFilename):
|
||||||
with open(dmAllowedInstancesFilename, 'r') as dmAllowedInstancesFile:
|
with open(dmAllowedInstancesFilename, 'r') as dmAllowedInstancesFile:
|
||||||
dmAllowedInstancesStr = dmAllowedInstancesFile.read()
|
dmAllowedInstancesStr = dmAllowedInstancesFile.read()
|
||||||
|
|
||||||
allowedInstancesStr = ''
|
allowedInstancesStr = ''
|
||||||
allowedInstancesFilename = \
|
allowedInstancesFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/allowedinstances.txt'
|
acct_dir(base_dir, nickname, domain) + '/allowedinstances.txt'
|
||||||
if os.path.isfile(allowedInstancesFilename):
|
if os.path.isfile(allowedInstancesFilename):
|
||||||
with open(allowedInstancesFilename, 'r') as allowedInstancesFile:
|
with open(allowedInstancesFilename, 'r') as allowedInstancesFile:
|
||||||
allowedInstancesStr = allowedInstancesFile.read()
|
allowedInstancesStr = allowedInstancesFile.read()
|
||||||
|
@ -1675,7 +1675,7 @@ def _htmlEditProfileFiltering(base_dir: str, nickname: str, domain: str,
|
||||||
'</label><br>\n'
|
'</label><br>\n'
|
||||||
|
|
||||||
city = ''
|
city = ''
|
||||||
cityFilename = acctDir(base_dir, nickname, domain) + '/city.txt'
|
cityFilename = acct_dir(base_dir, nickname, domain) + '/city.txt'
|
||||||
if os.path.isfile(cityFilename):
|
if os.path.isfile(cityFilename):
|
||||||
with open(cityFilename, 'r') as fp:
|
with open(cityFilename, 'r') as fp:
|
||||||
city = fp.read().replace('\n', '')
|
city = fp.read().replace('\n', '')
|
||||||
|
@ -2107,7 +2107,7 @@ def htmlEditProfile(cssCache: {}, translate: {}, base_dir: str, path: str,
|
||||||
return ''
|
return ''
|
||||||
domain_full = getFullDomain(domain, port)
|
domain_full = getFullDomain(domain, port)
|
||||||
|
|
||||||
actorFilename = acctDir(base_dir, nickname, domain) + '.json'
|
actorFilename = acct_dir(base_dir, nickname, domain) + '.json'
|
||||||
if not os.path.isfile(actorFilename):
|
if not os.path.isfile(actorFilename):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
@ -2164,7 +2164,7 @@ def htmlEditProfile(cssCache: {}, translate: {}, base_dir: str, path: str,
|
||||||
elif actor_json['type'] == 'Group':
|
elif actor_json['type'] == 'Group':
|
||||||
isGroup = 'checked'
|
isGroup = 'checked'
|
||||||
isBot = ''
|
isBot = ''
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
if os.path.isfile(accountDir + '/.followDMs'):
|
if os.path.isfile(accountDir + '/.followDMs'):
|
||||||
followDMs = 'checked'
|
followDMs = 'checked'
|
||||||
if os.path.isfile(accountDir + '/.removeTwitter'):
|
if os.path.isfile(accountDir + '/.removeTwitter'):
|
||||||
|
|
|
@ -10,7 +10,7 @@ __module_group__ = "Web Interface"
|
||||||
import os
|
import os
|
||||||
from question import isQuestion
|
from question import isQuestion
|
||||||
from utils import removeIdEnding
|
from utils import removeIdEnding
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
|
|
||||||
|
|
||||||
def insertQuestion(base_dir: str, translate: {},
|
def insertQuestion(base_dir: str, translate: {},
|
||||||
|
@ -31,7 +31,7 @@ def insertQuestion(base_dir: str, translate: {},
|
||||||
pageNumberStr = '?page=' + str(pageNumber)
|
pageNumberStr = '?page=' + str(pageNumber)
|
||||||
|
|
||||||
votesFilename = \
|
votesFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/questions.txt'
|
acct_dir(base_dir, nickname, domain) + '/questions.txt'
|
||||||
|
|
||||||
showQuestionResults = False
|
showQuestionResults = False
|
||||||
if os.path.isfile(votesFilename):
|
if os.path.isfile(votesFilename):
|
||||||
|
|
|
@ -24,7 +24,7 @@ from utils import isPublicPost
|
||||||
from utils import firstParagraphFromString
|
from utils import firstParagraphFromString
|
||||||
from utils import searchBoxPosts
|
from utils import searchBoxPosts
|
||||||
from utils import getAltPath
|
from utils import getAltPath
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from skills import noOfActorSkills
|
from skills import noOfActorSkills
|
||||||
from skills import getSkillsFromList
|
from skills import getSkillsFromList
|
||||||
|
@ -427,7 +427,7 @@ def htmlSearch(cssCache: {}, translate: {},
|
||||||
followStr += ' </form>\n'
|
followStr += ' </form>\n'
|
||||||
|
|
||||||
cachedHashtagSwarmFilename = \
|
cachedHashtagSwarmFilename = \
|
||||||
acctDir(base_dir, searchNickname, domain) + '/.hashtagSwarm'
|
acct_dir(base_dir, searchNickname, domain) + '/.hashtagSwarm'
|
||||||
swarmStr = ''
|
swarmStr = ''
|
||||||
if os.path.isfile(cachedHashtagSwarmFilename):
|
if os.path.isfile(cachedHashtagSwarmFilename):
|
||||||
try:
|
try:
|
||||||
|
@ -738,7 +738,7 @@ def htmlHashtagSearch(cssCache: {},
|
||||||
|
|
||||||
# check that the directory for the nickname exists
|
# check that the directory for the nickname exists
|
||||||
if nickname:
|
if nickname:
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
if not os.path.isdir(accountDir):
|
if not os.path.isdir(accountDir):
|
||||||
nickname = None
|
nickname = None
|
||||||
|
|
||||||
|
@ -922,7 +922,7 @@ def rssHashtagSearch(nickname: str, domain: str, port: int,
|
||||||
|
|
||||||
# check that the directory for the nickname exists
|
# check that the directory for the nickname exists
|
||||||
if nickname:
|
if nickname:
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
if not os.path.isdir(accountDir):
|
if not os.path.isdir(accountDir):
|
||||||
nickname = None
|
nickname = None
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ from utils import getConfigParam
|
||||||
from utils import getFullDomain
|
from utils import getFullDomain
|
||||||
from utils import isEditor
|
from utils import isEditor
|
||||||
from utils import removeIdEnding
|
from utils import removeIdEnding
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import isfloat
|
from utils import isfloat
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from follow import followerApprovalActive
|
from follow import followerApprovalActive
|
||||||
|
@ -457,7 +457,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
|
||||||
|
|
||||||
timelineStartTime = time.time()
|
timelineStartTime = time.time()
|
||||||
|
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
|
|
||||||
# should the calendar icon be highlighted?
|
# should the calendar icon be highlighted?
|
||||||
newCalendarEvent = False
|
newCalendarEvent = False
|
||||||
|
@ -621,7 +621,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
|
||||||
# show an icon for new follow approvals
|
# show an icon for new follow approvals
|
||||||
followApprovals = ''
|
followApprovals = ''
|
||||||
followRequestsFilename = \
|
followRequestsFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/followrequests.txt'
|
acct_dir(base_dir, nickname, domain) + '/followrequests.txt'
|
||||||
if os.path.isfile(followRequestsFilename):
|
if os.path.isfile(followRequestsFilename):
|
||||||
with open(followRequestsFilename, 'r') as f:
|
with open(followRequestsFilename, 'r') as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
|
|
|
@ -17,7 +17,7 @@ from utils import getProtocolPrefixes
|
||||||
from utils import loadJson
|
from utils import loadJson
|
||||||
from utils import getCachedPostFilename
|
from utils import getCachedPostFilename
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import getNicknameFromActor
|
from utils import getNicknameFromActor
|
||||||
from utils import isfloat
|
from utils import isfloat
|
||||||
from utils import getAudioExtensions
|
from utils import getAudioExtensions
|
||||||
|
@ -336,7 +336,7 @@ def scheduledPostsExist(base_dir: str, nickname: str, domain: str) -> bool:
|
||||||
"""Returns true if there are posts scheduled to be delivered
|
"""Returns true if there are posts scheduled to be delivered
|
||||||
"""
|
"""
|
||||||
scheduleIndexFilename = \
|
scheduleIndexFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/schedule.index'
|
acct_dir(base_dir, nickname, domain) + '/schedule.index'
|
||||||
if not os.path.isfile(scheduleIndexFilename):
|
if not os.path.isfile(scheduleIndexFilename):
|
||||||
return False
|
return False
|
||||||
if '#users#' in open(scheduleIndexFilename).read():
|
if '#users#' in open(scheduleIndexFilename).read():
|
||||||
|
@ -496,28 +496,28 @@ def _getImageFile(base_dir: str, name: str, directory: str,
|
||||||
|
|
||||||
def getBannerFile(base_dir: str,
|
def getBannerFile(base_dir: str,
|
||||||
nickname: str, domain: str, theme: str) -> (str, str):
|
nickname: str, domain: str, theme: str) -> (str, str):
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
return _getImageFile(base_dir, 'banner', accountDir,
|
return _getImageFile(base_dir, 'banner', accountDir,
|
||||||
nickname, domain, theme)
|
nickname, domain, theme)
|
||||||
|
|
||||||
|
|
||||||
def getSearchBannerFile(base_dir: str,
|
def getSearchBannerFile(base_dir: str,
|
||||||
nickname: str, domain: str, theme: str) -> (str, str):
|
nickname: str, domain: str, theme: str) -> (str, str):
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
return _getImageFile(base_dir, 'search_banner', accountDir,
|
return _getImageFile(base_dir, 'search_banner', accountDir,
|
||||||
nickname, domain, theme)
|
nickname, domain, theme)
|
||||||
|
|
||||||
|
|
||||||
def getLeftImageFile(base_dir: str,
|
def getLeftImageFile(base_dir: str,
|
||||||
nickname: str, domain: str, theme: str) -> (str, str):
|
nickname: str, domain: str, theme: str) -> (str, str):
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
return _getImageFile(base_dir, 'left_col_image', accountDir,
|
return _getImageFile(base_dir, 'left_col_image', accountDir,
|
||||||
nickname, domain, theme)
|
nickname, domain, theme)
|
||||||
|
|
||||||
|
|
||||||
def getRightImageFile(base_dir: str,
|
def getRightImageFile(base_dir: str,
|
||||||
nickname: str, domain: str, theme: str) -> (str, str):
|
nickname: str, domain: str, theme: str) -> (str, str):
|
||||||
accountDir = acctDir(base_dir, nickname, domain)
|
accountDir = acct_dir(base_dir, nickname, domain)
|
||||||
return _getImageFile(base_dir, 'right_col_image',
|
return _getImageFile(base_dir, 'right_col_image',
|
||||||
accountDir, nickname, domain, theme)
|
accountDir, nickname, domain, theme)
|
||||||
|
|
||||||
|
@ -1510,7 +1510,7 @@ def htmlShowShare(base_dir: str, domain: str, nickname: str,
|
||||||
if '://' + domain_full + '/' in shareUrl:
|
if '://' + domain_full + '/' in shareUrl:
|
||||||
# shared item on this instance
|
# shared item on this instance
|
||||||
sharesFilename = \
|
sharesFilename = \
|
||||||
acctDir(base_dir, contactNickname, domain) + '/' + \
|
acct_dir(base_dir, contactNickname, domain) + '/' + \
|
||||||
sharesFileType + '.json'
|
sharesFileType + '.json'
|
||||||
if not os.path.isfile(sharesFilename):
|
if not os.path.isfile(sharesFilename):
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -11,7 +11,7 @@ import os
|
||||||
from shutil import copyfile
|
from shutil import copyfile
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
from utils import removeHtml
|
from utils import removeHtml
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from webapp_utils import htmlHeaderWithExternalStyle
|
from webapp_utils import htmlHeaderWithExternalStyle
|
||||||
from webapp_utils import htmlFooter
|
from webapp_utils import htmlFooter
|
||||||
from markdown import markdownToHtml
|
from markdown import markdownToHtml
|
||||||
|
@ -20,7 +20,7 @@ from markdown import markdownToHtml
|
||||||
def isWelcomeScreenComplete(base_dir: str, nickname: str, domain: str) -> bool:
|
def isWelcomeScreenComplete(base_dir: str, nickname: str, domain: str) -> bool:
|
||||||
"""Returns true if the welcome screen is complete for the given account
|
"""Returns true if the welcome screen is complete for the given account
|
||||||
"""
|
"""
|
||||||
accountPath = acctDir(base_dir, nickname, domain)
|
accountPath = acct_dir(base_dir, nickname, domain)
|
||||||
if not os.path.isdir(accountPath):
|
if not os.path.isdir(accountPath):
|
||||||
return
|
return
|
||||||
completeFilename = accountPath + '/.welcome_complete'
|
completeFilename = accountPath + '/.welcome_complete'
|
||||||
|
@ -31,7 +31,7 @@ def welcomeScreenIsComplete(base_dir: str,
|
||||||
nickname: str, domain: str) -> None:
|
nickname: str, domain: str) -> None:
|
||||||
"""Indicates that the welcome screen has been shown for a given account
|
"""Indicates that the welcome screen has been shown for a given account
|
||||||
"""
|
"""
|
||||||
accountPath = acctDir(base_dir, nickname, domain)
|
accountPath = acct_dir(base_dir, nickname, domain)
|
||||||
if not os.path.isdir(accountPath):
|
if not os.path.isdir(accountPath):
|
||||||
return
|
return
|
||||||
completeFilename = accountPath + '/.welcome_complete'
|
completeFilename = accountPath + '/.welcome_complete'
|
||||||
|
|
|
@ -14,7 +14,7 @@ from utils import loadJson
|
||||||
from utils import getConfigParam
|
from utils import getConfigParam
|
||||||
from utils import getImageExtensions
|
from utils import getImageExtensions
|
||||||
from utils import getImageFormats
|
from utils import getImageFormats
|
||||||
from utils import acctDir
|
from utils import acct_dir
|
||||||
from utils import local_actor_url
|
from utils import local_actor_url
|
||||||
from webapp_utils import htmlHeaderWithExternalStyle
|
from webapp_utils import htmlHeaderWithExternalStyle
|
||||||
from webapp_utils import htmlFooter
|
from webapp_utils import htmlFooter
|
||||||
|
@ -72,7 +72,7 @@ def htmlWelcomeProfile(base_dir: str, nickname: str, domain: str,
|
||||||
# get the url of the avatar
|
# get the url of the avatar
|
||||||
for ext in getImageExtensions():
|
for ext in getImageExtensions():
|
||||||
avatarFilename = \
|
avatarFilename = \
|
||||||
acctDir(base_dir, nickname, domain) + '/avatar.' + ext
|
acct_dir(base_dir, nickname, domain) + '/avatar.' + ext
|
||||||
if os.path.isfile(avatarFilename):
|
if os.path.isfile(avatarFilename):
|
||||||
break
|
break
|
||||||
avatarUrl = \
|
avatarUrl = \
|
||||||
|
@ -99,7 +99,7 @@ def htmlWelcomeProfile(base_dir: str, nickname: str, domain: str,
|
||||||
'name="previewAvatar">' + translate['Preview'] + '</button> '
|
'name="previewAvatar">' + translate['Preview'] + '</button> '
|
||||||
profileForm += '</center>\n'
|
profileForm += '</center>\n'
|
||||||
|
|
||||||
actorFilename = acctDir(base_dir, nickname, domain) + '.json'
|
actorFilename = acct_dir(base_dir, nickname, domain) + '.json'
|
||||||
actor_json = loadJson(actorFilename)
|
actor_json = loadJson(actorFilename)
|
||||||
displayNickname = actor_json['name']
|
displayNickname = actor_json['name']
|
||||||
profileForm += '<div class="container">\n'
|
profileForm += '<div class="container">\n'
|
||||||
|
|
Loading…
Reference in New Issue