Commit Graph

85 Commits

Author SHA1 Message Date
absidue 291aeff1a6
Migrate channel related functionality to YouTube.js (#3143)
* Migrate channel related functionality to YouTube.js

* Better alert handling

* Add support for special autogenerated channels

* Add support for latest YouTube.js changes

* Add support for age restricted channels

* Update YouTube.js to 3.0.0

* Obey hide search bar setting for the tag searching

* Choose a better parameter name

* Allow sharing terminated and age restricted channels

* Add handle support for handles on Invidious

* Fix the backend fallback

* Use a positive parameter name

Co-authored-by: PikachuEXE <pikachuexe@gmail.com>

* Fix duplicate tags causing errors

* Fix sorting for the Invidious API

* Move URL resolving to the channel page

* Update YouTube.js to 3.1.0

---------

Co-authored-by: PikachuEXE <pikachuexe@gmail.com>
2023-03-01 08:39:33 +08:00
Artur 38fe74a4c6
Fix external player not opening on Subscriptions page (#3172)
* Changed undefined to null

If playlistId is set to undefined it will break /src/renderer/store/modules/utils.js:openInExternalPlayer() as it expects null or string. Undefined makes it believe it is a playlist and ignores the videoId

* revert last commit

* Added tests for undefined in openInExternalPlayer()
2023-02-09 19:24:27 +01:00
ChunkyProgrammer 03f73c5d33
Move invidious out of stores (#3045)
* move invidious out of stores

* fix getting more replies & local api fallback for comments

* throw error if error message found in invidious response

* fix issue with data setting

* fix issue with replacing thumbnails

* add bank line, remove slash

* Apply suggestions from code review

Co-authored-by: absidue <48293849+absidue@users.noreply.github.com>

Co-authored-by: absidue <48293849+absidue@users.noreply.github.com>
2023-01-12 07:55:21 +01:00
ChunkyProgrammer 43a25f8738
update linters & add stylelint (#3023)
* update linters, add stylelint, switch from sass to scss

* remove unused babel-eslint module

* fix spacing in scss files

* dont use npm in script calls

* dont error for `:deep` selector in css
2023-01-03 19:19:41 +01:00
absidue 492ad19558
Make getVideoParamsFromUrl and showExternalPlayerUnsupportedActionToast helpers (#3018) 2023-01-01 03:52:49 +01:00
absidue 1d1e6eacea
Switch from sync fs APIs to fs/promises (#2991)
* Switch from sync fs APIs to fs/promises

* Fix error and await storyboard creation

* Start a new file for filesystem helpers starting with pathExists
2022-12-29 01:19:48 +00:00
petaded c79674d956
Support extra youtube embed playlist links (#2972)
* Fix strange embed playlist links missing /

* support embed/videoseries links

* remove duplicated replace line

Co-authored-by: petaded <code@zikl.co.uk>
2022-12-22 15:22:12 +01:00
absidue dd18634fdc
Pass playlist data from playlist page to watch page (#2970)
* Pass playlist data from playlist page to watch page

* Remove unused properties
2022-12-19 11:43:28 +01:00
absidue a88bafeb27
Make getUserDataPath, getPicturesPath and getSystemLocale helpers (#2920) 2022-12-06 12:37:44 +01:00
absidue d793a8bcda
Make replaceFilenameForbiddenChars a helper (#2904)
* Make replaceFilenameForbiddenChars a helper

* Use function for screenshot file name checking
2022-12-02 08:29:01 +01:00
absidue b3bf37132d
Replace lodash.isequal with simple comparison (#2827) 2022-11-05 15:13:25 +00:00
Emma 70baa873fb
Move `Dialog` functions to `utils/helpers` (#2752)
* Moving `FileFromDialog` helpers into helpers/utils

* Moving `showDialog` functions to `utils/helpers`

* Linting

* Update src/renderer/helpers/utils.js

Co-authored-by: absidue <48293849+absidue@users.noreply.github.com>

* Update refs  `showSaveDialog` in `ft-video-player`

* Formatting long import to be multiline

Co-authored-by: PikachuEXE <pikachuexe@gmail.com>

Co-authored-by: absidue <48293849+absidue@users.noreply.github.com>
Co-authored-by: PikachuEXE <pikachuexe@gmail.com>
2022-10-25 16:44:18 +02:00
Emma 6e693c6c37
Implement `getRegionData` in web (#2743)
* Implement `getRegionData` in web

- Adjust __dirname to be a more sensible value
- Add `process.env.GEOLOCATION_NAMES` for web builds to avoid having
to blindly try and fetch

* Reverting webpack changes

* Change `indexOf` to `includes`

Co-authored-by: absidue <48293849+absidue@users.noreply.github.com>

* Adding a new helper `createWebURL`

It takes a given path to a resource, and it returns an
 easily fetch-able absolute path

* Using `createWebUrl` inside of the locale fetch

* Using `createWebURL` inside of `getRegionData`

* Removing an unnecessary leftover import

* Wait, no I was mistaken

Co-authored-by: absidue <48293849+absidue@users.noreply.github.com>
2022-10-22 10:31:34 +02:00
ChunkyProgrammer 2c5c654b66
move `toLocalePublicationString` to`utils/helper` (#2748)
* move toLocalePublicationString to helper

* remove unnecessary assignments

Co-Authored-By: absidue <48293849+absidue@users.noreply.github.com>

* Update src/renderer/components/ft-list-video/ft-list-video.js

Co-authored-by: PikachuEXE <pikachuexe@gmail.com>

* fix linter issue

Co-authored-by: absidue <48293849+absidue@users.noreply.github.com>
Co-authored-by: PikachuEXE <pikachuexe@gmail.com>
2022-10-20 06:03:31 +00:00
Emma 41b3af033b
Implenting `showSaveDialog` in web (#2741)
* Implementing the web callback for `showSaveDialog`

Using the native filesystem API when it is available

* Adding the `writeFileFromDialog` function

It normalizes the behavior of writing to a file handle
given by a file picker between web and electron

* Refactoring `exportFreeTubeSubscriptions`

Now, it should use the profile data stored in memory
rather than reading it from the file system (which may not
be present in web browsers), and it should also work in web
builds

* Refactoring exportYouTubeSubscriptions

Using the `writeFileFromDialog` function instead of `fs`

* Refactoring the rest of the subscription exports

Using the `writeFileFromDialog` function instead of `fs`

* Refactoring exportHistory

- Using the historyCache stored in memory instead of
reading from `fs` to get the history data
- Using `writeFileFromDialog` instead of `fs.writeFile`

* Refactoring exportPlaylists

Using `writeFileFromDialog` instead of `fs`

* Removing no longer needed `fs` import

* Removing something I was using to debug

* Fixing issue with mime types non populating in save picker

* Adding back an unintentionally removed line
2022-10-19 07:50:21 +02:00
Emma a6b86fac9c
Adding filePaths to the web file picker response (#2739)
`filePaths` is now used to decide which `subscription.db`
type to parse, so this is needed here
2022-10-18 17:50:59 +02:00
absidue f970936d1e
Make copyToClipboard and openExternalLink helpers (#2722) 2022-10-18 08:15:28 +00:00
absidue ad01d2b37d
Make the safe as and open file dialogs blocking (#2712) 2022-10-14 06:00:23 +00:00
absidue 3aa080d707
Make showToast a helper (#2695) 2022-10-14 05:59:49 +00:00
absidue c0f98eeafe
Use named parameters instead of $ and % in localised strings (#2685)
* Use named parameters instead of $ and % in localised strings

* Fix URL warning again

* Update placeholders in most locales

* Let the translators fix the problematic RTL strings

* Fix the missing quotes in some of the YAML files
2022-10-13 11:51:15 +00:00
absidue bc8261d970
Move colours from the store to the utils helper (#2710)
* Move colours from the store to the utils helper

* Use a single array for colours
2022-10-12 06:49:12 +00:00
absidue 22a5062334
Move calculateColorLuminance, calculatePublishedDate and buildVTTFileLocally out of the store (#2692) 2022-10-10 07:45:18 +00:00
absidue fa8d423bc6
Fix some development code not getting optimised out (#2605) 2022-09-26 16:15:13 -04:00
Emma 1512178489
Implementing showOpenDialog's web callback (#2608)
* Implementing the open file dialog in web

- Adding a new function to make loading files
from a dialog box easier in both web and electron

* Canceled should always be false

onchange is only triggered when the file picker
has a file path. If the user cancels, this function
is never called.

* Changing from `function ()` to `() => {`

* Adding a try around processing the history import

* Moving the try-catch to a smaller section

* Adding a listener to when the file picker is closed

* Fixing the grammar on my comment

* Refactoring playlist imports to use readFileFromDialog

* Refactoring handleFreetubeImportFile to use readFileFromDialog

* Refactoring handleYoutubeCsvImportFile to use readFileFromDialog

* Refactoring handleYoutubeImportFile to use readFileFromDialog

* Refactoring importOpmlYoutubeSubscriptions to use readFileFromDialog

* Refactoring importNewPipeSubscriptions to use readFileFromDialog

* Added a check

to prevent resolve from being called multiple times

* Moving the call to removeEventListener

to prevent this event from being triggered twice

* Adding extensions to the web file picker

* Hiding `Check for legacy subscriptions` in web

* Adding comments for better readability

* Correcting my vue syntax
2022-09-23 12:15:49 -04:00
ChunkyProgrammer 7822f7423e
Remove console.logs (#2606)
* remove console.logs

* use 'off' instead of 0
2022-09-23 09:04:10 +08:00
Emma 25d954f990
Cleaning up calls to the Clipboard API (#2597)
* Added a copyToClipboard function to utils

This should make it easier to handle errors which
result from the clipboard API (which are more likely
in web builds). This should also make it easier to handle
copying to clipboard in cordova builds by abstracting the
platform specific code out of the views and moving it
all into one function.

* Moved the $t function out of utils

* Removing locale snippets I was using and am not now

* Added function comment to copyToClipboard

* Adding some missing references

* Adding an additional check

* Re-reviewing my changes, I found a mistake

* Update src/renderer/store/modules/utils.js

Co-authored-by: absidue <48293849+absidue@users.noreply.github.com>

* Update static/locales/en-US.yaml

Co-authored-by: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>

* Reverting the language back to what it was previously

* Switching to using i18n.t()

instead of handling the translations myself.
Also, it looks like eslint removed a tab.

Co-authored-by: absidue <48293849+absidue@users.noreply.github.com>
Co-authored-by: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com>
2022-09-21 15:00:21 +08:00
Emma c4722c9533
Implementing downloadMedia in web environments (#2602) 2022-09-21 08:00:34 +02:00
Emma 386b9c586b
Fixing an undefined function reference (#2586) 2022-09-17 14:43:11 +00:00
absidue 62829b736a
Electron variable at build time instead of at runtime (#2574) 2022-09-15 08:59:09 +00:00
9ekaitz f8eff0e422
External player choice 'None' translated in Settings (#2075)
* External player choice 'None' translated in Settings

* requested fix related to Vue i18n import

* suggested changes using translation key and fallback to player name
2022-08-10 17:52:31 -04:00
absidue 6334df0ad0
Fix channel page ID handling (#2457)
* Fix channel page ID check race condition

* Correctly handle the different channel ID types
2022-08-08 09:26:04 +00:00
Rekito e14a5796ba
Added Catppuccin Mocha Theme (#2395)
* Added Catppuccin Mocha Theme

* Corrected Catppuccin Mocha Theme Hover Colors

* Fix text overflow when selecting theme accent colors

Co-authored-by: Otiker <oportunityfly.imp+gitlab2@protonmail.com>
2022-07-20 09:44:47 +08:00
bob1520 c2ddac724d
Fix download filename problems (#2320)
* fix "illegal" filename and EISDIR

* check download folder exists
2022-06-21 09:43:45 +08:00
Svallinn b1183fe0c0
Utils+Everywhere: Add a start offset tolerance for the external player (#2325)
If a current video is practically over or the value in
the history's watch progress is almost the same as the length
of the video, it's safe to deduce that if the external player
button is clicked, the user is most likely just rewatching
the video, making no sense to pass a start offset to it
2022-06-19 18:02:57 +00:00
bob1520 330086e87c
add ? and * (#2319) 2022-06-15 22:41:38 +00:00
bob1520 ddce28e586
Feature: Screenshot of video (#2221)
* screenshot

* player settings, jpg & default "pictures" folder

* filename pattern

* folder placeholder update

* remove duplicate action

* update: won't save invalid pattern

* Ask for folder, toggle screenshot, modal showSaveDialog & button unfocus

* useModal
2022-05-30 15:24:34 +02:00
ChunkyProgrammer dfb28b1d69
Feat: SponsorBlock improvements (#1849)
* Add setting for each SB category

* Update SB Settings Component

* Show other SB categories in seek bar

* Use camelCase for SponsorBlock values

Co-authored-by: PikachuEXE <pikachuexe@gmail.com>

* change "Don't Skip" to "Do Nothing" in locale

* improve styling of sponsorblock settings

* add filler category, don't repeat colors

* Fix JS format issue caused during code conflict resolving

* make sponsor block markers transparent

* change opacity to 0.6

Co-authored-by: PikachuEXE <pikachuexe@gmail.com>
2022-05-29 22:36:59 +02:00
ChunkyProgrammer 4ba2cb29c6
Fix: trending cache (#2125)
* fix trending cache

* fix displaying trending from cache

* fix trending "resync"
2022-04-09 15:34:55 -04:00
bob1520 dc4a828820
Fix addToSessionSearchHistory (#2124)
payload.data is already concatenated in Search.js
2022-03-26 09:20:22 +08:00
Preston cd574be4e7 Stats for nerds cleanup and fix linter errors 2022-02-19 17:17:58 -05:00
PrestonN 36dfb7849d Refactor video download logic 2022-02-01 22:11:38 -05:00
constraintAutomaton 609996d175
In app download (#1971)
* src/renderer/store/modules/utils.js, src/renderer/components/watch-video-info/watch-video-info.vue, src/renderer/components/watch-video-info/watch-video-info.js, src/renderer/components/ft-icon-button/ft-icon-button.js, src/main/index.js

in-app download in hardcoded path

* download into variable folder supported

download can be done into a specify folder defined in the  settings or can be done by choosing a folder just before the downloading

* src/renderer/store/modules/utils.js: folder is asked before downloading when appropriate

* src/renderer/store/modules/utils.js: toast added for success and faillure

* src/renderer/store/modules/utils.js: mecanism to show download progress

* src/renderer/store/modules/utils.js: percentage symbol added to toast message when displaying progress

* src/renderer/components/download-settings/download-settings.js: clarification comment about electron

* src/renderer/store/modules/utils.js: typo in comment resolved

* src/renderer/store/modules/utils.js: show a toast when there is a file error

* static/locales/fr-FR.yaml: resolved typo in Choose Path

* src/renderer/store/modules/utils.js: download progress notification toast deleted

* corrections of typos, changes in toast messages, toast messages translatable by modifying the ft-toast component to allow translatable strings

* cleaner code for translatable toast

* downloadMedia argument changed from array to object

* src/renderer/components/download-settings/download-settings.sass: trailling space added

* Apply suggestions from code review

folder changed for folderPath

Co-authored-by: PikachuEXE <pikachuexe@gmail.com>

* fix forgotten folderPath renaming

* extra space deleted

* starting toast displayed after download folder asks

* audio button deleted

* experimental electron web library deleted because can cause performance issues

* placeholder for web support

* made better condition for web and electon compatibility and small variable renaming

* better error message when user cancel the download

* falling back to asking the user if the download repository doesn't exist

* falling back mode implemented

* console.log for debugging deleted

* useless import deleted

* small renaming

Co-authored-by: PikachuEXE <pikachuexe@gmail.com>
2022-01-30 12:49:16 -05:00
Svallinn daecf944fb
Store Revamp / Full database synchronization across windows (#1833)
* History: Refactor history module

* Profiles: Refactor profiles module

* IPC: Move channel ids to their own file and make them constants

* IPC: Replace single sync channel for one channel per sync type

* Everywhere: Replace default profile id magic strings with constant ref

* Profiles: Refactor `activeProfile` property from store

This commit makes it so that `activeProfile`'s getter returns
the entire profile, while the related update function only needs
the profile id (instead of the previously used array index)
to change the currently active profile.

This change was made due to inconsistency regarding the active profile
when creating new profiles.
If a new profile coincidentally landed in the current active profile's
array index after sorting, the app would mistakenly change to it
without any action from the user apart from the profile's creation.
Turning the profile id into the selector instead solves this issue.

* Revert "Store: Implement history synchronization between windows"

This reverts commit 99b61e6178.

This is necessary for an upcoming improved implementation of the
history synchronization.

* History: Remove unused mutation

* Everywhere: Create abstract database handlers

The project now utilizes abstract handlers to fetch, modify
or otherwise manipulate data from the database.

This facilitates 3 aspects of the app, in addition of
making them future proof:

- Switching database libraries is now trivial
Since most of the app utilizes the abstract handlers, it's incredibly
easily to change to a different DB library.
Hypothetically, all that would need to be done is to simply replace the
the file containing the base handlers, while the rest of the app
would go unchanged.

- Syncing logic between Electron and web is now properly separated
There are now two distinct DB handling APIs: the Electron one and
the web one.
The app doesn't need to manually choose the API, because it's detected
which platform is being utilized on import.

- All Electron windows now share the same database instance
This provides a single source of truth, improving consistency
regarding data manipulation and windows synchronization.

As a sidenote, syncing implementation has been left as is
(web unimplemented; Electron only syncs settings, remaining
datastore syncing will be implemented in the upcoming commits).

* Electron/History: Implement history synchronization

* Profiles: Implement suplementary profile creation logic

* ft-profile-edit: Small fix on profile name missing display

* Electron/Profiles: Implement profile synchronization

* Electron/Playlists: Implement playlist synchronization
2021-12-15 13:42:24 -05:00
PrestonN 7ea86ef74d Add Dracula Colors to Util store 2021-11-11 15:54:08 -05:00
ChunkyProgrammer 9bf4742cf9
Recognize more channel links (#1455)
* Update channelPattern regex

* redirect to relevant sub page

* Simplify regex

Co-authored-by: PikachuEXE <pikachuexe@gmail.com>

* fix regression

- fix regression from commit 76f0d7512a
- add comment to explain regex

Co-authored-by: Preston <freetubeapp@protonmail.com>
Co-authored-by: PikachuEXE <pikachuexe@gmail.com>
2021-11-02 11:45:50 +00:00
kuhaku 3cf18b9f2d
Add support for the 'defaultCustomArguments' external player mapping field (#1415)
* feat(store/utils): add support for the `defaultCustomArguments` external player mapping field
improve(store/utils): move custom arguments evaluation to the top in `openInExternalPlayer`
improve(components/external-player-settings): conditionally append the default custom arguments to the tooltip

Signed-off-by: Randshot <randshot@norealm.xyz>

* fix(components/external-player-settings): fix lint error
chore(components/external-player-settings): remove unnecessary console log

Signed-off-by: Randshot <randshot@norealm.xyz>

* chore(static/external-player-map): add new `defaultCustomArguments` field to vlc map

Signed-off-by: Randshot <randshot@norealm.xyz>
2021-10-07 06:29:43 +00:00
ChunkyProgrammer 1ceb21f424
load shorts links (#1605) 2021-08-22 16:25:14 +00:00
ChunkyProgrammer 011ee17711
[Feature] Add trending pages for music, gaming & movies (#1483)
* Add other trending pages

* Add better formatting

* fixed trending cache

* Fix Trending page title

Changes in PR #1321 make this necessary

* update locale files

* add accessibility improvements

accessibility improvements

* focus tab on reload

Co-authored-by: Preston <freetubeapp@protonmail.com>
2021-08-21 23:08:38 +02:00
Svallinn d3e6d57f20
Main+Utils: Rename `getLocale` function to `getSystemLocale` 2021-06-20 02:47:33 +01:00
kuhaku 52fa523df1
Add support for External Players (closes #418) (#1271)
* 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 28b4713334.

* 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>
2021-06-13 17:31:43 +02:00