koishi-plugin-chat-patch 3.0.2 → 5.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/client/vue/index.vue +60 -634
  2. package/client/web/dist/assets/AppIcon-DIku6-h0.png +0 -0
  3. package/client/web/dist/assets/AppIconDark-BYymN71t.png +0 -0
  4. package/client/web/dist/assets/CapacitorAppIcon-CSZwNhvi.png +0 -0
  5. package/client/web/dist/assets/CapacitorAppIconDark-BMvMOzsg.png +0 -0
  6. package/client/web/dist/assets/Chat-CTdyeaX2.css +1 -0
  7. package/client/web/dist/assets/Chat-DkZvD7d8.js +28 -0
  8. package/client/web/dist/assets/MealHungryPan-Beos3lRI.js +1 -0
  9. package/client/web/dist/assets/MsgBody-aZ4_aija.js +1 -0
  10. package/client/web/dist/assets/MsgBody.vue_vue_type_script_setup_true_lang-CPZjRLp6.js +67 -0
  11. package/client/web/dist/assets/NapcatAppIcon-C7VOAkW9.png +0 -0
  12. package/client/web/dist/assets/Vue-lEhHouxB.png +0 -0
  13. package/client/web/dist/assets/append_darwin-CqBNU62J.css +1 -0
  14. package/client/web/dist/assets/append_full_vibrancy-j0D2LM9m.css +1 -0
  15. package/client/web/dist/assets/append_linux-uhxeBqeC.css +1 -0
  16. package/client/web/dist/assets/append_linux_vibrancy-COiZq8MS.css +1 -0
  17. package/client/web/dist/assets/append_napcat-DV8CAyAd.css +1 -0
  18. package/client/web/dist/assets/append_new-407Lo5_V.css +1 -0
  19. package/client/web/dist/assets/append_vibrancy-6FHctkOY.css +1 -0
  20. package/client/web/dist/assets/append_win32-srmD-78y.css +1 -0
  21. package/client/web/dist/assets/cakes-CxTVKdnK.svg +189 -0
  22. package/client/web/dist/assets/core-DhEqZVGG.js +1 -0
  23. package/client/web/dist/assets/event-Cadp6m6J.js +1 -0
  24. package/client/web/dist/assets/index-CPTXiemn.js +4045 -0
  25. package/client/web/dist/assets/index-Cg_esKB0.js +1 -0
  26. package/client/web/dist/assets/index-Cln012sP.css +1 -0
  27. package/client/web/dist/assets//346/226/271/346/255/243/345/226/265/345/221/234/344/275/223-CJKIKBn3.ttf +0 -0
  28. package/client/web/dist/assets//346/234/237/345/276/205-C90_OY60.png +0 -0
  29. package/client/web/dist/bcui/css/color-dark.css +35 -0
  30. package/client/web/dist/bcui/css/color-light.css +35 -0
  31. package/client/web/dist/bcui/css/style.css +468 -0
  32. package/client/web/dist/bcui/js/main.js +193 -0
  33. package/client/web/dist/css/append-dark.css +13 -0
  34. package/client/web/dist/css/append-light.css +13 -0
  35. package/client/web/dist/css/append-napcat-dark.css +14 -0
  36. package/client/web/dist/css/append-napcat-light.css +14 -0
  37. package/client/web/dist/favicon.ico +0 -0
  38. package/client/web/dist/img/icons/icon-for-fuck-apple.png +0 -0
  39. package/client/web/dist/img/icons/icon-maskable.png +0 -0
  40. package/client/web/dist/img/icons/icon.png +0 -0
  41. package/client/web/dist/img/icons/icon.svg +10 -0
  42. package/client/web/dist/index.html +22 -0
  43. package/client/web/dist/robots.txt +2 -0
  44. package/client/web/dist/sw.js +58 -0
  45. package/client/web/env.d.ts +56 -0
  46. package/client/web/index.html +21 -0
  47. package/client/web/package-lock.json +3419 -0
  48. package/client/web/package.json +62 -0
  49. package/client/web/public/bcui/css/color-dark.css +35 -0
  50. package/client/web/public/bcui/css/color-light.css +35 -0
  51. package/client/web/public/bcui/css/style.css +468 -0
  52. package/client/web/public/bcui/js/main.js +193 -0
  53. package/client/web/public/css/append-dark.css +13 -0
  54. package/client/web/public/css/append-light.css +13 -0
  55. package/client/web/public/css/append-napcat-dark.css +14 -0
  56. package/client/web/public/css/append-napcat-light.css +14 -0
  57. package/client/web/public/favicon.ico +0 -0
  58. package/client/web/public/img/icons/icon-for-fuck-apple.png +0 -0
  59. package/client/web/public/img/icons/icon-maskable.png +0 -0
  60. package/client/web/public/img/icons/icon.png +0 -0
  61. package/client/web/public/img/icons/icon.svg +10 -0
  62. package/client/web/public/robots.txt +2 -0
  63. package/client/web/public/sw.js +58 -0
  64. package/client/web/scripts/copy-bcui.mjs +17 -0
  65. package/client/web/src/App.vue +1127 -0
  66. package/client/web/src/assets/css/append/append_darwin.css +68 -0
  67. package/client/web/src/assets/css/append/append_full_vibrancy.css +290 -0
  68. package/client/web/src/assets/css/append/append_linux.css +125 -0
  69. package/client/web/src/assets/css/append/append_linux_vibrancy.css +22 -0
  70. package/client/web/src/assets/css/append/append_napcat.css +35 -0
  71. package/client/web/src/assets/css/append/append_new.css +843 -0
  72. package/client/web/src/assets/css/append/append_vibrancy.css +113 -0
  73. package/client/web/src/assets/css/append/append_win32.css +109 -0
  74. package/client/web/src/assets/css/append/mobile/append_mobile_horizontal.css +349 -0
  75. package/client/web/src/assets/css/append/mobile/append_mobile_vertical.css +96 -0
  76. package/client/web/src/assets/css/chat.css +2104 -0
  77. package/client/web/src/assets/css/msg.css +941 -0
  78. package/client/web/src/assets/css/options.css +811 -0
  79. package/client/web/src/assets/css/sys_notice.css +62 -0
  80. package/client/web/src/assets/css/view.css +2105 -0
  81. package/client/web/src/assets/font//346/226/271/346/255/243/345/226/265/345/221/234/344/275/223.ttf +0 -0
  82. package/client/web/src/assets/img/Vue.png +0 -0
  83. package/client/web/src/assets/img/cakes.svg +189 -0
  84. package/client/web/src/assets/img/icons/AppIcon.png +0 -0
  85. package/client/web/src/assets/img/icons/AppIconDark.png +0 -0
  86. package/client/web/src/assets/img/icons/CapacitorAppIcon.png +0 -0
  87. package/client/web/src/assets/img/icons/CapacitorAppIconDark.png +0 -0
  88. package/client/web/src/assets/img/icons/NapcatAppIcon.png +0 -0
  89. package/client/web/src/assets/img/icons/NapcatAppIconDark.png +0 -0
  90. package/client/web/src/assets/img/icons/exit.png +0 -0
  91. package/client/web/src/assets/img/icons/pen.png +0 -0
  92. package/client/web/src/assets/img/stars.svg +89 -0
  93. package/client/web/src/assets/img//346/234/237/345/276/205.png +0 -0
  94. package/client/web/src/assets/l10n/_About I10n.md +35 -0
  95. package/client/web/src/assets/l10n/_l10nconfig.json +7 -0
  96. package/client/web/src/assets/l10n/zh-CN.po +1941 -0
  97. package/client/web/src/assets/logo.png +0 -0
  98. package/client/web/src/assets/pathMap/LLOneBot.yaml +2 -0
  99. package/client/web/src/assets/pathMap/Lagrange.OneBot.yaml +180 -0
  100. package/client/web/src/assets/pathMap/NapCat.Onebot.yaml +224 -0
  101. package/client/web/src/assets/pathMap/SnowLuma.yaml +80 -0
  102. package/client/web/src/assets/qed.txt +1 -0
  103. package/client/web/src/components/AboutPan.vue +197 -0
  104. package/client/web/src/components/BulletinBody.vue +129 -0
  105. package/client/web/src/components/DepPan.vue +310 -0
  106. package/client/web/src/components/EmojiFace.vue +32 -0
  107. package/client/web/src/components/FacePan.vue +461 -0
  108. package/client/web/src/components/FileBody.vue +129 -0
  109. package/client/web/src/components/FileManager.vue +532 -0
  110. package/client/web/src/components/FriendBody.vue +54 -0
  111. package/client/web/src/components/GlobalSessionSearchBar.vue +301 -0
  112. package/client/web/src/components/History.vue +49 -0
  113. package/client/web/src/components/LazyLottie.vue +82 -0
  114. package/client/web/src/components/MergePan.vue +127 -0
  115. package/client/web/src/components/MsgBody.vue +1478 -0
  116. package/client/web/src/components/MusicPlayer.vue +549 -0
  117. package/client/web/src/components/NoticeBody.vue +168 -0
  118. package/client/web/src/components/QzonePermissionPan.vue +150 -0
  119. package/client/web/src/components/RawMsgRenderPreviewPan.vue +190 -0
  120. package/client/web/src/components/ThemeColorPickerPan.vue +420 -0
  121. package/client/web/src/components/TinySessionBody.vue +51 -0
  122. package/client/web/src/components/UmamiInfoPan.vue +1549 -0
  123. package/client/web/src/components/UpdatePan.vue +263 -0
  124. package/client/web/src/components/ViewerCom.vue +1360 -0
  125. package/client/web/src/components/VoiceMsg.vue +626 -0
  126. package/client/web/src/components/WelPan.vue +894 -0
  127. package/client/web/src/components/msg-body/.gitkeep +0 -0
  128. package/client/web/src/components/msg-component/JsonSegComp.vue +138 -0
  129. package/client/web/src/components/msg-component/XmlSegComp.vue +132 -0
  130. package/client/web/src/components/msg-component/jsonComp/AutoReply.vue +97 -0
  131. package/client/web/src/components/msg-component/jsonComp/Contact.lua.vue +129 -0
  132. package/client/web/src/components/msg-component/jsonComp/Feed.lua.vue +94 -0
  133. package/client/web/src/components/msg-component/jsonComp/Forum.vue +84 -0
  134. package/client/web/src/components/msg-component/jsonComp/Mannounce.vue +111 -0
  135. package/client/web/src/components/msg-component/jsonComp/Map.vue +52 -0
  136. package/client/web/src/components/msg-component/jsonComp/Miniapp.lua.vue +53 -0
  137. package/client/web/src/components/msg-component/jsonComp/Miniapp.vue +69 -0
  138. package/client/web/src/components/msg-component/jsonComp/Music.lua.vue +135 -0
  139. package/client/web/src/components/msg-component/jsonComp/Tuwen.lua.vue +56 -0
  140. package/client/web/src/components/notice-component/.gitkeep +0 -0
  141. package/client/web/src/components/notice-component/MealHungryPan.vue +119 -0
  142. package/client/web/src/components/tooltip/CustomFaceTooltip.vue +22 -0
  143. package/client/web/src/components/tooltip/Tooltip.vue +50 -0
  144. package/client/web/src/components/tooltip/Tooltips.vue +14 -0
  145. package/client/web/src/components/tooltip/UserInfoTooltip.vue +69 -0
  146. package/client/web/src/function/base.ts +238 -0
  147. package/client/web/src/function/connect.ts +2042 -0
  148. package/client/web/src/function/debug.ts +10 -0
  149. package/client/web/src/function/elements/information.ts +141 -0
  150. package/client/web/src/function/elements/system.ts +101 -0
  151. package/client/web/src/function/elements/vueComp.ts +62 -0
  152. package/client/web/src/function/favicon.ts +76 -0
  153. package/client/web/src/function/input.ts +69 -0
  154. package/client/web/src/function/model/emoji.ts +127 -0
  155. package/client/web/src/function/model/img.ts +150 -0
  156. package/client/web/src/function/model/msg-body.ts +51 -0
  157. package/client/web/src/function/msg.ts +2674 -0
  158. package/client/web/src/function/notify.ts +225 -0
  159. package/client/web/src/function/option.ts +749 -0
  160. package/client/web/src/function/satori-model.ts +818 -0
  161. package/client/web/src/function/satori.ts +325 -0
  162. package/client/web/src/function/sender.ts +178 -0
  163. package/client/web/src/function/tooltip.ts +49 -0
  164. package/client/web/src/function/utils/appUtil.ts +2288 -0
  165. package/client/web/src/function/utils/avatarUtil.ts +31 -0
  166. package/client/web/src/function/utils/backgroundUtil.ts +110 -0
  167. package/client/web/src/function/utils/linkViewUtil.ts +101 -0
  168. package/client/web/src/function/utils/localHistoryUtil.ts +517 -0
  169. package/client/web/src/function/utils/msgUtil.ts +1242 -0
  170. package/client/web/src/function/utils/pinyin.ts +141 -0
  171. package/client/web/src/function/utils/recordUtil.ts +187 -0
  172. package/client/web/src/function/utils/sessionUtil.ts +114 -0
  173. package/client/web/src/function/utils/systemUtil.ts +664 -0
  174. package/client/web/src/main.ts +91 -0
  175. package/client/web/src/pages/Chat.vue +3453 -0
  176. package/client/web/src/pages/Friends.vue +636 -0
  177. package/client/web/src/pages/Info.vue +717 -0
  178. package/client/web/src/pages/Messages.vue +875 -0
  179. package/client/web/src/pages/Options.vue +82 -0
  180. package/client/web/src/pages/Qzone.vue +1178 -0
  181. package/client/web/src/pages/chat-view/ChatDanmaku.vue +759 -0
  182. package/client/web/src/pages/chat-view/ChatGlagame.vue +642 -0
  183. package/client/web/src/pages/chat-view/ChatTerminal.vue +1044 -0
  184. package/client/web/src/pages/chat-view/SystemNotice.vue +171 -0
  185. package/client/web/src/pages/options/OptAccount.vue +107 -0
  186. package/client/web/src/pages/options/OptAddon.vue +185 -0
  187. package/client/web/src/pages/options/OptDev.vue +704 -0
  188. package/client/web/src/pages/options/OptFunction.vue +403 -0
  189. package/client/web/src/pages/options/OptInfo.vue +165 -0
  190. package/client/web/src/pages/options/OptView.vue +846 -0
  191. package/client/web/src/runtime/backend.ts +310 -0
  192. package/client/web/src/state/auth.ts +14 -0
  193. package/client/web/src/state/chat.ts +36 -0
  194. package/client/web/src/state/connection.ts +20 -0
  195. package/client/web/src/state/contact.ts +37 -0
  196. package/client/web/src/state/qzone.ts +18 -0
  197. package/client/web/src/state/sessionHistory.ts +25 -0
  198. package/client/web/src/state/settings.ts +18 -0
  199. package/client/web/src/state/sticker.ts +10 -0
  200. package/client/web/src/state/ui.ts +56 -0
  201. package/client/web/tsconfig.json +27 -0
  202. package/client/web/tsconfig.tsbuildinfo +1 -0
  203. package/client/web/vite.config.ts +33 -0
  204. package/dist/index.js +1 -12
  205. package/dist/style.css +1 -1
  206. package/lib/index.js +2070 -2077
  207. package/package.json +15 -2
  208. package/readme.md +0 -22
  209. package/src/bootstrap.ts +71 -0
  210. package/src/cache.ts +319 -0
  211. package/src/config.ts +23 -35
  212. package/src/database.ts +650 -0
  213. package/src/index.ts +27 -59
  214. package/src/media.ts +302 -0
  215. package/src/recorder.ts +175 -0
  216. package/src/self-message.ts +456 -0
  217. package/src/server.d.ts +26 -0
  218. package/src/types.ts +108 -48
  219. package/src/web.ts +712 -0
  220. package/client/vue/chat-logic.ts +0 -683
  221. package/client/vue/composables/useChatActions.ts +0 -61
  222. package/client/vue/composables/useChatData.ts +0 -185
  223. package/client/vue/composables/useImageCache.ts +0 -281
  224. package/client/vue/composables/useVideoCache.ts +0 -125
  225. package/client/vue/types.ts +0 -72
  226. package/lib/api-handlers.d.ts +0 -25
  227. package/lib/config.d.ts +0 -14
  228. package/lib/file-manager.d.ts +0 -124
  229. package/lib/index.d.ts +0 -17
  230. package/lib/logger.d.ts +0 -9
  231. package/lib/message-handler.d.ts +0 -35
  232. package/lib/types.d.ts +0 -57
  233. package/lib/utils.d.ts +0 -18
  234. package/src/api-handlers.ts +0 -646
  235. package/src/file-manager.ts +0 -1436
  236. package/src/message-handler.ts +0 -507
  237. package/src/utils.ts +0 -189
@@ -0,0 +1,846 @@
1
+ <!--
2
+ * @FileDescription: 设置页面(界面子页面)
3
+ * @Author: Stapxs
4
+ * @Date: 2022/09/26
5
+ * @Version: 1.0
6
+ -->
7
+
8
+ <template>
9
+ <div class="opt-page">
10
+ <div v-if="backend.isMobile()" class="ss-card">
11
+ <header>{{ $t('图标') }}</header>
12
+ <div class="icon-list">
13
+ <div v-for="item in getIconList()"
14
+ :key="item.name"
15
+ :class="item.name === usedIcon ? 'selected' : ''"
16
+ @click="changeIcon(item.name)">
17
+ <img :src="item.icon">
18
+ <span>{{ $t(item.name != '' ? item.name : '默认') }}</span>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ <div v-if="!napcat" class="ss-card">
23
+ <header>{{ $t('主题与颜色') }}</header>
24
+ <template v-if="settingsStore.sysConfig.opt_auto_gtk != true">
25
+ <div id="opt_view_dark" class="opt-item">
26
+ <div :class="checkDefault('opt_view_dark')" />
27
+ <font-awesome-icon :icon="['fas', 'moon']" />
28
+ <div>
29
+ <label for="opt-view-dark">{{ $t('深色模式') }}</label>
30
+ <span>{{ $t('是五彩斑斓的黑色!') }}</span>
31
+ </div>
32
+ <label class="ss-switch">
33
+ <input id="opt-view-dark" v-model="settingsStore.sysConfig.opt_dark"
34
+ type="checkbox" name="opt_dark" @change="save">
35
+ <div>
36
+ <div />
37
+ </div>
38
+ </label>
39
+ </div>
40
+ <template v-if="settingsStore.sysConfig.opt_auto_win_color != true">
41
+ <div class="opt-item">
42
+ <div :class="checkDefault('theme_color')" />
43
+ <font-awesome-icon :icon="['fas', 'palette']" />
44
+ <div>
45
+ <label for="theme_color_custom" @click.prevent="themeColorChange">{{ $t('主题色') }}</label>
46
+ <span>{{ $t('换个心情 🎵 ~') }}</span>
47
+ </div>
48
+ <div class="theme-color-col">
49
+ <input id="theme_color_custom"
50
+ v-model="themeColorRaw"
51
+ type="text"
52
+ readonly
53
+ @click.prevent="themeColorChange">
54
+ <label class="ss-radio" style="margin-left: 10px;">
55
+ <input type="radio" name="theme_color"
56
+ :checked="Number(settingsStore.sysConfig.theme_color) > 10"
57
+ @click="themeColorChange">
58
+ <div style="background: linear-gradient(135deg, hsl(0 100% 50%) 0%, hsl(30 100% 60%) 16%, hsl(60 100% 60%) 33%, hsl(120 80% 45%) 50%, hsl(220 90% 45%) 66%, hsl(260 60% 40%) 83%, hsl(290 80% 50%) 100%);">
59
+ <div />
60
+ </div>
61
+ </label>
62
+ <label v-for="(name, index) in colors" :key="'color_id_' + index"
63
+ :title="name" class="ss-radio">
64
+ <input type="radio" name="theme_color" :data-id="index"
65
+ :checked="settingsStore.sysConfig.theme_color === undefined ?
66
+ index === 0 : Number(settingsStore.sysConfig.theme_color) === index"
67
+ @change="save($event);gaColor($event)">
68
+ <div
69
+ :style="{ 'background': `var(--color-main-${index})` }">
70
+ <div />
71
+ </div>
72
+ </label>
73
+ </div>
74
+ </div>
75
+ </template>
76
+ </template>
77
+ <template v-if="backend.isDesktop() && browser.os != 'Linux'">
78
+ <div class="opt-item">
79
+ <div :class="checkDefault('opt_auto_win_color')" />
80
+ <font-awesome-icon :icon="['fas', 'wand-magic-sparkles']" />
81
+ <div>
82
+ <label for="opt-view-auto-win-color">{{ $t('自动跟随主题色') }}</label>
83
+ <span>{{ $t('自动获取系统的主题色设置并应用') }}</span>
84
+ </div>
85
+ <label class="ss-switch">
86
+ <input id="opt-view-auto-win-color" v-model="settingsStore.sysConfig.opt_auto_win_color"
87
+ type="checkbox" name="opt_auto_win_color" @change="save">
88
+ <div>
89
+ <div />
90
+ </div>
91
+ </label>
92
+ </div>
93
+ </template>
94
+ <div class="opt-item">
95
+ <div :class="checkDefault('chat_more_blur')" />
96
+ <font-awesome-icon :icon="['fas', 'expand']" />
97
+ <div>
98
+ <label for="opt-view-chat-more-blur">{{ $t('透明模式') }}</label>
99
+ <span>{{ $t('透明超级加倍!在界面上使用更泛滥的透明和模糊') }}</span>
100
+ </div>
101
+ <label class="ss-switch">
102
+ <input id="opt-view-chat-more-blur" v-model="settingsStore.sysConfig.chat_more_blur"
103
+ type="checkbox" name="chat_more_blur" @change="blurTip">
104
+ <div>
105
+ <div />
106
+ </div>
107
+ </label>
108
+ </div>
109
+ <div v-if="settingsStore.sysConfig.chat_more_blur && backend.platform === 'darwin' && Number(backend.release.split(' ')[1].split('.')[0]) >= 26" class="opt-item">
110
+ <div :class="checkDefault('glass_effect')" />
111
+ <font-awesome-icon :icon="['fas', 'wand-sparkles']" />
112
+ <div>
113
+ <label for="opt-view-glass-effect">{{ $t('流体玻璃窗口') }}</label>
114
+ <span>{{ $t('仅支持 macOS 26 及以上系统') }}</span>
115
+ </div>
116
+ <label class="ss-switch">
117
+ <input id="opt-view-glass-effect" v-model="settingsStore.sysConfig.glass_effect"
118
+ type="checkbox" name="glass_effect" @change="glassEffectToggle">
119
+ <div>
120
+ <div />
121
+ </div>
122
+ </label>
123
+ </div>
124
+ <div class="opt-item">
125
+ <div :class="checkDefault('chat_background')" />
126
+ <font-awesome-icon :icon="['fas', 'image']" />
127
+ <div>
128
+ <span>{{ $t('背景图片') }}</span>
129
+ <span>{{ $t('嘿嘿嘿(痴呆') }}</span>
130
+ </div>
131
+ <div class="file-choice">
132
+ <div class="choice-btn"
133
+ @click="setBackground">
134
+ {{
135
+ settingsStore.sysConfig.chat_background
136
+ ? $t('更换背景')
137
+ : $t('选择背景')
138
+ }}
139
+ <input id="opt-view-chat-background"
140
+ ref="choiceImgRef"
141
+ type="file"
142
+ style="display: none"
143
+ name="chat_background"
144
+ accept="image/*"
145
+ @change="setBackgroundFromInput($event)">
146
+ <label for="opt-view-chat-background" class="sr-only">{{ $t('选择背景图片') }}</label>
147
+ </div>
148
+ <div v-if="settingsStore.sysConfig.chat_background !== ''"
149
+ class="rm-btn"
150
+ @click="removeBackground">
151
+ <font-awesome-icon :icon="['fas', 'xmark']" />
152
+ </div>
153
+ </div>
154
+ </div>
155
+ <div class="opt-item">
156
+ <div :class="checkDefault('chat_background_blur')" />
157
+ <font-awesome-icon :icon="['fas', 'o']" />
158
+ <template v-if="!settingsStore.sysConfig.chat_more_blur">
159
+ <div>
160
+ <label for="opt-view-background-blur">{{ $t('背景模糊') }}</label>
161
+ <span>{{ $t('什么都看不见了(恼') }}</span>
162
+ </div>
163
+ <div class="ss-range" :style="{ '--range-precent': `${settingsStore.sysConfig.chat_background_blur}%` }">
164
+ <input id="opt-view-background-blur" v-model="settingsStore.sysConfig.chat_background_blur"
165
+ type="range" name="chat_background_blur" @input="save">
166
+ <div />
167
+ <span :style="{ 'color': `var(--color-font${ settingsStore.sysConfig.chat_background_blur > 50 ? '-r' : ''})` }">
168
+ {{ settingsStore.sysConfig.chat_background_blur }}
169
+ px</span>
170
+ </div>
171
+ </template>
172
+ <template v-else>
173
+ <div>
174
+ <label for="opt-view-background-opacity">{{ $t('背景透明度') }}</label>
175
+ <span>{{ $t('什么都看不见了(恼') }}</span>
176
+ </div>
177
+ <div class="ss-range" :style="{ '--range-precent': `${settingsStore.sysConfig.chat_background_blur}%` }">
178
+ <input id="opt-view-background-opacity" v-model="settingsStore.sysConfig.chat_background_blur"
179
+ type="range" max="100" name="chat_background_blur"
180
+ @input="save">
181
+ <div />
182
+ <span :style="{ 'color': `var(--color-font${ settingsStore.sysConfig.chat_background_blur > 50 ? '-r' : ''})` }">
183
+ {{ settingsStore.sysConfig.chat_background_blur }}
184
+ %</span>
185
+ </div>
186
+ </template>
187
+ </div>
188
+ <div class="opt-item">
189
+ <div :class="checkDefault('chat_background_align')" />
190
+ <font-awesome-icon :icon="['fas', 'crosshairs']" />
191
+ <div>
192
+ <label for="opt-view-background-align">{{ $t('背景对齐') }}</label>
193
+ <span>{{ $t('调整背景图片的对齐位置') }}</span>
194
+ </div>
195
+ <div class="select-wrapper">
196
+ <select id="opt-view-background-align"
197
+ v-model="settingsStore.sysConfig.chat_background_align"
198
+ name="chat_background_align" title="chat_background_align"
199
+ @change="save($event)">
200
+ <option value="center">
201
+ {{ $t('居中') }}
202
+ </option>
203
+ <option value="top">
204
+ {{ $t('顶部') }}
205
+ </option>
206
+ <option value="bottom">
207
+ {{ $t('底部') }}
208
+ </option>
209
+ <option value="left">
210
+ {{ $t('左侧') }}
211
+ </option>
212
+ <option value="right">
213
+ {{ $t('右侧') }}
214
+ </option>
215
+ </select>
216
+ </div>
217
+ </div>
218
+ <div class="opt-item">
219
+ <div :class="checkDefault('chat_background_fit')" />
220
+ <font-awesome-icon :icon="['fas', 'up-right-and-down-left-from-center']" />
221
+ <div>
222
+ <label for="opt-view-background-fit">{{ $t('背景填充') }}</label>
223
+ <span>{{ $t('调整背景图片的填充方式') }}</span>
224
+ </div>
225
+ <div class="select-wrapper">
226
+ <select id="opt-view-background-fit"
227
+ v-model="settingsStore.sysConfig.chat_background_fit"
228
+ name="chat_background_fit" title="chat_background_fit"
229
+ @change="save($event)">
230
+ <option value="cover">
231
+ {{ $t('覆盖') }}
232
+ </option>
233
+ <option value="contain">
234
+ {{ $t('包含') }}
235
+ </option>
236
+ <option value="fill">
237
+ {{ $t('拉伸') }}
238
+ </option>
239
+ <option value="none">
240
+ {{ $t('原始大小') }}
241
+ </option>
242
+ </select>
243
+ </div>
244
+ </div>
245
+ </div>
246
+ <div class="ss-card">
247
+ <header>{{ $t('页面') }}</header>
248
+ <div class="opt-item">
249
+ <div :class="checkDefault('quick_send')" />
250
+ <font-awesome-icon :icon="['fas', 'square-xmark']" />
251
+ <div>
252
+ <label for="opt-view-quick-send">{{ $t('默认功能按钮') }}</label>
253
+ <span>{{ $t('可以右击试试哦') }}</span>
254
+ </div>
255
+ <div class="select-wrapper">
256
+ <select id="opt-view-quick-send" v-model="settingsStore.sysConfig.quick_send" name="quick_send"
257
+ title="quick_send" @change="save">
258
+ <option value="default">
259
+ {{ $t('默认') }}
260
+ </option>
261
+ <option value="img">
262
+ {{ $t('图片') }}
263
+ </option>
264
+ <option value="file">
265
+ {{ $t('文件') }}
266
+ </option>
267
+ <option value="face">
268
+ {{ $t('表情') }}
269
+ </option>
270
+ </select>
271
+ </div>
272
+ </div>
273
+ <div class="opt-item">
274
+ <div :class="checkDefault('opt_ind_message')" />
275
+ <font-awesome-icon :icon="['fas', 'message']" />
276
+ <div>
277
+ <label>{{ $t('默认显示居左还是居右') }}</label>
278
+ <span>{{ $t('机器人消息默认显示在右侧') }}</span>
279
+ </div>
280
+ <div class="select-wrapper">
281
+ <select id="opt-view-ind-message" v-model="settingsStore.sysConfig.opt_ind_message"
282
+ name="opt_ind_message" title="opt_ind_message" @change="save">
283
+ <option value="left">{{ $t('左') }}</option>
284
+ <option value="right">{{ $t('右') }}</option>
285
+ </select>
286
+ </div>
287
+ </div>
288
+ <div v-if="isMobile() && !backend.isMobile()"
289
+ class="opt-item">
290
+ <div :class="checkDefault('initial_scale')" />
291
+ <font-awesome-icon :icon="['fas', 'up-down-left-right']" />
292
+ <div>
293
+ <label for="opt-view-initial-scale">{{ $t('缩放比例') }}</label>
294
+ <span>{{ $t('调整页面在移动端的缩放比例') }}</span>
295
+ </div>
296
+ <div class="ss-range" :style="{ '--range-precent': `${(initialScaleShow - 0.5) / 0.01}%` }">
297
+ <input id="opt-view-initial-scale" v-model="settingsStore.sysConfig.initial_scale"
298
+ type="range"
299
+ min="0.5"
300
+ max="1.5"
301
+ step="0.01"
302
+ name="initial_scale"
303
+ @change="scaleSave"
304
+ @input="setInitialScaleShow">
305
+ <div />
306
+ <span :style="{ 'color': `var(--color-font${initialScaleShow / 0.05 })` }">
307
+ {{ initialScaleShow }}</span>
308
+ </div>
309
+ </div>
310
+ <div
311
+ v-if="isMobile() && !backend.isMobile()"
312
+ class="opt-item">
313
+ <div :class="checkDefault('fs_adaptation')" />
314
+ <font-awesome-icon :icon="['fas', 'border-top-left']" />
315
+ <div>
316
+ <label for="opt-view-fs-adaptation">{{ $t('圆角适配') }}</label>
317
+ <span>{{ $t('适配全面屏设备防止四角出界') }}</span>
318
+ </div>
319
+ <div class="ss-range" :style="{ '--range-precent': `${(fsAdaptationShow / 50) * 100}%` }">
320
+ <input id="opt-view-fs-adaptation" v-model="settingsStore.sysConfig.fs_adaptation"
321
+ type="range"
322
+ min="0"
323
+ max="50"
324
+ step="10"
325
+ name="fs_adaptation"
326
+ @change="save"
327
+ @input="setFsAdaptationShow">
328
+ <div />
329
+ <span :style="{ 'color': `var(--color-font${fsAdaptationShow / 50 > 0.5 ? '-r' : ''})` }">
330
+ {{ fsAdaptationShow }} px
331
+ </span>
332
+ </div>
333
+ </div>
334
+ <div v-if="backend.type == 'web' && !napcat" class="opt-item">
335
+ <div :class="checkDefault('use_favicon_notice')" />
336
+ <font-awesome-icon :icon="['fas', 'bell']" />
337
+ <div>
338
+ <label for="opt-view-favicon-notice">{{ $t('在图标上显示通知') }}</label>
339
+ <span>{{ $t('呜呜呜——图标都被遮挡的看不到了!') }}</span>
340
+ </div>
341
+ <label class="ss-switch">
342
+ <input id="opt-view-favicon-notice" v-model="settingsStore.sysConfig.use_favicon_notice"
343
+ type="checkbox" name="use_favicon_notice" @change="save">
344
+ <div>
345
+ <div />
346
+ </div>
347
+ </label>
348
+ </div>
349
+ <div class="opt-item">
350
+ <font-awesome-icon :icon="['fas', 'arrows-rotate']" />
351
+ <div>
352
+ <label for="opt-view-revolve">{{ $t('不要点这个') }}</label>
353
+ <span>{{ $t('啊吧啊吧(智慧)') }}</span>
354
+ </div>
355
+ <label class="ss-switch">
356
+ <input id="opt-view-revolve" v-model="settingsStore.sysConfig.opt_revolve"
357
+ type="checkbox" name="opt_revolve" @change="save">
358
+ <div>
359
+ <div />
360
+ </div>
361
+ </label>
362
+ </div>
363
+ </div>
364
+ </div>
365
+ </template>
366
+
367
+ <script setup lang="ts">
368
+ import { markRaw, onMounted, ref, toRaw, useTemplateRef, watch } from 'vue'
369
+ import Option, { run, runASWEvent as save, checkDefault, runAS } from '../../function/option'
370
+ import { BrowserInfo, detect } from 'detect-browser'
371
+ import { getDeviceType } from '../../function/utils/systemUtil'
372
+
373
+ import { sendIdentifyData } from '../../function/utils/appUtil'
374
+ import { backend } from '../../runtime/backend'
375
+ import {
376
+ rememberLocalImageUrl,
377
+ resolveLocalImageUrl,
378
+ saveBrowserBackgroundImage,
379
+ type LocalImageInfo,
380
+ } from '../../function/utils/backgroundUtil'
381
+ import { i18n } from '../../main'
382
+ import { useSettingsStore } from '../../state/settings'
383
+ import { useUIStore } from '../../state/ui'
384
+ import ThemeColorPickerPan from '../../components/ThemeColorPickerPan.vue'
385
+
386
+ const settingsStore = useSettingsStore()
387
+ const uiStore = useUIStore()
388
+
389
+ defineOptions({ name: 'ViewOptTheme' })
390
+
391
+ const $t = i18n.global.t
392
+
393
+ const napcat = import.meta.env.VITE_NAPCAT
394
+ const colors = [
395
+ '林槐蓝',
396
+ '墨竹青',
397
+ '少女粉',
398
+ '微软紫',
399
+ '坏猫黄',
400
+ '玄素黑',
401
+ ]
402
+ const browser = detect() as BrowserInfo
403
+
404
+ const initialScaleShow = ref(0.5)
405
+ const fsAdaptationShow = ref(0)
406
+ const usedIcon = ref('')
407
+ const themeColorRaw = ref('')
408
+ const themeColorDraft = ref('')
409
+ const themeColorHistory = ref<string[]>([])
410
+
411
+ const THEME_COLOR_HISTORY_KEY = 'theme_color_history'
412
+ const THEME_COLOR_HISTORY_LIMIT = 12
413
+
414
+ const choiceImgRef = useTemplateRef<HTMLInputElement>('choiceImgRef')
415
+
416
+ onMounted(() => {
417
+ themeColorRaw.value = getThemeColorRawValue()
418
+ themeColorHistory.value = loadThemeColorHistory()
419
+ // 一次性初始化一次缩放级别
420
+ const unwatch = watch(
421
+ () => settingsStore.sysConfig,
422
+ () => {
423
+ initialScaleShow.value = toRaw(
424
+ settingsStore.sysConfig.initial_scale,
425
+ )
426
+ fsAdaptationShow.value = toRaw(
427
+ settingsStore.sysConfig.fs_adaptation,
428
+ )
429
+ unwatch()
430
+ },
431
+ )
432
+ // 获取当前使用的图标
433
+ const Onebot = (window.Capacitor as any)?.Plugins?.Onebot
434
+ if (Onebot) {
435
+ Onebot.addListener('onebot:icon', (data: any) => {
436
+ usedIcon.value = data.name.replace('AppIcon', '')
437
+ })
438
+ Onebot.getUsedIcon()
439
+ }
440
+
441
+ watch(
442
+ () => settingsStore.sysConfig.theme_color,
443
+ () => {
444
+ themeColorRaw.value = getThemeColorRawValue()
445
+ },
446
+ )
447
+ })
448
+
449
+ function gaColor(event: Event) {
450
+ const sender = event.target as HTMLInputElement
451
+ sendIdentifyData({ use_theme_color: colors[Number(sender.dataset.id)] })
452
+ }
453
+
454
+ function themeColorChange(event: Event) {
455
+ event.preventDefault()
456
+ const originThemeColorValue = Number(settingsStore.sysConfig.theme_color ?? 0)
457
+ themeColorDraft.value = getThemeColorRawValue()
458
+ uiStore.popBoxList.push({
459
+ title: $t('主题色'),
460
+ allowQuickClose: true,
461
+ onClose: () => {
462
+ restoreThemeColor(originThemeColorValue)
463
+ },
464
+ template: markRaw(ThemeColorPickerPan),
465
+ templateValue: {
466
+ modelValue: themeColorDraft.value,
467
+ onChange: (value: string) => {
468
+ themeColorDraft.value = normalizeHexColor(value)
469
+ run('theme_color', parseInt(themeColorDraft.value.slice(1), 16))
470
+ },
471
+ historyColors: themeColorHistory.value,
472
+ },
473
+ button: [
474
+ {
475
+ text: $t('取消'),
476
+ fun: () => {
477
+ restoreThemeColor(originThemeColorValue)
478
+ uiStore.popBoxList[0].onClose = undefined
479
+ uiStore.popBoxList.shift()
480
+ },
481
+ },
482
+ {
483
+ text: $t('确认'),
484
+ master: true,
485
+ fun: () => {
486
+ const saveColor = normalizeHexColor(themeColorDraft.value)
487
+ themeColorRaw.value = saveColor
488
+ themeColorHistory.value = saveThemeColorHistory(saveColor)
489
+ uiStore.popBoxList[0].onClose = undefined
490
+ runAS('theme_color', parseInt(saveColor.slice(1), 16))
491
+ uiStore.popBoxList.shift()
492
+ },
493
+ },
494
+ ],
495
+ })
496
+ }
497
+
498
+ function getThemeColorRawValue() {
499
+ const currentValue = Number(settingsStore.sysConfig.theme_color ?? 0)
500
+ if (currentValue > 10) {
501
+ return '#' + ('000000' + currentValue.toString(16)).slice(-6).toUpperCase()
502
+ }
503
+ const cssColor = getComputedStyle(document.documentElement)
504
+ .getPropertyValue('--color-main')
505
+ return cssColorToHex(cssColor)
506
+ }
507
+
508
+ function restoreThemeColor(themeColorValue: number) {
509
+ run('theme_color', themeColorValue)
510
+ themeColorRaw.value = getThemeColorRawValue()
511
+ }
512
+
513
+ function loadThemeColorHistory() {
514
+ const cookieValue = getCookie(THEME_COLOR_HISTORY_KEY)
515
+ let storageValue = null as string | null
516
+ try {
517
+ storageValue = globalThis.localStorage?.getItem(THEME_COLOR_HISTORY_KEY) ?? null
518
+ } catch {
519
+ // ignore
520
+ }
521
+ const source = cookieValue ?? storageValue
522
+ if (!source) {
523
+ return []
524
+ }
525
+ try {
526
+ const parsed = JSON.parse(source)
527
+ if (!Array.isArray(parsed)) {
528
+ return []
529
+ }
530
+ return parsed
531
+ .map((item) => normalizeHexColor(String(item)))
532
+ .filter((item, index, list) => list.indexOf(item) === index)
533
+ .slice(0, THEME_COLOR_HISTORY_LIMIT)
534
+ } catch {
535
+ return []
536
+ }
537
+ }
538
+
539
+ function saveThemeColorHistory(color: string) {
540
+ const normalized = normalizeHexColor(color)
541
+ const nextHistory = [
542
+ normalized,
543
+ ...themeColorHistory.value.filter((item) => item !== normalized),
544
+ ].slice(0, THEME_COLOR_HISTORY_LIMIT)
545
+ const serialized = JSON.stringify(nextHistory)
546
+ setCookie(THEME_COLOR_HISTORY_KEY, serialized, 3650)
547
+ try {
548
+ globalThis.localStorage?.setItem(THEME_COLOR_HISTORY_KEY, serialized)
549
+ } catch {
550
+ // ignore
551
+ }
552
+ return nextHistory
553
+ }
554
+
555
+ function getCookie(name: string) {
556
+ if (typeof document === 'undefined') {
557
+ return null
558
+ }
559
+ const prefix = `${name}=`
560
+ const cookie = document.cookie
561
+ .split('; ')
562
+ .find((item) => item.startsWith(prefix))
563
+ return cookie ? decodeURIComponent(cookie.slice(prefix.length)) : null
564
+ }
565
+
566
+ function setCookie(name: string, value: string, days: number) {
567
+ if (typeof document === 'undefined') {
568
+ return
569
+ }
570
+ const expires = new Date()
571
+ expires.setDate(expires.getDate() + days)
572
+ document.cookie = `${name}=${encodeURIComponent(value)}; expires=${expires.toUTCString()}; path=/; SameSite=Lax`
573
+ }
574
+
575
+ function cssColorToHex(color: string) {
576
+ const value = color.trim()
577
+ if (value.startsWith('#')) {
578
+ return normalizeHexColor(value)
579
+ }
580
+ const match = value.match(/^rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i)
581
+ if (!match) {
582
+ return '#FFFFFF'
583
+ }
584
+ return '#' + match.slice(1, 4).map((item) => {
585
+ return Number(item).toString(16).padStart(2, '0')
586
+ }).join('').toUpperCase()
587
+ }
588
+
589
+ function normalizeHexColor(color: string | undefined) {
590
+ const value = (color ?? '').trim()
591
+ const match = value.match(/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/)
592
+ if (!match) {
593
+ return '#FFFFFF'
594
+ }
595
+ const hex = match[1]
596
+ if (hex.length === 3) {
597
+ return '#' + hex.split('').map((item) => item + item).join('').toUpperCase()
598
+ }
599
+ return '#' + hex.toUpperCase()
600
+ }
601
+
602
+ function blurTip(event: Event) {
603
+ const sender = event.target as HTMLInputElement
604
+ if (sender.checked) {
605
+ const popInfo = {
606
+ title: $t('提醒'),
607
+ html: `<span>${$t('开启透明模式将会对性能产生较为明显的影响,建议不要在性能较差的设备上使用此功能;此功能与"背景图片"的部分功能冲突同时会降低元素可读性。')}<br><br>
608
+ ${$t('开启后需要重启应用才能生效,确定要开启吗?')}</span>`,
609
+ button: [
610
+ {
611
+ text: $t('确认'),
612
+ fun: () => {
613
+ uiStore.popBoxList.shift()
614
+ save(event)
615
+ sendIdentifyData({ use_transparent: true })
616
+ setTimeout(() => {
617
+ restartapp()
618
+ }, 500)
619
+ },
620
+ },
621
+ {
622
+ text: $t('取消'),
623
+ master: true,
624
+ fun: () => {
625
+ uiStore.popBoxList.shift()
626
+ sender.checked = false
627
+ },
628
+ },
629
+ ],
630
+ }
631
+ uiStore.popBoxList.push(popInfo)
632
+ } else {
633
+ const popInfo = {
634
+ title: $t('提醒'),
635
+ html: `<span>${$t('关闭透明模式需要重启应用才能生效。')}<br><br>
636
+ ${$t('确定要重启吗?')}</span>`,
637
+ button: [
638
+ {
639
+ text: $t('确认'),
640
+ fun: () => {
641
+ uiStore.popBoxList.shift()
642
+ save(event)
643
+ sendIdentifyData({ use_transparent: false })
644
+ setTimeout(() => {
645
+ restartapp()
646
+ }, 500)
647
+ },
648
+ },
649
+ {
650
+ text: $t('取消'),
651
+ master: true,
652
+ fun: () => {
653
+ uiStore.popBoxList.shift()
654
+ sender.checked = true
655
+ },
656
+ },
657
+ ],
658
+ }
659
+ uiStore.popBoxList.push(popInfo)
660
+ }
661
+ }
662
+
663
+ function scaleSave(event: Event) {
664
+ save(event)
665
+ // 5 秒后自动取消防止误操作导致无法恢复
666
+ const timerId = setTimeout(() => {
667
+ (event.target as HTMLInputElement).value = '0.85'
668
+ settingsStore.sysConfig.initial_scale = 0.85
669
+ initialScaleShow.value = 0.85
670
+ save(event)
671
+ uiStore.popBoxList.pop()
672
+ const popInfo = {
673
+ svg: 'up-down-left-right',
674
+ html: '<span>' + $t('缩放比例调整已取消,已恢复默认缩放比例。') + '</span>',
675
+ title: $t('确认缩放比例'),
676
+ button: [
677
+ {
678
+ text: $t('取消'),
679
+ master: true,
680
+ fun: () => {
681
+ uiStore.popBoxList.pop()
682
+ },
683
+ }
684
+ ],
685
+ }
686
+ uiStore.popBoxList.push(popInfo)
687
+ }, 5000)
688
+ // 保存提醒
689
+ const popInfo = {
690
+ svg: 'up-down-left-right',
691
+ html: '<span>' + $t('点击确认以应用缩放比例,预览将在 5 秒后取消……') + '</span>',
692
+ title: $t('确认缩放比例'),
693
+ button: [
694
+ {
695
+ text: $t('确定'),
696
+ fun: () => {
697
+ uiStore.popBoxList.pop()
698
+ clearTimeout(timerId)
699
+ },
700
+ }
701
+ ],
702
+ }
703
+ uiStore.popBoxList.push(popInfo)
704
+ }
705
+
706
+ function setInitialScaleShow(event: Event) {
707
+ const sender = event.target as HTMLInputElement
708
+ initialScaleShow.value = Number(sender.value)
709
+ }
710
+
711
+ function setFsAdaptationShow(event: Event) {
712
+ const sender = event.target as HTMLInputElement
713
+ fsAdaptationShow.value = Number(sender.value)
714
+ }
715
+
716
+ function restartapp() {
717
+ backend.call(undefined, 'win:relaunch', false)
718
+ }
719
+
720
+ function isMobile() {
721
+ return (
722
+ getDeviceType() === 'Android' || getDeviceType() === 'iOS'
723
+ )
724
+ }
725
+
726
+ function getIconList() {
727
+ const iconList = import.meta.glob('../../assets/img/icons/*.png', { eager: true })
728
+ const iconListInfo = [] as { name: string, icon: any }[]
729
+ Object.keys(iconList).forEach((key: string) => {
730
+ const name = key.split('/').pop()?.split('.')[0]
731
+ const iconName = name?.replace('AppIcon', '')
732
+ if( name && name.indexOf('AppIcon') >= 0 && iconName != undefined) {
733
+ if(!settingsStore.darkMode && !iconName.endsWith('Dark')) {
734
+ iconListInfo.push({ name: iconName, icon: (iconList[key] as any).default })
735
+ } else if(settingsStore.darkMode && iconName.endsWith('Dark')) {
736
+ iconListInfo.push({ name: iconName.replace('Dark', ''), icon: (iconList[key] as any).default })
737
+ }
738
+ }
739
+ })
740
+ return iconListInfo
741
+ }
742
+
743
+ function changeIcon(name: string) {
744
+ backend.call('Onebot', 'changeIcon', false, { name: name != '' ? (name + 'AppIcon') : name })
745
+ usedIcon.value = name
746
+ }
747
+
748
+ /**
749
+ * 设置背景图片
750
+ */
751
+ async function setBackground() {
752
+ if (backend.isDesktop()) {
753
+ const image = await backend.call(undefined, 'sys:selectImage', true) as LocalImageInfo | null
754
+ if (!image) return
755
+ const imageUrl = await resolveLocalImageUrl(image)
756
+ settingsStore.sysConfig.chat_background = imageUrl
757
+ rememberLocalImageUrl(image.path, imageUrl)
758
+ Option.runAS('chat_background', imageUrl)
759
+ return
760
+ }
761
+ choiceImgRef.value?.click()
762
+ }
763
+
764
+ async function setBackgroundFromInput(event: Event) {
765
+ const sender = event.target as HTMLInputElement
766
+ const img = sender.files?.[0]
767
+ if (!img) return
768
+ const backgroundUrl = await saveBrowserBackgroundImage(img)
769
+ const imgSrc = URL.createObjectURL(img)
770
+ rememberLocalImageUrl(backgroundUrl, imgSrc)
771
+ settingsStore.sysConfig.chat_background = backgroundUrl
772
+ Option.runAS('chat_background', backgroundUrl)
773
+ sender.value = ''
774
+ }
775
+
776
+ /**
777
+ * 移除背景图片
778
+ */
779
+ function removeBackground() {
780
+ settingsStore.sysConfig.chat_background = ''
781
+ Option.runAS('chat_background', '')
782
+ }
783
+
784
+ /**
785
+ * 切换 Glass Effect
786
+ */
787
+ function glassEffectToggle(event: Event) {
788
+ const sender = event.target as HTMLInputElement
789
+
790
+ if (sender.checked) {
791
+ const popInfo = {
792
+ title: $t('提醒'),
793
+ html: `<span>${$t('开启原生玻璃效果需要重启应用才能生效。')}<br><br>
794
+ ${$t('确定要重启吗?')}</span>`,
795
+ button: [
796
+ {
797
+ text: $t('确认'),
798
+ fun: () => {
799
+ uiStore.popBoxList.shift()
800
+ save(event)
801
+ setTimeout(() => {
802
+ restartapp()
803
+ }, 500)
804
+ },
805
+ },
806
+ {
807
+ text: $t('取消'),
808
+ master: true,
809
+ fun: () => {
810
+ uiStore.popBoxList.shift()
811
+ sender.checked = false
812
+ },
813
+ },
814
+ ],
815
+ }
816
+ uiStore.popBoxList.push(popInfo)
817
+ } else {
818
+ const popInfo = {
819
+ title: $t('提醒'),
820
+ html: `<span>${$t('关闭流体玻璃效果需要重启应用才能生效')}<br><br>
821
+ ${$t('确定要重启吗?')}</span>`,
822
+ button: [
823
+ {
824
+ text: $t('确认'),
825
+ fun: () => {
826
+ uiStore.popBoxList.shift()
827
+ save(event)
828
+ setTimeout(() => {
829
+ restartapp()
830
+ }, 500)
831
+ },
832
+ },
833
+ {
834
+ text: $t('取消'),
835
+ master: true,
836
+ fun: () => {
837
+ uiStore.popBoxList.shift()
838
+ sender.checked = true
839
+ },
840
+ },
841
+ ],
842
+ }
843
+ uiStore.popBoxList.push(popInfo)
844
+ }
845
+ }
846
+ </script>