Skip to content

Commit

Permalink
Merge pull request #449 from Araxeus/fix-resume-on-start
Browse files Browse the repository at this point in the history
set resume on start url to songInfo.url
  • Loading branch information
th-ch authored Nov 1, 2021
2 parents a47c906 + 43a9093 commit e2bbc6a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
7 changes: 0 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,6 @@ app.once("browser-window-created", (event, win) => {
event.preventDefault();
});

win.webContents.on("did-navigate-in-page", () => {
const url = win.webContents.getURL();
if (url.startsWith("https://music.youtube.com")) {
config.set("url", url);
}
});

win.webContents.on("will-navigate", (_, url) => {
if (url.startsWith("https://accounts.google.com")) {
// Force user-agent "Firefox Windows" for Google OAuth to work
Expand Down
5 changes: 5 additions & 0 deletions providers/song-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const { ipcMain, nativeImage } = require("electron");

const fetch = require("node-fetch");

const config = require("../config");

// Grab the progress using the selector
const getProgress = async (win) => {
// Get current value of the progressbar element
Expand Down Expand Up @@ -56,6 +58,9 @@ const handleData = async (responseText, win) => {
songInfo.uploadDate = data?.microformat?.microformatDataRenderer?.uploadDate;
songInfo.url = data?.microformat?.microformatDataRenderer?.urlCanonical?.split("&")[0];

// used for options.resumeOnStart
config.set("url", data?.microformat?.microformatDataRenderer?.urlCanonical);

win.webContents.send("update-song-info", JSON.stringify(songInfo));
};

Expand Down

0 comments on commit e2bbc6a

Please sign in to comment.