disallow creating timka.su and not-url links

master
timka 2023-11-23 18:54:03 +03:00
parent 2eb7bcd95f
commit 3d637372ca
1 changed files with 2 additions and 1 deletions

View File

@ -19,7 +19,8 @@ class AddLink extends Component {
}
short () {
if (this.state.value === "") {
const regex =/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
if (this.state.value === "" || this.state.value.includes('timka.su') || !(regex.test(this.state.value))) {
return
}
var linkName = makeid(6)