mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-21 01:53:57 +00:00
Compare commits
16 Commits
feat/disab
...
fix/lint-b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91adb97013 | ||
|
|
f138b2efcb | ||
|
|
991aa05760 | ||
|
|
aff9e13bca | ||
|
|
240a75c1d0 | ||
|
|
edbe86a1fb | ||
|
|
a01e1b1709 | ||
|
|
60fd90820c | ||
|
|
798f88618e | ||
|
|
40795c34dc | ||
|
|
e335e05628 | ||
|
|
05464f25df | ||
|
|
b9830afca1 | ||
|
|
1cab73bcb4 | ||
|
|
387b3ebeac | ||
|
|
1545f42d17 |
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
[](https://github.com/hydralauncher/hydra/actions)
|
[](https://github.com/hydralauncher/hydra/actions)
|
||||||
[](https://github.com/hydralauncher/hydra/releases)
|
[](https://github.com/hydralauncher/hydra/releases)
|
||||||
|
[](https://community.chocolatey.org/packages/hydralauncher)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -35,18 +35,27 @@ export class DownloadManager {
|
|||||||
): string | undefined {
|
): string | undefined {
|
||||||
if (originalUrl?.includes("#")) {
|
if (originalUrl?.includes("#")) {
|
||||||
const hashPart = originalUrl.split("#")[1];
|
const hashPart = originalUrl.split("#")[1];
|
||||||
if (hashPart && !hashPart.startsWith("http")) return hashPart;
|
if (hashPart && !hashPart.startsWith("http") && hashPart.includes(".")) {
|
||||||
|
return hashPart;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (url.includes("#")) {
|
if (url.includes("#")) {
|
||||||
const hashPart = url.split("#")[1];
|
const hashPart = url.split("#")[1];
|
||||||
if (hashPart && !hashPart.startsWith("http")) return hashPart;
|
if (hashPart && !hashPart.startsWith("http") && hashPart.includes(".")) {
|
||||||
|
return hashPart;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const urlObj = new URL(url);
|
const urlObj = new URL(url);
|
||||||
const filename = urlObj.pathname.split("/").pop();
|
const pathname = urlObj.pathname;
|
||||||
if (filename?.length) return filename;
|
const pathParts = pathname.split("/");
|
||||||
|
const filename = pathParts[pathParts.length - 1];
|
||||||
|
|
||||||
|
if (filename?.includes(".") && filename.length > 0) {
|
||||||
|
return decodeURIComponent(filename);
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
// Invalid URL
|
// Invalid URL
|
||||||
}
|
}
|
||||||
@@ -55,7 +64,7 @@ export class DownloadManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static sanitizeFilename(filename: string): string {
|
private static sanitizeFilename(filename: string): string {
|
||||||
return filename.replace(/[<>:"/\\|?*]/g, "_");
|
return filename.replaceAll(/[<>:"/\\|?*]/g, "_");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static createDownloadPayload(
|
private static createDownloadPayload(
|
||||||
@@ -64,13 +73,19 @@ export class DownloadManager {
|
|||||||
downloadId: string,
|
downloadId: string,
|
||||||
savePath: string
|
savePath: string
|
||||||
) {
|
) {
|
||||||
const filename = this.extractFilename(directUrl, originalUrl);
|
const filename =
|
||||||
|
this.extractFilename(originalUrl, directUrl) ||
|
||||||
|
this.extractFilename(directUrl);
|
||||||
const sanitizedFilename = filename
|
const sanitizedFilename = filename
|
||||||
? this.sanitizeFilename(filename)
|
? this.sanitizeFilename(filename)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
if (sanitizedFilename) {
|
if (sanitizedFilename) {
|
||||||
logger.log(`[DownloadManager] Using filename: ${sanitizedFilename}`);
|
logger.log(`[DownloadManager] Using filename: ${sanitizedFilename}`);
|
||||||
|
} else {
|
||||||
|
logger.log(
|
||||||
|
`[DownloadManager] No filename extracted, aria2 will use default`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -227,10 +242,10 @@ export class DownloadManager {
|
|||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
gameFilesManager.extractDownloadedFile();
|
gameFilesManager.extractDownloadedFile();
|
||||||
} else {
|
} else if (download.folderName) {
|
||||||
gameFilesManager
|
gameFilesManager
|
||||||
.extractFilesInDirectory(
|
.extractFilesInDirectory(
|
||||||
path.join(download.downloadPath, download.folderName!)
|
path.join(download.downloadPath, download.folderName)
|
||||||
)
|
)
|
||||||
.then(() => gameFilesManager.setExtractionComplete());
|
.then(() => gameFilesManager.setExtractionComplete());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
transition: all ease 0.2s;
|
transition: all ease 0.2s;
|
||||||
position: relative;
|
position: relative;
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
|
width: 100%;
|
||||||
|
text-align: left;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: rgba(255, 255, 255, 0.03);
|
background-color: rgba(255, 255, 255, 0.03);
|
||||||
@@ -40,12 +42,17 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
background-color: globals.$background-color;
|
background-color: globals.$background-color;
|
||||||
|
color: #fff;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
svg {
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&__badge-picture {
|
&__badge-picture {
|
||||||
|
|||||||
Reference in New Issue
Block a user