From 6e31cbb53d7623c28c4b46ffce4b7867d49a5282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Wed, 17 Jan 2024 17:09:27 +0800 Subject: [PATCH 1/7] =?UTF-8?q?wiki=E5=90=8D=E7=A7=B0=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/forge/Wiki/EditWiki.jsx | 14 ++++++--- src/forge/Wiki/Index.jsx | 11 +++++-- src/forge/Wiki/Preview.jsx | 2 +- src/forge/Wiki/api.js | 5 +--- src/forge/Wiki/components/sidebar/index.jsx | 29 ++++++++++--------- .../Wiki/components/uploadWiki/index.jsx | 8 +++-- 6 files changed, 41 insertions(+), 28 deletions(-) diff --git a/src/forge/Wiki/EditWiki.jsx b/src/forge/Wiki/EditWiki.jsx index 728f6e775..6ec63904f 100644 --- a/src/forge/Wiki/EditWiki.jsx +++ b/src/forge/Wiki/EditWiki.jsx @@ -18,7 +18,7 @@ export default Form.create()(({ form, history, showNotification, projectDetail, let wikiName = '' let key = ''; if (!pathname.endsWith('/wiki/add')) { - wikiName = pathname.split('/')[4]; + wikiName = decodeURI(pathname.split('/')[4]); key = pathname.split('/')[5]; }else{ key = search.split('=').pop(); @@ -116,6 +116,12 @@ export default Form.create()(({ form, history, showNotification, projectDetail, }; validateFields((err, values) => { if (!err) { + let regEn = /[\\/:*?"<>|[\]-]/g; + if (regEn.test(values.title)) { + message.error('文件名不能有特殊字符: \\ / : * ? \" < > | [ \] -'); + setOperateFlag(false); + return; + } const {md_content, title} = values; if (wikiName && search!== "?copy") { updateWiki({ @@ -124,7 +130,7 @@ export default Form.create()(({ form, history, showNotification, projectDetail, projectId: project.id, pageName: wikiName, title, - message: '', + commit_message: '', content_base64: Base64.encode(md_content) }).then(res => dealRes(res, title)); } else { @@ -217,7 +223,7 @@ export default Form.create()(({ form, history, showNotification, projectDetail, projectId: project.id, pageName: '_Sidebar', title: '_Sidebar', - message: '', + commit_message: '', content_base64: Base64.encode(content) }).then(res => { if (res && res.message === "200") { @@ -327,7 +333,7 @@ export default Form.create()(({ form, history, showNotification, projectDetail, "title", [ { required: true, message: "请输入标题" }, - { pattern: /^(?!-).*$/, message: '不能以-开头' } + // { pattern: /[^`\[\]\/:*?''<>|%-+_]/g, message: '不允许部分特殊字符' } ], { project && checkItem.name && getWiki({ owner: owner, repo: projectsId, - pageName: checkItem.sub_url, + pageName: checkItem.name, projectId: project.id }).then(res => { if (res && res.message === "200") { @@ -190,6 +190,11 @@ export default (props) => { setAddMenuError("不能仅输入空格"); return; } + const regEn = /[\\/:*?"<>|[\]-]/g; + if (regEn.test(menuName)) { + setAddMenuError("不能有特殊字符: \\ / : * ? \" < > | [ \] -"); + return; + } // 校验一级目录中是否有相同名称 const oneMenuList = fileList.filter(item=>!item.title.trim().startsWith('[[')).map(i=>i.title.trim()) if(oneMenuList.includes(`- ${menuName}`)){ @@ -210,7 +215,7 @@ export default (props) => { projectId: project.id, pageName: '_Sidebar', title: '_Sidebar', - message: '', + commit_message: '', content_base64: Base64.encode(treeToMd(sidebarList)) }).then(res => { if (res && res.message === "200") { @@ -228,7 +233,7 @@ export default (props) => { } function goEdit(params) { - history.push(`/${owner}/${projectsId}/wiki/${encodeURI(checkItem.sub_url)}/${checkItem.key}/edit${params}`); + history.push(`/${owner}/${projectsId}/wiki/${encodeURI(checkItem.name)}/${checkItem.key}/edit${params}`); } function preview() { diff --git a/src/forge/Wiki/Preview.jsx b/src/forge/Wiki/Preview.jsx index 2b700f60c..b36b1946f 100644 --- a/src/forge/Wiki/Preview.jsx +++ b/src/forge/Wiki/Preview.jsx @@ -63,7 +63,7 @@ export default (props) => { projectsId && checkItem.name && getWiki({ owner: owner, repo: projectsId, - pageName: checkItem.sub_url, + pageName: checkItem.name, projectId: projectId, }).then(res => { if (res && res.message === "200") { diff --git a/src/forge/Wiki/api.js b/src/forge/Wiki/api.js index 2250ec5f4..66425e0fb 100644 --- a/src/forge/Wiki/api.js +++ b/src/forge/Wiki/api.js @@ -116,16 +116,13 @@ export function markdownToTree(markdownText){ lines.map((item, index) =>{ const title = item.trim(); const isFile = title.startsWith('[[') && title.endsWith(']]'); - const titleStr = isFile ? title.substring(2, title.length - 2) : title.substring(2, title.length) const node = { // 带空格+[[]]或者- 标识 title: item, children: [], key: undefined, // 纯内容 - titleStr, - // 编码后的title,获取wiki内容用title_sub - title_sub: encodeURIComponent(titleStr), + titleStr: isFile ? title.substring(2, title.length - 2) : title.substring(2, title.length), // 是否是wiki文件 isFile: isFile } diff --git a/src/forge/Wiki/components/sidebar/index.jsx b/src/forge/Wiki/components/sidebar/index.jsx index d7046edb0..794ecbabc 100644 --- a/src/forge/Wiki/components/sidebar/index.jsx +++ b/src/forge/Wiki/components/sidebar/index.jsx @@ -163,7 +163,7 @@ export default function Sidebar(props) { const {node, children, key} = item; if(isFile){ // 删除页面 - deleteWiki({owner: owner, repo: projectsId, projectId: project.id, pageName: item.title_sub}).then(res => { + deleteWiki({owner: owner, repo: projectsId, projectId: project.id, pageName: title}).then(res => { if(res && res.message === "204"){ // 递归过滤相同key值的节点,执行删除操作 const menuListByDel = findSameKeyByDel(menuList, key); @@ -267,7 +267,7 @@ export default function Sidebar(props) { projectId: project.id, pageName: '_Sidebar', title: '_Sidebar', - message: '', + commit_message: '', content_base64: Base64.encode(content) }).then(res => { if (res && res.message === "200") { @@ -303,18 +303,20 @@ export default function Sidebar(props) { e.stopPropagation(); setVisible(item); setIsEditName(type); - const {titleStr, title_sub} = item; + let title = item.title.trim(); + const isFile = title.startsWith('[[') && title.endsWith(']]'); + title = isFile ? title.substring(2,title.length-2) : title.substring(2, title.length); type === 2 && getWiki({ owner: owner, repo: projectsId, - pageName: title_sub, + pageName: title, projectId: project.id }).then(res => { if (res && res.message === "200") { setWikiContent(res.data.md_content); } }) - setMenuName(titleStr); + setMenuName(title); } // 新增子目录 或者 重命名目录 @@ -327,8 +329,9 @@ export default function Sidebar(props) { setAddMenuError("不能仅输入空格"); return; } - if (isEditName === 2 && /^-/.test(menuName)) { - setAddMenuError('不能以-开头'); + const regEn = /[\\/:*?"<>|[\]-]/g; + if (regEn.test(menuName)) { + setAddMenuError('不能有特殊字符: \\ / : * ? \" < > | [ \] -'); return; } if(!isEditName){ @@ -353,15 +356,14 @@ export default function Sidebar(props) { }else{ // isEditName 1 编辑目录名称 2编辑页面名称 const titleToJudge = isEditName === 2 ? `[[${menuName}]]` : `- ${menuName}`; - const {key, titleStr, title_sub} = visible; - // 判断是否有修改名称 - if(titleStr === menuName){ + const {title, key} = visible; + if(title.trim() === titleToJudge){ setAddMenuError("请修改名称"); return } // 找兄弟节点 const list = findBrotherNodesByKey(menuList, key) || []; - if(list.map(item=>item.titleStr).includes(menuName)){ + if(list.map(item=>item.title.trim()).includes(titleToJudge)){ setAddMenuError("不能与同级目录名称相同"); return } @@ -379,16 +381,17 @@ export default function Sidebar(props) { }) if(isEditName === 2){ // 编辑页面名称-> 修改wiki + const oldTitle = title.substring(title.indexOf('[[')+2, title.indexOf(']]')) updateWiki({ owner, repo: projectsId, projectId: project.id, // 原名称 - pageName: title_sub, + pageName: oldTitle, // 现名称 title: menuName, content_base64: wikiContent, - message: '', + commit_message: '', }).then(res=>{ if(res && res.message === '200'){ // 修改wiki名称接口请求成功,更新sidebar diff --git a/src/forge/Wiki/components/uploadWiki/index.jsx b/src/forge/Wiki/components/uploadWiki/index.jsx index 30cfe492c..4113752dd 100644 --- a/src/forge/Wiki/components/uploadWiki/index.jsx +++ b/src/forge/Wiki/components/uploadWiki/index.jsx @@ -59,8 +59,10 @@ export default function UploadWiki(props) { message.error('只能上传md、txt文件'); return false; } - if (/^-/.test(file.name)) { - message.error('文件名不能以-开头'); + + let regEn = /[\\/:*?"<>|[\]-]/g; + if (regEn.test(file.name)) { + message.error('文件名不能有特殊字符: \\ / : * ? \" < > | [ \] -'); return false; } @@ -84,7 +86,7 @@ export default function UploadWiki(props) { projectId: project.id, pageName: '_Sidebar', title: '_Sidebar', - message: '', + commit_message: '', content_base64: Base64.encode(treeToMd(sidebarList)) }).then(res => { if (res && res.message === "200") { From 02585839d4eb01dc1fb31a227251c8ef218267da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E6=80=9D?= <2897217417@qq.com> Date: Thu, 29 Feb 2024 09:30:46 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=8F=8D=E9=A6=88=E4=B8=8D=E8=B5=8B=E9=BB=98=E8=AE=A4=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 12 ++++++------ src/forge/Issues/Component/newPanel.jsx | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index f0a4ed0fc..be7f27fb4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -172,7 +172,7 @@ "dependencies": { "jsesc": { "version": "2.5.2", - "resolved": "http://173.15.15.82:8081/repository/npm-all/jsesc/-/jsesc-2.5.2.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==" } } @@ -245,7 +245,7 @@ "dependencies": { "chalk": { "version": "2.4.2", - "resolved": "http://173.15.15.82:8081/repository/npm-all/chalk/-/chalk-2.4.2.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "requires": { "ansi-styles": "^3.2.1", @@ -341,12 +341,12 @@ }, "globals": { "version": "11.12.0", - "resolved": "http://173.15.15.82:8081/repository/npm-all/globals/-/globals-11.12.0.tgz", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" }, "ms": { "version": "2.1.2", - "resolved": "http://173.15.15.82:8081/repository/npm-all/ms/-/ms-2.1.2.tgz", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" } } @@ -7248,7 +7248,7 @@ }, "promise": { "version": "7.3.1", - "resolved": "http://173.15.15.82:8081/repository/npm-all/promise/-/promise-7.3.1.tgz", + "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", "requires": { "asap": "~2.0.3" @@ -9677,7 +9677,7 @@ }, "chalk": { "version": "2.4.2", - "resolved": "http://173.15.15.82:8081/repository/npm-all/chalk/-/chalk-2.4.2.tgz", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "requires": { "ansi-styles": "^3.2.1", diff --git a/src/forge/Issues/Component/newPanel.jsx b/src/forge/Issues/Component/newPanel.jsx index 67a02943f..babab11dc 100644 --- a/src/forge/Issues/Component/newPanel.jsx +++ b/src/forge/Issues/Component/newPanel.jsx @@ -16,8 +16,8 @@ function NewPanel(props,ref){ const { form: { getFieldDecorator, validateFields , setFieldsValue } } = props; useState(()=>{ - title && setTimeout(()=>{ - setFieldsValue({subject:title}); + setTimeout(()=>{ + title && setFieldsValue({subject:title}); desc && onContentChange(desc); },100) files && setAttachments(files); From 4243819efafc3585fa541a83a39b460deb18fb55 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 15 Mar 2024 14:52:05 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=B8=93=E5=8C=BA=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Component/mobile/accessory.jsx | 6 ++++-- .../Information/Component/mobile/index.scss | 1 + src/forge/Information/img/gitlink-gz-old.png | Bin 0 -> 8862 bytes src/forge/Information/img/gitlink-gz.png | Bin 8862 -> 37940 bytes src/forge/Information/img/gitlink-qq-old.png | Bin 0 -> 9293 bytes src/forge/Information/img/gitlink-qq.png | Bin 9293 -> 54774 bytes 6 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 src/forge/Information/img/gitlink-gz-old.png create mode 100644 src/forge/Information/img/gitlink-qq-old.png diff --git a/src/forge/Information/Component/mobile/accessory.jsx b/src/forge/Information/Component/mobile/accessory.jsx index a505727f6..28d04bd37 100644 --- a/src/forge/Information/Component/mobile/accessory.jsx +++ b/src/forge/Information/Component/mobile/accessory.jsx @@ -1,5 +1,7 @@ import React from 'react'; import './index.scss'; +import publicImg from '../../img/gitlink-gz.png'; +import qqImg from '../../img/gitlink-qq.png'; function acce({type}){ return( @@ -14,11 +16,11 @@ function acce({type}){
欢迎加入GitLink!
64%QWc=b6zo@JI_rL!=KJ}?jRe&zL?6UaFU;YyN?z?ZbG{3*}(o6BDKm92N
z4jfpm(eIaDdTGa`xUdNW>$TTjn`2B{ZM9YH_s%=-j0YZgAkIDa+_>Y8JF3;Q;xByR
z3)Llk9|!>RIm^%SW{28Z;BEs}zS#EluYbL+KCU_Gq?6_tTuVz!JpJ_3m6xm@KL^;%
znKSFErB!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