260260 </div >
261261 <n-switch v-model:value =" settingStore.enableTTMLLyric" class =" set" :round =" false" />
262262 </n-card >
263+ <n-collapse-transition :show =" settingStore.enableTTMLLyric" >
264+ <n-card class =" set-item" >
265+ <div class =" label" >
266+ <n-text class =" name" >AMLL TTML DB 地址</n-text >
267+ <n-text class =" tip" :depth =" 3" >
268+ AMLL TTML DB 地址,请确保地址正确,否则将导致歌词获取失败
269+ </n-text >
270+ </div >
271+ <n-button type =" primary" strong secondary @click =" changeAMLLDBServer" > 配置 </n-button >
272+ </n-card >
273+ </n-collapse-transition >
263274 <n-card class =" set-item" >
264275 <div class =" label" >
265276 <n-text class =" name" >启用歌词排除</n-text >
550561</template >
551562
552563<script setup lang="ts">
564+ import { NFlex , NInput , NText } from " naive-ui" ;
553565import { useSettingStore , useStatusStore } from " @/stores" ;
554566import { cloneDeep , isEqual } from " lodash-es" ;
567+ import { isValidURL } from " @/utils/validate" ;
555568import { isElectron } from " @/utils/env" ;
556569import { openLyricExclude } from " @/utils/modal" ;
557570import { LyricConfig } from " @/types/desktop-lyric" ;
@@ -566,6 +579,9 @@ const settingStore = useSettingStore();
566579// 全部字体
567580const allFontsData = ref <SelectOption []>([]);
568581
582+ // AMLL TTML DB 地址
583+ const amllDbServer = ref (" https://amll-ttml-db.stevexmh.net" );
584+
569585// 桌面歌词配置
570586const desktopLyricConfig = reactive <LyricConfig >({ ... defaultDesktopLyricConfig });
571587
@@ -649,10 +665,58 @@ const getAllSystemFonts = async () => {
649665 });
650666};
651667
652- onMounted (() => {
668+ // 修改 AMLL DB 服务地址
669+ const changeAMLLDBServer = () => {
670+ window .$modal .create ({
671+ preset: " dialog" ,
672+ title: " 修改 AMLL DB 地址" ,
673+ content : () =>
674+ h (
675+ NFlex ,
676+ { vertical: true },
677+ {
678+ default : () => [
679+ h (
680+ NText ,
681+ { depth: 3 , type: " warning" },
682+ { default : () => " 如果你不清楚这里是做什么的,请不要修改" },
683+ ),
684+ h (NInput , {
685+ value: amllDbServer .value ,
686+ onUpdateValue : (val ) => (amllDbServer .value = val ),
687+ placeholder: " 请输入 AMLL TTML DB 地址" ,
688+ }),
689+ h (NText , { depth: 3 }, { default : () => " 请确保地址正确,否则将导致歌词获取失败" }),
690+ ],
691+ },
692+ ),
693+ positiveText: " 确认" ,
694+ negativeText: " 取消" ,
695+ onPositiveClick : async () => {
696+ const urlValue = amllDbServer .value .trim ();
697+ if (isValidURL (urlValue )) {
698+ await window .api .store .set (" amllDbServer" , urlValue );
699+ settingStore .amllDbServer = urlValue ;
700+ window .$message .success (" AMLL TTML DB 地址已更新" );
701+ return true ;
702+ } else {
703+ window .$message .error (" 请输入正确的网址格式" );
704+ return false ;
705+ }
706+ },
707+ });
708+ };
709+
710+ onMounted (async () => {
653711 if (isElectron ) {
654712 getDesktopLyricConfig ();
655713 getAllSystemFonts ();
714+ // 恢复地址
715+ const server = await window .api .store .get (" amllDbServer" );
716+ if (server ) {
717+ amllDbServer .value = server ;
718+ settingStore .amllDbServer = server ;
719+ }
656720 }
657721});
658722 </script >
0 commit comments