mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-01 20:42:50 +08:00
feat(web/store): route guest play to non-destructive play-now-song
This commit is contained in:
1 parent
9d8c95b2f9
commit
15fcb11f4f
1 file changed
+5
-1
@@ -1,6 +1,7 @@
|
||||
import { defineStore } from 'pinia';
|
||||
import axios from 'axios';
|
||||
import { resolveScopedBot } from './scope.js';
|
||||
import { useSession } from '../composables/useSession.js';
|
||||
|
||||
export interface Song {
|
||||
id: string;
|
||||
@@ -334,7 +335,10 @@ export const usePlayerStore = defineStore('player', {
|
||||
|
||||
async playSong(song: Song) {
|
||||
if (!this.activeBotId) return;
|
||||
const res = await axios.post(`/api/player/${this.activeBotId}/play-song`, { song });
|
||||
// Guests use the non-destructive "play now" (insert-next + skip) so they
|
||||
// can't wipe everyone else's queue; members/admins keep the normal behavior.
|
||||
const endpoint = useSession().isGuest.value ? 'play-now-song' : 'play-song';
|
||||
const res = await axios.post(`/api/player/${this.activeBotId}/${endpoint}`, { song });
|
||||
if (res.data?.ok === false && res.data?.message) {
|
||||
this.notify(res.data.message, 'error');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user