diff options
| author | polwex <polwex@sortug.com> | 2025-11-19 05:47:30 +0700 |
|---|---|---|
| committer | polwex <polwex@sortug.com> | 2025-11-19 05:47:30 +0700 |
| commit | 74d84cb2f22600b6246343e9ea606cf0db7517f0 (patch) | |
| tree | 0d68285c8e74e6543645e17ab2751d543c1ff9a6 /gui/src/logic/constants.ts | |
| parent | e6e657be3a3b1dae426b46f3bc16f9a5cf4861c2 (diff) | |
Big GUI improvements on Nostr rendering and fetchingpolwex/iris
Diffstat (limited to 'gui/src/logic/constants.ts')
| -rw-r--r-- | gui/src/logic/constants.ts | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gui/src/logic/constants.ts b/gui/src/logic/constants.ts index fcf5573..a1569fd 100644 --- a/gui/src/logic/constants.ts +++ b/gui/src/logic/constants.ts @@ -25,9 +25,19 @@ export const REF_REGEX = new RegExp( ); export const RADIO_REGEX = new RegExp(/urbit:\/\/radio\/~[a-z-_]+/gim); +// export const URL_REGEX = new RegExp( +// /^(https?:\/\/)?((localhost)|([\w-]+(\.[\w-]+)+)|(\d{1,3}(\.\d{1,3}){3}))(:\d{2,5})?(\/[^\s?#]*)?(\?[^#\s]*)?(#[^\s]*)?$/gim, +// ); +export const URL_REGEX = new RegExp( + /(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b[-a-zA-Z0-9()@:%_\+.~#?&//=]*)/gi, +); export const IMAGE_REGEX = new RegExp( - /https:\/\/.+\.(jpg|img|png|gif|tiff|jpeg|webp|webm|svg)\b/gim, + /https:\/\/.+\.(jpg|img|png|gif|tiff|jpeg|webp|webm|svg)\b/gi, +); +export const IMAGE_SUBREGEX = new RegExp( + /.*(jpg|img|png|gif|tiff|jpeg|webp|webm|svg)$/, ); +export const VIDEO_SUBREGEX = new RegExp(/.*(mov|mp4|ogv|mkv|m3uv)$/); export const SHIP_REGEX = new RegExp(/\B~[a-z-]+/); export const HASHTAGS_REGEX = new RegExp(/#[a-z-]+/g); |
