From 23bfbeb995de9542248995080ac870c8ca00948d Mon Sep 17 00:00:00 2001 From: whyour Date: Wed, 21 Sep 2022 14:54:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=B0=E5=BB=BA=E8=AE=A2?= =?UTF-8?q?=E9=98=85=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/config/index.ts | 2 +- src/pages/subscription/modal.tsx | 43 ++++++++++---------------------- 2 files changed, 14 insertions(+), 31 deletions(-) diff --git a/back/config/index.ts b/back/config/index.ts index 446b3f73..82d384a4 100644 --- a/back/config/index.ts +++ b/back/config/index.ts @@ -11,7 +11,7 @@ if (!process.env.QL_DIR) { if (qlHomePath.endsWith('/static/')) { qlHomePath = path.join(qlHomePath, '../'); } - process.env.QL_DIR = qlHomePath; + process.env.QL_DIR = qlHomePath.replace(/\/$/g, ''); } const lastVersionFile = `http://qn.whyour.cn/version.ts?v=${Date.now()}`; diff --git a/src/pages/subscription/modal.tsx b/src/pages/subscription/modal.tsx index 73a8b578..b5d752ba 100644 --- a/src/pages/subscription/modal.tsx +++ b/src/pages/subscription/modal.tsx @@ -190,8 +190,8 @@ const SubscriptionModal = ({ }; const onPaste = useCallback((e: any) => { - const text = e.clipboardData.getData('text'); - if (!subscription && text.includes('ql ')) { + const text = e.clipboardData.getData('text') as string; + if (text.startsWith('ql ')) { const [ , type, @@ -208,8 +208,8 @@ const SubscriptionModal = ({ type === 'raw' ? 'file' : url.startsWith('http') - ? 'public-repo' - : 'private-repo'; + ? 'public-repo' + : 'private-repo'; form.setFieldsValue({ type: _type, @@ -225,6 +225,13 @@ const SubscriptionModal = ({ } }, []); + const onNamePaste = useCallback((e) => { + const text = e.clipboardData.getData('text') as string; + if (text.startsWith('ql ')) { + e.preventDefault(); + } + }, []); + useEffect(() => { if (visible) { window.addEventListener('paste', onPaste); @@ -243,34 +250,10 @@ const SubscriptionModal = ({ } }, [subscription, visible]); - const isFirefox = navigator.userAgent.includes('Firefox'); - const isSafari = - navigator.userAgent.includes('Safari') && - !navigator.userAgent.includes('Chrome'); - const isQQBrowser = navigator.userAgent.includes('QQBrowser'); - return ( - 新建订阅 - - 支持repo/raw命令,粘贴导入 - - - ) + subscription ? '编辑订阅' : '新建订阅' } open={visible} forceRender @@ -291,7 +274,7 @@ const SubscriptionModal = ({ >
- +