-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: resume and pause does not work with qbittorrent 5 (#801)
close #800
- Loading branch information
1 parent
69feefe
commit ae7a574
Showing
2 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export function isApiVersionAtLeast(currentVersion: string | null, targetVersion: string): boolean { | ||
if (!currentVersion) { | ||
return false; | ||
} | ||
const v1 = currentVersion.split('.').map(Number); | ||
const v2 = targetVersion.split('.').map(Number); | ||
|
||
for (let i = 0; i < Math.max(v1.length, v2.length); i++) { | ||
const num1 = v1[i] || 0; | ||
const num2 = v2[i] || 0; | ||
|
||
if (num1 > num2) return true; | ||
if (num1 < num2) return false; | ||
} | ||
return true; | ||
} |