Skip to content

Commit

Permalink
feat: 同步配置支持文件(后端 > 2.14.144)
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Jan 11, 2024
1 parent fbb75e1 commit 10d7396
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sub-store-front-end",
"version": "2.14.35",
"version": "2.14.36",
"private": true,
"scripts": {
"dev": "vite --host",
Expand Down
22 changes: 19 additions & 3 deletions src/components/ArtifactPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
></nut-cascader>

</nut-form-item>
<nut-form-item :label="$t(`syncPage.addArtForm.platform.label`)">
<nut-form-item v-if="sourceInput && ['subscription', 'collection'].includes(editPanelData.type) " :label="$t(`syncPage.addArtForm.platform.label`)">
<nut-radiogroup
direction="horizontal"
v-model="editPanelData.platform"
Expand Down Expand Up @@ -142,7 +142,7 @@
name: '',
displayName: '',
source: '',
type: 'subscription',
type: 'file',
platform: 'Surge',
});
Expand All @@ -163,6 +163,12 @@
collection.name,
};
});
const filesNameList = useSubsStore().files.map(file => {
return {
name: file.name,
displayName: file.displayName || file['display-name'] || file.name,
};
});
const options = [];
if (subsNameList.length > 0) {
Expand All @@ -186,6 +192,16 @@
})),
});
}
if (filesNameList.length > 0) {
options.push({
value: 'file',
text: t('specificWord.file'),
children: filesNameList.map(item => ({
value: item.name,
text: item.displayName,
})),
});
}
return options;
});
Expand All @@ -210,7 +226,7 @@
const onClickNameInput = () => {
if (isEditMode.value) {
Toast.warn('同步订阅配置的名称不支持修改', { duration: 1000 });
Toast.warn('同步配置的名称不支持修改', { duration: 1000 });
}
};
const submit = () => {
Expand Down
8 changes: 6 additions & 2 deletions src/components/ArtifactsListItem.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<nut-swipe class="sub-item-swipe" ref="swipe" :disabled="$props.disabled">
<div class="sub-item-wrapper" :style="{'padding': isSimpleMode ? '9px' : '16px' }" @click.stop="previewSource">
<div class="sub-img-wrappers">
<a class="sub-img-wrappers" :href="artifact.url" target="_blank">
<nut-avatar class="sub-item-customer-icon" :size="isSimpleMode ? '36' : '48'" :url="icon" bg-color=""></nut-avatar>
</div>
</a>
<div class="sub-item-content">
<div class="sub-item-title-wrapper">
<h3 class="sub-item-title">
Expand Down Expand Up @@ -175,6 +175,8 @@ const sourceSub = computed(() => {
return subsStore.getOneCollection(name);
case 'subscription':
return subsStore.getOneSub(name);
case 'file':
return subsStore.getOneFile(name);
}
});
Expand Down Expand Up @@ -209,6 +211,8 @@ const transferText = (type: string) => {
return t('specificWord.singleSub');
case 'collection':
return t('specificWord.collectionSub');
case 'file':
return t('specificWord.file');
}
};
Expand Down
7 changes: 4 additions & 3 deletions src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export default {
specificWord: {
singleSub: 'Single',
collectionSub: 'Collection',
file: 'File',
},
globalNotify: {
refresh: {
Expand All @@ -22,7 +23,7 @@ export default {
pagesTitle: {
sub: 'Management',
file: 'File',
sync: 'Sync Subscription',
sync: 'Sync',
my: 'My Profile',
subEditor: 'Subscription Editor',
fileEditor: 'File Editor',
Expand All @@ -33,9 +34,9 @@ export default {
notFound: '404 Not Found',
askWhat: {
sync: {
title: 'What is Sync Subscription?',
title: 'What is Sync?',
content:
'Upload your subscriptions to a private Gist, which can be accessed at any time on devices that do not run the Sub Store (e.g. routers, etc.).',
'Upload your subscriptions/files to a private Gist, which can be accessed at any time on devices that do not run the Sub Store (e.g. routers, etc.).',
},
subEditor: {
title: 'Download no subscription?',
Expand Down
7 changes: 4 additions & 3 deletions src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export default {
specificWord: {
singleSub: '单条订阅',
collectionSub: '组合订阅',
file: '文件',
},
globalNotify: {
refresh: {
Expand All @@ -22,7 +23,7 @@ export default {
pagesTitle: {
sub: '订阅管理',
file: '文件管理',
sync: '同步订阅',
sync: '同步',
my: '我的',
subEditor: '订阅编辑',
fileEditor: '文件编辑',
Expand All @@ -33,9 +34,9 @@ export default {
notFound: '地址未找到',
askWhat: {
sync: {
title: '什么是同步订阅?',
title: '什么是同步?',
content:
'将您的订阅信息上传到私有 Gist,在无法运行 Sub Store 的设备(例如路由器等)上也可以随时访问。',
'将订阅/文件上传到私有 Gist,在无法运行 Sub Store 的设备(例如路由器等)上也可以随时访问。',
},
subEditor: {
title: '下载不了订阅?',
Expand Down
2 changes: 1 addition & 1 deletion src/types/store/artifacts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type ArtifactsPlatform =
| 'ClashMeta'
| 'V2Ray';

type ArtifactType = 'collection' | 'subscription';
type ArtifactType = 'collection' | 'subscription' | 'file';

interface Artifact {
name: string;
Expand Down

0 comments on commit 10d7396

Please sign in to comment.