mirror of
https://github.com/Mastermindzh/tidal-hifi.git
synced 2025-05-11 05:23:09 +02:00
Compare commits
4 Commits
cff5fc37b2
...
da72b4bdd6
Author | SHA1 | Date | |
---|---|---|---|
|
da72b4bdd6 | ||
|
0f5e00c4df | ||
91156e5936 | |||
|
57e9a2dcb8 |
53
package-lock.json
generated
53
package-lock.json
generated
@ -19,7 +19,7 @@
|
|||||||
"hotkeys-js": "^3.13.7",
|
"hotkeys-js": "^3.13.7",
|
||||||
"mpris-service": "^2.1.2",
|
"mpris-service": "^2.1.2",
|
||||||
"request": "^2.88.2",
|
"request": "^2.88.2",
|
||||||
"sass": "^1.78.0",
|
"sass": "^1.79.4",
|
||||||
"swagger-ui-express": "^5.0.1"
|
"swagger-ui-express": "^5.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -2127,6 +2127,7 @@
|
|||||||
"version": "3.1.3",
|
"version": "3.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
|
||||||
"integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
|
"integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
|
||||||
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"normalize-path": "^3.0.0",
|
"normalize-path": "^3.0.0",
|
||||||
"picomatch": "^2.0.4"
|
"picomatch": "^2.0.4"
|
||||||
@ -2425,6 +2426,7 @@
|
|||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
|
||||||
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
|
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
|
||||||
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
@ -2522,6 +2524,7 @@
|
|||||||
"version": "3.0.3",
|
"version": "3.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
|
||||||
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
|
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
|
||||||
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fill-range": "^7.1.1"
|
"fill-range": "^7.1.1"
|
||||||
},
|
},
|
||||||
@ -2533,6 +2536,7 @@
|
|||||||
"version": "7.1.1",
|
"version": "7.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
|
||||||
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
|
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
|
||||||
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"to-regex-range": "^5.0.1"
|
"to-regex-range": "^5.0.1"
|
||||||
},
|
},
|
||||||
@ -2760,6 +2764,7 @@
|
|||||||
"version": "3.5.3",
|
"version": "3.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
|
||||||
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
|
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
|
||||||
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "individual",
|
"type": "individual",
|
||||||
@ -2786,6 +2791,7 @@
|
|||||||
"version": "5.1.2",
|
"version": "5.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
|
||||||
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
|
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
|
||||||
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"is-glob": "^4.0.1"
|
"is-glob": "^4.0.1"
|
||||||
},
|
},
|
||||||
@ -4612,6 +4618,7 @@
|
|||||||
"version": "2.3.3",
|
"version": "2.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||||
|
"dev": true,
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"optional": true,
|
"optional": true,
|
||||||
"os": [
|
"os": [
|
||||||
@ -5331,6 +5338,7 @@
|
|||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
|
||||||
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
|
"integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
|
||||||
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"binary-extensions": "^2.0.0"
|
"binary-extensions": "^2.0.0"
|
||||||
},
|
},
|
||||||
@ -5384,6 +5392,7 @@
|
|||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
|
||||||
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
|
"integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
|
||||||
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
@ -5401,6 +5410,7 @@
|
|||||||
"version": "4.0.3",
|
"version": "4.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
|
||||||
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
|
"integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
|
||||||
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"is-extglob": "^2.1.1"
|
"is-extglob": "^2.1.1"
|
||||||
},
|
},
|
||||||
@ -6377,6 +6387,7 @@
|
|||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
|
||||||
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
|
"integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
|
||||||
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
@ -6716,6 +6727,7 @@
|
|||||||
"version": "2.3.1",
|
"version": "2.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
|
||||||
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
|
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
|
||||||
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8.6"
|
"node": ">=8.6"
|
||||||
},
|
},
|
||||||
@ -7196,6 +7208,7 @@
|
|||||||
"version": "3.6.0",
|
"version": "3.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
|
||||||
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
|
"integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
|
||||||
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"picomatch": "^2.2.1"
|
"picomatch": "^2.2.1"
|
||||||
},
|
},
|
||||||
@ -7472,12 +7485,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/sass": {
|
"node_modules/sass": {
|
||||||
"version": "1.78.0",
|
"version": "1.79.4",
|
||||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.78.0.tgz",
|
"resolved": "https://registry.npmjs.org/sass/-/sass-1.79.4.tgz",
|
||||||
"integrity": "sha512-AaIqGSrjo5lA2Yg7RvFZrlXDBCp3nV4XP73GrLGvdRWWwk+8H3l0SDvq/5bA4eF+0RFPLuWUk3E+P1U/YqnpsQ==",
|
"integrity": "sha512-K0QDSNPXgyqO4GZq2HO5Q70TLxTH6cIT59RdoCHMivrC8rqzaTw5ab9prjz9KUN1El4FLXrBXJhik61JR4HcGg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chokidar": ">=3.0.0 <4.0.0",
|
"chokidar": "^4.0.0",
|
||||||
"immutable": "^4.0.0",
|
"immutable": "^4.0.0",
|
||||||
"source-map-js": ">=0.6.2 <2.0.0"
|
"source-map-js": ">=0.6.2 <2.0.0"
|
||||||
},
|
},
|
||||||
@ -7488,6 +7501,34 @@
|
|||||||
"node": ">=14.0.0"
|
"node": ">=14.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/sass/node_modules/chokidar": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.1.tgz",
|
||||||
|
"integrity": "sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"readdirp": "^4.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 14.16.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://paulmillr.com/funding/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/sass/node_modules/readdirp": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-yDMz9g+VaZkqBYS/ozoBJwaBhTbZo3UNYQHNRw1D3UFQB8oHB4uS/tAODO+ZLjGWmUbKnIlOWO+aaIiAxrUWHA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 14.16.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://paulmillr.com/funding/"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/sax": {
|
"node_modules/sax": {
|
||||||
"version": "1.3.0",
|
"version": "1.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz",
|
||||||
@ -8550,6 +8591,7 @@
|
|||||||
"version": "5.0.1",
|
"version": "5.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
||||||
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
|
"integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
|
||||||
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"is-number": "^7.0.0"
|
"is-number": "^7.0.0"
|
||||||
},
|
},
|
||||||
@ -8561,6 +8603,7 @@
|
|||||||
"version": "7.0.0",
|
"version": "7.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
|
||||||
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
|
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
|
||||||
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.12.0"
|
"node": ">=0.12.0"
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
"hotkeys-js": "^3.13.7",
|
"hotkeys-js": "^3.13.7",
|
||||||
"mpris-service": "^2.1.2",
|
"mpris-service": "^2.1.2",
|
||||||
"request": "^2.88.2",
|
"request": "^2.88.2",
|
||||||
"sass": "^1.78.0",
|
"sass": "^1.79.4",
|
||||||
"swagger-ui-express": "^5.0.1"
|
"swagger-ui-express": "^5.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -27,7 +27,10 @@ export const settings = {
|
|||||||
enableDiscord: "enableDiscord",
|
enableDiscord: "enableDiscord",
|
||||||
discord: {
|
discord: {
|
||||||
detailsPrefix: "discord.detailsPrefix",
|
detailsPrefix: "discord.detailsPrefix",
|
||||||
|
buttonText: "discord.buttonText",
|
||||||
includeTimestamps: "discord.includeTimestamps",
|
includeTimestamps: "discord.includeTimestamps",
|
||||||
|
showSong: "discord.showSong",
|
||||||
|
showIdle: "discord.showIdle",
|
||||||
idleText: "discord.idleText",
|
idleText: "discord.idleText",
|
||||||
usingText: "discord.usingText",
|
usingText: "discord.usingText",
|
||||||
},
|
},
|
||||||
|
@ -20,6 +20,11 @@ const switchesWithSettings = {
|
|||||||
classToHide: "discord_options",
|
classToHide: "discord_options",
|
||||||
settingsKey: settings.enableDiscord,
|
settingsKey: settings.enableDiscord,
|
||||||
},
|
},
|
||||||
|
discord_show_song: {
|
||||||
|
switch: "discord_show_song",
|
||||||
|
classToHide: "discord_show_song_options",
|
||||||
|
settingsKey: settings.discord.showSong,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let adBlock: HTMLInputElement,
|
let adBlock: HTMLInputElement,
|
||||||
@ -49,7 +54,13 @@ let adBlock: HTMLInputElement,
|
|||||||
ListenBrainzToken: HTMLInputElement,
|
ListenBrainzToken: HTMLInputElement,
|
||||||
listenbrainz_delay: HTMLInputElement,
|
listenbrainz_delay: HTMLInputElement,
|
||||||
enableWaylandSupport: HTMLInputElement,
|
enableWaylandSupport: HTMLInputElement,
|
||||||
discord_details_prefix: HTMLInputElement
|
discord_details_prefix: HTMLInputElement,
|
||||||
|
discord_include_timestamps: HTMLInputElement,
|
||||||
|
discord_button_text: HTMLInputElement,
|
||||||
|
discord_show_song: HTMLInputElement,
|
||||||
|
discord_show_idle: HTMLInputElement,
|
||||||
|
discord_idle_text: HTMLInputElement,
|
||||||
|
discord_using_text: HTMLInputElement;
|
||||||
|
|
||||||
addCustomCss(app);
|
addCustomCss(app);
|
||||||
|
|
||||||
@ -138,6 +149,12 @@ function refreshSettings() {
|
|||||||
ListenBrainzToken.value = settingsStore.get(settings.ListenBrainz.token);
|
ListenBrainzToken.value = settingsStore.get(settings.ListenBrainz.token);
|
||||||
listenbrainz_delay.value = settingsStore.get(settings.ListenBrainz.delay);
|
listenbrainz_delay.value = settingsStore.get(settings.ListenBrainz.delay);
|
||||||
discord_details_prefix.value = settingsStore.get(settings.discord.detailsPrefix);
|
discord_details_prefix.value = settingsStore.get(settings.discord.detailsPrefix);
|
||||||
|
discord_include_timestamps.checked = settingsStore.get(settings.discord.includeTimestamps);
|
||||||
|
discord_button_text.value = settingsStore.get(settings.discord.buttonText);
|
||||||
|
discord_show_song.checked = settingsStore.get(settings.discord.showSong);
|
||||||
|
discord_show_idle.checked = settingsStore.get(settings.discord.showIdle);
|
||||||
|
discord_idle_text.value = settingsStore.get(settings.discord.idleText);
|
||||||
|
discord_using_text.value = settingsStore.get(settings.discord.usingText);
|
||||||
|
|
||||||
// set state of all switches with additional settings
|
// set state of all switches with additional settings
|
||||||
Object.values(switchesWithSettings).forEach((settingSwitch) => {
|
Object.values(switchesWithSettings).forEach((settingSwitch) => {
|
||||||
@ -250,7 +267,13 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
ListenBrainzAPI = get("ListenBrainzAPI");
|
ListenBrainzAPI = get("ListenBrainzAPI");
|
||||||
ListenBrainzToken = get("ListenBrainzToken");
|
ListenBrainzToken = get("ListenBrainzToken");
|
||||||
discord_details_prefix = get("discord_details_prefix");
|
discord_details_prefix = get("discord_details_prefix");
|
||||||
|
discord_include_timestamps = get("discord_include_timestamps");
|
||||||
listenbrainz_delay = get("listenbrainz_delay");
|
listenbrainz_delay = get("listenbrainz_delay");
|
||||||
|
discord_button_text = get("discord_button_text");
|
||||||
|
discord_show_song = get("discord_show_song");
|
||||||
|
discord_show_idle = get("discord_show_idle");
|
||||||
|
discord_using_text = get("discord_using_text");
|
||||||
|
discord_idle_text = get("discord_idle_text");
|
||||||
|
|
||||||
refreshSettings();
|
refreshSettings();
|
||||||
addInputListener(adBlock, settings.adBlock);
|
addInputListener(adBlock, settings.adBlock);
|
||||||
@ -285,4 +308,14 @@ window.addEventListener("DOMContentLoaded", () => {
|
|||||||
addInputListener(ListenBrainzToken, settings.ListenBrainz.token);
|
addInputListener(ListenBrainzToken, settings.ListenBrainz.token);
|
||||||
addInputListener(listenbrainz_delay, settings.ListenBrainz.delay);
|
addInputListener(listenbrainz_delay, settings.ListenBrainz.delay);
|
||||||
addInputListener(discord_details_prefix, settings.discord.detailsPrefix);
|
addInputListener(discord_details_prefix, settings.discord.detailsPrefix);
|
||||||
|
addInputListener(discord_include_timestamps, settings.discord.includeTimestamps);
|
||||||
|
addInputListener(discord_button_text, settings.discord.buttonText);
|
||||||
|
addInputListener(
|
||||||
|
discord_show_song,
|
||||||
|
settings.discord.showSong,
|
||||||
|
switchesWithSettings.discord_show_song
|
||||||
|
);
|
||||||
|
addInputListener(discord_show_idle, settings.discord.showIdle);
|
||||||
|
addInputListener(discord_idle_text, settings.discord.idleText);
|
||||||
|
addInputListener(discord_using_text, settings.discord.usingText);
|
||||||
});
|
});
|
||||||
|
@ -226,13 +226,75 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div id="discord_options">
|
<div id="discord_options">
|
||||||
|
|
||||||
<div class="group__option" class="hidden">
|
<div class="group__option" class="hidden">
|
||||||
<div class="group__description">
|
<div class="group__description">
|
||||||
<h4>Details prefix</h4>
|
<h4>Show Idle Text</h4>
|
||||||
<p>Prefix for the "details" field of Discord's rich presence.</p>
|
<p>Should the idle text be shown when idle?</p>
|
||||||
<input id="discord_details_prefix" type="text" class="text-input" name="discord_details_prefix" />
|
</div>
|
||||||
|
<label class="switch">
|
||||||
|
<input id="discord_show_idle" type="checkbox" />
|
||||||
|
<span class="switch__slider"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="group__option" class="hidden">
|
||||||
|
<div class="group__description">
|
||||||
|
<h4>Idle Text</h4>
|
||||||
|
<p>The text displayed on Discord's rich presence while idling in the app.</p>
|
||||||
|
<input id="discord_idle_text" type="text" class="text-input" name="discord_idle_text" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="group__option" class="hidden">
|
||||||
|
<div class="group__description">
|
||||||
|
<h4>Using Tidal Text</h4>
|
||||||
|
<p>The text displayed on Discord's rich presence while "showSong" is turned off</p>
|
||||||
|
<input id="discord_using_text" type="text" class="text-input" name="discord_using_text" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="group__option" class="hidden">
|
||||||
|
<div class="group__description">
|
||||||
|
<h4>Show media</h4>
|
||||||
|
<p>Show the current media in the Discord client</p>
|
||||||
|
</div>
|
||||||
|
<label class="switch">
|
||||||
|
<input id="discord_show_song" type="checkbox" />
|
||||||
|
<span class="switch__slider"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="discord_show_song_options" class="hidden">
|
||||||
|
|
||||||
|
<div class="group__option" class="hidden">
|
||||||
|
<div class="group__description">
|
||||||
|
<h4>Include timestamps</h4>
|
||||||
|
<p>Show current/end playtime in the Discord client</p>
|
||||||
|
</div>
|
||||||
|
<label class="switch">
|
||||||
|
<input id="discord_include_timestamps" type="checkbox" />
|
||||||
|
<span class="switch__slider"></span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="group__option" class="hidden">
|
||||||
|
<div class="group__description">
|
||||||
|
<h4>Details prefix</h4>
|
||||||
|
<p>Prefix for the "details" field of Discord's rich presence.</p>
|
||||||
|
<input id="discord_details_prefix" type="text" class="text-input" name="discord_details_prefix" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="group__option">
|
||||||
|
<div class="group__description">
|
||||||
|
<h4>Button text</h4>
|
||||||
|
<p>Text to display on the button below the media information.</p>
|
||||||
|
<input id="discord_button_text" type="text" class="text-input" name="discord_button_text" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="group">
|
<div class="group">
|
||||||
|
@ -23,14 +23,15 @@ const observer = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const defaultPresence = {
|
const defaultPresence = {
|
||||||
smallImageKey: "tidal-hifi-icon",
|
largeImageKey: "tidal-hifi-icon",
|
||||||
smallImageText: `TIDAL Hi-Fi ${app.getVersion()}`,
|
largeImageText: `TIDAL Hi-Fi ${app.getVersion()}`,
|
||||||
instance: false,
|
instance: false,
|
||||||
type: ACTIVITY_LISTENING
|
type: ACTIVITY_LISTENING
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateActivity = () => {
|
const updateActivity = () => {
|
||||||
if (mediaInfo.status === MediaStatus.paused) {
|
const showIdle = settingsStore.get<string, boolean>(settings.discord.showIdle) ?? true;
|
||||||
|
if (mediaInfo.status === MediaStatus.paused && !showIdle) {
|
||||||
rpc.user?.clearActivity();
|
rpc.user?.clearActivity();
|
||||||
} else {
|
} else {
|
||||||
rpc.user?.setActivity(getActivity());
|
rpc.user?.setActivity(getActivity());
|
||||||
@ -40,11 +41,34 @@ const updateActivity = () => {
|
|||||||
const getActivity = (): SetActivity => {
|
const getActivity = (): SetActivity => {
|
||||||
const presence: SetActivity = { ...defaultPresence };
|
const presence: SetActivity = { ...defaultPresence };
|
||||||
|
|
||||||
includeTimeStamps();
|
if (mediaInfo.status === MediaStatus.paused) {
|
||||||
setPresenceFromMediaInfo();
|
presence.details =
|
||||||
|
settingsStore.get<string, string>(settings.discord.idleText) ?? "Browsing Tidal";
|
||||||
|
} else {
|
||||||
|
const showSong = settingsStore.get<string, boolean>(settings.discord.showSong) ?? false;
|
||||||
|
if (showSong) {
|
||||||
|
const { includeTimestamps, detailsPrefix, buttonText } = getFromStore();
|
||||||
|
includeTimeStamps(includeTimestamps);
|
||||||
|
setPresenceFromMediaInfo(detailsPrefix, buttonText);
|
||||||
|
} else {
|
||||||
|
presence.details =
|
||||||
|
settingsStore.get<string, string>(settings.discord.usingText) ?? "Playing media on TIDAL";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return presence;
|
return presence;
|
||||||
|
|
||||||
|
function getFromStore() {
|
||||||
|
const includeTimestamps =
|
||||||
|
settingsStore.get<string, boolean>(settings.discord.includeTimestamps) ?? true;
|
||||||
|
const detailsPrefix =
|
||||||
|
settingsStore.get<string, string>(settings.discord.detailsPrefix) ?? "Listening to ";
|
||||||
|
const buttonText =
|
||||||
|
settingsStore.get<string, string>(settings.discord.buttonText) ?? "Play on TIDAL";
|
||||||
|
|
||||||
|
return { includeTimestamps, detailsPrefix, buttonText };
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pad a string using spaces to at least 2 characters
|
* Pad a string using spaces to at least 2 characters
|
||||||
* @param input string to pad with 2 characters
|
* @param input string to pad with 2 characters
|
||||||
@ -54,28 +78,36 @@ const getActivity = (): SetActivity => {
|
|||||||
return input.padEnd(2, " ");
|
return input.padEnd(2, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
function setPresenceFromMediaInfo() {
|
function setPresenceFromMediaInfo(detailsPrefix: string, buttonText: string) {
|
||||||
// discord requires a minimum of 2 characters
|
// discord requires a minimum of 2 characters
|
||||||
const title = pad(mediaInfo.title);
|
const title = pad(mediaInfo.title);
|
||||||
const album = pad(mediaInfo.album);
|
const album = pad(mediaInfo.album);
|
||||||
const artists = pad(mediaInfo.artists);
|
const artists = pad(mediaInfo.artists);
|
||||||
|
|
||||||
const detailsPrefix = settingsStore.get<string, string>(settings.discord.detailsPrefix) ?? "Listening to ";
|
|
||||||
presence.details = `${detailsPrefix}${title}`;
|
|
||||||
presence.state = artists ? artists : "unknown artist(s)";
|
|
||||||
if (mediaInfo.url) {
|
if (mediaInfo.url) {
|
||||||
|
presence.details = `${detailsPrefix}${title}`;
|
||||||
|
presence.state = artists ? artists : "unknown artist(s)";
|
||||||
presence.largeImageKey = mediaInfo.image;
|
presence.largeImageKey = mediaInfo.image;
|
||||||
if (album) presence.largeImageText = album;
|
if (album) {
|
||||||
|
presence.largeImageText = album;
|
||||||
|
}
|
||||||
|
|
||||||
|
presence.buttons = [{ label: buttonText, url: mediaInfo.url }];
|
||||||
|
} else {
|
||||||
|
presence.details = `Watching ${title}`;
|
||||||
|
presence.state = artists;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function includeTimeStamps() {
|
function includeTimeStamps(includeTimestamps: boolean) {
|
||||||
|
if (includeTimestamps) {
|
||||||
const currentSeconds = convertDurationToSeconds(mediaInfo.current);
|
const currentSeconds = convertDurationToSeconds(mediaInfo.current);
|
||||||
const durationSeconds = convertDurationToSeconds(mediaInfo.duration);
|
const durationSeconds = convertDurationToSeconds(mediaInfo.duration);
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
const now = Math.floor(date.getTime() / 1000);
|
const now = Math.floor(date.getTime() / 1000);
|
||||||
presence.startTimestamp = now - currentSeconds;
|
presence.startTimestamp = now - currentSeconds;
|
||||||
presence.endTimestamp = presence.startTimestamp + durationSeconds;
|
presence.endTimestamp = presence.startTimestamp + durationSeconds;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,10 +42,13 @@ export const settingsStore = new Store({
|
|||||||
enableCustomHotkeys: false,
|
enableCustomHotkeys: false,
|
||||||
enableDiscord: false,
|
enableDiscord: false,
|
||||||
discord: {
|
discord: {
|
||||||
|
showSong: true,
|
||||||
|
showIdle: true,
|
||||||
idleText: "Browsing Tidal",
|
idleText: "Browsing Tidal",
|
||||||
usingText: "Playing media on TIDAL",
|
usingText: "Playing media on TIDAL",
|
||||||
includeTimestamps: true,
|
includeTimestamps: true,
|
||||||
detailsPrefix: "Listening to ",
|
detailsPrefix: "Listening to ",
|
||||||
|
buttonText: "Play on Tidal",
|
||||||
},
|
},
|
||||||
ListenBrainz: {
|
ListenBrainz: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
@ -86,8 +89,16 @@ export const settingsStore = new Store({
|
|||||||
migrationStore.get(settings.ListenBrainz.delay) ?? 5000
|
migrationStore.get(settings.ListenBrainz.delay) ?? 5000
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
"5.8.0": (migrationStore) => {
|
||||||
|
console.log("running migrations for 5.8.0");
|
||||||
|
migrationStore.set(
|
||||||
|
settings.discord.includeTimestamps,
|
||||||
|
migrationStore.get(settings.discord.includeTimestamps) ?? true
|
||||||
|
);
|
||||||
|
},
|
||||||
"5.9.0": (migrationStore) => {
|
"5.9.0": (migrationStore) => {
|
||||||
buildMigration("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.idleText, value: "Browsing Tidal" },
|
||||||
{
|
{
|
||||||
key: settings.discord.usingText,
|
key: settings.discord.usingText,
|
||||||
@ -104,7 +115,10 @@ export const settingsStore = new Store({
|
|||||||
buildMigration("5.15.0", migrationStore, [
|
buildMigration("5.15.0", migrationStore, [
|
||||||
{ key: settings.advanced.tidalUrl, value: "https://listen.tidal.com" },
|
{ key: settings.advanced.tidalUrl, value: "https://listen.tidal.com" },
|
||||||
]);
|
]);
|
||||||
}
|
},
|
||||||
|
"5.16.0": (migrationStore) => {
|
||||||
|
buildMigration("5.16.0", migrationStore, [{ key: settings.discord.showIdle, value: "true" }]);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user