diff --git a/content.py b/content.py index be1c7d39..37bfa0e9 100644 --- a/content.py +++ b/content.py @@ -138,6 +138,7 @@ def addWebLinks(content: str) -> str: w.startswith('i2p://') or \ w.startswith('gemini://') or \ w.startswith('gopher://') or \ + w.startswith('hyper://') or \ w.startswith('dat://'): if w.endswith('.') or w.endswith(';'): w = w[:-1] @@ -151,12 +152,15 @@ def addWebLinks(content: str) -> str: markup += '' elif w.startswith('dat://'): markup += '' + elif w.startswith('hyper://'): + markup += '' elif w.startswith('gemini://'): markup += '' elif w.startswith('gopher://'): markup += '' linkText = w.replace('https://', '').replace('http://', '') linkText = linkText.replace('dat://', '').replace('i2p://', '') + linkText = linkText.replace('hyper://', '') linkText = linkText.replace('gemini://', '') linkText = linkText.replace('gopher://', '') # prevent links from becoming too long @@ -415,6 +419,10 @@ def removeLongWords(content: str, maxWordLength: int, continue elif 'dat:' in wordStr: continue + elif 'hyper:' in wordStr: + continue + elif 'briar:' in wordStr: + continue if '<' in wordStr: replaceWord = wordStr.split('<', 1)[0] content = content.replace(wordStr, replaceWord) @@ -540,6 +548,7 @@ def getMentionsFromHtml(htmlText: str, actorStr = mentionStr.split('"')[0] if actorStr.startswith('http') or \ actorStr.startswith('i2p') or \ + actorStr.startswith('hyper') or \ actorStr.startswith('dat:'): if actorStr not in mentions: mentions.append(actorStr) diff --git a/epicyon.py b/epicyon.py index a2f305b8..ad3ef1ac 100644 --- a/epicyon.py +++ b/epicyon.py @@ -171,6 +171,9 @@ parser.add_argument("--http", type=str2bool, nargs='?', parser.add_argument("--dat", type=str2bool, nargs='?', const=True, default=False, help="Use dat protocol only") +parser.add_argument("--hyper", type=str2bool, nargs='?', + const=True, default=False, + help="Use hypercore protocol only") parser.add_argument("--i2p", type=str2bool, nargs='?', const=True, default=False, help="Use i2p protocol only") @@ -977,6 +980,8 @@ if args.ocap: ocapAlways = args.ocap if args.dat: httpPrefix = 'dat' +if args.hyper: + httpPrefix = 'hyper' if args.i2p: httpPrefix = 'i2p' @@ -990,6 +995,7 @@ if args.actor: args.actor = args.actor.replace('https://', '') args.actor = args.actor.replace('http://', '') args.actor = args.actor.replace('dat://', '') + args.actor = args.actor.replace('hyper://', '') args.actor = args.actor.replace('i2p://', '') args.actor = args.actor.replace('/@', '/users/') if '/users/' not in args.actor and \ diff --git a/follow.py b/follow.py index 4cbf3d17..dc9bebd5 100644 --- a/follow.py +++ b/follow.py @@ -461,8 +461,8 @@ def noOfFollowRequests(baseDir: str, lines = f.readlines() if followType != "onion": return len(lines) - for l in lines: - if '.onion' in l: + for fileLine in lines: + if '.onion' in fileLine: ctr += 1 return ctr diff --git a/inbox.py b/inbox.py index be4bffad..b0f1ab0f 100644 --- a/inbox.py +++ b/inbox.py @@ -1361,6 +1361,7 @@ def receiveAnnounce(recentPostsCache: {}, objectDomain = objectDomain.replace('http://', '') objectDomain = objectDomain.replace('i2p://', '') objectDomain = objectDomain.replace('dat://', '') + objectDomain = objectDomain.replace('hyper://', '') if '/' in objectDomain: objectDomain = objectDomain.split('/')[0] if isBlockedDomain(baseDir, objectDomain): diff --git a/utils.py b/utils.py index 31d419ba..732eafec 100644 --- a/utils.py +++ b/utils.py @@ -230,22 +230,23 @@ def getDomainFromActor(actor: str) -> (str, int): if '/profile/' in actor: domain = actor.split('/profile/')[0].replace('https://', '') domain = domain.replace('http://', '').replace('i2p://', '') - domain = domain.replace('dat://', '') + domain = domain.replace('dat://', '').replace('hyper://', '') else: if '/channel/' in actor: domain = actor.split('/channel/')[0].replace('https://', '') domain = domain.replace('http://', '').replace('i2p://', '') - domain = domain.replace('dat://', '') + domain = domain.replace('dat://', '').replace('hyper://', '') else: if '/users/' not in actor: domain = actor.replace('https://', '').replace('http://', '') - domain = domain.replace('i2p://', '').replace('dat://', '') + domain = domain.replace('i2p://', '') + domain = domain.replace('dat://', '').replace('hyper://', '') if '/' in actor: domain = domain.split('/')[0] else: domain = actor.split('/users/')[0].replace('https://', '') domain = domain.replace('http://', '').replace('i2p://', '') - domain = domain.replace('dat://', '') + domain = domain.replace('dat://', '').replace('hyper://', '') if ':' in domain: portStr = domain.split(':')[1] if not portStr.isdigit(): @@ -481,10 +482,10 @@ def deletePost(baseDir: str, httpPrefix: str, lines = f.readlines() if lines: newlines = '' - for l in lines: - if postId in l: + for fileLine in lines: + if postId in fileLine: continue - newlines += l + newlines += fileLine if not newlines.strip(): # if there are no lines then remove the # hashtag file diff --git a/webfinger.py b/webfinger.py index 0710cbd1..02310a3a 100644 --- a/webfinger.py +++ b/webfinger.py @@ -27,7 +27,8 @@ def parseHandle(handle: str) -> (str, str): if '.' not in handle: return None, None handleStr = handle.replace('https://', '').replace('http://', '') - handleStr = handleStr.replace('dat://', '').replace('i2p://', '') + handleStr = handleStr.replace('dat://', '').replace('hyper://', '') + handleStr = handleStr.replace('i2p://', '') if '/@' in handle: domain, nickname = handleStr.split('/@') else: diff --git a/webinterface.py b/webinterface.py index 2ee23b6f..8fcc9ca9 100644 --- a/webinterface.py +++ b/webinterface.py @@ -92,6 +92,7 @@ def getBlogAddress(actorJson: {}) -> str: if not (propertyValue['value'].startswith('https://') or propertyValue['value'].startswith('http://') or propertyValue['value'].startswith('dat://') or + propertyValue['value'].startswith('hyper://') or propertyValue['value'].startswith('i2p://')): continue if '.' not in propertyValue['value']: @@ -127,6 +128,7 @@ def setBlogAddress(actorJson: {}, blogAddress: str) -> None: if not (blogAddress.startswith('https://') or blogAddress.startswith('http://') or blogAddress.startswith('dat://') or + blogAddress.startswith('hyper://') or blogAddress.startswith('i2p://')): return if '.' not in blogAddress: @@ -2764,7 +2766,8 @@ def addEmbeddedAudio(translate: {}, content: str) -> str: continue if not (w.startswith('http') or w.startswith('dat:') or - w.startswith('i2p:') or '/' in w): + w.startswith('hyper:') or w.startswith('i2p:') or + '/' in w): continue url = w content += '