mirror of https://gitlab.com/bashrc2/epicyon
Removing id endings
parent
131aabdc03
commit
a317e69d31
|
@ -4247,8 +4247,8 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
print('ERROR: saving newswire state, ' + str(e))
|
||||
|
||||
# remove any previous cached news posts
|
||||
newsId = \
|
||||
postJsonObject['object']['id'].replace('/', '#')
|
||||
newsId = removeIdEnding(postJsonObject['object']['id'])
|
||||
newsId = newsId.replace('/', '#')
|
||||
clearFromPostCaches(baseDir, self.server.recentPostsCache,
|
||||
newsId)
|
||||
|
||||
|
@ -12429,7 +12429,7 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.server.systemLanguage)
|
||||
messageJson = {}
|
||||
if pinnedPostJson:
|
||||
postId = pinnedPostJson['id']
|
||||
postId = removeIdEnding(pinnedPostJson['id'])
|
||||
messageJson = \
|
||||
outboxMessageCreateWrap(self.server.httpPrefix,
|
||||
nickname,
|
||||
|
|
7
inbox.py
7
inbox.py
|
@ -2190,7 +2190,7 @@ def _sendToGroupMembers(session, baseDir: str, handle: str, port: int,
|
|||
savePostToBox(baseDir, httpPrefix, None,
|
||||
nickname, domain, postJsonObject, 'outbox')
|
||||
|
||||
postId = postJsonObject['object']['id']
|
||||
postId = removeIdEnding(postJsonObject['object']['id'])
|
||||
if debug:
|
||||
print('Group announce: ' + postId)
|
||||
announceJson = \
|
||||
|
@ -2478,7 +2478,8 @@ def _isValidDM(baseDir: str, nickname: str, domain: str, port: int,
|
|||
obj = postJsonObject['object']
|
||||
if isinstance(obj, dict):
|
||||
if not obj.get('inReplyTo'):
|
||||
_bounceDM(postJsonObject['id'],
|
||||
bouncedId = removeIdEnding(postJsonObject['id'])
|
||||
_bounceDM(bouncedId,
|
||||
session, httpPrefix,
|
||||
baseDir,
|
||||
nickname, domain,
|
||||
|
@ -3444,7 +3445,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
|
|||
# set the id to the same as the post filename
|
||||
# This makes the filename and the id consistent
|
||||
# if queueJson['post'].get('id'):
|
||||
# queueJson['post']['id']=queueJson['id']
|
||||
# queueJson['post']['id'] = queueJson['id']
|
||||
|
||||
if _receiveUndo(session,
|
||||
baseDir, httpPrefix, port,
|
||||
|
|
6
posts.py
6
posts.py
|
@ -32,6 +32,7 @@ from webfinger import webfingerHandle
|
|||
from httpsig import createSignedHeader
|
||||
from siteactive import siteIsActive
|
||||
from languages import understoodPostLanguage
|
||||
from utils import removeIdEnding
|
||||
from utils import replaceUsersWithAt
|
||||
from utils import hasGroupType
|
||||
from utils import getBaseContentFromPost
|
||||
|
@ -1989,7 +1990,8 @@ def createDirectMessagePost(baseDir: str,
|
|||
messageJson['cc'] = []
|
||||
messageJson['object']['cc'] = []
|
||||
if schedulePost:
|
||||
savePostToBox(baseDir, httpPrefix, messageJson['object']['id'],
|
||||
postId = removeIdEnding(messageJson['object']['id'])
|
||||
savePostToBox(baseDir, httpPrefix, postId,
|
||||
nickname, domain, messageJson, 'scheduled')
|
||||
return messageJson
|
||||
|
||||
|
@ -4362,7 +4364,7 @@ def downloadAnnounce(session, baseDir: str, httpPrefix: str,
|
|||
|
||||
postId = None
|
||||
if postJsonObject.get('id'):
|
||||
postId = postJsonObject['id']
|
||||
postId = removeIdEnding(postJsonObject['id'])
|
||||
announceFilename = \
|
||||
announceCacheDir + '/' + \
|
||||
postJsonObject['object'].replace('/', '#') + '.json'
|
||||
|
|
|
@ -11,6 +11,7 @@ import os
|
|||
import html
|
||||
import random
|
||||
import urllib.parse
|
||||
from utils import removeIdEnding
|
||||
from utils import isDM
|
||||
from utils import isReply
|
||||
from utils import camelCaseSplit
|
||||
|
@ -489,7 +490,7 @@ def _postToSpeakerJson(baseDir: str, httpPrefix: str,
|
|||
announcedHandle + '. ' + content
|
||||
postId = None
|
||||
if postJsonObject['object'].get('id'):
|
||||
postId = postJsonObject['object']['id']
|
||||
postId = removeIdEnding(postJsonObject['object']['id'])
|
||||
|
||||
followRequestsExist = False
|
||||
followRequestsList = []
|
||||
|
|
16
video.py
16
video.py
|
@ -10,6 +10,7 @@ __module_group__ = "Timeline"
|
|||
from utils import getFullDomain
|
||||
from utils import getNicknameFromActor
|
||||
from utils import getDomainFromActor
|
||||
from utils import removeIdEnding
|
||||
from blocking import isBlocked
|
||||
from filters import isFiltered
|
||||
|
||||
|
@ -88,7 +89,7 @@ def convertVideoToNote(baseDir: str, nickname: str, domain: str,
|
|||
content += '<p>' + postJsonObject['license']['name'] + '</p>'
|
||||
content += postJsonObject['content']
|
||||
|
||||
conversationId = postJsonObject['id']
|
||||
conversationId = removeIdEnding(postJsonObject['id'])
|
||||
|
||||
mediaType = None
|
||||
mediaUrl = None
|
||||
|
@ -130,27 +131,28 @@ def convertVideoToNote(baseDir: str, nickname: str, domain: str,
|
|||
content += '<a href="' + mediaMagnet + '">🧲</a>'
|
||||
content += '</p>'
|
||||
|
||||
newPostId = removeIdEnding(postJsonObject['id'])
|
||||
newPost = {
|
||||
'@context': postJsonObject['@context'],
|
||||
'id': postJsonObject['id'] + '/activity',
|
||||
'id': newPostId + '/activity',
|
||||
'type': 'Create',
|
||||
'actor': attributedTo,
|
||||
'published': postJsonObject['published'],
|
||||
'to': postJsonObject['to'],
|
||||
'cc': postJsonObject['cc'],
|
||||
'object': {
|
||||
'id': postJsonObject['id'],
|
||||
'id': newPostId,
|
||||
'conversation': conversationId,
|
||||
'type': 'Note',
|
||||
'summary': None,
|
||||
'inReplyTo': None,
|
||||
'published': postJsonObject['published'],
|
||||
'url': postJsonObject['id'],
|
||||
'url': newPostId,
|
||||
'attributedTo': attributedTo,
|
||||
'to': postJsonObject['to'],
|
||||
'cc': postJsonObject['cc'],
|
||||
'sensitive': postJsonObject['sensitive'],
|
||||
'atomUri': postJsonObject['id'],
|
||||
'atomUri': newPostId,
|
||||
'inReplyToAtomUri': None,
|
||||
'commentsEnabled': postJsonObject['commentsEnabled'],
|
||||
'rejectReplies': not postJsonObject['commentsEnabled'],
|
||||
|
@ -162,11 +164,11 @@ def convertVideoToNote(baseDir: str, nickname: str, domain: str,
|
|||
'attachment': attachment,
|
||||
'tag': [],
|
||||
'replies': {
|
||||
'id': postJsonObject['id'] + '/replies',
|
||||
'id': newPostId + '/replies',
|
||||
'type': 'Collection',
|
||||
'first': {
|
||||
'type': 'CollectionPage',
|
||||
'partOf': postJsonObject['id'] + '/replies',
|
||||
'partOf': newPostId + '/replies',
|
||||
'items': []
|
||||
}
|
||||
}
|
||||
|
|
|
@ -297,7 +297,7 @@ def _getReplyIconHtml(baseDir: str, nickname: str, domain: str,
|
|||
return replyStr
|
||||
|
||||
# reply is permitted - create reply icon
|
||||
replyToLink = postJsonObject['object']['id']
|
||||
replyToLink = removeIdEnding(postJsonObject['object']['id'])
|
||||
|
||||
# see Mike MacGirvin's replyTo suggestion
|
||||
if postJsonObject['object'].get('replyTo'):
|
||||
|
@ -380,7 +380,7 @@ def _getEditIconHtml(baseDir: str, nickname: str, domainFull: str,
|
|||
(isEditor(baseDir, nickname) and
|
||||
actor.endswith('/' + domainFull + '/users/news'))):
|
||||
|
||||
postId = postJsonObject['object']['id']
|
||||
postId = removeIdEnding(postJsonObject['object']['id'])
|
||||
|
||||
if '/statuses/' not in postId:
|
||||
return editStr
|
||||
|
@ -478,8 +478,9 @@ def _getAnnounceIconHtml(isAnnounced: bool,
|
|||
unannounceLinkStr = '?unannounce=' + \
|
||||
removeIdEnding(announceJsonObject['id'])
|
||||
|
||||
announcePostId = removeIdEnding(postJsonObject['object']['id'])
|
||||
announceLinkStr = '?' + \
|
||||
announceLink + '=' + postJsonObject['object']['id'] + pageNumberParam
|
||||
announceLink + '=' + announcePostId + pageNumberParam
|
||||
announceStr = \
|
||||
' <a class="imageAnchor" href="/users/' + \
|
||||
nickname + announceLinkStr + unannounceLinkStr + \
|
||||
|
@ -544,9 +545,10 @@ def _getLikeIconHtml(nickname: str, domainFull: str,
|
|||
likeStr += '<label class="likesCount">'
|
||||
likeStr += likeCountStr.replace('(', '').replace(')', '').strip()
|
||||
likeStr += '</label>\n'
|
||||
likePostId = removeIdEnding(postJsonObject['object']['id'])
|
||||
likeStr += \
|
||||
' <a class="imageAnchor" href="/users/' + nickname + '?' + \
|
||||
likeLink + '=' + postJsonObject['object']['id'] + \
|
||||
likeLink + '=' + likePostId + \
|
||||
pageNumberParam + \
|
||||
'?actor=' + postJsonObject['actor'] + \
|
||||
'?bm=' + timelinePostBookmark + \
|
||||
|
@ -589,9 +591,10 @@ def _getBookmarkIconHtml(nickname: str, domainFull: str,
|
|||
if translate.get(bookmarkTitle):
|
||||
bookmarkTitle = translate[bookmarkTitle]
|
||||
_logPostTiming(enableTimingLog, postStartTime, '12.6')
|
||||
bookmarkPostId = removeIdEnding(postJsonObject['object']['id'])
|
||||
bookmarkStr = \
|
||||
' <a class="imageAnchor" href="/users/' + nickname + '?' + \
|
||||
bookmarkLink + '=' + postJsonObject['object']['id'] + \
|
||||
bookmarkLink + '=' + bookmarkPostId + \
|
||||
pageNumberParam + \
|
||||
'?actor=' + postJsonObject['actor'] + \
|
||||
'?bm=' + timelinePostBookmark + \
|
||||
|
@ -777,13 +780,13 @@ def _announceUnattributedHtml(translate: {},
|
|||
announcesStr = 'announces'
|
||||
if translate.get(announcesStr):
|
||||
announcesStr = translate[announcesStr]
|
||||
postId = removeIdEnding(postJsonObject['object']['id'])
|
||||
return ' <img loading="lazy" title="' + \
|
||||
announcesStr + '" alt="' + \
|
||||
announcesStr + '" src="/icons' + \
|
||||
'/repeat_inactive.png" ' + \
|
||||
'class="announceOrReply"/>\n' + \
|
||||
' <a href="' + \
|
||||
postJsonObject['object']['id'] + \
|
||||
' <a href="' + postId + \
|
||||
'" class="announceOrReply">@unattributed</a>\n'
|
||||
|
||||
|
||||
|
@ -795,13 +798,13 @@ def _announceWithDisplayNameHtml(translate: {},
|
|||
announcesStr = 'announces'
|
||||
if translate.get(announcesStr):
|
||||
announcesStr = translate[announcesStr]
|
||||
postId = removeIdEnding(postJsonObject['object']['id'])
|
||||
return ' <img loading="lazy" title="' + \
|
||||
announcesStr + '" alt="' + \
|
||||
announcesStr + '" src="/' + \
|
||||
'icons/repeat_inactive.png" ' + \
|
||||
'class="announceOrReply"/>\n' + \
|
||||
' <a href="' + \
|
||||
postJsonObject['object']['id'] + '" ' + \
|
||||
' <a href="' + postId + '" ' + \
|
||||
'class="announceOrReply">' + announceDisplayName + '</a>\n'
|
||||
|
||||
|
||||
|
@ -1361,7 +1364,8 @@ def individualPostAsHtml(signingPrivateKeyPem: str,
|
|||
blockedCache)
|
||||
if not postJsonAnnounce:
|
||||
# if the announce could not be downloaded then mark it as rejected
|
||||
rejectPostId(baseDir, nickname, domain, postJsonObject['id'],
|
||||
announcedPostId = removeIdEnding(postJsonObject['id'])
|
||||
rejectPostId(baseDir, nickname, domain, announcedPostId,
|
||||
recentPostsCache)
|
||||
return ''
|
||||
postJsonObject = postJsonAnnounce
|
||||
|
|
Loading…
Reference in New Issue