|
@@ -4,7 +4,6 @@ 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 { GenericResponse } from "@musare_types/actions/GenericActions";
|
|
-import { GetPreferencesResponse } from "@musare_types/actions/UsersActions";
|
|
|
|
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";
|
|
@@ -41,14 +40,10 @@ const broadcastChannel = ref({
|
|
const disconnectedMessage = ref();
|
|
const disconnectedMessage = ref();
|
|
|
|
|
|
const { christmas } = storeToRefs(configStore);
|
|
const { christmas } = storeToRefs(configStore);
|
|
-const { loggedIn, banned } = storeToRefs(userAuthStore);
|
|
|
|
|
|
+const { currentUser, loggedIn, banned } = storeToRefs(userAuthStore);
|
|
const { nightmode, activityWatch } = storeToRefs(userPreferencesStore);
|
|
const { nightmode, activityWatch } = storeToRefs(userPreferencesStore);
|
|
const {
|
|
const {
|
|
changeNightmode,
|
|
changeNightmode,
|
|
- changeAutoSkipDisliked,
|
|
|
|
- changeActivityLogPublic,
|
|
|
|
- changeAnonymousSongRequests,
|
|
|
|
- changeActivityWatch
|
|
|
|
} = userPreferencesStore;
|
|
} = userPreferencesStore;
|
|
const { activeModals } = storeToRefs(modalsStore);
|
|
const { activeModals } = storeToRefs(modalsStore);
|
|
const { openModal, closeCurrentModal } = modalsStore;
|
|
const { openModal, closeCurrentModal } = modalsStore;
|
|
@@ -102,6 +97,11 @@ 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 =
|
|
@@ -183,23 +183,6 @@ onMounted(async () => {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
- socket.dispatch(
|
|
|
|
- "users.getPreferences",
|
|
|
|
- (res: GetPreferencesResponse) => {
|
|
|
|
- if (res.status === "success") {
|
|
|
|
- const { preferences } = res.data;
|
|
|
|
-
|
|
|
|
- changeAutoSkipDisliked(preferences.autoSkipDisliked);
|
|
|
|
- changeNightmode(preferences.nightmode);
|
|
|
|
- changeActivityLogPublic(preferences.activityLogPublic);
|
|
|
|
- changeAnonymousSongRequests(
|
|
|
|
- preferences.anonymousSongRequests
|
|
|
|
- );
|
|
|
|
- changeActivityWatch(preferences.activityWatch);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
openModal("whatIsNew");
|
|
openModal("whatIsNew");
|
|
|
|
|
|
router.isReady().then(() => {
|
|
router.isReady().then(() => {
|