Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

Commit

Permalink
fix stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianPetkovsek committed Nov 29, 2019
1 parent f50819e commit ffcb831
Show file tree
Hide file tree
Showing 9 changed files with 125 additions and 4 deletions.
69 changes: 69 additions & 0 deletions YouTube_social_white_square_(2017).svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icon.ico
Binary file not shown.
26 changes: 26 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,30 @@ app.on('ready', () => {

app.on('window-all-closed', () => {
app.quit();
});

//stops extra app instances from opening
var shouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) {
// Someone tried to run a second instance, we should focus our window.
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore();
mainWindow.focus();
}
});

if (shouldQuit) {
app.quit();
return;
}

//only allows one electron window open
var iSWindowOpen = false;
app.on('browser-window-created', function(event, window) {
if (iSWindowOpen){
window.loadURL('javascript:window.close();');
console.log("Close new window");
}else{
iSWindowOpen = true;
console.log("Open one window");
}
});
5 changes: 3 additions & 2 deletions modules/youtube-js/get-youtube.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ async function injectRun(mainWindow) {
let now = moment.utc(),
remaining = moment.duration(videoDuration - videoCurrentTime, 'seconds');
endTimestamp = now.add(remaining).unix();
global.hasSeeked = videoCurrentTimeTemp != Math.floor(endTimestamp)
videoCurrentTimeTemp = Math.floor(endTimestamp)
global.hasSeeked = global.videoCurrentTimeTemp != Math.floor(endTimestamp)
global.videoCurrentTimeTemp = Math.floor(endTimestamp)

rpcData.endTimestamp = endTimestamp;
rpcData.state = 'By: '+ creator;
Expand All @@ -88,6 +88,7 @@ async function injectRun(mainWindow) {
rpcData.details = 'browsing';
rpcData.state = 'idle';
}

if (global.hasSeeked){
//update with endTimestamp has seeked
global.hasSeeked = false;
Expand Down
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "YouTube",
"github_repository": "discord-youtube",
"version": "1.2.0",
"version": "1.2.2",
"description": "A YouTube wrapper with Discord Rich Presence",
"main": "main.js",
"scripts": {
Expand Down Expand Up @@ -50,6 +50,7 @@
},
"homepage": "https://github.com/BrianPetkovsek/discord-youtube#readme",
"dependencies": {
"bad-words": "^1.6.4",
"discord-rpc": "^3.0.0",
"electron-widevinecdm": "^5.0.2",
"moment": "^2.22.2",
Expand Down
10 changes: 9 additions & 1 deletion updating.html
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
<html><body>This app is downloading and installing an update please wait!</body></html>
<html>
<p>
This app is downloading and installing an update please wait!
</p>
<p>
If app taking a long time to update please download the latest release from GitHub.
</p>
<a href="https://github.com/BrianPetkovsek/discord-youtube/releases/latest">GitHub</a>
</html>
Binary file removed youtube.png
Binary file not shown.
Binary file added youtube_png.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ffcb831

Please sign in to comment.