mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of ssh://code.freedombone.net:2222/bashrc/epicyon
commit
882e0eff3c
16
feeds.py
16
feeds.py
|
|
@ -9,16 +9,14 @@ __module_group__ = "RSS Feeds"
|
|||
|
||||
|
||||
def rss2TagHeader(hashtag: str, httpPrefix: str, domainFull: str) -> str:
|
||||
rssStr = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
|
||||
rssStr += "<rss version=\"2.0\">"
|
||||
rssStr += '<channel>'
|
||||
rssStr += ' <title>#' + hashtag + '</title>'
|
||||
rssStr += ' <link>' + httpPrefix + '://' + domainFull + \
|
||||
return \
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" + \
|
||||
"<rss version=\"2.0\">" + \
|
||||
'<channel>' + \
|
||||
' <title>#' + hashtag + '</title>' + \
|
||||
' <link>' + httpPrefix + '://' + domainFull + \
|
||||
'/tags/rss2/' + hashtag + '</link>'
|
||||
return rssStr
|
||||
|
||||
|
||||
def rss2TagFooter() -> str:
|
||||
rssStr = '</channel>'
|
||||
rssStr += '</rss>'
|
||||
return rssStr
|
||||
return '</channel></rss>'
|
||||
|
|
|
|||
19
follow.py
19
follow.py
|
|
@ -220,18 +220,13 @@ def isFollowerOfPerson(baseDir: str, nickname: str, domain: str,
|
|||
|
||||
if handle in followersStr:
|
||||
alreadyFollowing = True
|
||||
elif '://' + followerDomain + \
|
||||
'/profile/' + followerNickname in followersStr:
|
||||
alreadyFollowing = True
|
||||
elif '://' + followerDomain + \
|
||||
'/channel/' + followerNickname in followersStr:
|
||||
alreadyFollowing = True
|
||||
elif '://' + followerDomain + \
|
||||
'/accounts/' + followerNickname in followersStr:
|
||||
alreadyFollowing = True
|
||||
elif '://' + followerDomain + \
|
||||
'/u/' + followerNickname in followersStr:
|
||||
alreadyFollowing = True
|
||||
else:
|
||||
paths = ('/profile/', '/channel/', '/accounts/', '/u/')
|
||||
for userPath in paths:
|
||||
url = '://' + followerDomain + userPath + followerNickname
|
||||
if url in followersStr:
|
||||
alreadyFollowing = True
|
||||
break
|
||||
|
||||
return alreadyFollowing
|
||||
|
||||
|
|
|
|||
10
happening.py
10
happening.py
|
|
@ -132,12 +132,10 @@ def saveEventPost(baseDir: str, handle: str, postId: str,
|
|||
calendarNotificationFilename = \
|
||||
baseDir + '/accounts/' + handle + '/.newCalendar'
|
||||
with open(calendarNotificationFilename, 'w+') as calendarNotificationFile:
|
||||
calendarNotificationFile.write('/calendar?year=' +
|
||||
str(eventYear) +
|
||||
'?month=' +
|
||||
str(eventMonthNumber) +
|
||||
'?day=' +
|
||||
str(eventDayOfMonth))
|
||||
notifyStr = \
|
||||
'/calendar?year=' + str(eventYear) + '?month=' + \
|
||||
str(eventMonthNumber) + '?day=' + str(eventDayOfMonth)
|
||||
calendarNotificationFile.write(notifyStr)
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -111,18 +111,12 @@ def manualApproveFollowRequest(session, baseDir: str,
|
|||
reqNick = approveHandle.split('@')[0]
|
||||
reqDomain = approveHandle.split('@')[1].strip()
|
||||
reqPrefix = httpPrefix + '://' + reqDomain
|
||||
if reqPrefix + '/profile/' + reqNick in approveFollowsStr:
|
||||
exists = True
|
||||
approveHandleFull = reqPrefix + '/profile/' + reqNick
|
||||
elif reqPrefix + '/channel/' + reqNick in approveFollowsStr:
|
||||
exists = True
|
||||
approveHandleFull = reqPrefix + '/channel/' + reqNick
|
||||
elif reqPrefix + '/accounts/' + reqNick in approveFollowsStr:
|
||||
exists = True
|
||||
approveHandleFull = reqPrefix + '/accounts/' + reqNick
|
||||
elif reqPrefix + '/u/' + reqNick in approveFollowsStr:
|
||||
exists = True
|
||||
approveHandleFull = reqPrefix + '/u/' + reqNick
|
||||
paths = ('/profile/', '/channel/', '/accounts/', '/u/')
|
||||
for userPath in paths:
|
||||
if reqPrefix + userPath + reqNick in approveFollowsStr:
|
||||
exists = True
|
||||
approveHandleFull = reqPrefix + userPath + reqNick
|
||||
break
|
||||
if not exists:
|
||||
print('Manual follow accept: ' + approveHandleFull +
|
||||
' not in requests file "' +
|
||||
|
|
|
|||
33
markdown.py
33
markdown.py
|
|
@ -140,29 +140,22 @@ def markdownToHtml(markdown: str) -> str:
|
|||
linesList = markdown.split('\n')
|
||||
htmlStr = ''
|
||||
ctr = 0
|
||||
titles = {
|
||||
"h5": '#####',
|
||||
"h4": '####',
|
||||
"h3": '###',
|
||||
"h2": '##',
|
||||
"h1": '#'
|
||||
}
|
||||
for line in linesList:
|
||||
if ctr > 0:
|
||||
htmlStr += '<br>'
|
||||
if line.startswith('#####'):
|
||||
line = line.replace('#####', '').strip()
|
||||
line = '<h5>' + line + '</h5>'
|
||||
ctr = -1
|
||||
elif line.startswith('####'):
|
||||
line = line.replace('####', '').strip()
|
||||
line = '<h4>' + line + '</h4>'
|
||||
ctr = -1
|
||||
elif line.startswith('###'):
|
||||
line = line.replace('###', '').strip()
|
||||
line = '<h3>' + line + '</h3>'
|
||||
ctr = -1
|
||||
elif line.startswith('##'):
|
||||
line = line.replace('##', '').strip()
|
||||
line = '<h2>' + line + '</h2>'
|
||||
ctr = -1
|
||||
elif line.startswith('#'):
|
||||
line = line.replace('#', '').strip()
|
||||
line = '<h1>' + line + '</h1>'
|
||||
ctr = -1
|
||||
for h, hashes in titles.items():
|
||||
if line.startswith(hashes):
|
||||
line = line.replace(hashes, '').strip()
|
||||
line = '<' + h + '>' + line + '</' + h + '>'
|
||||
ctr = -1
|
||||
break
|
||||
htmlStr += line
|
||||
ctr += 1
|
||||
return htmlStr
|
||||
|
|
|
|||
16
migrate.py
16
migrate.py
|
|
@ -13,9 +13,9 @@ from utils import getNicknameFromActor
|
|||
from utils import getDomainFromActor
|
||||
from webfinger import webfingerHandle
|
||||
from blocking import isBlocked
|
||||
from session import getJson
|
||||
from posts import getUserUrl
|
||||
from follow import unfollowAccount
|
||||
from person import getActorJson
|
||||
|
||||
|
||||
def _moveFollowingHandlesForAccount(baseDir: str, nickname: str, domain: str,
|
||||
|
|
@ -73,22 +73,16 @@ def _updateMovedHandle(baseDir: str, nickname: str, domain: str,
|
|||
print('wfRequest error: ' + str(wfRequest['errors']))
|
||||
return ctr
|
||||
|
||||
profileStr = 'https://www.w3.org/ns/activitystreams'
|
||||
asHeader = {
|
||||
'Accept': 'application/activity+json; profile="' + profileStr + '"'
|
||||
}
|
||||
if not personUrl:
|
||||
personUrl = getUserUrl(wfRequest, 0, debug)
|
||||
if not personUrl:
|
||||
return ctr
|
||||
|
||||
profileStr = 'https://www.w3.org/ns/activitystreams'
|
||||
asHeader = {
|
||||
'Accept': 'application/ld+json; profile="' + profileStr + '"'
|
||||
}
|
||||
gnunet = False
|
||||
if httpPrefix == 'gnunet':
|
||||
gnunet = True
|
||||
personJson = \
|
||||
getJson(session, personUrl, asHeader, None,
|
||||
debug, __version__, httpPrefix, None)
|
||||
getActorJson(domain, personUrl, httpPrefix, gnunet, debug)
|
||||
if not personJson:
|
||||
return ctr
|
||||
if not personJson.get('movedTo'):
|
||||
|
|
|
|||
20
tests.py
20
tests.py
|
|
@ -3951,9 +3951,8 @@ def _testSpoofGeolocation() -> None:
|
|||
hourStr = str(hour)
|
||||
if hour < 10:
|
||||
hourStr = '0' + hourStr
|
||||
currTime = datetime.datetime.strptime("2021-05-" + str(dayNumber) +
|
||||
" " + hourStr + ":14",
|
||||
"%Y-%m-%d %H:%M")
|
||||
dateTimeStr = "2021-05-" + str(dayNumber) + " " + hourStr + ":14"
|
||||
currTime = datetime.datetime.strptime(dateTimeStr, "%Y-%m-%d %H:%M")
|
||||
coords = spoofGeolocation('', 'new york, usa', currTime,
|
||||
decoySeed, citiesList, nogoList)
|
||||
longitude = coords[1]
|
||||
|
|
@ -3989,9 +3988,8 @@ def _testSpoofGeolocation() -> None:
|
|||
hourStr = str(hour)
|
||||
if hour < 10:
|
||||
hourStr = '0' + hourStr
|
||||
currTime = datetime.datetime.strptime("2021-05-" + str(dayNumber) +
|
||||
" " + hourStr + ":14",
|
||||
"%Y-%m-%d %H:%M")
|
||||
dateTimeStr = "2021-05-" + str(dayNumber) + " " + hourStr + ":14"
|
||||
currTime = datetime.datetime.strptime(dateTimeStr, "%Y-%m-%d %H:%M")
|
||||
coords = spoofGeolocation('', 'london, england', currTime,
|
||||
decoySeed, citiesList, nogoList)
|
||||
longitude = coords[1]
|
||||
|
|
@ -4040,9 +4038,8 @@ def _testSpoofGeolocation() -> None:
|
|||
hourStr = str(hour)
|
||||
if hour < 10:
|
||||
hourStr = '0' + hourStr
|
||||
currTime = datetime.datetime.strptime("2021-05-" + str(dayNumber) +
|
||||
" " + hourStr + ":14",
|
||||
"%Y-%m-%d %H:%M")
|
||||
dateTimeStr = "2021-05-" + str(dayNumber) + " " + hourStr + ":14"
|
||||
currTime = datetime.datetime.strptime(dateTimeStr, "%Y-%m-%d %H:%M")
|
||||
coords = spoofGeolocation('', 'SAN FRANCISCO, USA', currTime,
|
||||
decoySeed, citiesList, nogoList)
|
||||
longitude = coords[1]
|
||||
|
|
@ -4095,9 +4092,8 @@ def _testSpoofGeolocation() -> None:
|
|||
hourStr = str(hour)
|
||||
if hour < 10:
|
||||
hourStr = '0' + hourStr
|
||||
currTime = datetime.datetime.strptime("2021-05-" + str(dayNumber) +
|
||||
" " + hourStr + ":14",
|
||||
"%Y-%m-%d %H:%M")
|
||||
dateTimeStr = "2021-05-" + str(dayNumber) + " " + hourStr + ":14"
|
||||
currTime = datetime.datetime.strptime(dateTimeStr, "%Y-%m-%d %H:%M")
|
||||
coords = spoofGeolocation('', 'SEATTLE, USA', currTime,
|
||||
decoySeed, citiesList, nogoList)
|
||||
longitude = coords[1]
|
||||
|
|
|
|||
Loading…
Reference in New Issue