Option to show mobile newswire publish as icon or button

merge-requests/8/head
Bob Mottram 2020-10-24 17:04:53 +01:00
parent a4e7ba2fa8
commit 98e1805930
5 changed files with 29 additions and 9 deletions

View File

@ -9318,6 +9318,7 @@ class PubServer(BaseHTTPRequestHandler):
return
timelinePath = \
'/users/' + nickname + '/' + self.server.defaultTimeline
showPublishAsIcon = self.server.showPublishAsIcon
msg = htmlNewswireMobile(self.server.baseDir,
nickname,
self.server.domain,
@ -9326,7 +9327,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.translate,
self.server.newswire,
self.server.positiveVoting,
timelinePath).encode('utf-8')
timelinePath,
showPublishAsIcon).encode('utf-8')
self._set_headers('text/html', len(msg), cookie, callingDomain)
self._write(msg)
self.server.GETbusy = False
@ -11982,7 +11984,8 @@ def loadTokens(baseDir: str, tokensDict: {}, tokensLookup: {}) -> None:
tokensLookup[token] = nickname
def runDaemon(maxFollowers: int,
def runDaemon(showPublishAsIcon: bool,
maxFollowers: int,
allowNewsFollowers: bool,
maxNewsPosts: int,
maxMirroredArticles: int,
@ -12137,6 +12140,10 @@ def runDaemon(maxFollowers: int,
# maximum number of followers per account
httpd.maxFollowers = maxFollowers
# whether to show an icon for publish on the
# newswire, or a 'Publish' button
httpd.showPublishAsIcon = showPublishAsIcon
if registration == 'open':
httpd.registration = True
else:

View File

@ -209,6 +209,12 @@ parser.add_argument("--repliesEnabled", "--commentsEnabled",
type=str2bool, nargs='?',
const=True, default=True,
help="Enable replies to a post")
parser.add_argument("--showPublishAsIcon",
dest='showPublishAsIcon',
type=str2bool, nargs='?',
const=True, default=True,
help="Whether to show newswire publish " +
"as an icon or a button")
parser.add_argument("--allowNewsFollowers",
dest='allowNewsFollowers',
type=str2bool, nargs='?',
@ -1985,6 +1991,11 @@ allowNewsFollowers = \
if allowNewsFollowers is not None:
args.allowNewsFollowers = bool(allowNewsFollowers)
showPublishAsIcon = \
getConfigParam(baseDir, 'showPublishAsIcon')
if showPublishAsIcon is not None:
args.showPublishAsIcon = bool(showPublishAsIcon)
YTDomain = getConfigParam(baseDir, 'youtubedomain')
if YTDomain:
if '://' in YTDomain:
@ -1998,7 +2009,8 @@ if setTheme(baseDir, themeName, domain):
print('Theme set to ' + themeName)
if __name__ == "__main__":
runDaemon(args.maxFollowers,
runDaemon(args.showPublishAsIcon,
args.maxFollowers,
args.allowNewsFollowers,
args.maxNewsPosts,
args.maxMirroredArticles,

View File

@ -131,7 +131,7 @@ def manualApproveFollowRequest(session, baseDir: str,
with open(approveFollowsFilename, 'r') as approvefile:
for handleOfFollowRequester in approvefile:
# is this the approved follow?
if handleOfFollowRequester.startswith(approveHandle):
if handleOfFollowRequester.startswith(approveHandleFull):
handleOfFollowRequester = \
handleOfFollowRequester.replace('\n', '').replace('\r', '')
port2 = port

View File

@ -290,7 +290,7 @@ def createServerAlice(path: str, domain: str, port: int,
onionDomain = None
i2pDomain = None
print('Server running: Alice')
runDaemon(10, False, 0, 100, 1024, 5, False,
runDaemon(True, 10, False, 0, 100, 1024, 5, False,
0, False, 1, False, False, False,
5, True, True, 'en', __version__,
"instanceId", False, path, domain,
@ -354,7 +354,7 @@ def createServerBob(path: str, domain: str, port: int,
onionDomain = None
i2pDomain = None
print('Server running: Bob')
runDaemon(10, False, 0, 100, 1024, 5, False, 0,
runDaemon(True, 10, False, 0, 100, 1024, 5, False, 0,
False, 1, False, False, False,
5, True, True, 'en', __version__,
"instanceId", False, path, domain,
@ -392,7 +392,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
onionDomain = None
i2pDomain = None
print('Server running: Eve')
runDaemon(10, False, 0, 100, 1024, 5, False, 0,
runDaemon(True, 10, False, 0, 100, 1024, 5, False, 0,
False, 1, False, False, False,
5, True, True, 'en', __version__,
"instanceId", False, path, domain,

View File

@ -5850,7 +5850,8 @@ def htmlNewswireMobile(baseDir: str, nickname: str,
httpPrefix: str, translate: {},
newswire: {},
positiveVoting: bool,
timelinePath: str) -> str:
timelinePath: str,
showPublishAsIcon: bool) -> str:
"""Shows the mobile version of the newswire right column
"""
htmlStr = ''
@ -5886,7 +5887,7 @@ def htmlNewswireMobile(baseDir: str, nickname: str,
iconsDir, moderator, editor,
newswire, positiveVoting,
True, timelinePath, True,
True)
showPublishAsIcon)
htmlStr += htmlFooter()
return htmlStr