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/content.py b/content.py index 9e83b354e..ea41a40ff 100644 --- a/content.py +++ b/content.py @@ -651,6 +651,8 @@ def removeLongWords(content: str, maxWordLength: int, continue elif 'dat:' in wordStr: continue + elif 'rad:' in wordStr: + continue elif 'hyper:' in wordStr: continue elif 'briar:' in wordStr: diff --git a/daemon.py b/daemon.py index eb46e9e29..e02d1909f 100644 --- a/daemon.py +++ b/daemon.py @@ -1856,7 +1856,7 @@ class PubServer(BaseHTTPRequestHandler): baseDir, httpPrefix, reportPath, None, - [optionsActor], None, + [optionsActor], None, None, pageNumber, chooserNickname, domain, @@ -1925,7 +1925,7 @@ class PubServer(BaseHTTPRequestHandler): baseDir, httpPrefix, reportPath, None, [], - postUrl, pageNumber, + None, postUrl, pageNumber, chooserNickname, domain, domainFull, @@ -2392,7 +2392,8 @@ class PubServer(BaseHTTPRequestHandler): # skill search searchStr = searchStr.replace('*', '').strip() skillStr = \ - htmlSkillsSearch(self.server.cssCache, + htmlSkillsSearch(actorStr, + self.server.cssCache, self.server.translate, baseDir, httpPrefix, @@ -3822,9 +3823,8 @@ class PubServer(BaseHTTPRequestHandler): # change theme if fields.get('themeDropdown'): - setTheme(baseDir, - fields['themeDropdown'], - domain, + self.server.themeName = fields['themeDropdown'] + setTheme(baseDir, self.server.themeName, domain, allowLocalNetworkAccess) self.server.showPublishAsIcon = \ getConfigParam(self.server.baseDir, @@ -4196,6 +4196,7 @@ class PubServer(BaseHTTPRequestHandler): '.etag') currTheme = getTheme(baseDir) if currTheme: + self.server.themeName = currTheme setTheme(baseDir, currTheme, domain, self.server.allowLocalNetworkAccess) self.server.showPublishAsIcon = \ @@ -4565,12 +4566,14 @@ class PubServer(BaseHTTPRequestHandler): if 'image/avif' in self.headers['Accept']: favType = 'image/avif' favFilename = 'favicon.avif' - themeName = getConfigParam(baseDir, 'theme') - if not themeName: - themeName = 'default' + if not self.server.themeName: + self.themeName = getConfigParam(baseDir, 'theme') + if not self.server.themeName: + self.server.themeName = 'default' # custom favicon faviconFilename = \ - baseDir + '/theme/' + themeName + '/icons/' + favFilename + baseDir + '/theme/' + self.server.themeName + \ + '/icons/' + favFilename if not os.path.isfile(faviconFilename): # default favicon faviconFilename = \ @@ -5059,7 +5062,10 @@ class PubServer(BaseHTTPRequestHandler): if path.endswith('.png'): mediaStr = path.split('/icons/')[1] if '/' not in mediaStr: - theme = 'default' + if not self.server.themeName: + theme = 'default' + else: + theme = self.server.themeName iconFilename = mediaStr else: theme = mediaStr.split('/')[0] @@ -8961,7 +8967,7 @@ class PubServer(BaseHTTPRequestHandler): httpPrefix, path, inReplyToUrl, replyToList, - shareDescription, + shareDescription, None, replyPageNumber, nickname, domain, domainFull, @@ -10538,26 +10544,41 @@ class PubServer(BaseHTTPRequestHandler): # for moderation posts or the dm timeline if '?replydm=' in self.path: inReplyToUrl = self.path.split('?replydm=')[1] + inReplyToUrl = urllib.parse.unquote_plus(inReplyToUrl) if '?' in inReplyToUrl: + # multiple parameters mentionsList = inReplyToUrl.split('?') for m in mentionsList: if m.startswith('mention='): replyHandle = m.replace('mention=', '') - if m.replace('mention=', '') not in replyToList: - replyToList.append(m.replace('mention=', '')) - if m.startswith('page='): + inReplyToUrl = replyHandle + if replyHandle not in replyToList: + replyToList.append(replyHandle) + elif m.startswith('page='): replyPageStr = m.replace('page=', '') if replyPageStr.isdigit(): replyPageNumber = int(replyPageStr) -# if m.startswith('actor='): -# replytoActor = m.replace('actor=', '') - inReplyToUrl = mentionsList[0] - if inReplyToUrl.startswith('sharedesc:'): + elif m.startswith('sharedesc:'): + # get the title for the shared item + shareDescription = \ + m.replace('sharedesc:', '').strip() + shareDescription = \ + shareDescription.replace('_', ' ') + else: + # single parameter + if inReplyToUrl.startswith('mention='): + replyHandle = inReplyToUrl.replace('mention=', '') + inReplyToUrl = replyHandle + if replyHandle not in replyToList: + replyToList.append(replyHandle) + elif inReplyToUrl.startswith('sharedesc:'): + # get the title for the shared item shareDescription = \ - inReplyToUrl.replace('sharedesc:', '') + inReplyToUrl.replace('sharedesc:', '').strip() shareDescription = \ - urllib.parse.unquote_plus(shareDescription.strip()) - self.path = self.path.split('?replydm=')[0]+'/newdm' + shareDescription.replace('_', ' ') + + self.path = self.path.split('?replydm=')[0] + '/newdm' if self.server.debug: print('DEBUG: replydm path ' + self.path) @@ -13050,11 +13071,11 @@ def runDaemon(maxNewswirePosts: int, createNewsInbox(baseDir, domain, port, httpPrefix) # set the avatar for the news account - themeName = getConfigParam(baseDir, 'theme') - if not themeName: - themeName = 'default' + httpd.themeName = getConfigParam(baseDir, 'theme') + if not httpd.themeName: + httpd.themeName = 'default' setNewsAvatar(baseDir, - themeName, + httpd.themeName, httpPrefix, domain, httpd.domainFull) diff --git a/defaultcategories/en.xml b/defaultcategories/en.xml index d66ef2907..a17f6af3d 100644 --- a/defaultcategories/en.xml +++ b/defaultcategories/en.xml @@ -6,373 +6,385 @@ gafam zuckerberg apple youtube facebook amazon amazonring microsoft twitter skype degoogled google dotcoms deleteyoutube fascistbook FuckGoogle degoogle ring gafam fuckoffgoogle deletefacebook bigtech - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT + + + places + lapaz luanda asunción nouakchott conakry kyiv moscow saipan gibraltar dublin avarua hargeisa delhi niamey chișinău colombo brasília phnompenh mbabane belgrade belmopan pyongyang hannover ulaanbaatar oranjestad gaborone seattle ndjamena singapore kingedwardpoint abidjan nuuk pretoria papeete malé zagreb gitega abudhabi flyingfishcove castries georgetown hagåtña basseterre hamburg kinshasa suva valparaíso athens roseau baku charlotteamalie antananarivo pristina santiago sukhumi berlin funafuti libreville hanoi philipsburg tehran banjul prague andorralavella yerevan portauprince dakar paramaribo tifariti capetown tirana ankara ipswich managua lisbon bishkek amsterdam portonovo santodomingo bangkok bucharest kathmandu aden madrid sanjuan vienna kingston kabul damascus stockholm douglas willemstad thehague panamacity beirut amman newdelhi tórshavn nouméa oslo alofi gustavia paris video cockburntown ottawa stepanakert portofspain honiara asmara nicosia helsinki taipei tegucigalpa tokyo tashkent sarajevo algiers nairobi muscat monaco riyadh lusaka wellington bissau juba mariehamn majuro buenosaires ngerulmud dhaka guatemalacity washington vatican kuwaitcity bern mexicocity bratislava bridgetown tunis manila stanley matautu copenhagen lomé budapest ouagadougou mogadishu freetown victoria brazzaville portmoresby ashgabat kampala elaaiún vilnius bloemfontein sucre london pagopago bradesestate oakland vaduz addis nürnberg naypyidaw khartoum baghdad bandar moroni portvila kingstown reykjavík manama accra windhoek nukualofa tbilisi canberra quito maputo cetinje putrajaya ramallah bogotá dodoma harare havana warsaw valletta ljubljana bamako kualalumpur podgorica rabat cotonou plymouth seoul dushanbe bangui westisland tskhinvali palikir caracas jamestown rome munich sãotomé jakarta daressalaam sansalvador apia essex yaren cairo jerusalem brussels kigali southtarawa beijing minsk montevideo vientiane maseru hamilton doha tripoli portlouis lima adamstown abuja lilongwe nassau lobamba nyc montreal dili riga lesbos monrovia nursultan sanjosé marigot islamabad malabo tallinn sahara thimphu yaoundé praia bujumbura sofia skopje + + Sun, 06 Dec 2020 11:33:50 UT food - vitamind bolognese sourdough vegan soysauce bakery baking foodwaste aroma bagel batter beans beer biscuit bread broth burger butter cake candy caramel caviar cheese chili chocolate cider cobbler cocoa coffee cookie cream croissant crumble cuisine curd dessert dish drink eggs entree filet fish flour foie gras food glaze grill hamburger juice ketchup kitchen lard liquor margarine marinade mayo mayonnaise meat milk mousse muffin mushroom noodle nuts oil olive omelette pan pasta paste pastry pie pizza plate pot poutine pudding raclette recipe rice salad salsa sandwich sauce seasoning skillet soda soup soy spice steak stew syrup tartar taste tea toast vinegar waffle wheat wine wok yeast yogurt cookery cooking + vitamind cake margarine dessert salsa caviar cookery food skillet liquor milk bolognese recipe yeast plate waffle biscuit glaze omelette filet pastry wine hamburger juice sourdough nuts gras toast broth batter ketchup seasoning mayo soup pan mayonnaise vegan dish spice bakery cooking yogurt spotify crumble cider butter cobbler steak pizza soda aroma oil flour cream pie cuisine tartar tea marinade mushroom entree bread salad beans syrup cookie curd soysauce pudding beer baking fish foodwaste wheat pot stew chocolate paste wok olive burger candy kitchen coffee bagel taste meat noodle raclette caramel rice eggs grill poutine lard croissant pasta cheese drink muffin foie sauce soy cocoa sandwich mousse chili vinegar - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT + + + countries + romania burma lithuania solomon chile fiji tajikistan benin paraguay senegal ukraine italy brunei nicaragua guyana zambia iceland morocco netherlands swaziland bosnian suriname elsalvador russia samoa czech belarus hayabusa2 kyrgyzstan uk sanmarino catalonia panama japan venezuela gambia kuwait barbados papua greece switzerland uae nigeria usa angola honduras djibouti laos sierraleone cambodia vietnam seychelles marshall kazakhstan estonia tonga stlucia burundi bangladesh egypt mali congo us jordan grenada israel algeria ghana bosnia russian eritrea bhutan hungary saudi slovenia bahamas australia kiribati togo koreanorth poland malawi capeverde armenia american bahrain mozambique southsudan syria micronesia maldives iran sweden ethiopia cuba liberia canada burkina somalia scotland vaticancity easttimor austria turkey yemen Bolivia denmark madagascar finland philippines ivorycoast haiti ecuador Portugal azerbaijan spain albania afghanistan europe mauritania dominica thailand belize macedonia montenegro qatar mongolia costarica latvia uzbekistan ireland iraq malaysia mexico mauritius oman chad nz georgia zimbabwe france serbia lesotho tunisia argentina cameroon namibia sudan indonesia colombia tuvalu turkmenistan tanzania germany norway comoros guatemala kosovo andorra wales pakistan belgium china antigua koreasouth newzealand rwanda luxembourg libya nauru moldova palau taiwan kenya trinidad eu botswana jamaica vanuatu cyprus malta niger unitedstates myanmar saintvincent guinea nepal peru uganda uruguay india lebanon southafrica croatia europeanunion bolivia chinese dominican srilanka bulgaria slovakia gabon stkitts liechtenstein brazil + + Sun, 06 Dec 2020 11:33:50 UT cycling - bicycle bike Snowbike cycling + bicycle cycling bike Snowbike - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT phones mobileapp fdroid plasmamobile smartphone pinephone mobile ubuntutouch osmand vodafone postmarketos - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT software - app freedombox windows libre nginx Framasoft drm kubernetes jami FuckOffZoom docker freesoftware foss nextcloud wechat ikiwiki outreachy selfhosting lyft nitter opensource diaspora cabal conferencing accessibility owncast emacs gemini email chatapps floss deltachat bittorrent zoom gpl FriendofGNOME obnam cryptpad OwnStream mumble grsync irssi mutt backup apps ffmpeg lemmy OSM win10 jitsi libreoffice dino openoffice + app freedombox windows libre nginx Framasoft drm kubernetes jami FuckOffZoom docker freesoftware gimp foss nextcloud wechat ikiwiki outreachy selfhosting lyft nitter opensource diaspora cabal conferencing accessibility owncast emacs gemini email chatapps floss deltachat bittorrent zoom gpl FriendofGNOME obnam cryptpad OwnStream mumble grsync irssi mutt backup apps ffmpeg lemmy OSM win10 jitsi rsync libreoffice dino openoffice - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT security - password encrypt password cryptography infosec gchq cryptowars UseAMaskUseTor cyberattack security tor vpn openssh openssl crypto opsec nsa protonvpn nitrokey openpgp gpg cybersecurity signal noscript openvpn + encrypt password cryptography infosec gchq cryptowars UseAMaskUseTor cyberattack security tor vpn openssh openssl crypto opsec nsa protonvpn yubikey nitrokey openpgp gpgtools gpg cybersecurity signal noscript openvpn - Sat, 05 Dec 2020 13:30:17 UT - - - countries - wales scotland eu europe europeanunion chinese afghanistan albania algeria andorra angola antigua argentina armenia australia austria azerbaijan bahamas bahrain bangladesh barbados belarus belgium belize benin bhutan bolivia bosnia botswana brazil brunei bulgaria burkina burundi cambodia cameroon canada capeverde chad chile china colombia comoros congo costarica croatia cuba cyprus czech denmark djibouti dominica dominican easttimor ecuador egypt elsalvador guinea eritrea estonia ethiopia fiji finland france gabon gambia georgia germany ghana greece grenada guatemala guinea guyana haiti honduras hungary iceland india indonesia iran iraq ireland israel italy ivorycoast jamaica japan jordan kazakhstan kenya kiribati koreanorth koreasouth kosovo kuwait kyrgyzstan laos latvia lebanon lesotho liberia libya liechtenstein lithuania luxembourg macedonia madagascar malawi malaysia maldives mali malta marshall mauritania mauritius mexico micronesia moldova monaco mongolia montenegro morocco mozambique myanmar burma namibia nauru nepal netherlands newzealand nz nicaragua niger nigeria norway oman pakistan palau panama papua paraguay peru philippines poland Portugal qatar romania russian rwanda stkitts stlucia saintvincent samoa sanmarino saudi senegal serbia seychelles sierraleone singapore slovakia slovenia solomon somalia southafrica sudan spain srilanka sudan suriname swaziland sweden switzerland syria taiwan tajikistan tanzania thailand togo tonga trinidad tunisia turkey turkmenistan tuvalu uganda ukraine uae uk usa us unitedstates uruguay uzbekistan vanuatu vaticancity venezuela vietnam yemen zambia zimbabwe - - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT politics - cia wageslavery liberation fascism rojava leftists Socialism ukpol freedom anarchism DefundThePolice bjp election generalstrike digitalfreedom hatespeech fascists peerproduction corporations commons wageslave softwarefreedom socialecology politics nzpol totalitarianism TyskySour Labour decolonization surveillance elections borisjohnson mutuality whitehouse decolonize decenterwhiteness ChineseAppBan modi surveillancecapitalism leftist Revolution ukpolitics migration mutualaid fascist uselection + mayday cia wageslavery liberation fascism rojava leftists Socialism ukpol freedom abolitionnow anarchism DefundThePolice bjp election generalstrike digitalfreedom hatespeech fascists peerproduction corporations commons wageslave RemoveThePolice softwarefreedom socialecology politics nzpol brexit totalitarianism TyskySour Labour decolonization surveillance elections borisjohnson mutuality whitehouse decolonize decenterwhiteness ChineseAppBan modi surveillancecapitalism leftist Revolution ukpolitics migration mutualaid fascist uselection - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT conferences - schmoocon defcon C3 fossdem debconf talk FreedomBoxSummit summit minidebconf flossevent conf rC3 flossconf conference + debconf talk fossdem FreedomBoxSummit schmoocon summit minidebconf defcon flossevent conf rC3 conference flossconf C3 - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT photos nikon photography photo tokyocameraclub photoshop camera picture - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT programming - programming css rustlang typescript adventofcode scripting fedidev sourcecode django tuskydev lisp javascript code elisp html rust clojurescript racket python + git forge programming css rustlang typescript adventofcode scripting fedidev sourcecode django tuskydev lisp javascript code elisp html rust clojurescript racket python - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT activitypub - activitypub pleroma fedilab mastotips misskey siskin followers pixelfed monal tusky peertubers feditips fedizens epicyon mastomagic pixeldev fediverse mastodon peertube mobilizon + activitypub pleroma PeerTube fedilab mastotips misskey siskin followers pixelfed monal tusky peertubers feditips fedizens epicyon mastomagic pixeldev fediverse mastodon peertube mobilizon - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT news news - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT games - mud dnd rpg minetest game chess minecraft TetrisGore gaming + minecraft chess mud game TetrisGore gaming rpg minetest dnd - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT music - punk rap hiphop ipod rave bandcamp musicians mp3 thecure vaporwave dubstep synthwave experimentalmusic dj newwave dorkwave producing NowPlaying libremusicproduction MusicAdvent synth music fediversemusic cyberpunkmusic BandcampFriday + punk bandcamp musicians ipod rap mp3 thecure vaporwave dubstep synthwave rave hiphop experimentalmusic dj newwave dorkwave producing NowPlaying nowplaying libremusicproduction MusicAdvent synth music fediversemusic cyberpunkmusic BandcampFriday - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT + + + retro + A500 atarist commodore teletext 8bit atari floppy retrocomputing C64 80s microcomputing z80 retro amiga bbcmicro microcomputer + + Sun, 06 Dec 2020 11:33:50 UT indymedia visionontv indymediaback omn 4opens - Sat, 05 Dec 2020 13:30:17 UT - - - places - hannover hamburg ipswich oakland nürnberg munich essex minsk nyc montreal lesbos sahara abidjan abudhabi abuja accra adamstown addis aden algiers alofi amman amsterdam thehague andorralavella ankara antananarivo apia ashgabat asmara asunción athens avarua baghdad baku bamako bandar bangkok bangui banjul basseterre beijing beirut belgrade belmopan berlin bern bishkek bissau bloemfontein capetown pretoria bogotá bradesestate plymouth brasília bratislava brazzaville bridgetown brussels bucharest budapest buenosaires cairo canberra caracas castries cetinje podgorica charlotteamalie chișinău cockburntown colombo conakry copenhagen cotonou portonovo dakar damascus daressalaam dodoma dhaka dili djibouti doha douglas dublin dushanbe elaaiún tifariti flyingfishcove freetown funafuti gaborone georgetown gibraltar gitega bujumbura guatemalacity gustavia hagåtña hamilton hanoi harare hargeisa havana helsinki honiara islamabad jakarta jamestown jerusalem ramallah juba kabul kampala kathmandu khartoum kigali kingedwardpoint kingston kingston kingstown kinshasa kualalumpur putrajaya kuwaitcity kyiv lapaz sucre libreville lilongwe lima lisbon ljubljana lobamba mbabane lomé london luanda lusaka luxembourg madrid majuro malabo malé managua manama manila maputo mariehamn marigot maseru matautu mexicocity minsk mogadishu monaco monrovia montevideo moroni moscow muscat nairobi nassau naypyidaw ndjamena newdelhi delhi ngerulmud niamey nicosia nouakchott nouméa nukualofa nursultan nuuk oranjestad oslo ottawa ouagadougou pagopago palikir panamacity papeete paramaribo paris philipsburg phnompenh portlouis portmoresby portvila portauprince portofspain prague praia pristina pyongyang quito rabat reykjavík riga riyadh rome roseau saipan sanjosé sanjuan sanmarino sansalvador santiago valparaíso santodomingo sãotomé sarajevo seoul singapore skopje sofia southtarawa stanley stepanakert stockholm sukhumi suva taipei tallinn tashkent tbilisi tegucigalpa tehran thimphu tirana tokyo tórshavn tripoli tskhinvali tunis ulaanbaatar vaduz valletta vatican victoria vienna vientiane vilnius warsaw washington wellington westisland willemstad windhoek yaoundé yaren yerevan zagreb - - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT questions - askmastodon askfosstodon + askmastodon askfosstodon ask - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT birds RainbowBeeEater bird - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT ethics digitalethics ethics ethical - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT internet - cyberspace www w3c redecentralize rtmp decentralization decentralize w3c torrent data icann dns openstandards oauth SmallWeb xmpp semanticweb ntp socialnetworks jabber decentralized darknet cookies darkweb server browser p2p web twitch domain browsers openculture internet openweb socialweb cloudflare + redecentralize wikipedia rtmp decentralization decentralize w3c torrent data router icann dns openstandards oauth SmallWeb xmpp semanticweb ntp socialnetworks jabber decentralized darknet cookies darkweb server browser p2p www ilovewikipedia web twitch domain browsers decentralizeit openculture cyberspace internet openweb socialweb cloudflare - Sat, 05 Dec 2020 13:30:17 UT - - - retro - microcomputer microcomputing commodore C64 A500 8bit retro bbcmicro atari atarist teletext floppydisk retrocomputing 80s z80 amiga - - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT years - year Year2020 + Year2020 year - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT + + + month + month january feburary march april may june july august september october november december + + Sun, 06 Dec 2020 11:33:50 UT pets - dailycatpic DailyCatVid dogsofmastodon catofmastodon catbehaviour cats kittens dog caturday catsofmastodon cute dogs cat catcontent pet + catofmastodon catbehaviour dogsofmastodon cats kittens pet dog caturday catsofmastodon cute dogs cat catcontent - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT podcasts IntergalacticWasabiHour podcast tilderadio - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT events - meetup live followfriday livestream festival concert InternationalCheetahDay + week day Day live followfriday concert festival livestream InternationalCheetahDay meetup - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT + + + hardware + cyberdeck keyboards modem keyboard cybredeck lenovo arm thinkpad + + Sun, 06 Dec 2020 11:33:50 UT + + + seasons + spring autumn winter summer + + Sun, 06 Dec 2020 11:33:50 UT gender transwomen transcrowdfund female trans women estradiol woman transrights - Sat, 05 Dec 2020 13:30:17 UT - - - hardware - keyboards modem keyboard cyberdeck cybredeck thinkpad lenovo arm - - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT linux - mobian openwrt distros wireguard linuxaudio gtk debian trisquel gentoo archlinux ubuntu xubuntu fedora systemd distro qubesos linux btrfs + mobian openwrt distros wireguard linuxaudio gtk debian trisquel ubuntu xubuntu fedora gentoo systemd distro qubesos linux btrfs archlinux - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT fiction cyberpunk thehobbit fiction - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT audio audioproduction audiofeedback - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT bots bot - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT climate - clouds weather climate + clouds climate weather - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT books - earthsea ebooks ebook epub book + earthsea ebooks book ebook epub - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT scifi - startrek starwars cyberpunk + startrek starwars - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT pandemic CoronaWarnApp facemasks vaccines vaccine covid Lockdown codid19 COVID19 COVID - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT religion pagan - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT science supercollider paleontology - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT + + + art + art krita adultcolouring collage MastoArt digitalart mandala concretepoetry artwithopensource poetry + + Sun, 06 Dec 2020 11:33:50 UT nature trees nature - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT fashion bras fashion patches - Sat, 05 Dec 2020 13:30:17 UT - - - art - krita adultcolouring collage MastoArt digitalart mandala concretepoetry artwithopensource - - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT techbros hackernews reddit - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT + + + gardening + florespondence DailyFlowers flowers gardening + + Sun, 06 Dec 2020 11:33:50 UT moderation fedblock - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT election - voted vote election + voted vote - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT + + + #music + trance + + Sun, 06 Dec 2020 11:33:50 UT activism fsfe xr eff openrightsgroup fsf conservancy - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT crafts - knitting makers jewelry quilt + knitting jewelry makers quilt - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT - gardening - DailyFlowers flowers gardening + radio + vantaradio radio hamradio radiobroadcasting radiobroadcast - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT education education tutorial - Sat, 05 Dec 2020 13:30:17 UT - - - seasons - winter summer spring autumn - - Sat, 05 Dec 2020 13:30:17 UT - - - radio - hamradio radio - - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT microcontroller - microcontroller arduino esp32 + microcontroller arduino - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT comedy satire irony - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT privacy privacymatters dataprivacy privacy - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT environment climatechange climatechaos - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT #software flatpak - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT scotland highlands - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT microcontrollers esp8266 esp32 - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT health meds - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT astronomy moon milkyway - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT travel travel taxi - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT help help - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT funding patreon - Sat, 05 Dec 2020 13:30:17 UT + Sun, 06 Dec 2020 11:33:50 UT diff --git a/epicyon.py b/epicyon.py index 96b87396e..59c0e2cd5 100644 --- a/epicyon.py +++ b/epicyon.py @@ -326,12 +326,12 @@ parser.add_argument('--image', '--background', dest='backgroundImage', parser.add_argument('--archive', dest='archive', type=str, default=None, help='Archive old files to the given directory') -parser.add_argument('--archiveweeks', dest='archiveWeeks', type=str, - default=None, +parser.add_argument('--archiveweeks', dest='archiveWeeks', type=int, + default=4, help='Specify the number of weeks after which ' + - 'data will be archived') -parser.add_argument('--maxposts', dest='archiveMaxPosts', type=str, - default=None, + 'media will be archived') +parser.add_argument('--maxposts', dest='archiveMaxPosts', type=int, + default=32000, help='Maximum number of posts in in/outbox') parser.add_argument('--minimumvotes', dest='minimumvotes', type=int, default=1, @@ -1574,13 +1574,6 @@ if args.changepassword: print('Passwords file not found') sys.exit() -archiveWeeks = 4 -if args.archiveWeeks: - archiveWeeks = args.archiveWeeks -archiveMaxPosts = 32000 -if args.archiveMaxPosts: - archiveMaxPosts = args.archiveMaxPosts - if args.archive: if args.archive.lower().endswith('null') or \ args.archive.lower().endswith('delete') or \ @@ -1589,8 +1582,8 @@ if args.archive: print('Archiving with deletion of old posts...') else: print('Archiving to ' + args.archive + '...') - archiveMedia(baseDir, args.archive, archiveWeeks) - archivePosts(baseDir, httpPrefix, args.archive, {}, archiveMaxPosts) + archiveMedia(baseDir, args.archive, args.archiveWeeks) + archivePosts(baseDir, httpPrefix, args.archive, {}, args.archiveMaxPosts) print('Archiving complete') sys.exit() diff --git a/inbox.py b/inbox.py index 5bcabcbe3..b8ed2e0ac 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, + translate, pageNumber, baseDir, session, cachedWebfingers, personCache, nickname, domain, port, postJsonObject, avatarUrl, True, allowDeletion, diff --git a/media.py b/media.py index 25532ce22..2163820d8 100644 --- a/media.py +++ b/media.py @@ -199,9 +199,12 @@ def attachMedia(baseDir: str, httpPrefix: str, domain: str, port: int, def archiveMedia(baseDir: str, archiveDirectory: str, maxWeeks=4) -> None: """Any media older than the given number of weeks gets archived """ + if maxWeeks == 0: + return + currTime = datetime.datetime.utcnow() weeksSinceEpoch = int((currTime - datetime.datetime(1970, 1, 1)).days/7) - minWeek = weeksSinceEpoch-maxWeeks + minWeek = weeksSinceEpoch - maxWeeks if archiveDirectory: if not os.path.isdir(archiveDirectory): diff --git a/newswire.py b/newswire.py index 0bad590f7..1734a3a05 100644 --- a/newswire.py +++ b/newswire.py @@ -154,14 +154,6 @@ def parseFeedDate(pubDate: str) -> str: continue if ',' not in pubDate and ',' in dateFormat: continue - if '-' in pubDate and '-' not in dateFormat: - continue - if '-' not in pubDate and '-' in dateFormat: - continue - if 'T' in pubDate and 'T' not in dateFormat: - continue - if 'T' not in pubDate and 'T' in dateFormat: - continue if 'Z' in pubDate and 'Z' not in dateFormat: continue if 'Z' not in pubDate and 'Z' in dateFormat: @@ -267,10 +259,13 @@ def xml2StrToDict(baseDir: str, domain: str, xmlStr: str, if '' not in xmlStr: return {} result = {} + + # is this an rss feed containing hashtag categories? if '#categories' in xmlStr: xml2StrToHashtagCategories(baseDir, xmlStr, maxCategoriesFeedItemSizeKb) return {} + rssItems = xmlStr.split('') postCtr = 0 maxBytes = maxFeedItemSizeKb * 1024 diff --git a/posts.py b/posts.py index 67c5a56a5..359536abe 100644 --- a/posts.py +++ b/posts.py @@ -3144,9 +3144,13 @@ def archivePosts(baseDir: str, httpPrefix: str, archiveDir: str, maxPostsInBox=32000) -> None: """Archives posts for all accounts """ + if maxPostsInBox == 0: + return + if archiveDir: if not os.path.isdir(archiveDir): os.mkdir(archiveDir) + if archiveDir: if not os.path.isdir(archiveDir + '/accounts'): os.mkdir(archiveDir + '/accounts') diff --git a/tests.py b/tests.py index be85000b3..3af8473b3 100644 --- a/tests.py +++ b/tests.py @@ -547,6 +547,20 @@ def testPostMessageBetweenServers(): break time.sleep(1) + # check that a news account exists + newsActorDir = aliceDir + '/accounts/news@' + aliceDomain + print("newsActorDir: " + newsActorDir) + assert os.path.isdir(newsActorDir) + newsActorFile = newsActorDir + '.json' + assert os.path.isfile(newsActorFile) + newsActorJson = loadJson(newsActorFile) + assert newsActorJson + assert newsActorJson.get("id") + # check the id of the news actor + print('News actor Id: ' + newsActorJson["id"]) + assert (newsActorJson["id"] == + httpPrefix + '://' + aliceAddress + '/users/news') + # Image attachment created assert len([name for name in os.listdir(mediaPath) if os.path.isfile(os.path.join(mediaPath, name))]) > 0 @@ -1747,6 +1761,13 @@ def testWebLinks(): '

Test1 test2 ' '#YetAnotherExcessivelyLongwindedAndBorin\ngHashtag

') + exampleText = \ + "

Don't remove a p2p link " + \ + "rad:git:hwd1yrerc3mcgn8ga9rho3dqi4w33nep7kxmqezss4topyfgmexihp" + \ + "33xcw

" + resultText = removeLongWords(addWebLinks(exampleText), 40, []) + assert resultText == exampleText + def testAddEmoji(): print('testAddEmoji') @@ -2396,6 +2417,11 @@ def testFirstParagraphFromString(): def testParseFeedDate(): print('testParseFeedDate') + + pubDate = "Tue, 08 Dec 2020 06:24:38 -0600" + publishedDate = parseFeedDate(pubDate) + assert publishedDate == "2020-12-08 12:24:38+00:00" + pubDate = "2020-08-27T16:12:34+00:00" publishedDate = parseFeedDate(pubDate) assert publishedDate == "2020-08-27 16:12:34+00:00" diff --git a/theme/blue/icons/avatar_default.png b/theme/blue/icons/avatar_default.png new file mode 100644 index 000000000..f8cbb8f38 Binary files /dev/null and b/theme/blue/icons/avatar_default.png differ diff --git a/theme/debian/icons/avatar_default.png b/theme/debian/icons/avatar_default.png new file mode 100644 index 000000000..07599baeb Binary files /dev/null and b/theme/debian/icons/avatar_default.png differ diff --git a/theme/default/icons/avatar_default.png b/theme/default/icons/avatar_default.png new file mode 100644 index 000000000..f8cbb8f38 Binary files /dev/null and b/theme/default/icons/avatar_default.png differ diff --git a/theme/hacker/icons/avatar_default.png b/theme/hacker/icons/avatar_default.png new file mode 100644 index 000000000..66c11c47b Binary files /dev/null and b/theme/hacker/icons/avatar_default.png differ diff --git a/theme/henge/icons/avatar_default.png b/theme/henge/icons/avatar_default.png new file mode 100644 index 000000000..34e898654 Binary files /dev/null and b/theme/henge/icons/avatar_default.png differ diff --git a/theme/indymediaclassic/icons/avatar_default.png b/theme/indymediaclassic/icons/avatar_default.png new file mode 100644 index 000000000..261ae6239 Binary files /dev/null and b/theme/indymediaclassic/icons/avatar_default.png differ diff --git a/theme/indymediamodern/icons/avatar_default.png b/theme/indymediamodern/icons/avatar_default.png new file mode 100644 index 000000000..9089a1b66 Binary files /dev/null and b/theme/indymediamodern/icons/avatar_default.png differ diff --git a/theme/lcd/icons/avatar_default.png b/theme/lcd/icons/avatar_default.png new file mode 100644 index 000000000..74cc49969 Binary files /dev/null and b/theme/lcd/icons/avatar_default.png differ diff --git a/theme/light/icons/avatar_default.png b/theme/light/icons/avatar_default.png new file mode 100644 index 000000000..0196a526e Binary files /dev/null and b/theme/light/icons/avatar_default.png differ diff --git a/theme/night/icons/avatar_default.png b/theme/night/icons/avatar_default.png new file mode 100644 index 000000000..7b770cd0b Binary files /dev/null and b/theme/night/icons/avatar_default.png differ diff --git a/theme/purple/icons/avatar_default.png b/theme/purple/icons/avatar_default.png new file mode 100644 index 000000000..db87e722a Binary files /dev/null and b/theme/purple/icons/avatar_default.png differ diff --git a/theme/rc3/icons/avatar_default.png b/theme/rc3/icons/avatar_default.png new file mode 100644 index 000000000..b4eed9aed Binary files /dev/null and b/theme/rc3/icons/avatar_default.png differ diff --git a/theme/solidaric/icons/avatar_default.png b/theme/solidaric/icons/avatar_default.png new file mode 100644 index 000000000..bb95103d5 Binary files /dev/null and b/theme/solidaric/icons/avatar_default.png differ diff --git a/theme/starlight/icons/avatar_default.png b/theme/starlight/icons/avatar_default.png new file mode 100644 index 000000000..1a173f348 Binary files /dev/null and b/theme/starlight/icons/avatar_default.png differ diff --git a/theme/zen/icons/avatar_default.png b/theme/zen/icons/avatar_default.png new file mode 100644 index 000000000..31df35fc6 Binary files /dev/null and b/theme/zen/icons/avatar_default.png differ diff --git a/translations/ar.json b/translations/ar.json index b3752456c..2a96a612f 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -338,5 +338,6 @@ "Debian": "Debian", "Select the edit icon to add RSS feeds": "حدد رمز التحرير لإضافة موجز ويب لـ RSS", "Select the edit icon to add web links": "حدد رمز التحرير لإضافة روابط الويب", - "Hashtag Categories RSS Feed": "Hashtag Categories RSS Feed" + "Hashtag Categories RSS Feed": "Hashtag Categories RSS Feed", + "Ask about a shared item.": "اسأل عن عنصر مشترك." } diff --git a/translations/ca.json b/translations/ca.json index 45a703b61..7ff65aab7 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -338,5 +338,6 @@ "Debian": "Debian", "Select the edit icon to add RSS feeds": "Seleccioneu la icona d'edició per afegir canals RSS", "Select the edit icon to add web links": "Seleccioneu la icona d'edició per afegir enllaços web", - "Hashtag Categories RSS Feed": "Feed RSS de categories de hashtag" + "Hashtag Categories RSS Feed": "Feed RSS de categories de hashtag", + "Ask about a shared item.": "Pregunteu sobre un element compartit." } diff --git a/translations/cy.json b/translations/cy.json index fd9d78d3f..b10bb537e 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -338,5 +338,6 @@ "Debian": "Debian", "Select the edit icon to add RSS feeds": "Dewiswch yr eicon golygu i ychwanegu porthwyr RSS", "Select the edit icon to add web links": "Dewiswch yr eicon golygu i ychwanegu dolenni gwe", - "Hashtag Categories RSS Feed": "Categorïau Hashtag RSS Feed" + "Hashtag Categories RSS Feed": "Categorïau Hashtag RSS Feed", + "Ask about a shared item.": "Gofynnwch am eitem a rennir." } diff --git a/translations/de.json b/translations/de.json index 27500796b..ebd9e4e5a 100644 --- a/translations/de.json +++ b/translations/de.json @@ -338,5 +338,6 @@ "Debian": "Debian", "Select the edit icon to add RSS feeds": "Wählen Sie das Bearbeitungssymbol, um RSS-Feeds hinzuzufügen", "Select the edit icon to add web links": "Wählen Sie das Bearbeitungssymbol, um Weblinks hinzuzufügen", - "Hashtag Categories RSS Feed": "Hashtag Kategorien RSS Feed" + "Hashtag Categories RSS Feed": "Hashtag Kategorien RSS Feed", + "Ask about a shared item.": "Fragen Sie nach einem gemeinsamen Artikel." } diff --git a/translations/en.json b/translations/en.json index cdf939477..45e450a1e 100644 --- a/translations/en.json +++ b/translations/en.json @@ -338,5 +338,6 @@ "Debian": "Debian", "Select the edit icon to add RSS feeds": "Select the edit icon to add RSS feeds", "Select the edit icon to add web links": "Select the edit icon to add web links", - "Hashtag Categories RSS Feed": "Hashtag Categories RSS Feed" + "Hashtag Categories RSS Feed": "Hashtag Categories RSS Feed", + "Ask about a shared item.": "Ask about a shared item." } diff --git a/translations/es.json b/translations/es.json index 7a8471633..12e541e78 100644 --- a/translations/es.json +++ b/translations/es.json @@ -338,5 +338,6 @@ "Debian": "Debian", "Select the edit icon to add RSS feeds": "Seleccione el icono de edición para agregar fuentes RSS", "Select the edit icon to add web links": "Seleccione el icono de edición para agregar enlaces web", - "Hashtag Categories RSS Feed": "Feed RSS de categorías de hashtags" + "Hashtag Categories RSS Feed": "Feed RSS de categorías de hashtags", + "Ask about a shared item.": "Pregunte por un elemento compartido." } diff --git a/translations/fr.json b/translations/fr.json index 0b00ed4b1..7816fc8f8 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -338,5 +338,6 @@ "Debian": "Debian", "Select the edit icon to add RSS feeds": "Sélectionnez l'icône d'édition pour ajouter des flux RSS", "Select the edit icon to add web links": "Sélectionnez l'icône de modification pour ajouter des liens Web", - "Hashtag Categories RSS Feed": "Flux RSS des catégories Hashtag" + "Hashtag Categories RSS Feed": "Flux RSS des catégories Hashtag", + "Ask about a shared item.": "Renseignez-vous sur un élément partagé." } diff --git a/translations/ga.json b/translations/ga.json index 118845962..ac41d0205 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -338,5 +338,6 @@ "Debian": "Debian", "Select the edit icon to add RSS feeds": "Roghnaigh an deilbhín eagar chun fothaí RSS a chur leis", "Select the edit icon to add web links": "Roghnaigh an deilbhín eagar chun naisc ghréasáin a chur leis", - "Hashtag Categories RSS Feed": "Catagóirí Hashtag RSS Feed" + "Hashtag Categories RSS Feed": "Catagóirí Hashtag RSS Feed", + "Ask about a shared item.": "Fiafraigh faoi earra roinnte." } diff --git a/translations/hi.json b/translations/hi.json index 1bca2fa83..65fec21ff 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -338,5 +338,6 @@ "Debian": "Debian", "Select the edit icon to add RSS feeds": "RSS फ़ीड जोड़ने के लिए संपादन आइकन का चयन करें", "Select the edit icon to add web links": "वेब लिंक जोड़ने के लिए संपादन आइकन का चयन करें", - "Hashtag Categories RSS Feed": "हैशटैग श्रेणियाँ आरएसएस फ़ीड" + "Hashtag Categories RSS Feed": "हैशटैग श्रेणियाँ आरएसएस फ़ीड", + "Ask about a shared item.": "एक साझा आइटम के बारे में पूछें।" } diff --git a/translations/it.json b/translations/it.json index 1c05b8908..fabd4f973 100644 --- a/translations/it.json +++ b/translations/it.json @@ -338,5 +338,6 @@ "Debian": "Debian", "Select the edit icon to add RSS feeds": "Seleziona l'icona di modifica per aggiungere feed RSS", "Select the edit icon to add web links": "Seleziona l'icona di modifica per aggiungere link web", - "Hashtag Categories RSS Feed": "Feed RSS delle categorie hashtag" + "Hashtag Categories RSS Feed": "Feed RSS delle categorie hashtag", + "Ask about a shared item.": "Chiedi informazioni su un elemento condiviso." } diff --git a/translations/ja.json b/translations/ja.json index 4e1065001..7bed89c46 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -338,5 +338,6 @@ "Debian": "Debian", "Select the edit icon to add RSS feeds": "編集アイコンを選択してRSSフィードを追加します", "Select the edit icon to add web links": "編集アイコンを選択してWebリンクを追加します", - "Hashtag Categories RSS Feed": "ハッシュタグカテゴリRSSフィード" + "Hashtag Categories RSS Feed": "ハッシュタグカテゴリRSSフィード", + "Ask about a shared item.": "共有アイテムについて質問します。" } diff --git a/translations/oc.json b/translations/oc.json index b8fd14c6d..a224b833a 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -334,5 +334,6 @@ "Debian": "Debian", "Select the edit icon to add RSS feeds": "Select the edit icon to add RSS feeds", "Select the edit icon to add web links": "Select the edit icon to add web links", - "Hashtag Categories RSS Feed": "Hashtag Categories RSS Feed" + "Hashtag Categories RSS Feed": "Hashtag Categories RSS Feed", + "Ask about a shared item.": "Ask about a shared item." } diff --git a/translations/pt.json b/translations/pt.json index eda0cfe87..305243eac 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -338,5 +338,6 @@ "Debian": "Debian", "Select the edit icon to add RSS feeds": "Selecione o ícone de edição para adicionar feeds RSS", "Select the edit icon to add web links": "Selecione o ícone de edição para adicionar links da web", - "Hashtag Categories RSS Feed": "Feed RSS das categorias de hashtag" + "Hashtag Categories RSS Feed": "Feed RSS das categorias de hashtag", + "Ask about a shared item.": "Pergunte sobre um item compartilhado." } diff --git a/translations/ru.json b/translations/ru.json index 043800408..3c0155cea 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -338,5 +338,6 @@ "Debian": "Debian", "Select the edit icon to add RSS feeds": "Щелкните значок редактирования, чтобы добавить RSS-каналы", "Select the edit icon to add web links": "Щелкните значок редактирования, чтобы добавить веб-ссылки", - "Hashtag Categories RSS Feed": "RSS-канал категорий хэштегов" + "Hashtag Categories RSS Feed": "RSS-канал категорий хэштегов", + "Ask about a shared item.": "Спросите об общем элементе." } diff --git a/translations/zh.json b/translations/zh.json index 38b30eabc..470be2cd5 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -338,5 +338,6 @@ "Debian": "Debian", "Select the edit icon to add RSS feeds": "选择编辑图标以添加RSS feed", "Select the edit icon to add web links": "选择编辑图标以添加Web链接", - "Hashtag Categories RSS Feed": "标签类别RSS提要" + "Hashtag Categories RSS Feed": "标签类别RSS提要", + "Ask about a shared item.": "询问共享项目。" } 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 d882400d7..5e5df5cf7 100644 --- a/webapp_column_left.py +++ b/webapp_column_left.py @@ -11,11 +11,11 @@ from shutil import copyfile from utils import getConfigParam from utils import getNicknameFromActor from utils import isEditor +from webapp_utils import sharesTimelineJson 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 @@ -28,9 +28,46 @@ def linksExist(baseDir: str) -> bool: return os.path.isfile(linksFilename) +def getLeftColumnShares(baseDir: str, + httpPrefix: str, domainFull: str, + nickname: str, + maxSharesInLeftColumn: int, + translate: {}) -> []: + """get any shares and turn them into the left column links format + """ + pageNumber = 1 + actor = httpPrefix + '://' + domainFull + '/users/' + nickname + sharesJson, lastPage = \ + sharesTimelineJson(actor, pageNumber, + maxSharesInLeftColumn, + baseDir, maxSharesInLeftColumn) + if not sharesJson: + return [] + + linksList = [] + ctr = 0 + for published, item in sharesJson.items(): + sharedesc = item['displayName'] + if '<' in sharedesc or '?' in sharedesc: + continue + contactActor = item['actor'] + shareLink = actor + \ + '?replydm=sharedesc:' + \ + sharedesc.replace(' ', '_') + \ + '?mention=' + contactActor + linksList.append(sharedesc + ' ' + shareLink) + ctr += 1 + if ctr >= maxSharesInLeftColumn: + break + + if linksList: + linksList = ['* ' + translate['Shares']] + linksList + return linksList + + def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str, httpPrefix: str, translate: {}, - iconsPath: str, editor: bool, + editor: bool, showBackButton: bool, timelinePath: str, rssIconAtTop: bool, showHeaderImage: bool, frontPage: bool) -> str: @@ -98,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': @@ -117,7 +154,7 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str, '' + rssTitle + \
         '\n' + '" src="/icons/logorss.png" />\n' if rssIconAtTop: htmlStr += rssIconStr htmlStr += ' \n' @@ -136,53 +173,64 @@ def getLeftColumnContent(baseDir: str, nickname: str, domainFull: str, linksFilename = baseDir + '/accounts/links.txt' linksFileContainsEntries = False + linksList = None if os.path.isfile(linksFilename): - linksList = None with open(linksFilename, "r") as f: linksList = f.readlines() - if linksList: - for lineStr in linksList: - if ' ' not in lineStr: - if '#' not in lineStr: - if '*' not in lineStr: - continue - lineStr = lineStr.strip() - words = lineStr.split(' ') - # get the link - linkStr = None - for word in words: - if word == '#': + + if not frontPage: + # show a number of shares + maxSharesInLeftColumn = 3 + sharesList = \ + getLeftColumnShares(baseDir, + httpPrefix, domainFull, nickname, + maxSharesInLeftColumn, translate) + if linksList and sharesList: + linksList = sharesList + linksList + + if linksList: + for lineStr in linksList: + if ' ' not in lineStr: + if '#' not in lineStr: + if '*' not in lineStr: continue - if word == '*': - continue - if '://' in word: - linkStr = word - break - if linkStr: - lineStr = lineStr.replace(linkStr, '').strip() - # avoid any dubious scripts being added - if '<' not in lineStr: - # remove trailing comma if present - if lineStr.endswith(','): - lineStr = lineStr[:len(lineStr)-1] - # add link to the returned html - htmlStr += \ - '

' + \ - lineStr + '

\n' - linksFileContainsEntries = True - else: - if lineStr.startswith('#') or lineStr.startswith('*'): - lineStr = lineStr[1:].strip() - if firstSeparatorAdded: - htmlStr += separatorStr - firstSeparatorAdded = True - htmlStr += \ - '

' + \ - lineStr + '

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

' + lineStr + '

\n' + lineStr = lineStr.strip() + words = lineStr.split(' ') + # get the link + linkStr = None + for word in words: + if word == '#': + continue + if word == '*': + continue + if '://' in word: + linkStr = word + break + if linkStr: + lineStr = lineStr.replace(linkStr, '').strip() + # avoid any dubious scripts being added + if '<' not in lineStr: + # remove trailing comma if present + if lineStr.endswith(','): + lineStr = lineStr[:len(lineStr)-1] + # add link to the returned html + htmlStr += \ + '

' + \ + lineStr + '

\n' linksFileContainsEntries = True + else: + if lineStr.startswith('#') or lineStr.startswith('*'): + lineStr = lineStr[1:].strip() + if firstSeparatorAdded: + htmlStr += separatorStr + firstSeparatorAdded = True + htmlStr += \ + '

' + \ + lineStr + '

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

' + lineStr + '

\n' + linksFileContainsEntries = True if firstSeparatorAdded: htmlStr += separatorStr @@ -215,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 @@ -238,12 +284,12 @@ def htmlLinksMobile(cssCache: {}, baseDir: str, htmlStr += '
' + \ headerButtonsFrontScreen(translate, nickname, 'links', authorized, - iconsAsButtons, iconsPath) + '
' + iconsAsButtons) + '' if linksExist(baseDir): htmlStr += \ getLeftColumnContent(baseDir, nickname, domainFull, httpPrefix, translate, - iconsPath, editor, + editor, False, timelinePath, rssIconAtTop, False, False) else: diff --git a/webapp_column_right.py b/webapp_column_right.py index 78df295f6..91412956b 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: @@ -44,7 +43,7 @@ def votesIndicator(totalVotes: int, positiveVoting: bool) -> str: def getRightColumnContent(baseDir: str, nickname: str, domainFull: str, httpPrefix: str, translate: {}, - iconsPath: str, moderator: bool, editor: bool, + moderator: bool, editor: bool, newswire: {}, positiveVoting: bool, showBackButton: bool, timelinePath: str, showPublishButton: bool, @@ -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) htmlStr += newswireContentStr # show the rss icon at the bottom, typically on the right hand side @@ -207,7 +206,7 @@ def getRightColumnContent(baseDir: str, nickname: str, domainFull: str, def htmlNewswire(baseDir: str, newswire: {}, nickname: str, moderator: bool, - translate: {}, positiveVoting: bool, iconsPath: str) -> str: + translate: {}, positiveVoting: bool) -> str: """Converts a newswire dict into html """ separatorStr = htmlPostSeparator(baseDir, 'right') @@ -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) + '' if newswire: htmlStr += \ getRightColumnContent(baseDir, nickname, domainFull, httpPrefix, translate, - iconsPath, moderator, editor, + moderator, editor, newswire, positiveVoting, False, timelinePath, showPublishButton, showPublishAsIcon, rssIconAtTop, False, diff --git a/webapp_confirm.py b/webapp_confirm.py index 3a468ef7f..a7396f9d4 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, + 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 073146103..6681aa303 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 @@ -61,7 +60,6 @@ def htmlFollowingDataList(baseDir: str, nickname: str, def htmlNewPostDropDown(scopeIcon: str, scopeDescription: str, replyStr: str, translate: {}, - iconsPath: str, showPublicOnDropdown: bool, defaultTimeline: str, pathBase: str, @@ -81,7 +79,7 @@ def htmlNewPostDropDown(scopeIcon: str, scopeDescription: str, dropDownContent += ' \n' dropDownContent += '
    \n' @@ -89,58 +87,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 +146,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' @@ -167,13 +165,13 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, baseDir: str, httpPrefix: str, path: str, inReplyTo: str, mentions: [], + shareDescription: str, reportUrl: str, pageNumber: int, nickname: str, domain: str, domainFull: str, defaultTimeline: str, newswire: {}) -> str: """New post screen """ - iconsPath = getIconsWebPath(baseDir) replyStr = '' showPublicOnDropdown = True @@ -292,8 +290,11 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, scopeIcon = 'scope_public.png' scopeDescription = translate['Public'] - placeholderSubject = \ - translate['Subject or Content Warning (optional)'] + '...' + if shareDescription: + placeholderSubject = translate['Ask about a shared item.'] + '..' + else: + placeholderSubject = \ + translate['Subject or Content Warning (optional)'] + '...' placeholderMentions = '' if inReplyTo: # mentionsAndContent = getMentionsString(content) @@ -491,7 +492,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, dateAndLocation += \ '

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

    \n' + 'icons/calendar.png"/>\n' # select start time for the event dateAndLocation += '\n' @@ -519,7 +520,7 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, dateAndLocation += \ '
    \n' + 'icons/calendar.png"/>\n' dateAndLocation += '\n' dateAndLocation += '\n' @@ -612,12 +613,11 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, dropdownReportSuffix += '?mention=' + mentionedActor dropDownContent = '' - if not reportUrl: + if not reportUrl and not shareDescription: dropDownContent = \ htmlNewPostDropDown(scopeIcon, scopeDescription, replyStr, translate, - iconsPath, showPublicOnDropdown, defaultTimeline, pathBase, @@ -630,7 +630,9 @@ def htmlNewPost(cssCache: {}, mediaInstance: bool, translate: {}, dropdownEventSuffix, dropdownReportSuffix) else: - mentionsStr = 'Re: ' + reportUrl + '\n\n' + mentionsStr + if not shareDescription: + # reporting a post to moderator + mentionsStr = 'Re: ' + reportUrl + '\n\n' + mentionsStr newPostForm += \ '

    ' + placeholderSubject + '
    ' - newPostForm += ' ' + if not shareDescription: + shareDescription = '' + newPostForm += \ + ' ' newPostForm += '' selectedStr = ' selected' diff --git a/webapp_frontscreen.py b/webapp_frontscreen.py index d8e7e5b90..6589b78cc 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, + 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) # If this is the news account then show a different banner bannerFile, bannerFilename = getBannerFile(baseDir, nickname, domain) @@ -123,12 +120,10 @@ def htmlFrontScreen(rssIconAtTop: bool, profileHeaderStr += ' \n' profileHeaderStr += ' \n' profileHeaderStr += ' \n' - iconsPath = getIconsWebPath(baseDir) profileHeaderStr += \ getLeftColumnContent(baseDir, 'news', domainFull, httpPrefix, translate, - iconsPath, False, - False, None, rssIconAtTop, True, + False, False, None, rssIconAtTop, True, True) profileHeaderStr += ' \n' profileHeaderStr += ' \n' @@ -155,12 +150,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, - newswire, False, + False, False, newswire, False, False, None, False, False, False, True, authorized, True) profileFooterStr += ' \n' diff --git a/webapp_headerbuttons.py b/webapp_headerbuttons.py index ae987be95..83bb68cb1 100644 --- a/webapp_headerbuttons.py +++ b/webapp_headerbuttons.py @@ -38,7 +38,6 @@ def headerButtonsTimeline(defaultTimeline: str, newPostButtonStr: str, baseDir: str, nickname: str, domain: str, - iconsPath: str, timelineStartTime, newCalendarEvent: bool, calendarPath: str, @@ -212,7 +211,7 @@ def headerButtonsTimeline(defaultTimeline: str, tlStr += \ '| ' + \
                 translate['Search and follow'] + \
                 '' @@ -239,7 +238,7 @@ def headerButtonsTimeline(defaultTimeline: str, tlStr += \ ' | ' + calendarAltText + \
                 '\n' @@ -256,7 +255,7 @@ def headerButtonsTimeline(defaultTimeline: str, tlStr += \ ' | ' + translate['Show/Hide Buttons'] + \
                 '\n' @@ -278,7 +277,7 @@ def headerButtonsTimeline(defaultTimeline: str, tlStr += \ '' + \ - '| ' + translate['News'] + \
             '' @@ -296,7 +295,7 @@ def headerButtonsTimeline(defaultTimeline: str, tlStr += \ '' + \ - '| ' + translate['Edit Links'] + \
             '' diff --git a/webapp_post.py b/webapp_post.py index 366a56b64..87be26f42 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 @@ -202,6 +201,14 @@ def getAvatarImageUrl(session, return avatarUrl +def getBrokenLinkSubstitute() -> str: + """Returns html used to show a default image if the link to + an image is broken + """ + return " onerror=\"this.onerror=null; this.src='" + \ + "icons/avatar_default.png'\"" + + def getAvatarImageHtml(showAvatarOptions: bool, nickname: str, domainFull: str, avatarUrl: str, postActor: str, @@ -215,7 +222,7 @@ def getAvatarImageHtml(showAvatarOptions: bool, avatarLink += \ '  \n' + getBrokenLinkSubstitute() + '/>\n' if showAvatarOptions and \ domainFull + '/users/' + nickname not in postActor: @@ -227,20 +234,22 @@ def getAvatarImageHtml(showAvatarOptions: bool, avatarLink += \ ' \n' + '" src="' + avatarUrl + '" ' + avatarPosition + \ + getBrokenLinkSubstitute() + '/>\n' else: # don't link to the person options for the news account avatarLink += \ ' \n' + '" src="' + avatarUrl + '" ' + avatarPosition + \ + getBrokenLinkSubstitute() + '/>\n' return avatarLink.strip() def getReplyIconHtml(nickname: str, isPublicRepeat: bool, showIcons: bool, commentsEnabled: bool, postJsonObject: {}, pageNumberParam: str, - iconsPath: str, translate: {}) -> str: + translate: {}) -> str: """Returns html for the reply icon/button """ replyStr = '' @@ -292,13 +301,13 @@ def getReplyIconHtml(nickname: str, isPublicRepeat: bool, ' ' + \ '' + replyToThisPostStr + \
-        ' |\n' + ' |" src="/icons/reply.png"/>\n' return replyStr def getEditIconHtml(baseDir: str, nickname: str, domainFull: str, postJsonObject: {}, actorNickname: str, - translate: {}, iconsPath: str, isEvent: bool) -> str: + translate: {}, isEvent: bool) -> str: """Returns html for the edit icon/button """ editStr = '' @@ -325,7 +334,7 @@ def getEditIconHtml(baseDir: str, nickname: str, domainFull: str, '" title="' + editBlogPostStr + '">' + \ '' + editBlogPostStr + \
-                    ' |\n' + ' |" src="/icons/edit.png"/>\n' else: editStr += \ ' ' + \ @@ -336,7 +345,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 += \ @@ -348,7 +357,7 @@ def getEditIconHtml(baseDir: str, nickname: str, domainFull: str, '" title="' + editEventStr + '">' + \ '' + editEventStr + \
-                ' |\n' + ' |" src="/icons/edit.png"/>\n' return editStr @@ -360,7 +369,7 @@ def getAnnounceIconHtml(nickname: str, domainFull: str, translate: {}, pageNumberParam: str, timelinePostBookmark: str, - boxName: str, iconsPath: str) -> str: + boxName: str) -> str: """Returns html for announce icon/button """ announceStr = '' @@ -390,7 +399,7 @@ def getAnnounceIconHtml(nickname: str, domainFull: str, ' ' + \ '' + translate['Repeat this post'] + \
-            ' |\n' + ' |" src="/icons/' + announceIcon + '"/>\n' return announceStr @@ -402,7 +411,7 @@ def getLikeIconHtml(nickname: str, domainFull: str, postStartTime, translate: {}, pageNumberParam: str, timelinePostBookmark: str, - boxName: str, iconsPath: str) -> str: + boxName: str) -> str: """Returns html for like icon/button """ likeStr = '' @@ -448,7 +457,7 @@ def getLikeIconHtml(nickname: str, domainFull: str, ' ' + \ '' + likeTitle + \
-            ' |\n' + ' |" src="/icons/' + likeIcon + '"/>\n' return likeStr @@ -459,8 +468,7 @@ def getBookmarkIconHtml(nickname: str, domainFull: str, enableTimingLog: bool, postStartTime, boxName: str, pageNumberParam: str, - timelinePostBookmark: str, - iconsPath: str) -> str: + timelinePostBookmark: str) -> str: """Returns html for bookmark icon/button """ bookmarkStr = '' @@ -486,7 +494,7 @@ def getBookmarkIconHtml(nickname: str, domainFull: str, bookmarkStr += \ ' ' + \ '' + \
-        bookmarkTitle + ' |\n' return bookmarkStr @@ -497,7 +505,6 @@ def getMuteIconHtml(isMuted: bool, nickname: str, domainFull: str, allowDeletion: bool, pageNumberParam: str, - iconsPath: str, boxName: str, timelinePostBookmark: str, translate: {}) -> str: @@ -520,7 +527,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 @@ -542,7 +549,6 @@ def getDeleteIconHtml(nickname: str, domainFull: str, messageId: str, postJsonObject: {}, pageNumberParam: str, - iconsPath: str, translate: {}) -> str: """Returns html for delete icon/button """ @@ -562,7 +568,7 @@ def getDeleteIconHtml(nickname: str, domainFull: str, '' + \
                     translate['Delete this post'] + \
                     ' |\n' + '" src="/icons/delete.png"/>\n' return deleteStr @@ -634,24 +640,24 @@ def getBlogCitationsHtml(boxName: str, return citationsStr -def boostOwnTootHtml(translate: {}, iconsPath) -> str: +def boostOwnTootHtml(translate: {}) -> str: """The html title for announcing your own post """ return ' ' + translate['announces'] + \
-        '\n' -def announceUnattributedHtml(translate: {}, iconsPath: str, +def announceUnattributedHtml(translate: {}, postJsonObject: {}) -> str: """Returns the html for an announce title where there is no attribution on the announced post """ return ' ' + \
-        translate['announces'] + '\n' + \ ' @unattributed\n' -def announceWithoutDisplayNameHtml(translate: {}, iconsPath: str, +def announceWithoutDisplayNameHtml(translate: {}, announceNickname: str, announceDomain: str, postJsonObject: {}) -> str: @@ -668,7 +674,7 @@ def announceWithoutDisplayNameHtml(translate: {}, iconsPath: str, """ return ' ' + translate['announces'] + \
-        '\n' + \ ' @' + \ @@ -676,7 +682,6 @@ def announceWithoutDisplayNameHtml(translate: {}, iconsPath: str, def announceWithDisplayNameHtml(translate: {}, - iconsPath: str, postJsonObject: {}, announceDisplayName: str) -> str: """Returns html for an announce having a display name @@ -684,7 +689,7 @@ def announceWithDisplayNameHtml(translate: {}, return ' ' + \
         translate['announces'] + '\n' + \ ' ' \ ' \n \n' else: titleStr += \ - announceWithoutDisplayNameHtml(translate, iconsPath, + announceWithoutDisplayNameHtml(translate, announceNickname, announceDomain, postJsonObject) else: titleStr += \ - announceUnattributedHtml(translate, iconsPath, + announceUnattributedHtml(translate, postJsonObject) else: titleStr += \ - announceUnattributedHtml(translate, iconsPath, postJsonObject) + announceUnattributedHtml(translate, postJsonObject) return (titleStr, replyAvatarImageInPost, containerClassIcons, containerClass) -def replyToYourselfHtml(translate: {}, iconsPath: str) -> str: +def replyToYourselfHtml(translate: {}, ) -> str: """Returns html for a title which is a reply to yourself """ return ' ' + translate['replying to themselves'] + \
-        '\n' -def replyToUnknownHtml(translate: {}, iconsPath: str, +def replyToUnknownHtml(translate: {}, postJsonObject: {}) -> str: """Returns the html title for a reply to an unknown handle """ return ' ' + \
-        translate['replying to'] + '\n' + \ ' @unknown\n' -def replyWithUnknownPathHtml(translate: {}, iconsPath: str, +def replyWithUnknownPathHtml(translate: {}, postJsonObject: {}, postDomain: str) -> str: """Returns html title for a reply with an unknown path @@ -832,8 +835,7 @@ def replyWithUnknownPathHtml(translate: {}, iconsPath: str, return ' ' + translate['replying to'] + \
-        '\n' + \ ' \n' + \ ' ' + \ replyDisplayName + '\n' -def getReplyWithoutDisplayName(translate: {}, iconsPath: str, +def getReplyWithoutDisplayName(translate: {}, inReplyTo: str, replyNickname: str, replyDomain: str) -> str: """Returns html for a reply without a display name, @@ -865,7 +867,7 @@ def getReplyWithoutDisplayName(translate: {}, iconsPath: str, return ' ' + \ '' + translate['replying to'] + \
-        '\n' + ' @' + \ replyNickname + '@' + replyDomain + '\n' @@ -879,7 +881,6 @@ def getPostTitleReplyHtml(baseDir: str, postJsonObject: {}, postActor: str, translate: {}, - iconsPath: str, enableTimingLog: bool, postStartTime, boxName: str, @@ -903,7 +904,7 @@ def getPostTitleReplyHtml(baseDir: str, containerClassIcons = 'containericons darker' containerClass = 'container darker' if postJsonObject['object']['inReplyTo'].startswith(postActor): - titleStr += replyToYourselfHtml(translate, iconsPath) + titleStr += replyToYourselfHtml(translate) return (titleStr, replyAvatarImageInPost, containerClassIcons, containerClass) @@ -936,8 +937,7 @@ def getPostTitleReplyHtml(baseDir: str, logPostTiming(enableTimingLog, postStartTime, '13.6') titleStr += \ - getReplyHtml(translate, iconsPath, - inReplyTo, replyDisplayName) + getReplyHtml(translate, inReplyTo, replyDisplayName) logPostTiming(enableTimingLog, postStartTime, '13.7') @@ -971,18 +971,19 @@ def getPostTitleReplyHtml(baseDir: str, translate['Show profile'] replyAvatarImageInPost += \ '" alt=" "' + \ - avatarPosition + '/>\n' + \ - ' \n' + avatarPosition + \ + getBrokenLinkSubstitute() + \ + '/>\n \n' else: inReplyTo = \ postJsonObject['object']['inReplyTo'] titleStr += \ - getReplyWithoutDisplayName(translate, iconsPath, + getReplyWithoutDisplayName(translate, inReplyTo, replyNickname, replyDomain) else: titleStr += \ - replyToUnknownHtml(translate, iconsPath, postJsonObject) + replyToUnknownHtml(translate, postJsonObject) else: postDomain = \ postJsonObject['object']['inReplyTo'] @@ -993,7 +994,7 @@ def getPostTitleReplyHtml(baseDir: str, postDomain = postDomain.split('/', 1)[0] if postDomain: titleStr += \ - replyWithUnknownPathHtml(translate, iconsPath, + replyWithUnknownPathHtml(translate, postJsonObject, postDomain) return (titleStr, replyAvatarImageInPost, @@ -1008,7 +1009,6 @@ def getPostTitleHtml(baseDir: str, postJsonObject: {}, postActor: str, translate: {}, - iconsPath: str, enableTimingLog: bool, postStartTime, boxName: str, @@ -1037,7 +1037,6 @@ def getPostTitleHtml(baseDir: str, postJsonObject, postActor, translate, - iconsPath, enableTimingLog, postStartTime, boxName, @@ -1057,7 +1056,6 @@ def getPostTitleHtml(baseDir: str, postJsonObject, postActor, translate, - iconsPath, enableTimingLog, postStartTime, boxName, @@ -1098,7 +1096,7 @@ def getFooterWithIcons(showIcons: bool, def individualPostAsHtml(allowDownloads: bool, recentPostsCache: {}, maxRecentPosts: int, - iconsPath: str, translate: {}, + translate: {}, pageNumber: int, baseDir: str, session, wfRequest: {}, personCache: {}, nickname: str, domain: str, port: int, @@ -1308,7 +1306,7 @@ def individualPostAsHtml(allowDownloads: bool, if showDMicon: titleStr = \ titleStr + ' \n' + 'icons/dm.png" class="DMicon"/>\n' # check if replying is permitted commentsEnabled = True @@ -1319,7 +1317,7 @@ def individualPostAsHtml(allowDownloads: bool, replyStr = getReplyIconHtml(nickname, isPublicRepeat, showIcons, commentsEnabled, postJsonObject, pageNumberParam, - iconsPath, translate) + translate) logPostTiming(enableTimingLog, postStartTime, '10') @@ -1329,7 +1327,7 @@ def individualPostAsHtml(allowDownloads: bool, editStr = getEditIconHtml(baseDir, nickname, domainFull, postJsonObject, actorNickname, - translate, iconsPath, isEvent) + translate, isEvent) announceStr = \ getAnnounceIconHtml(nickname, domainFull, @@ -1340,7 +1338,7 @@ def individualPostAsHtml(allowDownloads: bool, translate, pageNumberParam, timelinePostBookmark, - boxName, iconsPath) + boxName) logPostTiming(enableTimingLog, postStartTime, '12') @@ -1359,7 +1357,7 @@ def individualPostAsHtml(allowDownloads: bool, postStartTime, translate, pageNumberParam, timelinePostBookmark, - boxName, iconsPath) + boxName) logPostTiming(enableTimingLog, postStartTime, '12.5') @@ -1371,8 +1369,7 @@ def individualPostAsHtml(allowDownloads: bool, enableTimingLog, postStartTime, boxName, pageNumberParam, - timelinePostBookmark, - iconsPath) + timelinePostBookmark) logPostTiming(enableTimingLog, postStartTime, '12.9') @@ -1387,7 +1384,6 @@ def individualPostAsHtml(allowDownloads: bool, nickname, domainFull, allowDeletion, pageNumberParam, - iconsPath, boxName, timelinePostBookmark, translate) @@ -1399,7 +1395,6 @@ def individualPostAsHtml(allowDownloads: bool, messageId, postJsonObject, pageNumberParam, - iconsPath, translate) logPostTiming(enableTimingLog, postStartTime, '13.1') @@ -1416,7 +1411,6 @@ def individualPostAsHtml(allowDownloads: bool, postJsonObject, postActor, translate, - iconsPath, enableTimingLog, postStartTime, boxName, @@ -1613,7 +1607,6 @@ def htmlIndividualPost(cssCache: {}, showPublishedDateOnly: bool) -> str: """Show an individual post as html """ - iconsPath = getIconsWebPath(baseDir) postStr = '' if likedBy: likedByNickname = getNicknameFromActor(likedBy) @@ -1649,7 +1642,7 @@ def htmlIndividualPost(cssCache: {}, postStr += \ individualPostAsHtml(True, recentPostsCache, maxRecentPosts, - iconsPath, translate, None, + translate, None, baseDir, session, wfRequest, personCache, nickname, domain, port, postJsonObject, None, True, False, @@ -1672,7 +1665,7 @@ def htmlIndividualPost(cssCache: {}, postStr = \ individualPostAsHtml(True, recentPostsCache, maxRecentPosts, - iconsPath, translate, None, + translate, None, baseDir, session, wfRequest, personCache, nickname, domain, port, @@ -1701,7 +1694,7 @@ def htmlIndividualPost(cssCache: {}, postStr += \ individualPostAsHtml(True, recentPostsCache, maxRecentPosts, - iconsPath, translate, None, + translate, None, baseDir, session, wfRequest, personCache, nickname, domain, port, item, @@ -1728,14 +1721,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, + 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..a6985d1f9 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, + translate, None, baseDir, session, cachedWebfingers, personCache, nickname, domain, port, item, avatarUrl, False, False, @@ -284,7 +282,7 @@ def htmlProfileAfterSearch(cssCache: {}, def getProfileHeader(baseDir: str, nickname: str, domain: str, - domainFull: str, translate: {}, iconsPath: str, + domainFull: str, translate: {}, defaultTimeline: str, displayName: str, avatarDescription: str, @@ -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, 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, + 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 1d0a3636f..378fa653d 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 = '' @@ -116,8 +114,10 @@ def htmlSearchSharedItems(cssCache: {}, translate: {}, sharedItemsForm = \ htmlHeaderWithExternalStyle(cssFilename) sharedItemsForm += \ - '

    ' + translate['Shared Items Search'] + \ - '

    ' + '

    ' + \ + '' + \ + translate['Shared Items Search'] + \ + '

    ' resultsExist = False for subdir, dirs, files in os.walk(baseDir + '/accounts'): for handle in dirs: @@ -213,14 +213,14 @@ def htmlSearchSharedItems(cssCache: {}, translate: {}, '" type="submit" name="submitSearch">\n' sharedItemsForm += \ ' ' + translate['Page up'] + \
                                 '\n' sharedItemsForm += ' \n' sharedItemsForm += '\n' - resultsExist = True + resultsExist = True ctr += 1 if ctr >= resultsPerPage: currPage += 1 @@ -247,7 +247,7 @@ def htmlSearchSharedItems(cssCache: {}, translate: {}, '" type="submit" name="submitSearch">\n' sharedItemsForm += \ ' ' + translate['Page down'] + \
@@ -382,7 +382,8 @@ def htmlSearch(cssCache: {}, translate: {},
     return followStr
 
 
-def htmlSkillsSearch(cssCache: {}, translate: {}, baseDir: str,
+def htmlSkillsSearch(actor: str,
+                     cssCache: {}, translate: {}, baseDir: str,
                      httpPrefix: str,
                      skillsearch: str, instanceOnly: bool,
                      postsPerPage: int) -> str:
@@ -473,8 +474,10 @@ def htmlSkillsSearch(cssCache: {}, translate: {}, baseDir: str,
 
     skillSearchForm = htmlHeaderWithExternalStyle(cssFilename)
     skillSearchForm += \
-        '<center><h1>' + translate['Skills search'] + ': ' + \
-        skillsearch + '</h1></center>'
+        '<center><h1><a href = ' + \ + translate['Skills search'] + ': ' + \ + skillsearch + \ + '' if len(results) == 0: skillSearchForm += \ @@ -538,8 +541,15 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str, htmlHeaderWithExternalStyle(cssFilename) # add the page title + domainFull = domain + if port: + if port != 80 and port != 443: + domainFull = domain + ':' + str(port) + actor = httpPrefix + '://' + domainFull + '/users/' + nickname historySearchForm += \ - '

    ' + translate['Your Posts'] + '

    ' + '

    ' + \ + translate['Your Posts'] + \ + '

    ' if len(boxFilenames) == 0: historySearchForm += \ @@ -547,7 +557,6 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str, '' return historySearchForm - iconsPath = getIconsWebPath(baseDir) separatorStr = htmlPostSeparator(baseDir, None) # ensure that the page number is in bounds @@ -578,7 +587,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str, postStr = \ individualPostAsHtml(True, recentPostsCache, maxRecentPosts, - iconsPath, translate, None, + translate, None, baseDir, session, wfRequest, personCache, nickname, domain, port, @@ -623,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 @@ -670,7 +678,7 @@ def htmlHashtagSearch(cssCache: {}, hashtagSearchForm += \ 'RSS 2.0\n' + 'icons/logorss.png" />\n' # edit the category for this hashtag if isEditor(baseDir, nickname): @@ -699,7 +707,7 @@ def htmlHashtagSearch(cssCache: {}, ' ' + translate['Page up'] + \
             '\n \n' @@ -744,7 +752,7 @@ def htmlHashtagSearch(cssCache: {}, postStr = \ individualPostAsHtml(allowDownloads, recentPostsCache, maxRecentPosts, - iconsPath, translate, None, + translate, None, baseDir, session, wfRequest, personCache, nickname, domain, port, @@ -769,7 +777,7 @@ def htmlHashtagSearch(cssCache: {}, '
    \n' + \ ' ' + translate['Page down'] + '' + \ '
    ' diff --git a/webapp_timeline.py b/webapp_timeline.py index ada794366..43459c655 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, 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, 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, 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, + 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, moderator, editor, newswire, positiveVoting, False, None, True, @@ -627,18 +622,20 @@ def htmlIndividualShare(actor: str, item: {}, translate: {}, '' + translate['Category'] + ': ' + item['category'] + ' ' profileStr += \ '' + translate['Location'] + ': ' + item['location'] + '

    \n' - if showContact: - contactActor = item['actor'] - profileStr += \ - '

    \n' - if removeButton: - profileStr += \ - ' \n' + sharedesc = item['displayName'] + if '<' not in sharedesc and '?' not in sharedesc: + if showContact: + contactActor = item['actor'] + profileStr += \ + '

    \n' + if removeButton: + profileStr += \ + ' \n' profileStr += '\n' return profileStr @@ -660,13 +657,12 @@ def htmlSharesTimeline(translate: {}, pageNumber: int, itemsPerPage: int, timelineStr = '' if pageNumber > 1: - iconsPath = getIconsWebPath(baseDir) timelineStr += \ '

    \n' + \ ' ' + translate['Page up'] + '\n' + \ '
    \n' @@ -684,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 3019d40ff..b8caff443 100644 --- a/webapp_utils.py +++ b/webapp_utils.py @@ -68,8 +68,7 @@ def htmlHashtagBlocked(cssCache: {}, baseDir: str, translate: {}) -> str: def headerButtonsFrontScreen(translate: {}, nickname: str, boxName: str, authorized: bool, - iconsAsButtons: bool, - iconsPath: bool) -> str: + iconsAsButtons: bool) -> str: """Returns the header buttons for the front page of a news instance """ headerStr = '' @@ -110,13 +109,13 @@ def headerButtonsFrontScreen(translate: {}, headerStr += \ ' ' + \ - '| ' + translate['Newswire'] + '\n' headerStr += \ ' ' + \ - '| ' + translate['Links'] + '\n' else: @@ -390,17 +389,6 @@ def getPersonAvatarUrl(baseDir: str, personUrl: str, personCache: {}, return None -def getIconsWebPath(baseDir: str) -> str: - """Returns the web path where icons exist - """ - iconsPath = 'icons' - theme = getConfigParam(baseDir, 'theme') - if theme: - if os.path.isdir(baseDir + '/theme/' + theme + '/icons'): - iconsPath = 'icons/' + theme - return iconsPath - - def scheduledPostsExist(baseDir: str, nickname: str, domain: str) -> bool: """Returns true if there are posts scheduled to be delivered """ @@ -422,24 +410,26 @@ def sharesTimelineJson(actor: str, pageNumber: int, itemsPerPage: int, allSharesJson = {} for subdir, dirs, files in os.walk(baseDir + '/accounts'): for handle in dirs: - if '@' in handle: - accountDir = baseDir + '/accounts/' + handle - sharesFilename = accountDir + '/shares.json' - if os.path.isfile(sharesFilename): - sharesJson = loadJson(sharesFilename) - if not sharesJson: - continue - nickname = handle.split('@')[0] - # actor who owns this share - owner = actor.split('/users/')[0] + '/users/' + nickname - ctr = 0 - for itemID, item in sharesJson.items(): - # assign owner to the item - item['actor'] = owner - allSharesJson[str(item['published'])] = item - ctr += 1 - if ctr >= maxSharesPerAccount: - break + if '@' not in handle: + continue + accountDir = baseDir + '/accounts/' + handle + sharesFilename = accountDir + '/shares.json' + if not os.path.isfile(sharesFilename): + continue + sharesJson = loadJson(sharesFilename) + if not sharesJson: + continue + nickname = handle.split('@')[0] + # actor who owns this share + owner = actor.split('/users/')[0] + '/users/' + nickname + ctr = 0 + for itemID, item in sharesJson.items(): + # assign owner to the item + item['actor'] = owner + allSharesJson[str(item['published'])] = item + ctr += 1 + if ctr >= maxSharesPerAccount: + break # sort the shared items in descending order of publication date sharesJson = OrderedDict(sorted(allSharesJson.items(), reverse=True)) lastPage = False @@ -835,7 +825,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" @@ -847,7 +836,7 @@ def htmlPostSeparator(baseDir: str, column: str) -> str: if os.path.isfile(separatorImageFilename): separatorStr = \ '
    ' + \ - '' + \ + '' + \ '
    \n' return separatorStr