Electron already has a built-in tracker for all opened windows,
so it makes no sense to have custom code to handle it.
One should always use what is given to you :^)
There are now two separate settings related to Invidious instances:
- currentInvidiousInstance
- defaultInvidiousInstance
'currentInvidiousInstance' is a value that exists solely in memory
and it's the value used by the app to make the API calls,
while 'defaultInvidiousInstance' is the value that can be persisted
in the database by user action and will be used to initiate
the 'currentInvidiousInstance' on startup.
If the user has not saved a default value to the database,
'currentInvidiousInstance' is randomized from
a fetched list of viable candidates.
This commit renames the 'syncSettings' IRC channels to 'syncWindows' and
changes the renderer's listener setup for this channel more generic
so that it can cover other store modules besides the settings' module.
Most actions in the history module would grab the history from disk
every time the history was updated and updated the cache this way.
This commit makes these actions perform these modifications in memory
instead of unnecessarily reaching into the disk.
This commit moves the locale relevant code to the settings' store module
and incorporates it with its current architecture.
I should clarify that this makes the value present in the `localStorage`
nonmeaningful, as that value is no longer being used in any way.
The 'nedb' package is unmaintained (last update was 5 years ago) and
has a couple of high severity vulnerabilities.
In addition, the use of callbacks is somewhat cumbersome for
the project's current workflow.
Therefore, I've decided to replace it with the 'nedb-promises' package,
which, internally, makes use of a maintained fork of 'nedb' and
wraps its API with Promises.
The 'markdown' package is unmaintained (last update was 8 years ago)
and has a low severity vulnerability, so it makes sense to replace it
with 'marked', which is actively maintained and very small in size.
Smooth scrolling toggling is currently wonky on runtime, since,
most of the time, it doesn't toggle on and off properly.
In addition, now that we have multi-window support,
the current implementation was somewhat lacking.
This commit solves those issues by replacing
the existing smooth scrolling related channels with a
new generic `relaunchRequest` channel.
Since the session is shared by all 'BrowserWindow's and
it can be accessed without a window reference,
it's best to clear data when the 'window-all-closed' event is emitted.
With the knowledge that the session is shared by all 'BrowserWindow's,
proxy and cookie related logic can now be set once on startup and
it's not necessary to set them again for every window created.
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.
The settings' store module has had a lot of duplicated logic for
the majority of its getters, mutations and actions.
This commit serves to remedy that duplication substantially
by auto generating all getters, mutations and the majority
of actions, using a predictable pattern.
* * Update Youtube URL handling to recongnize playlist ID in URL
Only for format of `https://www.youtube.com/watch?v=vid&list=lid`
* ! Fix vue component prop declaration
A prop where the value can be undefined cannot be declared "required"
* Added toggle component to settings
* Setting to toggle this feature is now functional. Video volume can now be changed by scrolling anywhere on the video, or just on the slider, depending on this setting
* Added translation lines for en_US and en_GB
* Changed setting line from 'Scroll Volume Over Video' to 'Scroll Volume Over Video Player'
* Changed 'mousewheel' to 'wheel' event, as 'mousewheel' is deprecated
* Ran lint check in settings.js
Co-authored-by: Alex Stewart <albinexotech@gmail.com>
* ! Fix app unable to load due to missing `getLocale` in `mapActions`
* $ Update a function's name with incorrect name casing
* Update "open youtube link" button to open with playlist when playing a video with an active playlist
The `remote` module is deprecated and `@electron/remote` is unnecessary,
since the `ipcMain` and `ipcRenderer` can replace their functionality,
providing better performance and better security.
All other dangerous calls (mainly pulling main process constructs into
the renderer process) have also been removed.
Closes: #1299
Previously, the app would notified the user (with a toast) of a
sponsor segment skip repeatedly if the segment lasted
until the end of a video.
This commit fixes that behavior so that it's displayed only once.
Closes: #1268
Having 'system' locale set would wrongfully send the wrong
locale information to YouTube, which would result in the captions
not being set properly. This commit fixes that behavior.
This prevents the CONSENT cookie from being deleted after a window
is closed by the user, making it so that the user can no
longer load the comment section.
Closes: #1205
* Added "Follow System" option to
`Settings -> General Settings -> Locale Preference`
and set it to default
* Changed double quotes to single quotes
* Removed unnecessary comment
* Changed `app` accessing method
* Cleaned up if/else statements
* Checks similar locales as fallback
* Changed label to "System Language"
* Changed locale filtering logic to use the filter() method
* Bump electron version to 12.0.6
* Move web content clean up logic to window close event
Reference from electron release notes:
> Fixed the window-all-closed event being emitted while the last
BrowserWindow was still in the process of being closed.
The interval to play the next video in a playlist was dynamic and
wasn't applied to the normal autoplay timer.
This commit merges the logic of these two scenarios so that they both
utilize the user-defined interval.
* $ Extract function which extract details from a Youtube URL
* * Update top nav handling to use extract function to handle input text if it's Youtube URL
* - Remove no longer used function
* Handle /user channel URL type
* Fix minor problems with the regexps
* Display informational toasts for hashtag and unknown URL types
* Add toast messages to the default locale
Closes: #1207
The app was mistakenly only set up to handle video type urls from
the freetube:// protocol.
It should now be able to additionally handle playlist, search and
channel type as well.
This allows users to specify the timestamp of a video (in seconds)
- by inputting a link into the search bar
- by making use of the protocol link (freetube://), p.e in a browser
When pulling video information from Invidious, hashtag-related links present in the description need to be replaced with valid links.
In this case, a freetube:// link was deemed the most appropriate.
Fixes#932
* Delete FtProfileAllChannelsList component
* Replace FtProfileAllChannelsList component with new filtered variant
* Add new locale for profile filter label
* Add FtProfileFilterChannelsList vue component with ft-select addition
* Add FtProfileFilterChannelsList script with profile filtering support
* Add css modifications to new FtProfileFilterChannelsList component
* Revamp about page
* Add more cards to about page
* Fix linter issues
* Add missing info and update locales
* Add license URL
Co-authored-by: Preston <freetubeapp@protonmail.com>
* Correctly bind theatre mode options
Theatre mode is now bound to both "recommended videos" and "live chat"
distraction settings, rather than just "recommended videos".
The settings switch, the button, and the layout have all been updated
to reflect this.
Most likely closes: https://github.com/FreeTubeApp/FreeTube/issues/910
* Fix watch layout when no sidebar
If there's nothing to display in the sidebar according to the
distraction settings and live status, the watch page will adopt a
single column layout. If the sidebar still exists due to faulty logic,
it will be placed at the very bottom of the page.
Most likely closes: https://github.com/FreeTubeApp/FreeTube/issues/909
* Unlink default theatre mode switch
* Normalise theatre calculation, consider playlists
* Reorder and resize playback rate menu
Reorder playback rate from 3->0.25 to 0.25->3 and resize to include an additional visible playback rate (0.25->1.5)
* Add Keybind (D) to Toggle Picture-In-Picture Mode
* Revert "Reorder and resize playback rate menu"
This reverts commit dacf1e9aa54e6d9d1bfe6ab79b561fd10f2b9ca3.
* Added (s) keybind to toggle Full Window
* Add description for (S) key
* Fixed weird Git things during rebase
Git injected some weird text during the rebase and duplicated a commit.
Hopefully that's just my messing up the rebase and it won't happen in the future.
* add functionality in fl-video-player and styles in videoJS.css, with the aim of having a full window button in the video player
Signed-off-by: CristianMartin <c.knoxville8@gmail.com>
* fixed up interposition with full screen
Signed-off-by: CristianMartin <c.knoxville8@gmail.com>
* incorporation of styles for the full window button, and general refactor of the functional code of the button in the ft-video-player.js class
Signed-off-by: CristianMartin <c.knoxville8@gmail.com>
* Incorporation of the icons for the full window button in the path src/renderer/assets/img/, incorporation of the icons to the css and style refactor in the code of the functionality window for the complete button
Signed-off-by: CristianMartin <c.knoxville8@gmail.com>
* final bug fix with npm run lint-fix and test run
Signed-off-by: CristianMartin <c.knoxville8@gmail.com>
* Update ft-video-player.js
Code refactor according to the suggestions of change in the extraction, modification of the position of the buttons of fullscreen and fullwindow as suggested.
* lint error repair
* Update videoJS.css
incorporation of css styles to correctly center the icon of the new fullwindow button
* Fail-Safe fix when author data of video is missing
* Fixed linter issues by replacing hasownproperty with in
* Implemented Prestons addition for the user thumbnail
* Added frame by frame advance functionality.
* Changed keybindings for frame by frame advancing.
* Fix comments.
* On Invidious videos using dash at high qualities the default is now skipping 1 frame at 60fps instead of 30fps. Avoided error on trying to read non-local dash manifest.
* On dash reading error, defaults to 60fps within determineMaxFramerate. maxFrameRate initialised in data object.
* Cleanup of framebyframe logic.
1. Handle open-url events.
2. Make protocol handling more robust on Win/Linux based on SO post.
3. Change 'ping' message to more descriptive 'openUrl' message.
4. Remove freetube:// protocol in main, and unify URL handling logic.
* Update player-settings.vue
Replaced the LATIN SMALL LETTER X with the correct MULTIPLICATION SIGN
* Update ft-slider.js
Added a SPACE character as separator between "value" and "extension".
* Update ft-slider.vue
Changed the "SPACE" and "HYPHEN" characters with the "COLON" character, in order to prevent values to look like they where negative.
* Update ft-search-filters.vue
- Removed CSS class "radioMargin" for "Time" and "Type". This class does not seem to be defined anywhere!
- Substituted CSS class "radioMargin" with "searchRadio" for "Duration", so the div aligns correctly.
* Update ft-slider.js
Removed SPACE character between "currentValue" and "valueExtension"