diff --git a/renderer/index.js b/renderer/index.js index d0b088b1..bd2f9732 100644 --- a/renderer/index.js +++ b/renderer/index.js @@ -163,13 +163,7 @@ function dispatch (action, ...args) { if (action === 'back') { // TODO // window.history.back() - if (state.url === '/player') { - restoreBounds() - closeServer() - } - state.url = '/' - state.title = config.APP_NAME - update() + closePlayer() } if (action === 'forward') { // TODO @@ -404,6 +398,17 @@ function openPlayer (torrent) { }) } +function closePlayer () { + state.url = '/' + state.title = config.APP_NAME + if (state.isFullScreen) { + electron.ipcRenderer.send('toggleFullScreen') + } + restoreBounds() + closeServer() + update() +} + function deleteTorrent (torrent) { var ix = state.saved.torrents.findIndex((x) => x.infoHash === torrent.infoHash) if (ix > -1) state.saved.torrents.splice(ix, 1)