From 3d637372ca4bba588460165f9fbd81c076040181 Mon Sep 17 00:00:00 2001 From: timka Date: Thu, 23 Nov 2023 18:54:03 +0300 Subject: [PATCH] disallow creating timka.su and not-url links --- src/components/AddLink.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/AddLink.js b/src/components/AddLink.js index 8df438e..38ebf00 100644 --- a/src/components/AddLink.js +++ b/src/components/AddLink.js @@ -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)