Skip to content

Commit

Permalink
Fix token update error
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeydarrenlau committed Feb 6, 2024
1 parent 5128e67 commit 95754c0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
6 changes: 4 additions & 2 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ export default class ObsidianSpotify extends Plugin {
console.log("[" + manifest.name + "] Spotify Token Refreshed")
window.spotifysdk = SpotifyApi.withAccessToken(setting.spotify_client_id, data);
}
var TIMEOUT = 20000;
var TIMEOUT = 2000;
var lastTime = (new Date()).getTime();

window.addEventListener("online", async () => {
window.addEventListener("offline", async () => {
// Handle online event here
console.log("[" + this.manifest.name + "] Now offline, refreshing Spotify Token after online and restting timer")
});
Expand All @@ -109,10 +109,12 @@ export default class ObsidianSpotify extends Plugin {
console.log("[" + this.manifest.name + "] Refreshing Spotify Token after online and restting timer")
await refreshspot(this.settings, this.manifest)
clearInterval(sharedstuff.get("spotifyrefreshtimer"))
setTimeout( async () => {
let spotifyrefreshtimer = setInterval( async () => {
await refreshspot(this.settings, this.manifest)
}, 3600000)
sharedstuff.set("spotifyrefreshtimer", spotifyrefreshtimer)
}, TIMEOUT)

})

Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"authorUrl": "https://github.com/Darren-project",
"fundingUrl": "https://www.buymeacoffee.com/mickeydarrenlau",
"isDesktopOnly": false,
"version": "1.1.0"
"version": "1.1.1"
}
2 changes: 1 addition & 1 deletion version-bump.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { readFileSync, writeFileSync } from "fs";

const targetVersion = "1.1.0";
const targetVersion = "1.1.1";

// read minAppVersion from manifest.json and bump version to target version
let manifest = JSON.parse(readFileSync("manifest.json", "utf8"));
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"1.0.7": "0.15.0",
"1.0.8": "0.15.0",
"1.0.9": "0.15.0",
"1.1.0": "0.15.0"
"1.1.0": "0.15.0",
"1.1.1": "0.15.0"
}

0 comments on commit 95754c0

Please sign in to comment.