()
| 64 | return JSON.parse(localStorage.getItem("userinfos") as string); |
| 65 | } |
| 66 | export function setDefaults() { |
| 67 | let userinfos = getBulkInfo(); |
| 68 | if (!userinfos) { |
| 69 | localStorage.setItem( |
| 70 | "userinfos", |
| 71 | JSON.stringify({ |
| 72 | currentuser: null, |
| 73 | users: {}, |
| 74 | preferences: { |
| 75 | theme: "Dark", |
| 76 | notifications: false, |
| 77 | notisound: "three", |
| 78 | }, |
| 79 | }), |
| 80 | ); |
| 81 | userinfos = getBulkInfo(); |
| 82 | } |
| 83 | if (userinfos.users === undefined) { |
| 84 | userinfos.users = {}; |
| 85 | } |
| 86 | if (userinfos.accent_color === undefined) { |
| 87 | userinfos.accent_color = "#3096f7"; |
| 88 | } |
| 89 | |
| 90 | const perfs = getPreferences(); |
| 91 | document.documentElement.style.setProperty("--accent-color", perfs.accentColor); |
| 92 | |
| 93 | if (userinfos.preferences === undefined) { |
| 94 | userinfos.preferences = { |
| 95 | theme: "Dark", |
| 96 | notifications: false, |
| 97 | notisound: "three", |
| 98 | }; |
| 99 | } |
| 100 | if (userinfos.preferences && userinfos.preferences.notisound === undefined) { |
| 101 | console.warn("uhoh"); |
| 102 | userinfos.preferences.notisound = "three"; |
| 103 | } |
| 104 | localStorage.setItem("userinfos", JSON.stringify(userinfos)); |
| 105 | } |
| 106 | setDefaults(); |
| 107 | export class Specialuser { |
| 108 | serverurls: InstanceUrls; |
no test coverage detected