Skip to content

Commit

Permalink
also prioritze single file over rar
Browse files Browse the repository at this point in the history
  • Loading branch information
GodPepe7 committed Jul 19, 2024
1 parent 9504106 commit 00cbf60
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ async function getSubs(animeTitle: string, episode: number) {
if (typeof subs === "string") {
return subs;
}
const nonZipSub = subs.find(sub => !sub.name.endsWith(".zip"))
const { url, name } = nonZipSub ? nonZipSub : subs[0]
const singleSub = subs.find(sub => !sub.name.endsWith(".zip") && !sub.name.endsWith(".rar"))
const { url, name } = singleSub ? singleSub : subs[0]
chrome.downloads.download({
url,
filename: name,
Expand All @@ -222,7 +222,7 @@ async function getSubs(animeTitle: string, episode: number) {
if (chrome.runtime.lastError) {
return chrome.runtime.lastError.message;
}
if (subs[0].name.endsWith(".zip")) {
if (name.endsWith(".zip") || name.endsWith(".rar")) {
await markMultipleAsDownloaded(name, animeTitle);
}
})
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const entryPoints = {
injectScript: './src/injectScript.ts'
};

module.exports = {1
module.exports = {
entry: entryPoints,
module: {
rules: [
Expand Down

0 comments on commit 00cbf60

Please sign in to comment.