| 
														
															@@ -3,12 +3,11 @@ import { useRouter } from "vue-router"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { defineAsyncComponent, ref, watch, onMounted } from "vue"; 
														 | 
														
														 | 
														
															 import { defineAsyncComponent, ref, watch, onMounted } from "vue"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import Toast from "toasters"; 
														 | 
														
														 | 
														
															 import Toast from "toasters"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { storeToRefs } from "pinia"; 
														 | 
														
														 | 
														
															 import { storeToRefs } from "pinia"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import { GenericResponse } from "@musare_types/actions/GenericActions"; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { useWebsocketsStore } from "@/stores/websockets"; 
														 | 
														
														 | 
														
															 import { useWebsocketsStore } from "@/stores/websockets"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { useConfigStore } from "@/stores/config"; 
														 | 
														
														 | 
														
															 import { useConfigStore } from "@/stores/config"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { useUserAuthStore } from "@/stores/userAuth"; 
														 | 
														
														 | 
														
															 import { useUserAuthStore } from "@/stores/userAuth"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import { useUserPreferencesStore } from "@/stores/userPreferences"; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import { useModalsStore } from "@/stores/modals"; 
														 | 
														
														 | 
														
															 import { useModalsStore } from "@/stores/modals"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import { useEvents } from "@/composables/useEvents"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import aw from "@/aw"; 
														 | 
														
														 | 
														
															 import aw from "@/aw"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import keyboardShortcuts from "@/keyboardShortcuts"; 
														 | 
														
														 | 
														
															 import keyboardShortcuts from "@/keyboardShortcuts"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -28,7 +27,6 @@ const router = useRouter(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 const { socket } = useWebsocketsStore(); 
														 | 
														
														 | 
														
															 const { socket } = useWebsocketsStore(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 const configStore = useConfigStore(); 
														 | 
														
														 | 
														
															 const configStore = useConfigStore(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 const userAuthStore = useUserAuthStore(); 
														 | 
														
														 | 
														
															 const userAuthStore = useUserAuthStore(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-const userPreferencesStore = useUserPreferencesStore(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 const modalsStore = useModalsStore(); 
														 | 
														
														 | 
														
															 const modalsStore = useModalsStore(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 const socketConnected = ref(true); 
														 | 
														
														 | 
														
															 const socketConnected = ref(true); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -40,27 +38,10 @@ const broadcastChannel = ref({ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 const disconnectedMessage = ref(); 
														 | 
														
														 | 
														
															 const disconnectedMessage = ref(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 const { christmas } = storeToRefs(configStore); 
														 | 
														
														 | 
														
															 const { christmas } = storeToRefs(configStore); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-const { currentUser, loggedIn, banned } = storeToRefs(userAuthStore); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-const { nightmode, activityWatch } = storeToRefs(userPreferencesStore); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-const { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	changeNightmode, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-} = userPreferencesStore; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+const { currentUser, loggedIn, banned, nightmode } = storeToRefs(userAuthStore); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 const { activeModals } = storeToRefs(modalsStore); 
														 | 
														
														 | 
														
															 const { activeModals } = storeToRefs(modalsStore); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 const { openModal, closeCurrentModal } = modalsStore; 
														 | 
														
														 | 
														
															 const { openModal, closeCurrentModal } = modalsStore; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-const toggleNightMode = () => { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	if (loggedIn.value) { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		socket.dispatch( 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			"users.updatePreferences", 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			{ nightmode: !nightmode.value }, 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			(res: GenericResponse) => { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-				if (res.status !== "success") new Toast(res.message); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			} 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	} else { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		broadcastChannel.value.nightmode.postMessage(!nightmode.value); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	} 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-}; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+const { onReady } = useEvents(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 const enableNightmode = () => { 
														 | 
														
														 | 
														
															 const enableNightmode = () => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	document.getElementsByTagName("html")[0].classList.add("night-mode"); 
														 | 
														
														 | 
														
															 	document.getElementsByTagName("html")[0].classList.add("night-mode"); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -85,23 +66,23 @@ watch(socketConnected, connected => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 watch(banned, () => { 
														 | 
														
														 | 
														
															 watch(banned, () => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	disconnectedMessage.value.hide(); 
														 | 
														
														 | 
														
															 	disconnectedMessage.value.hide(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 }); 
														 | 
														
														 | 
														
															 }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-watch(nightmode, enabled => { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	if (enabled) enableNightmode(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+watch(nightmode, value => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	if (value) enableNightmode(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	else disableNightmode(); 
														 | 
														
														 | 
														
															 	else disableNightmode(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	localStorage.setItem("nightmode", value.toString()); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 }); 
														 | 
														
														 | 
														
															 }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-watch(activityWatch, enabled => { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	if (enabled) aw.enable(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	else aw.disable(); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-}); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+watch( 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	() => currentUser.value?.activityWatch, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	enabled => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		if (enabled) aw.enable(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+		else aw.disable(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 watch(christmas, enabled => { 
														 | 
														
														 | 
														
															 watch(christmas, enabled => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	if (enabled) enableChristmasMode(); 
														 | 
														
														 | 
														
															 	if (enabled) enableChristmasMode(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	else disableChristmasMode(); 
														 | 
														
														 | 
														
															 	else disableChristmasMode(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 }); 
														 | 
														
														 | 
														
															 }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-watch(currentUser, user => { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	if (!user) return; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															- 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	changeNightmode(user.nightmode); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-}); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 onMounted(async () => { 
														 | 
														
														 | 
														
															 onMounted(async () => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	document.getElementsByTagName("html")[0].style.cssText = 
														 | 
														
														 | 
														
															 	document.getElementsByTagName("html")[0].style.cssText = 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -110,7 +91,7 @@ onMounted(async () => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	window 
														 | 
														
														 | 
														
															 	window 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		.matchMedia("(prefers-color-scheme: dark)") 
														 | 
														
														 | 
														
															 		.matchMedia("(prefers-color-scheme: dark)") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		.addEventListener("change", e => { 
														 | 
														
														 | 
														
															 		.addEventListener("change", e => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			if (e.matches === !nightmode.value) changeNightmode(true); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			if (e.matches === !nightmode.value) nightmode.value = true; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		}); 
														 | 
														
														 | 
														
															 		}); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	disconnectedMessage.value = new Toast({ 
														 | 
														
														 | 
														
															 	disconnectedMessage.value = new Toast({ 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -121,7 +102,7 @@ onMounted(async () => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	disconnectedMessage.value.hide(); 
														 | 
														
														 | 
														
															 	disconnectedMessage.value.hide(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	socket.onConnect(() => { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	await onReady(async () => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		socketConnected.value = true; 
														 | 
														
														 | 
														
															 		socketConnected.value = true; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		document.getElementsByTagName("html")[0].style.cssText = 
														 | 
														
														 | 
														
															 		document.getElementsByTagName("html")[0].style.cssText = 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -142,7 +123,7 @@ onMounted(async () => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				`${configStore.cookie}.nightmode` 
														 | 
														
														 | 
														
															 				`${configStore.cookie}.nightmode` 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			); 
														 | 
														
														 | 
														
															 			); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			broadcastChannel.value.nightmode.onmessage = res => { 
														 | 
														
														 | 
														
															 			broadcastChannel.value.nightmode.onmessage = res => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-				changeNightmode(!!res.data); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+				nightmode.value = !!res.data; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			}; 
														 | 
														
														 | 
														
															 			}; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		} 
														 | 
														
														 | 
														
															 		} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -170,7 +151,7 @@ onMounted(async () => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			keyCode: 78, 
														 | 
														
														 | 
														
															 			keyCode: 78, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			ctrl: true, 
														 | 
														
														 | 
														
															 			ctrl: true, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			alt: true, 
														 | 
														
														 | 
														
															 			alt: true, 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-			handler: () => toggleNightMode() 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+			handler: userAuthStore.toggleNightmode 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		}); 
														 | 
														
														 | 
														
															 		}); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		keyboardShortcuts.registerShortcut("closeModal", { 
														 | 
														
														 | 
														
															 		keyboardShortcuts.registerShortcut("closeModal", { 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -194,7 +175,7 @@ onMounted(async () => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 				localStorage.removeItem("github_redirect"); 
														 | 
														
														 | 
														
															 				localStorage.removeItem("github_redirect"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 			} 
														 | 
														
														 | 
														
															 			} 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		}); 
														 | 
														
														 | 
														
															 		}); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	}, true); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	}); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	socket.onDisconnect(() => { 
														 | 
														
														 | 
														
															 	socket.onDisconnect(() => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		socketConnected.value = false; 
														 | 
														
														 | 
														
															 		socketConnected.value = false; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -204,9 +185,7 @@ onMounted(async () => { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 		window.location.reload() 
														 | 
														
														 | 
														
															 		window.location.reload() 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 	); 
														 | 
														
														 | 
														
															 	); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	if (localStorage.getItem("nightmode") === "true") { 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-		changeNightmode(true); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-	} else changeNightmode(false); 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+	nightmode.value = localStorage.getItem("nightmode") === "true"; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 }); 
														 | 
														
														 | 
														
															 }); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 </script> 
														 | 
														
														 | 
														
															 </script> 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 |