diff --git a/package.json b/package.json
index 6a7a1243..fbab93aa 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "moviepilot",
- "version": "1.8.9-1",
+ "version": "1.9.0",
"private": true,
"bin": "dist/service.js",
"scripts": {
diff --git a/src/@core/components/ThemeSwitcher.vue b/src/@core/components/ThemeSwitcher.vue
index a7a29874..3f03feb8 100644
--- a/src/@core/components/ThemeSwitcher.vue
+++ b/src/@core/components/ThemeSwitcher.vue
@@ -4,6 +4,8 @@ import { useTheme } from 'vuetify'
import type { ThemeSwitcherTheme } from '@layouts/types'
import api from '@/api'
import { checkPrefersColorSchemeIsDark } from '@/@core/utils'
+import { useToast } from 'vue-toast-notification'
+import { VAceEditor } from 'vue3-ace-editor'
const props = defineProps<{
themes: ThemeSwitcherTheme[]
@@ -18,6 +20,17 @@ const { state: currentThemeName, next: getNextThemeName } = useCycleList(
{ initialValue: savedTheme.value },
)
+const $toast = useToast()
+
+// 自定义CSS弹窗
+const cssDialog = ref(false)
+
+// 自定义 CSS
+const customCSS = ref('')
+
+// 编辑器主题
+const editorTheme = computed(() => (currentThemeName.value === 'light' ? 'github' : 'monokai'))
+
// 主题切换动画
function themeTransition() {
const x = performance.now()
@@ -134,6 +147,43 @@ watch(
() => currentThemeName.value,
() => updateTheme(),
)
+
+// 获取自定义 CSS
+async function getCustomCSS() {
+ try {
+ const result: { [key: string]: any } = await api.get('system/setting/UserCustomCSS')
+ if (result && result.success && result.data?.value) {
+ customCSS.value = result.data?.value ?? ''
+ if (customCSS.value) {
+ const style = document.createElement('style')
+ style.innerHTML = result.data?.value ?? ''
+ document.head.appendChild(style)
+ }
+ }
+ } catch (error) {
+ console.error(error)
+ }
+}
+
+// 保存自定义 CSS
+async function saveCustomCSS() {
+ cssDialog.value = false
+ try {
+ const result: { [key: string]: any } = await api.post('system/setting/UserCustomCSS', customCSS.value, {
+ headers: {
+ 'Content-Type': 'text/plain',
+ },
+ })
+
+ if (result.success) $toast.success('自定义CSS保存成功!')
+ } catch (e) {
+ console.error('保存自定义 CSS 到服务端失败')
+ }
+}
+
+onMounted(() => {
+ getCustomCSS()
+})
@@ -150,8 +200,30 @@ watch(
{{ theme.title }}
+
+
+
+
+ 自定义
+
+
+
+
+
+
+
+
+
+
+
+
+ 保存
+
+
+
+