mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-11 05:46:17 +00:00
Compare commits
17 Commits
feat/souve
...
345696ad06
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
345696ad06 | ||
|
|
6c4e8c406f | ||
|
|
c46a1e7848 | ||
|
|
590e09a8c3 | ||
|
|
c1d7ea27f3 | ||
|
|
15dbd3b2ad | ||
|
|
4584783f44 | ||
|
|
765ec70dd0 | ||
|
|
de483da51c | ||
|
|
2bc0266775 | ||
|
|
c9729fb3eb | ||
|
|
9a7ad148e3 | ||
|
|
d929fbaeaa | ||
|
|
8fa33119d6 | ||
|
|
92d87c5d33 | ||
|
|
af884d3772 | ||
|
|
dc31ac0831 |
@@ -1,6 +1,7 @@
|
||||
MAIN_VITE_API_URL=
|
||||
MAIN_VITE_AUTH_URL=
|
||||
MAIN_VITE_WS_URL=
|
||||
MAIN_VITE_NIMBUS_API_URL=
|
||||
RENDERER_VITE_REAL_DEBRID_REFERRAL_ID=
|
||||
RENDERER_VITE_TORBOX_REFERRAL_CODE=
|
||||
MAIN_VITE_LAUNCHER_SUBDOMAIN=
|
||||
|
||||
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -57,6 +57,7 @@ jobs:
|
||||
MAIN_VITE_AUTH_URL: ${{ vars.MAIN_VITE_STAGING_AUTH_URL }}
|
||||
MAIN_VITE_CHECKOUT_URL: ${{ vars.MAIN_VITE_STAGING_CHECKOUT_URL }}
|
||||
MAIN_VITE_WS_URL: ${{ vars.MAIN_VITE_WS_STAGING_URL }}
|
||||
MAIN_VITE_NIMBUS_API_URL: ${{ vars.MAIN_VITE_NIMBUS_API_URL }}
|
||||
RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }}
|
||||
MAIN_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -73,6 +74,7 @@ jobs:
|
||||
MAIN_VITE_AUTH_URL: ${{ vars.MAIN_VITE_STAGING_AUTH_URL }}
|
||||
MAIN_VITE_CHECKOUT_URL: ${{ vars.MAIN_VITE_STAGING_CHECKOUT_URL }}
|
||||
MAIN_VITE_WS_URL: ${{ vars.MAIN_VITE_WS_STAGING_URL }}
|
||||
MAIN_VITE_NIMBUS_API_URL: ${{ vars.MAIN_VITE_NIMBUS_API_URL }}
|
||||
RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }}
|
||||
MAIN_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
@@ -54,9 +54,10 @@ jobs:
|
||||
MAIN_VITE_API_URL: ${{ vars.MAIN_VITE_API_URL }}
|
||||
MAIN_VITE_AUTH_URL: ${{ vars.MAIN_VITE_AUTH_URL }}
|
||||
MAIN_VITE_CHECKOUT_URL: ${{ vars.MAIN_VITE_CHECKOUT_URL }}
|
||||
MAIN_VITE_WS_URL: ${{ vars.MAIN_VITE_WS_URL }}
|
||||
MAIN_VITE_NIMBUS_API_URL: ${{ vars.MAIN_VITE_NIMBUS_API_URL }}
|
||||
RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }}
|
||||
MAIN_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }}
|
||||
MAIN_VITE_WS_URL: ${{ vars.MAIN_VITE_WS_URL }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
RENDERER_VITE_SENTRY_DSN: ${{ vars.SENTRY_DSN }}
|
||||
@@ -71,9 +72,10 @@ jobs:
|
||||
MAIN_VITE_API_URL: ${{ vars.MAIN_VITE_API_URL }}
|
||||
MAIN_VITE_AUTH_URL: ${{ vars.MAIN_VITE_AUTH_URL }}
|
||||
MAIN_VITE_CHECKOUT_URL: ${{ vars.MAIN_VITE_CHECKOUT_URL }}
|
||||
MAIN_VITE_WS_URL: ${{ vars.MAIN_VITE_WS_URL }}
|
||||
MAIN_VITE_NIMBUS_API_URL: ${{ vars.MAIN_VITE_NIMBUS_API_URL }}
|
||||
RENDERER_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }}
|
||||
MAIN_VITE_EXTERNAL_RESOURCES_URL: ${{ vars.EXTERNAL_RESOURCES_URL }}
|
||||
MAIN_VITE_WS_URL: ${{ vars.MAIN_VITE_WS_URL }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
RENDERER_VITE_SENTRY_DSN: ${{ vars.SENTRY_DSN }}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import aria2p
|
||||
from aria2p.client import ClientException as DownloadNotFound
|
||||
|
||||
class HttpDownloader:
|
||||
def __init__(self):
|
||||
@@ -11,12 +12,16 @@ class HttpDownloader:
|
||||
)
|
||||
)
|
||||
|
||||
def start_download(self, url: str, save_path: str, header: str, out: str = None):
|
||||
def start_download(self, url: str, save_path: str, header, out: str = None):
|
||||
if self.download:
|
||||
self.aria2.resume([self.download])
|
||||
else:
|
||||
downloads = self.aria2.add(url, options={"header": header, "dir": save_path, "out": out})
|
||||
|
||||
options = {"dir": save_path}
|
||||
if header:
|
||||
options["header"] = header
|
||||
if out:
|
||||
options["out"] = out
|
||||
downloads = self.aria2.add(url, options=options)
|
||||
self.download = downloads[0]
|
||||
|
||||
def pause_download(self):
|
||||
@@ -32,7 +37,11 @@ class HttpDownloader:
|
||||
if self.download == None:
|
||||
return None
|
||||
|
||||
download = self.aria2.get_download(self.download.gid)
|
||||
try:
|
||||
download = self.aria2.get_download(self.download.gid)
|
||||
except DownloadNotFound:
|
||||
self.download = None
|
||||
return None
|
||||
|
||||
response = {
|
||||
'folderName': download.name,
|
||||
|
||||
@@ -175,6 +175,7 @@
|
||||
"repacks_modal_description": "Choose the repack you want to download",
|
||||
"select_folder_hint": "To change the default folder, go to the <0>Settings</0>",
|
||||
"download_now": "Download now",
|
||||
"loading": "Loading...",
|
||||
"no_shop_details": "Could not retrieve shop details.",
|
||||
"download_options": "Download options",
|
||||
"download_path": "Download path",
|
||||
@@ -795,6 +796,7 @@
|
||||
"empty_description": "You're all caught up! Check back later for new updates.",
|
||||
"empty_filter_description": "No notifications match this filter.",
|
||||
"filter_all": "All",
|
||||
"filter_unread": "Unread",
|
||||
"filter_friends": "Friends",
|
||||
"filter_badges": "Badges",
|
||||
"filter_upvotes": "Upvotes",
|
||||
|
||||
@@ -21,6 +21,7 @@ export class Aria2 {
|
||||
"--rpc-listen-all",
|
||||
"--file-allocation=none",
|
||||
"--allow-overwrite=true",
|
||||
"--disable-ipv6",
|
||||
],
|
||||
{ stdio: "inherit", windowsHide: true }
|
||||
);
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
DatanodesApi,
|
||||
MediafireApi,
|
||||
PixelDrainApi,
|
||||
VikingFileApi,
|
||||
} from "../hosters";
|
||||
import { PythonRPC } from "../python-rpc";
|
||||
import {
|
||||
@@ -150,14 +151,28 @@ export class DownloadManager {
|
||||
if (!isDownloadingMetadata && !isCheckingFiles) {
|
||||
if (!download) return null;
|
||||
|
||||
await downloadsSublevel.put(downloadId, {
|
||||
const updatedDownload = {
|
||||
...download,
|
||||
bytesDownloaded,
|
||||
fileSize,
|
||||
progress,
|
||||
folderName,
|
||||
status: "active",
|
||||
});
|
||||
status: "active" as const,
|
||||
};
|
||||
|
||||
await downloadsSublevel.put(downloadId, updatedDownload);
|
||||
|
||||
return {
|
||||
numPeers,
|
||||
numSeeds,
|
||||
downloadSpeed,
|
||||
timeRemaining: calculateETA(fileSize, bytesDownloaded, downloadSpeed),
|
||||
isDownloadingMetadata,
|
||||
isCheckingFiles,
|
||||
progress,
|
||||
gameId: downloadId,
|
||||
download: updatedDownload,
|
||||
} as DownloadProgress;
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -499,6 +514,29 @@ export class DownloadManager {
|
||||
allow_multiple_connections: true,
|
||||
};
|
||||
}
|
||||
case Downloader.VikingFile: {
|
||||
logger.log(
|
||||
`[DownloadManager] Processing VikingFile download for URI: ${download.uri}`
|
||||
);
|
||||
try {
|
||||
const downloadUrl = await VikingFileApi.getDownloadUrl(download.uri);
|
||||
logger.log(`[DownloadManager] VikingFile direct URL obtained`);
|
||||
return {
|
||||
action: "start",
|
||||
game_id: downloadId,
|
||||
url: downloadUrl,
|
||||
save_path: download.downloadPath,
|
||||
header:
|
||||
"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",
|
||||
};
|
||||
} catch (error) {
|
||||
logger.error(
|
||||
`[DownloadManager] Error processing VikingFile download:`,
|
||||
error
|
||||
);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import axios from "axios";
|
||||
import http from "node:http";
|
||||
import https from "node:https";
|
||||
import {
|
||||
HOSTER_USER_AGENT,
|
||||
extractHosterFilename,
|
||||
@@ -28,6 +30,12 @@ export class BuzzheavierApi {
|
||||
await axios.get(baseUrl, {
|
||||
headers: { "User-Agent": HOSTER_USER_AGENT },
|
||||
timeout: 30000,
|
||||
httpAgent: new http.Agent({
|
||||
family: 4, // Force IPv4
|
||||
}),
|
||||
httpsAgent: new https.Agent({
|
||||
family: 4, // Force IPv4
|
||||
}),
|
||||
});
|
||||
|
||||
const downloadUrl = `${baseUrl}/download`;
|
||||
@@ -43,6 +51,12 @@ export class BuzzheavierApi {
|
||||
validateStatus: (status) =>
|
||||
status === 200 || status === 204 || status === 301 || status === 302,
|
||||
timeout: 30000,
|
||||
httpAgent: new http.Agent({
|
||||
family: 4, // Force IPv4
|
||||
}),
|
||||
httpsAgent: new https.Agent({
|
||||
family: 4, // Force IPv4
|
||||
}),
|
||||
});
|
||||
|
||||
const hxRedirect = headResponse.headers["hx-redirect"];
|
||||
|
||||
@@ -5,3 +5,4 @@ export * from "./mediafire";
|
||||
export * from "./pixeldrain";
|
||||
export * from "./buzzheavier";
|
||||
export * from "./fuckingfast";
|
||||
export * from "./vikingfile";
|
||||
|
||||
59
src/main/services/hosters/vikingfile.ts
Normal file
59
src/main/services/hosters/vikingfile.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import axios from "axios";
|
||||
import https from "node:https";
|
||||
import { logger } from "../logger";
|
||||
|
||||
interface UnlockResponse {
|
||||
link: string;
|
||||
hoster: string;
|
||||
}
|
||||
|
||||
export class VikingFileApi {
|
||||
private static readonly browserHeaders = {
|
||||
"User-Agent":
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",
|
||||
Accept: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
Referer: "https://vikingfile.com/",
|
||||
};
|
||||
|
||||
public static async getDownloadUrl(uri: string): Promise<string> {
|
||||
const unlockResponse = await axios.post<UnlockResponse>(
|
||||
`${import.meta.env.MAIN_VITE_NIMBUS_API_URL}/hosters/unlock`,
|
||||
{ url: uri }
|
||||
);
|
||||
|
||||
if (!unlockResponse.data.link) {
|
||||
throw new Error("Failed to unlock VikingFile URL");
|
||||
}
|
||||
|
||||
const redirectUrl = unlockResponse.data.link;
|
||||
|
||||
// Follow the redirect to get the final Cloudflare storage URL
|
||||
try {
|
||||
const redirectResponse = await axios.head(redirectUrl, {
|
||||
headers: this.browserHeaders,
|
||||
maxRedirects: 0,
|
||||
validateStatus: (status) =>
|
||||
status === 301 || status === 302 || status === 200,
|
||||
httpsAgent: new https.Agent({
|
||||
family: 4, // Force IPv4
|
||||
}),
|
||||
});
|
||||
|
||||
if (
|
||||
redirectResponse.headers.location ||
|
||||
redirectResponse.status === 301 ||
|
||||
redirectResponse.status === 302
|
||||
) {
|
||||
return redirectResponse.headers.location || redirectUrl;
|
||||
}
|
||||
|
||||
return redirectUrl;
|
||||
} catch (error) {
|
||||
logger.error(
|
||||
`[VikingFile] Error following redirect, using redirect URL:`,
|
||||
error
|
||||
);
|
||||
return redirectUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import axios from "axios";
|
||||
import http from "node:http";
|
||||
|
||||
import cp from "node:child_process";
|
||||
import fs from "node:fs";
|
||||
@@ -31,6 +32,9 @@ export class PythonRPC {
|
||||
public static readonly RPC_PORT = "8084";
|
||||
public static readonly rpc = axios.create({
|
||||
baseURL: `http://localhost:${this.RPC_PORT}`,
|
||||
httpAgent: new http.Agent({
|
||||
family: 4, // Force IPv4
|
||||
}),
|
||||
});
|
||||
|
||||
private static pythonProcess: cp.ChildProcess | null = null;
|
||||
|
||||
1
src/main/vite-env.d.ts
vendored
1
src/main/vite-env.d.ts
vendored
@@ -7,6 +7,7 @@ interface ImportMetaEnv {
|
||||
readonly MAIN_VITE_CHECKOUT_URL: string;
|
||||
readonly MAIN_VITE_EXTERNAL_RESOURCES_URL: string;
|
||||
readonly MAIN_VITE_WS_URL: string;
|
||||
readonly MAIN_VITE_NIMBUS_API_URL: string;
|
||||
readonly MAIN_VITE_LAUNCHER_SUBDOMAIN: string;
|
||||
readonly ELECTRON_RENDERER_URL: string;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ export const DOWNLOADER_NAME = {
|
||||
[Downloader.FuckingFast]: "FuckingFast",
|
||||
[Downloader.TorBox]: "TorBox",
|
||||
[Downloader.Hydra]: "Nimbus",
|
||||
[Downloader.VikingFile]: "VikingFile",
|
||||
};
|
||||
|
||||
export const MAX_MINUTES_TO_SHOW_IN_PLAYTIME = 120;
|
||||
|
||||
@@ -19,23 +19,67 @@
|
||||
color: globals.$body-color;
|
||||
}
|
||||
|
||||
&__downloaders {
|
||||
display: grid;
|
||||
gap: globals.$spacing-unit;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
&__downloaders-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: calc(globals.$spacing-unit / 2);
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
border: 1px solid globals.$border-color;
|
||||
border-radius: 4px;
|
||||
padding: calc(globals.$spacing-unit / 2);
|
||||
background-color: globals.$dark-background-color;
|
||||
}
|
||||
|
||||
&__downloader-option {
|
||||
position: relative;
|
||||
&__downloader-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: calc(globals.$spacing-unit * 1.5);
|
||||
padding: calc(globals.$spacing-unit * 1.5) calc(globals.$spacing-unit * 2);
|
||||
border: 1px solid transparent;
|
||||
border-radius: 4px;
|
||||
background-color: transparent;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
background-color 0.15s ease,
|
||||
border-color 0.15s ease;
|
||||
color: globals.$body-color;
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
|
||||
&:only-child {
|
||||
grid-column: 1 / -1;
|
||||
&:hover:not(&--disabled) {
|
||||
background-color: rgba(255, 255, 255, 0.05);
|
||||
}
|
||||
|
||||
&--selected {
|
||||
background-color: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
&--disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
&__downloader-icon {
|
||||
position: absolute;
|
||||
left: calc(globals.$spacing-unit * 2);
|
||||
&__downloader-name {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&__availability-indicator {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
|
||||
&--available {
|
||||
background-color: #22c55e;
|
||||
box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
|
||||
}
|
||||
|
||||
&--unavailable {
|
||||
background-color: #ef4444;
|
||||
box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
&__path-error {
|
||||
@@ -49,4 +93,17 @@
|
||||
&__change-path-button {
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
&__loading-spinner {
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,13 @@ import {
|
||||
Modal,
|
||||
TextField,
|
||||
} from "@renderer/components";
|
||||
import { CheckCircleFillIcon, DownloadIcon } from "@primer/octicons-react";
|
||||
import { Downloader, formatBytes, getDownloadersForUris } from "@shared";
|
||||
import { DownloadIcon, SyncIcon } from "@primer/octicons-react";
|
||||
import {
|
||||
Downloader,
|
||||
formatBytes,
|
||||
getDownloadersForUri,
|
||||
getDownloadersForUris,
|
||||
} from "@shared";
|
||||
import type { GameRepack } from "@types";
|
||||
import { DOWNLOADER_NAME } from "@renderer/constants";
|
||||
import { useAppSelector, useFeature, useToast } from "@renderer/hooks";
|
||||
@@ -82,6 +87,40 @@ export function DownloadSettingsModal({
|
||||
return getDownloadersForUris(repack?.uris ?? []);
|
||||
}, [repack?.uris]);
|
||||
|
||||
const downloadOptions = useMemo(() => {
|
||||
if (!repack) return [];
|
||||
|
||||
const unavailableUrisSet = new Set(repack.unavailableUris ?? []);
|
||||
|
||||
const downloaderMap = new Map<
|
||||
Downloader,
|
||||
{ hasAvailable: boolean; hasUnavailable: boolean }
|
||||
>();
|
||||
|
||||
for (const uri of repack.uris) {
|
||||
const uriDownloaders = getDownloadersForUri(uri);
|
||||
const isAvailable = !unavailableUrisSet.has(uri);
|
||||
|
||||
for (const downloader of uriDownloaders) {
|
||||
const existing = downloaderMap.get(downloader);
|
||||
if (existing) {
|
||||
existing.hasAvailable = existing.hasAvailable || isAvailable;
|
||||
existing.hasUnavailable = existing.hasUnavailable || !isAvailable;
|
||||
} else {
|
||||
downloaderMap.set(downloader, {
|
||||
hasAvailable: isAvailable,
|
||||
hasUnavailable: !isAvailable,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Array.from(downloaderMap.entries()).map(([downloader, status]) => ({
|
||||
downloader,
|
||||
isAvailable: status.hasAvailable,
|
||||
}));
|
||||
}, [repack]);
|
||||
|
||||
const getDefaultDownloader = useCallback(
|
||||
(availableDownloaders: Downloader[]) => {
|
||||
if (availableDownloaders.length === 0) return null;
|
||||
@@ -186,31 +225,47 @@ export function DownloadSettingsModal({
|
||||
<div className="download-settings-modal__downloads-path-field">
|
||||
<span>{t("downloader")}</span>
|
||||
|
||||
<div className="download-settings-modal__downloaders">
|
||||
{downloaders.map((downloader) => {
|
||||
const shouldDisableButton =
|
||||
(downloader === Downloader.RealDebrid &&
|
||||
<div className="download-settings-modal__downloaders-list">
|
||||
{downloadOptions.map((option) => {
|
||||
const isUnavailable = !option.isAvailable;
|
||||
const shouldDisableOption =
|
||||
isUnavailable ||
|
||||
(option.downloader === Downloader.RealDebrid &&
|
||||
!userPreferences?.realDebridApiToken) ||
|
||||
(downloader === Downloader.TorBox &&
|
||||
(option.downloader === Downloader.TorBox &&
|
||||
!userPreferences?.torBoxApiToken) ||
|
||||
(downloader === Downloader.Hydra &&
|
||||
(option.downloader === Downloader.Hydra &&
|
||||
!isFeatureEnabled(Feature.Nimbus));
|
||||
|
||||
const isSelected = selectedDownloader === option.downloader;
|
||||
|
||||
return (
|
||||
<Button
|
||||
key={downloader}
|
||||
className="download-settings-modal__downloader-option"
|
||||
theme={
|
||||
selectedDownloader === downloader ? "primary" : "outline"
|
||||
}
|
||||
disabled={shouldDisableButton}
|
||||
onClick={() => setSelectedDownloader(downloader)}
|
||||
<button
|
||||
type="button"
|
||||
key={option.downloader}
|
||||
className={`download-settings-modal__downloader-item ${
|
||||
isSelected
|
||||
? "download-settings-modal__downloader-item--selected"
|
||||
: ""
|
||||
} ${
|
||||
shouldDisableOption
|
||||
? "download-settings-modal__downloader-item--disabled"
|
||||
: ""
|
||||
}`}
|
||||
disabled={shouldDisableOption}
|
||||
onClick={() => setSelectedDownloader(option.downloader)}
|
||||
>
|
||||
{selectedDownloader === downloader && (
|
||||
<CheckCircleFillIcon className="download-settings-modal__downloader-icon" />
|
||||
)}
|
||||
{DOWNLOADER_NAME[downloader]}
|
||||
</Button>
|
||||
<span className="download-settings-modal__downloader-name">
|
||||
{DOWNLOADER_NAME[option.downloader]}
|
||||
</span>
|
||||
<span
|
||||
className={`download-settings-modal__availability-indicator ${
|
||||
option.isAvailable
|
||||
? "download-settings-modal__availability-indicator--available"
|
||||
: "download-settings-modal__availability-indicator--unavailable"
|
||||
}`}
|
||||
/>
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
@@ -267,8 +322,17 @@ export function DownloadSettingsModal({
|
||||
!hasWritePermission
|
||||
}
|
||||
>
|
||||
<DownloadIcon />
|
||||
{t("download_now")}
|
||||
{downloadStarting ? (
|
||||
<>
|
||||
<SyncIcon className="download-settings-modal__loading-spinner" />
|
||||
{t("loading")}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<DownloadIcon />
|
||||
{t("download_now")}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
@@ -221,6 +221,26 @@
|
||||
left: 0;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
&__cover-placeholder {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-width: 100%;
|
||||
min-height: 100%;
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
rgba(255, 255, 255, 0.08) 0%,
|
||||
rgba(255, 255, 255, 0.04) 50%,
|
||||
rgba(255, 255, 255, 0.08) 100%
|
||||
);
|
||||
border-radius: 4px;
|
||||
color: rgba(255, 255, 255, 0.3);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import { LibraryGame } from "@types";
|
||||
import { useGameCard } from "@renderer/hooks";
|
||||
import { memo } from "react";
|
||||
import { ClockIcon, AlertFillIcon, TrophyIcon } from "@primer/octicons-react";
|
||||
import { memo, useState } from "react";
|
||||
import {
|
||||
ClockIcon,
|
||||
AlertFillIcon,
|
||||
TrophyIcon,
|
||||
ImageIcon,
|
||||
} from "@primer/octicons-react";
|
||||
import "./library-game-card.scss";
|
||||
|
||||
interface LibraryGameCardProps {
|
||||
@@ -25,14 +30,9 @@ export const LibraryGameCard = memo(function LibraryGameCard({
|
||||
const { formatPlayTime, handleCardClick, handleContextMenuClick } =
|
||||
useGameCard(game, onContextMenu);
|
||||
|
||||
const coverImage = (
|
||||
game.customIconUrl ??
|
||||
game.coverImageUrl ??
|
||||
game.libraryImageUrl ??
|
||||
game.libraryHeroImageUrl ??
|
||||
game.iconUrl ??
|
||||
""
|
||||
).replaceAll("\\", "/");
|
||||
const coverImage = game.coverImageUrl?.replaceAll("\\", "/") ?? "";
|
||||
|
||||
const [imageError, setImageError] = useState(false);
|
||||
|
||||
return (
|
||||
<button
|
||||
@@ -98,12 +98,19 @@ export const LibraryGameCard = memo(function LibraryGameCard({
|
||||
)}
|
||||
</div>
|
||||
|
||||
<img
|
||||
src={coverImage ?? undefined}
|
||||
alt={game.title}
|
||||
className="library-game-card__game-image"
|
||||
loading="lazy"
|
||||
/>
|
||||
{imageError || !coverImage ? (
|
||||
<div className="library-game-card__cover-placeholder">
|
||||
<ImageIcon size={48} />
|
||||
</div>
|
||||
) : (
|
||||
<img
|
||||
src={coverImage}
|
||||
alt={game.title}
|
||||
className="library-game-card__game-image"
|
||||
loading="lazy"
|
||||
onError={() => setImageError(true)}
|
||||
/>
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -8,6 +8,72 @@
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
min-height: calc(100vh - 200px);
|
||||
|
||||
&__header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: calc(globals.$spacing-unit * 2);
|
||||
}
|
||||
|
||||
&__filter-tabs {
|
||||
display: flex;
|
||||
gap: globals.$spacing-unit;
|
||||
position: relative;
|
||||
flex: 1;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
&__tab-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&__tab {
|
||||
background: none;
|
||||
border: none;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
padding: calc(globals.$spacing-unit) calc(globals.$spacing-unit * 2);
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
transition: color ease 0.2s;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: calc(globals.$spacing-unit * 0.5);
|
||||
|
||||
&:hover {
|
||||
color: rgba(255, 255, 255, 0.8);
|
||||
}
|
||||
|
||||
&--active {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
|
||||
&__tab-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 20px;
|
||||
height: 20px;
|
||||
padding: 0 6px;
|
||||
background-color: rgba(255, 255, 255, 0.15);
|
||||
border-radius: 6px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: rgba(255, 255, 255, 0.9);
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
&__tab-underline {
|
||||
position: absolute;
|
||||
bottom: -1px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 2px;
|
||||
background: white;
|
||||
}
|
||||
|
||||
&__actions {
|
||||
display: flex;
|
||||
@@ -15,6 +81,12 @@
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
&__content-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&__list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -23,14 +95,22 @@
|
||||
|
||||
&__empty {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
gap: globals.$spacing-unit;
|
||||
}
|
||||
|
||||
&__empty-filter {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: calc(globals.$spacing-unit * 6);
|
||||
color: globals.$body-color;
|
||||
}
|
||||
|
||||
&__icon-container {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { BellIcon } from "@primer/octicons-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { AnimatePresence, motion } from "framer-motion";
|
||||
@@ -18,6 +18,11 @@ import type {
|
||||
} from "@types";
|
||||
import "./notifications.scss";
|
||||
|
||||
type NotificationFilter = "all" | "unread";
|
||||
|
||||
const STAGGER_DELAY_MS = 70;
|
||||
const EXIT_DURATION_MS = 250;
|
||||
|
||||
export default function Notifications() {
|
||||
const { t, i18n } = useTranslation("notifications_page");
|
||||
const { showSuccessToast, showErrorToast } = useToast();
|
||||
@@ -34,12 +39,14 @@ export default function Notifications() {
|
||||
>([]);
|
||||
const [badges, setBadges] = useState<Badge[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [clearingIds, setClearingIds] = useState<Set<string>>(new Set());
|
||||
const [isClearing, setIsClearing] = useState(false);
|
||||
const [filter, setFilter] = useState<NotificationFilter>("all");
|
||||
const [pagination, setPagination] = useState({
|
||||
total: 0,
|
||||
hasMore: false,
|
||||
skip: 0,
|
||||
});
|
||||
const clearingTimeoutsRef = useRef<NodeJS.Timeout[]>([]);
|
||||
|
||||
const fetchLocalNotifications = useCallback(async () => {
|
||||
try {
|
||||
@@ -65,7 +72,11 @@ export default function Notifications() {
|
||||
}, [i18n.language]);
|
||||
|
||||
const fetchApiNotifications = useCallback(
|
||||
async (skip = 0, append = false) => {
|
||||
async (
|
||||
skip = 0,
|
||||
append = false,
|
||||
filterParam: NotificationFilter = "all"
|
||||
) => {
|
||||
if (!userDetails) return;
|
||||
|
||||
try {
|
||||
@@ -74,7 +85,7 @@ export default function Notifications() {
|
||||
await window.electron.hydraApi.get<NotificationsResponse>(
|
||||
"/profile/notifications",
|
||||
{
|
||||
params: { filter: "all", take: 20, skip },
|
||||
params: { filter: filterParam, take: 20, skip },
|
||||
needsAuth: true,
|
||||
}
|
||||
);
|
||||
@@ -101,24 +112,24 @@ export default function Notifications() {
|
||||
[userDetails]
|
||||
);
|
||||
|
||||
const fetchAllNotifications = useCallback(async () => {
|
||||
setIsLoading(true);
|
||||
await Promise.all([
|
||||
fetchLocalNotifications(),
|
||||
fetchBadges(),
|
||||
userDetails ? fetchApiNotifications(0, false) : Promise.resolve(),
|
||||
]);
|
||||
setIsLoading(false);
|
||||
}, [
|
||||
fetchLocalNotifications,
|
||||
fetchBadges,
|
||||
fetchApiNotifications,
|
||||
userDetails,
|
||||
]);
|
||||
const fetchAllNotifications = useCallback(
|
||||
async (filterParam: NotificationFilter = "all") => {
|
||||
setIsLoading(true);
|
||||
await Promise.all([
|
||||
fetchLocalNotifications(),
|
||||
fetchBadges(),
|
||||
userDetails
|
||||
? fetchApiNotifications(0, false, filterParam)
|
||||
: Promise.resolve(),
|
||||
]);
|
||||
setIsLoading(false);
|
||||
},
|
||||
[fetchLocalNotifications, fetchBadges, fetchApiNotifications, userDetails]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
fetchAllNotifications();
|
||||
}, [fetchAllNotifications]);
|
||||
fetchAllNotifications(filter);
|
||||
}, [fetchAllNotifications, filter]);
|
||||
|
||||
useEffect(() => {
|
||||
const unsubscribe = window.electron.onLocalNotificationCreated(
|
||||
@@ -130,6 +141,13 @@ export default function Notifications() {
|
||||
return () => unsubscribe();
|
||||
}, []);
|
||||
|
||||
// Cleanup timeouts on unmount
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
clearingTimeoutsRef.current.forEach(clearTimeout);
|
||||
};
|
||||
}, []);
|
||||
|
||||
const mergedNotifications = useMemo<MergedNotification[]>(() => {
|
||||
const sortByDate = (a: MergedNotification, b: MergedNotification) =>
|
||||
new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime();
|
||||
@@ -144,23 +162,28 @@ export default function Notifications() {
|
||||
.filter((n) => n.priority !== 1)
|
||||
.map((n) => ({ ...n, source: "api" as const }));
|
||||
|
||||
const localWithSource: MergedNotification[] = localNotifications.map(
|
||||
(n) => ({
|
||||
// Filter local notifications based on current filter
|
||||
const filteredLocalNotifications =
|
||||
filter === "unread"
|
||||
? localNotifications.filter((n) => !n.isRead)
|
||||
: localNotifications;
|
||||
|
||||
const localWithSource: MergedNotification[] =
|
||||
filteredLocalNotifications.map((n) => ({
|
||||
...n,
|
||||
source: "local" as const,
|
||||
})
|
||||
);
|
||||
}));
|
||||
|
||||
const lowPriority = [...lowPriorityApi, ...localWithSource].sort(
|
||||
sortByDate
|
||||
);
|
||||
|
||||
return [...highPriority, ...lowPriority];
|
||||
}, [apiNotifications, localNotifications]);
|
||||
}, [apiNotifications, localNotifications, filter]);
|
||||
|
||||
const displayedNotifications = useMemo(() => {
|
||||
return mergedNotifications.filter((n) => !clearingIds.has(n.id));
|
||||
}, [mergedNotifications, clearingIds]);
|
||||
return mergedNotifications;
|
||||
}, [mergedNotifications]);
|
||||
|
||||
const notifyCountChange = useCallback(() => {
|
||||
window.dispatchEvent(new CustomEvent("notificationsChanged"));
|
||||
@@ -251,42 +274,86 @@ export default function Notifications() {
|
||||
[showErrorToast, t, notifyCountChange]
|
||||
);
|
||||
|
||||
const removeNotificationFromState = useCallback(
|
||||
(notification: MergedNotification) => {
|
||||
if (notification.source === "api") {
|
||||
setApiNotifications((prev) =>
|
||||
prev.filter((n) => n.id !== notification.id)
|
||||
);
|
||||
} else {
|
||||
setLocalNotifications((prev) =>
|
||||
prev.filter((n) => n.id !== notification.id)
|
||||
);
|
||||
}
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
const removeNotificationWithDelay = useCallback(
|
||||
(notification: MergedNotification, delayMs: number): Promise<void> => {
|
||||
return new Promise<void>((resolve) => {
|
||||
const timeout = setTimeout(() => {
|
||||
removeNotificationFromState(notification);
|
||||
resolve();
|
||||
}, delayMs);
|
||||
|
||||
clearingTimeoutsRef.current.push(timeout);
|
||||
});
|
||||
},
|
||||
[removeNotificationFromState]
|
||||
);
|
||||
|
||||
const handleClearAll = useCallback(async () => {
|
||||
if (isClearing) return;
|
||||
|
||||
try {
|
||||
// Mark all as clearing for animation
|
||||
const allIds = new Set([
|
||||
...apiNotifications.map((n) => n.id),
|
||||
...localNotifications.map((n) => n.id),
|
||||
]);
|
||||
setClearingIds(allIds);
|
||||
setIsClearing(true);
|
||||
|
||||
// Wait for exit animation
|
||||
await new Promise((resolve) => setTimeout(resolve, 300));
|
||||
// Clear any existing timeouts
|
||||
clearingTimeoutsRef.current.forEach(clearTimeout);
|
||||
clearingTimeoutsRef.current = [];
|
||||
|
||||
// Clear all API notifications
|
||||
if (userDetails && apiNotifications.length > 0) {
|
||||
// Snapshot current notifications for staggered removal
|
||||
const notificationsToRemove = [...displayedNotifications];
|
||||
const totalNotifications = notificationsToRemove.length;
|
||||
|
||||
if (totalNotifications === 0) {
|
||||
setIsClearing(false);
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove items one by one with staggered delays for visual effect
|
||||
const removalPromises = notificationsToRemove.map((notification, index) =>
|
||||
removeNotificationWithDelay(notification, index * STAGGER_DELAY_MS)
|
||||
);
|
||||
|
||||
// Wait for all items to be removed from state
|
||||
await Promise.all(removalPromises);
|
||||
|
||||
// Wait for the last exit animation to complete
|
||||
await new Promise((resolve) => setTimeout(resolve, EXIT_DURATION_MS));
|
||||
|
||||
// Perform actual backend deletions (state is already cleared by staggered removal)
|
||||
if (userDetails) {
|
||||
await window.electron.hydraApi.delete(`/profile/notifications/all`, {
|
||||
needsAuth: true,
|
||||
});
|
||||
setApiNotifications([]);
|
||||
}
|
||||
|
||||
// Clear all local notifications
|
||||
await window.electron.clearAllLocalNotifications();
|
||||
setLocalNotifications([]);
|
||||
|
||||
setClearingIds(new Set());
|
||||
setPagination({ total: 0, hasMore: false, skip: 0 });
|
||||
notifyCountChange();
|
||||
showSuccessToast(t("cleared_all"));
|
||||
} catch (error) {
|
||||
logger.error("Failed to clear all notifications", error);
|
||||
setClearingIds(new Set());
|
||||
showErrorToast(t("failed_to_clear"));
|
||||
} finally {
|
||||
setIsClearing(false);
|
||||
clearingTimeoutsRef.current = [];
|
||||
}
|
||||
}, [
|
||||
apiNotifications,
|
||||
localNotifications,
|
||||
displayedNotifications,
|
||||
isClearing,
|
||||
removeNotificationWithDelay,
|
||||
userDetails,
|
||||
showSuccessToast,
|
||||
showErrorToast,
|
||||
@@ -296,9 +363,19 @@ export default function Notifications() {
|
||||
|
||||
const handleLoadMore = useCallback(() => {
|
||||
if (pagination.hasMore && !isLoading) {
|
||||
fetchApiNotifications(pagination.skip, true);
|
||||
fetchApiNotifications(pagination.skip, true, filter);
|
||||
}
|
||||
}, [pagination, isLoading, fetchApiNotifications]);
|
||||
}, [pagination, isLoading, fetchApiNotifications, filter]);
|
||||
|
||||
const handleFilterChange = useCallback(
|
||||
(newFilter: NotificationFilter) => {
|
||||
if (newFilter !== filter) {
|
||||
setFilter(newFilter);
|
||||
setPagination({ total: 0, hasMore: false, skip: 0 });
|
||||
}
|
||||
},
|
||||
[filter]
|
||||
);
|
||||
|
||||
const handleAcceptFriendRequest = useCallback(() => {
|
||||
showSuccessToast(t("friend_request_accepted"));
|
||||
@@ -317,10 +394,13 @@ export default function Notifications() {
|
||||
return (
|
||||
<motion.div
|
||||
key={key}
|
||||
layout
|
||||
initial={{ opacity: 0, x: -20 }}
|
||||
animate={{ opacity: 1, x: 0 }}
|
||||
exit={{ opacity: 0, x: 100, transition: { duration: 0.2 } }}
|
||||
exit={{
|
||||
opacity: 0,
|
||||
x: 80,
|
||||
transition: { duration: EXIT_DURATION_MS / 1000 },
|
||||
}}
|
||||
transition={{ duration: 0.2 }}
|
||||
>
|
||||
{notification.source === "local" ? (
|
||||
@@ -343,8 +423,57 @@ export default function Notifications() {
|
||||
);
|
||||
};
|
||||
|
||||
const unreadCount = useMemo(() => {
|
||||
const apiUnread = apiNotifications.filter((n) => !n.isRead).length;
|
||||
const localUnread = localNotifications.filter((n) => !n.isRead).length;
|
||||
return apiUnread + localUnread;
|
||||
}, [apiNotifications, localNotifications]);
|
||||
|
||||
const renderFilterTabs = () => (
|
||||
<div className="notifications__filter-tabs">
|
||||
<div className="notifications__tab-wrapper">
|
||||
<button
|
||||
type="button"
|
||||
className={`notifications__tab ${filter === "all" ? "notifications__tab--active" : ""}`}
|
||||
onClick={() => handleFilterChange("all")}
|
||||
>
|
||||
{t("filter_all")}
|
||||
</button>
|
||||
{filter === "all" && (
|
||||
<motion.div
|
||||
className="notifications__tab-underline"
|
||||
layoutId="notifications-tab-underline"
|
||||
transition={{ type: "spring", stiffness: 300, damping: 30 }}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div className="notifications__tab-wrapper">
|
||||
<button
|
||||
type="button"
|
||||
className={`notifications__tab ${filter === "unread" ? "notifications__tab--active" : ""}`}
|
||||
onClick={() => handleFilterChange("unread")}
|
||||
>
|
||||
{t("filter_unread")}
|
||||
{unreadCount > 0 && (
|
||||
<span className="notifications__tab-badge">{unreadCount}</span>
|
||||
)}
|
||||
</button>
|
||||
{filter === "unread" && (
|
||||
<motion.div
|
||||
className="notifications__tab-underline"
|
||||
layoutId="notifications-tab-underline"
|
||||
transition={{ type: "spring", stiffness: 300, damping: 30 }}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
const hasNoNotifications = mergedNotifications.length === 0;
|
||||
const shouldDisableActions = isClearing || hasNoNotifications;
|
||||
|
||||
const renderContent = () => {
|
||||
if (isLoading && mergedNotifications.length === 0) {
|
||||
if (isLoading && hasNoNotifications) {
|
||||
return (
|
||||
<div className="notifications__loading">
|
||||
<span>{t("loading")}</span>
|
||||
@@ -352,36 +481,61 @@ export default function Notifications() {
|
||||
);
|
||||
}
|
||||
|
||||
if (mergedNotifications.length === 0) {
|
||||
return (
|
||||
<div className="notifications__empty">
|
||||
<div className="notifications__icon-container">
|
||||
<BellIcon size={24} />
|
||||
</div>
|
||||
<h2>{t("empty_title")}</h2>
|
||||
<p>{t("empty_description")}</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="notifications">
|
||||
<div className="notifications__actions">
|
||||
<Button theme="outline" onClick={handleMarkAllAsRead}>
|
||||
{t("mark_all_as_read")}
|
||||
</Button>
|
||||
<Button theme="danger" onClick={handleClearAll}>
|
||||
{t("clear_all")}
|
||||
</Button>
|
||||
<div className="notifications__header">
|
||||
{renderFilterTabs()}
|
||||
<div className="notifications__actions">
|
||||
<Button
|
||||
theme="outline"
|
||||
onClick={handleMarkAllAsRead}
|
||||
disabled={shouldDisableActions}
|
||||
>
|
||||
{t("mark_all_as_read")}
|
||||
</Button>
|
||||
<Button
|
||||
theme="danger"
|
||||
onClick={handleClearAll}
|
||||
disabled={shouldDisableActions}
|
||||
>
|
||||
{t("clear_all")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="notifications__list">
|
||||
<AnimatePresence mode="popLayout">
|
||||
{displayedNotifications.map(renderNotification)}
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
{/* Keep AnimatePresence mounted during clearing to preserve exit animations */}
|
||||
<AnimatePresence mode="wait">
|
||||
<motion.div
|
||||
key={filter}
|
||||
className="notifications__content-wrapper"
|
||||
initial={{ opacity: 0, x: -10 }}
|
||||
animate={{ opacity: 1, x: 0 }}
|
||||
exit={{ opacity: 0, x: 10 }}
|
||||
transition={{ duration: 0.2 }}
|
||||
>
|
||||
{hasNoNotifications && !isClearing ? (
|
||||
<div className="notifications__empty">
|
||||
<div className="notifications__icon-container">
|
||||
<BellIcon size={24} />
|
||||
</div>
|
||||
<h2>{t("empty_title")}</h2>
|
||||
<p>
|
||||
{filter === "unread"
|
||||
? t("empty_filter_description")
|
||||
: t("empty_description")}
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="notifications__list">
|
||||
<AnimatePresence>
|
||||
{displayedNotifications.map(renderNotification)}
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
)}
|
||||
</motion.div>
|
||||
</AnimatePresence>
|
||||
|
||||
{pagination.hasMore && (
|
||||
{pagination.hasMore && !isClearing && (
|
||||
<div className="notifications__load-more">
|
||||
<Button
|
||||
theme="outline"
|
||||
|
||||
@@ -10,6 +10,7 @@ export enum Downloader {
|
||||
Hydra,
|
||||
Buzzheavier,
|
||||
FuckingFast,
|
||||
VikingFile,
|
||||
}
|
||||
|
||||
export enum DownloadSourceStatus {
|
||||
|
||||
@@ -124,6 +124,9 @@ export const getDownloadersForUri = (uri: string) => {
|
||||
if (uri.startsWith("https://fuckingfast.co")) {
|
||||
return [Downloader.FuckingFast];
|
||||
}
|
||||
if (uri.startsWith("https://vikingfile.com")) {
|
||||
return [Downloader.VikingFile];
|
||||
}
|
||||
|
||||
if (realDebridHosts.some((host) => uri.startsWith(host)))
|
||||
return [Downloader.RealDebrid];
|
||||
|
||||
@@ -20,6 +20,7 @@ export interface GameRepack {
|
||||
title: string;
|
||||
fileSize: string | null;
|
||||
uris: string[];
|
||||
unavailableUris: string[];
|
||||
uploadDate: string | null;
|
||||
downloadSourceId: string;
|
||||
downloadSourceName: string;
|
||||
|
||||
Reference in New Issue
Block a user