forked from indymedia/epicyon
Option to show mobile newswire publish as icon or button
parent
a4e7ba2fa8
commit
98e1805930
11
daemon.py
11
daemon.py
|
@ -9318,6 +9318,7 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
return
|
return
|
||||||
timelinePath = \
|
timelinePath = \
|
||||||
'/users/' + nickname + '/' + self.server.defaultTimeline
|
'/users/' + nickname + '/' + self.server.defaultTimeline
|
||||||
|
showPublishAsIcon = self.server.showPublishAsIcon
|
||||||
msg = htmlNewswireMobile(self.server.baseDir,
|
msg = htmlNewswireMobile(self.server.baseDir,
|
||||||
nickname,
|
nickname,
|
||||||
self.server.domain,
|
self.server.domain,
|
||||||
|
@ -9326,7 +9327,8 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
self.server.translate,
|
self.server.translate,
|
||||||
self.server.newswire,
|
self.server.newswire,
|
||||||
self.server.positiveVoting,
|
self.server.positiveVoting,
|
||||||
timelinePath).encode('utf-8')
|
timelinePath,
|
||||||
|
showPublishAsIcon).encode('utf-8')
|
||||||
self._set_headers('text/html', len(msg), cookie, callingDomain)
|
self._set_headers('text/html', len(msg), cookie, callingDomain)
|
||||||
self._write(msg)
|
self._write(msg)
|
||||||
self.server.GETbusy = False
|
self.server.GETbusy = False
|
||||||
|
@ -11982,7 +11984,8 @@ def loadTokens(baseDir: str, tokensDict: {}, tokensLookup: {}) -> None:
|
||||||
tokensLookup[token] = nickname
|
tokensLookup[token] = nickname
|
||||||
|
|
||||||
|
|
||||||
def runDaemon(maxFollowers: int,
|
def runDaemon(showPublishAsIcon: bool,
|
||||||
|
maxFollowers: int,
|
||||||
allowNewsFollowers: bool,
|
allowNewsFollowers: bool,
|
||||||
maxNewsPosts: int,
|
maxNewsPosts: int,
|
||||||
maxMirroredArticles: int,
|
maxMirroredArticles: int,
|
||||||
|
@ -12137,6 +12140,10 @@ def runDaemon(maxFollowers: int,
|
||||||
# maximum number of followers per account
|
# maximum number of followers per account
|
||||||
httpd.maxFollowers = maxFollowers
|
httpd.maxFollowers = maxFollowers
|
||||||
|
|
||||||
|
# whether to show an icon for publish on the
|
||||||
|
# newswire, or a 'Publish' button
|
||||||
|
httpd.showPublishAsIcon = showPublishAsIcon
|
||||||
|
|
||||||
if registration == 'open':
|
if registration == 'open':
|
||||||
httpd.registration = True
|
httpd.registration = True
|
||||||
else:
|
else:
|
||||||
|
|
14
epicyon.py
14
epicyon.py
|
@ -209,6 +209,12 @@ parser.add_argument("--repliesEnabled", "--commentsEnabled",
|
||||||
type=str2bool, nargs='?',
|
type=str2bool, nargs='?',
|
||||||
const=True, default=True,
|
const=True, default=True,
|
||||||
help="Enable replies to a post")
|
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",
|
parser.add_argument("--allowNewsFollowers",
|
||||||
dest='allowNewsFollowers',
|
dest='allowNewsFollowers',
|
||||||
type=str2bool, nargs='?',
|
type=str2bool, nargs='?',
|
||||||
|
@ -1985,6 +1991,11 @@ allowNewsFollowers = \
|
||||||
if allowNewsFollowers is not None:
|
if allowNewsFollowers is not None:
|
||||||
args.allowNewsFollowers = bool(allowNewsFollowers)
|
args.allowNewsFollowers = bool(allowNewsFollowers)
|
||||||
|
|
||||||
|
showPublishAsIcon = \
|
||||||
|
getConfigParam(baseDir, 'showPublishAsIcon')
|
||||||
|
if showPublishAsIcon is not None:
|
||||||
|
args.showPublishAsIcon = bool(showPublishAsIcon)
|
||||||
|
|
||||||
YTDomain = getConfigParam(baseDir, 'youtubedomain')
|
YTDomain = getConfigParam(baseDir, 'youtubedomain')
|
||||||
if YTDomain:
|
if YTDomain:
|
||||||
if '://' in YTDomain:
|
if '://' in YTDomain:
|
||||||
|
@ -1998,7 +2009,8 @@ if setTheme(baseDir, themeName, domain):
|
||||||
print('Theme set to ' + themeName)
|
print('Theme set to ' + themeName)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
runDaemon(args.maxFollowers,
|
runDaemon(args.showPublishAsIcon,
|
||||||
|
args.maxFollowers,
|
||||||
args.allowNewsFollowers,
|
args.allowNewsFollowers,
|
||||||
args.maxNewsPosts,
|
args.maxNewsPosts,
|
||||||
args.maxMirroredArticles,
|
args.maxMirroredArticles,
|
||||||
|
|
|
@ -131,7 +131,7 @@ def manualApproveFollowRequest(session, baseDir: str,
|
||||||
with open(approveFollowsFilename, 'r') as approvefile:
|
with open(approveFollowsFilename, 'r') as approvefile:
|
||||||
for handleOfFollowRequester in approvefile:
|
for handleOfFollowRequester in approvefile:
|
||||||
# is this the approved follow?
|
# is this the approved follow?
|
||||||
if handleOfFollowRequester.startswith(approveHandle):
|
if handleOfFollowRequester.startswith(approveHandleFull):
|
||||||
handleOfFollowRequester = \
|
handleOfFollowRequester = \
|
||||||
handleOfFollowRequester.replace('\n', '').replace('\r', '')
|
handleOfFollowRequester.replace('\n', '').replace('\r', '')
|
||||||
port2 = port
|
port2 = port
|
||||||
|
|
6
tests.py
6
tests.py
|
@ -290,7 +290,7 @@ def createServerAlice(path: str, domain: str, port: int,
|
||||||
onionDomain = None
|
onionDomain = None
|
||||||
i2pDomain = None
|
i2pDomain = None
|
||||||
print('Server running: Alice')
|
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,
|
0, False, 1, False, False, False,
|
||||||
5, True, True, 'en', __version__,
|
5, True, True, 'en', __version__,
|
||||||
"instanceId", False, path, domain,
|
"instanceId", False, path, domain,
|
||||||
|
@ -354,7 +354,7 @@ def createServerBob(path: str, domain: str, port: int,
|
||||||
onionDomain = None
|
onionDomain = None
|
||||||
i2pDomain = None
|
i2pDomain = None
|
||||||
print('Server running: Bob')
|
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,
|
False, 1, False, False, False,
|
||||||
5, True, True, 'en', __version__,
|
5, True, True, 'en', __version__,
|
||||||
"instanceId", False, path, domain,
|
"instanceId", False, path, domain,
|
||||||
|
@ -392,7 +392,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
|
||||||
onionDomain = None
|
onionDomain = None
|
||||||
i2pDomain = None
|
i2pDomain = None
|
||||||
print('Server running: Eve')
|
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,
|
False, 1, False, False, False,
|
||||||
5, True, True, 'en', __version__,
|
5, True, True, 'en', __version__,
|
||||||
"instanceId", False, path, domain,
|
"instanceId", False, path, domain,
|
||||||
|
|
|
@ -5850,7 +5850,8 @@ def htmlNewswireMobile(baseDir: str, nickname: str,
|
||||||
httpPrefix: str, translate: {},
|
httpPrefix: str, translate: {},
|
||||||
newswire: {},
|
newswire: {},
|
||||||
positiveVoting: bool,
|
positiveVoting: bool,
|
||||||
timelinePath: str) -> str:
|
timelinePath: str,
|
||||||
|
showPublishAsIcon: bool) -> str:
|
||||||
"""Shows the mobile version of the newswire right column
|
"""Shows the mobile version of the newswire right column
|
||||||
"""
|
"""
|
||||||
htmlStr = ''
|
htmlStr = ''
|
||||||
|
@ -5886,7 +5887,7 @@ def htmlNewswireMobile(baseDir: str, nickname: str,
|
||||||
iconsDir, moderator, editor,
|
iconsDir, moderator, editor,
|
||||||
newswire, positiveVoting,
|
newswire, positiveVoting,
|
||||||
True, timelinePath, True,
|
True, timelinePath, True,
|
||||||
True)
|
showPublishAsIcon)
|
||||||
htmlStr += htmlFooter()
|
htmlStr += htmlFooter()
|
||||||
return htmlStr
|
return htmlStr
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue