mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
- Introduced Tauri as a new EventFetcherType in api-models. - Enhanced ClientFetcher.vue to support forced mode switching for Danmaku client. - Updated ClientLayout.vue to restrict usage outside Tauri environment with appropriate alerts. - Improved ClientSettings.vue to fetch and display the current version of the application. - Modified initialization logic in initialize.ts to handle minimized startup for Tauri. - Updated QueryBiliAPI function to conditionally use cookies based on a new parameter. - Added bootAsMinimized setting to useSettings store for better user experience. - Refactored logging in useWebFetcher to use console instead of logError/logInfo for clarity. - Created a new LabelItem component for better label handling in forms. - Enhanced EventFetcherStatusCard.vue to display version information based on EventFetcherType.
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import { useTauriStore } from './useTauriStore';
|
|
|
|
export type NotificationType = 'question-box' | 'danmaku';
|
|
export type NotificationSettings = {
|
|
enableTypes: NotificationType[];
|
|
};
|
|
export type VTsuruClientSettings = {
|
|
useDanmakuClientType: 'openlive' | 'direct';
|
|
fallbackToOpenLive: boolean;
|
|
bootAsMinimized: boolean;
|
|
|
|
danmakuHistorySize: number;
|
|
loginType: 'qrcode' | 'cookiecloud'
|
|
|
|
enableNotification: boolean;
|
|
notificationSettings: NotificationSettings;
|
|
};
|
|
|
|
export const useSettings = defineStore('settings', () => {
|
|
const store = useTauriStore().getTarget<VTsuruClientSettings>('settings');
|
|
const defaultSettings: VTsuruClientSettings = {
|
|
useDanmakuClientType: 'openlive',
|
|
fallbackToOpenLive: true,
|
|
bootAsMinimized: true,
|
|
|
|
danmakuHistorySize: 100,
|
|
loginType: 'qrcode',
|
|
enableNotification: true,
|
|
notificationSettings: {
|
|
enableTypes: ['question-box', 'danmaku'],
|
|
},
|
|
};
|
|
const settings = ref<VTsuruClientSettings>(Object.assign({}, defaultSettings));
|
|
|
|
async function init() {
|
|
settings.value = (await store.get()) || Object.assign({}, defaultSettings);
|
|
settings.value.notificationSettings ??= defaultSettings.notificationSettings;
|
|
settings.value.notificationSettings.enableTypes ??= [ 'question-box', 'danmaku' ];
|
|
}
|
|
async function save() {
|
|
await store.set(settings.value);
|
|
}
|
|
|
|
return { init, save, settings };
|
|
});
|
|
|
|
if (import.meta.hot) import.meta.hot.accept(acceptHMRUpdate(useSettings, import.meta.hot));
|