Chat Link Sharing System

Member
Feb
Threads
0
8
7
3
Rating - 0%
0   0   0
Hi, i tested the system and it works. at the end i ended up adding a whitelist in order to open only trusted links.
I added a python tuple inside the
Python:
__init__
method in
Python:
class interface
So:
1. Search for:
Python:
class Interface(object)
2. Inside
Python:
def __init__(self):
add:
Python:
self.whiteListWebsites = (
            "example",
            "example2",
            "example3",
        )
NOTE: Replace examples with the website you want to whitelist. You don't need to add the entire urls, but just a substring of the website (e.g. google)
3. Go inside the
Python:
def MakeHyperlinkTooltip(self, hyperlink):
4. Replace the
Python:
os.system("start " + tokens[1].replace("XxX", "://"))
with:
Python:
token = tokens[1].replace("XxX", "://")
                for website in self.whiteListWebsites:
                    if website in token:
                        os.system("start " + token)
                        return
                chat.AppendChat(chat.CHAT_TYPE_INFO, "Invalid website. If you think it's a valid one, contact a staff member.")
NOTE: I advise to use a string from the locale and not to add it like i did
NOTE2: This is just for "direct" urls, so urls that don't need a confirmation page to be opened, but at the end, modifications will be almost the same
NOTE3: It can be done the same also with black list instead of whitelist. It 's up to you to choose what to do

There are also some
Python:
import chr
wich i would move at the top of the file instead of using them in the middle of functions, but this is up to you
 


Thread Author
Moderator
Moderator
Developer
Feb
Threads
90
255
1,410
93
D A R D A Y I M
Rating - 0%
0   0   0
Hi, i tested the system and it works. at the end i ended up adding a whitelist in order to open only trusted links.
I added a python tuple inside the
Python:
__init__
method in
Python:
class interface
So:
1. Search for:
Python:
class Interface(object)
2. Inside
Python:
def __init__(self):
add:
Python:
self.whiteListWebsites = (
            "example",
            "example2",
            "example3",
        )
NOTE: Replace examples with the website you want to whitelist. You don't need to add the entire urls, but just a substring of the website (e.g. google)
3. Go inside the
Python:
def MakeHyperlinkTooltip(self, hyperlink):
4. Replace the
Python:
os.system("start " + tokens[1].replace("XxX", "://"))
with:
Python:
token = tokens[1].replace("XxX", "://")
                for website in self.whiteListWebsites:
                    if website in token:
                        os.system("start " + token)
                        return
                chat.AppendChat(chat.CHAT_TYPE_INFO, "Invalid website. If you think it's a valid one, contact a staff member.")
NOTE: I advise to use a string from the locale and not to add it like i did
NOTE2: This is just for "direct" urls, so urls that don't need a confirmation page to be opened, but at the end, modifications will be almost the same
NOTE3: It can be done the same also with black list instead of whitelist. It 's up to you to choose what to do

There are also some
Python:
import chr
wich i would move at the top of the file instead of using them in the middle of functions, but this is up to you
Thx bro ♥️
 
Member
Feb
Threads
6
68
253
53
Rating - 0%
0   0   0

ExyCvR.png


ty
 
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock