From e79cd00a06e78ec3eebc49cadb08d1396cca55b9 Mon Sep 17 00:00:00 2001 From: sadorowo Date: Wed, 8 May 2024 20:56:00 +0200 Subject: [PATCH] add some helpful messages to `curl` command --- js/commands.js | 4 ++-- js/data.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/js/commands.js b/js/commands.js index 391d202..23fc465 100644 --- a/js/commands.js +++ b/js/commands.js @@ -129,7 +129,7 @@ const COMMANDS = [ name: 'curl', description: 'open website in new tab', usage: '', - usage_examples: ['curl google.com'], + usage_examples: ['curl https://google.com'], arguments: [ { name: 'url', @@ -138,7 +138,7 @@ const COMMANDS = [ multiword: true, check: (url) => URL_REGEX.test(url) ? null - : "invalid URL" + : "invalid URL or missing protocol" } ], output: (url) => { diff --git a/js/data.js b/js/data.js index e659e08..f610515 100644 --- a/js/data.js +++ b/js/data.js @@ -1,4 +1,5 @@ -const URL_REGEX = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?)/; +const URL_REGEX = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/g; + const LINKS = { 'gitea': 'https://git.sador.me/sadorowo', 'instagram': 'https://instagram.com/sadorowo',