diff --git a/daemon.py b/daemon.py index 699bb7d6..83adeab6 100644 --- a/daemon.py +++ b/daemon.py @@ -6462,7 +6462,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.newswire, self.server.positiveVoting, self.server.showPublishAsIcon, - fullWidthTimelineButtonHeader) + fullWidthTimelineButtonHeader, + self.server.iconsAsButtons) if GETstartTime: self._benchmarkGETtimings(GETstartTime, GETtimings, 'show status done', @@ -6580,7 +6581,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.newswire, self.server.positiveVoting, self.server.showPublishAsIcon, - fullWidthTimelineButtonHeader) + fullWidthTimelineButtonHeader, + self.server.iconsAsButtons) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -6691,7 +6693,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.newswire, self.server.positiveVoting, self.server.showPublishAsIcon, - fullWidthTimelineButtonHeader) + fullWidthTimelineButtonHeader, + self.server.iconsAsButtons) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -6802,7 +6805,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.newswire, self.server.positiveVoting, self.server.showPublishAsIcon, - fullWidthTimelineButtonHeader) + fullWidthTimelineButtonHeader, + self.server.iconsAsButtons) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -6913,7 +6917,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.newswire, self.server.positiveVoting, self.server.showPublishAsIcon, - fullWidthTimelineButtonHeader) + fullWidthTimelineButtonHeader, + self.server.iconsAsButtons) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -7033,7 +7038,8 @@ class PubServer(BaseHTTPRequestHandler): moderator, editor, self.server.positiveVoting, self.server.showPublishAsIcon, - fullWidthTimelineButtonHeader) + fullWidthTimelineButtonHeader, + self.server.iconsAsButtons) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -7112,7 +7118,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.newswire, self.server.positiveVoting, self.server.showPublishAsIcon, - self.server.fullWidthTimelineButtonHeader) + self.server.fullWidthTimelineButtonHeader, + self.server.iconsAsButtons) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -7207,7 +7214,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.newswire, self.server.positiveVoting, self.server.showPublishAsIcon, - fullWidthTimelineButtonHeader) + fullWidthTimelineButtonHeader, + self.server.iconsAsButtons) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -7321,7 +7329,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.newswire, self.server.positiveVoting, self.server.showPublishAsIcon, - fullWidthTimelineButtonHeader) + fullWidthTimelineButtonHeader, + self.server.iconsAsButtons) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -7427,7 +7436,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.newswire, self.server.positiveVoting, self.server.showPublishAsIcon, - fullWidthTimelineButtonHeader) + fullWidthTimelineButtonHeader, + self.server.iconsAsButtons) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -7523,7 +7533,8 @@ class PubServer(BaseHTTPRequestHandler): self.server.newswire, self.server.positiveVoting, self.server.showPublishAsIcon, - fullWidthTimelineButtonHeader) + fullWidthTimelineButtonHeader, + self.server.iconsAsButtons) msg = msg.encode('utf-8') self._set_headers('text/html', len(msg), cookie, callingDomain) @@ -12039,7 +12050,8 @@ def loadTokens(baseDir: str, tokensDict: {}, tokensLookup: {}) -> None: tokensLookup[token] = nickname -def runDaemon(fullWidthTimelineButtonHeader: bool, +def runDaemon(iconsAsButtons: bool, + fullWidthTimelineButtonHeader: bool, showPublishAsIcon: bool, maxFollowers: int, allowNewsFollowers: bool, @@ -12204,6 +12216,9 @@ def runDaemon(fullWidthTimelineButtonHeader: bool, # calendar, etc as the full width of the screen or not httpd.fullWidthTimelineButtonHeader = fullWidthTimelineButtonHeader + # whether to show icons in the header (eg calendar) as buttons + httpd.iconsAsButtons = iconsAsButtons + if registration == 'open': httpd.registration = True else: diff --git a/epicyon.py b/epicyon.py index c77565ef..c6174d1c 100644 --- a/epicyon.py +++ b/epicyon.py @@ -227,6 +227,11 @@ parser.add_argument("--allowNewsFollowers", type=str2bool, nargs='?', const=True, default=False, help="Whether to allow the news account to be followed") +parser.add_argument("--iconsAsButtons", + dest='iconsAsButtons', + type=str2bool, nargs='?', + const=True, default=False, + help="Show header icons as buttons") parser.add_argument("--noapproval", type=str2bool, nargs='?', const=True, default=False, help="Allow followers without approval") @@ -2003,6 +2008,11 @@ showPublishAsIcon = \ if showPublishAsIcon is not None: args.showPublishAsIcon = bool(showPublishAsIcon) +iconsAsButtons = \ + getConfigParam(baseDir, 'iconsAsButtons') +if iconsAsButtons is not None: + args.iconsAsButtons = bool(iconsAsButtons) + fullWidthTimelineButtonHeader = \ getConfigParam(baseDir, 'fullWidthTimelineButtonHeader') if fullWidthTimelineButtonHeader is not None: @@ -2021,7 +2031,8 @@ if setTheme(baseDir, themeName, domain): print('Theme set to ' + themeName) if __name__ == "__main__": - runDaemon(args.fullWidthTimelineButtonHeader, + runDaemon(args.iconsAsButtons, + args.fullWidthTimelineButtonHeader, args.showPublishAsIcon, args.maxFollowers, args.allowNewsFollowers, diff --git a/tests.py b/tests.py index 2f45f44e..a873d457 100644 --- a/tests.py +++ b/tests.py @@ -291,7 +291,7 @@ def createServerAlice(path: str, domain: str, port: int, onionDomain = None i2pDomain = None print('Server running: Alice') - runDaemon(False, True, 10, False, 0, 100, 1024, 5, False, + runDaemon(False, False, True, 10, False, 0, 100, 1024, 5, False, 0, False, 1, False, False, False, 5, True, True, 'en', __version__, "instanceId", False, path, domain, @@ -355,7 +355,7 @@ def createServerBob(path: str, domain: str, port: int, onionDomain = None i2pDomain = None print('Server running: Bob') - runDaemon(False, True, 10, False, 0, 100, 1024, 5, False, 0, + runDaemon(False, False, True, 10, False, 0, 100, 1024, 5, False, 0, False, 1, False, False, False, 5, True, True, 'en', __version__, "instanceId", False, path, domain, @@ -393,7 +393,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [], onionDomain = None i2pDomain = None print('Server running: Eve') - runDaemon(False, True, 10, False, 0, 100, 1024, 5, False, 0, + runDaemon(False, False, True, 10, False, 0, 100, 1024, 5, False, 0, False, 1, False, False, False, 5, True, True, 'en', __version__, "instanceId", False, path, domain, diff --git a/theme.py b/theme.py index 891d9ed9..301fc97c 100644 --- a/theme.py +++ b/theme.py @@ -54,6 +54,20 @@ def setNewswirePublishAsIcon(baseDir: str, useIcon: bool) -> bool: return saveJson(configJson, configFilename) +def setIconsAsButtons(baseDir: str, useButtons: bool) -> bool: + """Whether to show icons in the header (inbox, outbox, etc) + as buttons + """ + configFilename = baseDir + '/config.json' + if not os.path.isfile(configFilename): + return False + configJson = loadJson(configFilename, 0) + if not configJson: + return False + configJson['iconsAsButtons'] = useButtons + return saveJson(configJson, configFilename) + + def setFullWidthTimelineButtonHeader(baseDir: str, fullWidth: bool) -> bool: """Shows the timeline button header containing inbox, outbox, calendar, etc as full width @@ -261,6 +275,7 @@ def setThemeDefault(baseDir: str): setThemeInConfig(baseDir, name) setNewswirePublishAsIcon(baseDir, True) setFullWidthTimelineButtonHeader(baseDir, False) + setIconsAsButtons(baseDir, False) bgParams = { "login": "jpg", "follow": "jpg", @@ -279,6 +294,7 @@ def setThemeIndymediaClassic(baseDir: str): setThemeInConfig(baseDir, name) setNewswirePublishAsIcon(baseDir, False) setFullWidthTimelineButtonHeader(baseDir, True) + setIconsAsButtons(baseDir, False) bgParams = { "login": "jpg", "follow": "jpg", @@ -360,6 +376,7 @@ def setThemeBlue(baseDir: str): setThemeInConfig(baseDir, name) setNewswirePublishAsIcon(baseDir, True) setFullWidthTimelineButtonHeader(baseDir, False) + setIconsAsButtons(baseDir, False) themeParams = { "newswire-date-color": "blue", "font-size-header": "22px", @@ -399,6 +416,7 @@ def setThemeNight(baseDir: str): setThemeInConfig(baseDir, name) setNewswirePublishAsIcon(baseDir, True) setFullWidthTimelineButtonHeader(baseDir, False) + setIconsAsButtons(baseDir, False) fontStr = \ "url('./fonts/solidaric.woff2') format('woff2')" fontStrItalic = \ @@ -459,6 +477,7 @@ def setThemeStarlight(baseDir: str): setThemeInConfig(baseDir, name) setNewswirePublishAsIcon(baseDir, True) setFullWidthTimelineButtonHeader(baseDir, False) + setIconsAsButtons(baseDir, False) themeParams = { "column-left-image-width-mobile": "40vw", "line-spacing-newswire": "120%", @@ -528,6 +547,7 @@ def setThemeHenge(baseDir: str): setThemeInConfig(baseDir, name) setNewswirePublishAsIcon(baseDir, True) setFullWidthTimelineButtonHeader(baseDir, False) + setIconsAsButtons(baseDir, False) themeParams = { "column-left-image-width-mobile": "40vw", "column-right-image-width-mobile": "40vw", @@ -592,6 +612,7 @@ def setThemeZen(baseDir: str): setThemeInConfig(baseDir, name) setNewswirePublishAsIcon(baseDir, True) setFullWidthTimelineButtonHeader(baseDir, False) + setIconsAsButtons(baseDir, False) themeParams = { "main-bg-color": "#5c4e41", "column-left-color": "#5c4e41", @@ -652,6 +673,7 @@ def setThemeHighVis(baseDir: str): setThemeFromDict(baseDir, name, themeParams, bgParams) setNewswirePublishAsIcon(baseDir, True) setFullWidthTimelineButtonHeader(baseDir, False) + setIconsAsButtons(baseDir, False) def setThemeLCD(baseDir: str): @@ -732,6 +754,7 @@ def setThemeLCD(baseDir: str): setThemeFromDict(baseDir, name, themeParams, bgParams) setNewswirePublishAsIcon(baseDir, True) setFullWidthTimelineButtonHeader(baseDir, False) + setIconsAsButtons(baseDir, False) def setThemePurple(baseDir: str): @@ -795,6 +818,7 @@ def setThemePurple(baseDir: str): setThemeFromDict(baseDir, name, themeParams, bgParams) setNewswirePublishAsIcon(baseDir, True) setFullWidthTimelineButtonHeader(baseDir, False) + setIconsAsButtons(baseDir, False) def setThemeHacker(baseDir: str): @@ -855,6 +879,7 @@ def setThemeHacker(baseDir: str): setThemeFromDict(baseDir, name, themeParams, bgParams) setNewswirePublishAsIcon(baseDir, True) setFullWidthTimelineButtonHeader(baseDir, False) + setIconsAsButtons(baseDir, False) def setThemeLight(baseDir: str): @@ -916,6 +941,7 @@ def setThemeLight(baseDir: str): setThemeFromDict(baseDir, name, themeParams, bgParams) setNewswirePublishAsIcon(baseDir, True) setFullWidthTimelineButtonHeader(baseDir, False) + setIconsAsButtons(baseDir, False) def setThemeIndymediaModern(baseDir: str): @@ -1002,6 +1028,7 @@ def setThemeIndymediaModern(baseDir: str): setThemeFromDict(baseDir, name, themeParams, bgParams) setNewswirePublishAsIcon(baseDir, False) setFullWidthTimelineButtonHeader(baseDir, True) + setIconsAsButtons(baseDir, True) def setThemeSolidaric(baseDir: str): @@ -1069,6 +1096,7 @@ def setThemeSolidaric(baseDir: str): setThemeFromDict(baseDir, name, themeParams, bgParams) setNewswirePublishAsIcon(baseDir, True) setFullWidthTimelineButtonHeader(baseDir, False) + setIconsAsButtons(baseDir, False) def setThemeImages(baseDir: str, name: str) -> None: diff --git a/translations/ar.json b/translations/ar.json index 8935e9b2..347c8869 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -315,5 +315,9 @@ "Publish": "ينشر", "Publish a news article": "انشر مقالة إخبارية", "News tagging rules": "قواعد وسم الأخبار", - "See instructions": "انظر التعليمات" + "See instructions": "انظر التعليمات", + "Search": "بحث", + "Expand": "وسعت", + "Newswire": "نيوزواير", + "Links": "الروابط" } diff --git a/translations/ca.json b/translations/ca.json index 71994ecb..ebba9e5e 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -315,5 +315,9 @@ "Publish": "Publica", "Publish a news article": "Publicar un article de notícies", "News tagging rules": "Regles d'etiquetatge de notícies", - "See instructions": "Consulteu les instruccions" + "See instructions": "Consulteu les instruccions", + "Search": "Cerca", + "Expand": "Amplia", + "Newswire": "Newswire", + "Links": "Enllaços" } diff --git a/translations/cy.json b/translations/cy.json index 472a1bbc..e3e72859 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -315,5 +315,9 @@ "Publish": "Cyhoeddi", "Publish a news article": "Cyhoeddi erthygl newyddion", "News tagging rules": "Rheolau tagio newyddion", - "See instructions": "Gweler y cyfarwyddiadau" + "See instructions": "Gweler y cyfarwyddiadau", + "Search": "Chwilio", + "Expand": "Ehangu", + "Newswire": "Newswire", + "Links": "Dolenni" } diff --git a/translations/de.json b/translations/de.json index 7a4973e3..7b673038 100644 --- a/translations/de.json +++ b/translations/de.json @@ -315,5 +315,9 @@ "Publish": "Veröffentlichen", "Publish a news article": "Veröffentlichen Sie einen Nachrichtenartikel", "News tagging rules": "Regeln für das Markieren von Nachrichten", - "See instructions": "Siehe Anweisungen" + "See instructions": "Siehe Anweisungen", + "Search": "Suche", + "Expand": "Erweitern", + "Newswire": "Newswire", + "Links": "Links" } diff --git a/translations/en.json b/translations/en.json index 25130fd4..9bf3621e 100644 --- a/translations/en.json +++ b/translations/en.json @@ -315,5 +315,9 @@ "Publish": "Publish", "Publish a news article": "Publish a news article", "News tagging rules": "News tagging rules", - "See instructions": "See instructions" + "See instructions": "See instructions", + "Search": "Search", + "Expand": "Expand", + "Newswire": "Newswire", + "Links": "Links" } diff --git a/translations/es.json b/translations/es.json index 5b794aa0..c77e95c8 100644 --- a/translations/es.json +++ b/translations/es.json @@ -315,5 +315,9 @@ "Publish": "Publicar", "Publish a news article": "Publica un artículo de noticias", "News tagging rules": "Reglas de etiquetado de noticias", - "See instructions": "Vea las instrucciones" + "See instructions": "Vea las instrucciones", + "Search": "Buscar", + "Expand": "Expandir", + "Newswire": "Newswire", + "Links": "Enlaces" } diff --git a/translations/fr.json b/translations/fr.json index 4c78e7b6..10fdb90d 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -315,5 +315,9 @@ "Publish": "Publier", "Publish a news article": "Publier un article de presse", "News tagging rules": "Règles de marquage des actualités", - "See instructions": "Voir les instructions" + "See instructions": "Voir les instructions", + "Search": "Chercher", + "Expand": "Développer", + "Newswire": "Newswire", + "Links": "Liens" } diff --git a/translations/ga.json b/translations/ga.json index 42b58e4c..c085ea73 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -315,5 +315,9 @@ "Publish": "Fhoilsiú", "Publish a news article": "Foilsigh alt nuachta", "News tagging rules": "Rialacha clibeála nuachta", - "See instructions": "Féach na treoracha" + "See instructions": "Féach na treoracha", + "Search": "Cuardaigh", + "Expand": "Leathnaigh", + "Newswire": "Newswire", + "Links": "Naisc" } diff --git a/translations/hi.json b/translations/hi.json index 9bec2ccb..54a154a5 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -315,5 +315,9 @@ "Publish": "प्रकाशित करना", "Publish a news article": "एक समाचार लेख प्रकाशित करें", "News tagging rules": "समाचार टैगिंग नियम", - "See instructions": "निर्देश देखें" + "See instructions": "निर्देश देखें", + "Search": "खोज", + "Expand": "विस्तार", + "Newswire": "न्यूज़वायर", + "Links": "लिंक" } diff --git a/translations/it.json b/translations/it.json index 8bb110a0..d86660d6 100644 --- a/translations/it.json +++ b/translations/it.json @@ -315,5 +315,9 @@ "Publish": "Pubblicare", "Publish a news article": "Pubblica un articolo di notizie", "News tagging rules": "Regole di tagging delle notizie", - "See instructions": "Vedere le istruzioni" + "See instructions": "Vedere le istruzioni", + "Search": "Ricerca", + "Expand": "Espandere", + "Newswire": "Newswire", + "Links": "Collegamenti" } diff --git a/translations/ja.json b/translations/ja.json index 45b90b57..537e9dee 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -315,5 +315,9 @@ "Publish": "公開する", "Publish a news article": "ニュース記事を公開する", "News tagging rules": "ニュースのタグ付けルール", - "See instructions": "手順を参照してください" + "See instructions": "手順を参照してください", + "Search": "探す", + "Expand": "展開", + "Newswire": "Newswire", + "Links": "リンク" } diff --git a/translations/oc.json b/translations/oc.json index f67af022..693a2d35 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -311,5 +311,9 @@ "Publish": "Publish", "Publish a news article": "Publish a news article", "News tagging rules": "News tagging rules", - "See instructions": "See instructions" + "See instructions": "See instructions", + "Search": "Search", + "Expand": "Expand", + "Newswire": "Newswire", + "Links": "Links" } diff --git a/translations/pt.json b/translations/pt.json index e3280b6d..42adf483 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -315,5 +315,9 @@ "Publish": "Publicar", "Publish a news article": "Publique um artigo de notícias", "News tagging rules": "Regras de marcação de notícias", - "See instructions": "Veja as instruções" + "See instructions": "Veja as instruções", + "Search": "Pesquisa", + "Expand": "Expandir", + "Newswire": "Newswire", + "Links": "Links" } diff --git a/translations/ru.json b/translations/ru.json index 33eb0805..e84af486 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -315,5 +315,9 @@ "Publish": "Публиковать", "Publish a news article": "Опубликовать новостную статью", "News tagging rules": "Правила тегирования новостей", - "See instructions": "См. Инструкции" + "See instructions": "См. Инструкции", + "Search": "Поиск", + "Expand": "Развернуть", + "Newswire": "Лента новостей", + "Links": "Ссылки" } diff --git a/translations/zh.json b/translations/zh.json index 57d8b21e..0a21c792 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -315,5 +315,9 @@ "Publish": "发布", "Publish a news article": "发布新闻文章", "News tagging rules": "新闻标记规则", - "See instructions": "见说明" + "See instructions": "见说明", + "Search": "搜索", + "Expand": "扩大", + "Newswire": "新闻专线", + "Links": "链接" } diff --git a/webinterface.py b/webinterface.py index d655260d..2ef6f820 100644 --- a/webinterface.py +++ b/webinterface.py @@ -5944,7 +5944,8 @@ def getTimelineButtonHeader(defaultTimeline: str, newCalendarEvent: bool, calendarPath: str, calendarImage: str, - followApprovals: str) -> str: + followApprovals: str, + iconsAsButtons: bool) -> str: """Returns the header at the top of the timeline, containing buttons for inbox, outbox, search, calendar, etc """ @@ -6073,13 +6074,20 @@ def getTimelineButtonHeader(defaultTimeline: str, '/calendar">\n' - # the search button - tlStr += \ - ' \n' + if not iconsAsButtons: + # the search button + tlStr += \ + ' \n' + else: + tlStr += \ + ' \n' # benchmark 5 timeDiff = int((time.time() - timelineStartTime) * 1000) @@ -6091,37 +6099,68 @@ def getTimelineButtonHeader(defaultTimeline: str, if newCalendarEvent: # indicate that the calendar icon is highlighted calendarAltText = '*' + calendarAltText + '*' - tlStr += \ - ' \n' + if not iconsAsButtons: + tlStr += \ + ' \n' + else: + tlStr += \ + ' \n' # the show/hide button, for a simpler header appearance - tlStr += \ - ' \n' + if not iconsAsButtons: + tlStr += \ + ' \n' + else: + tlStr += \ + ' \n' # the newswire button to show right column links - tlStr += \ - ' ' + \ - '\n' + if not iconsAsButtons: + tlStr += \ + ' ' + \ + '\n' + else: + tlStr += \ + ' \n' # the links button to show left column links - tlStr += \ - ' ' + \ - '\n' + if not iconsAsButtons: + tlStr += \ + ' ' + \ + '\n' + else: + tlStr += \ + ' \n' tlStr += followApprovals # end of the button header with inbox, outbox, etc @@ -6145,7 +6184,8 @@ def htmlTimeline(defaultTimeline: str, editor: bool, positiveVoting: bool, showPublishAsIcon: bool, - fullWidthTimelineButtonHeader: bool) -> str: + fullWidthTimelineButtonHeader: bool, + iconsAsButtons: bool) -> str: """Show the timeline as html """ timelineStartTime = time.time() @@ -6430,7 +6470,8 @@ def htmlTimeline(defaultTimeline: str, newPostButtonStr, baseDir, nickname, domain, iconsDir, timelineStartTime, newCalendarEvent, calendarPath, - calendarImage, followApprovals) + calendarImage, followApprovals, + iconsAsButtons) # start the timeline tlStr += '