mirror of https://gitlab.com/bashrc2/epicyon
Merge
commit
bdbb512663
11
daemon.py
11
daemon.py
|
|
@ -2819,7 +2819,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
domain, domainFull,
|
domain, domainFull,
|
||||||
GETstartTime, GETtimings,
|
GETstartTime, GETtimings,
|
||||||
onionDomain, i2pDomain,
|
onionDomain, i2pDomain,
|
||||||
cookie, debug)
|
cookie, debug, authorized)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
showPublishedDateOnly = self.server.showPublishedDateOnly
|
showPublishedDateOnly = self.server.showPublishedDateOnly
|
||||||
|
|
@ -5486,7 +5486,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
domain: str, domainFull: str,
|
domain: str, domainFull: str,
|
||||||
GETstartTime, GETtimings: {},
|
GETstartTime, GETtimings: {},
|
||||||
onionDomain: str, i2pDomain: str,
|
onionDomain: str, i2pDomain: str,
|
||||||
cookie: str, debug: bool) -> None:
|
cookie: str, debug: bool,
|
||||||
|
authorized: bool) -> None:
|
||||||
"""Show person options screen
|
"""Show person options screen
|
||||||
"""
|
"""
|
||||||
backToPath = ''
|
backToPath = ''
|
||||||
|
|
@ -5576,7 +5577,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
lockedAccount,
|
lockedAccount,
|
||||||
movedTo, alsoKnownAs,
|
movedTo, alsoKnownAs,
|
||||||
self.server.textModeBanner,
|
self.server.textModeBanner,
|
||||||
self.server.newsInstance).encode('utf-8')
|
self.server.newsInstance,
|
||||||
|
authorized).encode('utf-8')
|
||||||
msglen = len(msg)
|
msglen = len(msg)
|
||||||
self._set_headers('text/html', msglen,
|
self._set_headers('text/html', msglen,
|
||||||
cookie, callingDomain)
|
cookie, callingDomain)
|
||||||
|
|
@ -10495,7 +10497,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
GETstartTime, GETtimings,
|
GETstartTime, GETtimings,
|
||||||
self.server.onionDomain,
|
self.server.onionDomain,
|
||||||
self.server.i2pDomain,
|
self.server.i2pDomain,
|
||||||
cookie, self.server.debug)
|
cookie, self.server.debug,
|
||||||
|
authorized)
|
||||||
return
|
return
|
||||||
|
|
||||||
self._benchmarkGETtimings(GETstartTime, GETtimings,
|
self._benchmarkGETtimings(GETstartTime, GETtimings,
|
||||||
|
|
|
||||||
10
theme.py
10
theme.py
|
|
@ -619,6 +619,15 @@ def setNewsAvatar(baseDir: str, name: str,
|
||||||
nickname + '@' + domain + '/avatar.png')
|
nickname + '@' + domain + '/avatar.png')
|
||||||
|
|
||||||
|
|
||||||
|
def _setClearCacheFlag(baseDir: str) -> None:
|
||||||
|
"""Sets a flag which can be used by an external system
|
||||||
|
(eg. a script in a cron job) to clear the browser cache
|
||||||
|
"""
|
||||||
|
flagFilename = baseDir + '/accounts/.clear_cache'
|
||||||
|
with open(flagFilename, 'w+') as flagFile:
|
||||||
|
flagFile.write('\n')
|
||||||
|
|
||||||
|
|
||||||
def setTheme(baseDir: str, name: str, domain: str,
|
def setTheme(baseDir: str, name: str, domain: str,
|
||||||
allowLocalNetworkAccess: bool) -> bool:
|
allowLocalNetworkAccess: bool) -> bool:
|
||||||
"""Sets the theme with the given name as the current theme
|
"""Sets the theme with the given name as the current theme
|
||||||
|
|
@ -674,4 +683,5 @@ def setTheme(baseDir: str, name: str, domain: str,
|
||||||
disableGrayscale(baseDir)
|
disableGrayscale(baseDir)
|
||||||
|
|
||||||
_setThemeInConfig(baseDir, name)
|
_setThemeInConfig(baseDir, name)
|
||||||
|
_setClearCacheFlag(baseDir)
|
||||||
return result
|
return result
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,8 @@ def htmlPersonOptions(defaultTimeline: str,
|
||||||
movedTo: str,
|
movedTo: str,
|
||||||
alsoKnownAs: [],
|
alsoKnownAs: [],
|
||||||
textModeBanner: str,
|
textModeBanner: str,
|
||||||
newsInstance: bool) -> str:
|
newsInstance: bool,
|
||||||
|
authorized: bool) -> str:
|
||||||
"""Show options for a person: view/follow/block/report
|
"""Show options for a person: view/follow/block/report
|
||||||
"""
|
"""
|
||||||
optionsDomain, optionsPort = getDomainFromActor(optionsActor)
|
optionsDomain, optionsPort = getDomainFromActor(optionsActor)
|
||||||
|
|
@ -225,87 +226,94 @@ def htmlPersonOptions(defaultTimeline: str,
|
||||||
optionsActor + '">\n'
|
optionsActor + '">\n'
|
||||||
optionsStr += ' <input type="hidden" name="avatarUrl" value="' + \
|
optionsStr += ' <input type="hidden" name="avatarUrl" value="' + \
|
||||||
optionsProfileUrl + '">\n'
|
optionsProfileUrl + '">\n'
|
||||||
if optionsNickname:
|
if authorized:
|
||||||
handle = optionsNickname + '@' + optionsDomainFull
|
if originPathStr == '/users/' + nickname:
|
||||||
petname = getPetName(baseDir, nickname, domain, handle)
|
if optionsNickname:
|
||||||
optionsStr += \
|
handle = optionsNickname + '@' + optionsDomainFull
|
||||||
' ' + translate['Petname'] + ': \n' + \
|
petname = getPetName(baseDir, nickname, domain, handle)
|
||||||
' <input type="text" name="optionpetname" value="' + \
|
optionsStr += \
|
||||||
petname + '">\n' \
|
' ' + translate['Petname'] + ': \n' + \
|
||||||
' <button type="submit" class="buttonsmall" ' + \
|
' <input type="text" name="optionpetname" value="' + \
|
||||||
'name="submitPetname">' + \
|
petname + '">\n' \
|
||||||
translate['Submit'] + '</button><br>\n'
|
' <button type="submit" class="buttonsmall" ' + \
|
||||||
|
'name="submitPetname">' + \
|
||||||
|
translate['Submit'] + '</button><br>\n'
|
||||||
|
|
||||||
# checkbox for receiving calendar events
|
# checkbox for receiving calendar events
|
||||||
if isFollowingActor(baseDir, nickname, domain, optionsActor):
|
if isFollowingActor(baseDir, nickname, domain, optionsActor):
|
||||||
checkboxStr = \
|
checkboxStr = \
|
||||||
' <input type="checkbox" ' + \
|
' <input type="checkbox" ' + \
|
||||||
'class="profilecheckbox" name="onCalendar" checked> ' + \
|
'class="profilecheckbox" name="onCalendar" checked> ' + \
|
||||||
translate['Receive calendar events from this account'] + \
|
translate['Receive calendar events from this account'] + \
|
||||||
'\n <button type="submit" class="buttonsmall" ' + \
|
'\n <button type="submit" class="buttonsmall" ' + \
|
||||||
'name="submitOnCalendar">' + \
|
'name="submitOnCalendar">' + \
|
||||||
translate['Submit'] + '</button><br>\n'
|
translate['Submit'] + '</button><br>\n'
|
||||||
if not receivingCalendarEvents(baseDir, nickname, domain,
|
if not receivingCalendarEvents(baseDir, nickname, domain,
|
||||||
optionsNickname, optionsDomainFull):
|
optionsNickname,
|
||||||
checkboxStr = checkboxStr.replace(' checked>', '>')
|
optionsDomainFull):
|
||||||
optionsStr += checkboxStr
|
checkboxStr = checkboxStr.replace(' checked>', '>')
|
||||||
|
optionsStr += checkboxStr
|
||||||
|
|
||||||
# checkbox for permission to post to newswire
|
# checkbox for permission to post to newswire
|
||||||
newswirePostsPermitted = False
|
newswirePostsPermitted = False
|
||||||
if optionsDomainFull == domainFull:
|
if optionsDomainFull == domainFull:
|
||||||
adminNickname = getConfigParam(baseDir, 'admin')
|
adminNickname = getConfigParam(baseDir, 'admin')
|
||||||
if (nickname == adminNickname or
|
if (nickname == adminNickname or
|
||||||
(isModerator(baseDir, nickname) and
|
(isModerator(baseDir, nickname) and
|
||||||
not isModerator(baseDir, optionsNickname))):
|
not isModerator(baseDir, optionsNickname))):
|
||||||
newswireBlockedFilename = \
|
newswireBlockedFilename = \
|
||||||
baseDir + '/accounts/' + \
|
baseDir + '/accounts/' + \
|
||||||
optionsNickname + '@' + optionsDomain + '/.nonewswire'
|
optionsNickname + '@' + optionsDomain + '/.nonewswire'
|
||||||
checkboxStr = \
|
checkboxStr = \
|
||||||
' <input type="checkbox" ' + \
|
' <input type="checkbox" ' + \
|
||||||
'class="profilecheckbox" name="postsToNews" checked> ' + \
|
'class="profilecheckbox" ' + \
|
||||||
translate['Allow news posts'] + \
|
'name="postsToNews" checked> ' + \
|
||||||
'\n <button type="submit" class="buttonsmall" ' + \
|
translate['Allow news posts'] + \
|
||||||
'name="submitPostToNews">' + \
|
'\n <button type="submit" class="buttonsmall" ' + \
|
||||||
translate['Submit'] + '</button><br>\n'
|
'name="submitPostToNews">' + \
|
||||||
if os.path.isfile(newswireBlockedFilename):
|
translate['Submit'] + '</button><br>\n'
|
||||||
checkboxStr = checkboxStr.replace(' checked>', '>')
|
if os.path.isfile(newswireBlockedFilename):
|
||||||
else:
|
checkboxStr = checkboxStr.replace(' checked>', '>')
|
||||||
newswirePostsPermitted = True
|
else:
|
||||||
optionsStr += checkboxStr
|
newswirePostsPermitted = True
|
||||||
|
optionsStr += checkboxStr
|
||||||
|
|
||||||
# whether blogs created by this account are moderated on the newswire
|
# whether blogs created by this account are moderated on
|
||||||
if newswirePostsPermitted:
|
# the newswire
|
||||||
moderatedFilename = \
|
if newswirePostsPermitted:
|
||||||
baseDir + '/accounts/' + \
|
moderatedFilename = \
|
||||||
optionsNickname + '@' + optionsDomain + '/.newswiremoderated'
|
baseDir + '/accounts/' + \
|
||||||
checkboxStr = \
|
optionsNickname + '@' + \
|
||||||
' <input type="checkbox" ' + \
|
optionsDomain + '/.newswiremoderated'
|
||||||
'class="profilecheckbox" name="modNewsPosts" checked> ' + \
|
checkboxStr = \
|
||||||
translate['News posts are moderated'] + \
|
' <input type="checkbox" ' + \
|
||||||
'\n <button type="submit" class="buttonsmall" ' + \
|
'class="profilecheckbox" name="modNewsPosts" checked> ' + \
|
||||||
'name="submitModNewsPosts">' + \
|
translate['News posts are moderated'] + \
|
||||||
translate['Submit'] + '</button><br>\n'
|
'\n <button type="submit" class="buttonsmall" ' + \
|
||||||
if not os.path.isfile(moderatedFilename):
|
'name="submitModNewsPosts">' + \
|
||||||
checkboxStr = checkboxStr.replace(' checked>', '>')
|
translate['Submit'] + '</button><br>\n'
|
||||||
optionsStr += checkboxStr
|
if not os.path.isfile(moderatedFilename):
|
||||||
|
checkboxStr = checkboxStr.replace(' checked>', '>')
|
||||||
|
optionsStr += checkboxStr
|
||||||
|
|
||||||
# checkbox for permission to post to featured articles
|
# checkbox for permission to post to featured articles
|
||||||
if newsInstance and optionsDomainFull == domainFull:
|
if newsInstance and optionsDomainFull == domainFull:
|
||||||
adminNickname = getConfigParam(baseDir, 'admin')
|
adminNickname = getConfigParam(baseDir, 'admin')
|
||||||
if (nickname == adminNickname or
|
if (nickname == adminNickname or
|
||||||
(isModerator(baseDir, nickname) and
|
(isModerator(baseDir, nickname) and
|
||||||
not isModerator(baseDir, optionsNickname))):
|
not isModerator(baseDir, optionsNickname))):
|
||||||
checkboxStr = \
|
checkboxStr = \
|
||||||
' <input type="checkbox" ' + \
|
' <input type="checkbox" ' + \
|
||||||
'class="profilecheckbox" name="postsToFeatures" checked> ' + \
|
'class="profilecheckbox" ' + \
|
||||||
translate['Featured writer'] + \
|
'name="postsToFeatures" checked> ' + \
|
||||||
'\n <button type="submit" class="buttonsmall" ' + \
|
translate['Featured writer'] + \
|
||||||
'name="submitPostToFeatures">' + \
|
'\n <button type="submit" class="buttonsmall" ' + \
|
||||||
translate['Submit'] + '</button><br>\n'
|
'name="submitPostToFeatures">' + \
|
||||||
if not isFeaturedWriter(baseDir, optionsNickname,
|
translate['Submit'] + '</button><br>\n'
|
||||||
optionsDomain):
|
if not isFeaturedWriter(baseDir, optionsNickname,
|
||||||
checkboxStr = checkboxStr.replace(' checked>', '>')
|
optionsDomain):
|
||||||
optionsStr += checkboxStr
|
checkboxStr = checkboxStr.replace(' checked>', '>')
|
||||||
|
optionsStr += checkboxStr
|
||||||
|
|
||||||
optionsStr += optionsLinkStr
|
optionsStr += optionsLinkStr
|
||||||
backPath = '/'
|
backPath = '/'
|
||||||
|
|
@ -313,53 +321,63 @@ def htmlPersonOptions(defaultTimeline: str,
|
||||||
backPath = '/users/' + nickname + '/' + defaultTimeline
|
backPath = '/users/' + nickname + '/' + defaultTimeline
|
||||||
if 'moderation' in backToPath:
|
if 'moderation' in backToPath:
|
||||||
backPath = '/users/' + nickname + '/moderation'
|
backPath = '/users/' + nickname + '/moderation'
|
||||||
optionsStr += \
|
if authorized and originPathStr == '/users/' + nickname:
|
||||||
' <a href="' + backPath + '"><button type="button" ' + \
|
optionsStr += \
|
||||||
'class="buttonIcon" name="submitBack">' + translate['Go Back'] + \
|
' <a href="' + backPath + '"><button type="button" ' + \
|
||||||
'</button></a>\n'
|
'class="buttonIcon" name="submitBack">' + translate['Go Back'] + \
|
||||||
optionsStr += \
|
'</button></a>\n'
|
||||||
' <button type="submit" class="button" name="submitView">' + \
|
else:
|
||||||
translate['View'] + '</button>\n'
|
optionsStr += \
|
||||||
|
' <a href="' + originPathStr + '"><button type="button" ' + \
|
||||||
|
'class="buttonIcon" name="submitBack">' + translate['Go Back'] + \
|
||||||
|
'</button></a>\n'
|
||||||
|
if authorized:
|
||||||
|
optionsStr += \
|
||||||
|
' <button type="submit" class="button" name="submitView">' + \
|
||||||
|
translate['View'] + '</button>\n'
|
||||||
optionsStr += donateStr
|
optionsStr += donateStr
|
||||||
optionsStr += \
|
if authorized:
|
||||||
' <button type="submit" class="button" name="submit' + \
|
optionsStr += \
|
||||||
followStr + '">' + translate[followStr] + '</button>\n'
|
' <button type="submit" class="button" name="submit' + \
|
||||||
optionsStr += \
|
followStr + '">' + translate[followStr] + '</button>\n'
|
||||||
' <button type="submit" class="button" name="submit' + \
|
optionsStr += \
|
||||||
blockStr + '">' + translate[blockStr] + '</button>\n'
|
' <button type="submit" class="button" name="submit' + \
|
||||||
optionsStr += \
|
blockStr + '">' + translate[blockStr] + '</button>\n'
|
||||||
' <button type="submit" class="button" name="submitDM">' + \
|
optionsStr += \
|
||||||
translate['DM'] + '</button>\n'
|
' <button type="submit" class="button" name="submitDM">' + \
|
||||||
optionsStr += \
|
translate['DM'] + '</button>\n'
|
||||||
' <button type="submit" class="button" name="submit' + \
|
optionsStr += \
|
||||||
snoozeButtonStr + '">' + translate[snoozeButtonStr] + '</button>\n'
|
' <button type="submit" class="button" name="submit' + \
|
||||||
optionsStr += \
|
snoozeButtonStr + '">' + translate[snoozeButtonStr] + \
|
||||||
' <button type="submit" class="button" name="submitReport">' + \
|
'</button>\n'
|
||||||
translate['Report'] + '</button>\n'
|
|
||||||
|
|
||||||
if isModerator(baseDir, nickname):
|
|
||||||
optionsStr += \
|
optionsStr += \
|
||||||
' <button type="submit" class="button" ' + \
|
' <button type="submit" class="button" ' + \
|
||||||
'name="submitPersonInfo">' + \
|
'name="submitReport">' + translate['Report'] + '</button>\n'
|
||||||
translate['Info'] + '</button>\n'
|
|
||||||
|
|
||||||
personNotes = ''
|
if isModerator(baseDir, nickname):
|
||||||
personNotesFilename = \
|
optionsStr += \
|
||||||
baseDir + '/accounts/' + nickname + '@' + domain + \
|
' <button type="submit" class="button" ' + \
|
||||||
'/notes/' + handle + '.txt'
|
'name="submitPersonInfo">' + \
|
||||||
if os.path.isfile(personNotesFilename):
|
translate['Info'] + '</button>\n'
|
||||||
with open(personNotesFilename, 'r') as fp:
|
|
||||||
personNotes = fp.read()
|
|
||||||
|
|
||||||
optionsStr += \
|
personNotes = ''
|
||||||
' <br><br>' + translate['Notes'] + ': \n'
|
if originPathStr == '/users/' + nickname:
|
||||||
optionsStr += ' <button type="submit" class="buttonsmall" ' + \
|
personNotesFilename = \
|
||||||
'name="submitPersonNotes">' + \
|
baseDir + '/accounts/' + nickname + '@' + domain + \
|
||||||
translate['Submit'] + '</button><br>\n'
|
'/notes/' + handle + '.txt'
|
||||||
optionsStr += \
|
if os.path.isfile(personNotesFilename):
|
||||||
' <textarea id="message" ' + \
|
with open(personNotesFilename, 'r') as fp:
|
||||||
'name="optionnotes" style="height:400px">' + \
|
personNotes = fp.read()
|
||||||
personNotes + '</textarea>\n'
|
|
||||||
|
optionsStr += \
|
||||||
|
' <br><br>' + translate['Notes'] + ': \n'
|
||||||
|
optionsStr += ' <button type="submit" class="buttonsmall" ' + \
|
||||||
|
'name="submitPersonNotes">' + \
|
||||||
|
translate['Submit'] + '</button><br>\n'
|
||||||
|
optionsStr += \
|
||||||
|
' <textarea id="message" ' + \
|
||||||
|
'name="optionnotes" style="height:400px">' + \
|
||||||
|
personNotes + '</textarea>\n'
|
||||||
|
|
||||||
optionsStr += ' </form>\n'
|
optionsStr += ' </form>\n'
|
||||||
optionsStr += '</center>\n'
|
optionsStr += '</center>\n'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue