From ffdc49a56c0a34c7de841a44bc96c7f90e940c36 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Wed, 9 Dec 2020 13:08:26 +0000 Subject: [PATCH] Remove icons path variable --- blog.py | 22 +++------ inbox.py | 3 +- webapp_calendar.py | 10 ++-- webapp_column_left.py | 11 ++--- webapp_column_right.py | 25 ++++------ webapp_confirm.py | 4 +- webapp_create_post.py | 34 ++++++------- webapp_frontscreen.py | 13 ++--- webapp_headerbuttons.py | 10 ++-- webapp_post.py | 107 +++++++++++++++++++--------------------- webapp_profile.py | 21 +++----- webapp_search.py | 18 +++---- webapp_timeline.py | 39 ++++++--------- webapp_utils.py | 13 ++--- 14 files changed, 137 insertions(+), 193 deletions(-) diff --git a/blog.py b/blog.py index b0681a5e6..418821163 100644 --- a/blog.py +++ b/blog.py @@ -10,7 +10,6 @@ import os from datetime import datetime from content import replaceEmojiFromTags -from webapp_utils import getIconsWebPath from webapp_utils import htmlHeaderWithExternalStyle from webapp_utils import htmlFooter from webapp_utils import getPostAttachmentsAsHtml @@ -392,7 +391,6 @@ def htmlBlogPost(authorized: bool, None, False) # show rss links - iconsPath = getIconsWebPath(baseDir) blogStr += '

' blogStr += '' + 'icons/logorss.png" />' # blogStr += '' # blogStr += 'RSS 3.0' + # 'icons/rss3.png" />' blogStr += '

' @@ -452,7 +450,6 @@ def htmlBlogPage(authorized: bool, session, # show previous and next buttons if pageNumber is not None: - iconsPath = getIconsWebPath(baseDir) navigateStr = '

' if pageNumber > 1: # show previous button @@ -460,7 +457,7 @@ def htmlBlogPage(authorized: bool, session, domainFull + '/blog/' + \ nickname + '?page=' + str(pageNumber-1) + '">' + \ '<\n' if len(timelineJson['orderedItems']) >= noOfItems: # show next button @@ -468,7 +465,7 @@ def htmlBlogPage(authorized: bool, session, domainFull + '/blog/' + nickname + \ '?page=' + str(pageNumber + 1) + '">' + \ '>\n' navigateStr += '

' blogStr += navigateStr @@ -493,13 +490,13 @@ def htmlBlogPage(authorized: bool, session, domainFull + '/blog/' + nickname + '/rss.xml">' blogStr += 'RSS 2.0' + 'icons/logorss.png" />' # blogStr += '' # blogStr += 'RSS 3.0' + # 'icons/rss3.png" />' blogStr += '

' return blogStr + htmlFooter() @@ -723,8 +720,6 @@ def htmlEditBlog(mediaInstance: bool, translate: {}, print('Edit blog: json not loaded for ' + postFilename) return None - iconsPath = getIconsWebPath(baseDir) - editBlogText = '' + translate['Write your post text below.'] + '' if os.path.isfile(baseDir + '/accounts/newpost.txt'): @@ -765,8 +760,7 @@ def htmlEditBlog(mediaInstance: bool, translate: {}, dateAndLocation += \ '

' + 'class="emojicalendar" src="/icons/calendar.png"/>' dateAndLocation += \ '' dateAndLocation += '' @@ -797,7 +791,7 @@ def htmlEditBlog(mediaInstance: bool, translate: {}, editBlogForm += '

' editBlogForm += \ - ' ' + \ scopeDescription + '' editBlogForm += '
' diff --git a/inbox.py b/inbox.py index 5bcabcbe3..dedaef80d 100644 --- a/inbox.py +++ b/inbox.py @@ -58,7 +58,6 @@ from posts import isMuted from posts import isImageMedia from posts import sendSignedJson from posts import sendToFollowersThread -from webapp_utils import getIconsWebPath from webapp_post import individualPostAsHtml from question import questionUpdateVotes from media import replaceYouTube @@ -173,7 +172,7 @@ def inboxStorePostToHtmlCache(recentPostsCache: {}, maxRecentPosts: int, if boxname != 'tlevents' and boxname != 'outbox': boxname = 'inbox' individualPostAsHtml(True, recentPostsCache, maxRecentPosts, - getIconsWebPath(baseDir), translate, pageNumber, + 'icons', translate, pageNumber, baseDir, session, cachedWebfingers, personCache, nickname, domain, port, postJsonObject, avatarUrl, True, allowDeletion, diff --git a/webapp_calendar.py b/webapp_calendar.py index f0a90d67a..7b5b25bd3 100644 --- a/webapp_calendar.py +++ b/webapp_calendar.py @@ -20,7 +20,6 @@ from happening import getCalendarEvents from webapp_utils import htmlHeaderWithExternalStyle from webapp_utils import htmlFooter from webapp_utils import getAltPath -from webapp_utils import getIconsWebPath def htmlCalendarDeleteConfirm(cssCache: {}, translate: {}, baseDir: str, @@ -122,8 +121,6 @@ def htmlCalendarDay(cssCache: {}, translate: {}, calendarStr += '\n' calendarStr += '\n' - iconsPath = getIconsWebPath(baseDir) - if dayEvents: for eventPost in dayEvents: eventTime = None @@ -156,7 +153,7 @@ def htmlCalendarDay(cssCache: {}, translate: {}, '">\n' + \
                     translate['Delete this event'] + ' |\n' + 'icons/delete.png" />\n' if eventTime and eventDescription and eventPlace: calendarStr += \ @@ -201,7 +198,6 @@ def htmlCalendar(cssCache: {}, translate: {}, httpPrefix: str, domainFull: str) -> str: """Show the calendar for a person """ - iconsPath = getIconsWebPath(baseDir) domain = domainFull if ':' in domainFull: domain = domainFull.split(':')[0] @@ -302,7 +298,7 @@ def htmlCalendar(cssCache: {}, translate: {}, '?month=' + str(prevMonthNumber) + '">' calendarStr += \ ' ' + translate['Previous month'] + \
-        '\n' calendarStr += ' ' @@ -312,7 +308,7 @@ def htmlCalendar(cssCache: {}, translate: {}, '?month=' + str(nextMonthNumber) + '">' calendarStr += \ ' ' + translate['Next month'] + \
-        '\n' calendarStr += '\n' calendarStr += '\n' diff --git a/webapp_column_left.py b/webapp_column_left.py index 589333b6d..4a3a18c45 100644 --- a/webapp_column_left.py +++ b/webapp_column_left.py @@ -16,7 +16,6 @@ from webapp_utils import htmlPostSeparator from webapp_utils import getLeftImageFile from webapp_utils import getImageFile from webapp_utils import headerButtonsFrontScreen -from webapp_utils import getIconsWebPath from webapp_utils import htmlHeaderWithExternalStyle from webapp_utils import htmlFooter from webapp_utils import getBannerFile @@ -136,7 +135,7 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str, '" loading="lazy" alt="' + \ translate['Edit Links'] + '" title="' + \ translate['Edit Links'] + '" src="/' + \ - iconsPath + '/edit.png" />\n' + 'icons/edit.png" />\n' # RSS icon if nickname != 'news': @@ -155,7 +154,7 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str, '' + rssTitle + \
         '\n' + '" src="/icons/logorss.png" />\n' if rssIconAtTop: htmlStr += rssIconStr htmlStr += ' \n' @@ -264,8 +263,6 @@ def htmlLinksMobile(cssCache: {}, baseDir: str, if os.path.isfile(baseDir + '/epicyon.css'): cssFilename = baseDir + '/epicyon.css' - iconsPath = getIconsWebPath(baseDir) - # is the user a site editor? if nickname == 'news': editor = False @@ -287,12 +284,12 @@ def htmlLinksMobile(cssCache: {}, baseDir: str, htmlStr += '
' + \ headerButtonsFrontScreen(translate, nickname, 'links', authorized, - iconsAsButtons, iconsPath) + '
' + iconsAsButtons, 'icons') + '' if linksExist(baseDir): htmlStr += \ getLeftColumnContent(baseDir, nickname, domainFull, httpPrefix, translate, - iconsPath, editor, + 'icons', editor, False, timelinePath, rssIconAtTop, False, False) else: diff --git a/webapp_column_right.py b/webapp_column_right.py index 78df295f6..925199361 100644 --- a/webapp_column_right.py +++ b/webapp_column_right.py @@ -25,7 +25,6 @@ from webapp_utils import htmlFooter from webapp_utils import getBannerFile from webapp_utils import htmlPostSeparator from webapp_utils import headerButtonsFrontScreen -from webapp_utils import getIconsWebPath def votesIndicator(totalVotes: int, positiveVoting: bool) -> str: @@ -143,7 +142,7 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str, '" loading="lazy" alt="' + \ translate['Edit newswire'] + '" title="' + \ translate['Edit newswire'] + '" src="/' + \ - iconsPath + '/edit_notify.png" />\n' + 'icons/edit_notify.png" />\n' else: # show the edit icon htmlStr += \ @@ -153,7 +152,7 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str, '" loading="lazy" alt="' + \ translate['Edit newswire'] + '" title="' + \ translate['Edit newswire'] + '" src="/' + \ - iconsPath + '/edit.png" />\n' + 'icons/edit.png" />\n' # show the RSS icons rssIconStr = \ @@ -162,14 +161,14 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str, '" loading="lazy" alt="' + \ translate['Hashtag Categories RSS Feed'] + '" title="' + \ translate['Hashtag Categories RSS Feed'] + '" src="/' + \ - iconsPath + '/categoriesrss.png" />\n' + 'icons/categoriesrss.png" />\n' rssIconStr += \ ' ' + \ '' + \
         translate['Newswire RSS Feed'] + '\n' + 'icons/logorss.png" />\n' if rssIconAtTop: htmlStr += rssIconStr @@ -183,7 +182,7 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str, '" loading="lazy" alt="' + \ translate['Publish a news article'] + '" title="' + \ translate['Publish a news article'] + '" src="/' + \ - iconsPath + '/publish.png" />\n' + 'icons/publish.png" />\n' if editImageClass == 'rightColEdit': htmlStr += ' \n' @@ -197,7 +196,7 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str, # show the newswire lines newswireContentStr = \ htmlNewswire(baseDir, newswire, nickname, moderator, translate, - positiveVoting, iconsPath) + positiveVoting, 'icons') htmlStr += newswireContentStr # show the rss icon at the bottom, typically on the right hand side @@ -252,7 +251,7 @@ def htmlNewswire(baseDir: str, newswire: {}, nickname: str, moderator: bool, '/newswireunvote=' + dateStrLink + '" ' + \ 'title="' + translate['Remove Vote'] + '">' htmlStr += '

\n' + 'icons/vote.png" />

\n' else: htmlStr += ' ' htmlStr += dateShown + '

\n' @@ -277,7 +276,7 @@ def htmlNewswire(baseDir: str, newswire: {}, nickname: str, moderator: bool, '/newswirevote=' + dateStrLink + '" ' + \ 'title="' + translate['Vote'] + '">' htmlStr += '' + 'icons/vote.png" />' htmlStr += '

\n' else: htmlStr += '

' + \ @@ -324,8 +323,6 @@ def htmlCitations(baseDir: str, nickname: str, domain: str, if os.path.isfile(baseDir + '/epicyon.css'): cssFilename = baseDir + '/epicyon.css' - # iconsPath = getIconsWebPath(baseDir) - htmlStr = htmlHeaderWithExternalStyle(cssFilename) # top banner @@ -422,8 +419,6 @@ def htmlNewswireMobile(cssCache: {}, baseDir: str, nickname: str, if os.path.isfile(baseDir + '/epicyon.css'): cssFilename = baseDir + '/epicyon.css' - iconsPath = getIconsWebPath(baseDir) - if nickname == 'news': editor = False moderator = False @@ -449,12 +444,12 @@ def htmlNewswireMobile(cssCache: {}, baseDir: str, nickname: str, htmlStr += '

' + \ headerButtonsFrontScreen(translate, nickname, 'newswire', authorized, - iconsAsButtons, iconsPath) + '
' + iconsAsButtons, 'icons') + '' if newswire: htmlStr += \ getRightColumnContent(baseDir, nickname, domainFull, httpPrefix, translate, - iconsPath, moderator, editor, + 'icons', moderator, editor, newswire, positiveVoting, False, timelinePath, showPublishButton, showPublishAsIcon, rssIconAtTop, False, diff --git a/webapp_confirm.py b/webapp_confirm.py index 3a468ef7f..5981e5f60 100644 --- a/webapp_confirm.py +++ b/webapp_confirm.py @@ -13,7 +13,6 @@ from utils import getDomainFromActor from utils import locatePost from utils import loadJson from webapp_utils import getAltPath -from webapp_utils import getIconsWebPath from webapp_utils import htmlHeaderWithExternalStyle from webapp_utils import htmlFooter from webapp_post import individualPostAsHtml @@ -33,7 +32,6 @@ def htmlConfirmDelete(cssCache: {}, """ if '/statuses/' not in messageId: return None - iconsPath = getIconsWebPath(baseDir) actor = messageId.split('/statuses/')[0] nickname = getNicknameFromActor(actor) domain, port = getDomainFromActor(actor) @@ -63,7 +61,7 @@ def htmlConfirmDelete(cssCache: {}, deletePostStr = htmlHeaderWithExternalStyle(cssFilename) deletePostStr += \ individualPostAsHtml(True, recentPostsCache, maxRecentPosts, - iconsPath, translate, pageNumber, + 'icons', translate, pageNumber, baseDir, session, wfRequest, personCache, nickname, domain, port, postJsonObject, None, True, False, diff --git a/webapp_create_post.py b/webapp_create_post.py index 00b684208..5a1416b47 100644 --- a/webapp_create_post.py +++ b/webapp_create_post.py @@ -12,7 +12,6 @@ from utils import getNicknameFromActor from utils import getDomainFromActor from utils import getImageFormats from utils import getMediaFormats -from webapp_utils import getIconsWebPath from webapp_utils import getBannerFile from webapp_utils import htmlHeaderWithExternalStyle from webapp_utils import htmlFooter @@ -81,7 +80,7 @@ def htmlNewPostDropDown(scopeIcon: str, scopeDescription: str, dropDownContent += ' \n' dropDownContent += '
    \n' @@ -89,58 +88,58 @@ def htmlNewPostDropDown(scopeIcon: str, scopeDescription: str, dropDownContent += \ '
  • ' + \ + 'icons/scope_public.png"/>' + \ translate['Public'] + '
    ' + \ translate['Visible to anyone'] + '
  • \n' if defaultTimeline == 'tlfeatures': dropDownContent += \ '
  • ' + \ + 'icons/scope_blog.png"/>' + \ translate['Article'] + '
    ' + \ translate['Create an article'] + '
  • \n' else: dropDownContent += \ '
  • ' + \ + 'icons/scope_blog.png"/>' + \ translate['Blog'] + '
    ' + \ translate['Publicly visible post'] + '
  • \n' dropDownContent += \ '
  • ' + \ + 'icons/scope_unlisted.png"/>' + \ translate['Unlisted'] + '
    ' + \ translate['Not on public timeline'] + '
  • \n' dropDownContent += \ '
  • ' + \ + 'icons/scope_followers.png"/>' + \ translate['Followers'] + '
    ' + \ translate['Only to followers'] + '
  • \n' dropDownContent += \ '
  • ' + \ + 'icons/scope_dm.png"/>' + \ translate['DM'] + '
    ' + \ translate['Only to mentioned people'] + '
  • \n' dropDownContent += \ '
  • ' + \ + 'icons/scope_reminder.png"/>' + \ translate['Reminder'] + '
    ' + \ translate['Scheduled note to yourself'] + '
  • \n' dropDownContent += \ '
  • ' + \ + 'icons/scope_event.png"/>' + \ translate['Event'] + '
    ' + \ translate['Create an event'] + '
  • \n' dropDownContent += \ '
  • ' + \ + 'icons/scope_report.png"/>' + \ translate['Report'] + '
    ' + \ translate['Send to moderators'] + '
  • \n' @@ -148,13 +147,13 @@ def htmlNewPostDropDown(scopeIcon: str, scopeDescription: str, dropDownContent += \ '
  • ' + \ + 'icons/scope_share.png"/>' + \ translate['Shares'] + '
    ' + \ translate['Describe a shared item'] + '
  • \n' dropDownContent += \ '
  • ' + \ + 'icons/scope_question.png"/>' + \ translate['Question'] + '
    ' + \ translate['Ask a question'] + '
  • \n' @@ -174,7 +173,6 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, defaultTimeline: str, newswire: {}) -> str: """New post screen """ - iconsPath = getIconsWebPath(baseDir) replyStr = '' showPublicOnDropdown = True @@ -495,7 +493,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, dateAndLocation += \ '

    \n' + 'icons/calendar.png"/>\n' # select a date and time for this post dateAndLocation += '\n' @@ -510,7 +508,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, dateAndLocation += \ '

    \n' + 'icons/calendar.png"/>\n' # select start time for the event dateAndLocation += '\n' @@ -523,7 +521,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, dateAndLocation += \ '
    \n' + 'icons/calendar.png"/>\n' dateAndLocation += '\n' dateAndLocation += '\n' @@ -621,7 +619,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, htmlNewPostDropDown(scopeIcon, scopeDescription, replyStr, translate, - iconsPath, + 'icons', showPublicOnDropdown, defaultTimeline, pathBase, diff --git a/webapp_frontscreen.py b/webapp_frontscreen.py index d8e7e5b90..7c78a1aed 100644 --- a/webapp_frontscreen.py +++ b/webapp_frontscreen.py @@ -12,7 +12,6 @@ from utils import getDomainFromActor from person import personBoxJson from webapp_utils import htmlHeaderWithExternalStyle from webapp_utils import htmlFooter -from webapp_utils import getIconsWebPath from webapp_utils import getBannerFile from webapp_utils import htmlPostSeparator from webapp_utils import headerButtonsFrontScreen @@ -33,7 +32,6 @@ def htmlFrontScreenPosts(recentPostsCache: {}, maxRecentPosts: int, These should only be public blog posts from the features timeline which is the blog timeline of the news actor """ - iconsPath = getIconsWebPath(baseDir) separatorStr = htmlPostSeparator(baseDir, None) profileStr = '' maxItems = 4 @@ -57,7 +55,7 @@ def htmlFrontScreenPosts(recentPostsCache: {}, maxRecentPosts: int, postStr = \ individualPostAsHtml(True, recentPostsCache, maxRecentPosts, - iconsPath, translate, None, + 'icons', translate, None, baseDir, session, wfRequest, personCache, nickname, domain, port, item, @@ -101,10 +99,9 @@ def htmlFrontScreen(rssIconAtTop: bool, if port: domainFull = domain + ':' + str(port) - iconsPath = getIconsWebPath(baseDir) loginButton = headerButtonsFrontScreen(translate, nickname, 'features', authorized, - iconsAsButtons, iconsPath) + iconsAsButtons, 'icons') # If this is the news account then show a different banner bannerFile, bannerFilename = getBannerFile(baseDir, nickname, domain) @@ -123,11 +120,10 @@ def htmlFrontScreen(rssIconAtTop: bool, profileHeaderStr += ' \n' profileHeaderStr += ' \n' profileHeaderStr += ' \n' - iconsPath = getIconsWebPath(baseDir) profileHeaderStr += \ getLeftColumnContent(baseDir, 'news', domainFull, httpPrefix, translate, - iconsPath, False, + 'icons', False, False, None, rssIconAtTop, True, True) profileHeaderStr += ' \n' @@ -155,11 +151,10 @@ def htmlFrontScreen(rssIconAtTop: bool, # Footer which is only used for system accounts profileFooterStr = ' \n' profileFooterStr += ' \n' - iconsPath = getIconsWebPath(baseDir) profileFooterStr += \ getRightColumnContent(baseDir, 'news', domainFull, httpPrefix, translate, - iconsPath, False, False, + 'icons', False, False, newswire, False, False, None, False, False, False, True, authorized, True) diff --git a/webapp_headerbuttons.py b/webapp_headerbuttons.py index ae987be95..92486927f 100644 --- a/webapp_headerbuttons.py +++ b/webapp_headerbuttons.py @@ -212,7 +212,7 @@ def headerButtonsTimeline(defaultTimeline: str, tlStr += \ '| ' + \
                 translate['Search and follow'] + \
                 '' @@ -239,7 +239,7 @@ def headerButtonsTimeline(defaultTimeline: str, tlStr += \ ' | ' + calendarAltText + \
                 '\n' @@ -256,7 +256,7 @@ def headerButtonsTimeline(defaultTimeline: str, tlStr += \ ' | ' + translate['Show/Hide Buttons'] + \
                 '\n' @@ -278,7 +278,7 @@ def headerButtonsTimeline(defaultTimeline: str, tlStr += \ '' + \ - '| ' + translate['News'] + \
             '' @@ -296,7 +296,7 @@ def headerButtonsTimeline(defaultTimeline: str, tlStr += \ '' + \ - '| ' + translate['Edit Links'] + \
             '' diff --git a/webapp_post.py b/webapp_post.py index d2bad9612..bc7f67940 100644 --- a/webapp_post.py +++ b/webapp_post.py @@ -53,7 +53,6 @@ from webapp_utils import addEmojiToDisplayName from webapp_utils import postContainsPublic from webapp_utils import getContentWarningButton from webapp_utils import getPostAttachmentsAsHtml -from webapp_utils import getIconsWebPath from webapp_utils import htmlHeaderWithExternalStyle from webapp_utils import htmlFooter from webapp_media import addEmbeddedElements @@ -207,7 +206,7 @@ def getBrokenLinkSubstitute(iconsPath: str) -> str: an image is broken """ return " onerror=\"this.onerror=null; this.src='" + \ - iconsPath + "/avatar_default.png'\"" + "icons/avatar_default.png'\"" def getAvatarImageHtml(showAvatarOptions: bool, @@ -224,7 +223,7 @@ def getAvatarImageHtml(showAvatarOptions: bool, avatarLink += \ '  \n' + getBrokenLinkSubstitute('icons') + '/>\n' if showAvatarOptions and \ domainFull + '/users/' + nickname not in postActor: @@ -237,14 +236,14 @@ def getAvatarImageHtml(showAvatarOptions: bool, ' \n' + getBrokenLinkSubstitute('icons') + '/>\n' else: # don't link to the person options for the news account avatarLink += \ ' \n' + getBrokenLinkSubstitute('icons') + '/>\n' return avatarLink.strip() @@ -303,7 +302,7 @@ def getReplyIconHtml(nickname: str, isPublicRepeat: bool, ' ' + \ '' + replyToThisPostStr + \
-        ' |\n' + ' |" src="/icons/reply.png"/>\n' return replyStr @@ -336,7 +335,7 @@ def getEditIconHtml(baseDir: str, nickname: str, domainFull: str, '" title="' + editBlogPostStr + '">' + \ '' + editBlogPostStr + \
-                    ' |\n' + ' |" src="/icons/edit.png"/>\n' else: editStr += \ ' ' + \ @@ -347,7 +346,7 @@ def getEditIconHtml(baseDir: str, nickname: str, domainFull: str, '" title="' + editBlogPostStr + '">' + \ '' + editBlogPostStr + \
-                    ' |\n' + ' |" src="/icons/edit.png"/>\n' elif isEvent: editEventStr = translate['Edit event'] editStr += \ @@ -359,7 +358,7 @@ def getEditIconHtml(baseDir: str, nickname: str, domainFull: str, '" title="' + editEventStr + '">' + \ '' + editEventStr + \
-                ' |\n' + ' |" src="/icons/edit.png"/>\n' return editStr @@ -401,7 +400,7 @@ def getAnnounceIconHtml(nickname: str, domainFull: str, ' ' + \ '' + translate['Repeat this post'] + \
-            ' |\n' + ' |" src="/icons/' + announceIcon + '"/>\n' return announceStr @@ -459,7 +458,7 @@ def getLikeIconHtml(nickname: str, domainFull: str, ' ' + \ '' + likeTitle + \
-            ' |\n' + ' |" src="/icons/' + likeIcon + '"/>\n' return likeStr @@ -497,7 +496,7 @@ def getBookmarkIconHtml(nickname: str, domainFull: str, bookmarkStr += \ ' ' + \ '' + \
-        bookmarkTitle + ' |\n' return bookmarkStr @@ -531,7 +530,7 @@ def getMuteIconHtml(isMuted: bool, '' + \
             translate['Mute this post'] + \
             ' |\n' + '" src="/icons/mute.png"/>\n' else: muteStr = \ ' \n' + '" src="/icons/unmute.png"/>\n' return muteStr @@ -573,7 +572,7 @@ def getDeleteIconHtml(nickname: str, domainFull: str, '' + \
                     translate['Delete this post'] + \
                     ' |\n' + '" src="/icons/delete.png"/>\n' return deleteStr @@ -651,7 +650,7 @@ def boostOwnTootHtml(translate: {}, iconsPath) -> str: return ' ' + translate['announces'] + \
-        '\n' @@ -662,7 +661,7 @@ def announceUnattributedHtml(translate: {}, iconsPath: str, """ return ' ' + \
-        translate['announces'] + '\n' + \ ' \n' + \ ' @' + \ @@ -695,7 +694,7 @@ def announceWithDisplayNameHtml(translate: {}, return ' ' + \
         translate['announces'] + '\n' + \ ' \n \n' else: titleStr += \ - announceWithoutDisplayNameHtml(translate, iconsPath, + announceWithoutDisplayNameHtml(translate, 'icons', announceNickname, announceDomain, postJsonObject) else: titleStr += \ - announceUnattributedHtml(translate, iconsPath, + announceUnattributedHtml(translate, 'icons', postJsonObject) else: titleStr += \ - announceUnattributedHtml(translate, iconsPath, postJsonObject) + announceUnattributedHtml(translate, 'icons', postJsonObject) return (titleStr, replyAvatarImageInPost, containerClassIcons, containerClass) @@ -817,7 +816,7 @@ def replyToYourselfHtml(translate: {}, iconsPath: str) -> str: return ' ' + translate['replying to themselves'] + \
-        '\n' @@ -827,8 +826,7 @@ def replyToUnknownHtml(translate: {}, iconsPath: str, """ return ' ' + \
-        translate['replying to'] + '\n' + \ ' \n' + \ ' \n' + \ ' ' + \ @@ -877,7 +874,7 @@ def getReplyWithoutDisplayName(translate: {}, iconsPath: str, return ' ' + \ '' + translate['replying to'] + \
-        '\n' + ' @' + \ replyNickname + '@' + replyDomain + '\n' @@ -915,7 +912,7 @@ def getPostTitleReplyHtml(baseDir: str, containerClassIcons = 'containericons darker' containerClass = 'container darker' if postJsonObject['object']['inReplyTo'].startswith(postActor): - titleStr += replyToYourselfHtml(translate, iconsPath) + titleStr += replyToYourselfHtml(translate, 'icons') return (titleStr, replyAvatarImageInPost, containerClassIcons, containerClass) @@ -948,7 +945,7 @@ def getPostTitleReplyHtml(baseDir: str, logPostTiming(enableTimingLog, postStartTime, '13.6') titleStr += \ - getReplyHtml(translate, iconsPath, + getReplyHtml(translate, 'icons', inReplyTo, replyDisplayName) logPostTiming(enableTimingLog, postStartTime, '13.7') @@ -984,18 +981,18 @@ def getPostTitleReplyHtml(baseDir: str, replyAvatarImageInPost += \ '" alt=" "' + \ avatarPosition + \ - getBrokenLinkSubstitute(iconsPath) + \ + getBrokenLinkSubstitute('icons') + \ '/>\n \n' else: inReplyTo = \ postJsonObject['object']['inReplyTo'] titleStr += \ - getReplyWithoutDisplayName(translate, iconsPath, + getReplyWithoutDisplayName(translate, 'icons', inReplyTo, replyNickname, replyDomain) else: titleStr += \ - replyToUnknownHtml(translate, iconsPath, postJsonObject) + replyToUnknownHtml(translate, 'icons', postJsonObject) else: postDomain = \ postJsonObject['object']['inReplyTo'] @@ -1006,7 +1003,7 @@ def getPostTitleReplyHtml(baseDir: str, postDomain = postDomain.split('/', 1)[0] if postDomain: titleStr += \ - replyWithUnknownPathHtml(translate, iconsPath, + replyWithUnknownPathHtml(translate, 'icons', postJsonObject, postDomain) return (titleStr, replyAvatarImageInPost, @@ -1050,7 +1047,7 @@ def getPostTitleHtml(baseDir: str, postJsonObject, postActor, translate, - iconsPath, + 'icons', enableTimingLog, postStartTime, boxName, @@ -1070,7 +1067,7 @@ def getPostTitleHtml(baseDir: str, postJsonObject, postActor, translate, - iconsPath, + 'icons', enableTimingLog, postStartTime, boxName, @@ -1225,7 +1222,7 @@ def individualPostAsHtml(allowDownloads: bool, avatarUrl, postActor, translate, avatarPosition, pageNumber, messageIdStr, - iconsPath) + 'icons') avatarImageInPost = \ '

    ' + avatarLink + '
    \n' @@ -1322,7 +1319,7 @@ def individualPostAsHtml(allowDownloads: bool, if showDMicon: titleStr = \ titleStr + ' \n' + 'icons/dm.png" class="DMicon"/>\n' # check if replying is permitted commentsEnabled = True @@ -1333,7 +1330,7 @@ def individualPostAsHtml(allowDownloads: bool, replyStr = getReplyIconHtml(nickname, isPublicRepeat, showIcons, commentsEnabled, postJsonObject, pageNumberParam, - iconsPath, translate) + 'icons', translate) logPostTiming(enableTimingLog, postStartTime, '10') @@ -1343,7 +1340,7 @@ def individualPostAsHtml(allowDownloads: bool, editStr = getEditIconHtml(baseDir, nickname, domainFull, postJsonObject, actorNickname, - translate, iconsPath, isEvent) + translate, 'icons', isEvent) announceStr = \ getAnnounceIconHtml(nickname, domainFull, @@ -1354,7 +1351,7 @@ def individualPostAsHtml(allowDownloads: bool, translate, pageNumberParam, timelinePostBookmark, - boxName, iconsPath) + boxName, 'icons') logPostTiming(enableTimingLog, postStartTime, '12') @@ -1373,7 +1370,7 @@ def individualPostAsHtml(allowDownloads: bool, postStartTime, translate, pageNumberParam, timelinePostBookmark, - boxName, iconsPath) + boxName, 'icons') logPostTiming(enableTimingLog, postStartTime, '12.5') @@ -1386,7 +1383,7 @@ def individualPostAsHtml(allowDownloads: bool, postStartTime, boxName, pageNumberParam, timelinePostBookmark, - iconsPath) + 'icons') logPostTiming(enableTimingLog, postStartTime, '12.9') @@ -1401,7 +1398,7 @@ def individualPostAsHtml(allowDownloads: bool, nickname, domainFull, allowDeletion, pageNumberParam, - iconsPath, + 'icons', boxName, timelinePostBookmark, translate) @@ -1413,7 +1410,7 @@ def individualPostAsHtml(allowDownloads: bool, messageId, postJsonObject, pageNumberParam, - iconsPath, + 'icons', translate) logPostTiming(enableTimingLog, postStartTime, '13.1') @@ -1430,7 +1427,7 @@ def individualPostAsHtml(allowDownloads: bool, postJsonObject, postActor, translate, - iconsPath, + 'icons', enableTimingLog, postStartTime, boxName, @@ -1627,7 +1624,6 @@ def htmlIndividualPost(cssCache: {}, showPublishedDateOnly: bool) -> str: """Show an individual post as html """ - iconsPath = getIconsWebPath(baseDir) postStr = '' if likedBy: likedByNickname = getNicknameFromActor(likedBy) @@ -1663,7 +1659,7 @@ def htmlIndividualPost(cssCache: {}, postStr += \ individualPostAsHtml(True, recentPostsCache, maxRecentPosts, - iconsPath, translate, None, + 'icons', translate, None, baseDir, session, wfRequest, personCache, nickname, domain, port, postJsonObject, None, True, False, @@ -1686,7 +1682,7 @@ def htmlIndividualPost(cssCache: {}, postStr = \ individualPostAsHtml(True, recentPostsCache, maxRecentPosts, - iconsPath, translate, None, + 'icons', translate, None, baseDir, session, wfRequest, personCache, nickname, domain, port, @@ -1715,7 +1711,7 @@ def htmlIndividualPost(cssCache: {}, postStr += \ individualPostAsHtml(True, recentPostsCache, maxRecentPosts, - iconsPath, translate, None, + 'icons', translate, None, baseDir, session, wfRequest, personCache, nickname, domain, port, item, @@ -1742,14 +1738,13 @@ def htmlPostReplies(cssCache: {}, showPublishedDateOnly: bool) -> str: """Show the replies to an individual post as html """ - iconsPath = getIconsWebPath(baseDir) repliesStr = '' if repliesJson.get('orderedItems'): for item in repliesJson['orderedItems']: repliesStr += \ individualPostAsHtml(True, recentPostsCache, maxRecentPosts, - iconsPath, translate, None, + 'icons', translate, None, baseDir, session, wfRequest, personCache, nickname, domain, port, item, None, True, False, diff --git a/webapp_profile.py b/webapp_profile.py index a7f3df790..fce7f2a2f 100644 --- a/webapp_profile.py +++ b/webapp_profile.py @@ -35,7 +35,6 @@ from jami import getJamiAddress from webapp_frontscreen import htmlFrontScreen from webapp_utils import scheduledPostsExist from webapp_utils import getPersonAvatarUrl -from webapp_utils import getIconsWebPath from webapp_utils import htmlHeaderWithExternalStyle from webapp_utils import htmlFooter from webapp_utils import addEmojiToDisplayName @@ -256,7 +255,6 @@ def htmlProfileAfterSearch(cssCache: {}, profileStr += ' \n' profileStr += '\n' - iconsPath = getIconsWebPath(baseDir) i = 0 for item in parseUserFeed(session, outboxUrl, asHeader, projectVersion, httpPrefix, domain): @@ -268,7 +266,7 @@ def htmlProfileAfterSearch(cssCache: {}, continue profileStr += \ individualPostAsHtml(True, recentPostsCache, maxRecentPosts, - iconsPath, translate, None, baseDir, + 'icons', translate, None, baseDir, session, cachedWebfingers, personCache, nickname, domain, port, item, avatarUrl, False, False, @@ -313,7 +311,7 @@ def getProfileHeader(baseDir: str, nickname: str, domain: str, ' ' + \ - '

    \n' htmlStr += '

    ' + profileDescriptionShort + '

    \n' htmlStr += loginButton @@ -481,17 +479,16 @@ def htmlProfile(rssIconAtTop: bool, donateSection += ' \n' donateSection += '\n' - iconsPath = getIconsWebPath(baseDir) if authorized: editProfileStr = \ '' + \ - '| ' + translate['Edit'] + '\n' logoutStr = \ '' + \ - '| ' + translate['Logout'] + \
             '\n' @@ -564,7 +561,7 @@ def htmlProfile(rssIconAtTop: bool, avatarUrl = profileJson['icon']['url'] profileHeaderStr = \ getProfileHeader(baseDir, nickname, domain, - domainFull, translate, iconsPath, + domainFull, translate, 'icons', defaultTimeline, displayName, avatarDescription, profileDescriptionShort, @@ -672,7 +669,6 @@ def htmlProfilePosts(recentPostsCache: {}, maxRecentPosts: int, """Shows posts on the profile screen These should only be public posts """ - iconsPath = getIconsWebPath(baseDir) separatorStr = htmlPostSeparator(baseDir, None) profileStr = '' maxItems = 4 @@ -697,7 +693,7 @@ def htmlProfilePosts(recentPostsCache: {}, maxRecentPosts: int, postStr = \ individualPostAsHtml(True, recentPostsCache, maxRecentPosts, - iconsPath, translate, None, + 'icons', translate, None, baseDir, session, wfRequest, personCache, nickname, domain, port, item, @@ -728,7 +724,6 @@ def htmlProfileFollowing(translate: {}, baseDir: str, httpPrefix: str, """ profileStr = '' - iconsPath = getIconsWebPath(baseDir) if authorized and pageNumber: if authorized and pageNumber > 1: # page up arrow @@ -737,7 +732,7 @@ def htmlProfileFollowing(translate: {}, baseDir: str, httpPrefix: str, ' ' + \
                 translate['Page up'] + '\n' + \ ' \n' @@ -757,7 +752,7 @@ def htmlProfileFollowing(translate: {}, baseDir: str, httpPrefix: str, ' ' + \
                 translate['Page down'] + '\n' + \ ' \n' diff --git a/webapp_search.py b/webapp_search.py index 2733fe8cc..8015d75b2 100644 --- a/webapp_search.py +++ b/webapp_search.py @@ -23,7 +23,6 @@ from utils import getHashtagCategory from feeds import rss2TagHeader from feeds import rss2TagFooter from webapp_utils import getAltPath -from webapp_utils import getIconsWebPath from webapp_utils import getImageFile from webapp_utils import htmlHeaderWithExternalStyle from webapp_utils import htmlFooter @@ -102,7 +101,6 @@ def htmlSearchSharedItems(cssCache: {}, translate: {}, callingDomain: str) -> str: """Search results for shared items """ - iconsPath = getIconsWebPath(baseDir) currPage = 1 ctr = 0 sharedItemsForm = '' @@ -215,7 +213,7 @@ def htmlSearchSharedItems(cssCache: {}, translate: {}, '" type="submit" name="submitSearch">\n' sharedItemsForm += \ ' ' + translate['Page up'] + \
@@ -249,7 +247,7 @@ def htmlSearchSharedItems(cssCache: {}, translate: {},
                                 '\n' sharedItemsForm += \ ' ' + translate['Page down'] + \
@@ -559,7 +557,6 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str,
             '</h5></center>'
         return historySearchForm
 
-    iconsPath = getIconsWebPath(baseDir)
     separatorStr = htmlPostSeparator(baseDir, None)
 
     # ensure that the page number is in bounds
@@ -590,7 +587,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str,
         postStr = \
             individualPostAsHtml(True, recentPostsCache,
                                  maxRecentPosts,
-                                 iconsPath, translate, None,
+                                 'icons', translate, None,
                                  baseDir, session, wfRequest,
                                  personCache,
                                  nickname, domain, port,
@@ -635,7 +632,6 @@ def htmlHashtagSearch(cssCache: {},
         print('WARN: hashtag file not found ' + hashtagIndexFile)
         return None
 
-    iconsPath = getIconsWebPath(baseDir)
     separatorStr = htmlPostSeparator(baseDir, None)
 
     # check that the directory for the nickname exists
@@ -682,7 +678,7 @@ def htmlHashtagSearch(cssCache: {},
     hashtagSearchForm += \
         '<img style=\n' + 'icons/logorss.png" />\n' # edit the category for this hashtag if isEditor(baseDir, nickname): @@ -711,7 +707,7 @@ def htmlHashtagSearch(cssCache: {}, ' ' + translate['Page up'] + \
             '\n \n' @@ -756,7 +752,7 @@ def htmlHashtagSearch(cssCache: {}, postStr = \ individualPostAsHtml(allowDownloads, recentPostsCache, maxRecentPosts, - iconsPath, translate, None, + 'icons', translate, None, baseDir, session, wfRequest, personCache, nickname, domain, port, @@ -781,7 +777,7 @@ def htmlHashtagSearch(cssCache: {}, '
    \n' + \ ' ' + translate['Page down'] + '' + \ '
    ' diff --git a/webapp_timeline.py b/webapp_timeline.py index 526f37fca..2895bb931 100644 --- a/webapp_timeline.py +++ b/webapp_timeline.py @@ -12,7 +12,6 @@ from utils import isEditor from utils import removeIdEnding from follow import followerApprovalActive from person import isPersonSnoozed -from webapp_utils import getIconsWebPath from webapp_utils import htmlPostSeparator from webapp_utils import getBannerFile from webapp_utils import htmlHeaderWithExternalStyle @@ -112,10 +111,6 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, if boxName == 'moderation': os.remove(newReportFile) - # directory where icons are found - # This changes depending upon theme - iconsPath = getIconsWebPath(baseDir) - separatorStr = '' if boxName != 'tlmedia': separatorStr = htmlPostSeparator(baseDir, None) @@ -222,7 +217,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, 'class="timelineicon" alt="' + \ translate['Approve follow requests'] + \ '" title="' + translate['Approve follow requests'] + \ - '" src="/' + iconsPath + '/person.png"/>\n' + '" src="/icons/person.png"/>\n' break logTimelineTiming(enableTimingLog, timelineStartTime, boxName, '3') @@ -279,7 +274,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, newPostButtonStr += \ '| ' + translate['Create a new DM'] + \
                 '\n' @@ -295,7 +290,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, newPostButtonStr += \ '| ' + \
                 translate['Create a new post'] + \
                 '\n' @@ -309,7 +304,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, newPostButtonStr += \ '| ' + \
                 translate['Create a new event'] + \
                 '\n' @@ -323,7 +318,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, newPostButtonStr += \ '| ' + \
                 translate['Create a new shared item'] + \
                 '\n' @@ -338,7 +333,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, newPostButtonStr += \ '| ' + \
                     translate['Create a new post'] + \
                     '\n' @@ -352,7 +347,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, newPostButtonStr += \ '| ' + translate['Create a new post'] + \
                     '\n' @@ -388,7 +383,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, sharesButtonStr, bookmarksButtonStr, eventsButtonStr, moderationButtonStr, newPostButtonStr, baseDir, nickname, - domain, iconsPath, timelineStartTime, + domain, 'icons', timelineStartTime, newCalendarEvent, calendarPath, calendarImage, followApprovals, iconsAsButtons) @@ -411,7 +406,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, # left column leftColumnStr = \ getLeftColumnContent(baseDir, nickname, domainFull, - httpPrefix, translate, iconsPath, + httpPrefix, translate, 'icons', editor, False, None, rssIconAtTop, True, False) tlStr += ' ' + \ @@ -430,7 +425,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, sharesButtonStr, bookmarksButtonStr, eventsButtonStr, moderationButtonStr, newPostButtonStr, baseDir, nickname, - domain, iconsPath, timelineStartTime, + domain, 'icons', timelineStartTime, newCalendarEvent, calendarPath, calendarImage, followApprovals, iconsAsButtons) @@ -495,7 +490,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, ' ' + \
             translate['Page up'] + '\n' + \ ' \n' @@ -545,7 +540,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, currTlStr = \ individualPostAsHtml(False, recentPostsCache, maxRecentPosts, - iconsPath, translate, pageNumber, + 'icons', translate, pageNumber, baseDir, session, wfRequest, personCache, nickname, domain, port, @@ -577,7 +572,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, ' ' + \
             translate['Page down'] + '\n' + \ ' \n' @@ -590,7 +585,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str, # right column rightColumnStr = getRightColumnContent(baseDir, nickname, domainFull, - httpPrefix, translate, iconsPath, + httpPrefix, translate, 'icons', moderator, editor, newswire, positiveVoting, False, None, True, @@ -662,13 +657,12 @@ def htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int, timelineStr = '' if pageNumber > 1: - iconsPath = getIconsWebPath(baseDir) timelineStr += \ '
    \n' + \ ' ' + translate['Page up'] + '\n' + \ '
    \n' @@ -686,13 +680,12 @@ def htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int, timelineStr += separatorStr if not lastPage: - iconsPath = getIconsWebPath(baseDir) timelineStr += \ '
    \n' + \ ' ' + translate['Page down'] + '\n' + \ '
    \n' diff --git a/webapp_utils.py b/webapp_utils.py index 9119fc743..537122858 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -110,13 +110,13 @@ def headerButtonsFrontScreen(translate: {}, headerStr += \ ' ' + \ - '| ' + translate['Newswire'] + '\n' headerStr += \ ' ' + \ - '| ' + translate['Links'] + '\n' else: @@ -390,12 +390,6 @@ def getPersonAvatarUrl(baseDir: str, personUrl: str, personCache: {}, return None -def getIconsWebPath(baseDir: str) -> str: - """Returns the web path where icons exist - """ - return 'icons' - - def scheduledPostsExist(baseDir: str, nickname: str, domain: str) -> bool: """Returns true if there are posts scheduled to be delivered """ @@ -832,7 +826,6 @@ def getPostAttachmentsAsHtml(postJsonObject: {}, boxName: str, translate: {}, def htmlPostSeparator(baseDir: str, column: str) -> str: """Returns the html for a timeline post separator image """ - iconsPath = getIconsWebPath(baseDir) theme = getConfigParam(baseDir, 'theme') filename = 'separator.png' separatorClass = "postSeparatorImage" @@ -844,7 +837,7 @@ def htmlPostSeparator(baseDir: str, column: str) -> str: if os.path.isfile(separatorImageFilename): separatorStr = \ '
    ' + \ - '' + \ + '' + \ '
    \n' return separatorStr