mirror of
http://git.nowherejezfoltodf4jiyl6r56jnzintap5vyjlia7fkirfsnfizflqd.onion/nihilist/darknet-lantern.git
synced 2025-05-16 12:16:57 +00:00
fix even more parsing related stuff, including namespace conflicts
This commit is contained in:
parent
013673fffb
commit
ca4d949175
1 changed files with 3 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
|||
import re
|
||||
from utils import IsUrlValid
|
||||
from SimpleX.utils import IsUrlValid
|
||||
import urllib.parse
|
||||
|
||||
#simplex:/contact#/?v=2-7&smp=smp%3A%2F%2FBD4qkVq8lJUgjHt0kUaxeQBYsKaxDejeecxm6-2vOwI%3D%40 b6geeakpwskovltbesvy3b6ah3ewxfmnhnshojndmpp7wcv2df7bnead.onion %2FOReK0M4-3C5NeZyQx_yFuTHSknVVS-3h%23%2F%3Fv%3D1-3%26dh%3DMCowBQYDK2VuAyEANi5VHx-Q1mIKmgZEg2ls47NGSlntttvcgLLbfKBpym4%253D&data=%7B%22groupLinkId%22%3A%22ndniy85i4DjITgVhB-MXnQ%3D%3D%22%7D
|
||||
|
@ -19,8 +19,7 @@ hostname_pattern = re.compile(r'^(?:[a-zA-Z0-9.-]+|[0-9]{1,3}(?:\.[0-9]{1,3}){3}
|
|||
|
||||
def IsSimpleXChatroomValid(url: str) -> bool:
|
||||
"""Validate the SimpleX chatroom URL."""
|
||||
REQUIRED_SUBSTRING = "contact#/?v=2-7&smp=smp%3A%2F"
|
||||
REQUIRED_SUBSTRING2 = "contact/#/?v=2-7&smp=smp%3A%2F"
|
||||
REQUIRED_SUBSTRING = "#/?v=2-7&smp=smp%3A%2F"
|
||||
|
||||
# Step 1: Check if it starts with http://, https://, or simplex:/
|
||||
if url.startswith(('http://', 'https://', 'simplex:/')):
|
||||
|
@ -31,7 +30,7 @@ def IsSimpleXChatroomValid(url: str) -> bool:
|
|||
return False # Must start with one of the valid protocols
|
||||
|
||||
# Step 2: Check for the presence of the required substring
|
||||
if REQUIRED_SUBSTRING not in url and REQUIRED_SUBSTRING2 not in url:
|
||||
if REQUIRED_SUBSTRING not in url:
|
||||
return False # Required substring not found
|
||||
|
||||
# Step 3: Extract the part after "smp=smp%3A%2F"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue