mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-05-28 03:39:46 +08:00
73 lines
1.7 KiB
Vue
73 lines
1.7 KiB
Vue
<script lang="ts" setup>
|
|
import api from '@/api'
|
|
import { useI18n } from 'vue-i18n'
|
|
|
|
// 多语言支持
|
|
const { t } = useI18n()
|
|
|
|
// 定义输入
|
|
const props = defineProps({
|
|
conf: {
|
|
type: Object as PropType<{ [key: string]: any }>,
|
|
required: true,
|
|
},
|
|
})
|
|
|
|
if (!props.conf.filepath) {
|
|
props.conf.filepath = '/moviepilot/.config/rclone/rclone.conf'
|
|
}
|
|
|
|
if (!props.conf.content) {
|
|
props.conf.content = t('dialog.rcloneConfig.defaultContent')
|
|
}
|
|
|
|
// 定义事件
|
|
const emit = defineEmits(['done', 'close'])
|
|
|
|
// 完成
|
|
async function handleDone() {
|
|
await savaRcloneConfig()
|
|
emit('done')
|
|
}
|
|
|
|
// 保存rclone设置
|
|
async function savaRcloneConfig() {
|
|
try {
|
|
await api.post(`storage/save/rclone`, props.conf)
|
|
} catch (e) {
|
|
console.error(e)
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<VDialog width="50rem" scrollable max-height="85vh">
|
|
<VCard :title="t('dialog.rcloneConfig.title')" class="rounded-t">
|
|
<VDialogCloseBtn @click="emit('close')" />
|
|
<VCardText>
|
|
<VRow>
|
|
<VCol cols="12">
|
|
<VTextField v-model="props.conf.filepath" :label="t('dialog.rcloneConfig.filePath')" />
|
|
</VCol>
|
|
<VCol cols="12">
|
|
<VAceEditor
|
|
v-model:value="props.conf.content"
|
|
lang="ini"
|
|
theme="monokai"
|
|
style="block-size: 30rem"
|
|
class="rounded"
|
|
>
|
|
</VAceEditor>
|
|
</VCol>
|
|
</VRow>
|
|
</VCardText>
|
|
<VCardActions>
|
|
<VSpacer />
|
|
<VBtn variant="elevated" @click="handleDone" prepend-icon="mdi-check" class="px-5 me-3">
|
|
{{ t('dialog.rcloneConfig.complete') }}
|
|
</VBtn>
|
|
</VCardActions>
|
|
</VCard>
|
|
</VDialog>
|
|
</template>
|