Previously, the code misleadingly lead developers to believe that
each 'BrowserWindow' had its own isolated session.
This commit clarifies the fact that a global session is shared
by all 'BrowserWindow's by default.
This should fix an issue where, when closing the app, an error window
would very occasionally pop up declaring that 'getNormalBounds'
was called on an undefined variable.
* feat: add support for opening videos/playlists in external players (like mpv) #418
Signed-off-by: Randshot <randshot@norealm.xyz>
* feat: move external player settings into own section
feat: add warnings for when the external player doesn't support the current action (e.g. reversing playlists)
feat: add toggle in settings for ignoring unsupported action warnings
Signed-off-by: Randshot <randshot@norealm.xyz>
* improvement: do not append start offset argument when the watch progress is 0
Signed-off-by: Randshot <randshot@norealm.xyz>
* fix: fix undefined showToast error when clicking on the external player playlist button
Signed-off-by: Randshot <randshot@norealm.xyz>
* feat: add icon button for external player to watch-video-info (below video player) component
improvement: refactor the code for opening the external player into a separate function in utils.js
Signed-off-by: Randshot <randshot@norealm.xyz>
* feat: add support for ytdl protocol urls (supportsYtdlProtocol)
chore: fix lint error
Signed-off-by: Randshot <randshot@norealm.xyz>
* feat: add support for passing default playback rate to external player
improvement: add warning message for when the external player does not support starting playback at
a given offset
chore: rename reverse, shuffle, and loopPlaylist fields for consistency
Signed-off-by: Randshot <randshot@norealm.xyz>
* feat: add setting for custom external player command line arguments
Signed-off-by: Randshot <randshot@norealm.xyz>
* chore: fix lint error
Signed-off-by: Randshot <randshot@norealm.xyz>
* improvement(watch-video-info.js): change the default for playlistId back to null (consistent with other occurrences)
improvement(utils.js/openInExternalPlayer): also check for empty playlistId string
fix(watch-video-info.js): fix merge error
Signed-off-by: Randshot <randshot@norealm.xyz>
* improvement(components/ft-list-video): check whether watch history is turned on, before adding a video to it
fix(store/utils): fix playlistReverse typo, causing `undefined` being set as a command line argument
fix(store/utils): check for 'string' type, instead of `null` and `undefined`
fix(views/Watch): fix getPlaylistIndex returning an incorrect index, when reverse was turned on
chore(locales/en-US): fix thumbnail and suppress typo
chore(locales/en_GB): fix thumbnail and suppress typo
Signed-off-by: Randshot <randshot@norealm.xyz>
* feat: pause player when opening video in external player
Signed-off-by: Randshot <randshot@norealm.xyz>
* feat(externalPlayer): refactor externalPlayerCmdArguments into a separate static file `static/external-player-map.json`
chore(components/ft-list-video): fix lint error
Signed-off-by: Randshot <randshot@norealm.xyz>
* Revert "feat: pause player when opening video in external player"
This reverts commit 28b4713334bf941be9e403abf517bb4b89beb04f.
* feat: pause the app's player when opening video in external player
* This commit addresses above requested changes.
improvement(components/external-player-settings): move `externalPlayer` check to `ft-flex-box`
improvement(components/external-player-settings): use `update*` methods, instead of `handle*`
improvement(store/utils): move child_process invocation to `main/index.js` via IPC call to renderer
improvement(store/utils): use `dispatch` for calling actions
improvement(store/utils): get external player related settings directly in the action
improvement(renderer/App): move `checkExternalPlayer` call down into `usingElectron` if statement
fix(renderer/App): fix lint error
improvement(components/ft-list-playlist): remove unnecessary payload fields
fix(components/ft-list-playlist): fix typo in component name
improvement(components/ft-list-video): remove unnecessary payload fields
improvement(components/watch-video-info): remove unnecessary payload fields
improvement(views/Settings): add `usingElectron` condition
Signed-off-by: Randshot <randshot@norealm.xyz>
* fix(store/utils): fix toast message error
Signed-off-by: Randshot <randshot@norealm.xyz>
* fix(store/utils): fix a few code mess-ups
Co-authored-by: Svallinn <41585298+Svallinn@users.noreply.github.com>
When syncing a setting between windows, if that setting has any
side effects, a trigger is fired in all other windows to perform
those side effects in their own environment.
Previously, a custom Map was provided to the function in order to
determine whether or not a setting contained side effects that needed
to be handled.
That Map has now been deleted and the function has been modified
to make use of the module's new architecture.
Previously, the settings' module was not properly equipped to handle
setting updates that featured certain side effects and no way to
propagate those side effects to other windows.
This redesign is a direct answer to those needs, in preparation to
move these settings and related logic to the aproppriate structures,
which will be done over the course of several commits.
A more in-depth documentation of the current redesign can be found at
the top of the settings module file.
The app utilizes the Electron IPC to communicate settings' updates
to the other existing windows.
This is still at a fairly rudimentary stage, since some settings are
not syncing at all, while other settings have related side effects that
are not currently being propagated to the remaining windows.
An example of this would be the 'uiScale' setting, in which
the value is properly synced, but the app's actual scaling isn't.
This fixes a bug related to the presentation of the `defaultVolume`
value in its respective label in the Settings view.
Since the value stored in the database and in the in-memory store
is a decimal number, it is subject to floating point arithmetic related
limitations.
Example (processed by the V8 engine):
0.28 * 100 = 28.000000000000004
This commit removes duplicated handler logic related to the app's
'ready' event. In addition, it rearranges the template used to build the
app's menu in order to make it a bit easier to understand.
This function made use of a switch statement that was hundred of
lines in height and a majority of cases had similar logic.
This commit generalizes the logic of the majority of the cases into
a condensed for loop, which additionally handles the few existing
oddball cases in an easy-to-understand manner.
The 'grabUserSettings' action calls the 'updateInvidiousInstance'
action whenever the database returns an empty value for this setting.
However, that scenario should never happen in the first place.
In addition, a default value is already provided directly in the state.