AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [ANY] Smart Link Remover (https://forums.alliedmods.net/showthread.php?t=295634)

Totenfluch 03-31-2017 14:45

[ANY] Smart Link Remover
 
2 Attachment(s)
Hey0,

This is a small Plugin that removes all links from a Players name

Install
- Drag 'n' drop the .smx


And you're done.

Github: https://github.com/Totenfluch/SmartLinkRemover

Note: I released this to get input from other developers on how to remove advertisements in names completly and smart.
If you have any ideas how to improve this further let me know!

Download count ~510
Thanks to AgentWesker and Mitchell for the code improvements!

Mitchell 03-31-2017 15:10

Re: [ANY] Smart Link Remover
 
*redacted, fixed in the newest version*

Totenfluch 03-31-2017 15:13

Re: [ANY] Smart Link Remover
 
Quote:

Originally Posted by Mitchell (Post 2508298)

Good spot!
That was code I used for testing something else and forgot to remove <.<

sneaK 03-31-2017 15:18

Re: [ANY] Smart Link Remover
 
Nice release, was looking for something like this recently actually! Any chance you'll be doing any improvements/additions to this in the future? If so, a couple suggestions:

- An option for flag-based immunity
- A whitelist, without directly modifying the regex expression in the code - for example, I don't mind players who wish to self-advertise their twitch.tv in their names, but don't wish to have any other links in names

Totenfluch 03-31-2017 15:36

Re: [ANY] Smart Link Remover
 
Quote:

Originally Posted by blackhawk74 (Post 2508300)
Nice release, was looking for something like this recently actually! Any chance you'll be doing any improvements/additions to this in the future? If so, a couple suggestions:

- An option for flag-based immunity
- A whitelist, without directly modifying the regex expression in the code - for example, I don't mind players who wish to self-advertise their twitch.tv in their names, but don't wish to have any other links in names

I planned a mysql database to blacklist certain other phrases directly and a (mysql)whitelist for pages like youtube, twitch (Menu/Command based Ingame)

For Phrases that the regex doesn't catch there will be another database where the admin can target the client and specify the part of the name that is not allowed so the plugin gets it right on the next time.

Agent Wesker 04-04-2017 14:12

Re: [ANY] Smart Link Remover
 
Here is a slightly improved Regex from testing on our server:
((http:[/]{2}|https:[/]{2}|www[.])?[-a-zA-Z0-9]{2,}[.][a-zA-Z]{2,5})

https://i.imgur.com/xwGMP3G.png

I also modified your code to loop through each match in case of multiple links.

Edit: Fixes have been merged https://github.com/Totenfluch/SmartLinkRemover

Mitchell 04-04-2017 14:39

Re: [ANY] Smart Link Remover
 
Depends how intrusive you want to be as something like:
"HD.mtch"
Is not a url, but
"mtch.tech"
is a url.

Agent Wesker 04-04-2017 14:51

Re: [ANY] Smart Link Remover
 
Quote:

Originally Posted by Mitchell (Post 2509340)
Depends how intrusive you want to be as something like:
"HD.mtch"
Is not a url, but
"mtch.tech"
is a url.

You could do a regex "or" and look for the literal strings (.com .money .tech) but it would be a very large regex string and might not even parse correctly...

Mitchell 04-04-2017 14:56

Re: [ANY] Smart Link Remover
 
Quote:

Originally Posted by Agent Wesker (Post 2509343)
You could do a regex "or" and look for the literal strings (.com .money .tech) but it would be a very large regex string and might not even parse correctly...

Either that or make a list of them and compare that list to the player's name.
edit: there's 882 domain extensions and growing pretty fast.

Totenfluch 04-04-2017 15:18

Re: [ANY] Smart Link Remover
 
Quote:

Originally Posted by Agent Wesker (Post 2509328)
Here is a slightly improved Regex from testing on our server:
((http:[/]{2}|https:[/]{2}|www[.])?[-a-zA-Z0-9]{2,}[.][a-zA-Z]{2,5})

https://i.imgur.com/xwGMP3G.png

I also modified your code to loop through each match in case of multiple links.

I have recoreded 73.000 player names and none of them had http in their name. So you can scrap that~
the MAX_NAME_LENGTH makes it literally impossible to have two links in a name that's why I didn't implement it
Other than that your regex looks extremly solid with 0 false positives and all matches in my ~350 name test - Well done!
If you send me a pull requests I'll merge it


we're having a discussion here:

https://github.com/Totenfluch/SmartLinkRemover/pull/1

if you want to join


All times are GMT -4. The time now is 18:53.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.