From 7f88920cdbd3775763655746b621250ad17a0872 Mon Sep 17 00:00:00 2001 From: yenche123 Date: Mon, 28 Aug 2023 19:00:12 +1000 Subject: [PATCH] fix: parsing some link --- cloud-functions/src/parse-text.ts | 2 +- package.json | 2 +- src/views/create-page/create-page.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cloud-functions/src/parse-text.ts b/cloud-functions/src/parse-text.ts index 941931c..f642f4c 100644 --- a/cloud-functions/src/parse-text.ts +++ b/cloud-functions/src/parse-text.ts @@ -56,7 +56,7 @@ exports.main = async function (ctx: FunctionContext): Promise { * 判断是否为 .mp3 或 .m4a 结尾的链接 */ function judgeIsCdnLink(link: string): boolean { - const reg = /^http(s)?:\/\/[^\s\/]{2,40}\/\S{2,240}\.(mp3|m4a)[\?=\w]*$/g + const reg = /^http(s)?:\/\/[\w\.-]*\w{1,32}\.\w{2,6}\/\S+.(mp3|m4a)[\?=\w]*$/g //@ts-ignore let matches = link.matchAll(reg) for(let match of matches) { diff --git a/package.json b/package.json index c84bbe8..a6cceba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "podcast-together", - "version": "0.9.2", + "version": "0.9.3", "description": "一个基于 vite + vue + vue-router + ts + laf 的全栈项目,让你跟好友一起实时在线听播客!", "type": "module", "scripts": { diff --git a/src/views/create-page/create-page.vue b/src/views/create-page/create-page.vue index 6d5b6ad..df47fb1 100644 --- a/src/views/create-page/create-page.vue +++ b/src/views/create-page/create-page.vue @@ -26,7 +26,7 @@ const canSubmit = computed(() => { let val = inputValue.value let v = val.trim() if(v.length < 10) return false - const reg = /^http(s)?:\/\/[\w\.]*\w{1,32}\.\w{2,6}\S*$/g + const reg = /^http(s)?:\/\/[\w\.-]*\w{1,32}\.\w{2,6}\S*$/g return reg.test(val) })