Commit graph

46 commits

Author SHA1 Message Date
kingbri
646c22c9be Debrid: Fix UI updates with auth
If a debrid is authorized, a Published variable needs to be notified
since SwiftUI can't read computed properties on the fly (they are
getters). Therefore, it's better to maintain a single source of truth
of which services are logged in.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-16 15:00:35 -05:00
kingbri
5223c60acd Tree: Fix various bugs
- AllDebrid: Don't throw an empty error if cloud downloads/torrents
is empty
- Fix history not saving with the proper URLs
- Fix the HTMLParser looking at the incorrect term for seedLeech

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-16 15:00:35 -05:00
kingbri
3ef041f889 Tree: Format
Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-16 15:00:35 -05:00
kingbri
ecdd0199f6 Tree: Cleanup access levels
Public should not be used in an app since it declares public to
additional modules. However, an app is one module. Some structs/
classes need to be left public to conform to CoreData's generation.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-16 15:00:35 -05:00
kingbri
d8107cb5b6 Sources: Add queryFirstLetter param
Stopgap for index-based sources. For example, the keyword "John"
will be converted to "j" for sources that use "/j/John".

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-16 15:00:35 -05:00
kingbri
42e202b207 Plugins: Add request options to sources
Adds HTTP method, headers, and a body string. Also use a common
function to substitute params rather to allow for maintanence of a
common dictionary.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-16 15:00:35 -05:00
kingbri
07731e7b00 Debrid: Migrate more components to the protocol
Protocols can't be used in ObservedObjects. Observable in iOS 17
and up solves this, but Ferrite targets iOS 16 and up, so add a
type-erased StateObject which supports protocols.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-16 15:00:35 -05:00
kingbri
b80f8900b7 Debrid: Allow for UI updates
Mark as an ObservableObject so the UI can see parameters that are
being updated in the class.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-16 15:00:35 -05:00
kingbri
46e0687bd7 Scraping: Add new source methods
Some sources can be unique and require some extra parsing. Add the
ability to extract a magnet link instead of assuming that every
source provides a properly formatted one.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-06-06 20:09:43 -04:00
kingbri
9e362c14b7 Ferrite: Format
Signed-off-by: kingbri <bdashore3@proton.me>
2023-04-23 15:43:45 -04:00
kingbri
468d89b983 Scraping: Add configurable URLRequest timeout
Some websites and networks may be slow. Add the option to override
the request timeout of 15 seconds for search requests.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-04-23 15:43:42 -04:00
kingbri
df534327e5 Scraping: Fix JSON scraping with subResults
SubResults were nullified by new title and magnet checks since they
were removed on the first pass.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-04-12 18:13:09 -04:00
kingbri
75be076e0b Search: Fix keyboard lag with searchText
Make searchText a local variable passed to ScrapingModel to prevent
extreme keyboard lag and CPU usage when tracking this EnvironmentObject.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-04-09 21:37:14 -04:00
kingbri
4f303e1c1e Filters: Fix source filtering
Make it so that when a user chooses a source to filter, only filter
that specific source when a search occurs.

Also fix the "no results found" overlay text by checking if the
search bar textfield is being edited or not by modifiying ESSearchable.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-04-09 21:37:07 -04:00
kingbri
9427ca271b Ferrite: Format
Signed-off-by: kingbri <bdashore3@proton.me>
2023-04-09 00:12:43 -04:00
kingbri
d918039810 Plugins: Add website and about properties
These will serve as descriptions for a plugin which will be displayed
in the Plugin Info screen.

website has also replaced baseUrl and dynamicWebsite has replaced
dynamicBaseUrl

Signed-off-by: kingbri <bdashore3@proton.me>
2023-04-02 14:53:22 -04:00
kingbri
51366f3215 Sources: Don't require searchUrl in HTML parser
searchURL used to be a required variable in HTML parsers, but some
HTML sources can be single page which means that a search URL isn't
required.

Also make regex matching case insensitive along with adding anchors
to match newlines.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-04-01 23:19:15 -04:00
kingbri
2cf6e46422 Sources: Improve regex and require title
Titles are now required as an entry without a title shouldn't be
featured. Support via regex is now added for matching along with
splicing strings via capture groups.

If a capture group isn't present, assume that a contains check
is occurring.

Also migrate back to searchText being located in scrapingModel.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-04-01 14:12:43 -04:00
kingbri
7202a95bb2 Ferrite: Parallel tasks and logging
Make all tasks run in parallel to increase responsiveness and efficiency
when fetching new data.

However, parallel tasks means that toast errors are no longer feasible.
Instead, add a logging system which has a more detailed view of
app messages and direct the user there if there is an error.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-03-09 18:48:28 -05:00
kingbri
438e48be66 Ferrite: Format
Signed-off-by: kingbri <bdashore3@proton.me>
2023-03-03 15:09:34 -05:00
kingbri
cbe3d17be1 Ferrite: Fix search and add progressive loading
The searchbar had a lot of lag when scrolling down the search
results view. This was due to a shared searchText variable which
updated every time the searchbar text changed and caused UI blocking.

Migrate searchText to a local variable and destroy the child
SearchResultsView as it's not needed at this time (may come back
with v0.7 due to searchable).

Also sources now display results progressively without a ProgressView
blocking when each source loads which allows the user to view media
faster.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-02-27 12:22:36 -05:00
kingbri
cb4d935008 Sources: Fix magnet link parsing with RSS
Using the new magnet type auto-populates hashes and links

Signed-off-by: kingbri <bdashore3@proton.me>
2023-02-16 18:34:09 -05:00
kingbri
88a2dc9742 Sources: Add subName and fixup
The subName parameter is for aggregate sources that pull from a
child website. Make it so it's possible to include that child
site in parsers.

Also remove the magnet link/hash requirement since it's filtered out
anyways after results are fetched.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-02-08 22:33:27 -05:00
kingbri
5a4e98f10d Ferrite: Switch to a Magnet struct
Magnets are expressed in two different ways: a hash and a link. Both
of these mean the same thing with a magnet link giving more information
if required.

However, there was a disconnect if a hash was present or a link was
present and required many steps to check which was available. Unify
magnets by creating a parent structure that attempts to extract
the hash or create a link in the event that either parameter isn't
provided.

Replace everything except bookmarks (to prevent CoreData complaints
and unnecessary abstraction) to use the new Magnet system.

Signed-off-by: kingbri <bdashore3@proton.me>
2023-01-04 12:49:20 -05:00
kingbri
2322d3af67 Debrid: Decentralize and add AllDebrid support
AllDebrid is another debrid provider. Add support to Ferrite in
addition to RealDebrid.

The overall debrid login backend has changed to accomodate for a more
agnostic app structure where more services can be added as needed.

Also add some cosmetic changes to search so filters can be added while
searching for a phrase.

Signed-off-by: kingbri <bdashore3@proton.me>
2022-11-27 18:18:09 -05:00
kingbri
102b59ab0a Scraping: Add source specific errors
State what source errored when one occurs.

Signed-off-by: kingbri <bdashore3@proton.me>
2022-11-19 12:13:29 -05:00
kingbri
e063b91f3f Ferrite: Format and cleanup
Also add swipe to delete support in source lists

Signed-off-by: kingbri <bdashore3@proton.me>
2022-11-19 11:58:02 -05:00
kingbri
a774564212 Ferrite: Improve overall UI
- Make history buttons have 2 lines of text to give more context.
If a batch is given, the full episode name is shown
- Add a "now playing" section to player choices to show what the user
will play in the event of a misclick
- Make the maximum line limit in search results 4 lines to prevent
long title results from taking up the entire cell
- Fix light theme appearance with library since the picker and list
weren't aligned right

Signed-off-by: kingbri <bdashore3@proton.me>
2022-11-18 17:10:42 -05:00
kingbri
b85752c92c RealDebrid: Improve fetch and recache times
To declutter a RealDebrid user's library, check if the file and
unrestricted link exist and serve those existing links. Otherwise
perform a download like normal.

Sometimes RealDebrid deletes cached items, but still keeps them on
instant availability. Add a way to tell the user that the item
is downloading along with an option to cancel it.

Also remove unnecessary published variables from viewmodels

Signed-off-by: kingbri <bdashore3@proton.me>
2022-10-05 10:47:59 -04:00
kingbri
2f870b9410 Ferrite: Add bookmarks
Bookmarks are added through search results and can be accessed through
the library. These can be moved and deleted within the list.

Add a RealDebrid instant availability cache for bookmark IA status
to not overwhelm the API. Instant availability results are fresh on
every search results since the cache is cleared.

Also don't require a source API object to be present for the API parser
button in source settings. If a JSON parser exists for a source, allow
the option to be presented.

Signed-off-by: kingbri <bdashore3@proton.me>
2022-09-16 12:33:18 -04:00
kingbri
40c55e689a RssParser: Properly parse items in scraper
Signed-off-by: kingbri <bdashore3@proton.me>
2022-08-31 22:52:30 -04:00
kingbri
664c57b751 Ferrite: Add updater
Updates are sent via an alert on starting the app. This can be
disabled in the settings menu.

A full version struct has been completed for flexible comparisons.

Version history can also be viewed in settings in case a user wants
to download an earlier version of the app.

Updates track Github releases.

Signed-off-by: kingbri <bdashore3@gmail.com>
2022-08-31 18:47:02 -04:00
kingbri
1761f8dfb4 Debrid: Add loading indicator and fix iOS <14.5 issues
When a search result is selected, there is usually a delay due to
the debrid dance of API routes for grabbing a download link to stream.
Add a loading indicator and prevent any other tasks from loading
unless the user cancels it.

iOS 14.5 was a huge update which added many QoL SwiftUI changes that
are consistent to modern iOS versions.

However, Ferrite supports iOS versions less than 14.5, mainly 14.3.
More fixes had to be added to make sure UI is consistent across
all OS versions.

Signed-off-by: kingbri <bdashore3@gmail.com>
2022-08-31 18:47:02 -04:00
kingbri
79d88ffab6 Sources: Add fallback URLs
If a website times out, use the fallback options. The data URL
request now has a hard timeout of 15 seconds.

This only works for the base URL of a source, if an RSS url or
API url is provided, fallback URLs won't be used and the request
will fail.

Signed-off-by: kingbri <bdashore3@gmail.com>
2022-08-31 18:47:02 -04:00
kingbri
e0182a700f Sources: Add website API support
Adds support for website APIs both complex and simple. This commit
only supports GET requests to APIs. POST request support can be added
on request.

Client IDs and secrets are also supported. They can be added via
source settings or automatically set by a website endpoint.

Also fetch sources for scraping using the backgroundContext and remove
some functions from using the main actor.

Signed-off-by: kingbri <bdashore3@gmail.com>
2022-08-31 18:47:02 -04:00
kingbri
8c0e495f93 Sources: Move trackers to transformable array
Rather than creating a relationship for every tracker, store a string
array in CoreData.

Signed-off-by: kingbri <bdashore3@gmail.com>
2022-08-31 18:47:02 -04:00
kingbri
3195d74eea Ferrite: Cleanup and refine backend
- Fix how abrupt search cancellations work
- Add a no results prompt if no results are found
- Clean up how scraping model results are returned on error
- Allow a base URL and dynamic base URL to be provided together

Signed-off-by: kingbri <bdashore3@gmail.com>
2022-08-31 00:41:38 -04:00
kingbri
59ee4f7a2a Error: Replace the cancel error user-side
If a Task is cancelled, this was deliberate and prevent a huge error
from showing up on the user side.

Signed-off-by: kingbri <bdashore3@gmail.com>
2022-08-31 00:41:38 -04:00
kingbri
cab6eb3bb6 Sources: Allow for dynamic properties and basic API usage
Some sources are self-hosted and require unique keys and sever
addresses.

Signed-off-by: kingbri <bdashore3@gmail.com>
2022-08-31 00:41:38 -04:00
kingbri
c82cb1819d Searching: Cleanup existing searches
If a user searched after cancelling the search the first time,
the first search would still continue.

Assign the search task to navigation view and automatically cancel
it and dismiss the searchbar when the user switches to a different
tab.

Also add a ProgressView to show which source is being parsed.

Signed-off-by: kingbri <bdashore3@gmail.com>
2022-08-31 00:41:38 -04:00
kingbri
bb481f471e Ferrite: Format
Signed-off-by: kingbri <bdashore3@gmail.com>
2022-08-31 00:41:38 -04:00
kingbri
064a68fbb2 Sources: Add RSS, descriptions, and settings
RSS parsing has been added as a method to parse source since they're
easier on the website's end to parse.

Source settings have been added. The only current setting is the fetch
mode which selects which parser/scraper to use. By default, if an RSS
parser is found, it's selected.

A source now has info shown regarding versioning and authorship. A source
list's repository name and author string are now required.

Signed-off-by: kingbri <bdashore3@gmail.com>
2022-08-31 00:41:38 -04:00
kingbri
940f8337a5 Ferrite: Overhaul sources
Sources are now completely changed to use a more flexible API. This
uses a fully native source system, so there will be 0 overhead on
resource usage and performance.

JSON objects specify what is fetched and displayed by Ferrite when
searching torrents.

Sources now include sizes, seeders, and leechers for any site that
specifies them.

The versioning and repo naming framework has been added, but will be
displayed in another update.

API support will be included in another update.

Signed-off-by: kingbri <bdashore3@gmail.com>
2022-08-31 00:41:38 -04:00
kingbri
64798a172a Scraping: Remove workaround for last-child
Last-child is not supported on SwiftSoup, but nth-last-child is.
Therefore, sources must use nth-child or nth-last-child instead of
the first-child and last-child aliases.

Signed-off-by: kingbri <bdashore3@gmail.com>
2022-08-31 00:41:38 -04:00
kingbri
119a3a18b1 SearchResults: Add source filtering
Presenting all source results can be annoying to a user. Add filtering
to filter by a specific source.

Signed-off-by: kingbri <bdashore3@gmail.com>
2022-08-04 21:33:59 -04:00
kingbri
1eef8202ca Ferrite: Decouple torrent sources
These sources will be converted to be more flexible with JavaScript
in the future.

The source catalog is populated by adding a source list in settings
then installing a source from the catalog.

Sources can be enabled or disabled when using Ferrite.

Signed-off-by: kingbri <bdashore3@gmail.com>
2022-08-04 21:33:59 -04:00
Renamed from Ferrite/Models/ScrapingViewModel.swift (Browse further)