Skip to content

Commit 3064a4d

Browse files
committed
fix: 增加分享管理中对SUB_STORE_FRONTEND_BACKEND_PATH校验,新增部分文案i18n
1 parent 47194cd commit 3064a4d

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sub-store-front-end",
3-
"version": "2.15.77",
3+
"version": "2.15.78",
44
"private": true,
55
"scripts": {
66
"dev": "vite --host",

src/components/ShareListItem.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@
8383
</div>
8484
</div>
8585
<p v-if="!appearanceSetting.isSimpleMode" class="sub-item-remark">
86-
<span>创建时间:{{ createTime }}</span>
86+
<span>{{ t(`sharePage.createTimeLabel`) }}{{ createTime }}</span>
8787
</p>
8888
<p class="sub-item-remark">
89-
<span>到期时间:{{ expiresTime }}</span>
89+
<span>{{ t(`sharePage.expiredLabel`) }}{{ expiresTime }}</span>
9090
</p>
9191

9292
<!-- 分享备注 -->
@@ -345,6 +345,12 @@ const secretPath = computed(() => {
345345
const getShareUrl = () => {
346346
try {
347347
const { type, name, token } = props.data;
348+
if (!secretPath.value.startsWith('/')) {
349+
Toast.fail(t('sharePage.magicPathErrorNotify'));
350+
throw new Error(
351+
t("sharePage.magicPathErrorNotify"),
352+
);
353+
}
348354
const shareUrl = `${host.value.replace(
349355
new RegExp(`${secretPath.value}$`),
350356
"",

src/locales/en.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,6 +779,9 @@ export default {
779779
noOriginalTips: "Failed to jump, check if the source data has been deleted.",
780780
leftTime: "Remaining time",
781781
expired: "Expired",
782+
expiredLabel: "Expiration Time: ",
783+
createTimeLabel: "Creation Time: ",
784+
magicPathErrorNotify: "SUB_STORE_FRONTEND_BACKEND_PATH should start with /, please check the configuration!",
782785
createShare: {
783786
expiresValue: {
784787
label: "Valid for",

src/locales/zh.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,9 @@ export default {
769769
noOriginalTips: "跳转失败, 检查源数据是否已删除",
770770
leftTime: "剩余",
771771
expired: "已过期",
772+
expiredLabel: "过期时间:",
773+
createTimeLabel: "创建时间:",
774+
magicPathErrorNotify: "SUB_STORE_FRONTEND_BACKEND_PATH 必须以 / 开头,当前分享链接异常,请检查运行环境",
772775
createShare: {
773776
expiresValue: {
774777
label: "有效期时长",

src/views/share/SharePopup.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,12 @@ const handleCreateShare = async () => {
550550
if (res?.data?.status === "success") {
551551
isCreateShareLinkSuccess.value = true;
552552
const { token } = res.data.data;
553+
if (!secretPath.value.startsWith('/')) {
554+
Toast.fail(t('sharePage.magicPathErrorNotify'));
555+
throw new Error(
556+
t("sharePage.magicPathErrorNotify"),
557+
);
558+
}
553559
const shareUrl = `${host.value.replace(new RegExp(`${secretPath.value}$`), "")}/share/${typeMap[form.type]}/${encodeURIComponent(
554560
props.data.name,
555561
)}?token=${encodeURIComponent(token)}`;

0 commit comments

Comments
 (0)