privateEnabled

This commit is contained in:
vapormusic 2022-02-22 08:33:23 +07:00
parent ae9ea1d668
commit abf6def954
5 changed files with 10 additions and 8 deletions

View file

@ -13,7 +13,8 @@ export class Store {
"language": "en_US", // electron.app.getLocale().replace('-', '_') this can be used in future "language": "en_US", // electron.app.getLocale().replace('-', '_') this can be used in future
"playbackNotifications": true, "playbackNotifications": true,
"update_branch": "main", "update_branch": "main",
"resumeOnStartupBehavior": "local" "resumeOnStartupBehavior": "local",
"privateEnabled": false,
}, },
"home": { "home": {
"followedArtists": [], "followedArtists": [],

View file

@ -207,7 +207,7 @@ export default class DiscordRichPresence {
this.connect((DiscordRichPresence._store.general.discord_rpc == 1) ? '911790844204437504' : '886578863147192350'); this.connect((DiscordRichPresence._store.general.discord_rpc == 1) ? '911790844204437504' : '886578863147192350');
console.debug(`[Plugin][${this.name}] Ready.`); console.debug(`[Plugin][${this.name}] Ready.`);
ipcMain.on('updateRPCImage', (_event, imageurl) => { ipcMain.on('updateRPCImage', (_event, imageurl) => {
if (DiscordRichPresence._store.visual.showuserinfo){ if (!DiscordRichPresence._store.general.privateEnabled){
fetch('https://api.cider.sh/v1/images' ,{ fetch('https://api.cider.sh/v1/images' ,{
method: 'POST', method: 'POST',
@ -238,7 +238,7 @@ export default class DiscordRichPresence {
* @param attributes Music Attributes (attributes.status = current state) * @param attributes Music Attributes (attributes.status = current state)
*/ */
onPlaybackStateDidChange(attributes: object): void { onPlaybackStateDidChange(attributes: object): void {
if (DiscordRichPresence._store.visual.showuserinfo){ if (!DiscordRichPresence._store.general.privateEnabled){
this._attributes = attributes this._attributes = attributes
this.updateActivity(attributes)} this.updateActivity(attributes)}
} }
@ -248,7 +248,7 @@ export default class DiscordRichPresence {
* @param attributes Music Attributes * @param attributes Music Attributes
*/ */
onNowPlayingItemDidChange(attributes: object): void { onNowPlayingItemDidChange(attributes: object): void {
if (DiscordRichPresence._store.visual.showuserinfo){ if (!DiscordRichPresence._store.general.privateEnabled){
this._attributes = attributes this._attributes = attributes
this.updateActivity(attributes)} this.updateActivity(attributes)}
} }

View file

@ -119,7 +119,7 @@ export default class LastFMPlugin {
} else { } else {
return console.log('[LastFM] Did not add ', attributes.name, '—', artist, 'because now playing a other song.'); return console.log('[LastFM] Did not add ', attributes.name, '—', artist, 'because now playing a other song.');
} }
}, Math.round(attributes.durationInMillis * (self._store.lastfm.scrobble_after / 100))); }, Math.round(attributes.durationInMillis * Math.min((self._store.lastfm.scrobble_after / 100),0.8)));
} }
private async updateNowPlayingSong(attributes: any) { private async updateNowPlayingSong(attributes: any) {
@ -258,7 +258,7 @@ export default class LastFMPlugin {
* @param attributes Music Attributes * @param attributes Music Attributes
*/ */
nowPlayingItemDidChangeLastFM(attributes: any): void { nowPlayingItemDidChangeLastFM(attributes: any): void {
if (this._store.visual.showuserinfo){ if (!this._store.general.privateEnabled){
attributes.status = true attributes.status = true
if (!this._store.lastfm.filterLoop) { if (!this._store.lastfm.filterLoop) {
this._lastfm.cachedNowPlayingAttributes = false; this._lastfm.cachedNowPlayingAttributes = false;

View file

@ -612,6 +612,7 @@ const app = new Vue({
} else { } else {
// Get Hide User from Settings // Get Hide User from Settings
this.chrome.hideUserInfo = !this.cfg.visual.showuserinfo this.chrome.hideUserInfo = !this.cfg.visual.showuserinfo
this.mk.privateEnabled = this.cfg.general.privateEnabled
} }
if (this.cfg.visual.hw_acceleration == "disabled") { if (this.cfg.visual.hw_acceleration == "disabled") {
document.body.classList.add("no-gpu") document.body.classList.add("no-gpu")
@ -626,7 +627,7 @@ const app = new Vue({
this.chrome.userinfo = (await app.mk.api.v3.music(`/v1/me/social-profile`)).data.data[0] this.chrome.userinfo = (await app.mk.api.v3.music(`/v1/me/social-profile`)).data.data[0]
} catch (err) { } catch (err) {
} }
this.mk.privateEnabled = !this.cfg.visual.showuserinfo
this.mk._bag.features['seamless-audio-transitions'] = this.cfg.audio.seamless_audio this.mk._bag.features['seamless-audio-transitions'] = this.cfg.audio.seamless_audio
// API Fallback // API Fallback

View file

@ -20,7 +20,7 @@
{{$root.getLz('term.privateSession')}} {{$root.getLz('term.privateSession')}}
</div> </div>
<div class="md-option-segment md-option-segment_auto"> <div class="md-option-segment md-option-segment_auto">
<input type="checkbox" v-model="app.mk.privateEnabled" switch/> <input type="checkbox" v-model="$root.cfg.general.privateEnabled" v-on:change="$root.mk.privateEnabled = $root.cfg.general.privateEnabled" switch/>
</div> </div>
</div> </div>
<div class="md-option-line"> <div class="md-option-line">