- More Discord options:

- Added the ability to hide the current song from the discord activity and display a custom text instead
  - Added the ability to customize the text that is shown when no song is playing
  - Discord now reacts to pausing/unpausing events
- Refactored media info updates so it only updates the required info, fixes #342, #306
- Added 5.9.0 logs/versions/migrations
This commit is contained in:
2024-02-11 22:42:45 +01:00
parent e37b2f99cc
commit b11dbbd6d8
8 changed files with 172 additions and 106 deletions

View File

@@ -5,6 +5,25 @@ import path from "path";
import { settings } from "../constants/settings";
let settingsWindow: BrowserWindow;
/**
* Build a migration step for several settings.
* All settings will be checked and set to the default if non-existent.
* @param version
* @param migrationStore
* @param options
*/
const buildMigration = (
version: string,
migrationStore: { get: (str: string) => string; set: (str: string, val: unknown) => void },
options: Array<{ key: string; value: unknown }>
) => {
console.log(`running migrations for ${version}`);
options.forEach(({ key, value }) => {
const valueToSet = migrationStore.get(key) ?? value;
console.log(` - setting ${key} to ${value}`);
migrationStore.set(key, valueToSet);
});
};
export const settingsStore = new Store({
defaults: {
@@ -19,12 +38,12 @@ export const settingsStore = new Store({
enableCustomHotkeys: false,
enableDiscord: false,
discord: {
showSong: false,
showSong: true,
idleText: "Browsing Tidal",
listeningText: "Listening Tidal",
usingText: "Playing media on TIDAL",
includeTimestamps: true,
detailsPrefix: "Listening to ",
buttonText: "Play on Tidal",
includeTimestamps: true,
},
ListenBrainz: {
enabled: false,
@@ -72,6 +91,16 @@ export const settingsStore = new Store({
migrationStore.get(settings.discord.includeTimestamps) ?? true
);
},
"5.9.0": (migrationStore) => {
buildMigration("5.9.0", migrationStore, [
{ key: settings.discord.showSong, value: "true" },
{ key: settings.discord.idleText, value: "Browsing Tidal" },
{
key: settings.discord.usingText,
value: "Playing media on TIDAL",
},
]);
},
},
});