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