mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-11-30 16:15:51 +08:00
2
.eslintignore
Normal file
2
.eslintignore
Normal file
@@ -0,0 +1,2 @@
|
||||
/build
|
||||
/dist
|
||||
7
.eslintrc.json
Normal file
7
.eslintrc.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": ["@antfu", "prettier"],
|
||||
"rules": {
|
||||
"antfu/if-newline": ["off"],
|
||||
"no-console": ["off"]
|
||||
}
|
||||
}
|
||||
5
.prettierignore
Normal file
5
.prettierignore
Normal file
@@ -0,0 +1,5 @@
|
||||
/build
|
||||
/dist
|
||||
/pnpm-lock.yaml
|
||||
auto-imports.d.ts
|
||||
components.d.ts
|
||||
3
.prettierrc.json
Normal file
3
.prettierrc.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"singleQuote": true
|
||||
}
|
||||
Binary file not shown.
14
README.md
14
README.md
@@ -1,13 +1,15 @@
|
||||
# Auto_Bangumi_WebUI
|
||||
|
||||
基于[Auto_Bangumi](https://github.com/EstrellaXD/Auto_Bangumi)的WebUI
|
||||
基于[Auto_Bangumi](https://github.com/EstrellaXD/Auto_Bangumi)的 WebUI
|
||||
|
||||
目前适配了`Auto_Bangumi`的v1版本api
|
||||
目前适配了`Auto_Bangumi`的 v1 版本 api
|
||||
|
||||
主要功能为:
|
||||
- 查看订阅番剧(仅mikan源)
|
||||
- 订阅其他来源的新番rss
|
||||
- 订阅旧番rss
|
||||
|
||||
- 查看订阅番剧(仅 mikan 源)
|
||||
- 订阅其他来源的新番 rss
|
||||
- 订阅旧番 rss
|
||||
- debug
|
||||
- 重置`Auto_Bangumi`的数据
|
||||
- 查看日志
|
||||
- 查看日志
|
||||
- config 设置页
|
||||
|
||||
5
auto-imports.d.ts
vendored
5
auto-imports.d.ts
vendored
@@ -1,5 +0,0 @@
|
||||
// Generated by 'unplugin-auto-import'
|
||||
export {}
|
||||
declare global {
|
||||
|
||||
}
|
||||
BIN
build/dist.zip
BIN
build/dist.zip
Binary file not shown.
@@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="robots" content="noindex, nofollow" />
|
||||
<meta name="robots" content="noindex, nofollow" />
|
||||
<title>Auto_Bangumi</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
50
package.json
50
package.json
@@ -1,33 +1,43 @@
|
||||
{
|
||||
"name": "ab-webui",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "pnpm lint && vite build",
|
||||
"dev": "vite",
|
||||
"build": "vue-tsc --noEmit && vite build",
|
||||
"preview": "vite preview"
|
||||
"format": "prettier --write .",
|
||||
"format:check": "prettier --check .",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint . --fix",
|
||||
"preview": "vite preview",
|
||||
"test": "vitest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@vueuse/core": "^8.9.4",
|
||||
"axios": "^0.27.2",
|
||||
"element-plus": "^2.2.10",
|
||||
"element-plus": "^2.3.4",
|
||||
"modern-normalize": "^1.1.0",
|
||||
"pinia": "^2.0.16",
|
||||
"vue": "^3.2.37",
|
||||
"vue-global-api": "^0.4.1",
|
||||
"vue-router": "4"
|
||||
"pinia": "^2.0.35",
|
||||
"vue": "^3.2.47",
|
||||
"vue-router": "^4.1.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^18.0.6",
|
||||
"@vicons/carbon": "^0.12.0",
|
||||
"@vicons/utils": "^0.1.4",
|
||||
"@vitejs/plugin-vue": "^3.0.0",
|
||||
"sass": "^1.54.0",
|
||||
"typescript": "^4.6.4",
|
||||
"unplugin-auto-import": "^0.10.0",
|
||||
"unplugin-vue-components": "^0.21.1",
|
||||
"vite": "^3.0.0",
|
||||
"vue-tsc": "^0.38.4"
|
||||
"@antfu/eslint-config": "^0.38.5",
|
||||
"@types/node": "^18.16.0",
|
||||
"@unocss/preset-rem-to-px": "^0.51.8",
|
||||
"@unocss/reset": "^0.51.8",
|
||||
"@vitejs/plugin-vue": "^3.2.0",
|
||||
"eslint": "^8.39.0",
|
||||
"eslint-config-prettier": "^8.8.0",
|
||||
"prettier": "^2.8.8",
|
||||
"sass": "^1.62.0",
|
||||
"typescript": "^4.9.5",
|
||||
"unocss": "^0.51.8",
|
||||
"unplugin-auto-import": "^0.10.3",
|
||||
"unplugin-vue-components": "^0.21.2",
|
||||
"vite": "^3.2.6",
|
||||
"vitest": "^0.30.1",
|
||||
"vue-tsc": "^0.38.9"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
3912
pnpm-lock.yaml
generated
3912
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
13
src/App.vue
13
src/App.vue
@@ -1,14 +1,15 @@
|
||||
<script setup lang="ts">
|
||||
import zhCn from 'element-plus/lib/locale/lang/zh-cn'
|
||||
import { IconConfigProvider } from '@vicons/utils'
|
||||
import zhCn from 'element-plus/lib/locale/lang/zh-cn';
|
||||
|
||||
const { getStatus, onUpdate } = programStore();
|
||||
getStatus();
|
||||
onUpdate();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Suspense>
|
||||
<el-config-provider :locale="zhCn">
|
||||
<icon-config-provider size="18">
|
||||
<RouterView />
|
||||
</icon-config-provider>
|
||||
<RouterView />
|
||||
</el-config-provider>
|
||||
</Suspense>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
import axios from "axios";
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
* 添加番剧订阅
|
||||
* @param type 'new' 添加新番, ’old‘ 添加旧番
|
||||
* @param rss_link
|
||||
* @param rss_link
|
||||
*/
|
||||
const addBangumi = (type: string, rss_link: string) => {
|
||||
if(type === 'new') {
|
||||
function addBangumi(type: string, rss_link: string) {
|
||||
if (type === 'new') {
|
||||
return axios.post('api/v1/subscribe', { rss_link });
|
||||
} else if(type === 'old') {
|
||||
} else if (type === 'old') {
|
||||
return axios.post('api/v1/collection', { rss_link });
|
||||
} else {
|
||||
console.error('type错误, type应为 new 或 old');
|
||||
@@ -18,7 +17,7 @@ const addBangumi = (type: string, rss_link: string) => {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取AB存储的数据
|
||||
* 获取AB存储的数据
|
||||
*/
|
||||
const getABData = () => axios.get('api/v1/data');
|
||||
|
||||
@@ -28,8 +27,4 @@ const getABData = () => axios.get('api/v1/data');
|
||||
*/
|
||||
const removeRule = (name: string) => axios.get(`api/v1/removeRule/${name}`);
|
||||
|
||||
export {
|
||||
addBangumi,
|
||||
getABData,
|
||||
removeRule
|
||||
}
|
||||
export { addBangumi, getABData, removeRule };
|
||||
|
||||
12
src/api/config.ts
Normal file
12
src/api/config.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import axios from 'axios';
|
||||
import type { Config } from '#/config';
|
||||
|
||||
export async function setConfig(newConfig: Config) {
|
||||
const { data } = await axios.post('api/v1/updateConfig', newConfig);
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function getConfig() {
|
||||
const { data } = await axios.get<Config>('api/v1/getConfig');
|
||||
return data;
|
||||
}
|
||||
@@ -1,16 +1,15 @@
|
||||
import axios from 'axios'
|
||||
import axios from 'axios';
|
||||
|
||||
/**
|
||||
* 获取AB的日志
|
||||
* 获取AB的日志
|
||||
*/
|
||||
const getABLog = () => axios.get('api/v1/log');
|
||||
|
||||
async function getABLog() {
|
||||
const { data } = await axios.get('api/v1/log');
|
||||
return data;
|
||||
}
|
||||
/**
|
||||
* 重置 AB 的数据,程序会在下一轮检索中重新添加 RSS 订阅信息。
|
||||
* 重置 AB 的数据,程序会在下一轮检索中重新添加 RSS 订阅信息。
|
||||
*/
|
||||
const resetRule = () => axios.get('api/v1/resetRule');
|
||||
|
||||
export {
|
||||
getABLog,
|
||||
resetRule,
|
||||
}
|
||||
export { getABLog, resetRule };
|
||||
|
||||
16
src/api/program.ts
Normal file
16
src/api/program.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import axios from 'axios';
|
||||
|
||||
/** 重启 */
|
||||
export const appRestart = () => axios.get('api/v1/restart');
|
||||
|
||||
/** 启动 */
|
||||
export const appStart = () => axios.get('api/v1/start');
|
||||
|
||||
/** 停止 */
|
||||
export const appStop = () => axios.get('api/v1/stop');
|
||||
|
||||
/** 状态 */
|
||||
export async function appStatus() {
|
||||
const { data } = await axios.get<boolean>('api/v1/status');
|
||||
return data;
|
||||
}
|
||||
86
src/auto-imports.d.ts
vendored
Normal file
86
src/auto-imports.d.ts
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
// Generated by 'unplugin-auto-import'
|
||||
export {}
|
||||
declare global {
|
||||
const EffectScope: typeof import('vue')['EffectScope']
|
||||
const acceptHMRUpdate: typeof import('pinia')['acceptHMRUpdate']
|
||||
const afterAll: typeof import('vitest')['afterAll']
|
||||
const afterEach: typeof import('vitest')['afterEach']
|
||||
const assert: typeof import('vitest')['assert']
|
||||
const bangumiStore: typeof import('./store/bangumi')['bangumiStore']
|
||||
const beforeAll: typeof import('vitest')['beforeAll']
|
||||
const beforeEach: typeof import('vitest')['beforeEach']
|
||||
const chai: typeof import('vitest')['chai']
|
||||
const computed: typeof import('vue')['computed']
|
||||
const configStore: typeof import('./store/config')['configStore']
|
||||
const createApp: typeof import('vue')['createApp']
|
||||
const createPinia: typeof import('pinia')['createPinia']
|
||||
const customRef: typeof import('vue')['customRef']
|
||||
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
|
||||
const defineComponent: typeof import('vue')['defineComponent']
|
||||
const defineStore: typeof import('pinia')['defineStore']
|
||||
const describe: typeof import('vitest')['describe']
|
||||
const effectScope: typeof import('vue')['effectScope']
|
||||
const expect: typeof import('vitest')['expect']
|
||||
const getActivePinia: typeof import('pinia')['getActivePinia']
|
||||
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
|
||||
const getCurrentScope: typeof import('vue')['getCurrentScope']
|
||||
const h: typeof import('vue')['h']
|
||||
const inject: typeof import('vue')['inject']
|
||||
const isProxy: typeof import('vue')['isProxy']
|
||||
const isReactive: typeof import('vue')['isReactive']
|
||||
const isReadonly: typeof import('vue')['isReadonly']
|
||||
const isRef: typeof import('vue')['isRef']
|
||||
const it: typeof import('vitest')['it']
|
||||
const logStore: typeof import('./store/log')['logStore']
|
||||
const mapActions: typeof import('pinia')['mapActions']
|
||||
const mapGetters: typeof import('pinia')['mapGetters']
|
||||
const mapState: typeof import('pinia')['mapState']
|
||||
const mapStores: typeof import('pinia')['mapStores']
|
||||
const mapWritableState: typeof import('pinia')['mapWritableState']
|
||||
const markRaw: typeof import('vue')['markRaw']
|
||||
const nextTick: typeof import('vue')['nextTick']
|
||||
const onActivated: typeof import('vue')['onActivated']
|
||||
const onBeforeMount: typeof import('vue')['onBeforeMount']
|
||||
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
|
||||
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
|
||||
const onDeactivated: typeof import('vue')['onDeactivated']
|
||||
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
|
||||
const onMounted: typeof import('vue')['onMounted']
|
||||
const onRenderTracked: typeof import('vue')['onRenderTracked']
|
||||
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
|
||||
const onScopeDispose: typeof import('vue')['onScopeDispose']
|
||||
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
|
||||
const onUnmounted: typeof import('vue')['onUnmounted']
|
||||
const onUpdated: typeof import('vue')['onUpdated']
|
||||
const programStore: typeof import('./store/program')['programStore']
|
||||
const provide: typeof import('vue')['provide']
|
||||
const reactive: typeof import('vue')['reactive']
|
||||
const readonly: typeof import('vue')['readonly']
|
||||
const ref: typeof import('vue')['ref']
|
||||
const resolveComponent: typeof import('vue')['resolveComponent']
|
||||
const setActivePinia: typeof import('pinia')['setActivePinia']
|
||||
const setMapStoreSuffix: typeof import('pinia')['setMapStoreSuffix']
|
||||
const shallowReactive: typeof import('vue')['shallowReactive']
|
||||
const shallowReadonly: typeof import('vue')['shallowReadonly']
|
||||
const shallowRef: typeof import('vue')['shallowRef']
|
||||
const storeToRefs: typeof import('pinia')['storeToRefs']
|
||||
const suite: typeof import('vitest')['suite']
|
||||
const test: typeof import('vitest')['test']
|
||||
const toRaw: typeof import('vue')['toRaw']
|
||||
const toRef: typeof import('vue')['toRef']
|
||||
const toRefs: typeof import('vue')['toRefs']
|
||||
const triggerRef: typeof import('vue')['triggerRef']
|
||||
const unref: typeof import('vue')['unref']
|
||||
const useAttrs: typeof import('vue')['useAttrs']
|
||||
const useCssModule: typeof import('vue')['useCssModule']
|
||||
const useCssVars: typeof import('vue')['useCssVars']
|
||||
const useRoute: typeof import('vue-router')['useRoute']
|
||||
const useRouter: typeof import('vue-router')['useRouter']
|
||||
const useSlots: typeof import('vue')['useSlots']
|
||||
const vi: typeof import('vitest')['vi']
|
||||
const vitest: typeof import('vitest')['vitest']
|
||||
const watch: typeof import('vue')['watch']
|
||||
const watchEffect: typeof import('vue')['watchEffect']
|
||||
const watchPostEffect: typeof import('vue')['watchPostEffect']
|
||||
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
|
||||
}
|
||||
8
components.d.ts → src/components.d.ts
vendored
8
components.d.ts → src/components.d.ts
vendored
@@ -7,6 +7,8 @@ export {}
|
||||
|
||||
declare module '@vue/runtime-core' {
|
||||
export interface GlobalComponents {
|
||||
ConfigFormCol: typeof import('./components/ConfigFormCol.vue')['default']
|
||||
ConfigFormRow: typeof import('./components/ConfigFormRow.vue')['default']
|
||||
ElAside: typeof import('element-plus/es')['ElAside']
|
||||
ElButton: typeof import('element-plus/es')['ElButton']
|
||||
ElCard: typeof import('element-plus/es')['ElCard']
|
||||
@@ -16,17 +18,21 @@ declare module '@vue/runtime-core' {
|
||||
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
|
||||
ElContainer: typeof import('element-plus/es')['ElContainer']
|
||||
ElDialog: typeof import('element-plus/es')['ElDialog']
|
||||
ElForm: typeof import('element-plus/es')['ElForm']
|
||||
ElFormItem: typeof import('element-plus/es')['ElFormItem']
|
||||
ElHeader: typeof import('element-plus/es')['ElHeader']
|
||||
ElInput: typeof import('element-plus/es')['ElInput']
|
||||
ElMain: typeof import('element-plus/es')['ElMain']
|
||||
ElMenu: typeof import('element-plus/es')['ElMenu']
|
||||
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
|
||||
ElOption: typeof import('element-plus/es')['ElOption']
|
||||
ElRow: typeof import('element-plus/es')['ElRow']
|
||||
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
|
||||
ElSelect: typeof import('element-plus/es')['ElSelect']
|
||||
ElTable: typeof import('element-plus/es')['ElTable']
|
||||
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
ShowResults: typeof import('./src/components/ShowResults.vue')['default']
|
||||
ShowResults: typeof import('./components/ShowResults.vue')['default']
|
||||
}
|
||||
}
|
||||
14
src/components/ConfigFormCol.vue
Normal file
14
src/components/ConfigFormCol.vue
Normal file
@@ -0,0 +1,14 @@
|
||||
<script lang="ts" setup>
|
||||
defineProps<{
|
||||
label: string;
|
||||
prop?: string | string[];
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-col :xs="24" :sm="12" :md="8" :lg="6" :xl="4">
|
||||
<el-form-item :label="label" :prop="prop ?? ''">
|
||||
<slot></slot>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
17
src/components/ConfigFormRow.vue
Normal file
17
src/components/ConfigFormRow.vue
Normal file
@@ -0,0 +1,17 @@
|
||||
<script lang="ts" setup>
|
||||
defineProps<{
|
||||
title: string;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-collapse-item>
|
||||
<template #title>
|
||||
<span font-bold text-base>{{ title }}</span>
|
||||
</template>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<slot></slot>
|
||||
</el-row>
|
||||
</el-collapse-item>
|
||||
</template>
|
||||
@@ -1,20 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
const props = defineProps<{
|
||||
title: string,
|
||||
results: object | null
|
||||
defineProps<{
|
||||
title: string;
|
||||
results: object | null;
|
||||
}>();
|
||||
|
||||
const dialogVisible = ref(false);
|
||||
const handleClose = () => {
|
||||
function handleClose() {
|
||||
dialogVisible.value = false;
|
||||
}
|
||||
const open = () => {
|
||||
function open() {
|
||||
dialogVisible.value = true;
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open
|
||||
})
|
||||
open,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -34,13 +34,13 @@ defineExpose({
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang='scss' scope>
|
||||
.dia-log{
|
||||
.results{
|
||||
<style lang="scss" scope>
|
||||
.dia-log {
|
||||
.results {
|
||||
padding: 1em;
|
||||
line-height: 1.5;
|
||||
color: #fff;
|
||||
background: #333;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
21
src/main.ts
21
src/main.ts
@@ -1,14 +1,17 @@
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import 'vue-global-api'
|
||||
import 'modern-normalize/modern-normalize.css'
|
||||
import { createApp } from 'vue';
|
||||
import { createPinia } from 'pinia';
|
||||
import router from './router';
|
||||
import { Icon } from '@vicons/utils'
|
||||
import App from './App.vue';
|
||||
|
||||
const app = createApp(App)
|
||||
import '@unocss/reset/tailwind-compat.css';
|
||||
import 'virtual:uno.css';
|
||||
|
||||
app.component('Icon', Icon);
|
||||
import 'element-plus/es/components/message/style/css';
|
||||
import 'element-plus/es/components/message-box/style/css';
|
||||
|
||||
app.use(router)
|
||||
const pinia = createPinia();
|
||||
|
||||
app.mount('#app')
|
||||
const app = createApp(App);
|
||||
app.use(router);
|
||||
app.use(pinia);
|
||||
app.mount('#app');
|
||||
|
||||
@@ -1,26 +1,41 @@
|
||||
<script setup lang="ts">
|
||||
<script lang="ts" setup>
|
||||
import YMenu from './YMenu.vue';
|
||||
|
||||
const { status } = storeToRefs(programStore());
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="app-layout">
|
||||
<div class="app-layout" w-full h-screen overflow-hidden flex>
|
||||
<el-container>
|
||||
<el-header class="header">
|
||||
<img
|
||||
src="@/assets/logo.png"
|
||||
alt="logo"
|
||||
class="logo"
|
||||
>
|
||||
<el-header
|
||||
class="header"
|
||||
flex="~ items-center justify-center"
|
||||
h-65px
|
||||
relative
|
||||
>
|
||||
<img src="@/assets/logo.png" alt="logo" class="h-7/10" />
|
||||
|
||||
<div absolute right-5 flex="~ items-center" text-3>
|
||||
运行状态:
|
||||
<div
|
||||
class="i-carbon:dot-mark"
|
||||
:class="{ 'text-red': !status, 'text-green': status }"
|
||||
></div>
|
||||
</div>
|
||||
</el-header>
|
||||
|
||||
<el-container style="overflow: hidden;">
|
||||
<el-container overflow-hidden>
|
||||
<el-aside width="auto">
|
||||
<YMenu />
|
||||
</el-aside>
|
||||
|
||||
<el-main>
|
||||
<el-scrollbar>
|
||||
<RouterView />
|
||||
<RouterView v-slot="{ Component }">
|
||||
<KeepAlive>
|
||||
<component :is="Component" />
|
||||
</KeepAlive>
|
||||
</RouterView>
|
||||
</el-scrollbar>
|
||||
</el-main>
|
||||
</el-container>
|
||||
@@ -28,27 +43,14 @@ import YMenu from './YMenu.vue';
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang='scss' scope>
|
||||
<style lang="scss" scope>
|
||||
.app-layout {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
|
||||
@media screen and (max-width: 980px){
|
||||
@media screen and (max-width: 980px) {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-bottom: 1px solid var(--el-border-color);
|
||||
height: 65px;
|
||||
|
||||
.logo {
|
||||
height: 70%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
import { useRoute } from 'vue-router'
|
||||
import { Home, Debug, DocumentBlank } from '@vicons/carbon';
|
||||
import { useWindowSize } from '@vueuse/core';
|
||||
|
||||
const { fullPath } = useRoute();
|
||||
|
||||
const isCollapse = ref(false);
|
||||
|
||||
const { width } = useWindowSize();
|
||||
const isCollapse = ref(false);
|
||||
const WIDTH = 980;
|
||||
|
||||
watchEffect(() => {
|
||||
@@ -16,46 +12,39 @@ watchEffect(() => {
|
||||
} else {
|
||||
isCollapse.value = false;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
const items = [
|
||||
{
|
||||
icon: 'i-carbon-home',
|
||||
title: '番剧管理',
|
||||
url: '/bangumi',
|
||||
},
|
||||
{
|
||||
icon: 'i-carbon-debug',
|
||||
title: '调试',
|
||||
url: '/debug',
|
||||
},
|
||||
{
|
||||
icon: 'i-carbon:align-box-middle-right',
|
||||
title: '日志',
|
||||
url: '/log',
|
||||
},
|
||||
{
|
||||
icon: 'i-carbon:settings',
|
||||
title: '配置',
|
||||
url: '/config',
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<el-menu
|
||||
class="app-menu"
|
||||
:default-active="fullPath"
|
||||
:collapse="isCollapse"
|
||||
router
|
||||
>
|
||||
|
||||
<el-menu-item index="/bangumi">
|
||||
<Icon>
|
||||
<Home />
|
||||
</Icon>
|
||||
<template #title>番剧管理</template>
|
||||
</el-menu-item>
|
||||
|
||||
<el-menu-item index="/debug">
|
||||
<Icon>
|
||||
<Debug />
|
||||
</Icon>
|
||||
<template #title>调试</template>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="/log">
|
||||
<Icon>
|
||||
<DocumentBlank />
|
||||
</Icon>
|
||||
<template #title>日志</template>
|
||||
</el-menu-item>
|
||||
|
||||
<el-menu :default-active="fullPath" :collapse="isCollapse" router h-full>
|
||||
<template v-for="(i, index) in items" :key="index">
|
||||
<el-menu-item :index="i.url">
|
||||
<div :class="[i.icon]" mr-0.5em></div>
|
||||
<template #title>{{ i.title }}</template>
|
||||
</el-menu-item>
|
||||
</template>
|
||||
</el-menu>
|
||||
</template>
|
||||
|
||||
<style lang='scss' scope>
|
||||
.app-menu {
|
||||
height: 100%;
|
||||
|
||||
.xicon {
|
||||
margin-right: .5em;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,34 +1,28 @@
|
||||
<script setup lang="ts">
|
||||
import ShowResults from '@/components/ShowResults.vue';
|
||||
import { addBangumi } from '@/api/bangumi';
|
||||
|
||||
const props = defineProps<{
|
||||
type: string
|
||||
}>()
|
||||
type: string;
|
||||
}>();
|
||||
|
||||
const rssLink = ref('');
|
||||
const loading = ref(false);
|
||||
const dialog = ref();
|
||||
const dialogData = ref(null);
|
||||
|
||||
const add = async () => {
|
||||
async function add() {
|
||||
loading.value = true;
|
||||
const res = await addBangumi(props.type, rssLink.value);
|
||||
if (res){
|
||||
if (res) {
|
||||
loading.value = false;
|
||||
dialogData.value = res.data;
|
||||
dialog.value.open();
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ShowResults
|
||||
ref="dialog"
|
||||
title="执行结果"
|
||||
:results="dialogData"
|
||||
/>
|
||||
<ShowResults ref="dialog" title="执行结果" :results="dialogData" />
|
||||
|
||||
<el-card shadow="hover">
|
||||
<template #header>
|
||||
@@ -39,19 +33,13 @@ const add = async () => {
|
||||
</template>
|
||||
|
||||
<div class="card-con">
|
||||
<el-input
|
||||
v-model="rssLink"
|
||||
placeholder="请输入番剧的rss链接"
|
||||
>
|
||||
<el-input v-model="rssLink" placeholder="请输入番剧的rss链接">
|
||||
<template #append>
|
||||
<el-button
|
||||
type="primary"
|
||||
:loading="loading"
|
||||
@click="add"
|
||||
>订阅</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="add"
|
||||
>订阅</el-button
|
||||
>
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
|
||||
</el-card>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
@@ -1,76 +1,50 @@
|
||||
<script setup lang="ts">
|
||||
import ShowResults from '@/components/ShowResults.vue';
|
||||
import { getABData } from '@/api/bangumi';
|
||||
|
||||
const res = await getABData();
|
||||
const bangumiData = ref(res.data);
|
||||
const store = bangumiStore();
|
||||
|
||||
const activeName = ref('1');
|
||||
const dialogData = ref(null);
|
||||
const dialog = ref();
|
||||
|
||||
onActivated(() => {
|
||||
store.get();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ShowResults
|
||||
ref="dialog"
|
||||
title="执行结果"
|
||||
:results="dialogData"
|
||||
/>
|
||||
<ShowResults ref="dialog" title="执行结果" :results="dialogData" />
|
||||
|
||||
<div class="bangumi-data">
|
||||
<el-collapse
|
||||
accordion
|
||||
v-model="activeName"
|
||||
>
|
||||
|
||||
<el-collapse-item
|
||||
title="已订阅番剧"
|
||||
name="1"
|
||||
>
|
||||
<span class="tips">注: 目前只能管理mikan源, 如通过api添加其他来源的新番将不过出现在此处</span>
|
||||
<el-collapse v-model="activeName" accordion>
|
||||
<el-collapse-item title="已订阅番剧" name="1">
|
||||
<span class="tips"
|
||||
>注: 目前只能管理 mikan 源, 如通过 api 添加其他来源的新番将
|
||||
<b>不会</b> 出现在此处</span
|
||||
>
|
||||
<el-table
|
||||
:data="bangumiData.bangumi_info"
|
||||
:data="store.data.bangumi_info"
|
||||
stripe
|
||||
border
|
||||
style="width: 100%"
|
||||
max-height="40vh"
|
||||
>
|
||||
<el-table-column
|
||||
prop="official_title"
|
||||
label="番名"
|
||||
min-width="250"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="season"
|
||||
label="季度"
|
||||
width="60"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="dpi"
|
||||
label="分辨率"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="subtitle"
|
||||
label="字幕"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="group"
|
||||
label="字幕组"
|
||||
/>
|
||||
<el-table-column prop="official_title" label="番名" min-width="250" />
|
||||
<el-table-column prop="season" label="季度" width="60" />
|
||||
<el-table-column prop="dpi" label="分辨率" />
|
||||
<el-table-column prop="subtitle" label="字幕" />
|
||||
<el-table-column prop="group" label="字幕组" />
|
||||
</el-table>
|
||||
</el-collapse-item>
|
||||
|
||||
</el-collapse>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang='scss' scope>
|
||||
<style lang="scss" scope>
|
||||
.bangumi-data {
|
||||
.tips {
|
||||
line-height: 2;
|
||||
color: #F56C6C;
|
||||
color: #f56c6c;
|
||||
display: inline-block;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import BangumiData from './components/BangumiData.vue'
|
||||
import AddBangumi from './components/AddBangumi.vue'
|
||||
<script lang="ts" setup>
|
||||
import AddBangumi from './components/AddBangumi.vue';
|
||||
import BangumiData from './components/BangumiData.vue';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -14,7 +14,6 @@ import AddBangumi from './components/AddBangumi.vue'
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
|
||||
<!-- S 添加新番 -->
|
||||
<el-col :xs="24" :sm="24" :md="12" :lg="8">
|
||||
<AddBangumi type="new" />
|
||||
@@ -26,15 +25,14 @@ import AddBangumi from './components/AddBangumi.vue'
|
||||
<AddBangumi type="old" />
|
||||
</el-col>
|
||||
<!-- E 添加旧番 -->
|
||||
|
||||
</el-row>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style lang='scss' scope>
|
||||
<style lang="scss" scope>
|
||||
.el-row {
|
||||
&:not(:last-child) {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
26
src/pages/config/__test__/useConfigCheck.test.ts
Normal file
26
src/pages/config/__test__/useConfigCheck.test.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { checkHost, checkIp, checkPort } from '../useConfigCheck';
|
||||
|
||||
describe('check methods', () => {
|
||||
it('check ip', () => {
|
||||
expect(checkIp('127.0.0.1')).toBe(true);
|
||||
expect(checkIp('127.0.1')).toBe(false);
|
||||
expect(checkIp('')).toBe(false);
|
||||
});
|
||||
|
||||
it('check port', () => {
|
||||
expect(checkPort(80)).toBe(true);
|
||||
expect(checkPort(-1)).toBe(false);
|
||||
expect(checkPort(70000)).toBe(false);
|
||||
expect(checkPort()).toBe(false);
|
||||
});
|
||||
|
||||
it('check host', () => {
|
||||
expect(checkHost('127.0.0.1:2523')).toContainEqual(true);
|
||||
expect(checkHost('127.0.0.1')).toContainEqual(false);
|
||||
expect(checkHost('127.0.1:')).toContainEqual(false);
|
||||
expect(checkHost(':2523')).toContainEqual(false);
|
||||
expect(checkHost('127.0.0.1:70000')).toContainEqual(false);
|
||||
expect(checkHost('dfajlskdfa0')).toContainEqual(false);
|
||||
expect(checkHost('')).toContainEqual(false);
|
||||
});
|
||||
});
|
||||
64
src/pages/config/components/BangumiManageItem.vue
Normal file
64
src/pages/config/components/BangumiManageItem.vue
Normal file
@@ -0,0 +1,64 @@
|
||||
<script lang="ts" setup>
|
||||
import { form, renameMethod, tfOptions } from '../form-data';
|
||||
|
||||
const bgmManage = computed(() => form.bangumi_manage);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ConfigFormRow title="番剧管理">
|
||||
<ConfigFormCol label="启用">
|
||||
<el-select v-model="bgmManage.enable" flex-1>
|
||||
<el-option
|
||||
v-for="(opt, index) in tfOptions"
|
||||
:key="index"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="历史番剧下载">
|
||||
<el-select v-model="bgmManage.eps_complete" flex-1>
|
||||
<el-option
|
||||
v-for="(opt, index) in tfOptions"
|
||||
:key="index"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="重命名方法">
|
||||
<el-select v-model="bgmManage.rename_method" flex-1>
|
||||
<el-option
|
||||
v-for="opt in renameMethod"
|
||||
:key="opt"
|
||||
:label="opt"
|
||||
:value="opt"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="下载规则中添加组名">
|
||||
<el-select v-model="bgmManage.group_tag" flex-1>
|
||||
<el-option
|
||||
v-for="(opt, index) in tfOptions"
|
||||
:key="index"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="删除坏种">
|
||||
<el-select v-model="bgmManage.remove_bad_torrent" flex-1>
|
||||
<el-option
|
||||
v-for="(opt, index) in tfOptions"
|
||||
:key="index"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</ConfigFormCol>
|
||||
</ConfigFormRow>
|
||||
</template>
|
||||
46
src/pages/config/components/DownloaderItem.vue
Normal file
46
src/pages/config/components/DownloaderItem.vue
Normal file
@@ -0,0 +1,46 @@
|
||||
<script lang="ts" setup>
|
||||
import { downloaderType, form, tfOptions } from '../form-data';
|
||||
|
||||
const downloader = computed(() => form.downloader);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ConfigFormRow title="下载">
|
||||
<ConfigFormCol label="下载器">
|
||||
<el-select v-model="downloader.type" flex-1>
|
||||
<el-option
|
||||
v-for="opt in downloaderType"
|
||||
:key="opt"
|
||||
:value="opt"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="host" prop="downloader.host">
|
||||
<el-input v-model="downloader.host"></el-input>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="path">
|
||||
<el-input v-model="downloader.path"></el-input>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="username">
|
||||
<el-input v-model="downloader.username"></el-input>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="password">
|
||||
<el-input v-model="downloader.password"></el-input>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="ssl">
|
||||
<el-select v-model="downloader.ssl" flex-1>
|
||||
<el-option
|
||||
v-for="(opt, index) in tfOptions"
|
||||
:key="index"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</ConfigFormCol>
|
||||
</ConfigFormRow>
|
||||
</template>
|
||||
20
src/pages/config/components/LogItem.vue
Normal file
20
src/pages/config/components/LogItem.vue
Normal file
@@ -0,0 +1,20 @@
|
||||
<script lang="ts" setup>
|
||||
import { form, tfOptions } from '../form-data';
|
||||
|
||||
const log = computed(() => form.log);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ConfigFormRow title="日志">
|
||||
<ConfigFormCol label="启用debug">
|
||||
<el-select v-model="log.debug_enable" flex-1>
|
||||
<el-option
|
||||
v-for="(opt, index) in tfOptions"
|
||||
:key="index"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</ConfigFormCol>
|
||||
</ConfigFormRow>
|
||||
</template>
|
||||
39
src/pages/config/components/NotificationItem.vue
Normal file
39
src/pages/config/components/NotificationItem.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<script lang="ts" setup>
|
||||
import { form, notificationType, tfOptions } from '../form-data';
|
||||
|
||||
const notification = computed(() => form.notification);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ConfigFormRow title="通知">
|
||||
<ConfigFormCol label="启用">
|
||||
<el-select v-model="notification.enable" flex-1>
|
||||
<el-option
|
||||
v-for="(opt, index) in tfOptions"
|
||||
:key="index"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="通知类型">
|
||||
<el-select v-model="notification.type" flex-1>
|
||||
<el-option
|
||||
v-for="opt in notificationType"
|
||||
:key="opt"
|
||||
:label="opt"
|
||||
:value="opt"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="token">
|
||||
<el-input v-model="notification.token"></el-input>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="chat_id">
|
||||
<el-input v-model="notification.chat_id" type="number"></el-input>
|
||||
</ConfigFormCol>
|
||||
</ConfigFormRow>
|
||||
</template>
|
||||
21
src/pages/config/components/ProgramItem.vue
Normal file
21
src/pages/config/components/ProgramItem.vue
Normal file
@@ -0,0 +1,21 @@
|
||||
<script lang="ts" setup>
|
||||
import { form } from '../form-data';
|
||||
|
||||
const program = computed(() => form.program);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ConfigFormRow title="主程序">
|
||||
<ConfigFormCol label="RSS 检查间隔">
|
||||
<el-input v-model.number="program.sleep_time" type="number" />
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="重命名间隔">
|
||||
<el-input v-model.number="program.rename_times" type="number" />
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="webui端口" prop="program.webui_port">
|
||||
<el-input v-model.number="program.webui_port" type="number" />
|
||||
</ConfigFormCol>
|
||||
</ConfigFormRow>
|
||||
</template>
|
||||
51
src/pages/config/components/ProxyItem.vue
Normal file
51
src/pages/config/components/ProxyItem.vue
Normal file
@@ -0,0 +1,51 @@
|
||||
<script lang="ts" setup>
|
||||
import { form, proxyType, tfOptions } from '../form-data';
|
||||
|
||||
const proxy = computed(() => form.proxy);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ConfigFormRow title="代理">
|
||||
<ConfigFormCol label="启用">
|
||||
<el-select v-model="proxy.enable" flex-1>
|
||||
<el-option
|
||||
v-for="(opt, index) in tfOptions"
|
||||
:key="index"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="代理类型">
|
||||
<el-select v-model="proxy.type" flex-1>
|
||||
<el-option
|
||||
v-for="opt in proxyType"
|
||||
:key="opt"
|
||||
:label="opt"
|
||||
:value="opt"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="ip" prop="proxy.host">
|
||||
<el-input v-model="proxy.host"></el-input>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="port" prop="proxy.port">
|
||||
<el-input v-model.number="proxy.port" type="number"></el-input>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="username">
|
||||
<el-input v-model="proxy.username"></el-input>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="password">
|
||||
<el-input
|
||||
v-model="proxy.password"
|
||||
type="password"
|
||||
show-password
|
||||
></el-input>
|
||||
</ConfigFormCol>
|
||||
</ConfigFormRow>
|
||||
</template>
|
||||
69
src/pages/config/components/RssParserItem.vue
Normal file
69
src/pages/config/components/RssParserItem.vue
Normal file
@@ -0,0 +1,69 @@
|
||||
<script lang="ts" setup>
|
||||
import { form, rssParserLang, rssParserType, tfOptions } from '../form-data';
|
||||
|
||||
const rssParser = computed(() => form.rss_parser);
|
||||
|
||||
const filter = ref('');
|
||||
watch(filter, (nv) => {
|
||||
const value = nv.split(',').filter((e) => e !== '');
|
||||
rssParser.value.filter = value;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ConfigFormRow title="RSS解析">
|
||||
<ConfigFormCol label="启用">
|
||||
<el-select v-model="rssParser.enable" flex-1>
|
||||
<el-option
|
||||
v-for="(opt, index) in tfOptions"
|
||||
:key="index"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="源">
|
||||
<el-select v-model="rssParser.type" flex-1>
|
||||
<el-option
|
||||
v-for="opt in rssParserType"
|
||||
:key="opt"
|
||||
:value="opt"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="token">
|
||||
<el-input v-model="rssParser.token"></el-input>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="语言">
|
||||
<el-select v-model="rssParser.language" flex-1>
|
||||
<el-option
|
||||
v-for="opt in rssParserLang"
|
||||
:key="opt"
|
||||
:value="opt"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="源站链接">
|
||||
<el-input v-model="rssParser.custom_url"></el-input>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="tmdb解析">
|
||||
<el-select v-model="rssParser.enable_tmdb" flex-1>
|
||||
<el-option
|
||||
v-for="(opt, index) in tfOptions"
|
||||
:key="index"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</ConfigFormCol>
|
||||
|
||||
<ConfigFormCol label="筛选">
|
||||
<el-input v-model="filter" :value="rssParser.filter.join(',')"></el-input>
|
||||
</ConfigFormCol>
|
||||
</ConfigFormRow>
|
||||
</template>
|
||||
70
src/pages/config/form-data.ts
Normal file
70
src/pages/config/form-data.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import type {
|
||||
Config,
|
||||
DownloaderType,
|
||||
NotificationType,
|
||||
ProxyType,
|
||||
RenameMethod,
|
||||
RssParserLang,
|
||||
RssParserType,
|
||||
} from '#/config';
|
||||
|
||||
export const form = reactive<Config>({
|
||||
data_version: 4,
|
||||
program: {
|
||||
sleep_time: 0,
|
||||
rename_times: 0,
|
||||
webui_port: 0,
|
||||
},
|
||||
downloader: {
|
||||
type: 'qbittorrent',
|
||||
host: '',
|
||||
username: '',
|
||||
password: '',
|
||||
path: '',
|
||||
ssl: false,
|
||||
},
|
||||
rss_parser: {
|
||||
enable: true,
|
||||
type: 'mikan',
|
||||
token: '',
|
||||
custom_url: '',
|
||||
enable_tmdb: false,
|
||||
filter: [],
|
||||
language: 'zh',
|
||||
},
|
||||
bangumi_manage: {
|
||||
enable: true,
|
||||
eps_complete: true,
|
||||
rename_method: 'normal',
|
||||
group_tag: true,
|
||||
remove_bad_torrent: true,
|
||||
},
|
||||
log: {
|
||||
debug_enable: false,
|
||||
},
|
||||
proxy: {
|
||||
enable: false,
|
||||
type: 'http',
|
||||
host: '',
|
||||
port: 0,
|
||||
username: '',
|
||||
password: '',
|
||||
},
|
||||
notification: {
|
||||
enable: false,
|
||||
type: 'telegram',
|
||||
token: '',
|
||||
chat_id: '',
|
||||
},
|
||||
});
|
||||
|
||||
export const downloaderType: DownloaderType = ['qbittorrent'];
|
||||
export const rssParserType: RssParserType = ['mikan'];
|
||||
export const rssParserLang: RssParserLang = ['zh', 'en', 'jp'];
|
||||
export const renameMethod: RenameMethod = ['normal', 'pn', 'advance', 'none'];
|
||||
export const proxyType: ProxyType = ['http', 'https', 'socks5'];
|
||||
export const notificationType: NotificationType = ['telegram', 'server-chan'];
|
||||
export const tfOptions = [
|
||||
{ label: '是', value: true },
|
||||
{ label: '否', value: false },
|
||||
];
|
||||
65
src/pages/config/index.vue
Normal file
65
src/pages/config/index.vue
Normal file
@@ -0,0 +1,65 @@
|
||||
<script lang="ts" setup>
|
||||
import ProgramItem from './components/ProgramItem.vue';
|
||||
import DownloaderItem from './components/DownloaderItem.vue';
|
||||
import RssParserItem from './components/RssParserItem.vue';
|
||||
import BangumiManageItem from './components/BangumiManageItem.vue';
|
||||
import LogItem from './components/LogItem.vue';
|
||||
import ProxyItem from './components/ProxyItem.vue';
|
||||
import NotificationItem from './components/NotificationItem.vue';
|
||||
|
||||
import { form } from './form-data';
|
||||
|
||||
const store = configStore();
|
||||
|
||||
function submit() {
|
||||
store.set(form);
|
||||
}
|
||||
|
||||
function formSync() {
|
||||
if (store.config) {
|
||||
Object.keys(store.config).forEach((key) => {
|
||||
if (store.config) {
|
||||
form[key] = JSON.parse(JSON.stringify(store.config[key]));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
onActivated(async () => {
|
||||
await store.get();
|
||||
formSync();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="settings" pb30>
|
||||
<el-row :gutter="20">
|
||||
<el-col :xs="24" :sm="24">
|
||||
<el-form :model="form" label-position="right">
|
||||
<el-collapse>
|
||||
<ProgramItem />
|
||||
<DownloaderItem />
|
||||
<RssParserItem />
|
||||
<BangumiManageItem />
|
||||
<LogItem />
|
||||
<ProxyItem />
|
||||
<NotificationItem />
|
||||
</el-collapse>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<div flex="~ items-center justify-center" mt20>
|
||||
<el-button type="primary" @click="submit">保存</el-button>
|
||||
<el-button @click="formSync">还原</el-button>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scope>
|
||||
.el-row {
|
||||
&:not(:last-child) {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
77
src/pages/config/useConfigCheck.ts
Normal file
77
src/pages/config/useConfigCheck.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
import { form } from './form-data';
|
||||
|
||||
export function checkIp(ip: string) {
|
||||
const check =
|
||||
/^((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])(?::(?:[0-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$/;
|
||||
|
||||
return check.test(ip);
|
||||
}
|
||||
|
||||
/** 有效端口检测 */
|
||||
export function checkPort(port?: number) {
|
||||
if (!port) return false;
|
||||
if (port >= 0 && port <= 65535) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
/** host 格式检测 */
|
||||
export function checkHost(host: string): [boolean, string] {
|
||||
if (host === '') return [false, '请输入host'];
|
||||
if (!/:/.test(host)) {
|
||||
return [false, "缺少 ':'"];
|
||||
} else {
|
||||
const [ip, port] = host.split(':');
|
||||
|
||||
if (!checkIp(ip)) {
|
||||
return [false, '请输入有效ip!'];
|
||||
}
|
||||
|
||||
if (!checkPort(Number(port))) {
|
||||
return [false, '请输入有效端口!'];
|
||||
}
|
||||
}
|
||||
|
||||
return [true, ''];
|
||||
}
|
||||
|
||||
export function useConfigCheck() {
|
||||
/** 端口验证 */
|
||||
function validtePort(rule: any, value: any, callback: any) {
|
||||
if (value === '') return callback(new Error('请输入端口号'));
|
||||
|
||||
if (!checkPort(value)) {
|
||||
callback(new Error('无效端口 (端口范围 0 - 65535)'));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
|
||||
/** host 验证 */
|
||||
function validteHost(rule: any, value: any, callback: any) {
|
||||
const [c, m] = checkHost(value);
|
||||
if (!c) return callback(new Error(m));
|
||||
callback();
|
||||
}
|
||||
|
||||
/** proxy 启用时检测 ip 和 端口 */
|
||||
const validteFormProxy = {
|
||||
ip(rule: any, value: any, callback: any) {
|
||||
if (form.proxy.enable) {
|
||||
if (!checkIp(value)) return callback(new Error('请输入有效ip!'));
|
||||
}
|
||||
callback();
|
||||
},
|
||||
port(rule: any, value: any, callback: any) {
|
||||
if (form.proxy.enable) {
|
||||
if (!checkPort(value)) return callback(new Error('请输入有效端口!'));
|
||||
}
|
||||
callback();
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
validtePort,
|
||||
validteHost,
|
||||
validteFormProxy,
|
||||
};
|
||||
}
|
||||
@@ -1,29 +1,55 @@
|
||||
<script setup lang="ts">
|
||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||
import { resetRule } from '@/api/debug';
|
||||
import 'element-plus/es/components/message/style/css'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { appRestart } from '@/api/program';
|
||||
|
||||
const loading = ref(false);
|
||||
const reset = async () => {
|
||||
async function reset() {
|
||||
loading.value = true;
|
||||
const res = await resetRule();
|
||||
if (res.data === "Success") {
|
||||
loading.value = false;
|
||||
if (res.data === 'Success') {
|
||||
ElMessage({
|
||||
message: '数据已重置, 建议重启容器',
|
||||
message: '数据已重置, 建议重启程序或容器',
|
||||
type: 'success',
|
||||
})
|
||||
});
|
||||
} else {
|
||||
ElMessage({
|
||||
message: `错误: ${res.data}`,
|
||||
type: 'error',
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function restart() {
|
||||
ElMessageBox.confirm('该操作将重启程序!', {
|
||||
type: 'warning',
|
||||
})
|
||||
.then(async () => {
|
||||
appRestart()
|
||||
.then(({ data }) => {
|
||||
if (data.status === 'success') {
|
||||
ElMessage({
|
||||
message: '正在重启, 请稍后刷新页面...',
|
||||
type: 'success',
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('🚀 ~ file: index.vue:41 ~ .then ~ error:', error);
|
||||
ElMessage({
|
||||
message: '操作失败, 请重试!',
|
||||
type: 'error',
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="debug">
|
||||
<el-row :gutter="20">
|
||||
|
||||
<!-- S 重置数据 -->
|
||||
<el-col :xs="24" :sm="12" :lg="8">
|
||||
<el-card shadow="hover">
|
||||
@@ -34,20 +60,31 @@ const reset = async () => {
|
||||
</template>
|
||||
|
||||
<div class="card-con">
|
||||
<el-button
|
||||
type="danger"
|
||||
:loading="loading"
|
||||
@click="reset"
|
||||
>重置</el-button>
|
||||
<el-button type="danger" :loading="loading" @click="reset"
|
||||
>重置</el-button
|
||||
>
|
||||
</div>
|
||||
|
||||
</el-card>
|
||||
</el-col>
|
||||
<!-- E 重置数据 -->
|
||||
|
||||
<!-- S 重启程序 -->
|
||||
<el-col :xs="24" :sm="12" :lg="8" style="display: none">
|
||||
<el-card shadow="hover">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>重启程序</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="card-con">
|
||||
<el-button type="danger" :loading="loading" @click="restart"
|
||||
>重启</el-button
|
||||
>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<!-- E 重启程序 -->
|
||||
</el-row>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style lang='scss' scope>
|
||||
</style>
|
||||
@@ -1,41 +1,18 @@
|
||||
<script setup lang="ts">
|
||||
import { getABLog } from '@/api/debug';
|
||||
const store = logStore();
|
||||
|
||||
const log = ref(null);
|
||||
const timer = ref<NodeJS.Timer | null>(null);
|
||||
onActivated(() => {
|
||||
store.get();
|
||||
store.onUpdate();
|
||||
});
|
||||
|
||||
const getLog = async () => {
|
||||
const res = await getABLog();
|
||||
log.value = res.data;
|
||||
}
|
||||
|
||||
const autoUpdate = () => {
|
||||
timer.value = setInterval(getLog, 5000);
|
||||
}
|
||||
getLog();
|
||||
|
||||
onMounted(autoUpdate);
|
||||
onUnmounted(() => {
|
||||
clearInterval(Number(timer.value));
|
||||
})
|
||||
onDeactivated(() => {
|
||||
store.removeUpdate();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="log-box">
|
||||
<pre>{{ log }}</pre>
|
||||
<div class="log-box" wh-full overflow-hidden px-2em leading-2em text-12px>
|
||||
<pre whitespace-break-spaces>{{ store.log }}</pre>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang='scss' scope>
|
||||
.log-box {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
line-height: 2;
|
||||
padding: 0 2em;
|
||||
|
||||
pre {
|
||||
white-space: break-spaces;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -4,6 +4,7 @@ const YLayout = () => import('../pages/YLayout.vue');
|
||||
const YBangumi = () => import('../pages/bangumi/index.vue');
|
||||
const YDebug = () => import('../pages/debug/index.vue');
|
||||
const YLog = () => import('../pages/journal/index.vue');
|
||||
const YConfig = () => import('../pages/config/index.vue');
|
||||
|
||||
const routes = [
|
||||
{
|
||||
@@ -13,23 +14,27 @@ const routes = [
|
||||
children: [
|
||||
{
|
||||
path: 'bangumi',
|
||||
component: YBangumi
|
||||
component: YBangumi,
|
||||
},
|
||||
{
|
||||
path: 'debug',
|
||||
component: YDebug
|
||||
component: YDebug,
|
||||
},
|
||||
{
|
||||
path: 'log',
|
||||
component: YLog
|
||||
}
|
||||
]
|
||||
component: YLog,
|
||||
},
|
||||
{
|
||||
path: 'config',
|
||||
component: YConfig,
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
];
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
routes,
|
||||
})
|
||||
});
|
||||
|
||||
export default router;
|
||||
export default router;
|
||||
|
||||
12
src/store/bangumi.ts
Normal file
12
src/store/bangumi.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { getABData } from '../api/bangumi';
|
||||
|
||||
export const bangumiStore = defineStore('bangumi', () => {
|
||||
const data = ref({ rss_link: '', data_version: 4, bangumi_info: [] });
|
||||
|
||||
const get = async () => {
|
||||
const res = await getABData();
|
||||
data.value = res.data;
|
||||
};
|
||||
|
||||
return { data, get };
|
||||
});
|
||||
39
src/store/config.ts
Normal file
39
src/store/config.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import { ElMessage } from 'element-plus';
|
||||
import { getConfig, setConfig } from '@/api/config';
|
||||
import type { Config } from '#/config';
|
||||
|
||||
export const configStore = defineStore('config', () => {
|
||||
const config = ref<Config>();
|
||||
|
||||
const get = async () => {
|
||||
config.value = await getConfig();
|
||||
};
|
||||
|
||||
const set = async (newConfig: Omit<Config, 'data_version'>) => {
|
||||
let finalConfig: Config;
|
||||
if (config.value !== undefined) {
|
||||
finalConfig = Object.assign(config.value, newConfig);
|
||||
const { message } = await setConfig(finalConfig);
|
||||
|
||||
if (message === 'Success') {
|
||||
ElMessage({
|
||||
message: '保存成功, 请重启容器以应用新的配置!',
|
||||
type: 'success',
|
||||
});
|
||||
} else {
|
||||
ElMessage({
|
||||
message: '保存失败, 请重试!',
|
||||
type: 'error',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
return {
|
||||
get,
|
||||
set,
|
||||
config,
|
||||
};
|
||||
});
|
||||
25
src/store/log.ts
Normal file
25
src/store/log.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { getABLog } from '../api/debug';
|
||||
|
||||
export const logStore = defineStore('log', () => {
|
||||
const log = ref('');
|
||||
const timer = ref<NodeJS.Timer | null>(null);
|
||||
|
||||
const get = async () => {
|
||||
log.value = await getABLog();
|
||||
};
|
||||
|
||||
const onUpdate = () => {
|
||||
timer.value = setInterval(() => get(), 3000);
|
||||
};
|
||||
|
||||
const removeUpdate = () => {
|
||||
clearInterval(Number(timer.value));
|
||||
};
|
||||
|
||||
return {
|
||||
log,
|
||||
get,
|
||||
onUpdate,
|
||||
removeUpdate,
|
||||
};
|
||||
});
|
||||
20
src/store/program.ts
Normal file
20
src/store/program.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { appStatus } from '../api/program';
|
||||
|
||||
export const programStore = defineStore('program', () => {
|
||||
const status = ref(false);
|
||||
const timer = ref<NodeJS.Timer | null>(null);
|
||||
|
||||
const getStatus = async () => {
|
||||
status.value = await appStatus();
|
||||
};
|
||||
|
||||
const onUpdate = () => {
|
||||
timer.value = setInterval(() => getStatus(), 3000);
|
||||
};
|
||||
|
||||
return {
|
||||
status,
|
||||
getStatus,
|
||||
onUpdate,
|
||||
};
|
||||
});
|
||||
6
src/vite-env.d.ts
vendored
6
src/vite-env.d.ts
vendored
@@ -1,7 +1,7 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare module '*.vue' {
|
||||
import type { DefineComponent } from 'vue'
|
||||
const component: DefineComponent<{}, {}, any>
|
||||
export default component
|
||||
import type { DefineComponent } from 'vue';
|
||||
const component: DefineComponent<{}, {}, any>;
|
||||
export default component;
|
||||
}
|
||||
|
||||
@@ -12,15 +12,20 @@
|
||||
"esModuleInterop": true,
|
||||
"lib": ["ESNext", "DOM"],
|
||||
"skipLibCheck": true,
|
||||
"noImplicitAny": false,
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"@/*": ["src/*"],
|
||||
"#/*": ["src/types/*"]
|
||||
"#/*": ["types/*"]
|
||||
},
|
||||
"types": [
|
||||
"element-plus/global"
|
||||
]
|
||||
"types": ["element-plus/global"]
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.d.ts",
|
||||
"src/**/*.tsx",
|
||||
"src/**/*.vue",
|
||||
"types/config.ts"
|
||||
],
|
||||
"references": [{ "path": "./tsconfig.node.json" }]
|
||||
}
|
||||
|
||||
74
types/config.ts
Normal file
74
types/config.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
import type { UnionToTuple } from '#/utils';
|
||||
|
||||
export interface Config {
|
||||
data_version: 4;
|
||||
program: {
|
||||
sleep_time: number;
|
||||
rename_times: number;
|
||||
webui_port: number;
|
||||
};
|
||||
downloader: {
|
||||
type: 'qbittorrent';
|
||||
host: string;
|
||||
username: string;
|
||||
password: string;
|
||||
path: string;
|
||||
ssl: boolean;
|
||||
};
|
||||
rss_parser: {
|
||||
enable: boolean;
|
||||
type: 'mikan';
|
||||
token: string;
|
||||
custom_url: string;
|
||||
enable_tmdb: boolean;
|
||||
filter: Array<string>;
|
||||
language: 'zh' | 'en' | 'jp';
|
||||
};
|
||||
bangumi_manage: {
|
||||
enable: boolean;
|
||||
eps_complete: boolean;
|
||||
rename_method: 'normal' | 'pn' | 'advance' | 'none';
|
||||
group_tag: boolean;
|
||||
remove_bad_torrent: boolean;
|
||||
};
|
||||
log: {
|
||||
debug_enable: boolean;
|
||||
};
|
||||
proxy: {
|
||||
enable: boolean;
|
||||
type: 'http' | 'https' | 'socks5';
|
||||
host: string;
|
||||
port: number;
|
||||
username: string;
|
||||
password: string;
|
||||
};
|
||||
notification: {
|
||||
enable: boolean;
|
||||
type: 'telegram' | 'server-chan';
|
||||
token: string;
|
||||
chat_id: string;
|
||||
};
|
||||
}
|
||||
|
||||
type getItem<T extends keyof Config> = Pick<Config, T>[T];
|
||||
|
||||
export type Program = getItem<'program'>;
|
||||
export type Downloader = getItem<'downloader'>;
|
||||
export type RssParser = getItem<'rss_parser'>;
|
||||
export type BangumiManage = getItem<'bangumi_manage'>;
|
||||
export type Log = getItem<'log'>;
|
||||
export type Proxy = getItem<'proxy'>;
|
||||
export type Notification = getItem<'notification'>;
|
||||
|
||||
/** 下载方式 */
|
||||
export type DownloaderType = UnionToTuple<Downloader['type']>;
|
||||
/** rss parser 源 */
|
||||
export type RssParserType = UnionToTuple<RssParser['type']>;
|
||||
/** rss parser 语言 */
|
||||
export type RssParserLang = UnionToTuple<RssParser['language']>;
|
||||
/** 重命名方式 */
|
||||
export type RenameMethod = UnionToTuple<BangumiManage['rename_method']>;
|
||||
/** 代理类型 */
|
||||
export type ProxyType = UnionToTuple<Proxy['type']>;
|
||||
/** 通知类型 */
|
||||
export type NotificationType = UnionToTuple<Notification['type']>;
|
||||
39
types/utils.ts
Normal file
39
types/utils.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 将联合类型转为对应的交叉函数类型
|
||||
* @template U 联合类型
|
||||
*/
|
||||
export type UnionToInterFunction<U> = (
|
||||
U extends any ? (k: () => U) => void : never
|
||||
) extends (k: infer I) => void
|
||||
? I
|
||||
: never;
|
||||
|
||||
/**
|
||||
* 获取联合类型中的最后一个类型
|
||||
* @template U 联合类型
|
||||
*/
|
||||
export type GetUnionLast<U> = UnionToInterFunction<U> extends { (): infer A }
|
||||
? A
|
||||
: never;
|
||||
|
||||
/**
|
||||
* 在元组类型中前置插入一个新的类型(元素);
|
||||
* @template Tuple 元组类型
|
||||
* @template E 新的类型
|
||||
*/
|
||||
export type Prepend<Tuple extends any[], E> = [E, ...Tuple];
|
||||
|
||||
/**
|
||||
* 联合类型转元组类型;
|
||||
* @template Union 联合类型
|
||||
* @template T 初始元组类型
|
||||
* @template Last 传入联合类型中的最后一个类型(元素),自动生成,内部使用
|
||||
*/
|
||||
export type UnionToTuple<
|
||||
Union,
|
||||
T extends any[] = [],
|
||||
Last = GetUnionLast<Union>
|
||||
> = {
|
||||
0: T;
|
||||
1: UnionToTuple<Exclude<Union, Last>, Prepend<T, Last>>;
|
||||
}[[Union] extends [never] ? 0 : 1];
|
||||
17
unocss.config.ts
Normal file
17
unocss.config.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import {
|
||||
defineConfig,
|
||||
presetAttributify,
|
||||
presetIcons,
|
||||
presetUno,
|
||||
} from 'unocss';
|
||||
import presetRemToPx from '@unocss/preset-rem-to-px';
|
||||
|
||||
export default defineConfig({
|
||||
presets: [
|
||||
presetUno(),
|
||||
presetRemToPx(),
|
||||
presetAttributify(),
|
||||
presetIcons({ cdn: 'https://esm.sh/' }),
|
||||
],
|
||||
shortcuts: [[/^wh-(.*)$/, ([, t]) => `w-${t} h-${t}`]],
|
||||
});
|
||||
@@ -1,32 +1,41 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { resolve } from 'path';
|
||||
import AutoImport from 'unplugin-auto-import/vite'
|
||||
import Components from 'unplugin-vue-components/vite'
|
||||
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
||||
import { resolve } from 'node:path';
|
||||
import UnoCSS from 'unocss/vite';
|
||||
import { defineConfig } from 'vite';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import AutoImport from 'unplugin-auto-import/vite';
|
||||
import Components from 'unplugin-vue-components/vite';
|
||||
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
base: './',
|
||||
plugins: [
|
||||
vue(),
|
||||
UnoCSS(),
|
||||
AutoImport({
|
||||
imports: ['vue', 'vue-router', 'vitest', 'pinia'],
|
||||
dts: 'src/auto-imports.d.ts',
|
||||
resolvers: [ElementPlusResolver()],
|
||||
dirs: ['src/store', 'src/hooks'],
|
||||
}),
|
||||
Components({
|
||||
dts: 'src/components.d.ts',
|
||||
resolvers: [ElementPlusResolver()],
|
||||
}),
|
||||
],
|
||||
build: {
|
||||
cssCodeSplit: false,
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve(__dirname, 'src'),
|
||||
'#': resolve(__dirname, 'types')
|
||||
}
|
||||
'#': resolve(__dirname, 'types'),
|
||||
},
|
||||
},
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
proxy: {
|
||||
'/api': 'http://192.168.0.2:7892'
|
||||
}
|
||||
}
|
||||
})
|
||||
'^/api/.*': 'http://127.0.0.1:7892',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user