mirror of
https://github.com/Alvin-Zilverstand/Twitter-X-Media-Batch-Downloader.git
synced 2026-11-24 07:13:11 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de402efe6b | ||
|
|
2f51a118e4 | ||
|
|
b611632c30 | ||
|
|
30bcf3db9f | ||
|
|
ada11f086e | ||
|
|
b4266cb7fa |
No files matched your search
@@ -12,15 +12,15 @@ A GUI tool to download original-quality images and videos from Twitter/X account
|
||||
|
||||
</div>
|
||||
|
||||
### [Download](https://github.com/afkarxyz/SpotiFLAC/releases)
|
||||
### [Download](https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases)
|
||||
|
||||
- If you're familiar with userscripts, install it [**here**](https://greasyfork.org/en/scripts/551198)
|
||||
|
||||
- To install the Chrome extension version, click [**here**](https://www.patreon.com/posts/chrome-extension-139296789)
|
||||
- To install the Chrome extension version, click [**here**](https://chromewebstore.google.com/detail/aboccmnimgpjehlplnanplbhlccohhhn)
|
||||
|
||||
## Screenshot
|
||||
|
||||

|
||||

|
||||
|
||||
## How to Obtain Auth Token
|
||||
|
||||
@@ -40,3 +40,5 @@ A GUI tool to download original-quality images and videos from Twitter/X account
|
||||
6. Do not log out of your account, as a new `auth_token` will be generated by Twitter
|
||||
|
||||

|
||||
|
||||
[](https://ko-fi.com/afkarxyz)
|
||||
@@ -174,10 +174,10 @@ func (a *App) Quit() {
|
||||
|
||||
// DownloadMediaRequest represents the request for downloading media (legacy)
|
||||
type DownloadMediaRequest struct {
|
||||
URLs []string `json:"urls"`
|
||||
OutputDir string `json:"output_dir"`
|
||||
Username string `json:"username"`
|
||||
Proxy string `json:"proxy,omitempty"` // Optional proxy URL (e.g., http://proxy:port or socks5://proxy:port)
|
||||
URLs []string `json:"urls"`
|
||||
OutputDir string `json:"output_dir"`
|
||||
Username string `json:"username"`
|
||||
Proxy string `json:"proxy,omitempty"` // Optional proxy URL (e.g., http://proxy:port or socks5://proxy:port)
|
||||
}
|
||||
|
||||
// MediaItemRequest represents a media item with metadata
|
||||
@@ -186,7 +186,7 @@ type MediaItemRequest struct {
|
||||
Date string `json:"date"`
|
||||
TweetID backend.TweetIDString `json:"tweet_id"`
|
||||
Type string `json:"type"`
|
||||
Content string `json:"content,omitempty"` // Tweet text content (for text-only tweets)
|
||||
Content string `json:"content,omitempty"` // Tweet text content (for text-only tweets)
|
||||
OriginalFilename string `json:"original_filename,omitempty"` // Original filename from API
|
||||
AuthorUsername string `json:"author_username,omitempty"` // Username of tweet author (for bookmarks and likes)
|
||||
}
|
||||
@@ -275,23 +275,23 @@ func (a *App) DownloadMediaWithMetadata(req DownloadMediaWithMetadataRequest) (D
|
||||
outputDir = backend.GetDefaultDownloadPath()
|
||||
}
|
||||
|
||||
// Convert request items to backend items
|
||||
// For bookmarks and likes, use author_username from each item if available
|
||||
items := make([]backend.MediaItem, len(req.Items))
|
||||
for i, item := range req.Items {
|
||||
// Use original filename from API if available, otherwise extract from URL
|
||||
originalFilename := item.OriginalFilename
|
||||
if originalFilename == "" {
|
||||
// Fallback: extract from URL if not provided in API response
|
||||
originalFilename = backend.ExtractOriginalFilename(item.URL)
|
||||
}
|
||||
|
||||
// For bookmarks and likes, use author_username from item, otherwise use req.Username
|
||||
username := req.Username
|
||||
if item.AuthorUsername != "" {
|
||||
username = item.AuthorUsername
|
||||
}
|
||||
|
||||
// Convert request items to backend items
|
||||
// For bookmarks and likes, use author_username from each item if available
|
||||
items := make([]backend.MediaItem, len(req.Items))
|
||||
for i, item := range req.Items {
|
||||
// Use original filename from API if available, otherwise extract from URL
|
||||
originalFilename := item.OriginalFilename
|
||||
if originalFilename == "" {
|
||||
// Fallback: extract from URL if not provided in API response
|
||||
originalFilename = backend.ExtractOriginalFilename(item.URL)
|
||||
}
|
||||
|
||||
// For bookmarks and likes, use author_username from item, otherwise use req.Username
|
||||
username := req.Username
|
||||
if item.AuthorUsername != "" {
|
||||
username = item.AuthorUsername
|
||||
}
|
||||
|
||||
items[i] = backend.MediaItem{
|
||||
URL: item.URL,
|
||||
Date: item.Date,
|
||||
@@ -333,7 +333,7 @@ func (a *App) DownloadMediaWithMetadata(req DownloadMediaWithMetadataRequest) (D
|
||||
return DownloadMediaResponse{
|
||||
Success: false,
|
||||
Downloaded: downloaded,
|
||||
Skipped: skipped,
|
||||
Skipped: skipped,
|
||||
Failed: failed,
|
||||
Message: err.Error(),
|
||||
}, err
|
||||
@@ -345,7 +345,7 @@ func (a *App) DownloadMediaWithMetadata(req DownloadMediaWithMetadataRequest) (D
|
||||
return DownloadMediaResponse{
|
||||
Success: true,
|
||||
Downloaded: downloaded,
|
||||
Skipped: skipped,
|
||||
Skipped: skipped,
|
||||
Failed: failed,
|
||||
Message: fmt.Sprintf("Downloaded %d files, %d skipped, %d failed", downloaded, skipped, failed),
|
||||
}, nil
|
||||
@@ -497,6 +497,31 @@ type ImportAccountResponse struct {
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// CheckFolderExists checks if a folder exists for the given username
|
||||
func (a *App) CheckFolderExists(basePath, username string) bool {
|
||||
return backend.CheckFolderExists(basePath, username)
|
||||
}
|
||||
|
||||
// CheckGifsFolderExists checks if a gifs subfolder exists for the given username
|
||||
func (a *App) CheckGifsFolderExists(basePath, username string) bool {
|
||||
return backend.CheckGifsFolderExists(basePath, username)
|
||||
}
|
||||
|
||||
// CheckGifsFolderHasMP4 checks if the gifs folder has any MP4 files to convert
|
||||
func (a *App) CheckGifsFolderHasMP4(basePath, username string) bool {
|
||||
return backend.CheckGifsFolderHasMP4(basePath, username)
|
||||
}
|
||||
|
||||
// GetFolderPath returns the full path for a username folder
|
||||
func (a *App) GetFolderPath(basePath, username string) string {
|
||||
return backend.GetFolderPath(basePath, username)
|
||||
}
|
||||
|
||||
// GetGifsFolderPath returns the full path for a username's gifs folder
|
||||
func (a *App) GetGifsFolderPath(basePath, username string) string {
|
||||
return backend.GetGifsFolderPath(basePath, username)
|
||||
}
|
||||
|
||||
// ImportAccountFromJSON imports account from JSON file (supports both old and new format)
|
||||
func (a *App) ImportAccountFromJSON() (ImportAccountResponse, error) {
|
||||
// Open file dialog
|
||||
|
||||
+34
-14
@@ -27,17 +27,19 @@ type AccountDB struct {
|
||||
|
||||
// AccountListItem represents a simplified account for listing
|
||||
type AccountListItem struct {
|
||||
ID int64 `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Name string `json:"name"`
|
||||
ProfileImage string `json:"profile_image"`
|
||||
TotalMedia int `json:"total_media"`
|
||||
LastFetched string `json:"last_fetched"`
|
||||
GroupName string `json:"group_name"`
|
||||
GroupColor string `json:"group_color"`
|
||||
MediaType string `json:"media_type"`
|
||||
Cursor string `json:"cursor"`
|
||||
Completed bool `json:"completed"`
|
||||
ID int64 `json:"id"`
|
||||
Username string `json:"username"`
|
||||
Name string `json:"name"`
|
||||
ProfileImage string `json:"profile_image"`
|
||||
TotalMedia int `json:"total_media"`
|
||||
LastFetched string `json:"last_fetched"`
|
||||
GroupName string `json:"group_name"`
|
||||
GroupColor string `json:"group_color"`
|
||||
MediaType string `json:"media_type"`
|
||||
Cursor string `json:"cursor"`
|
||||
Completed bool `json:"completed"`
|
||||
FollowersCount int `json:"followers_count"`
|
||||
StatusesCount int `json:"statuses_count"`
|
||||
}
|
||||
|
||||
var db *sql.DB
|
||||
@@ -161,7 +163,8 @@ func GetAllAccounts() ([]AccountListItem, error) {
|
||||
SELECT id, username, name, profile_image, total_media, last_fetched,
|
||||
COALESCE(group_name, '') as group_name, COALESCE(group_color, '') as group_color,
|
||||
COALESCE(media_type, 'all') as media_type,
|
||||
COALESCE(cursor, '') as cursor, COALESCE(completed, 1) as completed
|
||||
COALESCE(cursor, '') as cursor, COALESCE(completed, 1) as completed,
|
||||
COALESCE(response_json, '') as response_json
|
||||
FROM accounts
|
||||
ORDER BY group_name ASC, last_fetched DESC
|
||||
`)
|
||||
@@ -175,11 +178,28 @@ func GetAllAccounts() ([]AccountListItem, error) {
|
||||
var acc AccountListItem
|
||||
var lastFetched time.Time
|
||||
var completedInt int
|
||||
if err := rows.Scan(&acc.ID, &acc.Username, &acc.Name, &acc.ProfileImage, &acc.TotalMedia, &lastFetched, &acc.GroupName, &acc.GroupColor, &acc.MediaType, &acc.Cursor, &completedInt); err != nil {
|
||||
var responseJSON string
|
||||
if err := rows.Scan(&acc.ID, &acc.Username, &acc.Name, &acc.ProfileImage, &acc.TotalMedia, &lastFetched, &acc.GroupName, &acc.GroupColor, &acc.MediaType, &acc.Cursor, &completedInt, &responseJSON); err != nil {
|
||||
continue
|
||||
}
|
||||
acc.LastFetched = lastFetched.Format("2006-01-02 15:04")
|
||||
acc.Completed = completedInt == 1
|
||||
|
||||
// Extract followers_count and statuses_count from response_json
|
||||
if responseJSON != "" {
|
||||
var parsed map[string]interface{}
|
||||
if err := json.Unmarshal([]byte(responseJSON), &parsed); err == nil {
|
||||
if accountInfo, ok := parsed["account_info"].(map[string]interface{}); ok {
|
||||
if followers, ok := accountInfo["followers_count"].(float64); ok {
|
||||
acc.FollowersCount = int(followers)
|
||||
}
|
||||
if statuses, ok := accountInfo["statuses_count"].(float64); ok {
|
||||
acc.StatusesCount = int(statuses)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
accounts = append(accounts, acc)
|
||||
}
|
||||
|
||||
@@ -241,7 +261,6 @@ func ClearAllAccounts() error {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
// GetAccountByID returns a specific account by ID
|
||||
func GetAccountByID(id int64) (*AccountDB, error) {
|
||||
if db == nil {
|
||||
@@ -284,6 +303,7 @@ func DeleteAccount(id int64) error {
|
||||
_, err := db.Exec("DELETE FROM accounts WHERE id = ?", id)
|
||||
return err
|
||||
}
|
||||
|
||||
// LegacyMediaEntry represents media entry in old format
|
||||
type LegacyMediaEntry struct {
|
||||
TweetID string `json:"tweet_id"`
|
||||
|
||||
+28
-6
@@ -220,12 +220,34 @@ func ConvertMP4ToGIF(inputPath, outputPath, quality, resolution string) error {
|
||||
var args []string
|
||||
|
||||
if quality == "fast" {
|
||||
// Fast mode: simple conversion
|
||||
args = []string{
|
||||
"-i", inputPath,
|
||||
"-loop", "0",
|
||||
"-y",
|
||||
outputPath,
|
||||
// Fast mode: simple conversion with resolution scaling
|
||||
var scaleFilter string
|
||||
switch resolution {
|
||||
case "high":
|
||||
scaleFilter = "scale=800:-1"
|
||||
case "medium":
|
||||
scaleFilter = "scale=600:-1"
|
||||
case "low":
|
||||
scaleFilter = "scale=400:-1"
|
||||
default: // original - no scaling
|
||||
scaleFilter = ""
|
||||
}
|
||||
|
||||
if scaleFilter != "" {
|
||||
args = []string{
|
||||
"-i", inputPath,
|
||||
"-vf", scaleFilter,
|
||||
"-loop", "0",
|
||||
"-y",
|
||||
outputPath,
|
||||
}
|
||||
} else {
|
||||
args = []string{
|
||||
"-i", inputPath,
|
||||
"-loop", "0",
|
||||
"-y",
|
||||
outputPath,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Better mode: optimized palette with dithering
|
||||
|
||||
@@ -2,7 +2,9 @@ package backend
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
@@ -50,3 +52,53 @@ func SelectFolderDialog(ctx context.Context, defaultPath string) (string, error)
|
||||
|
||||
return selectedPath, nil
|
||||
}
|
||||
|
||||
// CheckFolderExists checks if a folder exists at the given path
|
||||
func CheckFolderExists(basePath, username string) bool {
|
||||
folderPath := filepath.Join(basePath, username)
|
||||
info, err := os.Stat(folderPath)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return info.IsDir()
|
||||
}
|
||||
|
||||
// CheckGifsFolderExists checks if a gifs subfolder exists for the given username
|
||||
func CheckGifsFolderExists(basePath, username string) bool {
|
||||
gifsPath := filepath.Join(basePath, username, "gifs")
|
||||
info, err := os.Stat(gifsPath)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
return info.IsDir()
|
||||
}
|
||||
|
||||
// CheckGifsFolderHasMP4 checks if the gifs folder has any MP4 files to convert
|
||||
func CheckGifsFolderHasMP4(basePath, username string) bool {
|
||||
gifsPath := filepath.Join(basePath, username, "gifs")
|
||||
|
||||
entries, err := os.ReadDir(gifsPath)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, entry := range entries {
|
||||
if !entry.IsDir() {
|
||||
ext := filepath.Ext(entry.Name())
|
||||
if ext == ".mp4" || ext == ".MP4" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetFolderPath returns the full path for a username folder
|
||||
func GetFolderPath(basePath, username string) string {
|
||||
return filepath.Join(basePath, username)
|
||||
}
|
||||
|
||||
// GetGifsFolderPath returns the full path for a username's gifs folder
|
||||
func GetGifsFolderPath(basePath, username string) string {
|
||||
return filepath.Join(basePath, username, "gifs")
|
||||
}
|
||||
@@ -18,5 +18,7 @@
|
||||
"lib": "@/lib",
|
||||
"hooks": "@/hooks"
|
||||
},
|
||||
"registries": {}
|
||||
"registries": {
|
||||
"@lucide-animated": "https://lucide-animated.com/r/{name}.json"
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -6,7 +6,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Google+Sans+Code:ital,wght@0,300..800;1,300..800&family=Google+Sans+Flex:opsz,wght@6..144,1..1000&family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Manrope:wght@200..800&family=Plus+Jakarta+Sans:ital,wght@0,200..800;1,200..800&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100..900;1,100..900&family=Space+Grotesk:wght@300..700&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@300..800&family=Figtree:wght@300..900&family=Geist:wght@100..900&family=Google+Sans+Code:ital,wght@0,300..800;1,300..800&family=Google+Sans+Flex:opsz,wght@6..144,1..1000&family=Inter:wght@300..800&family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&family=Manrope:wght@300..800&family=Noto+Sans:wght@100..900&family=Nunito+Sans:opsz,wght@6..12,200..1000&family=Outfit:wght@100..900&family=Plus+Jakarta+Sans:wght@300..800&family=Poppins:wght@300;400;500;600;700;800&family=Public+Sans:ital,wght@0,100..900;1,100..900&family=Raleway:wght@100..900&family=Roboto:wght@300;400;500;700;900&family=Space+Grotesk:wght@300..700&display=swap" rel="stylesheet">
|
||||
<title>Twitter/X Media Batch Downloader</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
+12
-14
@@ -12,44 +12,42 @@
|
||||
"postinstall": "node scripts/generate-icon.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@radix-ui/react-accordion": "^1.2.12",
|
||||
"@radix-ui/react-checkbox": "^1.3.3",
|
||||
"@radix-ui/react-context-menu": "^2.2.16",
|
||||
"@radix-ui/react-dialog": "^1.1.15",
|
||||
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
||||
"@radix-ui/react-label": "^2.1.8",
|
||||
"@radix-ui/react-progress": "^1.1.8",
|
||||
"@radix-ui/react-radio-group": "^1.3.8",
|
||||
"@radix-ui/react-select": "^2.2.6",
|
||||
"@radix-ui/react-slot": "^1.2.4",
|
||||
"@radix-ui/react-switch": "^1.2.6",
|
||||
"@radix-ui/react-tabs": "^1.1.13",
|
||||
"@radix-ui/react-tooltip": "^1.2.8",
|
||||
"@tailwindcss/vite": "^4.1.17",
|
||||
"@tailwindcss/vite": "^4.1.18",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"clsx": "^2.1.1",
|
||||
"lucide-react": "^0.559.0",
|
||||
"lucide-react": "^0.562.0",
|
||||
"motion": "^12.23.26",
|
||||
"next-themes": "^0.4.6",
|
||||
"react": "^19.2.1",
|
||||
"react-dom": "^19.2.1",
|
||||
"react": "^19.2.3",
|
||||
"react-dom": "^19.2.3",
|
||||
"sonner": "^2.0.7",
|
||||
"tailwind-merge": "^3.4.0",
|
||||
"tailwindcss": "^4.1.17"
|
||||
"tailwindcss": "^4.1.18"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.39.1",
|
||||
"@types/node": "^25.0.0",
|
||||
"@eslint/js": "^9.39.2",
|
||||
"@types/node": "^25.0.3",
|
||||
"@types/react": "^19.2.7",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^5.1.2",
|
||||
"eslint": "^9.39.1",
|
||||
"eslint": "^9.39.2",
|
||||
"eslint-plugin-react-hooks": "^7.0.1",
|
||||
"eslint-plugin-react-refresh": "^0.4.24",
|
||||
"eslint-plugin-react-refresh": "^0.4.26",
|
||||
"globals": "^16.5.0",
|
||||
"sharp": "^0.34.5",
|
||||
"tw-animate-css": "^1.4.0",
|
||||
"typescript": "~5.9.3",
|
||||
"typescript-eslint": "^8.49.0",
|
||||
"vite": "^7.2.7"
|
||||
"typescript-eslint": "^8.50.0",
|
||||
"vite": "^7.3.0"
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
9fa5d67c42a33ac8765a4b51d8bc1bb5
|
||||
93300717a79529efe3943af0fda63408
|
||||
Generated
+753
-821
File diff suppressed because it is too large.
Load diff
+192
-39
@@ -34,9 +34,13 @@ import { ExtractTimeline, ExtractDateRange, SaveAccountToDBWithStatus, CleanupEx
|
||||
|
||||
const HISTORY_KEY = "twitter_media_fetch_history";
|
||||
const MAX_HISTORY = 10;
|
||||
const CURRENT_VERSION = "4.1";
|
||||
const CURRENT_VERSION = "4.3";
|
||||
const BATCH_SIZE = 200; // Fetch in batches for progressive display and resume
|
||||
|
||||
function formatNumberWithComma(num: number): string {
|
||||
return num.toLocaleString();
|
||||
}
|
||||
|
||||
function App() {
|
||||
const [currentPage, setCurrentPage] = useState<PageType>("main");
|
||||
const [username, setUsername] = useState("");
|
||||
@@ -425,7 +429,11 @@ function App() {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Timeline mode with batching for progressive display and resume
|
||||
// Timeline mode - check fetch mode from settings
|
||||
const settings = getSettings();
|
||||
const isSingleMode = settings.fetchMode === "single";
|
||||
const batchSize = isSingleMode ? 0 : BATCH_SIZE;
|
||||
|
||||
let timelineType = "timeline";
|
||||
if (isBookmarks) {
|
||||
timelineType = "bookmarks";
|
||||
@@ -436,6 +444,8 @@ function App() {
|
||||
let hasMore = true;
|
||||
let page = 0;
|
||||
|
||||
// Single mode: one fetch, no loop
|
||||
// Batch mode: loop until done or stopped
|
||||
while (hasMore && !stopFetchRef.current) {
|
||||
// Check timeout before each batch
|
||||
if (fetchStartTimeRef.current !== null) {
|
||||
@@ -446,18 +456,67 @@ function App() {
|
||||
logger.warning(`Timeout reached (${timeoutSeconds}s). Stopping fetch...`);
|
||||
stopFetchRef.current = true;
|
||||
toast.warning("Fetch timeout reached. Stopping...");
|
||||
|
||||
// IMPORTANT: Save state immediately before breaking out of loop
|
||||
// This ensures no data is lost when timeout occurs
|
||||
if (accountInfo && allTimeline.length > 0) {
|
||||
saveFetchState({
|
||||
username: cleanUsername,
|
||||
cursor: cursor || "",
|
||||
timeline: allTimeline,
|
||||
accountInfo: accountInfo,
|
||||
totalFetched: allTimeline.length,
|
||||
completed: false,
|
||||
authToken: authToken.trim(),
|
||||
mediaType: mediaType || "all",
|
||||
retweets: retweets || false,
|
||||
timelineType: timelineType,
|
||||
});
|
||||
|
||||
// Also save to database immediately
|
||||
const timeoutResponse: TwitterResponse = {
|
||||
account_info: accountInfo,
|
||||
timeline: allTimeline,
|
||||
total_urls: allTimeline.length,
|
||||
metadata: {
|
||||
new_entries: 0,
|
||||
page: page,
|
||||
batch_size: batchSize,
|
||||
has_more: hasMore,
|
||||
cursor: cursor,
|
||||
completed: false,
|
||||
},
|
||||
cursor: cursor,
|
||||
completed: false,
|
||||
};
|
||||
try {
|
||||
await SaveAccountToDBWithStatus(
|
||||
accountInfo.name,
|
||||
accountInfo.nick,
|
||||
accountInfo.profile_image,
|
||||
allTimeline.length,
|
||||
JSON.stringify(timeoutResponse),
|
||||
mediaType || "all",
|
||||
cursor || "",
|
||||
false
|
||||
);
|
||||
logger.info(`Saved ${allTimeline.length} items before timeout`);
|
||||
} catch (err) {
|
||||
console.error("Failed to save timeout state to database:", err);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const batchNum = page + 1;
|
||||
logger.info(`Fetching batch ${batchNum}${cursor ? " (resuming)" : ""}...`);
|
||||
logger.info(isSingleMode ? "Fetching all media..." : `Fetching batch ${batchNum}${cursor ? " (resuming)" : ""}...`);
|
||||
|
||||
const response = await ExtractTimeline({
|
||||
username: isBookmarks ? "" : username.trim(),
|
||||
auth_token: authToken.trim(),
|
||||
timeline_type: timelineType,
|
||||
batch_size: BATCH_SIZE,
|
||||
batch_size: batchSize,
|
||||
page: page,
|
||||
media_type: mediaType || "all",
|
||||
retweets: retweets || false,
|
||||
@@ -511,7 +570,7 @@ function App() {
|
||||
metadata: {
|
||||
new_entries: data.timeline.length,
|
||||
page: page,
|
||||
batch_size: BATCH_SIZE,
|
||||
batch_size: batchSize,
|
||||
has_more: hasMore,
|
||||
cursor: cursor,
|
||||
completed: !hasMore,
|
||||
@@ -523,23 +582,20 @@ function App() {
|
||||
|
||||
logger.info(`Fetched ${allTimeline.length} items total`);
|
||||
|
||||
// Save state periodically (every 3 batches) or when stopping
|
||||
// This reduces localStorage writes for better performance
|
||||
// Note: cursor is already saved every batch above (lightweight)
|
||||
if (page % 3 === 0 || !hasMore || stopFetchRef.current) {
|
||||
saveFetchState({
|
||||
username: cleanUsername,
|
||||
cursor: cursor || "",
|
||||
timeline: allTimeline,
|
||||
accountInfo: accountInfo,
|
||||
totalFetched: allTimeline.length,
|
||||
completed: !hasMore,
|
||||
authToken: authToken.trim(),
|
||||
mediaType: mediaType || "all",
|
||||
retweets: retweets || false,
|
||||
timelineType: timelineType,
|
||||
});
|
||||
}
|
||||
// Save state EVERY batch to ensure no data loss on timeout/error
|
||||
// This is critical for large accounts where fetch can take a long time
|
||||
saveFetchState({
|
||||
username: cleanUsername,
|
||||
cursor: cursor || "",
|
||||
timeline: allTimeline,
|
||||
accountInfo: accountInfo,
|
||||
totalFetched: allTimeline.length,
|
||||
completed: !hasMore,
|
||||
authToken: authToken.trim(),
|
||||
mediaType: mediaType || "all",
|
||||
retweets: retweets || false,
|
||||
timelineType: timelineType,
|
||||
});
|
||||
|
||||
// Save to database immediately after each batch for realtime persistence
|
||||
// This ensures data is saved even if fetch fails mid-way
|
||||
@@ -551,7 +607,7 @@ function App() {
|
||||
metadata: {
|
||||
new_entries: data.timeline.length,
|
||||
page: page,
|
||||
batch_size: BATCH_SIZE,
|
||||
batch_size: batchSize,
|
||||
has_more: hasMore,
|
||||
cursor: cursor,
|
||||
completed: !hasMore,
|
||||
@@ -578,8 +634,9 @@ function App() {
|
||||
|
||||
// If stopped by user, keep state for resume
|
||||
if (stopFetchRef.current) {
|
||||
logger.info(`Stopped at ${allTimeline.length} items - can resume later`);
|
||||
toast.info(`Stopped at ${allTimeline.length} items`);
|
||||
const elapsedSecs = fetchStartTimeRef.current ? Math.floor((Date.now() - fetchStartTimeRef.current) / 1000) : 0;
|
||||
logger.info(`Stopped at ${allTimeline.length} items - can resume later (${elapsedSecs}s)`);
|
||||
toast.info(`Stopped at ${formatNumberWithComma(allTimeline.length)} items`);
|
||||
setResumeInfo({ canResume: true, mediaCount: allTimeline.length });
|
||||
} else {
|
||||
// Completed - clear state
|
||||
@@ -597,7 +654,7 @@ function App() {
|
||||
metadata: {
|
||||
new_entries: allTimeline.length,
|
||||
page: page,
|
||||
batch_size: BATCH_SIZE,
|
||||
batch_size: batchSize,
|
||||
has_more: false,
|
||||
cursor: cursor,
|
||||
completed: !stopFetchRef.current,
|
||||
@@ -639,13 +696,15 @@ function App() {
|
||||
}
|
||||
|
||||
if (!stopFetchRef.current) {
|
||||
logger.success(`Found ${finalData.total_urls} media items`);
|
||||
const elapsedSecs = fetchStartTimeRef.current ? Math.floor((Date.now() - fetchStartTimeRef.current) / 1000) : 0;
|
||||
logger.success(`Found ${finalData.total_urls} media items (${elapsedSecs}s)`);
|
||||
toast.success(`${finalData.total_urls} media items found`);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
const errorMsg = error instanceof Error ? error.message : String(error);
|
||||
logger.error(`Failed to fetch: ${errorMsg}`);
|
||||
const elapsedSecs = fetchStartTimeRef.current ? Math.floor((Date.now() - fetchStartTimeRef.current) / 1000) : 0;
|
||||
logger.error(`Failed to fetch: ${errorMsg} (${elapsedSecs}s)`);
|
||||
toast.error("Failed to fetch media");
|
||||
|
||||
// On error, check if we have partial data saved
|
||||
@@ -655,7 +714,7 @@ function App() {
|
||||
if (partialResponse) {
|
||||
setResult(partialResponse);
|
||||
setResumeInfo({ canResume: true, mediaCount: savedState.timeline.length });
|
||||
toast.info(`Saved ${savedState.timeline.length} items - can resume`);
|
||||
toast.info(`Saved ${formatNumberWithComma(savedState.timeline.length)} items - can resume`);
|
||||
|
||||
// Also save partial data to database for persistence
|
||||
try {
|
||||
@@ -776,7 +835,7 @@ function App() {
|
||||
// Set fetch type to multiple and navigate to home
|
||||
setFetchType("multiple");
|
||||
setCurrentPage("main");
|
||||
toast.success(`Added ${accounts.length} account(s) to multiple fetch`);
|
||||
toast.success(`Added ${formatNumberWithComma(accounts.length)} account(s) to multiple fetch`);
|
||||
};
|
||||
|
||||
// Handle import txt file
|
||||
@@ -812,7 +871,7 @@ function App() {
|
||||
});
|
||||
|
||||
setMultipleAccounts(accounts);
|
||||
toast.success(`Imported ${accounts.length} account(s)`);
|
||||
toast.success(`Imported ${formatNumberWithComma(accounts.length)} account(s)`);
|
||||
} catch (error) {
|
||||
toast.error("Failed to read file");
|
||||
}
|
||||
@@ -955,7 +1014,11 @@ function App() {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Fetch account
|
||||
// Fetch account - check fetch mode from settings
|
||||
const fetchSettings = getSettings();
|
||||
const isSingleModeMultiple = fetchSettings.fetchMode === "single";
|
||||
const batchSizeMultiple = isSingleModeMultiple ? 0 : BATCH_SIZE;
|
||||
|
||||
const cleanUsername = account.username.trim();
|
||||
let allTimeline: TwitterResponse["timeline"] = [];
|
||||
let accountInfo: TwitterResponse["account_info"] | null = null;
|
||||
@@ -965,8 +1028,53 @@ function App() {
|
||||
let previousMediaCount = account.mediaCount || 0;
|
||||
|
||||
while (hasMore && !stopAllRef.current) {
|
||||
// Check if this specific account should be stopped
|
||||
// Check if this specific account should be stopped (timeout)
|
||||
if (accountStopFlagsRef.current.get(accountId)) {
|
||||
// IMPORTANT: Save state before breaking to prevent data loss
|
||||
if (accountInfo && allTimeline.length > 0) {
|
||||
saveFetchState({
|
||||
username: cleanUsername,
|
||||
cursor: cursor || "",
|
||||
timeline: allTimeline,
|
||||
accountInfo: accountInfo,
|
||||
totalFetched: allTimeline.length,
|
||||
completed: false,
|
||||
authToken: authToken.trim(),
|
||||
mediaType: fetchedMediaType || "all",
|
||||
retweets: false,
|
||||
timelineType: "timeline",
|
||||
});
|
||||
|
||||
// Also save to database
|
||||
try {
|
||||
await SaveAccountToDBWithStatus(
|
||||
accountInfo.name,
|
||||
accountInfo.nick,
|
||||
accountInfo.profile_image,
|
||||
allTimeline.length,
|
||||
JSON.stringify({
|
||||
account_info: accountInfo,
|
||||
timeline: allTimeline,
|
||||
total_urls: allTimeline.length,
|
||||
metadata: {
|
||||
new_entries: 0,
|
||||
page: page,
|
||||
batch_size: batchSizeMultiple,
|
||||
has_more: hasMore,
|
||||
cursor: cursor,
|
||||
completed: false,
|
||||
},
|
||||
cursor: cursor,
|
||||
completed: false,
|
||||
}),
|
||||
fetchedMediaType || "all",
|
||||
cursor || "",
|
||||
false
|
||||
);
|
||||
} catch (err) {
|
||||
console.error("Failed to save timeout state to database:", err);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -974,7 +1082,7 @@ function App() {
|
||||
username: cleanUsername,
|
||||
auth_token: authToken.trim(),
|
||||
timeline_type: "timeline",
|
||||
batch_size: BATCH_SIZE,
|
||||
batch_size: batchSizeMultiple,
|
||||
page: page,
|
||||
media_type: fetchedMediaType || "all",
|
||||
retweets: false,
|
||||
@@ -1033,6 +1141,22 @@ function App() {
|
||||
// Update previous count for next iteration
|
||||
previousMediaCount = currentMediaCount;
|
||||
|
||||
// Save fetch state EVERY batch to ensure no data loss on timeout/error
|
||||
if (accountInfo) {
|
||||
saveFetchState({
|
||||
username: cleanUsername,
|
||||
cursor: cursor || "",
|
||||
timeline: allTimeline,
|
||||
accountInfo: accountInfo,
|
||||
totalFetched: allTimeline.length,
|
||||
completed: !hasMore,
|
||||
authToken: authToken.trim(),
|
||||
mediaType: fetchedMediaType || "all",
|
||||
retweets: false,
|
||||
timelineType: "timeline",
|
||||
});
|
||||
}
|
||||
|
||||
// Save to database after each batch
|
||||
if (accountInfo) {
|
||||
try {
|
||||
@@ -1048,7 +1172,7 @@ function App() {
|
||||
metadata: {
|
||||
new_entries: data.timeline.length,
|
||||
page: page,
|
||||
batch_size: BATCH_SIZE,
|
||||
batch_size: batchSizeMultiple,
|
||||
has_more: hasMore,
|
||||
cursor: cursor,
|
||||
completed: !hasMore,
|
||||
@@ -1066,6 +1190,10 @@ function App() {
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate elapsed time before clearing
|
||||
const startTime = accountStartTimesRef.current.get(accountId);
|
||||
const elapsedSecs = startTime ? Math.floor((Date.now() - startTime) / 1000) : 0;
|
||||
|
||||
// Clear timer
|
||||
clearInterval(timerInterval);
|
||||
accountTimersRef.current.delete(accountId);
|
||||
@@ -1081,6 +1209,7 @@ function App() {
|
||||
|
||||
if (wasTimeout) {
|
||||
// Timeout: incomplete if media was fetched, failed if no media
|
||||
logger.warning(`@${account.username}: timeout - ${finalMediaCount} items (${elapsedSecs}s)`);
|
||||
setMultipleAccounts((prev) =>
|
||||
prev.map((acc) =>
|
||||
acc.id === accountId
|
||||
@@ -1090,6 +1219,7 @@ function App() {
|
||||
);
|
||||
} else if (stopAllRef.current) {
|
||||
// Stopped by user: incomplete if media was fetched, failed if no media
|
||||
logger.info(`@${account.username}: stopped - ${finalMediaCount} items (${elapsedSecs}s)`);
|
||||
setMultipleAccounts((prev) =>
|
||||
prev.map((acc) =>
|
||||
acc.id === accountId
|
||||
@@ -1099,6 +1229,7 @@ function App() {
|
||||
);
|
||||
} else if (hasMore) {
|
||||
// Has more but stopped (e.g., API error): incomplete if media was fetched, failed if no media
|
||||
logger.warning(`@${account.username}: incomplete - ${finalMediaCount} items (${elapsedSecs}s)`);
|
||||
setMultipleAccounts((prev) =>
|
||||
prev.map((acc) =>
|
||||
acc.id === accountId
|
||||
@@ -1108,6 +1239,7 @@ function App() {
|
||||
);
|
||||
} else {
|
||||
// Completed successfully
|
||||
logger.success(`@${account.username}: completed - ${finalMediaCount} items (${elapsedSecs}s)`);
|
||||
setMultipleAccounts((prev) =>
|
||||
prev.map((acc) =>
|
||||
acc.id === accountId
|
||||
@@ -1117,6 +1249,10 @@ function App() {
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
// Calculate elapsed time before clearing
|
||||
const startTime = accountStartTimesRef.current.get(accountId);
|
||||
const elapsedSecs = startTime ? Math.floor((Date.now() - startTime) / 1000) : 0;
|
||||
|
||||
// Clear timer on error
|
||||
const timerInterval = accountTimersRef.current.get(accountId);
|
||||
if (timerInterval) {
|
||||
@@ -1158,7 +1294,7 @@ function App() {
|
||||
: acc
|
||||
)
|
||||
);
|
||||
logger.error(`Failed to fetch @${account.username}: ${errorMsg}`);
|
||||
logger.error(`@${account.username}: failed - ${errorMsg} (${elapsedSecs}s)`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1243,6 +1379,11 @@ function App() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get fetch mode from settings
|
||||
const retrySettings = getSettings();
|
||||
const isSingleModeRetry = retrySettings.fetchMode === "single";
|
||||
const batchSizeRetry = isSingleModeRetry ? 0 : BATCH_SIZE;
|
||||
|
||||
// Check if we have a saved cursor (like resume in single fetch)
|
||||
const cleanUsername = account.username.trim();
|
||||
let existingState: FetchState | null = null;
|
||||
@@ -1386,7 +1527,7 @@ function App() {
|
||||
username: cleanUsername,
|
||||
auth_token: authToken.trim(),
|
||||
timeline_type: "timeline",
|
||||
batch_size: BATCH_SIZE,
|
||||
batch_size: batchSizeRetry,
|
||||
page: page,
|
||||
media_type: fetchedMediaType || "all",
|
||||
retweets: false,
|
||||
@@ -1476,7 +1617,7 @@ function App() {
|
||||
metadata: {
|
||||
new_entries: data.timeline.length,
|
||||
page: page,
|
||||
batch_size: BATCH_SIZE,
|
||||
batch_size: batchSizeRetry,
|
||||
has_more: hasMore,
|
||||
cursor: cursor,
|
||||
completed: !hasMore,
|
||||
@@ -1494,6 +1635,10 @@ function App() {
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate elapsed time before clearing
|
||||
const startTime = accountStartTimesRef.current.get(accountId);
|
||||
const elapsedSecs = startTime ? Math.floor((Date.now() - startTime) / 1000) : 0;
|
||||
|
||||
// Clear timer
|
||||
clearInterval(timerInterval);
|
||||
accountTimersRef.current.delete(accountId);
|
||||
@@ -1507,6 +1652,7 @@ function App() {
|
||||
const wasTimeout = accountStopFlagsRef.current.get(accountId);
|
||||
|
||||
if (wasTimeout) {
|
||||
logger.warning(`@${account.username}: timeout - ${finalMediaCount} items (${elapsedSecs}s)`);
|
||||
setMultipleAccounts((prev) =>
|
||||
prev.map((acc) =>
|
||||
acc.id === accountId
|
||||
@@ -1515,6 +1661,7 @@ function App() {
|
||||
)
|
||||
);
|
||||
} else if (stopAllRef.current) {
|
||||
logger.info(`@${account.username}: stopped - ${finalMediaCount} items (${elapsedSecs}s)`);
|
||||
setMultipleAccounts((prev) =>
|
||||
prev.map((acc) =>
|
||||
acc.id === accountId
|
||||
@@ -1523,6 +1670,7 @@ function App() {
|
||||
)
|
||||
);
|
||||
} else if (hasMore) {
|
||||
logger.warning(`@${account.username}: incomplete - ${finalMediaCount} items (${elapsedSecs}s)`);
|
||||
setMultipleAccounts((prev) =>
|
||||
prev.map((acc) =>
|
||||
acc.id === accountId
|
||||
@@ -1532,6 +1680,7 @@ function App() {
|
||||
);
|
||||
} else {
|
||||
// Completed successfully - clear fetch state and cursor
|
||||
logger.success(`@${account.username}: completed - ${finalMediaCount} items (${elapsedSecs}s)`);
|
||||
clearFetchState(cleanUsername);
|
||||
clearCursor(cleanUsername);
|
||||
setMultipleAccounts((prev) =>
|
||||
@@ -1541,6 +1690,10 @@ function App() {
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
// Calculate elapsed time before clearing
|
||||
const startTime = accountStartTimesRef.current.get(accountId);
|
||||
const elapsedSecs = startTime ? Math.floor((Date.now() - startTime) / 1000) : 0;
|
||||
|
||||
// Clear timer on error
|
||||
const timerInterval = accountTimersRef.current.get(accountId);
|
||||
if (timerInterval) {
|
||||
@@ -1578,7 +1731,7 @@ function App() {
|
||||
: acc
|
||||
)
|
||||
);
|
||||
logger.error(`Failed to fetch @${account.username}: ${errorMsg}`);
|
||||
logger.error(`@${account.username}: failed - ${errorMsg} (${elapsedSecs}s)`);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -51,7 +51,7 @@ import { logger } from "@/lib/logger";
|
||||
import { toastWithSound as toast } from "@/lib/toast-with-sound";
|
||||
import { getSettings } from "@/lib/settings";
|
||||
import { openExternal } from "@/lib/utils";
|
||||
import { DownloadMediaWithMetadata, OpenFolder, IsFFmpegInstalled, ConvertGIFs, StopDownload } from "../../wailsjs/go/main/App";
|
||||
import { DownloadMediaWithMetadata, OpenFolder, IsFFmpegInstalled, ConvertGIFs, StopDownload, CheckFolderExists, CheckGifsFolderHasMP4 } from "../../wailsjs/go/main/App";
|
||||
import { EventsOn, EventsOff } from "../../wailsjs/runtime/runtime";
|
||||
import { main } from "../../wailsjs/go/models";
|
||||
|
||||
@@ -231,9 +231,10 @@ export function MediaList({
|
||||
const [downloadProgress, setDownloadProgress] = useState<DownloadProgress | null>(null);
|
||||
const [hasDownloaded, setHasDownloaded] = useState(false);
|
||||
const [isConverting, setIsConverting] = useState(false);
|
||||
const [hasGifs, setHasGifs] = useState(false);
|
||||
const [ffmpegInstalled, setFfmpegInstalled] = useState(false);
|
||||
const [showScrollTop, setShowScrollTop] = useState(false);
|
||||
const [folderExists, setFolderExists] = useState(false);
|
||||
const [gifsFolderHasMP4, setGifsFolderHasMP4] = useState(false);
|
||||
const [previewIndex, setPreviewIndex] = useState<number | null>(null);
|
||||
// Download status tracking per item (by tweet_id + index for uniqueness)
|
||||
const [downloadedItems, setDownloadedItems] = useState<Set<string>>(new Set());
|
||||
@@ -290,6 +291,40 @@ export function MediaList({
|
||||
setVisibleCount(10);
|
||||
}, [filteredTimeline.length]);
|
||||
|
||||
// Check folder existence and FFmpeg installation
|
||||
useEffect(() => {
|
||||
const checkFoldersAndFFmpeg = async () => {
|
||||
const settings = getSettings();
|
||||
const basePath = settings.downloadPath;
|
||||
|
||||
// Check FFmpeg installation
|
||||
const installed = await IsFFmpegInstalled();
|
||||
setFfmpegInstalled(installed);
|
||||
|
||||
if (!basePath || !accountInfo.name) return;
|
||||
|
||||
// For bookmarks/likes, check special folder names
|
||||
let folderName = accountInfo.name;
|
||||
if (accountInfo.nick === "My Bookmarks" || accountInfo.name === "bookmarks") {
|
||||
folderName = "My Bookmarks";
|
||||
} else if (accountInfo.nick === "My Likes" || accountInfo.name === "likes") {
|
||||
folderName = "My Likes";
|
||||
}
|
||||
|
||||
const exists = await CheckFolderExists(basePath, folderName);
|
||||
setFolderExists(exists);
|
||||
|
||||
if (exists) {
|
||||
const hasMP4 = await CheckGifsFolderHasMP4(basePath, folderName);
|
||||
setGifsFolderHasMP4(hasMP4);
|
||||
} else {
|
||||
setGifsFolderHasMP4(false);
|
||||
}
|
||||
};
|
||||
|
||||
checkFoldersAndFFmpeg();
|
||||
}, [accountInfo.name, accountInfo.nick, hasDownloaded]);
|
||||
|
||||
// Intersection Observer for lazy loading thumbnails
|
||||
useEffect(() => {
|
||||
if (!loadMoreRef.current) return;
|
||||
@@ -538,13 +573,9 @@ export function MediaList({
|
||||
}
|
||||
setHasDownloaded(true);
|
||||
|
||||
// Check if there are GIFs and FFmpeg is installed
|
||||
const hasGifItems = itemsWithIndices.some(({ item }) => item.type === "gif" || item.type === "animated_gif");
|
||||
if (hasGifItems) {
|
||||
setHasGifs(true);
|
||||
const installed = await IsFFmpegInstalled();
|
||||
setFfmpegInstalled(installed);
|
||||
}
|
||||
// Check if FFmpeg is installed for GIF conversion
|
||||
const installed = await IsFFmpegInstalled();
|
||||
setFfmpegInstalled(installed);
|
||||
} else {
|
||||
logger.error(response.message);
|
||||
toast.error("Download failed");
|
||||
@@ -635,7 +666,16 @@ export function MediaList({
|
||||
if (response.success) {
|
||||
logger.success(`Converted ${response.converted} GIFs`);
|
||||
toast.success(`${response.converted} GIFs converted`);
|
||||
setHasGifs(false);
|
||||
// Re-check if gifs folder still has MP4 files after conversion
|
||||
const settings = getSettings();
|
||||
let folderName = accountInfo.name;
|
||||
if (accountInfo.nick === "My Bookmarks" || accountInfo.name === "bookmarks") {
|
||||
folderName = "My Bookmarks";
|
||||
} else if (accountInfo.nick === "My Likes" || accountInfo.name === "likes") {
|
||||
folderName = "My Likes";
|
||||
}
|
||||
const hasMP4 = await CheckGifsFolderHasMP4(settings.downloadPath, folderName);
|
||||
setGifsFolderHasMP4(hasMP4);
|
||||
} else {
|
||||
logger.error(response.message);
|
||||
toast.error("Convert failed");
|
||||
@@ -701,7 +741,7 @@ export function MediaList({
|
||||
</span>
|
||||
<span className="flex items-center gap-1">
|
||||
<MessageSquare className="h-3.5 w-3.5" />
|
||||
{formatNumber(accountInfo.statuses_count)} tweets
|
||||
{formatNumber(accountInfo.statuses_count)} posts
|
||||
</span>
|
||||
{accountInfo.date && (
|
||||
<span className="flex items-center gap-1">
|
||||
@@ -745,24 +785,30 @@ export function MediaList({
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="all">All ({formatNumberWithComma(totalUrls)})</SelectItem>
|
||||
<SelectItem value="photo">
|
||||
<span className="flex items-center gap-2">
|
||||
<Image className="h-4 w-4 text-blue-500" />
|
||||
Images ({formatNumberWithComma(mediaCounts.photo)})
|
||||
</span>
|
||||
</SelectItem>
|
||||
<SelectItem value="video">
|
||||
<span className="flex items-center gap-2">
|
||||
<Video className="h-4 w-4 text-purple-500" />
|
||||
Videos ({formatNumberWithComma(mediaCounts.video)})
|
||||
</span>
|
||||
</SelectItem>
|
||||
<SelectItem value="gif">
|
||||
<span className="flex items-center gap-2">
|
||||
<Film className="h-4 w-4 text-green-500" />
|
||||
GIFs ({formatNumberWithComma(mediaCounts.gif)})
|
||||
</span>
|
||||
</SelectItem>
|
||||
{mediaCounts.photo > 0 && (
|
||||
<SelectItem value="photo">
|
||||
<span className="flex items-center gap-2">
|
||||
<Image className="h-4 w-4 text-blue-500" />
|
||||
Images ({formatNumberWithComma(mediaCounts.photo)})
|
||||
</span>
|
||||
</SelectItem>
|
||||
)}
|
||||
{mediaCounts.video > 0 && (
|
||||
<SelectItem value="video">
|
||||
<span className="flex items-center gap-2">
|
||||
<Video className="h-4 w-4 text-purple-500" />
|
||||
Videos ({formatNumberWithComma(mediaCounts.video)})
|
||||
</span>
|
||||
</SelectItem>
|
||||
)}
|
||||
{mediaCounts.gif > 0 && (
|
||||
<SelectItem value="gif">
|
||||
<span className="flex items-center gap-2">
|
||||
<Film className="h-4 w-4 text-green-500" />
|
||||
GIFs ({formatNumberWithComma(mediaCounts.gif)})
|
||||
</span>
|
||||
</SelectItem>
|
||||
)}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
)}
|
||||
@@ -796,27 +842,23 @@ export function MediaList({
|
||||
</div>
|
||||
|
||||
<div className="flex-1" />
|
||||
{hasDownloaded && (
|
||||
<Button variant="outline" onClick={handleOpenFolder}>
|
||||
<FolderOpen className="h-4 w-4" />
|
||||
Open Folder
|
||||
</Button>
|
||||
)}
|
||||
{hasGifs && ffmpegInstalled && (
|
||||
<Button variant="outline" onClick={handleConvertGifs} disabled={isConverting}>
|
||||
{isConverting ? (
|
||||
<>
|
||||
<Spinner />
|
||||
Converting...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Film className="h-4 w-4" />
|
||||
Convert GIFs
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
)}
|
||||
<Button variant="outline" onClick={handleOpenFolder} disabled={!folderExists}>
|
||||
<FolderOpen className="h-4 w-4" />
|
||||
Open Folder
|
||||
</Button>
|
||||
<Button variant="outline" onClick={handleConvertGifs} disabled={isConverting || !gifsFolderHasMP4 || !ffmpegInstalled}>
|
||||
{isConverting ? (
|
||||
<>
|
||||
<Spinner />
|
||||
Converting...
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Film className="h-4 w-4" />
|
||||
Convert GIFs
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
<div className="flex items-center gap-2">
|
||||
{isDownloading && (
|
||||
<Button variant="destructive" onClick={handleStopDownload}>
|
||||
@@ -1234,7 +1276,7 @@ export function MediaList({
|
||||
|
||||
{/* Counter - above media */}
|
||||
<div className="text-white text-sm bg-black/50 px-4 py-1.5 rounded-full mb-4">
|
||||
{previewIndex + 1} / {filteredTimeline.length}
|
||||
{formatNumberWithComma(previewIndex + 1)} / {formatNumberWithComma(filteredTimeline.length)}
|
||||
</div>
|
||||
|
||||
{/* Media content - center */}
|
||||
|
||||
@@ -28,6 +28,10 @@ import {
|
||||
AlertCircle,
|
||||
} from "lucide-react";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
|
||||
function formatNumberWithComma(num: number): string {
|
||||
return num.toLocaleString();
|
||||
}
|
||||
import { Checkbox } from "@/components/ui/checkbox";
|
||||
import {
|
||||
Select,
|
||||
@@ -45,6 +49,7 @@ import { Settings as SettingsIcon } from "lucide-react";
|
||||
import { FetchHistory } from "@/components/FetchHistory";
|
||||
import type { HistoryItem } from "@/components/FetchHistory";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { getSettings, updateSettings, type FetchMode as SettingsFetchMode, type MediaType as SettingsMediaType } from "@/lib/settings";
|
||||
|
||||
export type FetchMode = "public" | "private";
|
||||
export type PrivateType = "bookmarks" | "likes";
|
||||
@@ -144,8 +149,8 @@ export function SearchBar({
|
||||
const [useDateRange, setUseDateRange] = useState(false);
|
||||
const [startDate, setStartDate] = useState("");
|
||||
const [endDate, setEndDate] = useState("");
|
||||
const [mediaType, setMediaType] = useState("all");
|
||||
const [retweets, setRetweets] = useState(false);
|
||||
const [mediaType, setMediaType] = useState<SettingsMediaType>(getSettings().mediaType);
|
||||
const [retweets, setRetweets] = useState(getSettings().includeRetweets);
|
||||
const [mode, setMode] = useState<FetchMode>(externalMode || "public");
|
||||
const [privateType, setPrivateType] = useState<PrivateType>(externalPrivateType || "bookmarks");
|
||||
|
||||
@@ -163,6 +168,7 @@ export function SearchBar({
|
||||
}, [externalPrivateType]);
|
||||
const [showAuthInput, setShowAuthInput] = useState(false);
|
||||
const [showAdvanced, setShowAdvanced] = useState(false);
|
||||
const [currentFetchMode, setCurrentFetchMode] = useState<SettingsFetchMode>(getSettings().fetchMode);
|
||||
|
||||
// Separate auth tokens for public and private modes
|
||||
const [publicAuthToken, setPublicAuthToken] = useState("");
|
||||
@@ -386,7 +392,7 @@ export function SearchBar({
|
||||
{/* Timer Display */}
|
||||
{(remainingTime !== null || elapsedTime > 0) && (
|
||||
<div className="flex items-center gap-1.5 px-3 py-1.5 border rounded-md bg-muted/50 text-sm w-[85px]">
|
||||
<Clock className="h-3.5 w-3.5 text-muted-foreground flex-shrink-0" />
|
||||
<Clock className="h-3.5 w-3.5 text-muted-foreground shrink-0" />
|
||||
<span className="font-mono">
|
||||
{remainingTime !== null && remainingTime >= 0
|
||||
? `${Math.floor(remainingTime / 60)}:${String(remainingTime % 60).padStart(2, "0")}`
|
||||
@@ -409,11 +415,11 @@ export function SearchBar({
|
||||
<Trash2 className="h-4 w-4" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>Clear resume data</TooltipContent>
|
||||
<TooltipContent>Clear Resume</TooltipContent>
|
||||
</Tooltip>
|
||||
<Button variant="secondary" onClick={handleResume} disabled={!hasAuthToken}>
|
||||
<RotateCcw className="h-4 w-4" />
|
||||
Resume ({resumeInfo.mediaCount})
|
||||
Resume ({resumeInfo.mediaCount.toLocaleString()})
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
@@ -505,7 +511,7 @@ export function SearchBar({
|
||||
{/* Timer Display */}
|
||||
{(remainingTime !== null || elapsedTime > 0) && (
|
||||
<div className="flex items-center gap-1.5 px-3 py-1.5 border rounded-md bg-muted/50 text-sm w-[85px]">
|
||||
<Clock className="h-3.5 w-3.5 text-muted-foreground flex-shrink-0" />
|
||||
<Clock className="h-3.5 w-3.5 text-muted-foreground shrink-0" />
|
||||
<span className="font-mono">
|
||||
{remainingTime !== null && remainingTime >= 0
|
||||
? `${Math.floor(remainingTime / 60)}:${String(remainingTime % 60).padStart(2, "0")}`
|
||||
@@ -602,22 +608,44 @@ export function SearchBar({
|
||||
{showAdvanced && (
|
||||
<div className="p-3 border rounded-lg bg-muted/30 space-y-3">
|
||||
{/* Options Row */}
|
||||
<div className="flex items-center gap-4">
|
||||
<div className="flex items-center gap-4 flex-wrap">
|
||||
{/* Fetch Mode */}
|
||||
<div className="flex items-center gap-2">
|
||||
<Label htmlFor="fetch-mode" className="text-sm">
|
||||
Fetch Mode
|
||||
</Label>
|
||||
<Select value={currentFetchMode} onValueChange={(value: SettingsFetchMode) => {
|
||||
updateSettings({ fetchMode: value });
|
||||
setCurrentFetchMode(value);
|
||||
}}>
|
||||
<SelectTrigger id="fetch-mode" className="w-auto h-8 bg-background">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="batch">Batch</SelectItem>
|
||||
<SelectItem value="single">Single</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
{/* Media Type */}
|
||||
<div className="flex items-center gap-2">
|
||||
<Label htmlFor="media-type" className="text-sm">
|
||||
Media Type
|
||||
</Label>
|
||||
<Select value={mediaType} onValueChange={setMediaType}>
|
||||
<Select value={mediaType} onValueChange={(value: SettingsMediaType) => {
|
||||
updateSettings({ mediaType: value });
|
||||
setMediaType(value);
|
||||
}}>
|
||||
<SelectTrigger id="media-type" className="w-auto h-8 bg-background">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="all">All Media</SelectItem>
|
||||
<SelectItem value="image">Images Only</SelectItem>
|
||||
<SelectItem value="video">Videos Only</SelectItem>
|
||||
<SelectItem value="gif">GIFs Only</SelectItem>
|
||||
<SelectItem value="text">Text Only (No Media)</SelectItem>
|
||||
<SelectItem value="image">Images</SelectItem>
|
||||
<SelectItem value="video">Videos</SelectItem>
|
||||
<SelectItem value="gif">GIFs</SelectItem>
|
||||
<SelectItem value="text">Text (No Media)</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
@@ -627,7 +655,11 @@ export function SearchBar({
|
||||
<Checkbox
|
||||
id="retweets"
|
||||
checked={retweets}
|
||||
onCheckedChange={(checked) => setRetweets(checked as boolean)}
|
||||
onCheckedChange={(checked) => {
|
||||
const value = checked as boolean;
|
||||
updateSettings({ includeRetweets: value });
|
||||
setRetweets(value);
|
||||
}}
|
||||
className="bg-background"
|
||||
/>
|
||||
<Label htmlFor="retweets" className="text-sm cursor-pointer">
|
||||
@@ -688,29 +720,29 @@ export function SearchBar({
|
||||
<CheckCircle className="h-4 w-4 text-green-600 dark:text-green-400" />
|
||||
<span className="text-muted-foreground">Completed:</span>
|
||||
<span className="font-medium">
|
||||
{multipleAccounts.filter((acc) => acc.status === "completed").length}
|
||||
{formatNumberWithComma(multipleAccounts.filter((acc) => acc.status === "completed").length)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<AlertCircle className="h-4 w-4 text-yellow-600 dark:text-yellow-400" />
|
||||
<span className="text-muted-foreground">Incomplete:</span>
|
||||
<span className="font-medium">
|
||||
{multipleAccounts.filter((acc) => acc.status === "incomplete").length}
|
||||
{formatNumberWithComma(multipleAccounts.filter((acc) => acc.status === "incomplete").length)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<XCircle className="h-4 w-4 text-red-600 dark:text-red-400" />
|
||||
<span className="text-muted-foreground">Failed:</span>
|
||||
<span className="font-medium">
|
||||
{multipleAccounts.filter((acc) => acc.status === "failed").length}
|
||||
{formatNumberWithComma(multipleAccounts.filter((acc) => acc.status === "failed").length)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-2 ml-auto">
|
||||
<span className="text-muted-foreground">Total:</span>
|
||||
<span className="font-medium">
|
||||
{multipleAccounts.filter((acc) =>
|
||||
{formatNumberWithComma(multipleAccounts.filter((acc) =>
|
||||
acc.status === "completed" || acc.status === "incomplete" || acc.status === "failed"
|
||||
).length}/{multipleAccounts.length}
|
||||
).length)}/{formatNumberWithComma(multipleAccounts.length)}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -720,7 +752,7 @@ export function SearchBar({
|
||||
{/* Account List - below auth token and advanced settings */}
|
||||
{fetchType === "multiple" && multipleAccounts.length > 0 && (
|
||||
<div className="space-y-2">
|
||||
<p className="text-sm text-muted-foreground">Accounts to Fetch ({multipleAccounts.length})</p>
|
||||
<p className="text-sm text-muted-foreground">Accounts to Fetch ({formatNumberWithComma(multipleAccounts.length)})</p>
|
||||
<div className="space-y-2 max-h-[400px] overflow-y-auto">
|
||||
{multipleAccounts.map((account) => (
|
||||
<div
|
||||
@@ -767,7 +799,7 @@ export function SearchBar({
|
||||
{account.status === "fetching" && (
|
||||
<>
|
||||
<div className="flex items-center gap-1.5 px-3 py-1.5 border rounded-md bg-muted/50 text-sm w-[85px]">
|
||||
<Clock className="h-3.5 w-3.5 text-muted-foreground flex-shrink-0" />
|
||||
<Clock className="h-3.5 w-3.5 text-muted-foreground shrink-0" />
|
||||
<span className="font-mono">
|
||||
{account.remainingTime !== null && account.remainingTime >= 0
|
||||
? formatTime(account.remainingTime)
|
||||
|
||||
@@ -10,7 +10,15 @@ import {
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||
import { FolderOpen, Save, RotateCcw, Info, Download, Check, Volume2 } from "lucide-react";
|
||||
import { FolderOpen, Save, RotateCcw, Info, Download, Check } from "lucide-react";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog";
|
||||
import { Spinner } from "@/components/ui/spinner";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { getSettings, getSettingsWithDefaults, saveSettings, resetToDefaultSettings, applyThemeMode, applyFont, FONT_OPTIONS, type Settings as SettingsType, type FontFamily, type GifQuality, type GifResolution } from "@/lib/settings";
|
||||
@@ -26,6 +34,7 @@ export function SettingsPage() {
|
||||
const [downloadingFFmpeg, setDownloadingFFmpeg] = useState(false);
|
||||
const [exiftoolInstalled, setExiftoolInstalled] = useState(false);
|
||||
const [downloadingExifTool, setDownloadingExifTool] = useState(false);
|
||||
const [showResetConfirm, setShowResetConfirm] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
applyThemeMode(savedSettings.themeMode);
|
||||
@@ -80,6 +89,7 @@ export function SettingsPage() {
|
||||
applyThemeMode(defaultSettings.themeMode);
|
||||
applyTheme(defaultSettings.theme);
|
||||
applyFont(defaultSettings.fontFamily);
|
||||
setShowResetConfirm(false);
|
||||
toast.success("Settings reset to default");
|
||||
};
|
||||
|
||||
@@ -215,7 +225,6 @@ export function SettingsPage() {
|
||||
|
||||
{/* Sound Effects */}
|
||||
<div className="flex items-center gap-3 pt-2">
|
||||
<Volume2 className="h-4 w-4 text-muted-foreground" />
|
||||
<Label htmlFor="sfx-enabled" className="cursor-pointer text-sm">Sound Effects</Label>
|
||||
<Switch
|
||||
id="sfx-enabled"
|
||||
@@ -315,51 +324,42 @@ export function SettingsPage() {
|
||||
|
||||
{/* GIF Quality - only show if FFmpeg installed */}
|
||||
{ffmpegInstalled && (
|
||||
<>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="gif-quality">GIF Quality</Label>
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="gif-quality">GIF Quality</Label>
|
||||
<div className="flex items-center gap-2">
|
||||
<Select
|
||||
value={tempSettings.gifQuality}
|
||||
onValueChange={(value: GifQuality) => {
|
||||
setTempSettings((prev) => ({
|
||||
...prev,
|
||||
gifQuality: value,
|
||||
// Auto-select "original" when switching to "better"
|
||||
gifResolution: value === "better" ? "original" : prev.gifResolution,
|
||||
}));
|
||||
}}
|
||||
>
|
||||
<SelectTrigger id="gif-quality">
|
||||
<SelectTrigger id="gif-quality" className="w-auto">
|
||||
<SelectValue placeholder="Select quality" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="fast">Fast (Simple conversion)</SelectItem>
|
||||
<SelectItem value="better">Better (Optimized palette)</SelectItem>
|
||||
<SelectItem value="fast">Fast</SelectItem>
|
||||
<SelectItem value="better">Better</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Select
|
||||
value={tempSettings.gifResolution}
|
||||
onValueChange={(value: GifResolution) => setTempSettings((prev) => ({ ...prev, gifResolution: value }))}
|
||||
>
|
||||
<SelectTrigger id="gif-resolution" className="w-auto">
|
||||
<SelectValue placeholder="Resolution" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="original">Original</SelectItem>
|
||||
<SelectItem value="high">High (800px)</SelectItem>
|
||||
<SelectItem value="medium">Medium (600px)</SelectItem>
|
||||
<SelectItem value="low">Low (400px)</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
{/* GIF Resolution - only show if Better quality selected */}
|
||||
{tempSettings.gifQuality === "better" && (
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="gif-resolution">GIF Resolution</Label>
|
||||
<Select
|
||||
value={tempSettings.gifResolution}
|
||||
onValueChange={(value: GifResolution) => setTempSettings((prev) => ({ ...prev, gifResolution: value }))}
|
||||
>
|
||||
<SelectTrigger id="gif-resolution">
|
||||
<SelectValue placeholder="Select resolution" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="original">Original (No scaling, 15 fps)</SelectItem>
|
||||
<SelectItem value="high">High (800px, 15 fps)</SelectItem>
|
||||
<SelectItem value="medium">Medium (600px, 10 fps)</SelectItem>
|
||||
<SelectItem value="low">Low (400px, 8 fps)</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Proxy */}
|
||||
@@ -428,12 +428,13 @@ export function SettingsPage() {
|
||||
className="w-[20%]"
|
||||
/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Actions */}
|
||||
<div className="flex gap-2 justify-between pt-4 border-t">
|
||||
<Button variant="outline" onClick={handleReset} className="gap-1.5">
|
||||
<Button variant="outline" onClick={() => setShowResetConfirm(true)} className="gap-1.5">
|
||||
<RotateCcw className="h-4 w-4" />
|
||||
Reset to Default
|
||||
</Button>
|
||||
@@ -442,6 +443,22 @@ export function SettingsPage() {
|
||||
Save Changes
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
{/* Reset Confirmation Dialog */}
|
||||
<Dialog open={showResetConfirm} onOpenChange={setShowResetConfirm}>
|
||||
<DialogContent className="max-w-md [&>button]:hidden">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Reset to Default?</DialogTitle>
|
||||
<DialogDescription>
|
||||
This will reset all settings to their default values. Your custom configurations will be lost.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<DialogFooter>
|
||||
<Button variant="outline" onClick={() => setShowResetConfirm(false)}>Cancel</Button>
|
||||
<Button onClick={handleReset}>Reset</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,10 @@
|
||||
import { Home, Settings, Bug, Database, LayoutGrid } from "lucide-react";
|
||||
import { HomeIcon } from "@/components/ui/home";
|
||||
import { SettingsIcon } from "@/components/ui/settings";
|
||||
import { ArchiveIcon } from "@/components/ui/archive";
|
||||
import { TerminalIcon } from "@/components/ui/terminal";
|
||||
import { GithubIcon } from "@/components/ui/github";
|
||||
import { BlocksIcon } from "@/components/ui/blocks";
|
||||
import { CoffeeIcon } from "@/components/ui/coffee";
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
@@ -15,56 +21,95 @@ interface SidebarProps {
|
||||
}
|
||||
|
||||
export function Sidebar({ currentPage, onPageChange }: SidebarProps) {
|
||||
const navItems = [
|
||||
{ id: "main" as PageType, icon: Home, label: "Home" },
|
||||
{ id: "settings" as PageType, icon: Settings, label: "Settings" },
|
||||
{ id: "database" as PageType, icon: Database, label: "Saved Accounts" },
|
||||
{ id: "debug" as PageType, icon: Bug, label: "Debug Logs" },
|
||||
];
|
||||
|
||||
return (
|
||||
<div className="fixed left-0 top-0 h-full w-14 bg-card border-r border-border flex flex-col items-center py-14 z-30">
|
||||
<div className="flex flex-col gap-2 flex-1">
|
||||
{navItems.map((item) => (
|
||||
<Tooltip key={item.id} delayDuration={0}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant={currentPage === item.id ? "secondary" : "ghost"}
|
||||
size="icon"
|
||||
className="h-10 w-10"
|
||||
onClick={() => onPageChange(item.id)}
|
||||
>
|
||||
<item.icon className="h-5 w-5" />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">
|
||||
<p>{item.label}</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
))}
|
||||
{/* Home */}
|
||||
<Tooltip delayDuration={0}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant={currentPage === "main" ? "secondary" : "ghost"}
|
||||
size="icon"
|
||||
className="h-10 w-10"
|
||||
onClick={() => onPageChange("main")}
|
||||
>
|
||||
<HomeIcon size={20} />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">
|
||||
<p>Home</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
|
||||
{/* Settings */}
|
||||
<Tooltip delayDuration={0}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant={currentPage === "settings" ? "secondary" : "ghost"}
|
||||
size="icon"
|
||||
className="h-10 w-10"
|
||||
onClick={() => onPageChange("settings")}
|
||||
>
|
||||
<SettingsIcon size={20} />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">
|
||||
<p>Settings</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
|
||||
{/* Database - using animated archive icon */}
|
||||
<Tooltip delayDuration={0}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant={currentPage === "database" ? "secondary" : "ghost"}
|
||||
size="icon"
|
||||
className="h-10 w-10"
|
||||
onClick={() => onPageChange("database")}
|
||||
>
|
||||
<ArchiveIcon size={20} />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">
|
||||
<p>Saved Accounts</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
|
||||
{/* Debug - using animated terminal icon */}
|
||||
<Tooltip delayDuration={0}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant={currentPage === "debug" ? "secondary" : "ghost"}
|
||||
size="icon"
|
||||
className="h-10 w-10"
|
||||
onClick={() => onPageChange("debug")}
|
||||
>
|
||||
<TerminalIcon size={20} />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">
|
||||
<p>Debug Logs</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
|
||||
{/* GitHub - below debug */}
|
||||
<Tooltip delayDuration={0}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-10 w-10"
|
||||
onClick={() => openExternal("https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/issues")}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" className="h-5 w-5" fill="currentColor">
|
||||
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
|
||||
</svg>
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">
|
||||
<p>Report Bug</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
|
||||
{/* Other Projects at bottom */}
|
||||
<div className="mt-auto">
|
||||
{/* Bottom icons */}
|
||||
<div className="mt-auto flex flex-col gap-2">
|
||||
<Tooltip delayDuration={0}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-10 w-10"
|
||||
onClick={() => openExternal("https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/issues")}
|
||||
>
|
||||
<GithubIcon size={20} />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">
|
||||
<p>Report Bug</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
<Tooltip delayDuration={0}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
@@ -73,13 +118,28 @@ export function Sidebar({ currentPage, onPageChange }: SidebarProps) {
|
||||
className="h-10 w-10"
|
||||
onClick={() => openExternal("https://exyezed.cc/")}
|
||||
>
|
||||
<LayoutGrid className="h-5 w-5" />
|
||||
<BlocksIcon size={20} />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">
|
||||
<p>Other Projects</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
<Tooltip delayDuration={0}>
|
||||
<TooltipTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="h-10 w-10"
|
||||
onClick={() => openExternal("https://ko-fi.com/afkarxyz")}
|
||||
>
|
||||
<CoffeeIcon size={20} />
|
||||
</Button>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent side="right">
|
||||
<p>Support me on Ko-fi</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import * as AccordionPrimitive from "@radix-ui/react-accordion"
|
||||
import { ChevronDownIcon } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function Accordion({
|
||||
...props
|
||||
}: React.ComponentProps<typeof AccordionPrimitive.Root>) {
|
||||
return <AccordionPrimitive.Root data-slot="accordion" {...props} />
|
||||
}
|
||||
|
||||
function AccordionItem({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof AccordionPrimitive.Item>) {
|
||||
return (
|
||||
<AccordionPrimitive.Item
|
||||
data-slot="accordion-item"
|
||||
className={cn("border-b last:border-b-0", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function AccordionTrigger({
|
||||
className,
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
|
||||
return (
|
||||
<AccordionPrimitive.Header className="flex">
|
||||
<AccordionPrimitive.Trigger
|
||||
data-slot="accordion-trigger"
|
||||
className={cn(
|
||||
"focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
<ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" />
|
||||
</AccordionPrimitive.Trigger>
|
||||
</AccordionPrimitive.Header>
|
||||
)
|
||||
}
|
||||
|
||||
function AccordionContent({
|
||||
className,
|
||||
children,
|
||||
...props
|
||||
}: React.ComponentProps<typeof AccordionPrimitive.Content>) {
|
||||
return (
|
||||
<AccordionPrimitive.Content
|
||||
data-slot="accordion-content"
|
||||
className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
|
||||
{...props}
|
||||
>
|
||||
<div className={cn("pt-0 pb-4", className)}>{children}</div>
|
||||
</AccordionPrimitive.Content>
|
||||
)
|
||||
}
|
||||
|
||||
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|
||||
@@ -0,0 +1,132 @@
|
||||
'use client';
|
||||
|
||||
import type { Variants } from 'motion/react';
|
||||
import type { HTMLAttributes } from 'react';
|
||||
import { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';
|
||||
import { motion, useAnimation } from 'motion/react';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
export interface ArchiveIconHandle {
|
||||
startAnimation: () => void;
|
||||
stopAnimation: () => void;
|
||||
}
|
||||
|
||||
interface ArchiveIconProps extends HTMLAttributes<HTMLDivElement> {
|
||||
size?: number;
|
||||
}
|
||||
|
||||
const RECT_VARIANTS: Variants = {
|
||||
normal: {
|
||||
translateY: 0,
|
||||
transition: {
|
||||
duration: 0.2,
|
||||
type: 'spring',
|
||||
stiffness: 200,
|
||||
damping: 25,
|
||||
},
|
||||
},
|
||||
animate: {
|
||||
translateY: -1.5,
|
||||
transition: {
|
||||
duration: 0.2,
|
||||
type: 'spring',
|
||||
stiffness: 200,
|
||||
damping: 25,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const PATH_VARIANTS: Variants = {
|
||||
normal: { d: 'M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8' },
|
||||
animate: { d: 'M4 11v9a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V11' },
|
||||
};
|
||||
|
||||
const SECONDARY_PATH_VARIANTS: Variants = {
|
||||
normal: { d: 'M10 12h4' },
|
||||
animate: { d: 'M10 15h4' },
|
||||
};
|
||||
|
||||
const ArchiveIcon = forwardRef<ArchiveIconHandle, ArchiveIconProps>(
|
||||
({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {
|
||||
const controls = useAnimation();
|
||||
const isControlledRef = useRef(false);
|
||||
|
||||
useImperativeHandle(ref, () => {
|
||||
isControlledRef.current = true;
|
||||
|
||||
return {
|
||||
startAnimation: () => controls.start('animate'),
|
||||
stopAnimation: () => controls.start('normal'),
|
||||
};
|
||||
});
|
||||
|
||||
const handleMouseEnter = useCallback(
|
||||
(e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!isControlledRef.current) {
|
||||
controls.start('animate');
|
||||
} else {
|
||||
onMouseEnter?.(e);
|
||||
}
|
||||
},
|
||||
[controls, onMouseEnter]
|
||||
);
|
||||
|
||||
const handleMouseLeave = useCallback(
|
||||
(e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!isControlledRef.current) {
|
||||
controls.start('normal');
|
||||
} else {
|
||||
onMouseLeave?.(e);
|
||||
}
|
||||
},
|
||||
[controls, onMouseLeave]
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(className)}
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
{...props}
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
>
|
||||
<motion.rect
|
||||
width="20"
|
||||
height="5"
|
||||
x="2"
|
||||
y="3"
|
||||
rx="1"
|
||||
initial="normal"
|
||||
animate={controls}
|
||||
variants={RECT_VARIANTS}
|
||||
/>
|
||||
<motion.path
|
||||
d="M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"
|
||||
variants={PATH_VARIANTS}
|
||||
animate={controls}
|
||||
/>
|
||||
<motion.path
|
||||
d="M10 12h4"
|
||||
variants={SECONDARY_PATH_VARIANTS}
|
||||
animate={controls}
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
ArchiveIcon.displayName = 'ArchiveIcon';
|
||||
|
||||
export { ArchiveIcon };
|
||||
@@ -0,0 +1,92 @@
|
||||
'use client';
|
||||
|
||||
import type { Variants } from 'motion/react';
|
||||
import type { HTMLAttributes } from 'react';
|
||||
import { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';
|
||||
import { motion, useAnimation } from 'motion/react';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
export interface BlocksIconHandle {
|
||||
startAnimation: () => void;
|
||||
stopAnimation: () => void;
|
||||
}
|
||||
|
||||
interface BlocksIconProps extends HTMLAttributes<HTMLDivElement> {
|
||||
size?: number;
|
||||
}
|
||||
|
||||
const VARIANTS: Variants = {
|
||||
normal: { translateX: 0, translateY: 0 },
|
||||
animate: { translateX: -4, translateY: 4 },
|
||||
};
|
||||
|
||||
const BlocksIcon = forwardRef<BlocksIconHandle, BlocksIconProps>(
|
||||
({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {
|
||||
const controls = useAnimation();
|
||||
const isControlledRef = useRef(false);
|
||||
|
||||
useImperativeHandle(ref, () => {
|
||||
isControlledRef.current = true;
|
||||
|
||||
return {
|
||||
startAnimation: () => controls.start('animate'),
|
||||
stopAnimation: () => controls.start('normal'),
|
||||
};
|
||||
});
|
||||
|
||||
const handleMouseEnter = useCallback(
|
||||
(e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!isControlledRef.current) {
|
||||
controls.start('animate');
|
||||
} else {
|
||||
onMouseEnter?.(e);
|
||||
}
|
||||
},
|
||||
[controls, onMouseEnter]
|
||||
);
|
||||
|
||||
const handleMouseLeave = useCallback(
|
||||
(e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!isControlledRef.current) {
|
||||
controls.start('normal');
|
||||
} else {
|
||||
onMouseLeave?.(e);
|
||||
}
|
||||
},
|
||||
[controls, onMouseLeave]
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(className)}
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
{...props}
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
>
|
||||
<path d="M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3" />
|
||||
<motion.path
|
||||
d="M14 3h7v7h-7z"
|
||||
variants={VARIANTS}
|
||||
animate={controls}
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
BlocksIcon.displayName = 'BlocksIcon';
|
||||
|
||||
export { BlocksIcon };
|
||||
@@ -1,92 +0,0 @@
|
||||
import * as React from "react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function Card({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card"
|
||||
className={cn(
|
||||
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-header"
|
||||
className={cn(
|
||||
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-title"
|
||||
className={cn("leading-none font-semibold", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-description"
|
||||
className={cn("text-muted-foreground text-sm", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-action"
|
||||
className={cn(
|
||||
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-content"
|
||||
className={cn("px-6", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
|
||||
return (
|
||||
<div
|
||||
data-slot="card-footer"
|
||||
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export {
|
||||
Card,
|
||||
CardHeader,
|
||||
CardFooter,
|
||||
CardTitle,
|
||||
CardAction,
|
||||
CardDescription,
|
||||
CardContent,
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
'use client';
|
||||
|
||||
import type { Variants } from 'motion/react';
|
||||
import type { HTMLAttributes } from 'react';
|
||||
import { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';
|
||||
import { motion, useAnimation } from 'motion/react';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
export interface CoffeeIconHandle {
|
||||
startAnimation: () => void;
|
||||
stopAnimation: () => void;
|
||||
}
|
||||
|
||||
interface CoffeeIconProps extends HTMLAttributes<HTMLDivElement> {
|
||||
size?: number;
|
||||
}
|
||||
|
||||
const PATH_VARIANTS: Variants = {
|
||||
normal: {
|
||||
y: 0,
|
||||
opacity: 1,
|
||||
},
|
||||
animate: (custom: number) => ({
|
||||
y: -3,
|
||||
opacity: [0, 1, 0],
|
||||
transition: {
|
||||
repeat: Infinity,
|
||||
duration: 1.5,
|
||||
ease: 'easeInOut',
|
||||
delay: 0.2 * custom,
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
const CoffeeIcon = forwardRef<CoffeeIconHandle, CoffeeIconProps>(
|
||||
({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {
|
||||
const controls = useAnimation();
|
||||
const isControlledRef = useRef(false);
|
||||
|
||||
useImperativeHandle(ref, () => {
|
||||
isControlledRef.current = true;
|
||||
|
||||
return {
|
||||
startAnimation: () => controls.start('animate'),
|
||||
stopAnimation: () => controls.start('normal'),
|
||||
};
|
||||
});
|
||||
|
||||
const handleMouseEnter = useCallback(
|
||||
(e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!isControlledRef.current) {
|
||||
controls.start('animate');
|
||||
} else {
|
||||
onMouseEnter?.(e);
|
||||
}
|
||||
},
|
||||
[controls, onMouseEnter]
|
||||
);
|
||||
|
||||
const handleMouseLeave = useCallback(
|
||||
(e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!isControlledRef.current) {
|
||||
controls.start('normal');
|
||||
} else {
|
||||
onMouseLeave?.(e);
|
||||
}
|
||||
},
|
||||
[controls, onMouseLeave]
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(className)}
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
{...props}
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
style={{ overflow: 'visible' }}
|
||||
>
|
||||
<motion.path
|
||||
d="M10 2v2"
|
||||
animate={controls}
|
||||
variants={PATH_VARIANTS}
|
||||
custom={0.2}
|
||||
/>
|
||||
<motion.path
|
||||
d="M14 2v2"
|
||||
animate={controls}
|
||||
variants={PATH_VARIANTS}
|
||||
custom={0.4}
|
||||
/>
|
||||
<motion.path
|
||||
d="M6 2v2"
|
||||
animate={controls}
|
||||
variants={PATH_VARIANTS}
|
||||
custom={0}
|
||||
/>
|
||||
<path d="M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1" />
|
||||
</svg>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
CoffeeIcon.displayName = 'CoffeeIcon';
|
||||
|
||||
export { CoffeeIcon };
|
||||
@@ -0,0 +1,149 @@
|
||||
'use client';
|
||||
|
||||
import type { Variants } from 'motion/react';
|
||||
import type { HTMLAttributes } from 'react';
|
||||
import { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';
|
||||
import { motion, useAnimation } from 'motion/react';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
export interface GithubIconHandle {
|
||||
startAnimation: () => void;
|
||||
stopAnimation: () => void;
|
||||
}
|
||||
|
||||
interface GithubIconProps extends HTMLAttributes<HTMLDivElement> {
|
||||
size?: number;
|
||||
}
|
||||
|
||||
const BODY_VARIANTS: Variants = {
|
||||
normal: {
|
||||
opacity: 1,
|
||||
pathLength: 1,
|
||||
scale: 1,
|
||||
transition: {
|
||||
duration: 0.3,
|
||||
},
|
||||
},
|
||||
animate: {
|
||||
opacity: [0, 1],
|
||||
pathLength: [0, 1],
|
||||
scale: [0.9, 1],
|
||||
transition: {
|
||||
duration: 0.4,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const TAIL_VARIANTS: Variants = {
|
||||
normal: {
|
||||
pathLength: 1,
|
||||
rotate: 0,
|
||||
transition: {
|
||||
duration: 0.3,
|
||||
},
|
||||
},
|
||||
draw: {
|
||||
pathLength: [0, 1],
|
||||
rotate: 0,
|
||||
transition: {
|
||||
duration: 0.5,
|
||||
},
|
||||
},
|
||||
wag: {
|
||||
pathLength: 1,
|
||||
rotate: [0, -15, 15, -10, 10, -5, 5],
|
||||
transition: {
|
||||
duration: 2.5,
|
||||
ease: 'easeInOut',
|
||||
repeat: Infinity,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const GithubIcon = forwardRef<GithubIconHandle, GithubIconProps>(
|
||||
({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {
|
||||
const bodyControls = useAnimation();
|
||||
const tailControls = useAnimation();
|
||||
const isControlledRef = useRef(false);
|
||||
|
||||
useImperativeHandle(ref, () => {
|
||||
isControlledRef.current = true;
|
||||
|
||||
return {
|
||||
startAnimation: async () => {
|
||||
bodyControls.start('animate');
|
||||
await tailControls.start('draw');
|
||||
tailControls.start('wag');
|
||||
},
|
||||
stopAnimation: () => {
|
||||
bodyControls.start('normal');
|
||||
tailControls.start('normal');
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
const handleMouseEnter = useCallback(
|
||||
async (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!isControlledRef.current) {
|
||||
bodyControls.start('animate');
|
||||
await tailControls.start('draw');
|
||||
tailControls.start('wag');
|
||||
} else {
|
||||
onMouseEnter?.(e);
|
||||
}
|
||||
},
|
||||
[bodyControls, onMouseEnter, tailControls]
|
||||
);
|
||||
|
||||
const handleMouseLeave = useCallback(
|
||||
(e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!isControlledRef.current) {
|
||||
bodyControls.start('normal');
|
||||
tailControls.start('normal');
|
||||
} else {
|
||||
onMouseLeave?.(e);
|
||||
}
|
||||
},
|
||||
[bodyControls, tailControls, onMouseLeave]
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(className)}
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
{...props}
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
>
|
||||
<motion.path
|
||||
variants={BODY_VARIANTS}
|
||||
initial="normal"
|
||||
animate={bodyControls}
|
||||
d="M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"
|
||||
/>
|
||||
<motion.path
|
||||
variants={TAIL_VARIANTS}
|
||||
initial="normal"
|
||||
animate={tailControls}
|
||||
d="M9 18c-4.51 2-5-2-7-2"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
GithubIcon.displayName = 'GithubIcon';
|
||||
|
||||
export { GithubIcon };
|
||||
@@ -0,0 +1,103 @@
|
||||
'use client';
|
||||
|
||||
import type { Transition, Variants } from 'motion/react';
|
||||
import type { HTMLAttributes } from 'react';
|
||||
import { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';
|
||||
import { motion, useAnimation } from 'motion/react';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
export interface HomeIconHandle {
|
||||
startAnimation: () => void;
|
||||
stopAnimation: () => void;
|
||||
}
|
||||
|
||||
interface HomeIconProps extends HTMLAttributes<HTMLDivElement> {
|
||||
size?: number;
|
||||
}
|
||||
|
||||
const DEFAULT_TRANSITION: Transition = {
|
||||
duration: 0.6,
|
||||
opacity: { duration: 0.2 },
|
||||
};
|
||||
|
||||
const PATH_VARIANTS: Variants = {
|
||||
normal: {
|
||||
pathLength: 1,
|
||||
opacity: 1,
|
||||
},
|
||||
animate: {
|
||||
opacity: [0, 1],
|
||||
pathLength: [0, 1],
|
||||
},
|
||||
};
|
||||
|
||||
const HomeIcon = forwardRef<HomeIconHandle, HomeIconProps>(
|
||||
({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {
|
||||
const controls = useAnimation();
|
||||
const isControlledRef = useRef(false);
|
||||
|
||||
useImperativeHandle(ref, () => {
|
||||
isControlledRef.current = true;
|
||||
|
||||
return {
|
||||
startAnimation: () => controls.start('animate'),
|
||||
stopAnimation: () => controls.start('normal'),
|
||||
};
|
||||
});
|
||||
|
||||
const handleMouseEnter = useCallback(
|
||||
(e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!isControlledRef.current) {
|
||||
controls.start('animate');
|
||||
} else {
|
||||
onMouseEnter?.(e);
|
||||
}
|
||||
},
|
||||
[controls, onMouseEnter]
|
||||
);
|
||||
|
||||
const handleMouseLeave = useCallback(
|
||||
(e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!isControlledRef.current) {
|
||||
controls.start('normal');
|
||||
} else {
|
||||
onMouseLeave?.(e);
|
||||
}
|
||||
},
|
||||
[controls, onMouseLeave]
|
||||
);
|
||||
return (
|
||||
<div
|
||||
className={cn(className)}
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
{...props}
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
>
|
||||
<path d="M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" />
|
||||
<motion.path
|
||||
d="M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8"
|
||||
variants={PATH_VARIANTS}
|
||||
transition={DEFAULT_TRANSITION}
|
||||
animate={controls}
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
HomeIcon.displayName = 'HomeIcon';
|
||||
|
||||
export { HomeIcon };
|
||||
@@ -1,127 +0,0 @@
|
||||
import * as React from "react"
|
||||
import {
|
||||
ChevronLeftIcon,
|
||||
ChevronRightIcon,
|
||||
MoreHorizontalIcon,
|
||||
} from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { Button, buttonVariants } from "@/components/ui/button"
|
||||
|
||||
function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
|
||||
return (
|
||||
<nav
|
||||
role="navigation"
|
||||
aria-label="pagination"
|
||||
data-slot="pagination"
|
||||
className={cn("mx-auto flex w-full justify-center", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function PaginationContent({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<"ul">) {
|
||||
return (
|
||||
<ul
|
||||
data-slot="pagination-content"
|
||||
className={cn("flex flex-row items-center gap-1", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function PaginationItem({ ...props }: React.ComponentProps<"li">) {
|
||||
return <li data-slot="pagination-item" {...props} />
|
||||
}
|
||||
|
||||
type PaginationLinkProps = {
|
||||
isActive?: boolean
|
||||
} & Pick<React.ComponentProps<typeof Button>, "size"> &
|
||||
React.ComponentProps<"a">
|
||||
|
||||
function PaginationLink({
|
||||
className,
|
||||
isActive,
|
||||
size = "icon",
|
||||
...props
|
||||
}: PaginationLinkProps) {
|
||||
return (
|
||||
<a
|
||||
aria-current={isActive ? "page" : undefined}
|
||||
data-slot="pagination-link"
|
||||
data-active={isActive}
|
||||
className={cn(
|
||||
buttonVariants({
|
||||
variant: isActive ? "outline" : "ghost",
|
||||
size,
|
||||
}),
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function PaginationPrevious({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof PaginationLink>) {
|
||||
return (
|
||||
<PaginationLink
|
||||
aria-label="Go to previous page"
|
||||
size="default"
|
||||
className={cn("gap-1 px-2.5 sm:pl-2.5", className)}
|
||||
{...props}
|
||||
>
|
||||
<ChevronLeftIcon />
|
||||
<span className="hidden sm:block">Previous</span>
|
||||
</PaginationLink>
|
||||
)
|
||||
}
|
||||
|
||||
function PaginationNext({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof PaginationLink>) {
|
||||
return (
|
||||
<PaginationLink
|
||||
aria-label="Go to next page"
|
||||
size="default"
|
||||
className={cn("gap-1 px-2.5 sm:pr-2.5", className)}
|
||||
{...props}
|
||||
>
|
||||
<span className="hidden sm:block">Next</span>
|
||||
<ChevronRightIcon />
|
||||
</PaginationLink>
|
||||
)
|
||||
}
|
||||
|
||||
function PaginationEllipsis({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<"span">) {
|
||||
return (
|
||||
<span
|
||||
aria-hidden
|
||||
data-slot="pagination-ellipsis"
|
||||
className={cn("flex size-9 items-center justify-center", className)}
|
||||
{...props}
|
||||
>
|
||||
<MoreHorizontalIcon className="size-4" />
|
||||
<span className="sr-only">More pages</span>
|
||||
</span>
|
||||
)
|
||||
}
|
||||
|
||||
export {
|
||||
Pagination,
|
||||
PaginationContent,
|
||||
PaginationLink,
|
||||
PaginationItem,
|
||||
PaginationPrevious,
|
||||
PaginationNext,
|
||||
PaginationEllipsis,
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
|
||||
import { CircleIcon } from "lucide-react"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
function RadioGroup({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
|
||||
return (
|
||||
<RadioGroupPrimitive.Root
|
||||
data-slot="radio-group"
|
||||
className={cn("grid gap-3", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function RadioGroupItem({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
|
||||
return (
|
||||
<RadioGroupPrimitive.Item
|
||||
data-slot="radio-group-item"
|
||||
className={cn(
|
||||
"border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<RadioGroupPrimitive.Indicator
|
||||
data-slot="radio-group-indicator"
|
||||
className="relative flex items-center justify-center"
|
||||
>
|
||||
<CircleIcon className="fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" />
|
||||
</RadioGroupPrimitive.Indicator>
|
||||
</RadioGroupPrimitive.Item>
|
||||
)
|
||||
}
|
||||
|
||||
export { RadioGroup, RadioGroupItem }
|
||||
@@ -0,0 +1,92 @@
|
||||
'use client';
|
||||
|
||||
import type { HTMLAttributes } from 'react';
|
||||
import { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';
|
||||
import { motion, useAnimation } from 'motion/react';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
export interface SettingsIconHandle {
|
||||
startAnimation: () => void;
|
||||
stopAnimation: () => void;
|
||||
}
|
||||
|
||||
interface SettingsIconProps extends HTMLAttributes<HTMLDivElement> {
|
||||
size?: number;
|
||||
}
|
||||
|
||||
const SettingsIcon = forwardRef<SettingsIconHandle, SettingsIconProps>(
|
||||
({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {
|
||||
const controls = useAnimation();
|
||||
const isControlledRef = useRef(false);
|
||||
|
||||
useImperativeHandle(ref, () => {
|
||||
isControlledRef.current = true;
|
||||
|
||||
return {
|
||||
startAnimation: () => controls.start('animate'),
|
||||
stopAnimation: () => controls.start('normal'),
|
||||
};
|
||||
});
|
||||
|
||||
const handleMouseEnter = useCallback(
|
||||
(e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!isControlledRef.current) {
|
||||
controls.start('animate');
|
||||
} else {
|
||||
onMouseEnter?.(e);
|
||||
}
|
||||
},
|
||||
[controls, onMouseEnter]
|
||||
);
|
||||
|
||||
const handleMouseLeave = useCallback(
|
||||
(e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!isControlledRef.current) {
|
||||
controls.start('normal');
|
||||
} else {
|
||||
onMouseLeave?.(e);
|
||||
}
|
||||
},
|
||||
[controls, onMouseLeave]
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(className)}
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
{...props}
|
||||
>
|
||||
<motion.svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
transition={{ type: 'spring', stiffness: 50, damping: 10 }}
|
||||
variants={{
|
||||
normal: {
|
||||
rotate: 0,
|
||||
},
|
||||
animate: {
|
||||
rotate: 180,
|
||||
},
|
||||
}}
|
||||
animate={controls}
|
||||
>
|
||||
<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" />
|
||||
<circle cx="12" cy="12" r="3" />
|
||||
</motion.svg>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
SettingsIcon.displayName = 'SettingsIcon';
|
||||
|
||||
export { SettingsIcon };
|
||||
@@ -0,0 +1,103 @@
|
||||
'use client';
|
||||
|
||||
import type { Variants } from 'motion/react';
|
||||
import type { HTMLAttributes } from 'react';
|
||||
import { forwardRef, useCallback, useImperativeHandle, useRef } from 'react';
|
||||
import { motion, useAnimation } from 'motion/react';
|
||||
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
export interface TerminalIconHandle {
|
||||
startAnimation: () => void;
|
||||
stopAnimation: () => void;
|
||||
}
|
||||
|
||||
interface TerminalIconProps extends HTMLAttributes<HTMLDivElement> {
|
||||
size?: number;
|
||||
}
|
||||
|
||||
const LINE_VARIANTS: Variants = {
|
||||
normal: { opacity: 1 },
|
||||
animate: {
|
||||
opacity: [1, 0, 1],
|
||||
transition: {
|
||||
duration: 0.8,
|
||||
repeat: Infinity,
|
||||
ease: 'linear',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const TerminalIcon = forwardRef<TerminalIconHandle, TerminalIconProps>(
|
||||
({ onMouseEnter, onMouseLeave, className, size = 28, ...props }, ref) => {
|
||||
const controls = useAnimation();
|
||||
const isControlledRef = useRef(false);
|
||||
|
||||
useImperativeHandle(ref, () => {
|
||||
isControlledRef.current = true;
|
||||
|
||||
return {
|
||||
startAnimation: () => controls.start('animate'),
|
||||
stopAnimation: () => controls.start('normal'),
|
||||
};
|
||||
});
|
||||
|
||||
const handleMouseEnter = useCallback(
|
||||
(e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!isControlledRef.current) {
|
||||
controls.start('animate');
|
||||
} else {
|
||||
onMouseEnter?.(e);
|
||||
}
|
||||
},
|
||||
[controls, onMouseEnter]
|
||||
);
|
||||
|
||||
const handleMouseLeave = useCallback(
|
||||
(e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if (!isControlledRef.current) {
|
||||
controls.start('normal');
|
||||
} else {
|
||||
onMouseLeave?.(e);
|
||||
}
|
||||
},
|
||||
[controls, onMouseLeave]
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={cn(className)}
|
||||
onMouseEnter={handleMouseEnter}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
{...props}
|
||||
>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
strokeWidth="2"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
>
|
||||
<polyline points="4 17 10 11 4 5" />
|
||||
<motion.line
|
||||
x1="12"
|
||||
x2="20"
|
||||
y1="19"
|
||||
y2="19"
|
||||
variants={LINE_VARIANTS}
|
||||
animate={controls}
|
||||
initial="normal"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
TerminalIcon.displayName = 'TerminalIcon';
|
||||
|
||||
export { TerminalIcon };
|
||||
+48
-44
@@ -26,19 +26,6 @@
|
||||
--color-border: var(--border);
|
||||
--color-input: var(--input);
|
||||
--color-ring: var(--ring);
|
||||
--color-chart-1: var(--chart-1);
|
||||
--color-chart-2: var(--chart-2);
|
||||
--color-chart-3: var(--chart-3);
|
||||
--color-chart-4: var(--chart-4);
|
||||
--color-chart-5: var(--chart-5);
|
||||
--color-sidebar: var(--sidebar);
|
||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||
--color-sidebar-primary: var(--sidebar-primary);
|
||||
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||
--color-sidebar-accent: var(--sidebar-accent);
|
||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
}
|
||||
|
||||
:root {
|
||||
@@ -61,19 +48,6 @@
|
||||
--border: oklch(0.922 0 0);
|
||||
--input: oklch(0.922 0 0);
|
||||
--ring: oklch(0.708 0 0);
|
||||
--chart-1: oklch(0.646 0.222 41.116);
|
||||
--chart-2: oklch(0.6 0.118 184.704);
|
||||
--chart-3: oklch(0.398 0.07 227.392);
|
||||
--chart-4: oklch(0.828 0.189 84.429);
|
||||
--chart-5: oklch(0.769 0.188 70.08);
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.145 0 0);
|
||||
--sidebar-primary: oklch(0.205 0 0);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.97 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||
--sidebar-border: oklch(0.922 0 0);
|
||||
--sidebar-ring: oklch(0.708 0 0);
|
||||
}
|
||||
|
||||
.dark {
|
||||
@@ -95,19 +69,6 @@
|
||||
--border: oklch(1 0 0 / 10%);
|
||||
--input: oklch(1 0 0 / 15%);
|
||||
--ring: oklch(0.556 0 0);
|
||||
--chart-1: oklch(0.488 0.243 264.376);
|
||||
--chart-2: oklch(0.696 0.17 162.48);
|
||||
--chart-3: oklch(0.769 0.188 70.08);
|
||||
--chart-4: oklch(0.627 0.265 303.9);
|
||||
--chart-5: oklch(0.645 0.246 16.439);
|
||||
--sidebar: oklch(0.205 0 0);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.269 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(1 0 0 / 10%);
|
||||
--sidebar-ring: oklch(0.556 0 0);
|
||||
}
|
||||
|
||||
@layer base {
|
||||
@@ -164,6 +125,54 @@
|
||||
@apply text-blue-600;
|
||||
}
|
||||
|
||||
/* Ensure description text uses same color as title */
|
||||
[data-sonner-toast] [data-description],
|
||||
[data-sonner-toast] [data-description] * {
|
||||
opacity: 1 !important;
|
||||
}
|
||||
|
||||
/* Specific color for each toast type - match icon color */
|
||||
[data-sonner-toast][data-type="success"] [data-description],
|
||||
[data-sonner-toast][data-type="success"] [data-description] * {
|
||||
color: rgb(22 163 74) !important; /* green-600 - same as icon */
|
||||
}
|
||||
|
||||
[data-sonner-toast][data-type="error"] [data-description],
|
||||
[data-sonner-toast][data-type="error"] [data-description] * {
|
||||
color: rgb(220 38 38) !important; /* red-600 - same as icon */
|
||||
}
|
||||
|
||||
[data-sonner-toast][data-type="warning"] [data-description],
|
||||
[data-sonner-toast][data-type="warning"] [data-description] * {
|
||||
color: rgb(202 138 4) !important; /* yellow-600 - same as icon */
|
||||
}
|
||||
|
||||
[data-sonner-toast][data-type="info"] [data-description],
|
||||
[data-sonner-toast][data-type="info"] [data-description] * {
|
||||
color: rgb(37 99 235) !important; /* blue-600 - same as icon */
|
||||
}
|
||||
|
||||
/* Dark mode - use same icon colors */
|
||||
.dark [data-sonner-toast][data-type="success"] [data-description],
|
||||
.dark [data-sonner-toast][data-type="success"] [data-description] * {
|
||||
color: rgb(22 163 74) !important; /* green-600 */
|
||||
}
|
||||
|
||||
.dark [data-sonner-toast][data-type="error"] [data-description],
|
||||
.dark [data-sonner-toast][data-type="error"] [data-description] * {
|
||||
color: rgb(220 38 38) !important; /* red-600 */
|
||||
}
|
||||
|
||||
.dark [data-sonner-toast][data-type="warning"] [data-description],
|
||||
.dark [data-sonner-toast][data-type="warning"] [data-description] * {
|
||||
color: rgb(202 138 4) !important; /* yellow-600 */
|
||||
}
|
||||
|
||||
.dark [data-sonner-toast][data-type="info"] [data-description],
|
||||
.dark [data-sonner-toast][data-type="info"] [data-description] * {
|
||||
color: rgb(37 99 235) !important; /* blue-600 */
|
||||
}
|
||||
|
||||
/* Dark mode toast styling */
|
||||
.dark [data-sonner-toast][data-type="success"] {
|
||||
@apply bg-green-950 border-green-800 text-green-100;
|
||||
@@ -244,8 +253,3 @@
|
||||
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
|
||||
filter: brightness(1.2);
|
||||
}
|
||||
|
||||
/* Date input styling for dark mode */
|
||||
.dark input[type="date"]::-webkit-calendar-picker-indicator {
|
||||
filter: invert(1);
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
import { GetDefaults } from "../../wailsjs/go/main/App";
|
||||
|
||||
export type FontFamily = "google-sans" | "inter" | "poppins" | "roboto" | "dm-sans" | "plus-jakarta-sans" | "manrope" | "space-grotesk";
|
||||
export type FontFamily = "google-sans" | "inter" | "poppins" | "roboto" | "dm-sans" | "plus-jakarta-sans" | "manrope" | "space-grotesk" | "noto-sans" | "nunito-sans" | "figtree" | "raleway" | "public-sans" | "outfit" | "jetbrains-mono" | "geist-sans";
|
||||
export type GifQuality = "fast" | "better";
|
||||
export type GifResolution = "original" | "high" | "medium" | "low";
|
||||
export type FetchMode = "single" | "batch";
|
||||
export type MediaType = "all" | "image" | "video" | "gif" | "text";
|
||||
|
||||
export interface Settings {
|
||||
downloadPath: string;
|
||||
@@ -14,6 +16,9 @@ export interface Settings {
|
||||
gifResolution: GifResolution;
|
||||
proxy: string; // Proxy URL (e.g., http://proxy:port or socks5://proxy:port). Empty to use system proxy or no proxy.
|
||||
fetchTimeout: number; // Fetch timeout in seconds. Default: 60 seconds.
|
||||
fetchMode: FetchMode; // Fetch mode: single (all at once) or batch (200 per request). Default: batch.
|
||||
mediaType: MediaType; // Media type filter. Default: all.
|
||||
includeRetweets: boolean; // Include retweets in fetch. Default: false.
|
||||
}
|
||||
|
||||
export const DEFAULT_SETTINGS: Settings = {
|
||||
@@ -23,19 +28,30 @@ export const DEFAULT_SETTINGS: Settings = {
|
||||
fontFamily: "google-sans",
|
||||
sfxEnabled: true,
|
||||
gifQuality: "fast",
|
||||
gifResolution: "high",
|
||||
gifResolution: "original",
|
||||
proxy: "",
|
||||
fetchTimeout: 60, // Default: 60 seconds
|
||||
fetchMode: "batch", // Default: batch mode (200 per request)
|
||||
mediaType: "all", // Default: all media
|
||||
includeRetweets: false, // Default: don't include retweets
|
||||
};
|
||||
|
||||
export const FONT_OPTIONS: { value: FontFamily; label: string; fontFamily: string }[] = [
|
||||
{ value: "dm-sans", label: "DM Sans", fontFamily: '"DM Sans", system-ui, sans-serif' },
|
||||
{ value: "figtree", label: "Figtree", fontFamily: '"Figtree", system-ui, sans-serif' },
|
||||
{ value: "geist-sans", label: "Geist Sans", fontFamily: '"Geist", system-ui, sans-serif' },
|
||||
{ value: "google-sans", label: "Google Sans Flex", fontFamily: '"Google Sans Flex", system-ui, sans-serif' },
|
||||
{ value: "inter", label: "Inter", fontFamily: '"Inter", system-ui, sans-serif' },
|
||||
{ value: "poppins", label: "Poppins", fontFamily: '"Poppins", system-ui, sans-serif' },
|
||||
{ value: "roboto", label: "Roboto", fontFamily: '"Roboto", system-ui, sans-serif' },
|
||||
{ value: "dm-sans", label: "DM Sans", fontFamily: '"DM Sans", system-ui, sans-serif' },
|
||||
{ value: "plus-jakarta-sans", label: "Plus Jakarta Sans", fontFamily: '"Plus Jakarta Sans", system-ui, sans-serif' },
|
||||
{ value: "jetbrains-mono", label: "JetBrains Mono", fontFamily: '"JetBrains Mono", ui-monospace, monospace' },
|
||||
{ value: "manrope", label: "Manrope", fontFamily: '"Manrope", system-ui, sans-serif' },
|
||||
{ value: "noto-sans", label: "Noto Sans", fontFamily: '"Noto Sans", system-ui, sans-serif' },
|
||||
{ value: "nunito-sans", label: "Nunito Sans", fontFamily: '"Nunito Sans", system-ui, sans-serif' },
|
||||
{ value: "outfit", label: "Outfit", fontFamily: '"Outfit", system-ui, sans-serif' },
|
||||
{ value: "plus-jakarta-sans", label: "Plus Jakarta Sans", fontFamily: '"Plus Jakarta Sans", system-ui, sans-serif' },
|
||||
{ value: "poppins", label: "Poppins", fontFamily: '"Poppins", system-ui, sans-serif' },
|
||||
{ value: "public-sans", label: "Public Sans", fontFamily: '"Public Sans", system-ui, sans-serif' },
|
||||
{ value: "raleway", label: "Raleway", fontFamily: '"Raleway", system-ui, sans-serif' },
|
||||
{ value: "roboto", label: "Roboto", fontFamily: '"Roboto", system-ui, sans-serif' },
|
||||
{ value: "space-grotesk", label: "Space Grotesk", fontFamily: '"Space Grotesk", system-ui, sans-serif' },
|
||||
];
|
||||
|
||||
|
||||
+269
-449
@@ -7,456 +7,276 @@ export interface Theme {
|
||||
};
|
||||
}
|
||||
|
||||
// Base colors yang sama untuk semua tema (kecuali primary dan primary-foreground)
|
||||
const baseLightColors: Record<string, string> = {
|
||||
background: "oklch(1 0 0)",
|
||||
foreground: "oklch(0.145 0 0)",
|
||||
card: "oklch(1 0 0)",
|
||||
"card-foreground": "oklch(0.145 0 0)",
|
||||
popover: "oklch(1 0 0)",
|
||||
"popover-foreground": "oklch(0.145 0 0)",
|
||||
secondary: "oklch(0.967 0.001 286.375)",
|
||||
"secondary-foreground": "oklch(0.21 0.006 285.885)",
|
||||
muted: "oklch(0.97 0 0)",
|
||||
"muted-foreground": "oklch(0.556 0 0)",
|
||||
accent: "oklch(0.97 0 0)",
|
||||
"accent-foreground": "oklch(0.205 0 0)",
|
||||
destructive: "oklch(0.58 0.22 27)",
|
||||
border: "oklch(0.922 0 0)",
|
||||
input: "oklch(0.922 0 0)",
|
||||
ring: "oklch(0.708 0 0)",
|
||||
};
|
||||
|
||||
const baseDarkColors: Record<string, string> = {
|
||||
background: "oklch(0.145 0 0)",
|
||||
foreground: "oklch(0.985 0 0)",
|
||||
card: "oklch(0.205 0 0)",
|
||||
"card-foreground": "oklch(0.985 0 0)",
|
||||
popover: "oklch(0.205 0 0)",
|
||||
"popover-foreground": "oklch(0.985 0 0)",
|
||||
secondary: "oklch(0.274 0.006 286.033)",
|
||||
"secondary-foreground": "oklch(0.985 0 0)",
|
||||
muted: "oklch(0.269 0 0)",
|
||||
"muted-foreground": "oklch(0.708 0 0)",
|
||||
accent: "oklch(0.371 0 0)",
|
||||
"accent-foreground": "oklch(0.985 0 0)",
|
||||
destructive: "oklch(0.704 0.191 22.216)",
|
||||
border: "oklch(1 0 0 / 10%)",
|
||||
input: "oklch(1 0 0 / 15%)",
|
||||
ring: "oklch(0.556 0 0)",
|
||||
};
|
||||
|
||||
// Primary colors yang berbeda untuk setiap tema
|
||||
interface PrimaryColors {
|
||||
light: {
|
||||
primary: string;
|
||||
"primary-foreground": string;
|
||||
};
|
||||
dark: {
|
||||
primary: string;
|
||||
"primary-foreground": string;
|
||||
};
|
||||
}
|
||||
|
||||
const primaryColors: Record<string, PrimaryColors> = {
|
||||
amber: {
|
||||
light: {
|
||||
primary: "oklch(0.67 0.16 58)",
|
||||
"primary-foreground": "oklch(0.99 0.02 95)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.77 0.16 70)",
|
||||
"primary-foreground": "oklch(0.28 0.07 46)",
|
||||
},
|
||||
},
|
||||
blue: {
|
||||
light: {
|
||||
primary: "oklch(0.488 0.243 264.376)",
|
||||
"primary-foreground": "oklch(0.97 0.014 254.604)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.42 0.18 266)",
|
||||
"primary-foreground": "oklch(0.97 0.014 254.604)",
|
||||
},
|
||||
},
|
||||
cyan: {
|
||||
light: {
|
||||
primary: "oklch(0.61 0.11 222)",
|
||||
"primary-foreground": "oklch(0.98 0.02 201)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.71 0.13 215)",
|
||||
"primary-foreground": "oklch(0.30 0.05 230)",
|
||||
},
|
||||
},
|
||||
emerald: {
|
||||
light: {
|
||||
primary: "oklch(0.60 0.13 163)",
|
||||
"primary-foreground": "oklch(0.98 0.02 166)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.70 0.15 162)",
|
||||
"primary-foreground": "oklch(0.26 0.05 173)",
|
||||
},
|
||||
},
|
||||
fuchsia: {
|
||||
light: {
|
||||
primary: "oklch(0.59 0.26 323)",
|
||||
"primary-foreground": "oklch(0.98 0.02 320)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.67 0.26 322)",
|
||||
"primary-foreground": "oklch(0.98 0.02 320)",
|
||||
},
|
||||
},
|
||||
green: {
|
||||
light: {
|
||||
primary: "oklch(0.648 0.2 131.684)",
|
||||
"primary-foreground": "oklch(0.986 0.031 120.757)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.648 0.2 131.684)",
|
||||
"primary-foreground": "oklch(0.986 0.031 120.757)",
|
||||
},
|
||||
},
|
||||
indigo: {
|
||||
light: {
|
||||
primary: "oklch(0.51 0.23 277)",
|
||||
"primary-foreground": "oklch(0.96 0.02 272)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.59 0.20 277)",
|
||||
"primary-foreground": "oklch(0.96 0.02 272)",
|
||||
},
|
||||
},
|
||||
lime: {
|
||||
light: {
|
||||
primary: "oklch(0.65 0.18 132)",
|
||||
"primary-foreground": "oklch(0.99 0.03 121)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.77 0.20 131)",
|
||||
"primary-foreground": "oklch(0.27 0.07 132)",
|
||||
},
|
||||
},
|
||||
neutral: {
|
||||
light: {
|
||||
primary: "oklch(0.205 0 0)",
|
||||
"primary-foreground": "oklch(0.985 0 0)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.922 0 0)",
|
||||
"primary-foreground": "oklch(0.205 0 0)",
|
||||
},
|
||||
},
|
||||
orange: {
|
||||
light: {
|
||||
primary: "oklch(0.646 0.222 41.116)",
|
||||
"primary-foreground": "oklch(0.98 0.016 73.684)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.705 0.213 47.604)",
|
||||
"primary-foreground": "oklch(0.98 0.016 73.684)",
|
||||
},
|
||||
},
|
||||
pink: {
|
||||
light: {
|
||||
primary: "oklch(0.59 0.22 1)",
|
||||
"primary-foreground": "oklch(0.97 0.01 343)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.66 0.21 354)",
|
||||
"primary-foreground": "oklch(0.97 0.01 343)",
|
||||
},
|
||||
},
|
||||
purple: {
|
||||
light: {
|
||||
primary: "oklch(0.56 0.25 302)",
|
||||
"primary-foreground": "oklch(0.98 0.01 308)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.63 0.23 304)",
|
||||
"primary-foreground": "oklch(0.98 0.01 308)",
|
||||
},
|
||||
},
|
||||
red: {
|
||||
light: {
|
||||
primary: "oklch(0.577 0.245 27.325)",
|
||||
"primary-foreground": "oklch(0.971 0.013 17.38)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.637 0.237 25.331)",
|
||||
"primary-foreground": "oklch(0.971 0.013 17.38)",
|
||||
},
|
||||
},
|
||||
rose: {
|
||||
light: {
|
||||
primary: "oklch(0.586 0.253 17.585)",
|
||||
"primary-foreground": "oklch(0.969 0.015 12.422)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.645 0.246 16.439)",
|
||||
"primary-foreground": "oklch(0.969 0.015 12.422)",
|
||||
},
|
||||
},
|
||||
sky: {
|
||||
light: {
|
||||
primary: "oklch(0.59 0.14 242)",
|
||||
"primary-foreground": "oklch(0.98 0.01 237)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.68 0.15 237)",
|
||||
"primary-foreground": "oklch(0.29 0.06 243)",
|
||||
},
|
||||
},
|
||||
teal: {
|
||||
light: {
|
||||
primary: "oklch(0.60 0.10 185)",
|
||||
"primary-foreground": "oklch(0.98 0.01 181)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.70 0.12 183)",
|
||||
"primary-foreground": "oklch(0.28 0.04 193)",
|
||||
},
|
||||
},
|
||||
violet: {
|
||||
light: {
|
||||
primary: "oklch(0.541 0.281 293.009)",
|
||||
"primary-foreground": "oklch(0.969 0.016 293.756)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.606 0.25 292.717)",
|
||||
"primary-foreground": "oklch(0.969 0.016 293.756)",
|
||||
},
|
||||
},
|
||||
yellow: {
|
||||
light: {
|
||||
primary: "oklch(0.852 0.199 91.936)",
|
||||
"primary-foreground": "oklch(0.421 0.095 57.708)",
|
||||
},
|
||||
dark: {
|
||||
primary: "oklch(0.795 0.184 86.047)",
|
||||
"primary-foreground": "oklch(0.421 0.095 57.708)",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// Helper function untuk menggabungkan base colors dengan primary colors
|
||||
function createTheme(
|
||||
name: string,
|
||||
label: string,
|
||||
primary: PrimaryColors
|
||||
): Theme {
|
||||
return {
|
||||
name,
|
||||
label,
|
||||
cssVars: {
|
||||
light: { ...baseLightColors, ...primary.light },
|
||||
dark: { ...baseDarkColors, ...primary.dark },
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export const themes: Theme[] = [
|
||||
{
|
||||
name: "neutral",
|
||||
label: "Default",
|
||||
cssVars: {
|
||||
light: {
|
||||
background: "oklch(1 0 0)",
|
||||
foreground: "oklch(0.145 0 0)",
|
||||
card: "oklch(1 0 0)",
|
||||
"card-foreground": "oklch(0.145 0 0)",
|
||||
popover: "oklch(1 0 0)",
|
||||
"popover-foreground": "oklch(0.145 0 0)",
|
||||
primary: "oklch(0.205 0 0)",
|
||||
"primary-foreground": "oklch(0.985 0 0)",
|
||||
secondary: "oklch(0.97 0 0)",
|
||||
"secondary-foreground": "oklch(0.205 0 0)",
|
||||
muted: "oklch(0.97 0 0)",
|
||||
"muted-foreground": "oklch(0.556 0 0)",
|
||||
accent: "oklch(0.97 0 0)",
|
||||
"accent-foreground": "oklch(0.205 0 0)",
|
||||
destructive: "oklch(0.577 0.245 27.325)",
|
||||
border: "oklch(0.922 0 0)",
|
||||
input: "oklch(0.922 0 0)",
|
||||
ring: "oklch(0.708 0 0)",
|
||||
"chart-1": "oklch(0.646 0.222 41.116)",
|
||||
"chart-2": "oklch(0.6 0.118 184.704)",
|
||||
"chart-3": "oklch(0.398 0.07 227.392)",
|
||||
"chart-4": "oklch(0.828 0.189 84.429)",
|
||||
"chart-5": "oklch(0.769 0.188 70.08)",
|
||||
},
|
||||
dark: {
|
||||
background: "oklch(0.145 0 0)",
|
||||
foreground: "oklch(0.985 0 0)",
|
||||
card: "oklch(0.205 0 0)",
|
||||
"card-foreground": "oklch(0.985 0 0)",
|
||||
popover: "oklch(0.205 0 0)",
|
||||
"popover-foreground": "oklch(0.985 0 0)",
|
||||
primary: "oklch(0.922 0 0)",
|
||||
"primary-foreground": "oklch(0.205 0 0)",
|
||||
secondary: "oklch(0.269 0 0)",
|
||||
"secondary-foreground": "oklch(0.985 0 0)",
|
||||
muted: "oklch(0.269 0 0)",
|
||||
"muted-foreground": "oklch(0.708 0 0)",
|
||||
accent: "oklch(0.269 0 0)",
|
||||
"accent-foreground": "oklch(0.985 0 0)",
|
||||
destructive: "oklch(0.704 0.191 22.216)",
|
||||
border: "oklch(1 0 0 / 10%)",
|
||||
input: "oklch(1 0 0 / 15%)",
|
||||
ring: "oklch(0.556 0 0)",
|
||||
"chart-1": "oklch(0.488 0.243 264.376)",
|
||||
"chart-2": "oklch(0.696 0.17 162.48)",
|
||||
"chart-3": "oklch(0.769 0.188 70.08)",
|
||||
"chart-4": "oklch(0.627 0.265 303.9)",
|
||||
"chart-5": "oklch(0.645 0.246 16.439)",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "blue",
|
||||
label: "Blue",
|
||||
cssVars: {
|
||||
light: {
|
||||
background: "oklch(1 0 0)",
|
||||
foreground: "oklch(0.141 0.005 285.823)",
|
||||
card: "oklch(1 0 0)",
|
||||
"card-foreground": "oklch(0.141 0.005 285.823)",
|
||||
popover: "oklch(1 0 0)",
|
||||
"popover-foreground": "oklch(0.141 0.005 285.823)",
|
||||
primary: "oklch(0.488 0.243 264.376)",
|
||||
"primary-foreground": "oklch(0.97 0.014 254.604)",
|
||||
secondary: "oklch(0.967 0.001 286.375)",
|
||||
"secondary-foreground": "oklch(0.21 0.006 285.885)",
|
||||
muted: "oklch(0.967 0.001 286.375)",
|
||||
"muted-foreground": "oklch(0.552 0.016 285.938)",
|
||||
accent: "oklch(0.967 0.001 286.375)",
|
||||
"accent-foreground": "oklch(0.21 0.006 285.885)",
|
||||
destructive: "oklch(0.577 0.245 27.325)",
|
||||
border: "oklch(0.92 0.004 286.32)",
|
||||
input: "oklch(0.92 0.004 286.32)",
|
||||
ring: "oklch(0.708 0 0)",
|
||||
"chart-1": "oklch(0.809 0.105 251.813)",
|
||||
"chart-2": "oklch(0.623 0.214 259.815)",
|
||||
"chart-3": "oklch(0.546 0.245 262.881)",
|
||||
"chart-4": "oklch(0.488 0.243 264.376)",
|
||||
"chart-5": "oklch(0.424 0.199 265.638)",
|
||||
},
|
||||
dark: {
|
||||
background: "oklch(0.141 0.005 285.823)",
|
||||
foreground: "oklch(0.985 0 0)",
|
||||
card: "oklch(0.21 0.006 285.885)",
|
||||
"card-foreground": "oklch(0.985 0 0)",
|
||||
popover: "oklch(0.21 0.006 285.885)",
|
||||
"popover-foreground": "oklch(0.985 0 0)",
|
||||
primary: "oklch(0.488 0.243 264.376)",
|
||||
"primary-foreground": "oklch(0.97 0.014 254.604)",
|
||||
secondary: "oklch(0.274 0.006 286.033)",
|
||||
"secondary-foreground": "oklch(0.985 0 0)",
|
||||
muted: "oklch(0.274 0.006 286.033)",
|
||||
"muted-foreground": "oklch(0.705 0.015 286.067)",
|
||||
accent: "oklch(0.274 0.006 286.033)",
|
||||
"accent-foreground": "oklch(0.985 0 0)",
|
||||
destructive: "oklch(0.704 0.191 22.216)",
|
||||
border: "oklch(1 0 0 / 10%)",
|
||||
input: "oklch(1 0 0 / 15%)",
|
||||
ring: "oklch(0.556 0 0)",
|
||||
"chart-1": "oklch(0.809 0.105 251.813)",
|
||||
"chart-2": "oklch(0.623 0.214 259.815)",
|
||||
"chart-3": "oklch(0.546 0.245 262.881)",
|
||||
"chart-4": "oklch(0.488 0.243 264.376)",
|
||||
"chart-5": "oklch(0.424 0.199 265.638)",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "green",
|
||||
label: "Green",
|
||||
cssVars: {
|
||||
light: {
|
||||
background: "oklch(1 0 0)",
|
||||
foreground: "oklch(0.141 0.005 285.823)",
|
||||
card: "oklch(1 0 0)",
|
||||
"card-foreground": "oklch(0.141 0.005 285.823)",
|
||||
popover: "oklch(1 0 0)",
|
||||
"popover-foreground": "oklch(0.141 0.005 285.823)",
|
||||
primary: "oklch(0.648 0.2 131.684)",
|
||||
"primary-foreground": "oklch(0.986 0.031 120.757)",
|
||||
secondary: "oklch(0.967 0.001 286.375)",
|
||||
"secondary-foreground": "oklch(0.21 0.006 285.885)",
|
||||
muted: "oklch(0.967 0.001 286.375)",
|
||||
"muted-foreground": "oklch(0.552 0.016 285.938)",
|
||||
accent: "oklch(0.967 0.001 286.375)",
|
||||
"accent-foreground": "oklch(0.21 0.006 285.885)",
|
||||
destructive: "oklch(0.577 0.245 27.325)",
|
||||
border: "oklch(0.92 0.004 286.32)",
|
||||
input: "oklch(0.92 0.004 286.32)",
|
||||
ring: "oklch(0.841 0.238 128.85)",
|
||||
"chart-1": "oklch(0.871 0.15 154.449)",
|
||||
"chart-2": "oklch(0.723 0.219 149.579)",
|
||||
"chart-3": "oklch(0.627 0.194 149.214)",
|
||||
"chart-4": "oklch(0.527 0.154 150.069)",
|
||||
"chart-5": "oklch(0.448 0.119 151.328)",
|
||||
},
|
||||
dark: {
|
||||
background: "oklch(0.141 0.005 285.823)",
|
||||
foreground: "oklch(0.985 0 0)",
|
||||
card: "oklch(0.21 0.006 285.885)",
|
||||
"card-foreground": "oklch(0.985 0 0)",
|
||||
popover: "oklch(0.21 0.006 285.885)",
|
||||
"popover-foreground": "oklch(0.985 0 0)",
|
||||
primary: "oklch(0.648 0.2 131.684)",
|
||||
"primary-foreground": "oklch(0.986 0.031 120.757)",
|
||||
secondary: "oklch(0.274 0.006 286.033)",
|
||||
"secondary-foreground": "oklch(0.985 0 0)",
|
||||
muted: "oklch(0.274 0.006 286.033)",
|
||||
"muted-foreground": "oklch(0.705 0.015 286.067)",
|
||||
accent: "oklch(0.274 0.006 286.033)",
|
||||
"accent-foreground": "oklch(0.985 0 0)",
|
||||
destructive: "oklch(0.704 0.191 22.216)",
|
||||
border: "oklch(1 0 0 / 10%)",
|
||||
input: "oklch(1 0 0 / 15%)",
|
||||
ring: "oklch(0.405 0.101 131.063)",
|
||||
"chart-1": "oklch(0.871 0.15 154.449)",
|
||||
"chart-2": "oklch(0.723 0.219 149.579)",
|
||||
"chart-3": "oklch(0.627 0.194 149.214)",
|
||||
"chart-4": "oklch(0.527 0.154 150.069)",
|
||||
"chart-5": "oklch(0.448 0.119 151.328)",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "orange",
|
||||
label: "Orange",
|
||||
cssVars: {
|
||||
light: {
|
||||
background: "oklch(1 0 0)",
|
||||
foreground: "oklch(0.141 0.005 285.823)",
|
||||
card: "oklch(1 0 0)",
|
||||
"card-foreground": "oklch(0.141 0.005 285.823)",
|
||||
popover: "oklch(1 0 0)",
|
||||
"popover-foreground": "oklch(0.141 0.005 285.823)",
|
||||
primary: "oklch(0.646 0.222 41.116)",
|
||||
"primary-foreground": "oklch(0.98 0.016 73.684)",
|
||||
secondary: "oklch(0.967 0.001 286.375)",
|
||||
"secondary-foreground": "oklch(0.21 0.006 285.885)",
|
||||
muted: "oklch(0.967 0.001 286.375)",
|
||||
"muted-foreground": "oklch(0.552 0.016 285.938)",
|
||||
accent: "oklch(0.967 0.001 286.375)",
|
||||
"accent-foreground": "oklch(0.21 0.006 285.885)",
|
||||
destructive: "oklch(0.577 0.245 27.325)",
|
||||
border: "oklch(0.92 0.004 286.32)",
|
||||
input: "oklch(0.92 0.004 286.32)",
|
||||
ring: "oklch(0.75 0.183 55.934)",
|
||||
"chart-1": "oklch(0.837 0.128 66.29)",
|
||||
"chart-2": "oklch(0.705 0.213 47.604)",
|
||||
"chart-3": "oklch(0.646 0.222 41.116)",
|
||||
"chart-4": "oklch(0.553 0.195 38.402)",
|
||||
"chart-5": "oklch(0.47 0.157 37.304)",
|
||||
},
|
||||
dark: {
|
||||
background: "oklch(0.141 0.005 285.823)",
|
||||
foreground: "oklch(0.985 0 0)",
|
||||
card: "oklch(0.21 0.006 285.885)",
|
||||
"card-foreground": "oklch(0.985 0 0)",
|
||||
popover: "oklch(0.21 0.006 285.885)",
|
||||
"popover-foreground": "oklch(0.985 0 0)",
|
||||
primary: "oklch(0.705 0.213 47.604)",
|
||||
"primary-foreground": "oklch(0.98 0.016 73.684)",
|
||||
secondary: "oklch(0.274 0.006 286.033)",
|
||||
"secondary-foreground": "oklch(0.985 0 0)",
|
||||
muted: "oklch(0.274 0.006 286.033)",
|
||||
"muted-foreground": "oklch(0.705 0.015 286.067)",
|
||||
accent: "oklch(0.274 0.006 286.033)",
|
||||
"accent-foreground": "oklch(0.985 0 0)",
|
||||
destructive: "oklch(0.704 0.191 22.216)",
|
||||
border: "oklch(1 0 0 / 10%)",
|
||||
input: "oklch(1 0 0 / 15%)",
|
||||
ring: "oklch(0.408 0.123 38.172)",
|
||||
"chart-1": "oklch(0.837 0.128 66.29)",
|
||||
"chart-2": "oklch(0.705 0.213 47.604)",
|
||||
"chart-3": "oklch(0.646 0.222 41.116)",
|
||||
"chart-4": "oklch(0.553 0.195 38.402)",
|
||||
"chart-5": "oklch(0.47 0.157 37.304)",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "red",
|
||||
label: "Red",
|
||||
cssVars: {
|
||||
light: {
|
||||
background: "oklch(1 0 0)",
|
||||
foreground: "oklch(0.141 0.005 285.823)",
|
||||
card: "oklch(1 0 0)",
|
||||
"card-foreground": "oklch(0.141 0.005 285.823)",
|
||||
popover: "oklch(1 0 0)",
|
||||
"popover-foreground": "oklch(0.141 0.005 285.823)",
|
||||
primary: "oklch(0.577 0.245 27.325)",
|
||||
"primary-foreground": "oklch(0.971 0.013 17.38)",
|
||||
secondary: "oklch(0.967 0.001 286.375)",
|
||||
"secondary-foreground": "oklch(0.21 0.006 285.885)",
|
||||
muted: "oklch(0.967 0.001 286.375)",
|
||||
"muted-foreground": "oklch(0.552 0.016 285.938)",
|
||||
accent: "oklch(0.967 0.001 286.375)",
|
||||
"accent-foreground": "oklch(0.21 0.006 285.885)",
|
||||
destructive: "oklch(0.577 0.245 27.325)",
|
||||
border: "oklch(0.92 0.004 286.32)",
|
||||
input: "oklch(0.92 0.004 286.32)",
|
||||
ring: "oklch(0.704 0.191 22.216)",
|
||||
"chart-1": "oklch(0.808 0.114 19.571)",
|
||||
"chart-2": "oklch(0.637 0.237 25.331)",
|
||||
"chart-3": "oklch(0.577 0.245 27.325)",
|
||||
"chart-4": "oklch(0.505 0.213 27.518)",
|
||||
"chart-5": "oklch(0.444 0.177 26.899)",
|
||||
},
|
||||
dark: {
|
||||
background: "oklch(0.141 0.005 285.823)",
|
||||
foreground: "oklch(0.985 0 0)",
|
||||
card: "oklch(0.21 0.006 285.885)",
|
||||
"card-foreground": "oklch(0.985 0 0)",
|
||||
popover: "oklch(0.21 0.006 285.885)",
|
||||
"popover-foreground": "oklch(0.985 0 0)",
|
||||
primary: "oklch(0.637 0.237 25.331)",
|
||||
"primary-foreground": "oklch(0.971 0.013 17.38)",
|
||||
secondary: "oklch(0.274 0.006 286.033)",
|
||||
"secondary-foreground": "oklch(0.985 0 0)",
|
||||
muted: "oklch(0.274 0.006 286.033)",
|
||||
"muted-foreground": "oklch(0.705 0.015 286.067)",
|
||||
accent: "oklch(0.274 0.006 286.033)",
|
||||
"accent-foreground": "oklch(0.985 0 0)",
|
||||
destructive: "oklch(0.704 0.191 22.216)",
|
||||
border: "oklch(1 0 0 / 10%)",
|
||||
input: "oklch(1 0 0 / 15%)",
|
||||
ring: "oklch(0.396 0.141 25.723)",
|
||||
"chart-1": "oklch(0.808 0.114 19.571)",
|
||||
"chart-2": "oklch(0.637 0.237 25.331)",
|
||||
"chart-3": "oklch(0.577 0.245 27.325)",
|
||||
"chart-4": "oklch(0.505 0.213 27.518)",
|
||||
"chart-5": "oklch(0.444 0.177 26.899)",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "rose",
|
||||
label: "Rose",
|
||||
cssVars: {
|
||||
light: {
|
||||
background: "oklch(1 0 0)",
|
||||
foreground: "oklch(0.141 0.005 285.823)",
|
||||
card: "oklch(1 0 0)",
|
||||
"card-foreground": "oklch(0.141 0.005 285.823)",
|
||||
popover: "oklch(1 0 0)",
|
||||
"popover-foreground": "oklch(0.141 0.005 285.823)",
|
||||
primary: "oklch(0.586 0.253 17.585)",
|
||||
"primary-foreground": "oklch(0.969 0.015 12.422)",
|
||||
secondary: "oklch(0.967 0.001 286.375)",
|
||||
"secondary-foreground": "oklch(0.21 0.006 285.885)",
|
||||
muted: "oklch(0.967 0.001 286.375)",
|
||||
"muted-foreground": "oklch(0.552 0.016 285.938)",
|
||||
accent: "oklch(0.967 0.001 286.375)",
|
||||
"accent-foreground": "oklch(0.21 0.006 285.885)",
|
||||
destructive: "oklch(0.577 0.245 27.325)",
|
||||
border: "oklch(0.92 0.004 286.32)",
|
||||
input: "oklch(0.92 0.004 286.32)",
|
||||
ring: "oklch(0.712 0.194 13.428)",
|
||||
"chart-1": "oklch(0.81 0.117 11.638)",
|
||||
"chart-2": "oklch(0.645 0.246 16.439)",
|
||||
"chart-3": "oklch(0.586 0.253 17.585)",
|
||||
"chart-4": "oklch(0.514 0.222 16.935)",
|
||||
"chart-5": "oklch(0.455 0.188 13.697)",
|
||||
},
|
||||
dark: {
|
||||
background: "oklch(0.141 0.005 285.823)",
|
||||
foreground: "oklch(0.985 0 0)",
|
||||
card: "oklch(0.21 0.006 285.885)",
|
||||
"card-foreground": "oklch(0.985 0 0)",
|
||||
popover: "oklch(0.21 0.006 285.885)",
|
||||
"popover-foreground": "oklch(0.985 0 0)",
|
||||
primary: "oklch(0.645 0.246 16.439)",
|
||||
"primary-foreground": "oklch(0.969 0.015 12.422)",
|
||||
secondary: "oklch(0.274 0.006 286.033)",
|
||||
"secondary-foreground": "oklch(0.985 0 0)",
|
||||
muted: "oklch(0.274 0.006 286.033)",
|
||||
"muted-foreground": "oklch(0.705 0.015 286.067)",
|
||||
accent: "oklch(0.274 0.006 286.033)",
|
||||
"accent-foreground": "oklch(0.985 0 0)",
|
||||
destructive: "oklch(0.704 0.191 22.216)",
|
||||
border: "oklch(1 0 0 / 10%)",
|
||||
input: "oklch(1 0 0 / 15%)",
|
||||
ring: "oklch(0.41 0.159 10.272)",
|
||||
"chart-1": "oklch(0.81 0.117 11.638)",
|
||||
"chart-2": "oklch(0.645 0.246 16.439)",
|
||||
"chart-3": "oklch(0.586 0.253 17.585)",
|
||||
"chart-4": "oklch(0.514 0.222 16.935)",
|
||||
"chart-5": "oklch(0.455 0.188 13.697)",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "violet",
|
||||
label: "Violet",
|
||||
cssVars: {
|
||||
light: {
|
||||
background: "oklch(1 0 0)",
|
||||
foreground: "oklch(0.141 0.005 285.823)",
|
||||
card: "oklch(1 0 0)",
|
||||
"card-foreground": "oklch(0.141 0.005 285.823)",
|
||||
popover: "oklch(1 0 0)",
|
||||
"popover-foreground": "oklch(0.141 0.005 285.823)",
|
||||
primary: "oklch(0.541 0.281 293.009)",
|
||||
"primary-foreground": "oklch(0.969 0.016 293.756)",
|
||||
secondary: "oklch(0.967 0.001 286.375)",
|
||||
"secondary-foreground": "oklch(0.21 0.006 285.885)",
|
||||
muted: "oklch(0.967 0.001 286.375)",
|
||||
"muted-foreground": "oklch(0.552 0.016 285.938)",
|
||||
accent: "oklch(0.967 0.001 286.375)",
|
||||
"accent-foreground": "oklch(0.21 0.006 285.885)",
|
||||
destructive: "oklch(0.577 0.245 27.325)",
|
||||
border: "oklch(0.92 0.004 286.32)",
|
||||
input: "oklch(0.92 0.004 286.32)",
|
||||
ring: "oklch(0.702 0.183 293.541)",
|
||||
"chart-1": "oklch(0.811 0.111 293.571)",
|
||||
"chart-2": "oklch(0.606 0.25 292.717)",
|
||||
"chart-3": "oklch(0.541 0.281 293.009)",
|
||||
"chart-4": "oklch(0.491 0.27 292.581)",
|
||||
"chart-5": "oklch(0.432 0.232 292.759)",
|
||||
},
|
||||
dark: {
|
||||
background: "oklch(0.141 0.005 285.823)",
|
||||
foreground: "oklch(0.985 0 0)",
|
||||
card: "oklch(0.21 0.006 285.885)",
|
||||
"card-foreground": "oklch(0.985 0 0)",
|
||||
popover: "oklch(0.21 0.006 285.885)",
|
||||
"popover-foreground": "oklch(0.985 0 0)",
|
||||
primary: "oklch(0.606 0.25 292.717)",
|
||||
"primary-foreground": "oklch(0.969 0.016 293.756)",
|
||||
secondary: "oklch(0.274 0.006 286.033)",
|
||||
"secondary-foreground": "oklch(0.985 0 0)",
|
||||
muted: "oklch(0.274 0.006 286.033)",
|
||||
"muted-foreground": "oklch(0.705 0.015 286.067)",
|
||||
accent: "oklch(0.274 0.006 286.033)",
|
||||
"accent-foreground": "oklch(0.985 0 0)",
|
||||
destructive: "oklch(0.704 0.191 22.216)",
|
||||
border: "oklch(1 0 0 / 10%)",
|
||||
input: "oklch(1 0 0 / 15%)",
|
||||
ring: "oklch(0.38 0.189 293.745)",
|
||||
"chart-1": "oklch(0.811 0.111 293.571)",
|
||||
"chart-2": "oklch(0.606 0.25 292.717)",
|
||||
"chart-3": "oklch(0.541 0.281 293.009)",
|
||||
"chart-4": "oklch(0.491 0.27 292.581)",
|
||||
"chart-5": "oklch(0.432 0.232 292.759)",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "yellow",
|
||||
label: "Yellow",
|
||||
cssVars: {
|
||||
light: {
|
||||
background: "oklch(1 0 0)",
|
||||
foreground: "oklch(0.141 0.005 285.823)",
|
||||
card: "oklch(1 0 0)",
|
||||
"card-foreground": "oklch(0.141 0.005 285.823)",
|
||||
popover: "oklch(1 0 0)",
|
||||
"popover-foreground": "oklch(0.141 0.005 285.823)",
|
||||
primary: "oklch(0.852 0.199 91.936)",
|
||||
"primary-foreground": "oklch(0.421 0.095 57.708)",
|
||||
secondary: "oklch(0.967 0.001 286.375)",
|
||||
"secondary-foreground": "oklch(0.21 0.006 285.885)",
|
||||
muted: "oklch(0.967 0.001 286.375)",
|
||||
"muted-foreground": "oklch(0.552 0.016 285.938)",
|
||||
accent: "oklch(0.967 0.001 286.375)",
|
||||
"accent-foreground": "oklch(0.21 0.006 285.885)",
|
||||
destructive: "oklch(0.577 0.245 27.325)",
|
||||
border: "oklch(0.92 0.004 286.32)",
|
||||
input: "oklch(0.92 0.004 286.32)",
|
||||
ring: "oklch(0.852 0.199 91.936)",
|
||||
"chart-1": "oklch(0.905 0.182 98.111)",
|
||||
"chart-2": "oklch(0.795 0.184 86.047)",
|
||||
"chart-3": "oklch(0.681 0.162 75.834)",
|
||||
"chart-4": "oklch(0.554 0.135 66.442)",
|
||||
"chart-5": "oklch(0.476 0.114 61.907)",
|
||||
},
|
||||
dark: {
|
||||
background: "oklch(0.141 0.005 285.823)",
|
||||
foreground: "oklch(0.985 0 0)",
|
||||
card: "oklch(0.21 0.006 285.885)",
|
||||
"card-foreground": "oklch(0.985 0 0)",
|
||||
popover: "oklch(0.21 0.006 285.885)",
|
||||
"popover-foreground": "oklch(0.985 0 0)",
|
||||
primary: "oklch(0.795 0.184 86.047)",
|
||||
"primary-foreground": "oklch(0.421 0.095 57.708)",
|
||||
secondary: "oklch(0.274 0.006 286.033)",
|
||||
"secondary-foreground": "oklch(0.985 0 0)",
|
||||
muted: "oklch(0.274 0.006 286.033)",
|
||||
"muted-foreground": "oklch(0.705 0.015 286.067)",
|
||||
accent: "oklch(0.274 0.006 286.033)",
|
||||
"accent-foreground": "oklch(0.985 0 0)",
|
||||
destructive: "oklch(0.704 0.191 22.216)",
|
||||
border: "oklch(1 0 0 / 10%)",
|
||||
input: "oklch(1 0 0 / 15%)",
|
||||
ring: "oklch(0.421 0.095 57.708)",
|
||||
"chart-1": "oklch(0.905 0.182 98.111)",
|
||||
"chart-2": "oklch(0.795 0.184 86.047)",
|
||||
"chart-3": "oklch(0.681 0.162 75.834)",
|
||||
"chart-4": "oklch(0.554 0.135 66.442)",
|
||||
"chart-5": "oklch(0.476 0.114 61.907)",
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
createTheme("amber", "Amber", primaryColors.amber),
|
||||
createTheme("blue", "Blue", primaryColors.blue),
|
||||
createTheme("cyan", "Cyan", primaryColors.cyan),
|
||||
createTheme("emerald", "Emerald", primaryColors.emerald),
|
||||
createTheme("fuchsia", "Fuchsia", primaryColors.fuchsia),
|
||||
createTheme("green", "Green", primaryColors.green),
|
||||
createTheme("indigo", "Indigo", primaryColors.indigo),
|
||||
createTheme("lime", "Lime", primaryColors.lime),
|
||||
createTheme("neutral", "Neutral", primaryColors.neutral),
|
||||
createTheme("orange", "Orange", primaryColors.orange),
|
||||
createTheme("pink", "Pink", primaryColors.pink),
|
||||
createTheme("purple", "Purple", primaryColors.purple),
|
||||
createTheme("red", "Red", primaryColors.red),
|
||||
createTheme("rose", "Rose", primaryColors.rose),
|
||||
createTheme("sky", "Sky", primaryColors.sky),
|
||||
createTheme("teal", "Teal", primaryColors.teal),
|
||||
createTheme("violet", "Violet", primaryColors.violet),
|
||||
createTheme("yellow", "Yellow", primaryColors.yellow),
|
||||
].sort((a, b) => a.name.localeCompare(b.name));
|
||||
|
||||
export function applyTheme(themeName: string) {
|
||||
const theme = themes.find((t) => t.name === themeName) || themes[0];
|
||||
|
||||
+29
-35
@@ -6,10 +6,7 @@ CLI tool for extracting media and metadata from Twitter/X using gallery-dl extra
|
||||
|
||||
### Required
|
||||
- `url` — Twitter/X URL (timeline, media, likes, search, etc.)
|
||||
|
||||
### Authentication
|
||||
- `--auth-token TOKEN` — Your auth_token cookie value
|
||||
- `--guest` — Force guest mode (no authentication)
|
||||
- `--auth-token TOKEN` — Your auth_token cookie value (required)
|
||||
|
||||
### Content Options
|
||||
- `--retweets {skip|include|original}` — Control retweets (default: skip)
|
||||
@@ -42,10 +39,7 @@ CLI tool for extracting media and metadata from Twitter/X using gallery-dl extra
|
||||
### Basic Fetch
|
||||
|
||||
```powershell
|
||||
# Guest mode (no auth)
|
||||
python twitter_cli.py https://x.com/username/media --limit 10 --json --guest
|
||||
|
||||
# With authentication
|
||||
# Fetch media with authentication
|
||||
python twitter_cli.py https://x.com/username/media --limit 10 --json --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
@@ -53,49 +47,49 @@ python twitter_cli.py https://x.com/username/media --limit 10 --json --auth-toke
|
||||
|
||||
```powershell
|
||||
# Photos only
|
||||
python twitter_cli.py https://x.com/username/media --type photo --json --guest
|
||||
python twitter_cli.py https://x.com/username/media --type photo --json --auth-token YOUR_TOKEN
|
||||
|
||||
# Videos only
|
||||
python twitter_cli.py https://x.com/username/media --type video --json --guest
|
||||
python twitter_cli.py https://x.com/username/media --type video --json --auth-token YOUR_TOKEN
|
||||
|
||||
# Animated GIFs only
|
||||
python twitter_cli.py https://x.com/username/media --type animated_gif --json --guest
|
||||
python twitter_cli.py https://x.com/username/media --type animated_gif --json --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
### With Metadata
|
||||
|
||||
```powershell
|
||||
# Include tweet metadata (author, date, counts)
|
||||
python twitter_cli.py https://x.com/username/media --limit 5 --json --metadata --guest
|
||||
python twitter_cli.py https://x.com/username/media --limit 5 --json --metadata --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
### Retweets Control
|
||||
|
||||
```powershell
|
||||
# Skip retweets (default)
|
||||
python twitter_cli.py https://x.com/username/timeline --retweets skip --json --guest
|
||||
python twitter_cli.py https://x.com/username/timeline --retweets skip --json --auth-token YOUR_TOKEN
|
||||
|
||||
# Include retweets
|
||||
python twitter_cli.py https://x.com/username/timeline --retweets include --json --guest
|
||||
python twitter_cli.py https://x.com/username/timeline --retweets include --json --auth-token YOUR_TOKEN
|
||||
|
||||
# Get original tweet from retweets
|
||||
python twitter_cli.py https://x.com/username/timeline --retweets original --json --guest
|
||||
python twitter_cli.py https://x.com/username/timeline --retweets original --json --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
### Save & Resume
|
||||
|
||||
```powershell
|
||||
# Save to file (with resume capability)
|
||||
python twitter_cli.py https://x.com/username/media --limit 100 --output results.json --progress --guest
|
||||
python twitter_cli.py https://x.com/username/media --limit 100 --output results.json --progress --auth-token YOUR_TOKEN
|
||||
|
||||
# Resume from saved file
|
||||
python twitter_cli.py https://x.com/username/media --resume results.json --limit 100 --output results.json --guest
|
||||
python twitter_cli.py https://x.com/username/media --resume results.json --limit 100 --output results.json --auth-token YOUR_TOKEN
|
||||
|
||||
# Fetch all remaining
|
||||
python twitter_cli.py https://x.com/username/media --resume results.json --limit 0 --output results.json --guest
|
||||
python twitter_cli.py https://x.com/username/media --resume results.json --limit 0 --output results.json --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
### Private Content (Requires Auth)
|
||||
### Private Content
|
||||
|
||||
```powershell
|
||||
# Your likes
|
||||
@@ -109,30 +103,30 @@ python twitter_cli.py https://x.com/i/bookmarks --limit 20 --json --auth-token Y
|
||||
|
||||
```powershell
|
||||
# Search with filters
|
||||
python twitter_cli.py "https://x.com/search?q=from:username filter:media" --limit 50 --json --guest
|
||||
python twitter_cli.py "https://x.com/search?q=from:username filter:media" --limit 50 --json --auth-token YOUR_TOKEN
|
||||
|
||||
# Date range search
|
||||
python twitter_cli.py "https://x.com/search?q=from:username since:2024-01-01 until:2024-12-31" --json --guest
|
||||
python twitter_cli.py "https://x.com/search?q=from:username since:2024-01-01 until:2024-12-31" --json --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
### Advanced Filtering
|
||||
|
||||
```powershell
|
||||
# Filter by date (2024 only)
|
||||
python twitter_cli.py https://x.com/username/media --json --metadata --set filter="date.year == 2024" --guest
|
||||
python twitter_cli.py https://x.com/username/media --json --metadata --set filter="date.year == 2024" --auth-token YOUR_TOKEN
|
||||
|
||||
# Filter by engagement (>1000 likes)
|
||||
python twitter_cli.py https://x.com/username/media --json --metadata --set filter="favorite_count > 1000" --guest
|
||||
python twitter_cli.py https://x.com/username/media --json --metadata --set filter="favorite_count > 1000" --auth-token YOUR_TOKEN
|
||||
|
||||
# Combine filters (photos from 2024 with >100 likes)
|
||||
python twitter_cli.py https://x.com/username/media --type photo --json --metadata --set filter="date.year == 2024 and favorite_count > 100" --guest
|
||||
python twitter_cli.py https://x.com/username/media --type photo --json --metadata --set filter="date.year == 2024 and favorite_count > 100" --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
### Text-Only Tweets
|
||||
|
||||
```powershell
|
||||
# Fetch tweets without media
|
||||
python twitter_cli.py https://x.com/username/tweets --text-tweets --json --metadata --guest
|
||||
python twitter_cli.py https://x.com/username/tweets --text-tweets --json --metadata --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
---
|
||||
@@ -200,16 +194,16 @@ When using `--output`, the file includes:
|
||||
|
||||
```powershell
|
||||
# Step 1: Initial fetch (saves state)
|
||||
python twitter_cli.py https://x.com/user/media --limit 100 --output data.json --progress --guest
|
||||
python twitter_cli.py https://x.com/user/media --limit 100 --output data.json --progress --auth-token YOUR_TOKEN
|
||||
# Output: Saved 202 media to data.json [partial (can resume)]
|
||||
|
||||
# Step 2: Resume and fetch more
|
||||
python twitter_cli.py https://x.com/user/media --resume data.json --limit 100 --output data.json --guest
|
||||
python twitter_cli.py https://x.com/user/media --resume data.json --limit 100 --output data.json --auth-token YOUR_TOKEN
|
||||
# Output: Resuming from cursor, 202 media already fetched
|
||||
# Added 100 new media (total: 302)
|
||||
|
||||
# Step 3: Fetch all remaining
|
||||
python twitter_cli.py https://x.com/user/media --resume data.json --limit 0 --output data.json --guest
|
||||
python twitter_cli.py https://x.com/user/media --resume data.json --limit 0 --output data.json --auth-token YOUR_TOKEN
|
||||
# Output: Added 244 new media (total: 546) [completed]
|
||||
```
|
||||
|
||||
@@ -222,10 +216,10 @@ python twitter_cli.py https://x.com/user/media --resume data.json --limit 0 --ou
|
||||
- `https://x.com/username/timeline` — Full timeline
|
||||
- `https://x.com/username/tweets` — Tweets only
|
||||
- `https://x.com/username/with_replies` — With replies
|
||||
- `https://x.com/username/likes` — Liked tweets (requires auth)
|
||||
- `https://x.com/username/likes` — Liked tweets
|
||||
|
||||
### Private Content
|
||||
- `https://x.com/i/bookmarks` — Your bookmarks (requires auth)
|
||||
- `https://x.com/i/bookmarks` — Your bookmarks
|
||||
|
||||
### Search
|
||||
- `https://x.com/search?q=QUERY` — Search tweets
|
||||
@@ -260,22 +254,22 @@ Use in search URLs:
|
||||
### 1. Progressive Fetch with Resume
|
||||
```powershell
|
||||
# Fetch in batches to avoid long waits
|
||||
python twitter_cli.py URL --limit 200 --output data.json --progress --guest
|
||||
python twitter_cli.py URL --resume data.json --limit 200 --output data.json --guest
|
||||
python twitter_cli.py URL --limit 200 --output data.json --progress --auth-token YOUR_TOKEN
|
||||
python twitter_cli.py URL --resume data.json --limit 200 --output data.json --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
### 2. Combine Type Filter with Custom Filter
|
||||
```powershell
|
||||
# Photos from 2024 with high engagement
|
||||
python twitter_cli.py URL --type photo --metadata --set filter="date.year == 2024 and favorite_count > 500" --json --guest
|
||||
python twitter_cli.py URL --type photo --metadata --set filter="date.year == 2024 and favorite_count > 500" --json --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
### 3. Use Progress Flag for Long Fetches
|
||||
```powershell
|
||||
python twitter_cli.py URL --limit 1000 --progress --output data.json --guest
|
||||
python twitter_cli.py URL --limit 1000 --progress --output data.json --auth-token YOUR_TOKEN
|
||||
```
|
||||
|
||||
### 4. Check Cursor Availability
|
||||
- If `completed: false` in output → can resume
|
||||
- If `completed: true` → all data fetched
|
||||
- If `cursor: null` → no more data available
|
||||
- If `cursor: null` → no more data available
|
||||
@@ -102,6 +102,20 @@ def _extract_tweet_metadata(data: MutableMapping[str, Any]) -> Dict[str, Any]:
|
||||
"name": meta["author"].get("name"),
|
||||
"nick": meta["author"].get("nick"),
|
||||
}
|
||||
elif isinstance(meta["author"], str):
|
||||
# Handle case where author is just a string (username)
|
||||
meta["author"] = {
|
||||
"id": None,
|
||||
"name": meta["author"],
|
||||
"nick": meta["author"],
|
||||
}
|
||||
else:
|
||||
# Handle None or other types
|
||||
meta["author"] = {
|
||||
"id": None,
|
||||
"name": None,
|
||||
"nick": None,
|
||||
}
|
||||
return meta
|
||||
|
||||
|
||||
@@ -171,7 +185,9 @@ def run_request(
|
||||
for message in extractor:
|
||||
mtype = message[0]
|
||||
if mtype is Message.Directory and request.metadata:
|
||||
metadata.append(_extract_tweet_metadata(message[1]))
|
||||
# Only extract metadata if message[1] is a dict
|
||||
if isinstance(message[1], dict):
|
||||
metadata.append(_extract_tweet_metadata(message[1]))
|
||||
elif mtype is Message.Url:
|
||||
url = message[1]
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"version": "4.1"
|
||||
}
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
},
|
||||
"info": {
|
||||
"productName": "Twitter/X Media Batch Downloader",
|
||||
"productVersion": "4.1"
|
||||
"productVersion": "4.3"
|
||||
},
|
||||
"wailsjsdir": "./frontend",
|
||||
"assetdir": "./frontend/dist",
|
||||
|
||||
Reference in new issue
Block a user