Compare commits

..

59 commits

Author SHA1 Message Date
kingbri
f598137baf Ferrite: Bump version
v0.7.1

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
217bb5caa4 Debrid: Use universal cached IDs
Different services can send different statuses for if a file is
cached or not. Therefore, make this scoped to the debrid service
rather than expecting everything to state "downloaded".

Also it feels pretty blank if the disclosure groups are gone when
a cloud array is empty, so remove those checks.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
64378ccc23 Debrid: Fix OffCloud single files and cloud population
Populate cloud lists when the app is launched to begin maintainence
of a synced list. In addition, fix the errors when OffCloud tried
fetching links for a single file. The explore endpoint only works
when the file is a batch which is unknown until it's actually called.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
b232f9c0f3 Debrid: Clarify struct properties
Doesn't make sense to use more descriptive IDs when the struct
describes what the model is already.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
3627b955e4 Treewide: Cleanup and rename
Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
d4baf513c6 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-19 16:40:26 -05:00
kingbri
aaf12e28e2 Update README
Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
935f3d1ea4 Debrid: Make TorBox a rich service and fix cloud downloads
TorBox can now show if there's a batch before loading a file.

Cloud downloads should check the server in case there's a different
method to fetch a download link.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
e0510ca924 Update README
Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
8f84508e03 Debrid: Add description field and cleanup
Allow for overriding of the default description in the settings UI.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
8e20d6c76d Update README and add media
Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
d47d535b16 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-19 16:40:26 -05:00
kingbri
02fca1502d Debrid: Add OffCloud support
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>
2024-06-19 16:40:26 -05:00
kingbri
aa0712b967 Debrid: Fix cleanup of unrestrict and task
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>
2024-06-19 16:40:26 -05:00
kingbri
e14c684b5f Tree: Format
Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
c4edd5f687 Tree: Remove OffCloud references
Was an experiment for later commits.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
4cee7a15ec Debrid: Add TorBox support
TorBox is a service that handles magnet links under both a free
and paid plan. Integrate support into Ferrite. Will add rich services
once the instantAvailability endpoint returns a file list.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
0f69b92540 Debrid: Add split for download and unrestrict
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>
2024-06-19 16:40:26 -05:00
kingbri
e46e115244 Debrid: Add alert if there's no web login option
Indicates to the user that an API must be used to log into the debrid
service.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
15651eb695 Debrid: Reorder protocol
Helps when auto-filling stubs for new classes.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
8c9bb4a699 Revert "Extension: Remove Set warning"
This reverts commit cf090cfaa61acef5ff43f9f261764b0a125411f8.
2024-06-19 16:40:26 -05:00
kingbri
4ecc9d9ee7 Ferrite: Update project settings
Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
905943330f 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-19 16:40:26 -05:00
kingbri
1289c24fa5 Extension: Remove Set warning
This will be removed in the future anyway.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
d0f1f70d60 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-19 16:40:26 -05:00
kingbri
ff57c90a62 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-19 16:40:26 -05:00
kingbri
17ac5f8534 Actions: Update to latest
Bump actions and macos build versions.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
8755009ad4 Debrid: Fix UI updates for IA
Hook to the published variable to push updates.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
0ad2ba5cf2 Premiumize: Fix service-specific errors
This parameter should be optional and errors if it isn't.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
1d928b9a36 Logging: Improve generic error message
Point the user to settings logs rather than giving no extra information.
It would be a good idea to give the type of error in the future.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
457d938be8 Tree: Format
Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
5b4cef7ef0 Debrid: Migrate auth to protocol
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>
2024-06-19 16:40:26 -05:00
kingbri
eeb9cbdf65 Debrid: Unify cloud views
Cloud torrents and downloads are unified with the new protocol.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
694a2bfdf1 Debrid: Remove more redundant vars
the IA vars are no longer needed since that's unified.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
7e83a47050 Debrid: Migrate preferred service setter
PreferredService is now the debrid ID.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
b6a1179d1b Debrid: Remove separated download functions
No longer needed due to the common type.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
d54a2b4e37 Debrid: Remove redundant logout functions
Logout is now handled in the debrid class itself.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
f00ffb1b8c Debrid: Fix cache alert
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>
2024-06-19 16:40:26 -05:00
kingbri
fa8e5c19c3 Debrid: Swap to common DebridError
Removes the redundant error types.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
aa739133be Debrid: Refactor IA and download functions
Use the common protocol to handle these.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
7d5cdc5d06 Debrid: Remove ID storage
Storing an ID reference is redundant. Store a class reference
instead.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
5120b3e576 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-19 16:40:26 -05:00
kingbri
2db5273ec4 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-19 16:40:26 -05:00
kingbri
6a3733ca9a Debrid: Migrate common arrays to their API classes
Add convenience vars which makes the API classes the source of truth
for any interaction.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
1c21f563e2 Debrid: Fix RealDebrid download handling
The torrent ID is no longer stored in the DebridManager.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
2d220045c6 Debrid: Add common functions for existing magnets/downloads
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>
2024-06-19 16:40:26 -05:00
kingbri
551083f521 Debrid: Remove per-API IA structures
These aren't required since IA is a unified type. Only keep batch
IA for RealDebrid since it helps clear up confusion when gathering
InstantAvailability results.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
11dd2cabb6 Tree: Format
Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
3435e929d8 Debrid: Add source to all models
Gives an ID of where the struct came from.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
5eb1158456 Debrid: Add Premiumize to InstantAvailability
Also add the requirement to the protocol.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
fd9eb080be Debrid: Order API implementations
Reorder everything and mark off where different functions are located.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
cf58626384 Debrid: Add protocol for cloud handling
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>
2024-06-19 16:40:26 -05:00
kingbri
69a9d30475 Debrid: Add InstantAvailability and download to protocol
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>
2024-06-19 16:40:26 -05:00
kingbri
b8a225e141 Debrid: Begin using common protocols
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>
2024-06-19 16:40:26 -05:00
kingbri
b1227db143 NavView: Switch to NavigationStack for iOS 17 and up
iOS 17 fixes the issues that NavigationStack had with iOS 16. This
means that futureproofing is fixed.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
20f500fb64 Premiumize: Fix DDL fetching and debrid IA handling
Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
eb48b99ed8 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>
2024-06-19 16:40:26 -05:00
kingbri
f0d917002e Premiumize: Fix API key usage
PM has a different method to handle API keys compared to other services
which takes the value as an authorization header.

Signed-off-by: kingbri <bdashore3@proton.me>
2024-06-19 16:40:26 -05:00
kingbri
375de6f46e Debrid: Various updates to API and settings
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>
2024-06-19 16:40:26 -05:00
27 changed files with 187 additions and 289 deletions

View file

@ -104,7 +104,6 @@
0C8DC35429CE2AB5008A83AD /* SourceSettingsBaseUrlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C8DC35329CE2AB5008A83AD /* SourceSettingsBaseUrlView.swift */; };
0C8DC35629CE2ABF008A83AD /* SourceSettingsApiView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C8DC35529CE2ABF008A83AD /* SourceSettingsApiView.swift */; };
0C8DC35829CE2ACA008A83AD /* SourceSettingsMethodView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C8DC35729CE2ACA008A83AD /* SourceSettingsMethodView.swift */; };
0C93DED82CF80101009EA8D2 /* SettingsDebridLinkView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C93DED72CF80101009EA8D2 /* SettingsDebridLinkView.swift */; };
0C95D8D828A55B03005E22B3 /* DefaultActionPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0C95D8D728A55B03005E22B3 /* DefaultActionPickerView.swift */; };
0CA05457288EE58200850554 /* SettingsPluginListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CA05456288EE58200850554 /* SettingsPluginListView.swift */; };
0CA05459288EE9E600850554 /* PluginManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0CA05458288EE9E600850554 /* PluginManager.swift */; };
@ -260,7 +259,6 @@
0C8DC35329CE2AB5008A83AD /* SourceSettingsBaseUrlView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceSettingsBaseUrlView.swift; sourceTree = "<group>"; };
0C8DC35529CE2ABF008A83AD /* SourceSettingsApiView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceSettingsApiView.swift; sourceTree = "<group>"; };
0C8DC35729CE2ACA008A83AD /* SourceSettingsMethodView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SourceSettingsMethodView.swift; sourceTree = "<group>"; };
0C93DED72CF80101009EA8D2 /* SettingsDebridLinkView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsDebridLinkView.swift; sourceTree = "<group>"; };
0C95D8D728A55B03005E22B3 /* DefaultActionPickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultActionPickerView.swift; sourceTree = "<group>"; };
0CA05456288EE58200850554 /* SettingsPluginListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsPluginListView.swift; sourceTree = "<group>"; };
0CA05458288EE9E600850554 /* PluginManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PluginManager.swift; sourceTree = "<group>"; };
@ -557,7 +555,6 @@
0C10848A28BD9A38008F0BA6 /* SettingsAppVersionView.swift */,
0C6771FD29B521F1005D38D2 /* SettingsDebridInfoView.swift */,
0C5708EA29B8F89300BE07F9 /* SettingsLogView.swift */,
0C93DED72CF80101009EA8D2 /* SettingsDebridLinkView.swift */,
);
path = Settings;
sourceTree = "<group>";
@ -984,7 +981,6 @@
0C32FB572890D1F2002BD219 /* ListRowViews.swift in Sources */,
0CEC8AAE299B31B6007BFE8F /* SearchFilterHeaderView.swift in Sources */,
0C84F4822895BFED0074B7C9 /* Source+CoreDataClass.swift in Sources */,
0C93DED82CF80101009EA8D2 /* SettingsDebridLinkView.swift in Sources */,
0C3DD43F29B6968D006429DB /* KodiEditorView.swift in Sources */,
0CB725322C123E6F0047FC0B /* CloudDownloadView.swift in Sources */,
0C3DD44329B6ACD9006429DB /* KodiServer+CoreDataProperties.swift in Sources */,
@ -1126,7 +1122,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 21;
CURRENT_PROJECT_VERSION = 18;
DEVELOPMENT_ASSET_PATHS = "\"Ferrite/Preview Content\"";
DEVELOPMENT_TEAM = 8A74DBQ6S3;
ENABLE_PREVIEWS = YES;
@ -1146,7 +1142,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.7.3;
MARKETING_VERSION = 0.7.1;
PRODUCT_BUNDLE_IDENTIFIER = me.kingbri.Ferrite;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
@ -1162,7 +1158,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 21;
CURRENT_PROJECT_VERSION = 18;
DEVELOPMENT_ASSET_PATHS = "\"Ferrite/Preview Content\"";
DEVELOPMENT_TEAM = 8A74DBQ6S3;
ENABLE_PREVIEWS = YES;
@ -1182,7 +1178,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 0.7.3;
MARKETING_VERSION = 0.7.1;
PRODUCT_BUNDLE_IDENTIFIER = me.kingbri.Ferrite;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;

View file

@ -11,13 +11,6 @@ class AllDebrid: PollingDebridSource, ObservableObject {
let id = "AllDebrid"
let abbreviation = "AD"
let website = "https://alldebrid.com"
let description: String? = "AllDebrid is a debrid service that is used for downloads and media playback. " +
"You must pay to access this service. \n\n" +
"It is not recommended to use this service since media cache checks are not possible via the API. " +
"Ferrite's instant availability solely looks at a user's magnet library. \n\n" +
"If you must use this service, it is recommended to download search results manually using the context menu. \n\n" +
"This service does not inform if a magnet link is a batch before downloading."
let cachedStatus: [String] = ["Ready"]
var authTask: Task<Void, Error>?
@ -88,7 +81,7 @@ class AllDebrid: PollingDebridSource, ObservableObject {
URLQueryItem(name: "pin", value: pin)
]
let request = try URLRequest(url: buildRequestURL(urlString: "\(baseApiUrl)/pin/check", queryItems: queryItems))
let request = URLRequest(url: try buildRequestURL(urlString: "\(baseApiUrl)/pin/check", queryItems: queryItems))
// Timer to poll AD API for key
authTask = Task {
@ -199,22 +192,31 @@ class AllDebrid: PollingDebridSource, ObservableObject {
}
}
// Fetch the user magnets to the latest version
try await getUserMagnets()
for cloudMagnet in cloudMagnets {
if cachedStatus.contains(cloudMagnet.status),
sendMagnets.contains(where: { $0.hash == cloudMagnet.hash })
{
IAValues.append(
DebridIA(
magnet: Magnet(hash: cloudMagnet.hash, link: nil),
expiryTimeStamp: Date().timeIntervalSince1970 + 300,
files: []
)
)
}
if sendMagnets.isEmpty {
return
}
let queryItems = sendMagnets.map { URLQueryItem(name: "magnets[]", value: $0.hash) }
var request = URLRequest(url: try buildRequestURL(urlString: "\(baseApiUrl)/magnet/instant", queryItems: queryItems))
let data = try await performRequest(request: &request, requestName: #function)
let rawResponse = try jsonDecoder.decode(ADResponse<InstantAvailabilityResponse>.self, from: data).data
let filteredMagnets = rawResponse.magnets.filter { $0.instant == true && $0.files != nil }
let availableHashes = filteredMagnets.map { magnetResp in
// Force unwrap is OK here since the filter caught any nil values
let files = magnetResp.files!.enumerated().map { index, magnetFile in
DebridIAFile(id: index, name: magnetFile.name)
}
return DebridIA(
magnet: Magnet(hash: magnetResp.hash, link: magnetResp.magnet),
expiryTimeStamp: Date().timeIntervalSince1970 + 300,
files: files
)
}
IAValues += availableHashes
}
// MARK: - Downloading
@ -223,49 +225,19 @@ class AllDebrid: PollingDebridSource, ObservableObject {
func getRestrictedFile(magnet: Magnet, ia: DebridIA?, iaFile: DebridIAFile?) async throws -> (restrictedFile: DebridIAFile?, newIA: DebridIA?) {
let selectedMagnetId: String
if let existingMagnet = cloudMagnets.first(where: {
$0.hash == magnet.hash && cachedStatus.contains($0.status)
}) {
if let existingMagnet = cloudMagnets.first(where: { $0.hash == magnet.hash && cachedStatus.contains($0.status) }) {
selectedMagnetId = existingMagnet.id
} else {
let magnetId = try await addMagnet(magnet: magnet)
selectedMagnetId = String(magnetId)
}
let rawResponse = try await fetchMagnetStatus(
let lockedLink = try await fetchMagnetStatus(
magnetId: selectedMagnetId,
selectedIndex: iaFile?.id ?? 0
)
guard let magnets = rawResponse.magnets[safe: 0] else {
throw DebridError.EmptyUserMagnets
}
// Batches require an unrestrict from the user
if magnets.links.count > 1, iaFile == nil {
var copiedIA = ia
copiedIA?.files = magnets.links.enumerated().compactMap { index, file in
DebridIAFile(
id: index,
name: file.filename,
streamUrlString: file.link
)
}
return (nil, copiedIA)
}
if let cloudMagnetFile = magnets.links[safe: iaFile?.id ?? 0] {
let restrictedFile = DebridIAFile(
id: 0,
name: cloudMagnetFile.filename,
streamUrlString: cloudMagnetFile.link
)
return (restrictedFile, nil)
} else {
throw DebridError.EmptyUserMagnets
}
return (lockedLink, nil)
}
// Adds a magnet link to the user's AD account
@ -274,7 +246,7 @@ class AllDebrid: PollingDebridSource, ObservableObject {
throw DebridError.FailedRequest(description: "The magnet link is invalid")
}
var request = try URLRequest(url: buildRequestURL(urlString: "\(baseApiUrl)/magnet/upload"))
var request = URLRequest(url: try buildRequestURL(urlString: "\(baseApiUrl)/magnet/upload"))
request.httpMethod = "POST"
request.setValue("application/x-www-form-urlencoded", forHTTPHeaderField: "Content-Type")
@ -289,26 +261,27 @@ class AllDebrid: PollingDebridSource, ObservableObject {
let rawResponse = try jsonDecoder.decode(ADResponse<AddMagnetResponse>.self, from: data).data
if let magnet = rawResponse.magnets[safe: 0] {
if !magnet.ready {
throw DebridError.IsCaching
}
return magnet.id
} else {
throw DebridError.InvalidResponse
}
}
func fetchMagnetStatus(magnetId: String, selectedIndex: Int?) async throws -> MagnetStatusResponse {
func fetchMagnetStatus(magnetId: String, selectedIndex: Int?) async throws -> DebridIAFile {
let queryItems = [
URLQueryItem(name: "id", value: magnetId)
]
var request = try URLRequest(url: buildRequestURL(urlString: "\(baseApiUrl)/magnet/status", queryItems: queryItems))
var request = URLRequest(url: try buildRequestURL(urlString: "\(baseApiUrl)/magnet/status", queryItems: queryItems))
let data = try await performRequest(request: &request, requestName: #function)
let rawResponse = try jsonDecoder.decode(ADResponse<MagnetStatusResponse>.self, from: data).data
return rawResponse
// Better to fetch no link at all than the wrong link
if let cloudMagnetFile = rawResponse.magnets[safe: 0]?.links[safe: selectedIndex ?? -1] {
return DebridIAFile(id: 0, name: cloudMagnetFile.filename, streamUrlString: cloudMagnetFile.link)
} else {
throw DebridError.EmptyUserMagnets
}
}
// Known as unlockLink in AD's API
@ -316,7 +289,7 @@ class AllDebrid: PollingDebridSource, ObservableObject {
let queryItems = [
URLQueryItem(name: "link", value: restrictedFile.streamUrlString)
]
var request = try URLRequest(url: buildRequestURL(urlString: "\(baseApiUrl)/link/unlock", queryItems: queryItems))
var request = URLRequest(url: try buildRequestURL(urlString: "\(baseApiUrl)/link/unlock", queryItems: queryItems))
let data = try await performRequest(request: &request, requestName: "unlockLink")
let rawResponse = try jsonDecoder.decode(ADResponse<UnlockLinkResponse>.self, from: data).data
@ -328,7 +301,7 @@ class AllDebrid: PollingDebridSource, ObservableObject {
let queryItems = [
URLQueryItem(name: "links[]", value: link)
]
var request = try URLRequest(url: buildRequestURL(urlString: "\(baseApiUrl)/user/links/save", queryItems: queryItems))
var request = URLRequest(url: try buildRequestURL(urlString: "\(baseApiUrl)/user/links/save", queryItems: queryItems))
try await performRequest(request: &request, requestName: #function)
}
@ -336,7 +309,7 @@ class AllDebrid: PollingDebridSource, ObservableObject {
// MARK: - Cloud methods
func getUserMagnets() async throws {
var request = try URLRequest(url: buildRequestURL(urlString: "\(baseApiUrl)/magnet/status"))
var request = URLRequest(url: try buildRequestURL(urlString: "\(baseApiUrl)/magnet/status"))
let data = try await performRequest(request: &request, requestName: #function)
let rawResponse = try jsonDecoder.decode(ADResponse<MagnetStatusResponse>.self, from: data).data
@ -360,13 +333,13 @@ class AllDebrid: PollingDebridSource, ObservableObject {
let queryItems = [
URLQueryItem(name: "id", value: cloudMagnetId)
]
var request = try URLRequest(url: buildRequestURL(urlString: "\(baseApiUrl)/magnet/delete", queryItems: queryItems))
var request = URLRequest(url: try buildRequestURL(urlString: "\(baseApiUrl)/magnet/delete", queryItems: queryItems))
try await performRequest(request: &request, requestName: #function)
}
func getUserDownloads() async throws {
var request = try URLRequest(url: buildRequestURL(urlString: "\(baseApiUrl)/user/links"))
var request = URLRequest(url: try buildRequestURL(urlString: "\(baseApiUrl)/user/links"))
let data = try await performRequest(request: &request, requestName: #function)
let rawResponse = try jsonDecoder.decode(ADResponse<SavedLinksResponse>.self, from: data).data
@ -389,7 +362,7 @@ class AllDebrid: PollingDebridSource, ObservableObject {
let queryItems = [
URLQueryItem(name: "link", value: downloadId)
]
var request = try URLRequest(url: buildRequestURL(urlString: "\(baseApiUrl)/user/links/delete", queryItems: queryItems))
var request = URLRequest(url: try buildRequestURL(urlString: "\(baseApiUrl)/user/links/delete", queryItems: queryItems))
try await performRequest(request: &request, requestName: #function)
}

View file

@ -118,7 +118,7 @@ class OffCloud: DebridSource, ObservableObject {
return
}
var request = try URLRequest(url: buildRequestURL(urlString: "\(baseApiUrl)/cache"))
var request = URLRequest(url: try buildRequestURL(urlString: "\(baseApiUrl)/cache"))
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
@ -202,7 +202,7 @@ class OffCloud: DebridSource, ObservableObject {
// Called as "cloud" in offcloud's API
private func offcloudDownload(magnet: Magnet) async throws -> CloudDownloadResponse {
var request = try URLRequest(url: buildRequestURL(urlString: "\(baseApiUrl)/cloud"))
var request = URLRequest(url: try buildRequestURL(urlString: "\(baseApiUrl)/cloud"))
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
@ -220,7 +220,7 @@ class OffCloud: DebridSource, ObservableObject {
}
private func cloudExplore(requestId: String) async throws -> CloudExploreResponse {
var request = try URLRequest(url: buildRequestURL(urlString: "\(baseApiUrl)/cloud/explore/\(requestId)"))
var request = URLRequest(url: try buildRequestURL(urlString: "\(baseApiUrl)/cloud/explore/\(requestId)"))
let data = try await performRequest(request: &request, requestName: "cloudExplore")
let rawResponse = try jsonDecoder.decode(CloudExploreResponse.self, from: data)
@ -245,7 +245,7 @@ class OffCloud: DebridSource, ObservableObject {
func deleteUserDownload(downloadId: String) {}
func getUserMagnets() async throws {
var request = try URLRequest(url: buildRequestURL(urlString: "\(baseApiUrl)/cloud/history"))
var request = URLRequest(url: try buildRequestURL(urlString: "\(baseApiUrl)/cloud/history"))
let data = try await performRequest(request: &request, requestName: "cloudHistory")
let rawResponse = try jsonDecoder.decode([CloudHistoryResponse].self, from: data)
@ -271,7 +271,7 @@ class OffCloud: DebridSource, ObservableObject {
throw DebridError.InvalidPostBody
}
var request = try URLRequest(url: buildRequestURL(urlString: "\(website)/cloud/remove/\(cloudMagnetId)"))
var request = URLRequest(url: try buildRequestURL(urlString: "\(website)/cloud/remove/\(cloudMagnetId)"))
try await performRequest(request: &request, requestName: "cloudRemove")
}
}

View file

@ -11,13 +11,6 @@ class RealDebrid: PollingDebridSource, ObservableObject {
let id = "RealDebrid"
let abbreviation = "RD"
let website = "https://real-debrid.com"
let description: String? = "RealDebrid is a debrid service that is used for downloads and media playback. " +
"You must pay to access this service. \n\n" +
"It is not recommended to use this service since media cache checks are not possible via the API. " +
"Ferrite's instant availability solely looks at a user's magnet library. \n\n" +
"If you must use this service, it is recommended to download search results manually using the context menu. \n\n" +
"This service does not inform if a magnet link is a batch before downloading."
let cachedStatus: [String] = ["downloaded"]
var authTask: Task<Void, Error>?
@ -252,8 +245,7 @@ class RealDebrid: PollingDebridSource, ObservableObject {
// MARK: - Instant availability
// Post-API changes
// Use user magnets to check for IA instead
// Checks if the magnet is streamable on RD
func instantAvailability(magnets: [Magnet]) async throws {
let now = Date().timeIntervalSince1970
@ -270,21 +262,61 @@ class RealDebrid: PollingDebridSource, ObservableObject {
}
}
// Fetch the user magnets to the latest version
try await getUserMagnets()
if sendMagnets.isEmpty {
return
}
for cloudMagnet in cloudMagnets {
if cachedStatus.contains(cloudMagnet.status),
sendMagnets.contains(where: { $0.hash == cloudMagnet.hash })
{
IAValues.append(
DebridIA(
magnet: Magnet(hash: cloudMagnet.hash, link: nil),
expiryTimeStamp: Date().timeIntervalSince1970 + 300,
files: []
)
)
var request = URLRequest(url: URL(string: "\(baseApiUrl)/torrents/instantAvailability/\(sendMagnets.compactMap(\.hash).joined(separator: "/"))")!)
let data = try await performRequest(request: &request, requestName: #function)
let rawResponseDict = try jsonDecoder.decode([String: InstantAvailabilityResponse].self, from: data)
for (hash, response) in rawResponseDict {
guard let data = response.data else {
continue
}
if data.rd.isEmpty {
continue
}
// Handle files array
let batches = data.rd.map { fileDict in
let batchFiles: [RealDebrid.IABatchFile] = fileDict.map { key, value in
// Force unwrapped ID. Is safe because ID is guaranteed on a successful response
RealDebrid.IABatchFile(id: Int(key)!, fileName: value.filename)
}.sorted(by: { $0.id < $1.id })
return RealDebrid.IABatch(files: batchFiles)
}
var files: [DebridIAFile] = []
for batch in batches {
let batchFileIds = batch.files.map(\.id)
for batchFile in batch.files {
if !files.contains(where: { $0.id == batchFile.id }) {
files.append(
DebridIAFile(
id: batchFile.id,
name: batchFile.fileName,
batchIds: batchFileIds
)
)
}
}
}
// TTL: 5 minutes
IAValues.append(
DebridIA(
magnet: Magnet(hash: hash, link: nil),
expiryTimeStamp: Date().timeIntervalSince1970 + 300,
files: files
)
)
}
}
@ -296,9 +328,7 @@ class RealDebrid: PollingDebridSource, ObservableObject {
do {
// Don't queue a new job if the magnet already exists in the user's library
if let existingCloudMagnet = cloudMagnets.first(where: {
$0.hash == magnet.hash && cachedStatus.contains($0.status)
}) {
if let existingCloudMagnet = cloudMagnets.first(where: { $0.hash == magnet.hash && $0.status == "downloaded" }) {
selectedMagnetId = existingCloudMagnet.id
} else {
selectedMagnetId = try await addMagnet(magnet: magnet)
@ -306,33 +336,12 @@ class RealDebrid: PollingDebridSource, ObservableObject {
try await selectFiles(debridID: selectedMagnetId, fileIds: iaFile?.batchIds ?? [])
}
let response = try await torrentInfo(debridID: selectedMagnetId)
let filteredFiles = response.files.filter { $0.selected == 1 }
// Need to return this to the user
if filteredFiles.count > 1, iaFile == nil {
var copiedIA = ia
copiedIA?.files = response.files.enumerated().compactMap { index, file in
DebridIAFile(
id: index,
name: file.path,
streamUrlString: response.links[safe: index]
)
}
return (nil, copiedIA)
}
// RealDebrid has 1 as the first ID for a file
let selectedFileId = iaFile?.id ?? 1
let linkIndex = filteredFiles.firstIndex(where: { $0.id == selectedFileId })
let restrictedFile = try await torrentInfo(
debridID: selectedMagnetId,
selectedFileId: iaFile?.id ?? 1
)
guard let cloudMagnetLink = response.links[safe: linkIndex ?? -1] else {
throw DebridError.EmptyUserMagnets
}
let restrictedFile = DebridIAFile(id: 0, name: response.filename, streamUrlString: cloudMagnetLink)
return (restrictedFile, nil)
} catch {
if case DebridError.EmptyUserMagnets = error, !selectedMagnetId.isEmpty {
@ -386,19 +395,24 @@ class RealDebrid: PollingDebridSource, ObservableObject {
}
// Gets the info of a torrent from a given ID
func torrentInfo(debridID: String) async throws -> TorrentInfoResponse {
func torrentInfo(debridID: String, selectedFileId: Int?) async throws -> DebridIAFile {
var request = URLRequest(url: URL(string: "\(baseApiUrl)/torrents/info/\(debridID)")!)
let data = try await performRequest(request: &request, requestName: #function)
let rawResponse = try jsonDecoder.decode(TorrentInfoResponse.self, from: data)
let filteredFiles = rawResponse.files.filter { $0.selected == 1 }
let linkIndex = filteredFiles.firstIndex(where: { $0.id == selectedFileId })
// Let the user know if a magnet is downloading
switch rawResponse.status {
case "downloaded":
return rawResponse
case "downloading", "queued":
if let cloudMagnetLink = rawResponse.links[safe: linkIndex ?? -1], rawResponse.status == "downloaded" {
return DebridIAFile(
id: 0,
name: rawResponse.filename,
streamUrlString: cloudMagnetLink
)
} else if rawResponse.status == "downloading" || rawResponse.status == "queued" {
throw DebridError.IsCaching
default:
} else {
throw DebridError.EmptyUserMagnets
}
}
@ -434,7 +448,7 @@ class RealDebrid: PollingDebridSource, ObservableObject {
fileName: response.filename,
status: response.status,
hash: response.hash,
links: [response.id]
links: response.links
)
}
}

View file

@ -1,5 +1,5 @@
//
// Set.swift
// Array.swift
// Ferrite
//
// Created by Brian Dashore on 11/26/22.

View file

@ -24,7 +24,7 @@
<string>Ferrite</string>
<key>CFBundleURLSchemes</key>
<array>
<string>ferrite</string>
<string>ferrite://</string>
</array>
</dict>
</array>

View file

@ -1,5 +1,5 @@
//
// FormDataBody.swift
// MultipartFormDataRequest.swift
// Ferrite
//
// Created by Brian Dashore on 6/12/24.

View file

@ -174,7 +174,7 @@ class DebridManager: ObservableObject {
return true
} else {
logManager?.warn("DebridManager: Could not find the associated \(selectedSource.id) entry for magnet hash \(magnetHash)")
logManager?.error("DebridManager: Could not find the associated \(selectedSource.id) entry for magnet hash \(magnetHash)")
return false
}
}
@ -323,11 +323,6 @@ class DebridManager: ObservableObject {
func fetchDebridDownload(magnet: Magnet?, cloudInfo: String? = nil) async {
defer {
logManager?.hideIndeterminateToast()
if !requiresUnrestrict {
clearSelectedDebridItems()
}
currentDebridTask = nil
}
@ -341,9 +336,6 @@ class DebridManager: ObservableObject {
}
do {
// Cleanup beforehand
requiresUnrestrict = false
if let cloudInfo {
downloadUrl = try await debridSource.checkUserDownloads(link: cloudInfo) ?? ""
return
@ -392,7 +384,6 @@ class DebridManager: ObservableObject {
defer {
logManager?.hideIndeterminateToast()
requiresUnrestrict = false
clearSelectedDebridItems()
currentDebridTask = nil
}

View file

@ -1,5 +1,5 @@
//
// LoggingManager.swift
// ToastViewModel.swift
// Ferrite
//
// Created by Brian Dashore on 7/19/22.

View file

@ -1,5 +1,5 @@
//
// PluginManager.swift
// SourceManager.swift
// Ferrite
//
// Created by Brian Dashore on 7/25/22.

View file

@ -21,12 +21,13 @@ struct IndeterminateProgressView: View {
.foregroundColor(Color.accentColor)
.frame(width: reader.size.width * 0.26, height: 6)
.clipShape(Capsule())
.offset(x: -reader.size.width * 0.6, y: 0)
.offset(x: reader.size.width * 1.2 * offset, y: 0)
.animation(.default.repeatForever().speed(0.5), value: offset)
.offset(x: reader.size.width * 1.2 * self.offset, y: 0)
.animation(.default.repeatForever().speed(0.5), value: self.offset)
.onAppear {
withAnimation {
offset = 1
self.offset = 1
}
}
)

View file

@ -56,27 +56,20 @@ struct BookmarksView: View {
.frame(height: 15)
}
.task {
await matchAgainstIA()
}
.refreshable {
await matchAgainstIA()
if !debridManager.enabledDebrids.isEmpty {
let magnets = bookmarks.compactMap {
if let magnetHash = $0.magnetHash {
return Magnet(hash: magnetHash, link: $0.magnetLink)
} else {
return nil
}
}
await debridManager.populateDebridIA(magnets)
}
}
}
func fetchPredicate() {
bookmarks.nsPredicate = searchText.isEmpty ? nil : NSPredicate(format: "title CONTAINS[cd] %@", searchText)
}
func matchAgainstIA() async {
if !debridManager.enabledDebrids.isEmpty {
let magnets = bookmarks.compactMap {
if let magnetHash = $0.magnetHash {
return Magnet(hash: magnetHash, link: $0.magnetLink)
} else {
return nil
}
}
await debridManager.populateDebridIA(magnets)
}
}
}

View file

@ -1,5 +1,5 @@
//
// InstalledPluginButtonView.swift
// InstalledSourceButtonView.swift
// Ferrite
//
// Created by Brian Dashore on 8/5/22.

View file

@ -1,5 +1,5 @@
//
// PluginCatalogButtonView.swift
// SourceCatalogButtonView.swift
// Ferrite
//
// Created by Brian Dashore on 8/5/22.

View file

@ -32,7 +32,8 @@ struct PluginInfoMetaView<P: Plugin>: View {
Group {
Text("ID: \(selectedPlugin.id)")
if let pluginList = pluginLists.first(where: { $0.id == selectedPlugin.listId }) {
if let pluginList = pluginLists.first(where: { $0.id == selectedPlugin.listId })
{
Text("List: \(pluginList.name)")
Text("List ID: \(pluginList.id.uuidString)")
} else {

View file

@ -1,5 +1,5 @@
//
// PluginTagsView.swift
// PluginTagView.swift
// Ferrite
//
// Created by Brian Dashore on 2/7/23.

View file

@ -37,7 +37,29 @@ struct SearchResultButtonView: View {
case .full:
if debridManager.selectDebridResult(magnet: result.magnet) {
debridManager.currentDebridTask = Task {
await downloadToDebrid()
await debridManager.fetchDebridDownload(magnet: result.magnet)
// Bump to batch
if debridManager.requiresUnrestrict {
navModel.selectedHistoryInfo = historyEntry
navModel.currentChoiceSheet = .batch
return
}
if !debridManager.downloadUrl.isEmpty {
historyEntry.url = debridManager.downloadUrl
PersistenceController.shared.createHistory(historyEntry, performSave: true)
pluginManager.runDefaultAction(
urlString: debridManager.downloadUrl,
navModel: navModel
)
if navModel.currentChoiceSheet != .action {
debridManager.downloadUrl = ""
}
}
}
}
case .partial:
@ -99,33 +121,6 @@ struct SearchResultButtonView: View {
}
}
}
Button {
if debridManager.currentDebridTask == nil {
let foundIAResult = debridManager.selectDebridResult(magnet: result.magnet)
// Add a fake IA because we don't know if the magnet is cached at this point
if !foundIAResult {
debridManager.selectedDebridItem = DebridIA(
magnet: result.magnet,
expiryTimeStamp: Date().timeIntervalSince1970,
files: []
)
}
debridManager.currentDebridTask = Task {
await downloadToDebrid()
// Re-populate the IA cache if a result wasn't initially found
if !foundIAResult {
await debridManager.populateDebridIA([result.magnet])
}
}
}
} label: {
Text("Download to Debrid")
Image(systemName: "arrow.down.circle")
}
}
.alert("Caching file", isPresented: $debridManager.showDeleteAlert) {
Button("Yes", role: .destructive) {
@ -171,35 +166,4 @@ struct SearchResultButtonView: View {
}
}
}
// Common function to download
func downloadToDebrid() async {
var historyEntry = HistoryEntryJson(
name: result.title,
source: result.source
)
await debridManager.fetchDebridDownload(magnet: result.magnet)
navModel.selectedTitle = result.title ?? ""
if debridManager.requiresUnrestrict {
navModel.currentChoiceSheet = .batch
return
}
if !debridManager.downloadUrl.isEmpty {
historyEntry.url = debridManager.downloadUrl
PersistenceController.shared.createHistory(historyEntry, performSave: true)
pluginManager.runDefaultAction(
urlString: debridManager.downloadUrl,
navModel: navModel
)
if navModel.currentChoiceSheet != .action {
debridManager.downloadUrl = ""
}
}
}
}

View file

@ -1,5 +1,5 @@
//
// SearchResultInfoView.swift
// SearchResultRDView.swift
// Ferrite
//
// Created by Brian Dashore on 7/26/22.

View file

@ -1,5 +1,5 @@
//
// DefaultActionPickerView.swift
// DefaultActionsPickerViews.swift
// Ferrite
//
// Created by Brian Dashore on 8/11/22.

View file

@ -1,5 +1,5 @@
//
// PluginListEditorView.swift
// SourceListEditorView.swift
// Ferrite
//
// Created by Brian Dashore on 7/25/22.

View file

@ -1,5 +1,5 @@
//
// SettingsPluginListView.swift
// SettingsSourceListView.swift
// Ferrite
//
// Created by Brian Dashore on 7/25/22.

View file

@ -1,5 +1,5 @@
//
// SettingsDebridInfoView.swift
// DebridInfoView.swift
// Ferrite
//
// Created by Brian Dashore on 3/5/23.

View file

@ -1,31 +0,0 @@
//
// SettingsDebridLinkView.swift
// Ferrite
//
// Created by Brian Dashore on 11/27/24.
//
import SwiftUI
struct SettingsDebridLinkView: View {
var debridSource: DebridSource
// TODO: Use a roundabout state for now
@State private var isLoggedIn = false
var body: some View {
NavigationLink {
SettingsDebridInfoView(debridSource: debridSource)
} label: {
HStack {
Text(debridSource.id)
Spacer()
Text(isLoggedIn ? "Enabled" : "Disabled")
.foregroundColor(.secondary)
}
}
.onAppear {
isLoggedIn = debridSource.isLoggedIn
}
}
}

View file

@ -47,7 +47,16 @@ struct SettingsView: View {
Form {
Section(header: InlineHeader("Debrid services")) {
ForEach(debridManager.debridSources, id: \.id) { (debridSource: DebridSource) in
SettingsDebridLinkView(debridSource: debridSource)
NavigationLink {
SettingsDebridInfoView(debridSource: debridSource)
} label: {
HStack {
Text(debridSource.id)
Spacer()
Text(debridSource.isLoggedIn ? "Enabled" : "Disabled")
.foregroundColor(.secondary)
}
}
}
}

View file

@ -1,5 +1,5 @@
//
// ActionChoiceView.swift
// MagnetChoiceView.swift
// Ferrite
//
// Created by Brian Dashore on 7/20/22.
@ -143,8 +143,6 @@ struct ActionChoiceView: View {
}
.onDisappear {
debridManager.downloadUrl = ""
debridManager.clearSelectedDebridItems()
debridManager.requiresUnrestrict = false
navModel.selectedTitle = ""
navModel.selectedBatchTitle = ""
navModel.resultFromCloud = false
@ -155,11 +153,8 @@ struct ActionChoiceView: View {
ToolbarItem(placement: .navigationBarTrailing) {
Button("Done") {
debridManager.downloadUrl = ""
debridManager.clearSelectedDebridItems()
debridManager.requiresUnrestrict = false
navModel.selectedTitle = ""
navModel.selectedBatchTitle = ""
navModel.resultFromCloud = false
dismiss()
}

View file

@ -39,10 +39,6 @@ struct BatchChoiceView: View {
.searchable(text: $searchText, placement: .navigationBarDrawer(displayMode: .always))
.autocorrectionDisabled(!autocorrectSearch)
.textInputAutocapitalization(autocorrectSearch ? .sentences : .never)
.onDisappear {
debridManager.clearSelectedDebridItems()
debridManager.requiresUnrestrict = false
}
.navigationTitle("Select a file")
.navigationBarTitleDisplayMode(.inline)
.toolbar {

View file

@ -32,10 +32,6 @@
</a>
</p>
<p align="left">
<a href="https://testflight.apple.com/join/YohgCnC4"><img src="https://i.imgur.com/A5Kpowu.png" width="200"></a>
</p>
A media search engine for iOS with a plugin API to extend its functionality.
## Screenshots