Set an alternative twitter domain

merge-requests/26/head
Bob Mottram 2021-09-18 18:08:14 +01:00
parent 0e3a136c60
commit fc65d8e598
33 changed files with 352 additions and 57 deletions

View File

@ -119,6 +119,7 @@ from threads import removeDormantThreads
from media import processMetaData
from media import convertImageToLowBandwidth
from media import replaceYouTube
from media import replaceTwitter
from media import attachMedia
from media import pathIsVideo
from media import pathIsAudio
@ -1202,6 +1203,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.proxyType, version,
self.server.debug,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.allowLocalNetworkAccess,
city, self.server.systemLanguage,
@ -3012,6 +3014,7 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix,
self.server.projectVersion,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
@ -3069,6 +3072,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.personCache,
port,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
@ -3106,6 +3110,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.personCache,
port,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
@ -3187,6 +3192,8 @@ class PubServer(BaseHTTPRequestHandler):
signingPrivateKeyPem = \
self.server.signingPrivateKeyPem
twitterReplacementDomain = \
self.server.twitterReplacementDomain
profileStr = \
htmlProfileAfterSearch(self.server.cssCache,
self.server.recentPostsCache,
@ -3205,6 +3212,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.debug,
self.server.projectVersion,
self.server.YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
self.server.defaultTimeline,
self.server.peertubeInstances,
@ -4711,6 +4719,29 @@ class PubServer(BaseHTTPRequestHandler):
'youtubedomain', '')
self.server.YTReplacementDomain = None
# change twitter alternate domain
if fields.get('twitterdomain'):
currTwitterDomain = \
self.server.twitterReplacementDomain
if fields['twitterdomain'] != currTwitterDomain:
newTwitterDomain = fields['twitterdomain']
if '://' in newTwitterDomain:
newTwitterDomain = \
newTwitterDomain.split('://')[1]
if '/' in newTwitterDomain:
newTwitterDomain = \
newTwitterDomain.split('/')[0]
if '.' in newTwitterDomain:
setConfigParam(baseDir,
'twitterdomain',
newTwitterDomain)
self.server.twitterReplacementDomain = \
newTwitterDomain
else:
setConfigParam(baseDir,
'twitterdomain', '')
self.server.twitterReplacementDomain = None
# change custom post submit button text
currCustomSubmitText = \
getConfigParam(baseDir, 'customSubmitText')
@ -6717,6 +6748,7 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix,
self.server.projectVersion,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
@ -6779,6 +6811,7 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix,
self.server.projectVersion,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.systemLanguage)
if hashtagStr:
msg = hashtagStr.encode('utf-8')
@ -6927,6 +6960,7 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix, self.server.projectVersion,
timelineStr,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
@ -7381,6 +7415,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.projectVersion,
timelineStr,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
@ -7522,6 +7557,7 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix,
self.server.projectVersion, timelineStr,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
@ -7653,6 +7689,7 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix, self.server.projectVersion,
timelineStr,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
@ -7785,6 +7822,7 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix,
self.server.projectVersion, timelineStr,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
@ -7889,6 +7927,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cachedWebfingers,
self.server.personCache, callingDomain,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
@ -7984,6 +8023,7 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix,
self.server.projectVersion, timelineStr,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
@ -8083,6 +8123,7 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix,
self.server.projectVersion, timelineStr,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
@ -8190,6 +8231,8 @@ class PubServer(BaseHTTPRequestHandler):
personCache = self.server.personCache
projectVersion = self.server.projectVersion
ytDomain = self.server.YTReplacementDomain
twitterReplacementDomain = \
self.server.twitterReplacementDomain
peertubeInstances = self.server.peertubeInstances
msg = \
htmlPostReplies(self.server.cssCache,
@ -8207,6 +8250,7 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix,
projectVersion,
ytDomain,
twitterReplacementDomain,
self.server.showPublishedDateOnly,
peertubeInstances,
self.server.allowLocalNetworkAccess,
@ -8280,6 +8324,8 @@ class PubServer(BaseHTTPRequestHandler):
personCache = self.server.personCache
projectVersion = self.server.projectVersion
ytDomain = self.server.YTReplacementDomain
twitterReplacementDomain = \
self.server.twitterReplacementDomain
peertubeInstances = self.server.peertubeInstances
msg = \
htmlPostReplies(self.server.cssCache,
@ -8297,6 +8343,7 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix,
projectVersion,
ytDomain,
twitterReplacementDomain,
self.server.showPublishedDateOnly,
peertubeInstances,
self.server.allowLocalNetworkAccess,
@ -8367,6 +8414,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cachedWebfingers
YTReplacementDomain = \
self.server.YTReplacementDomain
twitterReplacementDomain = \
self.server.twitterReplacementDomain
iconsAsButtons = \
self.server.iconsAsButtons
@ -8394,6 +8443,7 @@ class PubServer(BaseHTTPRequestHandler):
cachedWebfingers,
self.server.personCache,
YTReplacementDomain,
twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.newswire,
self.server.themeName,
@ -8465,6 +8515,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cachedWebfingers
YTReplacementDomain = \
self.server.YTReplacementDomain
twitterReplacementDomain = \
self.server.twitterReplacementDomain
showPublishedDateOnly = \
self.server.showPublishedDateOnly
iconsAsButtons = \
@ -8501,6 +8553,7 @@ class PubServer(BaseHTTPRequestHandler):
cachedWebfingers,
self.server.personCache,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
self.server.newswire,
self.server.themeName,
@ -8643,6 +8696,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.projectVersion,
likedBy,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.peertubeInstances,
self.server.allowLocalNetworkAccess,
@ -8763,7 +8817,8 @@ class PubServer(BaseHTTPRequestHandler):
personCache: {},
allowDeletion: bool,
projectVersion: str,
YTReplacementDomain: str) -> bool:
YTReplacementDomain: str,
twitterReplacementDomain: str) -> bool:
"""Shows the inbox timeline
"""
if '/users/' in path:
@ -8847,6 +8902,7 @@ class PubServer(BaseHTTPRequestHandler):
projectVersion,
minimalNick,
YTReplacementDomain,
twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.newswire,
self.server.positiveVoting,
@ -8990,6 +9046,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.projectVersion,
minimalNick,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.newswire,
self.server.positiveVoting,
@ -9125,6 +9182,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.projectVersion,
minimalNick,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.newswire,
self.server.positiveVoting,
@ -9258,6 +9316,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.projectVersion,
minimalNick,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.newswire,
self.server.positiveVoting,
@ -9392,6 +9451,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.projectVersion,
minimalNick,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.newswire,
self.server.positiveVoting,
@ -9534,6 +9594,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.projectVersion,
minimalNick,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.newswire,
moderator, editor,
@ -9676,6 +9737,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.projectVersion,
minimalNick,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.newswire,
self.server.positiveVoting,
@ -9777,6 +9839,7 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix,
self.server.projectVersion,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.newswire,
self.server.positiveVoting,
@ -9859,6 +9922,7 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix,
self.server.projectVersion,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.newswire,
self.server.positiveVoting,
@ -9977,6 +10041,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.projectVersion,
minimalNick,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.newswire,
self.server.positiveVoting,
@ -10108,6 +10173,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.projectVersion,
minimalNick,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.newswire,
self.server.positiveVoting,
@ -10210,6 +10276,8 @@ class PubServer(BaseHTTPRequestHandler):
sharedItemsFederatedDomains = \
self.server.sharedItemsFederatedDomains
twitterReplacementDomain = \
self.server.twitterReplacementDomain
msg = \
htmlModeration(self.server.cssCache,
self.server.defaultTimeline,
@ -10229,6 +10297,7 @@ class PubServer(BaseHTTPRequestHandler):
httpPrefix,
self.server.projectVersion,
self.server.YTReplacementDomain,
twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.newswire,
self.server.positiveVoting,
@ -10354,6 +10423,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cachedWebfingers,
self.server.personCache,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.newswire,
self.server.themeName,
@ -10471,6 +10541,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cachedWebfingers,
self.server.personCache,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.newswire,
self.server.themeName,
@ -10588,6 +10659,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cachedWebfingers,
self.server.personCache,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.newswire,
self.server.themeName,
@ -10728,6 +10800,7 @@ class PubServer(BaseHTTPRequestHandler):
self.server.cachedWebfingers,
self.server.personCache,
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain,
self.server.showPublishedDateOnly,
self.server.newswire,
self.server.themeName,
@ -14103,7 +14176,8 @@ class PubServer(BaseHTTPRequestHandler):
self.server.personCache,
self.server.allowDeletion,
self.server.projectVersion,
self.server.YTReplacementDomain):
self.server.YTReplacementDomain,
self.server.twitterReplacementDomain):
return
self._benchmarkGETtimings(GETstartTime, GETtimings,
@ -14952,6 +15026,9 @@ class PubServer(BaseHTTPRequestHandler):
replaceYouTube(postJsonObject,
self.server.YTReplacementDomain,
self.server.systemLanguage)
replaceTwitter(postJsonObject,
self.server.twitterReplacementDomain,
self.server.systemLanguage)
saveJson(postJsonObject, postFilename)
# also save to the news actor
if nickname != 'news':
@ -16493,6 +16570,7 @@ def runDaemon(defaultReplyIntervalHours: int,
baseDir: str, domain: str,
onionDomain: str, i2pDomain: str,
YTReplacementDomain: str,
twitterReplacementDomain: str,
port: int = 80, proxyPort: int = 80,
httpPrefix: str = 'https',
fedList: [] = [],
@ -16608,6 +16686,7 @@ def runDaemon(defaultReplyIntervalHours: int,
# unit tests are run on the local network with LAN addresses
httpd.allowLocalNetworkAccess = True
httpd.YTReplacementDomain = YTReplacementDomain
httpd.twitterReplacementDomain = twitterReplacementDomain
# newswire storing rss feeds
httpd.newswire = {}
@ -16913,6 +16992,7 @@ def runDaemon(defaultReplyIntervalHours: int,
allowDeletion, debug, maxMentions, maxEmoji,
httpd.translate, unitTest,
httpd.YTReplacementDomain,
httpd.twitterReplacementDomain,
httpd.showPublishedDateOnly,
httpd.maxFollowers,
httpd.allowLocalNetworkAccess,

View File

@ -692,6 +692,7 @@ def _readLocalBoxPost(session, nickname: str, domain: str,
recentPostsCache = {}
allowLocalNetworkAccess = False
YTReplacementDomain = None
twitterReplacementDomain = None
postJsonObject2 = \
downloadAnnounce(session, baseDir,
httpPrefix,
@ -699,6 +700,7 @@ def _readLocalBoxPost(session, nickname: str, domain: str,
postJsonObject,
__version__, translate,
YTReplacementDomain,
twitterReplacementDomain,
allowLocalNetworkAccess,
recentPostsCache, False,
systemLanguage,
@ -2375,6 +2377,7 @@ def runDesktopClient(baseDir: str, proxyType: str, httpPrefix: str,
recentPostsCache = {}
allowLocalNetworkAccess = False
YTReplacementDomain = None
twitterReplacementDomain = None
postJsonObject2 = \
downloadAnnounce(session, baseDir,
httpPrefix,
@ -2382,6 +2385,7 @@ def runDesktopClient(baseDir: str, proxyType: str, httpPrefix: str,
postJsonObject,
__version__, translate,
YTReplacementDomain,
twitterReplacementDomain,
allowLocalNetworkAccess,
recentPostsCache, False,
systemLanguage,

View File

@ -223,6 +223,9 @@ parser.add_argument('--path', dest='baseDir',
parser.add_argument('--ytdomain', dest='YTReplacementDomain',
type=str, default=None,
help='Domain used to replace youtube.com')
parser.add_argument('--twitterdomain', dest='twitterReplacementDomain',
type=str, default=None,
help='Domain used to replace twitter.com')
parser.add_argument('--language', dest='language',
type=str, default=None,
help='Language code, eg. en/fr/de/es')
@ -3022,6 +3025,15 @@ if YTDomain:
if '.' in YTDomain:
args.YTReplacementDomain = YTDomain
twitterDomain = getConfigParam(baseDir, 'twitterdomain')
if twitterDomain:
if '://' in twitterDomain:
twitterDomain = twitterDomain.split('://')[1]
if '/' in twitterDomain:
twitterDomain = twitterDomain.split('/')[0]
if '.' in twitterDomain:
args.twitterReplacementDomain = twitterDomain
if setTheme(baseDir, themeName, domain,
args.allowLocalNetworkAccess, args.language):
print('Theme set to ' + themeName)
@ -3089,6 +3101,7 @@ if __name__ == "__main__":
instanceId, args.client, baseDir,
domain, onionDomain, i2pDomain,
args.YTReplacementDomain,
args.twitterReplacementDomain,
port, proxyPort, httpPrefix,
federationList, args.maxMentions,
args.maxEmoji, args.secureMode,

View File

@ -86,6 +86,7 @@ from posts import sendToFollowersThread
from webapp_post import individualPostAsHtml
from question import questionUpdateVotes
from media import replaceYouTube
from media import replaceTwitter
from git import isGitPatch
from git import receiveGitPatch
from followingCalendar import receivingCalendarEvents
@ -930,6 +931,7 @@ def _receiveLike(recentPostsCache: {},
maxRecentPosts: int, translate: {},
allowDeletion: bool,
YTReplacementDomain: str,
twitterReplacementDomain: str,
peertubeInstances: [],
allowLocalNetworkAccess: bool,
themeName: str, systemLanguage: str,
@ -1013,7 +1015,9 @@ def _receiveLike(recentPostsCache: {},
handleName, domain, port, likedPostJson,
None, True, allowDeletion,
httpPrefix, __version__,
'inbox', YTReplacementDomain,
'inbox',
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess,
@ -1036,6 +1040,7 @@ def _receiveUndoLike(recentPostsCache: {},
maxRecentPosts: int, translate: {},
allowDeletion: bool,
YTReplacementDomain: str,
twitterReplacementDomain: str,
peertubeInstances: [],
allowLocalNetworkAccess: bool,
themeName: str, systemLanguage: str,
@ -1112,7 +1117,9 @@ def _receiveUndoLike(recentPostsCache: {},
handleName, domain, port, likedPostJson,
None, True, allowDeletion,
httpPrefix, __version__,
'inbox', YTReplacementDomain,
'inbox',
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess,
@ -1133,6 +1140,7 @@ def _receiveBookmark(recentPostsCache: {},
maxRecentPosts: int, translate: {},
allowDeletion: bool,
YTReplacementDomain: str,
twitterReplacementDomain: str,
peertubeInstances: [],
allowLocalNetworkAccess: bool,
themeName: str, systemLanguage: str,
@ -1225,7 +1233,9 @@ def _receiveBookmark(recentPostsCache: {},
nickname, domain, port, bookmarkedPostJson,
None, True, allowDeletion,
httpPrefix, __version__,
'inbox', YTReplacementDomain,
'inbox',
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess,
@ -1246,6 +1256,7 @@ def _receiveUndoBookmark(recentPostsCache: {},
maxRecentPosts: int, translate: {},
allowDeletion: bool,
YTReplacementDomain: str,
twitterReplacementDomain: str,
peertubeInstances: [],
allowLocalNetworkAccess: bool,
themeName: str, systemLanguage: str,
@ -1339,7 +1350,9 @@ def _receiveUndoBookmark(recentPostsCache: {},
nickname, domain, port, bookmarkedPostJson,
None, True, allowDeletion,
httpPrefix, __version__,
'inbox', YTReplacementDomain,
'inbox',
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess,
@ -1442,6 +1455,7 @@ def _receiveAnnounce(recentPostsCache: {},
personCache: {}, messageJson: {}, federationList: [],
debug: bool, translate: {},
YTReplacementDomain: str,
twitterReplacementDomain: str,
allowLocalNetworkAccess: bool,
themeName: str, systemLanguage: str,
signingPrivateKeyPem: str,
@ -1558,7 +1572,9 @@ def _receiveAnnounce(recentPostsCache: {},
nickname, domain, port, messageJson,
None, True, allowDeletion,
httpPrefix, __version__,
'inbox', YTReplacementDomain,
'inbox',
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess,
@ -1580,6 +1596,7 @@ def _receiveAnnounce(recentPostsCache: {},
messageJson,
__version__, translate,
YTReplacementDomain,
twitterReplacementDomain,
allowLocalNetworkAccess,
recentPostsCache, debug,
systemLanguage,
@ -2490,7 +2507,9 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
queueFilename: str, destinationFilename: str,
maxReplies: int, allowDeletion: bool,
maxMentions: int, maxEmoji: int, translate: {},
unitTest: bool, YTReplacementDomain: str,
unitTest: bool,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
allowLocalNetworkAccess: bool,
peertubeInstances: [],
@ -2524,6 +2543,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
maxRecentPosts, translate,
allowDeletion,
YTReplacementDomain,
twitterReplacementDomain,
peertubeInstances,
allowLocalNetworkAccess,
themeName, systemLanguage,
@ -2545,6 +2565,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
maxRecentPosts, translate,
allowDeletion,
YTReplacementDomain,
twitterReplacementDomain,
peertubeInstances,
allowLocalNetworkAccess,
themeName, systemLanguage,
@ -2566,6 +2587,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
maxRecentPosts, translate,
allowDeletion,
YTReplacementDomain,
twitterReplacementDomain,
peertubeInstances,
allowLocalNetworkAccess,
themeName, systemLanguage,
@ -2587,6 +2609,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
maxRecentPosts, translate,
allowDeletion,
YTReplacementDomain,
twitterReplacementDomain,
peertubeInstances,
allowLocalNetworkAccess,
themeName, systemLanguage,
@ -2609,6 +2632,7 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
federationList,
debug, translate,
YTReplacementDomain,
twitterReplacementDomain,
allowLocalNetworkAccess,
themeName, systemLanguage,
signingPrivateKeyPem,
@ -2701,6 +2725,10 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
# replace YouTube links, so they get less tracking data
replaceYouTube(postJsonObject, YTReplacementDomain, systemLanguage)
# replace twitter link domains, so that you can view twitter posts
# without having an account
replaceTwitter(postJsonObject, twitterReplacementDomain,
systemLanguage)
# list of indexes to be updated
updateIndexList = ['inbox']
@ -2810,7 +2838,9 @@ def _inboxAfterInitial(recentPostsCache: {}, maxRecentPosts: int,
if isImageMedia(session, baseDir, httpPrefix,
nickname, domain, postJsonObject,
translate, YTReplacementDomain,
translate,
YTReplacementDomain,
twitterReplacementDomain,
allowLocalNetworkAccess,
recentPostsCache, debug, systemLanguage,
domainFull, personCache, signingPrivateKeyPem):
@ -3149,6 +3179,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
allowDeletion: bool, debug: bool, maxMentions: int,
maxEmoji: int, translate: {}, unitTest: bool,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
maxFollowers: int, allowLocalNetworkAccess: bool,
peertubeInstances: [],
@ -3564,6 +3595,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
maxMentions, maxEmoji,
translate, unitTest,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
allowLocalNetworkAccess,
peertubeInstances,

View File

@ -48,6 +48,26 @@ def replaceYouTube(postJsonObject: {}, replacementDomain: str,
postJsonObject['object']['contentMap'][systemLanguage] = contentStr
def replaceTwitter(postJsonObject: {}, replacementDomain: str,
systemLanguage: str) -> None:
"""Replace Twitter with a replacement domain
This allows you to view twitter posts without having a twitter account
"""
if not replacementDomain:
return
if not hasObjectDict(postJsonObject):
return
if not postJsonObject['object'].get('content'):
return
contentStr = getBaseContentFromPost(postJsonObject, systemLanguage)
if 'twitter.com' not in contentStr:
return
contentStr = contentStr.replace('twitter.com', replacementDomain)
postJsonObject['object']['content'] = contentStr
if postJsonObject['object'].get('contentMap'):
postJsonObject['object']['contentMap'][systemLanguage] = contentStr
def _removeMetaData(imageFilename: str, outputFilename: str) -> None:
"""Attempts to do this with pure python didn't work well,
so better to use a dedicated tool if one is installed

View File

@ -34,6 +34,7 @@ from blocking import outboxUndoBlock
from blocking import outboxMute
from blocking import outboxUndoMute
from media import replaceYouTube
from media import replaceTwitter
from media import getMediaPath
from media import createMediaDirs
from inbox import inboxUpdateIndex
@ -191,6 +192,7 @@ def postMessageToOutbox(session, translate: {},
personCache: {}, allowDeletion: bool,
proxyType: str, version: str, debug: bool,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
allowLocalNetworkAccess: bool,
city: str, systemLanguage: str,
@ -287,6 +289,9 @@ def postMessageToOutbox(session, translate: {},
return False
# replace youtube, so that google gets less tracking data
replaceYouTube(messageJson, YTReplacementDomain, systemLanguage)
# replace twitter, so that twitter posts can be shown without
# having a twitter account
replaceTwitter(messageJson, twitterReplacementDomain, systemLanguage)
# https://www.w3.org/TR/activitypub/#create-activity-outbox
messageJson['object']['attributedTo'] = messageJson['actor']
if messageJson['object'].get('attachment'):
@ -413,7 +418,9 @@ def postMessageToOutbox(session, translate: {},
if isImageMedia(session, baseDir, httpPrefix,
postToNickname, domain,
messageJson,
translate, YTReplacementDomain,
translate,
YTReplacementDomain,
twitterReplacementDomain,
allowLocalNetworkAccess,
recentPostsCache, debug, systemLanguage,
domainFull, personCache,
@ -453,6 +460,7 @@ def postMessageToOutbox(session, translate: {},
httpPrefix, __version__,
boxNameIndex,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess,

View File

@ -67,6 +67,7 @@ from utils import acctDir
from utils import localActorUrl
from media import attachMedia
from media import replaceYouTube
from media import replaceTwitter
from content import limitRepeatedWords
from content import tagExists
from content import removeLongWords
@ -3286,6 +3287,7 @@ def isImageMedia(session, baseDir: str, httpPrefix: str,
nickname: str, domain: str,
postJsonObject: {}, translate: {},
YTReplacementDomain: str,
twitterReplacementDomain: str,
allowLocalNetworkAccess: bool,
recentPostsCache: {}, debug: bool,
systemLanguage: str,
@ -3300,6 +3302,7 @@ def isImageMedia(session, baseDir: str, httpPrefix: str,
nickname, domain, postJsonObject,
__version__, translate,
YTReplacementDomain,
twitterReplacementDomain,
allowLocalNetworkAccess,
recentPostsCache, debug,
systemLanguage,
@ -4326,7 +4329,9 @@ def _rejectAnnounce(announceFilename: str,
def downloadAnnounce(session, baseDir: str, httpPrefix: str,
nickname: str, domain: str,
postJsonObject: {}, projectVersion: str,
translate: {}, YTReplacementDomain: str,
translate: {},
YTReplacementDomain: str,
twitterReplacementDomain: str,
allowLocalNetworkAccess: bool,
recentPostsCache: {}, debug: bool,
systemLanguage: str,
@ -4535,6 +4540,8 @@ def downloadAnnounce(session, baseDir: str, httpPrefix: str,
return None
postJsonObject = announcedJson
replaceYouTube(postJsonObject, YTReplacementDomain, systemLanguage)
replaceTwitter(postJsonObject, twitterReplacementDomain,
systemLanguage)
if saveJson(postJsonObject, announceFilename):
return postJsonObject
return None

View File

@ -113,6 +113,7 @@ def _updatePostSchedule(baseDir: str, handle: str, httpd,
httpd.projectVersion,
httpd.debug,
httpd.YTReplacementDomain,
httpd.twitterReplacementDomain,
httpd.showPublishedDateOnly,
httpd.allowLocalNetworkAccess,
httpd.city, httpd.systemLanguage,

View File

@ -831,7 +831,7 @@ def createServerAlice(path: str, domain: str, port: int,
0, False, 1, False, False, False,
5, True, True, 'en', __version__,
"instanceId", False, path, domain,
onionDomain, i2pDomain, None, port, port,
onionDomain, i2pDomain, None, None, port, port,
httpPrefix, federationList, maxMentions, maxEmoji, False,
proxyType, maxReplies,
domainMaxPostsPerDay, accountMaxPostsPerDay,
@ -969,7 +969,7 @@ def createServerBob(path: str, domain: str, port: int,
False, 1, False, False, False,
5, True, True, 'en', __version__,
"instanceId", False, path, domain,
onionDomain, i2pDomain, None, port, port,
onionDomain, i2pDomain, None, None, port, port,
httpPrefix, federationList, maxMentions, maxEmoji, False,
proxyType, maxReplies,
domainMaxPostsPerDay, accountMaxPostsPerDay,
@ -1036,7 +1036,7 @@ def createServerEve(path: str, domain: str, port: int, federationList: [],
False, 1, False, False, False,
5, True, True, 'en', __version__,
"instanceId", False, path, domain,
onionDomain, i2pDomain, None, port, port,
onionDomain, i2pDomain, None, None, port, port,
httpPrefix, federationList, maxMentions, maxEmoji, False,
proxyType, maxReplies, allowDeletion, True, True, False,
sendThreads, False)
@ -1105,7 +1105,7 @@ def createServerGroup(path: str, domain: str, port: int,
0, False, 1, False, False, False,
5, True, True, 'en', __version__,
"instanceId", False, path, domain,
onionDomain, i2pDomain, None, port, port,
onionDomain, i2pDomain, None, None, port, port,
httpPrefix, federationList, maxMentions, maxEmoji, False,
proxyType, maxReplies,
domainMaxPostsPerDay, accountMaxPostsPerDay,

View File

@ -478,5 +478,7 @@
"accommodation": "الإقامة",
"Forbidden": "محرم",
"You're not allowed": "كنت لا يسمح",
"Hours after posting during which replies are allowed": "ساعات بعد النشر المسموح بها خلال الردود"
"Hours after posting during which replies are allowed": "ساعات بعد النشر المسموح بها خلال الردود",
"Twitter": "Twitter",
"Twitter Replacement Domain": "مجال استبدال تويتر"
}

View File

@ -478,5 +478,7 @@
"accommodation": "allotjament",
"Forbidden": "Prohibit",
"You're not allowed": "No està permès",
"Hours after posting during which replies are allowed": "Hores després de la publicació durant les respostes"
"Hours after posting during which replies are allowed": "Hores després de la publicació durant les respostes",
"Twitter": "Twitter",
"Twitter Replacement Domain": "Domini de substitució de Twitter"
}

View File

@ -478,5 +478,7 @@
"accommodation": "llety",
"Forbidden": "Wedi'i wahardd",
"You're not allowed": "Ni chaniateir i chi",
"Hours after posting during which replies are allowed": "Oriau ar ôl postio pan ganiateir atebion"
"Hours after posting during which replies are allowed": "Oriau ar ôl postio pan ganiateir atebion",
"Twitter": "Twitter",
"Twitter Replacement Domain": "Parth Amnewid Twitter"
}

View File

@ -478,5 +478,7 @@
"accommodation": "unterkunft",
"Forbidden": "Verboten",
"You're not allowed": "Du darfst nicht",
"Hours after posting during which replies are allowed": "Stunden nach dem Posten, während denen Antworten erlaubt sind"
"Hours after posting during which replies are allowed": "Stunden nach dem Posten, während denen Antworten erlaubt sind",
"Twitter": "Twitter",
"Twitter Replacement Domain": "Twitter-Ersatzdomain"
}

View File

@ -478,5 +478,7 @@
"accommodation": "accommodation",
"Forbidden": "Forbidden",
"You're not allowed": "You're not allowed",
"Hours after posting during which replies are allowed": "Hours after posting during which replies are allowed"
"Hours after posting during which replies are allowed": "Hours after posting during which replies are allowed",
"Twitter": "Twitter",
"Twitter Replacement Domain": "Twitter Replacement Domain"
}

View File

@ -478,5 +478,7 @@
"accommodation": "alojamiento",
"Forbidden": "Prohibida",
"You're not allowed": "No tienes permiso",
"Hours after posting during which replies are allowed": "Horas después de la publicación durante las cuales se permiten las respuestas"
"Hours after posting during which replies are allowed": "Horas después de la publicación durante las cuales se permiten las respuestas",
"Twitter": "Twitter",
"Twitter Replacement Domain": "Dominio de reemplazo de Twitter"
}

View File

@ -478,5 +478,7 @@
"accommodation": "hébergement",
"Forbidden": "Interdite",
"You're not allowed": "Tu n'as pas le droit",
"Hours after posting during which replies are allowed": "Heures après la publication pendant laquelle les réponses sont autorisées"
"Hours after posting during which replies are allowed": "Heures après la publication pendant laquelle les réponses sont autorisées",
"Twitter": "Twitter",
"Twitter Replacement Domain": "Domaine de remplacement Twitter"
}

View File

@ -478,5 +478,7 @@
"accommodation": "lóistín",
"Forbidden": "Toirmiscthe",
"You're not allowed": "Níl cead agat",
"Hours after posting during which replies are allowed": "Uair an chloig tar éis an phostála ina gceadaítear freagraí"
"Hours after posting during which replies are allowed": "Uair an chloig tar éis an phostála ina gceadaítear freagraí",
"Twitter": "Twitter",
"Twitter Replacement Domain": "Fearann Athsholáthair Twitter"
}

View File

@ -478,5 +478,7 @@
"accommodation": "निवास स्थान",
"Forbidden": "निषिद्ध",
"You're not allowed": "आपको अनुमति नहीं है",
"Hours after posting during which replies are allowed": "पोस्ट करने के कुछ घंटे जिसके बाद जवाब देने की अनुमति है"
"Hours after posting during which replies are allowed": "पोस्ट करने के कुछ घंटे जिसके बाद जवाब देने की अनुमति है",
"Twitter": "Twitter",
"Twitter Replacement Domain": "ट्विटर रिप्लेसमेंट डोमेन"
}

View File

@ -478,5 +478,7 @@
"accommodation": "struttura ricettiva",
"Forbidden": "Proibita",
"You're not allowed": "Non ti è permesso",
"Hours after posting during which replies are allowed": "Ore dopo la pubblicazione durante le quali le risposte sono consentite"
"Hours after posting during which replies are allowed": "Ore dopo la pubblicazione durante le quali le risposte sono consentite",
"Twitter": "Twitter",
"Twitter Replacement Domain": "Dominio sostitutivo di Twitter"
}

View File

@ -478,5 +478,7 @@
"accommodation": "宿泊施設",
"Forbidden": "禁断",
"You're not allowed": "あなたは許可されていません",
"Hours after posting during which replies are allowed": "転記後の時間返信が許可されています"
"Hours after posting during which replies are allowed": "転記後の時間返信が許可されています",
"Twitter": "Twitter",
"Twitter Replacement Domain": "Twitterの代替ドメイン"
}

View File

@ -478,5 +478,7 @@
"accommodation": "cih",
"Forbidden": "Qedexekirî",
"You're not allowed": "Destûrê nadin te",
"Hours after posting during which replies are allowed": "Demjimêran piştî şandina di dema bersivê de destûr tê dayîn"
"Hours after posting during which replies are allowed": "Demjimêran piştî şandina di dema bersivê de destûr tê dayîn",
"Twitter": "Twitter",
"Twitter Replacement Domain": "Domaina Veguheztina Twitter"
}

View File

@ -474,5 +474,7 @@
"accommodation": "accommodation",
"Forbidden": "Forbidden",
"You're not allowed": "You're not allowed",
"Hours after posting during which replies are allowed": "Hours after posting during which replies are allowed"
"Hours after posting during which replies are allowed": "Hours after posting during which replies are allowed",
"Twitter": "Twitter",
"Twitter Replacement Domain": "Twitter Replacement Domain"
}

View File

@ -478,5 +478,7 @@
"accommodation": "alojamento",
"Forbidden": "Proibida",
"You're not allowed": "Você não tem permissão",
"Hours after posting during which replies are allowed": "Horas após a postagem durante as quais as respostas são permitidas"
"Hours after posting during which replies are allowed": "Horas após a postagem durante as quais as respostas são permitidas",
"Twitter": "Twitter",
"Twitter Replacement Domain": "Domínio de substituição do Twitter"
}

View File

@ -478,5 +478,7 @@
"accommodation": "размещение",
"Forbidden": "Запрещенный",
"You're not allowed": "Вам не разрешено",
"Hours after posting during which replies are allowed": "Часы после размещения, в течение которых разрешены ответы"
"Hours after posting during which replies are allowed": "Часы после размещения, в течение которых разрешены ответы",
"Twitter": "Twitter",
"Twitter Replacement Domain": "Замещающий домен Twitter"
}

View File

@ -478,5 +478,7 @@
"accommodation": "malazi",
"Forbidden": "Imekatazwa",
"You're not allowed": "Hauruhusiwi",
"Hours after posting during which replies are allowed": "Masaa baada ya kuchapisha wakati majibu yanaruhusiwa."
"Hours after posting during which replies are allowed": "Masaa baada ya kuchapisha wakati majibu yanaruhusiwa.",
"Twitter": "Twitter",
"Twitter Replacement Domain": "Kikoa cha Uingizwaji wa Twitter"
}

View File

@ -478,5 +478,7 @@
"accommodation": "住所",
"Forbidden": "禁止的",
"You're not allowed": "你不被允许",
"Hours after posting during which replies are allowed": "发布后的时间允许答复"
"Hours after posting during which replies are allowed": "发布后的时间允许答复",
"Twitter": "Twitter",
"Twitter Replacement Domain": "Twitter 替换域"
}

View File

@ -30,6 +30,7 @@ def htmlConfirmDelete(cssCache: {},
cachedWebfingers: {}, personCache: {},
callingDomain: str,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
peertubeInstances: [],
allowLocalNetworkAccess: bool,
@ -74,6 +75,7 @@ def htmlConfirmDelete(cssCache: {},
None, True, False,
httpPrefix, projectVersion, 'outbox',
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances, allowLocalNetworkAccess,
themeName, systemLanguage, maxLikeCount,

View File

@ -29,6 +29,7 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, maxRecentPosts: int,
session, cachedWebfingers: {}, personCache: {},
projectVersion: str,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
peertubeInstances: [],
allowLocalNetworkAccess: bool,
@ -73,6 +74,7 @@ def _htmlFrontScreenPosts(recentPostsCache: {}, maxRecentPosts: int,
None, True, False,
httpPrefix, projectVersion, 'inbox',
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess,
@ -98,6 +100,7 @@ def htmlFrontScreen(signingPrivateKeyPem: str,
profileJson: {}, selected: str,
session, cachedWebfingers: {}, personCache: {},
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, theme: str,
peertubeInstances: [],
@ -172,6 +175,7 @@ def htmlFrontScreen(signingPrivateKeyPem: str,
session, cachedWebfingers, personCache,
projectVersion,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess,

View File

@ -37,6 +37,7 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
allowDeletion: bool,
httpPrefix: str, projectVersion: str,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, positiveVoting: bool,
showPublishAsIcon: bool,
@ -61,7 +62,9 @@ def htmlModeration(cssCache: {}, defaultTimeline: str,
itemsPerPage, session, baseDir, wfRequest, personCache,
nickname, domain, port, inboxJson, 'moderation',
allowDeletion, httpPrefix, projectVersion, True, False,
YTReplacementDomain, showPublishedDateOnly,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False, positiveVoting,
showPublishAsIcon, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,

View File

@ -1188,7 +1188,9 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
avatarUrl: str, showAvatarOptions: bool,
allowDeletion: bool,
httpPrefix: str, projectVersion: str,
boxName: str, YTReplacementDomain: str,
boxName: str,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
peertubeInstances: [],
allowLocalNetworkAccess: bool,
@ -1351,6 +1353,7 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
nickname, domain, postJsonObject,
projectVersion, translate,
YTReplacementDomain,
twitterReplacementDomain,
allowLocalNetworkAccess,
recentPostsCache, False,
systemLanguage,
@ -1810,6 +1813,7 @@ def htmlIndividualPost(cssCache: {},
postJsonObject: {}, httpPrefix: str,
projectVersion: str, likedBy: str,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
peertubeInstances: [],
allowLocalNetworkAccess: bool,
@ -1862,6 +1866,7 @@ def htmlIndividualPost(cssCache: {},
None, True, False,
httpPrefix, projectVersion, 'inbox',
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess, themeName,
@ -1891,6 +1896,7 @@ def htmlIndividualPost(cssCache: {},
None, True, False,
httpPrefix, projectVersion, 'inbox',
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess,
@ -1924,6 +1930,7 @@ def htmlIndividualPost(cssCache: {},
None, True, False,
httpPrefix, projectVersion, 'inbox',
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess,
@ -1948,6 +1955,7 @@ def htmlPostReplies(cssCache: {},
nickname: str, domain: str, port: int, repliesJson: {},
httpPrefix: str, projectVersion: str,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
peertubeInstances: [],
allowLocalNetworkAccess: bool,
@ -1970,6 +1978,7 @@ def htmlPostReplies(cssCache: {},
None, True, False,
httpPrefix, projectVersion, 'inbox',
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess,

View File

@ -79,6 +79,7 @@ def htmlProfileAfterSearch(cssCache: {},
session, cachedWebfingers: {}, personCache: {},
debug: bool, projectVersion: str,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
defaultTimeline: str,
peertubeInstances: [],
@ -290,6 +291,7 @@ def htmlProfileAfterSearch(cssCache: {},
item, avatarUrl, False, False,
httpPrefix, projectVersion, 'inbox',
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess,
@ -495,6 +497,7 @@ def htmlProfile(signingPrivateKeyPem: str,
profileJson: {}, selected: str,
session, cachedWebfingers: {}, personCache: {},
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, theme: str, dormantMonths: int,
peertubeInstances: [],
@ -521,6 +524,7 @@ def htmlProfile(signingPrivateKeyPem: str,
profileJson, selected,
session, cachedWebfingers, personCache,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, theme, extraJson,
allowLocalNetworkAccess, accessKeys,
@ -868,6 +872,7 @@ def htmlProfile(signingPrivateKeyPem: str,
session, cachedWebfingers, personCache,
projectVersion,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess,
@ -930,6 +935,7 @@ def _htmlProfilePosts(recentPostsCache: {}, maxRecentPosts: int,
session, cachedWebfingers: {}, personCache: {},
projectVersion: str,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
peertubeInstances: [],
allowLocalNetworkAccess: bool,
@ -973,6 +979,7 @@ def _htmlProfilePosts(recentPostsCache: {}, maxRecentPosts: int,
None, True, False,
httpPrefix, projectVersion, 'inbox',
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess,
@ -1172,6 +1179,25 @@ def _htmlEditProfileGraphicDesign(baseDir: str, translate: {}) -> str:
return graphicsStr
def _htmlEditProfileTwitter(baseDir: str, translate: {},
removeTwitter: str) -> str:
"""Edit twitter settings within profile
"""
# Twitter section
twitterStr = beginEditSection(translate['Twitter'])
twitterStr += \
editCheckBox(translate['Remove Twitter posts'],
'removeTwitter', removeTwitter)
twitterReplacementDomain = getConfigParam(baseDir, "twitterdomain")
if not twitterReplacementDomain:
twitterReplacementDomain = ''
twitterStr += \
editTextField(translate['Twitter Replacement Domain'],
'twitterdomain', twitterReplacementDomain)
twitterStr += endEditSection()
return twitterStr
def _htmlEditProfileInstance(baseDir: str, translate: {},
peertubeInstances: [],
mediaInstanceStr: str,
@ -1910,7 +1936,7 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
displayNickname = nickname
isBot = isGroup = followDMs = removeTwitter = ''
notifyLikes = hideLikeButton = mediaInstanceStr = ''
blogsInstanceStr = newsInstanceStr = movedTo = ''
blogsInstanceStr = newsInstanceStr = movedTo = twitterStr = ''
bioStr = donateUrl = websiteUrl = emailAddress = PGPpubKey = ''
PGPfingerprint = xmppAddress = matrixAddress = ''
ssbAddress = blogAddress = toxAddress = jamiAddress = ''
@ -2002,6 +2028,8 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
if adminNickname:
if path.startswith('/users/' + adminNickname + '/'):
isAdmin = True
twitterStr = \
_htmlEditProfileTwitter(baseDir, translate, removeTwitter)
# shared items section
sharesFederationStr = \
_htmlEditProfileSharedItems(baseDir, nickname,
@ -2089,7 +2117,7 @@ def htmlEditProfile(cssCache: {}, translate: {}, baseDir: str, path: str,
_htmlEditProfileSkills(baseDir, nickname, domain, translate)
editProfileForm += roleAssignStr + peertubeStr + graphicsStr
editProfileForm += sharesFederationStr + instanceStr
editProfileForm += sharesFederationStr + twitterStr + instanceStr
# danger zone section
editProfileForm += _htmlEditProfileDangerZone(translate)

View File

@ -570,6 +570,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str,
personCache: {},
port: int,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
peertubeInstances: [],
allowLocalNetworkAccess: bool,
@ -654,6 +655,7 @@ def htmlHistorySearch(cssCache: {}, translate: {}, baseDir: str,
httpPrefix, projectVersion,
'search',
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess,
@ -678,6 +680,7 @@ def htmlHashtagSearch(cssCache: {},
session, cachedWebfingers: {}, personCache: {},
httpPrefix: str, projectVersion: str,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
peertubeInstances: [],
allowLocalNetworkAccess: bool,
@ -832,6 +835,7 @@ def htmlHashtagSearch(cssCache: {},
httpPrefix, projectVersion,
'search',
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess,
@ -865,7 +869,9 @@ def rssHashtagSearch(nickname: str, domain: str, port: int,
postsPerPage: int,
session, cachedWebfingers: {}, personCache: {},
httpPrefix: str, projectVersion: str,
YTReplacementDomain: str, systemLanguage: str) -> str:
YTReplacementDomain: str,
twitterReplacementDomain: str,
systemLanguage: str) -> str:
"""Show an rss feed for a hashtag
"""
if hashtag.startswith('#'):

View File

@ -406,6 +406,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
manuallyApproveFollowers: bool,
minimal: bool,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, moderator: bool,
editor: bool,
@ -887,6 +888,7 @@ def htmlTimeline(cssCache: {}, defaultTimeline: str,
httpPrefix, projectVersion,
boxName,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
peertubeInstances,
allowLocalNetworkAccess,
@ -1088,6 +1090,7 @@ def htmlShares(cssCache: {}, defaultTimeline: str,
allowDeletion: bool,
httpPrefix: str, projectVersion: str,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, positiveVoting: bool,
showPublishAsIcon: bool,
@ -1116,7 +1119,9 @@ def htmlShares(cssCache: {}, defaultTimeline: str,
nickname, domain, port, None,
'tlshares', allowDeletion,
httpPrefix, projectVersion, manuallyApproveFollowers,
False, YTReplacementDomain,
False,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False,
positiveVoting, showPublishAsIcon,
@ -1137,6 +1142,7 @@ def htmlWanted(cssCache: {}, defaultTimeline: str,
allowDeletion: bool,
httpPrefix: str, projectVersion: str,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, positiveVoting: bool,
showPublishAsIcon: bool,
@ -1165,7 +1171,9 @@ def htmlWanted(cssCache: {}, defaultTimeline: str,
nickname, domain, port, None,
'tlwanted', allowDeletion,
httpPrefix, projectVersion, manuallyApproveFollowers,
False, YTReplacementDomain,
False,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False,
positiveVoting, showPublishAsIcon,
@ -1185,7 +1193,9 @@ def htmlInbox(cssCache: {}, defaultTimeline: str,
nickname: str, domain: str, port: int, inboxJson: {},
allowDeletion: bool,
httpPrefix: str, projectVersion: str,
minimal: bool, YTReplacementDomain: str,
minimal: bool,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, positiveVoting: bool,
showPublishAsIcon: bool,
@ -1214,7 +1224,9 @@ def htmlInbox(cssCache: {}, defaultTimeline: str,
nickname, domain, port, inboxJson,
'inbox', allowDeletion,
httpPrefix, projectVersion, manuallyApproveFollowers,
minimal, YTReplacementDomain,
minimal,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False,
positiveVoting, showPublishAsIcon,
@ -1234,7 +1246,9 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str,
nickname: str, domain: str, port: int, bookmarksJson: {},
allowDeletion: bool,
httpPrefix: str, projectVersion: str,
minimal: bool, YTReplacementDomain: str,
minimal: bool,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, positiveVoting: bool,
showPublishAsIcon: bool,
@ -1263,7 +1277,9 @@ def htmlBookmarks(cssCache: {}, defaultTimeline: str,
nickname, domain, port, bookmarksJson,
'tlbookmarks', allowDeletion,
httpPrefix, projectVersion, manuallyApproveFollowers,
minimal, YTReplacementDomain,
minimal,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False,
positiveVoting, showPublishAsIcon,
@ -1283,7 +1299,9 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
nickname: str, domain: str, port: int, inboxJson: {},
allowDeletion: bool,
httpPrefix: str, projectVersion: str,
minimal: bool, YTReplacementDomain: str,
minimal: bool,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, positiveVoting: bool,
showPublishAsIcon: bool,
@ -1308,7 +1326,9 @@ def htmlInboxDMs(cssCache: {}, defaultTimeline: str,
cachedWebfingers, personCache,
nickname, domain, port, inboxJson, 'dm', allowDeletion,
httpPrefix, projectVersion, False, minimal,
YTReplacementDomain, showPublishedDateOnly,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False, positiveVoting,
showPublishAsIcon,
fullWidthTimelineButtonHeader,
@ -1327,7 +1347,9 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
nickname: str, domain: str, port: int, inboxJson: {},
allowDeletion: bool,
httpPrefix: str, projectVersion: str,
minimal: bool, YTReplacementDomain: str,
minimal: bool,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, positiveVoting: bool,
showPublishAsIcon: bool,
@ -1352,7 +1374,9 @@ def htmlInboxReplies(cssCache: {}, defaultTimeline: str,
cachedWebfingers, personCache,
nickname, domain, port, inboxJson, 'tlreplies',
allowDeletion, httpPrefix, projectVersion, False,
minimal, YTReplacementDomain,
minimal,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False,
positiveVoting, showPublishAsIcon,
@ -1372,7 +1396,9 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
nickname: str, domain: str, port: int, inboxJson: {},
allowDeletion: bool,
httpPrefix: str, projectVersion: str,
minimal: bool, YTReplacementDomain: str,
minimal: bool,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, positiveVoting: bool,
showPublishAsIcon: bool,
@ -1397,7 +1423,9 @@ def htmlInboxMedia(cssCache: {}, defaultTimeline: str,
cachedWebfingers, personCache,
nickname, domain, port, inboxJson, 'tlmedia',
allowDeletion, httpPrefix, projectVersion, False,
minimal, YTReplacementDomain,
minimal,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False,
positiveVoting, showPublishAsIcon,
@ -1417,7 +1445,9 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
nickname: str, domain: str, port: int, inboxJson: {},
allowDeletion: bool,
httpPrefix: str, projectVersion: str,
minimal: bool, YTReplacementDomain: str,
minimal: bool,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, positiveVoting: bool,
showPublishAsIcon: bool,
@ -1442,7 +1472,9 @@ def htmlInboxBlogs(cssCache: {}, defaultTimeline: str,
cachedWebfingers, personCache,
nickname, domain, port, inboxJson, 'tlblogs',
allowDeletion, httpPrefix, projectVersion, False,
minimal, YTReplacementDomain,
minimal,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False,
positiveVoting, showPublishAsIcon,
@ -1462,7 +1494,9 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
nickname: str, domain: str, port: int, inboxJson: {},
allowDeletion: bool,
httpPrefix: str, projectVersion: str,
minimal: bool, YTReplacementDomain: str,
minimal: bool,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, positiveVoting: bool,
showPublishAsIcon: bool,
@ -1488,7 +1522,9 @@ def htmlInboxFeatures(cssCache: {}, defaultTimeline: str,
cachedWebfingers, personCache,
nickname, domain, port, inboxJson, 'tlfeatures',
allowDeletion, httpPrefix, projectVersion, False,
minimal, YTReplacementDomain,
minimal,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False,
positiveVoting, showPublishAsIcon,
@ -1508,7 +1544,9 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
nickname: str, domain: str, port: int, inboxJson: {},
allowDeletion: bool,
httpPrefix: str, projectVersion: str,
minimal: bool, YTReplacementDomain: str,
minimal: bool,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, moderator: bool, editor: bool,
positiveVoting: bool, showPublishAsIcon: bool,
@ -1533,7 +1571,9 @@ def htmlInboxNews(cssCache: {}, defaultTimeline: str,
cachedWebfingers, personCache,
nickname, domain, port, inboxJson, 'tlnews',
allowDeletion, httpPrefix, projectVersion, False,
minimal, YTReplacementDomain,
minimal,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, moderator, editor,
positiveVoting, showPublishAsIcon,
@ -1553,7 +1593,9 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str,
nickname: str, domain: str, port: int, outboxJson: {},
allowDeletion: bool,
httpPrefix: str, projectVersion: str,
minimal: bool, YTReplacementDomain: str,
minimal: bool,
YTReplacementDomain: str,
twitterReplacementDomain: str,
showPublishedDateOnly: bool,
newswire: {}, positiveVoting: bool,
showPublishAsIcon: bool,
@ -1581,7 +1623,9 @@ def htmlOutbox(cssCache: {}, defaultTimeline: str,
nickname, domain, port, outboxJson, 'outbox',
allowDeletion, httpPrefix, projectVersion,
manuallyApproveFollowers, minimal,
YTReplacementDomain, showPublishedDateOnly,
YTReplacementDomain,
twitterReplacementDomain,
showPublishedDateOnly,
newswire, False, False, positiveVoting,
showPublishAsIcon, fullWidthTimelineButtonHeader,
iconsAsButtons, rssIconAtTop, publishButtonAtTop,