mirror of
https://github.com/Alvin-Zilverstand/Twitter-X-Media-Batch-Downloader.git
synced 2026-11-28 17:17:54 +01:00
v4.6
This commit is contained in:
1 parent
33be717065
commit
e05a9379fc
20 files changed
+1449
-611
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { useState, useEffect, useRef, useCallback, useMemo } from "react";
|
||||
import { useState, useEffect, useRef, useCallback, useMemo, useDeferredValue } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Input } from "@/components/ui/input";
|
||||
@@ -16,7 +16,7 @@ import { toastWithSound as toast } from "@/lib/toast-with-sound";
|
||||
import { getSettings } from "@/lib/settings";
|
||||
import { openExternal } from "@/lib/utils";
|
||||
import { GetAllAccountsFromDB, GetAccountFromDB, DeleteAccountFromDB, SaveAccountToDB, ExportAccountJSON, ExportAccountsTXT, UpdateAccountGroup, GetAllGroups, DownloadMediaWithMetadata, StopDownload, CheckFoldersExist, OpenFolder, GetFolderPath, } from "../../wailsjs/go/main/App";
|
||||
import { EventsOn, EventsOff } from "../../wailsjs/runtime/runtime";
|
||||
import { EventsOn } from "../../wailsjs/runtime/runtime";
|
||||
import { main } from "../../wailsjs/go/models";
|
||||
interface DownloadProgress {
|
||||
current: number;
|
||||
@@ -82,6 +82,7 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
const [filterMediaType, setFilterMediaType] = useState<string>("all");
|
||||
const [accountViewMode, setAccountViewMode] = useState<"public" | "private">("public");
|
||||
const [searchQuery, setSearchQuery] = useState<string>("");
|
||||
const deferredSearchQuery = useDeferredValue(searchQuery);
|
||||
const [sortOrder, setSortOrder] = useState<"newest" | "oldest" | "username-asc" | "username-desc" | "followers-high" | "followers-low" | "posts-high" | "posts-low" | "media-high" | "media-low">("newest");
|
||||
const [gridView, setGridView] = useState<"large" | "small" | "list">("list");
|
||||
const [editingAccount, setEditingAccount] = useState<AccountListItem | null>(null);
|
||||
@@ -147,7 +148,6 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
setDownloadProgress(progress);
|
||||
});
|
||||
return () => {
|
||||
EventsOff("download-progress");
|
||||
unsubscribe();
|
||||
};
|
||||
}, []);
|
||||
@@ -162,8 +162,8 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
const baseAccounts = accountViewMode === "public" ? publicAccounts : privateAccounts;
|
||||
return baseAccounts
|
||||
.filter((acc) => {
|
||||
if (searchQuery) {
|
||||
const query = searchQuery.toLowerCase();
|
||||
if (deferredSearchQuery) {
|
||||
const query = deferredSearchQuery.toLowerCase();
|
||||
const matchesUsername = acc.username.toLowerCase().includes(query);
|
||||
const matchesName = acc.name.toLowerCase().includes(query);
|
||||
if (!matchesUsername && !matchesName)
|
||||
@@ -219,7 +219,7 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}, [accountViewMode, filterGroup, filterMediaType, privateAccounts, publicAccounts, searchQuery, sortOrder]);
|
||||
}, [accountViewMode, filterGroup, filterMediaType, privateAccounts, publicAccounts, deferredSearchQuery, sortOrder]);
|
||||
const visibleAccounts = useMemo(() => filteredAccounts.slice(0, visibleCount), [filteredAccounts, visibleCount]);
|
||||
const visibleAccountsKey = visibleAccounts
|
||||
.map((account) => `${account.id}:${account.username}`)
|
||||
@@ -377,6 +377,10 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
})),
|
||||
output_dir: outputDir,
|
||||
username: actualUsername,
|
||||
concurrent_downloads: settings.concurrentDownloads || 10,
|
||||
skip_existing: settings.skipExistingFiles,
|
||||
delete_incomplete_files: settings.deleteIncompleteFiles,
|
||||
retry_attempts: settings.retryAttempts,
|
||||
proxy: settings.proxy || "",
|
||||
});
|
||||
const response = await DownloadMediaWithMetadata(request);
|
||||
@@ -496,6 +500,10 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
})),
|
||||
output_dir: outputDir,
|
||||
username: actualUsername,
|
||||
concurrent_downloads: settings.concurrentDownloads || 10,
|
||||
skip_existing: settings.skipExistingFiles,
|
||||
delete_incomplete_files: settings.deleteIncompleteFiles,
|
||||
retry_attempts: settings.retryAttempts,
|
||||
proxy: settings.proxy || "",
|
||||
});
|
||||
const response = await DownloadMediaWithMetadata(request);
|
||||
@@ -611,7 +619,15 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
input.type = "file";
|
||||
input.accept = ".json";
|
||||
input.multiple = true;
|
||||
input.style.display = "none";
|
||||
document.body.appendChild(input);
|
||||
const cleanup = () => {
|
||||
if (input.parentNode) {
|
||||
input.parentNode.removeChild(input);
|
||||
}
|
||||
};
|
||||
input.onchange = async (e) => {
|
||||
try {
|
||||
const files = (e.target as HTMLInputElement).files;
|
||||
if (!files || files.length === 0)
|
||||
return;
|
||||
@@ -710,6 +726,9 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
||||
else {
|
||||
toast.error("No valid files imported");
|
||||
}
|
||||
} finally {
|
||||
cleanup();
|
||||
}
|
||||
};
|
||||
input.click();
|
||||
};
|
||||
|
||||
@@ -11,8 +11,8 @@ export function Header({ version, hasUpdate, releaseDate }: HeaderProps) {
|
||||
return (<div className="relative">
|
||||
<div className="text-center space-y-2">
|
||||
<div className="flex items-center justify-center gap-3">
|
||||
<img src="/icon.svg" alt="Twitter/X Media Batch Downloader" className="w-12 h-12 cursor-pointer" onClick={() => window.location.reload()}/>
|
||||
<h1 className="text-3xl font-bold cursor-pointer" onClick={() => window.location.reload()}>
|
||||
<img src="/icon.svg" alt="Twitter/X Media Batch Downloader" className="w-12 h-12"/>
|
||||
<h1 className="text-3xl font-bold">
|
||||
Twitter/X Media Batch Downloader
|
||||
</h1>
|
||||
<div className="relative">
|
||||
|
||||
@@ -14,7 +14,7 @@ import { getSettings } from "@/lib/settings";
|
||||
import { getCachedDependencyStatus, getCachedMediaFolderStatus, setCachedDependencyStatus, setCachedMediaFolderStatus } from "@/lib/runtime-cache";
|
||||
import { openExternal } from "@/lib/utils";
|
||||
import { DownloadMediaWithMetadata, OpenFolder, IsFFmpegInstalled, ConvertGIFs, StopDownload, CheckFolderExists, CheckGifsFolderHasMP4 } from "../../wailsjs/go/main/App";
|
||||
import { EventsOn, EventsOff } from "../../wailsjs/runtime/runtime";
|
||||
import { EventsOn } from "../../wailsjs/runtime/runtime";
|
||||
import { main } from "../../wailsjs/go/models";
|
||||
interface DownloadProgress {
|
||||
current: number;
|
||||
@@ -185,7 +185,7 @@ export function MediaList({ accountInfo, timeline, totalUrls, fetchedMediaType =
|
||||
const cachedMediaFolderStatus = settings.downloadPath
|
||||
? getCachedMediaFolderStatus(settings.downloadPath, folderName)
|
||||
: null;
|
||||
const [selectedItems, setSelectedItems] = useState<Set<number>>(new Set());
|
||||
const [selectedItems, setSelectedItems] = useState<Set<string>>(new Set());
|
||||
const [sortBy, setSortBy] = useState<string>("date-desc");
|
||||
const [filterType, setFilterType] = useState<string>("all");
|
||||
const [viewMode, setViewMode] = useState<"large" | "small" | "list">("list");
|
||||
@@ -301,14 +301,13 @@ export function MediaList({ accountInfo, timeline, totalUrls, fetchedMediaType =
|
||||
setPreviewIndex(null);
|
||||
};
|
||||
useEffect(() => {
|
||||
if (previewIndex !== null) {
|
||||
document.body.style.overflow = "hidden";
|
||||
}
|
||||
else {
|
||||
document.body.style.overflow = "";
|
||||
if (previewIndex === null) {
|
||||
return;
|
||||
}
|
||||
const previousOverflow = document.body.style.overflow;
|
||||
document.body.style.overflow = "hidden";
|
||||
return () => {
|
||||
document.body.style.overflow = "";
|
||||
document.body.style.overflow = previousOverflow;
|
||||
};
|
||||
}, [previewIndex]);
|
||||
useEffect(() => {
|
||||
@@ -316,7 +315,6 @@ export function MediaList({ accountInfo, timeline, totalUrls, fetchedMediaType =
|
||||
setDownloadProgress(progress);
|
||||
});
|
||||
return () => {
|
||||
EventsOff("download-progress");
|
||||
unsubscribe();
|
||||
};
|
||||
}, []);
|
||||
@@ -361,7 +359,6 @@ export function MediaList({ accountInfo, timeline, totalUrls, fetchedMediaType =
|
||||
}
|
||||
});
|
||||
return () => {
|
||||
EventsOff("download-item-status");
|
||||
unsubscribe();
|
||||
};
|
||||
}, []);
|
||||
@@ -408,16 +405,16 @@ export function MediaList({ accountInfo, timeline, totalUrls, fetchedMediaType =
|
||||
setSelectedItems(new Set());
|
||||
}
|
||||
else {
|
||||
setSelectedItems(new Set(filteredTimeline.map((_, i) => i)));
|
||||
setSelectedItems(new Set(filteredTimeline.map((item) => getItemKey(item))));
|
||||
}
|
||||
};
|
||||
const toggleItem = (index: number) => {
|
||||
const toggleItem = (key: string) => {
|
||||
const newSelected = new Set(selectedItems);
|
||||
if (newSelected.has(index)) {
|
||||
newSelected.delete(index);
|
||||
if (newSelected.has(key)) {
|
||||
newSelected.delete(key);
|
||||
}
|
||||
else {
|
||||
newSelected.add(index);
|
||||
newSelected.add(key);
|
||||
}
|
||||
setSelectedItems(newSelected);
|
||||
};
|
||||
@@ -434,7 +431,9 @@ export function MediaList({ accountInfo, timeline, totalUrls, fetchedMediaType =
|
||||
};
|
||||
const handleDownload = async () => {
|
||||
const itemsWithIndices = selectedItems.size > 0
|
||||
? Array.from(selectedItems).map((i) => ({ item: filteredTimeline[i], originalIndex: i }))
|
||||
? filteredTimeline
|
||||
.map((item, i) => ({ item, originalIndex: i }))
|
||||
.filter((entry) => selectedItems.has(getItemKey(entry.item)))
|
||||
: filteredTimeline.map((item, i) => ({ item, originalIndex: i }));
|
||||
if (itemsWithIndices.length === 0) {
|
||||
toast.error("No media to download");
|
||||
@@ -462,6 +461,10 @@ export function MediaList({ accountInfo, timeline, totalUrls, fetchedMediaType =
|
||||
})),
|
||||
output_dir: getOutputDir(),
|
||||
username: accountInfo.name,
|
||||
concurrent_downloads: settings.concurrentDownloads || 10,
|
||||
skip_existing: settings.skipExistingFiles,
|
||||
delete_incomplete_files: settings.deleteIncompleteFiles,
|
||||
retry_attempts: settings.retryAttempts,
|
||||
proxy: settings.proxy || "",
|
||||
});
|
||||
const response = await DownloadMediaWithMetadata(request);
|
||||
@@ -774,14 +777,14 @@ export function MediaList({ accountInfo, timeline, totalUrls, fetchedMediaType =
|
||||
|
||||
{viewMode === "list" ? (<div className="space-y-2">
|
||||
{filteredTimeline.slice(0, visibleCount).map((item, index) => {
|
||||
const isSelected = selectedItems.has(index);
|
||||
const itemKey = getItemKey(item);
|
||||
const isSelected = selectedItems.has(itemKey);
|
||||
const isItemDownloaded = downloadedItems.has(itemKey);
|
||||
const isItemFailed = failedItems.has(itemKey);
|
||||
const isItemSkipped = skippedItems.has(itemKey);
|
||||
const isItemDownloading = downloadingItem === itemKey;
|
||||
return (<div key={itemKey} className={`flex items-center gap-4 p-3 rounded-lg border-2 transition-all ${isSelected ? "border-primary bg-primary/5" : "border-transparent hover:bg-muted/50"}`}>
|
||||
<Checkbox checked={isSelected} onCheckedChange={() => toggleItem(index)}/>
|
||||
<Checkbox checked={isSelected} onCheckedChange={() => toggleItem(itemKey)}/>
|
||||
<span className="text-sm text-muted-foreground w-8 text-center shrink-0">
|
||||
{index + 1}
|
||||
</span>
|
||||
@@ -833,6 +836,10 @@ export function MediaList({ accountInfo, timeline, totalUrls, fetchedMediaType =
|
||||
})],
|
||||
output_dir: getOutputDir(),
|
||||
username: accountInfo.name,
|
||||
concurrent_downloads: settings.concurrentDownloads || 10,
|
||||
skip_existing: settings.skipExistingFiles,
|
||||
delete_incomplete_files: settings.deleteIncompleteFiles,
|
||||
retry_attempts: settings.retryAttempts,
|
||||
proxy: settings.proxy || "",
|
||||
});
|
||||
const response = await DownloadMediaWithMetadata(request);
|
||||
@@ -872,8 +879,8 @@ export function MediaList({ accountInfo, timeline, totalUrls, fetchedMediaType =
|
||||
})}
|
||||
</div>) : (<div className={`grid gap-3 ${viewMode === "large" ? "grid-cols-4" : "grid-cols-6"}`}>
|
||||
{filteredTimeline.slice(0, visibleCount).map((item, index) => {
|
||||
const isSelected = selectedItems.has(index);
|
||||
const itemKey = getItemKey(item);
|
||||
const isSelected = selectedItems.has(itemKey);
|
||||
const isItemDownloaded = downloadedItems.has(itemKey);
|
||||
const isItemFailed = failedItems.has(itemKey);
|
||||
const isItemSkipped = skippedItems.has(itemKey);
|
||||
@@ -906,6 +913,10 @@ export function MediaList({ accountInfo, timeline, totalUrls, fetchedMediaType =
|
||||
})],
|
||||
output_dir: getOutputDir(),
|
||||
username: accountInfo.name,
|
||||
concurrent_downloads: settings.concurrentDownloads || 10,
|
||||
skip_existing: settings.skipExistingFiles,
|
||||
delete_incomplete_files: settings.deleteIncompleteFiles,
|
||||
retry_attempts: settings.retryAttempts,
|
||||
proxy: settings.proxy || "",
|
||||
});
|
||||
const response = await DownloadMediaWithMetadata(request);
|
||||
@@ -947,7 +958,7 @@ export function MediaList({ accountInfo, timeline, totalUrls, fetchedMediaType =
|
||||
|
||||
|
||||
<div className="absolute top-2 left-2" onClick={(e) => e.stopPropagation()}>
|
||||
<Checkbox checked={isSelected} onCheckedChange={() => toggleItem(index)} className="bg-background/80"/>
|
||||
<Checkbox checked={isSelected} onCheckedChange={() => toggleItem(itemKey)} className="bg-background/80"/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1079,6 +1090,10 @@ export function MediaList({ accountInfo, timeline, totalUrls, fetchedMediaType =
|
||||
})],
|
||||
output_dir: getOutputDir(),
|
||||
username: accountInfo.name,
|
||||
concurrent_downloads: settings.concurrentDownloads || 10,
|
||||
skip_existing: settings.skipExistingFiles,
|
||||
delete_incomplete_files: settings.deleteIncompleteFiles,
|
||||
retry_attempts: settings.retryAttempts,
|
||||
proxy: settings.proxy || "",
|
||||
});
|
||||
const response = await DownloadMediaWithMetadata(request);
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -24,7 +24,7 @@ interface DependencyVersionStatus {
|
||||
}
|
||||
|
||||
type DependencyVersionMethod = "GetExtractorVersionStatus" | "GetFFmpegVersionStatus" | "GetExifToolVersionStatus";
|
||||
type SettingsTab = "general" | "dependencies";
|
||||
type SettingsTab = "general" | "downloads" | "dependencies";
|
||||
|
||||
interface SettingsPageProps {
|
||||
onUnsavedChangesChange?: (hasUnsavedChanges: boolean) => void;
|
||||
@@ -387,6 +387,10 @@ export function SettingsPage({ onUnsavedChangesChange, onResetRequest }: Setting
|
||||
<MonitorCog className="h-4 w-4"/>
|
||||
General
|
||||
</Button>
|
||||
<Button variant={activeTab === "downloads" ? "default" : "ghost"} size="sm" onClick={() => setActiveTab("downloads")} className="rounded-b-none gap-2">
|
||||
<Download className="h-4 w-4"/>
|
||||
Downloads
|
||||
</Button>
|
||||
<Button variant={activeTab === "dependencies" ? "default" : "ghost"} size="sm" onClick={() => setActiveTab("dependencies")} className="rounded-b-none gap-2">
|
||||
<PackageSearch className="h-4 w-4"/>
|
||||
Dependencies
|
||||
@@ -394,19 +398,8 @@ export function SettingsPage({ onUnsavedChangesChange, onResetRequest }: Setting
|
||||
</div>
|
||||
|
||||
<div className="pt-4">
|
||||
{activeTab === "general" && (<div className="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
{activeTab === "general" && (<div className="max-w-3xl space-y-4">
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="download-path">Download Path</Label>
|
||||
<div className="flex gap-2">
|
||||
<InputWithContext id="download-path" value={tempSettings.downloadPath} onChange={(e) => setTempSettings((prev) => ({ ...prev, downloadPath: e.target.value }))} placeholder="C:\Users\YourUsername\Pictures"/>
|
||||
<Button type="button" onClick={handleBrowseFolder} className="gap-1.5">
|
||||
<FolderOpen className="h-4 w-4"/>
|
||||
Browse
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="theme-mode">Mode</Label>
|
||||
<Select value={tempSettings.themeMode} onValueChange={(value: "auto" | "light" | "dark") => setTempSettings((prev) => ({ ...prev, themeMode: value }))}>
|
||||
@@ -481,22 +474,137 @@ export function SettingsPage({ onUnsavedChangesChange, onResetRequest }: Setting
|
||||
<Switch id="sfx-enabled" checked={tempSettings.sfxEnabled} onCheckedChange={(checked) => setTempSettings((prev) => ({ ...prev, sfxEnabled: checked }))}/>
|
||||
</div>
|
||||
</div>
|
||||
</div>)}
|
||||
|
||||
{activeTab === "downloads" && (<div className="grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,1fr)_1px_minmax(0,1fr)] md:gap-6">
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="download-path">Download Path</Label>
|
||||
<div className="flex gap-2">
|
||||
<InputWithContext id="download-path" value={tempSettings.downloadPath} onChange={(e) => setTempSettings((prev) => ({ ...prev, downloadPath: e.target.value }))} placeholder="C:\Users\YourUsername\Pictures"/>
|
||||
<Button type="button" onClick={handleBrowseFolder} className="gap-1.5">
|
||||
<FolderOpen className="h-4 w-4"/>
|
||||
Browse
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="concurrent-downloads" className="flex items-center gap-2">
|
||||
Concurrent Downloads
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Info className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">
|
||||
<p>How many media files can download at the same time.</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</Label>
|
||||
<Select value={String(tempSettings.concurrentDownloads || 10)} onValueChange={(value) => setTempSettings((prev) => ({ ...prev, concurrentDownloads: parseInt(value, 10) }))}>
|
||||
<SelectTrigger id="concurrent-downloads" className="w-28">
|
||||
<SelectValue placeholder="10"/>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{[1, 2, 3, 5, 8, 10, 15, 20, 25, 30, 40, 50].map((value) => (<SelectItem key={value} value={String(value)}>
|
||||
{value}
|
||||
</SelectItem>))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between gap-4">
|
||||
<Label htmlFor="skip-existing-files" className="cursor-pointer">Skip Existing Files</Label>
|
||||
<Switch id="skip-existing-files" checked={tempSettings.skipExistingFiles} onCheckedChange={(checked) => setTempSettings((prev) => ({ ...prev, skipExistingFiles: checked }))}/>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between gap-4">
|
||||
<Label htmlFor="delete-incomplete-files" className="cursor-pointer">Delete Incomplete Files</Label>
|
||||
<Switch id="delete-incomplete-files" checked={tempSettings.deleteIncompleteFiles} onCheckedChange={(checked) => setTempSettings((prev) => ({ ...prev, deleteIncompleteFiles: checked }))}/>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center justify-between gap-4">
|
||||
<Label htmlFor="retry-attempts">Retry Attempts</Label>
|
||||
<Select value={String(tempSettings.retryAttempts)} onValueChange={(value) => setTempSettings((prev) => ({ ...prev, retryAttempts: parseInt(value, 10) }))}>
|
||||
<SelectTrigger id="retry-attempts" className="w-24">
|
||||
<SelectValue placeholder="1"/>
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{[1, 2, 3, 4, 5].map((value) => (<SelectItem key={value} value={String(value)}>
|
||||
{value}
|
||||
</SelectItem>))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div aria-hidden="true" className="hidden bg-border md:block"/>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-4">
|
||||
<Label className="flex items-center gap-2">
|
||||
GIF Conversion
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="proxy" className="flex items-center gap-2">
|
||||
Proxy
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Info className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">
|
||||
<p>Quality settings for converting Twitter's MP4 into actual GIF files.</p>
|
||||
<p>Supports one proxy or multiple proxies separated by commas. Requests will rotate through them.</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</Label>
|
||||
<InputWithContext id="proxy" value={tempSettings.proxy || ""} onChange={(e) => setTempSettings((prev) => ({ ...prev, proxy: e.target.value }))} placeholder="http://proxy1:port, socks5://proxy2:port (optional)" className="max-w-md"/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="fetch-timeout" className="flex items-center gap-2">
|
||||
Fetch Timeout
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Info className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">
|
||||
<p>Timeout in seconds. Fetch stops automatically when reached</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</Label>
|
||||
<InputWithContext id="fetch-timeout" type="number" value={tempSettings.fetchTimeout || 60} onChange={(e) => {
|
||||
const inputValue = e.target.value;
|
||||
if (inputValue === "") {
|
||||
setTempSettings((prev) => ({ ...prev, fetchTimeout: 60 }));
|
||||
return;
|
||||
}
|
||||
const value = parseInt(inputValue, 10);
|
||||
if (!isNaN(value)) {
|
||||
setTempSettings((prev) => ({ ...prev, fetchTimeout: value }));
|
||||
}
|
||||
}} onBlur={(e) => {
|
||||
const value = parseInt(e.target.value, 10);
|
||||
if (isNaN(value) || value < 30) {
|
||||
setTempSettings((prev) => ({ ...prev, fetchTimeout: 30 }));
|
||||
}
|
||||
else if (value > 900) {
|
||||
setTempSettings((prev) => ({ ...prev, fetchTimeout: 900 }));
|
||||
}
|
||||
}} placeholder="60" className="w-24"/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-4">
|
||||
<div className="space-y-3">
|
||||
<div className="space-y-2">
|
||||
<Label className="flex items-center gap-2">
|
||||
GIF Conversion
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Info className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">
|
||||
<p>Quality settings for converting Twitter's MP4 into actual GIF files.</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</Label>
|
||||
<div className="flex items-center justify-between gap-4">
|
||||
<Label htmlFor="gif-quality" className={!ffmpegInstalled ? "text-muted-foreground" : undefined}>GIF Quality</Label>
|
||||
<Select value={tempSettings.gifQuality} onValueChange={(value: GifQuality) => {
|
||||
setTempSettings((prev) => ({
|
||||
@@ -514,7 +622,7 @@ export function SettingsPage({ onUnsavedChangesChange, onResetRequest }: Setting
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-center justify-between gap-4">
|
||||
<Label htmlFor="gif-resolution" className={!ffmpegInstalled ? "text-muted-foreground" : undefined}>Resolution</Label>
|
||||
<Select value={tempSettings.gifResolution} onValueChange={(value: GifResolution) => setTempSettings((prev) => ({ ...prev, gifResolution: value }))} disabled={!ffmpegInstalled}>
|
||||
<SelectTrigger id="gif-resolution" className="w-fit">
|
||||
@@ -528,68 +636,6 @@ export function SettingsPage({ onUnsavedChangesChange, onResetRequest }: Setting
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label className="flex items-center gap-2">
|
||||
Network
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Info className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">
|
||||
<p>Connection settings used while fetching data and downloading media.</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</Label>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="proxy" className="flex items-center gap-2">
|
||||
Proxy
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Info className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">
|
||||
<p>Supports one proxy or multiple proxies separated by commas. Requests will rotate through them.</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</Label>
|
||||
<InputWithContext id="proxy" value={tempSettings.proxy || ""} onChange={(e) => setTempSettings((prev) => ({ ...prev, proxy: e.target.value }))} placeholder="http://proxy1:port, socks5://proxy2:port (optional)" className="max-w-md"/>
|
||||
</div>
|
||||
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="fetch-timeout" className="flex items-center gap-2">
|
||||
Fetch Timeout
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<Info className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="top">
|
||||
<p>Timeout in seconds. Fetch stops automatically when reached</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</Label>
|
||||
<InputWithContext id="fetch-timeout" type="number" value={tempSettings.fetchTimeout || 60} onChange={(e) => {
|
||||
const inputValue = e.target.value;
|
||||
if (inputValue === "") {
|
||||
setTempSettings((prev) => ({ ...prev, fetchTimeout: 60 }));
|
||||
return;
|
||||
}
|
||||
const value = parseInt(inputValue, 10);
|
||||
if (!isNaN(value)) {
|
||||
setTempSettings((prev) => ({ ...prev, fetchTimeout: value }));
|
||||
}
|
||||
}} onBlur={(e) => {
|
||||
const value = parseInt(e.target.value, 10);
|
||||
if (isNaN(value) || value < 30) {
|
||||
setTempSettings((prev) => ({ ...prev, fetchTimeout: 30 }));
|
||||
}
|
||||
else if (value > 900) {
|
||||
setTempSettings((prev) => ({ ...prev, fetchTimeout: 900 }));
|
||||
}
|
||||
}} placeholder="60" className="w-24"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user