To avoid inflating the IA value cache, restore the TTL logic and only
append IAs that are part of the sent magnets.
In addition, if an IA result isn't found for a model download, re-fetch
the IA cache.
Signed-off-by: kingbri <bdashore3@proton.me>
Cloud magnets are now under a rate limit and links are no longer
present per entry. Remove rich display for that section only and
present a batch sheet on click.
Also add more spots for cleaning up variables.
Signed-off-by: kingbri <bdashore3@proton.me>
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>
OffCloud is a debrid provider that allows for caching and playing
media. Does not have rich debrid support.
Also add a handler if functionality isn't implemented in the service.
Signed-off-by: kingbri <bdashore3@proton.me>
The task can be set to nil after completion, and the unrestrict
flag should also be set to nil when the batch sheet is dismissed.
Signed-off-by: kingbri <bdashore3@proton.me>
Some debrid services aren't "rich", which means that they don't
broadcast whether an instantly available torrent is a batch or a
single file. This results in all torrents either having the green
badge or red badge based on what hash is given.
However, batches need to intercept the download itself which requires
the download function to be split into download and unrestrict. In
between, there's room for the batch sheet to act.
Signed-off-by: kingbri <bdashore3@proton.me>
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>
Unify authentication to the new protocol. Also remove logout on
invalid requests. This became annoying and didn't update the UI
properly.
Signed-off-by: kingbri <bdashore3@proton.me>
Change the returned error to one that's unique to caching. Also
make deleteTorrents optional to delete the first torrent if necessary
since that's always being cached.
Signed-off-by: kingbri <bdashore3@proton.me>
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>
This fixes cloud magnet fetching and also doesn't duplicate magnets
inside the cloud service. Unrestricted links don't get duplicated,
so no need to check against those.
Signed-off-by: kingbri <bdashore3@proton.me>
Cloud downloads and torrents are now unified under their own
protocol and models. Downloads and torrents are separated.
Signed-off-by: kingbri <bdashore3@proton.me>
Unify IA into a passable client side structure and add a common
download method to the DebridSource protocol.
Signed-off-by: kingbri <bdashore3@proton.me>
Unifying the debrid services under a protocol will help slim down
on excess redundant code and allow for easy addition of new services
in the future.
Signed-off-by: kingbri <bdashore3@proton.me>
Debrid services can change their APIs at any time which negatively
impacts user experiences on Ferrite.
Add the following:
- Ability for a user to add a manually generated API key only showing the
last 4 characters for security purposes.
- Make ephemeral auth sessions toggle-able. ASWebAuthenticationView does
not automatically clear on toggle change.
- Add the savedLinks endpoint for AllDebrid so users can access their
downloads and magnets.
- Add a links section to AD's cloud view.
Signed-off-by: kingbri <bdashore3@proton.me>
The default SwiftUI picker is too limited for Ferrite's purposes.
Switch to a custom implementation for UI consistency.
Signed-off-by: kingbri <bdashore3@proton.me>
Items can now be filtered based if they're present in the debrid cache,
are a batch file, or not present at all.
Signed-off-by: kingbri <bdashore3@proton.me>
onAppear wasn't being called with the current implementation of the
cloud tab in library. Fix this to listen to the selectedDebridType
variable instead of relying on the onAppear call of a view.y
Also do some further project cleanup and LOC removal
Signed-off-by: kingbri <bdashore3@proton.me>
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>
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>
Add a searchbar to filter through various library entries so it's
easier to find items.
Also add fixes for < iOS 16 devices and fix up searchbar constraints.
Signed-off-by: kingbri <bdashore3@proton.me>
This commit adds support for viewing a user's AllDebrid magnet list.
AllDebrid does not save unlocked links, but they do save which magnets
a user has queried.
Also clean up various functions in DebridManager.
Signed-off-by: kingbri <bdashore3@proton.me>
Error handling can be tedious with debrid because network errors
to ignore are present (such as -999). Create a function to properly
display the errors to the user and log them via print statments.
Signed-off-by: kingbri <bdashore3@proton.me>
This is required for PM's cloud since transfers will also add the
files to a user's cloud rather than just fetching the DDL link.
Signed-off-by: kingbri <bdashore3@proton.me>
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>
Add the ability to view a user's Premiumize files in Ferrite. Files
can be deleted from a user's account directly in Ferrite's list.
Signed-off-by: kingbri <bdashore3@proton.me>
RealDebrid saves a user's unrestricted links and "torrents" (magnet
links in this case). Add the ability to see and queue a user's RD
library in Ferrite itself.
This required a further abstraction of the debrid manager to allow
for more types other than search results to be passed to various
functions.
Deleting an item from RD's cloud list deletes the item from RD as well.
NOTE: This does not track download progress, but it does show if a
magnet is currently being downloaded or not.
Signed-off-by: kingbri <bdashore3@proton.me>
Premiumize has a dynamic upper limit of 107-110 (from testing)
hashes per request. To play it safe, cache requests are split by
100 and executed in parallel as 2 (or more) requests.
Signed-off-by: kingbri <bdashore3@proton.me>
I mistakenly added an and condition which caused all debrid services
to fail unless the user is using Premiumize.
Signed-off-by: kingbri <bdashore3@proton.me>
Premiumize is another debrid provider. Add support in addition
to other debrid services.
Add a unified Magnet type that encloses both the link and hash
when needed for certain services.
A universal ASAuthenticationSession has been added to make implicit
authentication easier for services that support it.
Clean up declarations of certain variables that were mismanaged
during the debrid decentralization process.
Signed-off-by: kingbri <bdashore3@proton.me>