mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-14 20:01:47 +00:00
Merge pull request #449 from Araxeus/fix-resume-on-start
set resume on start url to songInfo.url
This commit is contained in:
7
index.js
7
index.js
@ -197,13 +197,6 @@ app.once("browser-window-created", (event, win) => {
|
|||||||
event.preventDefault();
|
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) => {
|
win.webContents.on("will-navigate", (_, url) => {
|
||||||
if (url.startsWith("https://accounts.google.com")) {
|
if (url.startsWith("https://accounts.google.com")) {
|
||||||
// Force user-agent "Firefox Windows" for Google OAuth to work
|
// Force user-agent "Firefox Windows" for Google OAuth to work
|
||||||
|
|||||||
@ -2,6 +2,8 @@ const { ipcMain, nativeImage } = require("electron");
|
|||||||
|
|
||||||
const fetch = require("node-fetch");
|
const fetch = require("node-fetch");
|
||||||
|
|
||||||
|
const config = require("../config");
|
||||||
|
|
||||||
// Grab the progress using the selector
|
// Grab the progress using the selector
|
||||||
const getProgress = async (win) => {
|
const getProgress = async (win) => {
|
||||||
// Get current value of the progressbar element
|
// Get current value of the progressbar element
|
||||||
@ -56,6 +58,9 @@ const handleData = async (responseText, win) => {
|
|||||||
songInfo.uploadDate = data?.microformat?.microformatDataRenderer?.uploadDate;
|
songInfo.uploadDate = data?.microformat?.microformatDataRenderer?.uploadDate;
|
||||||
songInfo.url = data?.microformat?.microformatDataRenderer?.urlCanonical?.split("&")[0];
|
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));
|
win.webContents.send("update-song-info", JSON.stringify(songInfo));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user