diff --git a/web/src/components/CustomAvatarRow.vue b/web/src/components/CustomAvatarRow.vue new file mode 100644 index 0000000..e507220 --- /dev/null +++ b/web/src/components/CustomAvatarRow.vue @@ -0,0 +1,53 @@ + + + diff --git a/web/src/views/Settings.vue b/web/src/views/Settings.vue index ba2a310..5df7d1b 100755 --- a/web/src/views/Settings.vue +++ b/web/src/views/Settings.vue @@ -116,6 +116,10 @@ +
+ + +
@@ -439,6 +443,13 @@ @change="updateProfile(bot.id, t.key, ($event.target as HTMLInputElement).checked)" /> +
+
+
自定义头像
+
无论封面同步是否开启,停播时都会回到这张图
+
+ +
@@ -450,6 +461,8 @@ import { ref, reactive, onMounted, onUnmounted } from 'vue'; import { Icon } from '@iconify/vue'; import axios from 'axios'; +import AvatarUpload from '../components/AvatarUpload.vue'; +import CustomAvatarRow from '../components/CustomAvatarRow.vue'; import QRCode from 'qrcode'; import { usePlayerStore } from '../stores/player.js'; @@ -475,6 +488,7 @@ const newBotPort = ref(9987); const newBotNickname = ref('MusicBot'); const newBotChannel = ref(''); const newBotServerPassword = ref(''); +const newBotAvatar = ref(null); // Edit bot const editingBot = ref(null); @@ -635,7 +649,7 @@ async function pollQrStatus(platform: string) { async function createBot() { if (!newBotName.value || !newBotServer.value) return; try { - await axios.post('/api/bot', { + const res = await axios.post('/api/bot', { name: newBotName.value, serverAddress: newBotServer.value, serverPort: newBotPort.value || 9987, @@ -644,12 +658,20 @@ async function createBot() { serverPassword: newBotServerPassword.value || undefined, autoStart: false, }); + if (newBotAvatar.value && res.data?.id) { + try { + await axios.put(`/api/bot/${res.data.id}/avatar`, { dataUrl: newBotAvatar.value }); + } catch (err) { + console.warn('failed to set avatar on new bot', err); + } + } newBotName.value = ''; newBotServer.value = ''; newBotPort.value = 9987; newBotNickname.value = 'MusicBot'; newBotChannel.value = ''; newBotServerPassword.value = ''; + newBotAvatar.value = null; await store.fetchBots(); } catch { // Ignore @@ -1408,6 +1430,11 @@ onUnmounted(() => { } } +.profile-toggle-static { + cursor: default; + align-items: flex-start; +} + @media (max-width: 768px) { .profile-bot-header { padding: 14px 12px;