feat: 新增主题选择

This commit is contained in:
Lan
2024-11-28 20:13:02 +08:00
parent 495525f187
commit f54dadfcba
126 changed files with 98 additions and 39 deletions
+1
View File
@@ -90,6 +90,7 @@ async def update_config(
config_service: ConfigService = Depends(get_config_service), config_service: ConfigService = Depends(get_config_service),
admin: bool = Depends(admin_required) admin: bool = Depends(admin_required)
): ):
data.pop('themesChoices')
await config_service.update_config(data) await config_service.update_config(data)
return APIResponse() return APIResponse()
+15 -1
View File
@@ -2,7 +2,6 @@
# @Author : Lan # @Author : Lan
# @File : settings.py # @File : settings.py
# @Software: PyCharm # @Software: PyCharm
import json
from pathlib import Path from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
@@ -43,6 +42,21 @@ DEFAULT_CONFIG = {
'opacity': 0.9, 'opacity': 0.9,
'background': '', 'background': '',
'uploadCount': 10, 'uploadCount': 10,
'themesChoices': [
{
'name': '2023',
'key': 'themes/2023',
'author': 'Lan',
'version': '1.0',
},
{
'name': '2024',
'key': 'themes/2024',
'author': 'Lan',
'version': '1.0',
}
],
'themesSelect': 'themes/2024',
'errorMinute': 1, 'errorMinute': 1,
'errorCount': 1, 'errorCount': 1,
'port': 12345, 'port': 12345,
+29
View File
@@ -8,10 +8,39 @@ export {}
declare module 'vue' { declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {
CardTools: typeof import('./src/components/CardTools.vue')['default'] CardTools: typeof import('./src/components/CardTools.vue')['default']
ElButton: typeof import('element-plus/es')['ElButton']
ElCard: typeof import('element-plus/es')['ElCard']
ElCol: typeof import('element-plus/es')['ElCol']
ElContainer: typeof import('element-plus/es')['ElContainer']
ElDialog: typeof import('element-plus/es')['ElDialog']
ElDrawer: typeof import('element-plus/es')['ElDrawer']
ElEmpty: typeof import('element-plus/es')['ElEmpty']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElHeader: typeof import('element-plus/es')['ElHeader']
ElIcon: typeof import('element-plus/es')['ElIcon']
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']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElProgress: typeof import('element-plus/es')['ElProgress']
ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElRow: typeof import('element-plus/es')['ElRow']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTag: typeof import('element-plus/es')['ElTag']
ElUpload: typeof import('element-plus/es')['ElUpload']
FileBox: typeof import('./src/components/FileBox.vue')['default'] FileBox: typeof import('./src/components/FileBox.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink'] RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView'] RouterView: typeof import('vue-router')['RouterView']
UploadFile: typeof import('./src/components/UploadFile.vue')['default'] UploadFile: typeof import('./src/components/UploadFile.vue')['default']
UploadText: typeof import('./src/components/UploadText.vue')['default'] UploadText: typeof import('./src/components/UploadText.vue')['default']
} }
export interface ComponentCustomProperties {
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
}
} }
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
View File
@@ -53,6 +53,7 @@ export default {
explain: 'Interface Instructions', explain: 'Interface Instructions',
errorlimit: 'Error Limit', errorlimit: 'Error Limit',
keywords: 'Keywords', keywords: 'Keywords',
themeSelect: 'Theme Selection',
notify_title: 'Notification Title', notify_title: 'Notification Title',
notify_content: 'Notification Content', notify_content: 'Notification Content',
background: 'Background Image', background: 'Background Image',
+1
View File
@@ -53,6 +53,7 @@ export default {
explain: 'Descripción de la interfaz', explain: 'Descripción de la interfaz',
errorlimit: 'Límite de errores', errorlimit: 'Límite de errores',
keywords: 'Palabras clave', keywords: 'Palabras clave',
themeSelect: 'Selección de tema',
notify_title: 'Título de notificación', notify_title: 'Título de notificación',
notify_content: 'Contenido de notificación', notify_content: 'Contenido de notificación',
background: 'Imagen de fondo', background: 'Imagen de fondo',
+1
View File
@@ -53,6 +53,7 @@ export default {
explain:'界面说明', explain:'界面说明',
errorlimit: '错误限制', errorlimit: '错误限制',
keywords: '关键词', keywords: '关键词',
themeSelect: '主题选择',
notify_title: '通知标题', notify_title: '通知标题',
notify_content: '通知内容', notify_content: '通知内容',
background: '背景图片', background: '背景图片',
+1
View File
@@ -53,6 +53,7 @@ export default {
explain:'界面说明', explain:'界面说明',
errorlimit: '错误限制', errorlimit: '错误限制',
keywords: '关键词', keywords: '关键词',
themeSelect: '主题选择',
notify_title: '通知标题', notify_title: '通知标题',
notify_content: '通知内容', notify_content: '通知内容',
background: '背景图片', background: '背景图片',
+1
View File
@@ -53,6 +53,7 @@ export default {
explain: '界面說明', explain: '界面說明',
errorlimit: '錯誤限制', errorlimit: '錯誤限制',
keywords: '關鍵詞', keywords: '關鍵詞',
themeSelect: 'Theme選擇',
notify_title: '通知標題', notify_title: '通知標題',
notify_content: '通知內容', notify_content: '通知內容',
background: '背景圖片', background: '背景圖片',
+12 -1
View File
@@ -9,6 +9,15 @@
<el-form-item size="large" :label="t('admin.settings.keywords')" style="letter-spacing: 0.3rem"> <el-form-item size="large" :label="t('admin.settings.keywords')" style="letter-spacing: 0.3rem">
<el-input v-model="config.keywords" /> <el-input v-model="config.keywords" />
</el-form-item> </el-form-item>
<el-form-item size="large" :label="t('admin.settings.themeSelect')" >
<el-select
v-model="config.themesSelect"
multiple
style="width: 100%"
>
<el-option v-for="item in config.themesChoices" :label="item.name" :value="item.key" />
</el-select>
</el-form-item>
<el-form-item size="large" :label="t('admin.settings.notify_title')"> <el-form-item size="large" :label="t('admin.settings.notify_title')">
<el-input v-model="config.notify_title" /> <el-input v-model="config.notify_title" />
</el-form-item> </el-form-item>
@@ -139,11 +148,13 @@ import { useI18n } from 'vue-i18n'
const { t } = useI18n() const { t } = useI18n()
const config = ref({ const config:any = ref({
name: '', name: '',
description: '', description: '',
file_storage: '', file_storage: '',
expireStyle: [], expireStyle: [],
themesChoices: [],
themesSelect: '',
admin_token: '', admin_token: '',
robotsText:'', robotsText:'',
keywords: '', keywords: '',
+2 -3
View File
@@ -44,6 +44,7 @@ async def lifespan(app: FastAPI):
# 加载配置 # 加载配置
await load_config() await load_config()
app.mount('/assets', StaticFiles(directory=f'./{settings.themesSelect}/assets'), name="assets")
try: try:
yield yield
@@ -75,8 +76,6 @@ app.add_middleware(
allow_headers=["*"], allow_headers=["*"],
) )
app.mount('/assets', StaticFiles(directory='./fcb-fronted/dist/assets'), name="assets")
# 使用 register_tortoise 来添加异常处理器 # 使用 register_tortoise 来添加异常处理器
register_tortoise( register_tortoise(
app, app,
@@ -100,7 +99,7 @@ app.include_router(admin_api)
@app.get('/') @app.get('/')
async def index(): async def index():
return HTMLResponse( return HTMLResponse(
content=open(BASE_DIR / 'fcb-fronted/dist/index.html', 'r', encoding='utf-8').read() content=open(BASE_DIR / f'{settings.themesSelect}/index.html', 'r', encoding='utf-8').read()
.replace('{{title}}', str(settings.name)) .replace('{{title}}', str(settings.name))
.replace('{{description}}', str(settings.description)) .replace('{{description}}', str(settings.description))
.replace('{{keywords}}', str(settings.keywords)) .replace('{{keywords}}', str(settings.keywords))
@@ -1 +1 @@
import{d as s,a8 as n,Y as c,W as e,a1 as r,$ as a,g as o,o as i}from"./index-C7AmCAY9.js";const l={style:{"text-align":"center"}},u={style:{color:"#333"},href:"https://github.com/vastsa/FileCodeBox"},f=s({__name:"AboutView",setup(_){const{t}=n();return(m,d)=>(i(),c("main",l,[e("span",null,[r(a(o(t)("admin.about.source1"))+" ",1),e("em",null,[e("a",u,a(o(t)("admin.about.source2")),1)])])]))}});export{f as default}; import{d as s,a8 as n,Y as c,W as e,a1 as r,$ as a,g as o,o as i}from"./index-i8zpFmQM.js";const l={style:{"text-align":"center"}},u={style:{color:"#333"},href:"https://github.com/vastsa/FileCodeBox"},f=s({__name:"AboutView",setup(_){const{t}=n();return(m,d)=>(i(),c("main",l,[e("span",null,[r(a(o(t)("admin.about.source1"))+" ",1),e("em",null,[e("a",u,a(o(t)("admin.about.source2")),1)])])]))}});export{f as default};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
import{c as y,k as F,a as l,m as C,s as _,g as v,n as N,o as E,h as K,p as j,q as u,r as B,e as R,b as q,f as W,j as Y,S as H,t as J}from"./el-popper-CVoGoRyw.js";import{bs as S,b2 as x,a$ as Q,b5 as V,bt as X}from"./index-C7AmCAY9.js";import{v as Z}from"./el-button-ufZgkdzR.js";function z(e,r){for(var n=-1,s=e==null?0:e.length;++n<s&&r(e[n],n,e)!==!1;);return e}function k(e,r){return e&&y(r,F(r),e)}function ee(e,r){return e&&y(r,l(r),e)}function re(e,r){return y(e,C(e),r)}var te=Object.getOwnPropertySymbols,L=te?function(e){for(var r=[];e;)Z(r,C(e)),e=v(e);return r}:_;function ne(e,r){return y(e,L(e),r)}function ae(e){return N(e,l,L)}var oe=Object.prototype,se=oe.hasOwnProperty;function ce(e){var r=e.length,n=new e.constructor(r);return r&&typeof e[0]=="string"&&se.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function ie(e,r){var n=r?E(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var be=/\w*$/;function fe(e){var r=new e.constructor(e.source,be.exec(e));return r.lastIndex=e.lastIndex,r}var O=S?S.prototype:void 0,w=O?O.valueOf:void 0;function ge(e){return w?Object(w.call(e)):{}}var ue="[object Boolean]",ye="[object Date]",Te="[object Map]",le="[object Number]",je="[object RegExp]",pe="[object Set]",Ae="[object String]",me="[object Symbol]",de="[object ArrayBuffer]",$e="[object DataView]",Se="[object Float32Array]",Oe="[object Float64Array]",we="[object Int8Array]",Ie="[object Int16Array]",he="[object Int32Array]",Fe="[object Uint8Array]",Ce="[object Uint8ClampedArray]",Ee="[object Uint16Array]",Be="[object Uint32Array]";function xe(e,r,n){var s=e.constructor;switch(r){case de:return E(e);case ue:case ye:return new s(+e);case $e:return ie(e,n);case Se:case Oe:case we:case Ie:case he:case Fe:case Ce:case Ee:case Be:return K(e,n);case Te:return new s;case le:case Ae:return new s(e);case je:return fe(e);case pe:return new s;case me:return ge(e)}}var Le="[object Map]";function Me(e){return x(e)&&j(e)==Le}var I=u&&u.isMap,Ue=I?B(I):Me,Pe="[object Set]";function De(e){return x(e)&&j(e)==Pe}var h=u&&u.isSet,Ge=h?B(h):De,_e=1,ve=2,Ne=4,M="[object Arguments]",Ke="[object Array]",Re="[object Boolean]",qe="[object Date]",We="[object Error]",U="[object Function]",Ye="[object GeneratorFunction]",He="[object Map]",Je="[object Number]",P="[object Object]",Qe="[object RegExp]",Ve="[object Set]",Xe="[object String]",Ze="[object Symbol]",ze="[object WeakMap]",ke="[object ArrayBuffer]",er="[object DataView]",rr="[object Float32Array]",tr="[object Float64Array]",nr="[object Int8Array]",ar="[object Int16Array]",or="[object Int32Array]",sr="[object Uint8Array]",cr="[object Uint8ClampedArray]",ir="[object Uint16Array]",br="[object Uint32Array]",t={};t[M]=t[Ke]=t[ke]=t[er]=t[Re]=t[qe]=t[rr]=t[tr]=t[nr]=t[ar]=t[or]=t[He]=t[Je]=t[P]=t[Qe]=t[Ve]=t[Xe]=t[Ze]=t[sr]=t[cr]=t[ir]=t[br]=!0;t[We]=t[U]=t[ze]=!1;function T(e,r,n,s,p,c){var a,f=r&_e,g=r&ve,D=r&Ne;if(a!==void 0)return a;if(!Q(e))return e;var A=V(e);if(A){if(a=ce(e),!f)return R(e,a)}else{var b=j(e),m=b==U||b==Ye;if(q(e))return W(e,f);if(b==P||b==M||m&&!p){if(a=g||m?{}:Y(e),!f)return g?ne(e,ee(a,e)):re(e,k(a,e))}else{if(!t[b])return p?e:{};a=xe(e,b,f)}}c||(c=new H);var d=c.get(e);if(d)return d;c.set(e,a),Ge(e)?e.forEach(function(o){a.add(T(o,r,n,o,e,c))}):Ue(e)&&e.forEach(function(o,i){a.set(i,T(o,r,n,i,e,c))});var G=D?g?ae:J:g?l:F,$=A?void 0:G(e);return z($||e,function(o,i){$&&(i=o,o=e[i]),X(a,i,T(o,r,n,i,e,c))}),a}export{T as b}; import{c as y,k as F,a as l,m as C,s as _,g as v,n as N,o as E,h as K,p as j,q as u,r as B,e as R,b as q,f as W,j as Y,S as H,t as J}from"./el-popper-D5mMJcNX.js";import{bs as S,b2 as x,a$ as Q,b5 as V,bt as X}from"./index-i8zpFmQM.js";import{v as Z}from"./el-button-Bx4jKw8Q.js";function z(e,r){for(var n=-1,s=e==null?0:e.length;++n<s&&r(e[n],n,e)!==!1;);return e}function k(e,r){return e&&y(r,F(r),e)}function ee(e,r){return e&&y(r,l(r),e)}function re(e,r){return y(e,C(e),r)}var te=Object.getOwnPropertySymbols,L=te?function(e){for(var r=[];e;)Z(r,C(e)),e=v(e);return r}:_;function ne(e,r){return y(e,L(e),r)}function ae(e){return N(e,l,L)}var oe=Object.prototype,se=oe.hasOwnProperty;function ce(e){var r=e.length,n=new e.constructor(r);return r&&typeof e[0]=="string"&&se.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function ie(e,r){var n=r?E(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var be=/\w*$/;function fe(e){var r=new e.constructor(e.source,be.exec(e));return r.lastIndex=e.lastIndex,r}var O=S?S.prototype:void 0,w=O?O.valueOf:void 0;function ge(e){return w?Object(w.call(e)):{}}var ue="[object Boolean]",ye="[object Date]",Te="[object Map]",le="[object Number]",je="[object RegExp]",pe="[object Set]",Ae="[object String]",me="[object Symbol]",de="[object ArrayBuffer]",$e="[object DataView]",Se="[object Float32Array]",Oe="[object Float64Array]",we="[object Int8Array]",Ie="[object Int16Array]",he="[object Int32Array]",Fe="[object Uint8Array]",Ce="[object Uint8ClampedArray]",Ee="[object Uint16Array]",Be="[object Uint32Array]";function xe(e,r,n){var s=e.constructor;switch(r){case de:return E(e);case ue:case ye:return new s(+e);case $e:return ie(e,n);case Se:case Oe:case we:case Ie:case he:case Fe:case Ce:case Ee:case Be:return K(e,n);case Te:return new s;case le:case Ae:return new s(e);case je:return fe(e);case pe:return new s;case me:return ge(e)}}var Le="[object Map]";function Me(e){return x(e)&&j(e)==Le}var I=u&&u.isMap,Ue=I?B(I):Me,Pe="[object Set]";function De(e){return x(e)&&j(e)==Pe}var h=u&&u.isSet,Ge=h?B(h):De,_e=1,ve=2,Ne=4,M="[object Arguments]",Ke="[object Array]",Re="[object Boolean]",qe="[object Date]",We="[object Error]",U="[object Function]",Ye="[object GeneratorFunction]",He="[object Map]",Je="[object Number]",P="[object Object]",Qe="[object RegExp]",Ve="[object Set]",Xe="[object String]",Ze="[object Symbol]",ze="[object WeakMap]",ke="[object ArrayBuffer]",er="[object DataView]",rr="[object Float32Array]",tr="[object Float64Array]",nr="[object Int8Array]",ar="[object Int16Array]",or="[object Int32Array]",sr="[object Uint8Array]",cr="[object Uint8ClampedArray]",ir="[object Uint16Array]",br="[object Uint32Array]",t={};t[M]=t[Ke]=t[ke]=t[er]=t[Re]=t[qe]=t[rr]=t[tr]=t[nr]=t[ar]=t[or]=t[He]=t[Je]=t[P]=t[Qe]=t[Ve]=t[Xe]=t[Ze]=t[sr]=t[cr]=t[ir]=t[br]=!0;t[We]=t[U]=t[ze]=!1;function T(e,r,n,s,p,c){var a,f=r&_e,g=r&ve,D=r&Ne;if(a!==void 0)return a;if(!Q(e))return e;var A=V(e);if(A){if(a=ce(e),!f)return R(e,a)}else{var b=j(e),m=b==U||b==Ye;if(q(e))return W(e,f);if(b==P||b==M||m&&!p){if(a=g||m?{}:Y(e),!f)return g?ne(e,ee(a,e)):re(e,k(a,e))}else{if(!t[b])return p?e:{};a=xe(e,b,f)}}c||(c=new H);var d=c.get(e);if(d)return d;c.set(e,a),Ge(e)?e.forEach(function(o){a.add(T(o,r,n,o,e,c))}):Ue(e)&&e.forEach(function(o,i){a.set(i,T(o,r,n,i,e,c))});var G=D?g?ae:J:g?l:F,$=A?void 0:G(e);return z($||e,function(o,i){$&&(i=o,o=e[i]),X(a,i,T(o,r,n,i,e,c))}),a}export{T as b};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More