mirror of
https://github.com/Alvin-Zilverstand/Twitter-X-Media-Batch-Downloader.git
synced 2026-11-24 15:23:11 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6964753e3e | ||
|
|
9c269bc8f2 | ||
|
|
70f5088574 |
No files matched your search
@@ -1 +0,0 @@
|
|||||||
ko_fi: afkarxyz
|
|
||||||
@@ -54,7 +54,7 @@ jobs:
|
|||||||
- name: Install frontend dependencies
|
- name: Install frontend dependencies
|
||||||
working-directory: frontend
|
working-directory: frontend
|
||||||
run: |
|
run: |
|
||||||
pnpm install
|
pnpm install --frozen-lockfile
|
||||||
pnpm run generate-icon
|
pnpm run generate-icon
|
||||||
|
|
||||||
- name: Install UPX
|
- name: Install UPX
|
||||||
@@ -120,7 +120,7 @@ jobs:
|
|||||||
- name: Install frontend dependencies
|
- name: Install frontend dependencies
|
||||||
working-directory: frontend
|
working-directory: frontend
|
||||||
run: |
|
run: |
|
||||||
pnpm install
|
pnpm install --frozen-lockfile
|
||||||
pnpm run generate-icon
|
pnpm run generate-icon
|
||||||
|
|
||||||
- name: Build application
|
- name: Build application
|
||||||
@@ -217,7 +217,7 @@ jobs:
|
|||||||
- name: Install frontend dependencies
|
- name: Install frontend dependencies
|
||||||
working-directory: frontend
|
working-directory: frontend
|
||||||
run: |
|
run: |
|
||||||
pnpm install
|
pnpm install --frozen-lockfile
|
||||||
pnpm run generate-icon
|
pnpm run generate-icon
|
||||||
|
|
||||||
- name: Build application
|
- name: Build application
|
||||||
|
|||||||
@@ -9,20 +9,19 @@
|
|||||||
href="https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases"><img
|
href="https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases"><img
|
||||||
src="https://img.shields.io/github/downloads/afkarxyz/Twitter-X-Media-Batch-Downloader/total?color=22c55e&labelColor=black&logo=github&label=Downloads" /></a><a
|
src="https://img.shields.io/github/downloads/afkarxyz/Twitter-X-Media-Batch-Downloader/total?color=22c55e&labelColor=black&logo=github&label=Downloads" /></a><a
|
||||||
href="https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/latest"><img
|
href="https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/latest"><img
|
||||||
src="https://img.shields.io/github/v/release/afkarxyz/Twitter-X-Media-Batch-Downloader?color=8b5cf6&labelColor=black&logo=github&label=Latest%20Release" /></a><a
|
src="https://img.shields.io/github/v/release/afkarxyz/Twitter-X-Media-Batch-Downloader?color=8b5cf6&labelColor=black&logo=github&label=Latest%20Release" /></a><a href="https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/latest"><img
|
||||||
|
src="https://img.shields.io/badge/Windows-369eff?labelColor=black&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MTIiIGhlaWdodD0iNTEyIiB2aWV3Qm94PSIwIDAgMjAgMjAiPjxwYXRoIGZpbGw9IiNmZmZmZmYiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTIwIDEwLjg3M1YyMEw4LjQ3OSAxOC41MzdsLjAwMS03LjY2NEgyMFptLTEzLjEyIDBsLS4wMDEgNy40NjFMMCAxNy40NjF2LTYuNTg4aDYuODhaTTIwIDkuMjczSDguNDhsLS4wMDEtNy44MUwyMCAwdjkuMjczWk02Ljg3OSAxLjY2NmwuMDAxIDcuNjA3SDBWMi41MzlsNi44NzktLjg3M1oiLz48L3N2Zz4=" /></a><a
|
||||||
href="https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/latest"><img
|
href="https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/latest"><img
|
||||||
src="https://img.shields.io/badge/Windows-10%2B-369eff?labelColor=black&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MTIiIGhlaWdodD0iNTEyIiB2aWV3Qm94PSIwIDAgMjAgMjAiPjxwYXRoIGZpbGw9IiNmZmZmZmYiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTIwIDEwLjg3M1YyMEw4LjQ3OSAxOC41MzdsLjAwMS03LjY2NEgyMFptLTEzLjEyIDBsLS4wMDEgNy40NjFMMCAxNy40NjF2LTYuNTg4aDYuODhaTTIwIDkuMjczSDguNDhsLS4wMDEtNy44MUwyMCAwdjkuMjczWk02Ljg3OSAxLjY2NmwuMDAxIDcuNjA3SDBWMi41MzlsNi44NzktLjg3M1oiLz48L3N2Zz4=" /></a><a
|
src="https://img.shields.io/badge/macOS-FFFFFF?labelColor=black&logo=apple&logoColor=white" /></a><a
|
||||||
href="https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/latest"><img
|
href="https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/latest"><img
|
||||||
src="https://img.shields.io/badge/macOS-10.13%2B-FFFFFF?labelColor=black&logo=apple&logoColor=white" /></a><a
|
src="https://img.shields.io/badge/Linux-FCC624?labelColor=black&logo=linux&logoColor=white" /></a>
|
||||||
href="https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/latest"><img
|
|
||||||
src="https://img.shields.io/badge/Linux-Any-FCC624?labelColor=black&logo=linux&logoColor=white" /></a>
|
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<a href="https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/latest" target="_blank"><img
|
<a href="https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/latest" target="_blank"><img
|
||||||
src="https://github.com/user-attachments/assets/556bc876-871b-4ac1-af9e-a9001c6b9bbf" alt="Dark"
|
src="https://github.com/user-attachments/assets/e95586cb-35ce-4ef7-a6ce-a5a18ebf3b29" alt="Dark"
|
||||||
width="49%" /></a>
|
width="49%" /></a>
|
||||||
<a href="https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/latest" target="_blank"><img
|
<a href="https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/latest" target="_blank"><img
|
||||||
src="https://github.com/user-attachments/assets/338f11b5-9ddb-4074-8185-aaee13772bdf" alt="Light"
|
src="https://github.com/user-attachments/assets/7581ca58-9e15-4dd9-ae45-14c2b8f3f9d6" alt="Light"
|
||||||
width="49%" /></a>
|
width="49%" /></a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -35,6 +34,19 @@
|
|||||||
|
|
||||||
- Also available on the web at [**TwitterDL.app**](https://twitterdl.app)
|
- Also available on the web at [**TwitterDL.app**](https://twitterdl.app)
|
||||||
|
|
||||||
|
## Fetch pacing
|
||||||
|
|
||||||
|
Settings includes separate **Fetch Delay** controls: a base delay and a random
|
||||||
|
extra from zero to the configured value, in seconds. Both default to zero
|
||||||
|
(disabled). A suggested starting point is 5 seconds base plus up to 5 seconds
|
||||||
|
extra; this is not a guaranteed safe rate for Twitter/X.
|
||||||
|
|
||||||
|
The delay spaces out extractor starts across batches, accounts, resumes, retries,
|
||||||
|
and date-range fetches. The first fetch starts immediately. It does not control
|
||||||
|
requests made internally by the external extractor. Stop interrupts a pending
|
||||||
|
wait, and waiting counts toward Fetch Timeout, so increase the timeout when
|
||||||
|
using longer delays.
|
||||||
|
|
||||||
## How to Obtain Auth Token
|
## How to Obtain Auth Token
|
||||||
|
|
||||||
> [!Warning]
|
> [!Warning]
|
||||||
@@ -50,4 +62,4 @@
|
|||||||
5. Find and copy the `auth_token` value
|
5. Find and copy the `auth_token` value
|
||||||
6. Do not log out of your account, as a new `auth_token` will be generated by Twitter
|
6. Do not log out of your account, as a new `auth_token` will be generated by Twitter
|
||||||
|
|
||||||

|

|
||||||
@@ -5,8 +5,11 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
"twitterxmediabatchdownloader/backend"
|
"twitterxmediabatchdownloader/backend"
|
||||||
|
|
||||||
"github.com/wailsapp/wails/v2/pkg/runtime"
|
"github.com/wailsapp/wails/v2/pkg/runtime"
|
||||||
@@ -224,15 +227,49 @@ func (a *App) Quit() {
|
|||||||
panic("quit")
|
panic("quit")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *App) ExportFailedLogs(content string) (string, error) {
|
||||||
|
if strings.TrimSpace(content) == "" {
|
||||||
|
return "", fmt.Errorf("no failed logs to export")
|
||||||
|
}
|
||||||
|
if a.ctx == nil {
|
||||||
|
return "", fmt.Errorf("application is not ready")
|
||||||
|
}
|
||||||
|
|
||||||
|
path, err := runtime.SaveFileDialog(a.ctx, runtime.SaveDialogOptions{
|
||||||
|
DefaultFilename: fmt.Sprintf("TwitterXMediaBatchDownloader_%s_Failed.txt", time.Now().Format("20060102_150405")),
|
||||||
|
Title: "Export Failed Logs",
|
||||||
|
Filters: []runtime.FileFilter{
|
||||||
|
{
|
||||||
|
DisplayName: "Text Files (*.txt)",
|
||||||
|
Pattern: "*.txt",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("failed to open save dialog: %v", err)
|
||||||
|
}
|
||||||
|
if path == "" {
|
||||||
|
return "", nil
|
||||||
|
}
|
||||||
|
if err := os.WriteFile(path, []byte(content), 0644); err != nil {
|
||||||
|
return "", fmt.Errorf("failed to write log file: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return path, nil
|
||||||
|
}
|
||||||
|
|
||||||
type DownloadMediaRequest struct {
|
type DownloadMediaRequest struct {
|
||||||
URLs []string `json:"urls"`
|
URLs []string `json:"urls"`
|
||||||
OutputDir string `json:"output_dir"`
|
OutputDir string `json:"output_dir"`
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
ConcurrentDownloads int `json:"concurrent_downloads,omitempty"`
|
ConcurrentDownloads int `json:"concurrent_downloads,omitempty"`
|
||||||
SkipExisting bool `json:"skip_existing"`
|
SkipExisting bool `json:"skip_existing"`
|
||||||
DeleteIncompleteFiles bool `json:"delete_incomplete_files"`
|
DeleteIncompleteFiles bool `json:"delete_incomplete_files"`
|
||||||
RetryAttempts int `json:"retry_attempts,omitempty"`
|
RetryAttempts int `json:"retry_attempts,omitempty"`
|
||||||
Proxy string `json:"proxy,omitempty"`
|
DownloadSpeedLimitKBps int `json:"download_speed_limit_kbps,omitempty"`
|
||||||
|
DownloadDelayMillis int `json:"download_delay_ms,omitempty"`
|
||||||
|
DownloadDelayJitterMillis int `json:"download_delay_jitter_ms,omitempty"`
|
||||||
|
Proxy string `json:"proxy,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MediaItemRequest struct {
|
type MediaItemRequest struct {
|
||||||
@@ -247,19 +284,22 @@ type MediaItemRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DownloadMediaWithMetadataRequest struct {
|
type DownloadMediaWithMetadataRequest struct {
|
||||||
Items []MediaItemRequest `json:"items"`
|
Items []MediaItemRequest `json:"items"`
|
||||||
OutputDir string `json:"output_dir"`
|
OutputDir string `json:"output_dir"`
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
ConcurrentDownloads int `json:"concurrent_downloads,omitempty"`
|
ConcurrentDownloads int `json:"concurrent_downloads,omitempty"`
|
||||||
SkipExisting bool `json:"skip_existing"`
|
SkipExisting bool `json:"skip_existing"`
|
||||||
DeleteIncompleteFiles bool `json:"delete_incomplete_files"`
|
DeleteIncompleteFiles bool `json:"delete_incomplete_files"`
|
||||||
RetryAttempts int `json:"retry_attempts,omitempty"`
|
RetryAttempts int `json:"retry_attempts,omitempty"`
|
||||||
Proxy string `json:"proxy,omitempty"`
|
DownloadSpeedLimitKBps int `json:"download_speed_limit_kbps,omitempty"`
|
||||||
FilenameTemplate string `json:"filename_template,omitempty"`
|
DownloadDelayMillis int `json:"download_delay_ms,omitempty"`
|
||||||
FolderTemplate string `json:"folder_template,omitempty"`
|
DownloadDelayJitterMillis int `json:"download_delay_jitter_ms,omitempty"`
|
||||||
AutoConvertGIFs bool `json:"auto_convert_gifs,omitempty"`
|
Proxy string `json:"proxy,omitempty"`
|
||||||
GIFQuality string `json:"gif_quality,omitempty"`
|
FilenameTemplate string `json:"filename_template,omitempty"`
|
||||||
GIFResolution string `json:"gif_resolution,omitempty"`
|
FolderTemplate string `json:"folder_template,omitempty"`
|
||||||
|
AutoConvertGIFs bool `json:"auto_convert_gifs,omitempty"`
|
||||||
|
GIFQuality string `json:"gif_quality,omitempty"`
|
||||||
|
GIFResolution string `json:"gif_resolution,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type DownloadMediaResponse struct {
|
type DownloadMediaResponse struct {
|
||||||
@@ -290,10 +330,13 @@ func (a *App) DownloadMedia(req DownloadMediaRequest) (DownloadMediaResponse, er
|
|||||||
}
|
}
|
||||||
|
|
||||||
options := backend.DownloadOptions{
|
options := backend.DownloadOptions{
|
||||||
ConcurrentDownloads: req.ConcurrentDownloads,
|
ConcurrentDownloads: req.ConcurrentDownloads,
|
||||||
SkipExistingFiles: req.SkipExisting,
|
SkipExistingFiles: req.SkipExisting,
|
||||||
DeleteIncompleteFiles: req.DeleteIncompleteFiles,
|
DeleteIncompleteFiles: req.DeleteIncompleteFiles,
|
||||||
RetryAttempts: req.RetryAttempts,
|
RetryAttempts: req.RetryAttempts,
|
||||||
|
DownloadSpeedLimitKBps: req.DownloadSpeedLimitKBps,
|
||||||
|
DownloadDelayMillis: req.DownloadDelayMillis,
|
||||||
|
DownloadDelayJitterMillis: req.DownloadDelayJitterMillis,
|
||||||
}
|
}
|
||||||
|
|
||||||
downloaded, failed, err := backend.DownloadMediaFiles(req.URLs, outputDir, options, req.Proxy)
|
downloaded, failed, err := backend.DownloadMediaFiles(req.URLs, outputDir, options, req.Proxy)
|
||||||
@@ -401,15 +444,18 @@ func (a *App) DownloadMediaWithMetadata(req DownloadMediaWithMetadataRequest) (D
|
|||||||
}
|
}
|
||||||
|
|
||||||
options := backend.DownloadOptions{
|
options := backend.DownloadOptions{
|
||||||
ConcurrentDownloads: req.ConcurrentDownloads,
|
ConcurrentDownloads: req.ConcurrentDownloads,
|
||||||
SkipExistingFiles: req.SkipExisting,
|
SkipExistingFiles: req.SkipExisting,
|
||||||
DeleteIncompleteFiles: req.DeleteIncompleteFiles,
|
DeleteIncompleteFiles: req.DeleteIncompleteFiles,
|
||||||
RetryAttempts: req.RetryAttempts,
|
RetryAttempts: req.RetryAttempts,
|
||||||
FilenameTemplate: req.FilenameTemplate,
|
DownloadSpeedLimitKBps: req.DownloadSpeedLimitKBps,
|
||||||
FolderTemplate: req.FolderTemplate,
|
DownloadDelayMillis: req.DownloadDelayMillis,
|
||||||
AutoConvertGIFs: req.AutoConvertGIFs,
|
DownloadDelayJitterMillis: req.DownloadDelayJitterMillis,
|
||||||
GIFQuality: req.GIFQuality,
|
FilenameTemplate: req.FilenameTemplate,
|
||||||
GIFResolution: req.GIFResolution,
|
FolderTemplate: req.FolderTemplate,
|
||||||
|
AutoConvertGIFs: req.AutoConvertGIFs,
|
||||||
|
GIFQuality: req.GIFQuality,
|
||||||
|
GIFResolution: req.GIFResolution,
|
||||||
}
|
}
|
||||||
|
|
||||||
downloaded, skipped, failed, err := backend.DownloadMediaWithMetadataProgressAndStatus(
|
downloaded, skipped, failed, err := backend.DownloadMediaWithMetadataProgressAndStatus(
|
||||||
|
|||||||
+176
-33
@@ -5,6 +5,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"math/rand/v2"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
@@ -20,6 +21,8 @@ const (
|
|||||||
MaxConcurrentDownloads = 50
|
MaxConcurrentDownloads = 50
|
||||||
DefaultRetryAttempts = 2
|
DefaultRetryAttempts = 2
|
||||||
MaxRetryAttempts = 5
|
MaxRetryAttempts = 5
|
||||||
|
MaxDownloadSpeedLimitKBps = 10 * 1024 * 1024
|
||||||
|
MaxDownloadDelayMillis = 60 * 60 * 1000
|
||||||
)
|
)
|
||||||
|
|
||||||
func NormalizeConcurrentDownloads(requested int) int {
|
func NormalizeConcurrentDownloads(requested int) int {
|
||||||
@@ -42,24 +45,169 @@ func NormalizeRetryAttempts(requested int) int {
|
|||||||
return requested
|
return requested
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func normalizeDownloadSpeedLimit(requested int) int {
|
||||||
|
if requested < 0 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
if requested > MaxDownloadSpeedLimitKBps {
|
||||||
|
return MaxDownloadSpeedLimitKBps
|
||||||
|
}
|
||||||
|
return requested
|
||||||
|
}
|
||||||
|
|
||||||
|
func normalizeDownloadDelay(requested int) int {
|
||||||
|
if requested < 0 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
if requested > MaxDownloadDelayMillis {
|
||||||
|
return MaxDownloadDelayMillis
|
||||||
|
}
|
||||||
|
return requested
|
||||||
|
}
|
||||||
|
|
||||||
type DownloadOptions struct {
|
type DownloadOptions struct {
|
||||||
ConcurrentDownloads int
|
ConcurrentDownloads int
|
||||||
SkipExistingFiles bool
|
SkipExistingFiles bool
|
||||||
DeleteIncompleteFiles bool
|
DeleteIncompleteFiles bool
|
||||||
RetryAttempts int
|
RetryAttempts int
|
||||||
FilenameTemplate string
|
DownloadSpeedLimitKBps int
|
||||||
FolderTemplate string
|
DownloadDelayMillis int
|
||||||
AutoConvertGIFs bool
|
DownloadDelayJitterMillis int
|
||||||
GIFQuality string
|
FilenameTemplate string
|
||||||
GIFResolution string
|
FolderTemplate string
|
||||||
|
AutoConvertGIFs bool
|
||||||
|
GIFQuality string
|
||||||
|
GIFResolution string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NormalizeDownloadOptions(options DownloadOptions) DownloadOptions {
|
func NormalizeDownloadOptions(options DownloadOptions) DownloadOptions {
|
||||||
options.ConcurrentDownloads = NormalizeConcurrentDownloads(options.ConcurrentDownloads)
|
options.ConcurrentDownloads = NormalizeConcurrentDownloads(options.ConcurrentDownloads)
|
||||||
options.RetryAttempts = NormalizeRetryAttempts(options.RetryAttempts)
|
options.RetryAttempts = NormalizeRetryAttempts(options.RetryAttempts)
|
||||||
|
options.DownloadSpeedLimitKBps = normalizeDownloadSpeedLimit(options.DownloadSpeedLimitKBps)
|
||||||
|
options.DownloadDelayMillis = normalizeDownloadDelay(options.DownloadDelayMillis)
|
||||||
|
options.DownloadDelayJitterMillis = normalizeDownloadDelay(options.DownloadDelayJitterMillis)
|
||||||
return options
|
return options
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type downloadThrottle struct {
|
||||||
|
speedBytesPerSecond int64
|
||||||
|
delay time.Duration
|
||||||
|
delayJitter time.Duration
|
||||||
|
|
||||||
|
requestMu sync.Mutex
|
||||||
|
nextRequestStart time.Time
|
||||||
|
requestStarted bool
|
||||||
|
|
||||||
|
bandwidthMu sync.Mutex
|
||||||
|
nextByteWriteTime time.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
func newDownloadThrottle(options DownloadOptions) *downloadThrottle {
|
||||||
|
options = NormalizeDownloadOptions(options)
|
||||||
|
if options.DownloadSpeedLimitKBps == 0 && options.DownloadDelayMillis == 0 && options.DownloadDelayJitterMillis == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return &downloadThrottle{
|
||||||
|
speedBytesPerSecond: int64(options.DownloadSpeedLimitKBps) * 1024,
|
||||||
|
delay: time.Duration(options.DownloadDelayMillis) * time.Millisecond,
|
||||||
|
delayJitter: time.Duration(options.DownloadDelayJitterMillis) * time.Millisecond,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func waitUntil(ctx context.Context, deadline time.Time) error {
|
||||||
|
wait := time.Until(deadline)
|
||||||
|
if wait <= 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
timer := time.NewTimer(wait)
|
||||||
|
defer timer.Stop()
|
||||||
|
|
||||||
|
select {
|
||||||
|
case <-ctx.Done():
|
||||||
|
return ctx.Err()
|
||||||
|
case <-timer.C:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *downloadThrottle) waitForRequest(ctx context.Context) error {
|
||||||
|
if t == nil || (t.delay == 0 && t.delayJitter == 0) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
t.requestMu.Lock()
|
||||||
|
now := time.Now()
|
||||||
|
startAt := now
|
||||||
|
if t.requestStarted && t.nextRequestStart.After(startAt) {
|
||||||
|
startAt = t.nextRequestStart
|
||||||
|
}
|
||||||
|
|
||||||
|
jitter := time.Duration(0)
|
||||||
|
if t.delayJitter > 0 {
|
||||||
|
jitter = time.Duration(rand.Int64N(int64(t.delayJitter) + 1))
|
||||||
|
}
|
||||||
|
t.nextRequestStart = startAt.Add(t.delay + jitter)
|
||||||
|
t.requestStarted = true
|
||||||
|
t.requestMu.Unlock()
|
||||||
|
|
||||||
|
return waitUntil(ctx, startAt)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *downloadThrottle) waitForBytes(ctx context.Context, byteCount int) error {
|
||||||
|
if t == nil || t.speedBytesPerSecond <= 0 || byteCount <= 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
nanoseconds := (int64(byteCount)*int64(time.Second) + t.speedBytesPerSecond - 1) / t.speedBytesPerSecond
|
||||||
|
duration := time.Duration(nanoseconds)
|
||||||
|
|
||||||
|
t.bandwidthMu.Lock()
|
||||||
|
now := time.Now()
|
||||||
|
if t.nextByteWriteTime.Before(now) {
|
||||||
|
t.nextByteWriteTime = now
|
||||||
|
}
|
||||||
|
t.nextByteWriteTime = t.nextByteWriteTime.Add(duration)
|
||||||
|
writeAt := t.nextByteWriteTime
|
||||||
|
t.bandwidthMu.Unlock()
|
||||||
|
|
||||||
|
return waitUntil(ctx, writeAt)
|
||||||
|
}
|
||||||
|
|
||||||
|
type throttledWriter struct {
|
||||||
|
ctx context.Context
|
||||||
|
writer io.Writer
|
||||||
|
throttle *downloadThrottle
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w throttledWriter) Write(p []byte) (int, error) {
|
||||||
|
if err := w.throttle.waitForBytes(w.ctx, len(p)); err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return w.writer.Write(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
func createMediaDownloadClient(customProxy string, options DownloadOptions) *http.Client {
|
||||||
|
client, err := CreateHTTPClient(customProxy, 60*time.Second)
|
||||||
|
if err != nil {
|
||||||
|
client = &http.Client{Timeout: 60 * time.Second}
|
||||||
|
}
|
||||||
|
|
||||||
|
if options.DownloadSpeedLimitKBps > 0 {
|
||||||
|
client.Timeout = 0
|
||||||
|
if transport, ok := client.Transport.(*http.Transport); ok {
|
||||||
|
transport.ResponseHeaderTimeout = 60 * time.Second
|
||||||
|
} else if client.Transport == nil {
|
||||||
|
transport := http.DefaultTransport.(*http.Transport).Clone()
|
||||||
|
transport.ResponseHeaderTimeout = 60 * time.Second
|
||||||
|
client.Transport = transport
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return client
|
||||||
|
}
|
||||||
|
|
||||||
type MediaItem struct {
|
type MediaItem struct {
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
Date string `json:"date"`
|
Date string `json:"date"`
|
||||||
@@ -78,13 +226,8 @@ func DownloadMediaFiles(urls []string, outputDir string, options DownloadOptions
|
|||||||
return 0, len(urls), fmt.Errorf("failed to create output directory: %v", err)
|
return 0, len(urls), fmt.Errorf("failed to create output directory: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
client, err := CreateHTTPClient(customProxy, 60*time.Second)
|
client := createMediaDownloadClient(customProxy, options)
|
||||||
if err != nil {
|
throttle := newDownloadThrottle(options)
|
||||||
|
|
||||||
client = &http.Client{
|
|
||||||
Timeout: 60 * time.Second,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, mediaURL := range urls {
|
for _, mediaURL := range urls {
|
||||||
filename := extractFilename(mediaURL)
|
filename := extractFilename(mediaURL)
|
||||||
@@ -97,7 +240,7 @@ func DownloadMediaFiles(urls []string, outputDir string, options DownloadOptions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := downloadFileWithRetry(context.Background(), client, mediaURL, outputPath, options); err != nil {
|
if err := downloadFileWithRetry(context.Background(), client, mediaURL, outputPath, options, throttle); err != nil {
|
||||||
failed++
|
failed++
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -197,14 +340,14 @@ func waitForRetry(ctx context.Context, attempt int) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func downloadFileWithRetry(ctx context.Context, client *http.Client, mediaURL, outputPath string, options DownloadOptions) error {
|
func downloadFileWithRetry(ctx context.Context, client *http.Client, mediaURL, outputPath string, options DownloadOptions, throttle *downloadThrottle) error {
|
||||||
options = NormalizeDownloadOptions(options)
|
options = NormalizeDownloadOptions(options)
|
||||||
|
|
||||||
var lastErr error
|
var lastErr error
|
||||||
totalAttempts := options.RetryAttempts + 1
|
totalAttempts := options.RetryAttempts + 1
|
||||||
for attempt := 1; attempt <= totalAttempts; attempt++ {
|
for attempt := 1; attempt <= totalAttempts; attempt++ {
|
||||||
keepPartialOnFailure := !options.DeleteIncompleteFiles && attempt == totalAttempts
|
keepPartialOnFailure := !options.DeleteIncompleteFiles && attempt == totalAttempts
|
||||||
lastErr = downloadFileWithContext(ctx, client, mediaURL, outputPath, !options.SkipExistingFiles, keepPartialOnFailure)
|
lastErr = downloadFileWithContext(ctx, client, mediaURL, outputPath, !options.SkipExistingFiles, keepPartialOnFailure, throttle)
|
||||||
if lastErr == nil {
|
if lastErr == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -381,16 +524,8 @@ func DownloadMediaWithMetadataProgressAndStatus(items []MediaItem, outputDir str
|
|||||||
numWorkers = len(tasks)
|
numWorkers = len(tasks)
|
||||||
}
|
}
|
||||||
|
|
||||||
var sharedClient *http.Client
|
sharedClient := createMediaDownloadClient(customProxy, options)
|
||||||
client, err := CreateHTTPClient(customProxy, 60*time.Second)
|
throttle := newDownloadThrottle(options)
|
||||||
if err != nil {
|
|
||||||
|
|
||||||
sharedClient = &http.Client{
|
|
||||||
Timeout: 60 * time.Second,
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sharedClient = client
|
|
||||||
}
|
|
||||||
|
|
||||||
for i := 0; i < numWorkers; i++ {
|
for i := 0; i < numWorkers; i++ {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
@@ -446,7 +581,7 @@ func DownloadMediaWithMetadataProgressAndStatus(items []MediaItem, outputDir str
|
|||||||
atomic.AddInt64(&downloadedCount, 1)
|
atomic.AddInt64(&downloadedCount, 1)
|
||||||
status = "success"
|
status = "success"
|
||||||
}
|
}
|
||||||
} else if err := downloadFileWithRetry(ctx, client, task.item.URL, task.outputPath, options); err != nil {
|
} else if err := downloadFileWithRetry(ctx, client, task.item.URL, task.outputPath, options, throttle); err != nil {
|
||||||
if ctx.Err() != nil || errors.Is(err, context.Canceled) {
|
if ctx.Err() != nil || errors.Is(err, context.Canceled) {
|
||||||
if itemStatus != nil {
|
if itemStatus != nil {
|
||||||
itemStatus(task.item.TweetID, task.index, "cancelled")
|
itemStatus(task.item.TweetID, task.index, "cancelled")
|
||||||
@@ -539,7 +674,11 @@ func normalizeGIFResolution(resolution string) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func downloadFileWithContext(ctx context.Context, client *http.Client, url, outputPath string, allowOverwrite bool, keepPartialOnFailure bool) error {
|
func downloadFileWithContext(ctx context.Context, client *http.Client, url, outputPath string, allowOverwrite bool, keepPartialOnFailure bool, throttle *downloadThrottle) error {
|
||||||
|
if err := throttle.waitForRequest(ctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
|
req, err := http.NewRequestWithContext(ctx, "GET", url, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -570,7 +709,11 @@ func downloadFileWithContext(ctx context.Context, client *http.Client, url, outp
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
_, err = io.Copy(out, resp.Body)
|
writer := io.Writer(out)
|
||||||
|
if throttle != nil && throttle.speedBytesPerSecond > 0 {
|
||||||
|
writer = throttledWriter{ctx: ctx, writer: out, throttle: throttle}
|
||||||
|
}
|
||||||
|
_, err = io.Copy(writer, resp.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -768,7 +911,7 @@ func downloadFile(client *http.Client, url, outputPath string) error {
|
|||||||
SkipExistingFiles: false,
|
SkipExistingFiles: false,
|
||||||
DeleteIncompleteFiles: true,
|
DeleteIncompleteFiles: true,
|
||||||
RetryAttempts: 0,
|
RetryAttempts: 0,
|
||||||
})
|
}, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func DownloadProfileImage(imageURL, outputDir, username, kind, customProxy string) (string, error) {
|
func DownloadProfileImage(imageURL, outputDir, username, kind, customProxy string) (string, error) {
|
||||||
|
|||||||
@@ -32,8 +32,10 @@ type extractorVersionMetadata struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type githubRelease struct {
|
type githubRelease struct {
|
||||||
TagName string `json:"tag_name"`
|
TagName string `json:"tag_name"`
|
||||||
Assets []githubReleaseAsset `json:"assets"`
|
Draft bool `json:"draft"`
|
||||||
|
Prerelease bool `json:"prerelease"`
|
||||||
|
Assets []githubReleaseAsset `json:"assets"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type githubReleaseAsset struct {
|
type githubReleaseAsset struct {
|
||||||
|
|||||||
+28
-9
@@ -18,9 +18,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ffmpegReleaseAPIURL = "https://api.github.com/repos/spotbye/Dependencies/releases/tags/FFmpeg-8.1"
|
ffmpegReleasesAPIURL = "https://api.github.com/repos/spotbye/Dependencies/releases?per_page=100"
|
||||||
ffmpegLatestReleaseURL = "https://github.com/spotbye/Dependencies/releases/tag/FFmpeg-8.1"
|
ffmpegReleaseTagPrefix = "FFmpeg-"
|
||||||
ffmpegLatestDownloadBaseURL = "https://github.com/spotbye/Dependencies/releases/download/FFmpeg-8.1"
|
ffmpegFallbackReleaseTag = "FFmpeg-9.0"
|
||||||
|
ffmpegFallbackReleaseURL = "https://github.com/spotbye/Dependencies/releases/tag/" + ffmpegFallbackReleaseTag
|
||||||
|
ffmpegFallbackDownloadBaseURL = "https://github.com/spotbye/Dependencies/releases/download/" + ffmpegFallbackReleaseTag
|
||||||
)
|
)
|
||||||
|
|
||||||
var ffmpegVersionPattern = regexp.MustCompile(`^[0-9]+(?:\.[0-9]+)+`)
|
var ffmpegVersionPattern = regexp.MustCompile(`^[0-9]+(?:\.[0-9]+)+`)
|
||||||
@@ -206,7 +208,7 @@ func fetchLatestFFmpegRelease() (*githubRelease, error) {
|
|||||||
return nil, fmt.Errorf("failed to configure ffmpeg network client: %v", err)
|
return nil, fmt.Errorf("failed to configure ffmpeg network client: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := newFFmpegGitHubRequest(ffmpegReleaseAPIURL)
|
req, err := newFFmpegGitHubRequest(ffmpegReleasesAPIURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -221,12 +223,26 @@ func fetchLatestFFmpegRelease() (*githubRelease, error) {
|
|||||||
return nil, fmt.Errorf("failed to fetch ffmpeg release info: status %d", resp.StatusCode)
|
return nil, fmt.Errorf("failed to fetch ffmpeg release info: status %d", resp.StatusCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
var release githubRelease
|
var releases []githubRelease
|
||||||
if err := json.NewDecoder(resp.Body).Decode(&release); err != nil {
|
if err := json.NewDecoder(resp.Body).Decode(&releases); err != nil {
|
||||||
return nil, fmt.Errorf("failed to decode ffmpeg release info: %v", err)
|
return nil, fmt.Errorf("failed to decode ffmpeg release info: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &release, nil
|
return findLatestStableFFmpegRelease(releases)
|
||||||
|
}
|
||||||
|
|
||||||
|
func findLatestStableFFmpegRelease(releases []githubRelease) (*githubRelease, error) {
|
||||||
|
for index := range releases {
|
||||||
|
release := &releases[index]
|
||||||
|
if release.Draft || release.Prerelease || !strings.HasPrefix(strings.ToLower(release.TagName), strings.ToLower(ffmpegReleaseTagPrefix)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if normalizeFFmpegVersion(release.TagName) != "" {
|
||||||
|
return release, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, fmt.Errorf("no stable ffmpeg release found")
|
||||||
}
|
}
|
||||||
|
|
||||||
func newFFmpegGitHubRequest(url string) (*http.Request, error) {
|
func newFFmpegGitHubRequest(url string) (*http.Request, error) {
|
||||||
@@ -260,7 +276,7 @@ func fetchLatestFFmpegVersionFromRedirect() (string, error) {
|
|||||||
return http.ErrUseLastResponse
|
return http.ErrUseLastResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
req, err := http.NewRequest(http.MethodGet, ffmpegLatestReleaseURL, nil)
|
req, err := http.NewRequest(http.MethodGet, ffmpegFallbackReleaseURL, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("failed to create ffmpeg redirect request: %v", err)
|
return "", fmt.Errorf("failed to create ffmpeg redirect request: %v", err)
|
||||||
}
|
}
|
||||||
@@ -302,7 +318,7 @@ func parseFFmpegVersionFromReleaseURL(releaseURL string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func buildLatestFFmpegDownloadURL(assetName string) string {
|
func buildLatestFFmpegDownloadURL(assetName string) string {
|
||||||
return ffmpegLatestDownloadBaseURL + "/" + assetName
|
return ffmpegFallbackDownloadBaseURL + "/" + assetName
|
||||||
}
|
}
|
||||||
|
|
||||||
func downloadFFmpegArchive(downloadURL string, destination *os.File, progressCallback func(downloaded, total int64)) error {
|
func downloadFFmpegArchive(downloadURL string, destination *os.File, progressCallback func(downloaded, total int64)) error {
|
||||||
@@ -498,6 +514,9 @@ func normalizeFFmpegVersion(version string) string {
|
|||||||
if strings.HasPrefix(lowerVersion, "ffmpeg version ") {
|
if strings.HasPrefix(lowerVersion, "ffmpeg version ") {
|
||||||
version = strings.TrimSpace(version[len("ffmpeg version "):])
|
version = strings.TrimSpace(version[len("ffmpeg version "):])
|
||||||
}
|
}
|
||||||
|
if strings.HasPrefix(strings.ToLower(version), strings.ToLower(ffmpegReleaseTagPrefix)) {
|
||||||
|
version = version[len(ffmpegReleaseTagPrefix):]
|
||||||
|
}
|
||||||
|
|
||||||
fields := strings.Fields(version)
|
fields := strings.Fields(version)
|
||||||
if len(fields) > 0 {
|
if len(fields) > 0 {
|
||||||
|
|||||||
+2
-2
@@ -730,7 +730,7 @@ func ExtractTimeline(req TimelineRequest) (*TwitterResponse, error) {
|
|||||||
args = append(args, "--guest")
|
args = append(args, "--guest")
|
||||||
}
|
}
|
||||||
|
|
||||||
args = append(args, "--json", "--metadata")
|
args = append(args, "--json", "--metadata", "--no-discord")
|
||||||
|
|
||||||
if req.BatchSize > 0 {
|
if req.BatchSize > 0 {
|
||||||
args = append(args, "--limit", fmt.Sprintf("%d", req.BatchSize))
|
args = append(args, "--limit", fmt.Sprintf("%d", req.BatchSize))
|
||||||
@@ -840,7 +840,7 @@ func ExtractDateRange(req DateRangeRequest) (*TwitterResponse, error) {
|
|||||||
args = append(args, "--guest")
|
args = append(args, "--guest")
|
||||||
}
|
}
|
||||||
|
|
||||||
args = append(args, "--json", "--metadata")
|
args = append(args, "--json", "--metadata", "--no-discord")
|
||||||
|
|
||||||
if req.Retweets {
|
if req.Retweets {
|
||||||
args = append(args, "--retweets", "include")
|
args = append(args, "--retweets", "include")
|
||||||
|
|||||||
+27
-26
@@ -4,6 +4,7 @@
|
|||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"test": "node --experimental-strip-types --test scripts/*.test.mjs",
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc -b && vite build",
|
"build": "tsc -b && vite build",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
@@ -12,42 +13,42 @@
|
|||||||
"postinstall": "node scripts/generate-icon.js"
|
"postinstall": "node scripts/generate-icon.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@radix-ui/react-checkbox": "^1.3.5",
|
"@radix-ui/react-checkbox": "^1.3.11",
|
||||||
"@radix-ui/react-context-menu": "^2.3.1",
|
"@radix-ui/react-context-menu": "^2.3.7",
|
||||||
"@radix-ui/react-dialog": "^1.1.17",
|
"@radix-ui/react-dialog": "^1.1.23",
|
||||||
"@radix-ui/react-dropdown-menu": "^2.1.18",
|
"@radix-ui/react-dropdown-menu": "^2.1.24",
|
||||||
"@radix-ui/react-label": "^2.1.10",
|
"@radix-ui/react-label": "^2.1.15",
|
||||||
"@radix-ui/react-progress": "^1.1.10",
|
"@radix-ui/react-progress": "^1.1.16",
|
||||||
"@radix-ui/react-select": "^2.3.1",
|
"@radix-ui/react-select": "^2.3.7",
|
||||||
"@radix-ui/react-slot": "^1.3.0",
|
"@radix-ui/react-slot": "^1.3.3",
|
||||||
"@radix-ui/react-switch": "^1.3.1",
|
"@radix-ui/react-switch": "^1.3.7",
|
||||||
"@radix-ui/react-tooltip": "^1.2.10",
|
"@radix-ui/react-tooltip": "^1.2.16",
|
||||||
"@tailwindcss/vite": "^4.3.1",
|
"@tailwindcss/vite": "^4.3.3",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"lucide-react": "^0.562.0",
|
"lucide-react": "^0.562.0",
|
||||||
"motion": "^12.40.0",
|
"motion": "^12.43.0",
|
||||||
"next-themes": "^0.4.6",
|
"next-themes": "^0.4.6",
|
||||||
"react": "^19.2.7",
|
"react": "^19.2.8",
|
||||||
"react-dom": "^19.2.7",
|
"react-dom": "^19.2.8",
|
||||||
"sonner": "^2.0.7",
|
"sonner": "^2.0.8",
|
||||||
"tailwind-merge": "^3.6.0",
|
"tailwind-merge": "^3.6.0",
|
||||||
"tailwindcss": "^4.3.1"
|
"tailwindcss": "^4.3.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^10.0.1",
|
"@eslint/js": "^10.0.1",
|
||||||
"@types/node": "^26.0.0",
|
"@types/node": "^26.2.0",
|
||||||
"@types/react": "^19.2.17",
|
"@types/react": "^19.2.18",
|
||||||
"@types/react-dom": "^19.2.3",
|
"@types/react-dom": "^19.2.4",
|
||||||
"@vitejs/plugin-react": "^6.0.2",
|
"@vitejs/plugin-react": "^6.0.5",
|
||||||
"eslint": "^10.5.0",
|
"eslint": "^10.8.1",
|
||||||
"eslint-plugin-react-hooks": "^7.1.1",
|
"eslint-plugin-react-hooks": "^7.1.1",
|
||||||
"eslint-plugin-react-refresh": "^0.5.3",
|
"eslint-plugin-react-refresh": "^0.5.4",
|
||||||
"globals": "^17.6.0",
|
"globals": "^17.11.0",
|
||||||
"sharp": "^0.35.2",
|
"sharp": "^0.35.3",
|
||||||
"tw-animate-css": "^1.4.0",
|
"tw-animate-css": "^1.4.0",
|
||||||
"typescript": "~6.0.3",
|
"typescript": "~6.0.3",
|
||||||
"typescript-eslint": "^8.61.1",
|
"typescript-eslint": "^8.67.0",
|
||||||
"vite": "^8.0.16"
|
"vite": "^8.2.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1 +1 @@
|
|||||||
b9015b5860764ef52b634f74fd0f1180
|
11d903f252aa57269b096713a9fa71fe
|
||||||
Generated
+1086
-1008
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,84 @@
|
|||||||
|
import assert from "node:assert/strict";
|
||||||
|
import { test } from "node:test";
|
||||||
|
import { createFetchDelayGate, normalizeFetchDelay } from "../src/lib/fetch-delay.ts";
|
||||||
|
|
||||||
|
function clock(random = 0.5) {
|
||||||
|
let time = 0;
|
||||||
|
const waits = [];
|
||||||
|
const gate = createFetchDelayGate({
|
||||||
|
now: () => time,
|
||||||
|
random: () => random,
|
||||||
|
sleep: async (ms) => { waits.push(ms); time += ms; },
|
||||||
|
});
|
||||||
|
return { gate, waits, now: () => time, advance: (ms) => { time += ms; } };
|
||||||
|
}
|
||||||
|
|
||||||
|
test("old or invalid settings disable delay; valid settings are bounded", () => {
|
||||||
|
for (const value of [undefined, null, "5", NaN, Infinity, -1]) {
|
||||||
|
assert.equal(normalizeFetchDelay(value), 0);
|
||||||
|
}
|
||||||
|
assert.equal(normalizeFetchDelay(4000), 3600);
|
||||||
|
assert.equal(normalizeFetchDelay(1.2345), 1.235);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("first fetch starts immediately; later batches/accounts share pacing", async () => {
|
||||||
|
const c = clock();
|
||||||
|
assert.equal(await c.gate(5, 5, () => false), true);
|
||||||
|
assert.equal(c.now(), 0);
|
||||||
|
c.advance(2000); // Time spent fetching the previous batch.
|
||||||
|
assert.equal(await c.gate(5, 5, () => false), true);
|
||||||
|
assert.equal(c.now(), 7500);
|
||||||
|
await c.gate(5, 5, () => false);
|
||||||
|
assert.equal(c.now(), 15000);
|
||||||
|
assert.ok(c.waits.every((ms) => ms <= 100));
|
||||||
|
});
|
||||||
|
|
||||||
|
test("disabled pacing and a long fetch do not introduce unnecessary waits", async () => {
|
||||||
|
const c = clock();
|
||||||
|
await c.gate(0, 0, () => false);
|
||||||
|
await c.gate(0, 0, () => false);
|
||||||
|
c.advance(10000);
|
||||||
|
await c.gate(5, 0, () => false);
|
||||||
|
assert.deepEqual(c.waits, []);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("random-only pacing supports both ends of the random range", async () => {
|
||||||
|
for (const random of [0, 0.999]) {
|
||||||
|
const c = clock(random);
|
||||||
|
await c.gate(0, 5, () => false);
|
||||||
|
await c.gate(0, 5, () => false);
|
||||||
|
assert.equal(c.now(), random * 5000);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test("stop or timeout during a wait prevents the next fetch from starting", async () => {
|
||||||
|
const c = clock();
|
||||||
|
await c.gate(5, 0, () => false);
|
||||||
|
assert.equal(await c.gate(5, 0, () => c.now() >= 200), false);
|
||||||
|
assert.equal(c.now(), 200);
|
||||||
|
assert.equal(await c.gate(0, 0, () => true), false);
|
||||||
|
await c.gate(5, 0, () => false);
|
||||||
|
assert.equal(c.now(), 5000); // Cancellation did not reserve a future slot.
|
||||||
|
});
|
||||||
|
|
||||||
|
test("concurrent callers recheck the shared start time after waking", async () => {
|
||||||
|
let time = 0;
|
||||||
|
const sleepers = [];
|
||||||
|
const gate = createFetchDelayGate({
|
||||||
|
now: () => time,
|
||||||
|
random: () => 0,
|
||||||
|
sleep: () => new Promise((resolve) => sleepers.push(resolve)),
|
||||||
|
});
|
||||||
|
await gate(1, 0, () => false);
|
||||||
|
const starts = [];
|
||||||
|
const a = gate(1, 0, () => false).then(() => starts.push(time));
|
||||||
|
const b = gate(1, 0, () => false).then(() => starts.push(time));
|
||||||
|
time = 1000;
|
||||||
|
sleepers.splice(0).forEach((resolve) => resolve());
|
||||||
|
await a;
|
||||||
|
assert.deepEqual(starts, [1000]);
|
||||||
|
time = 2000;
|
||||||
|
sleepers.splice(0).forEach((resolve) => resolve());
|
||||||
|
await b;
|
||||||
|
assert.deepEqual(starts, [1000, 2000]);
|
||||||
|
});
|
||||||
+82
-21
@@ -2,11 +2,11 @@ import { useState, useEffect, useRef, useCallback } from "react";
|
|||||||
import { TooltipProvider } from "@/components/ui/tooltip";
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
||||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { ArrowLeft } from "lucide-react";
|
|
||||||
import { getSettings, applyThemeMode, applyFont } from "@/lib/settings";
|
import { getSettings, applyThemeMode, applyFont } from "@/lib/settings";
|
||||||
|
import { createFetchDelayGate } from "@/lib/fetch-delay";
|
||||||
import { applyTheme } from "@/lib/themes";
|
import { applyTheme } from "@/lib/themes";
|
||||||
import { openExternal } from "@/lib/utils";
|
import { openExternal } from "@/lib/utils";
|
||||||
import { compareVersionNumbers } from "@/lib/version";
|
import { isNewerVersion } from "@/lib/version";
|
||||||
import { toastWithSound as toast } from "@/lib/toast-with-sound";
|
import { toastWithSound as toast } from "@/lib/toast-with-sound";
|
||||||
import { logger } from "@/lib/logger";
|
import { logger } from "@/lib/logger";
|
||||||
import { initDownloadProgressEvents } from "@/lib/download-state";
|
import { initDownloadProgressEvents } from "@/lib/download-state";
|
||||||
@@ -14,6 +14,8 @@ import { saveFetchState, getFetchState, clearFetchState, getResumableInfo, merge
|
|||||||
import { TitleBar } from "@/components/TitleBar";
|
import { TitleBar } from "@/components/TitleBar";
|
||||||
import { Sidebar, type PageType } from "@/components/Sidebar";
|
import { Sidebar, type PageType } from "@/components/Sidebar";
|
||||||
import { Header } from "@/components/Header";
|
import { Header } from "@/components/Header";
|
||||||
|
import { MarkdownLite } from "@/components/MarkdownLite";
|
||||||
|
import { extractMarkdownSection } from "@/lib/markdown";
|
||||||
import { SearchBar, type FetchMode, type PrivateType, type FetchType, type MultipleAccount } from "@/components/SearchBar";
|
import { SearchBar, type FetchMode, type PrivateType, type FetchType, type MultipleAccount } from "@/components/SearchBar";
|
||||||
import { MediaList } from "@/components/MediaList";
|
import { MediaList } from "@/components/MediaList";
|
||||||
import { DatabaseView } from "@/components/DatabaseView";
|
import { DatabaseView } from "@/components/DatabaseView";
|
||||||
@@ -28,6 +30,7 @@ const HISTORY_KEY = "twitter_media_fetch_history";
|
|||||||
const MAX_HISTORY = 10;
|
const MAX_HISTORY = 10;
|
||||||
const CURRENT_VERSION = __APP_VERSION__;
|
const CURRENT_VERSION = __APP_VERSION__;
|
||||||
const BATCH_SIZE = 100;
|
const BATCH_SIZE = 100;
|
||||||
|
const waitForFetch = createFetchDelayGate();
|
||||||
function formatNumberWithComma(num: number): string {
|
function formatNumberWithComma(num: number): string {
|
||||||
return num.toLocaleString();
|
return num.toLocaleString();
|
||||||
}
|
}
|
||||||
@@ -57,6 +60,12 @@ function App() {
|
|||||||
const [fetchedMediaType, setFetchedMediaType] = useState<string>("all");
|
const [fetchedMediaType, setFetchedMediaType] = useState<string>("all");
|
||||||
const [hasUpdate, setHasUpdate] = useState(false);
|
const [hasUpdate, setHasUpdate] = useState(false);
|
||||||
const [releaseDate, setReleaseDate] = useState<string | null>(null);
|
const [releaseDate, setReleaseDate] = useState<string | null>(null);
|
||||||
|
const [updateInfo, setUpdateInfo] = useState<{
|
||||||
|
version: string;
|
||||||
|
changelog: string;
|
||||||
|
url: string;
|
||||||
|
} | null>(null);
|
||||||
|
const [showUpdateDialog, setShowUpdateDialog] = useState(false);
|
||||||
const [fetchHistory, setFetchHistory] = useState<HistoryItem[]>([]);
|
const [fetchHistory, setFetchHistory] = useState<HistoryItem[]>([]);
|
||||||
const [resumeInfo, setResumeInfo] = useState<{
|
const [resumeInfo, setResumeInfo] = useState<{
|
||||||
canResume: boolean;
|
canResume: boolean;
|
||||||
@@ -69,6 +78,7 @@ function App() {
|
|||||||
const fetchStartTimeRef = useRef<number | null>(null);
|
const fetchStartTimeRef = useRef<number | null>(null);
|
||||||
const timeoutIntervalRef = useRef<number | null>(null);
|
const timeoutIntervalRef = useRef<number | null>(null);
|
||||||
const [fetchType, setFetchType] = useState<FetchType>("single");
|
const [fetchType, setFetchType] = useState<FetchType>("single");
|
||||||
|
const [isResultViewActive, setIsResultViewActive] = useState(false);
|
||||||
const [multipleAccounts, setMultipleAccounts] = useState<MultipleAccount[]>([]);
|
const [multipleAccounts, setMultipleAccounts] = useState<MultipleAccount[]>([]);
|
||||||
const [isFetchingAll, setIsFetchingAll] = useState(false);
|
const [isFetchingAll, setIsFetchingAll] = useState(false);
|
||||||
const [searchMode, setSearchMode] = useState<FetchMode>("public");
|
const [searchMode, setSearchMode] = useState<FetchMode>("public");
|
||||||
@@ -84,6 +94,9 @@ function App() {
|
|||||||
const accountMediaCountRef = useRef<Map<string, number>>(new Map());
|
const accountMediaCountRef = useRef<Map<string, number>>(new Map());
|
||||||
const accountTimeoutSecondsRef = useRef<Map<string, number>>(new Map());
|
const accountTimeoutSecondsRef = useRef<Map<string, number>>(new Map());
|
||||||
const dbSaveWarningShownRef = useRef(false);
|
const dbSaveWarningShownRef = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
setIsResultViewActive(result !== null && fetchType === "single");
|
||||||
|
}, [result, fetchType]);
|
||||||
const reportDatabaseSaveError = (scope: string, error: unknown) => {
|
const reportDatabaseSaveError = (scope: string, error: unknown) => {
|
||||||
console.error(`Failed to save ${scope} to database:`, error);
|
console.error(`Failed to save ${scope} to database:`, error);
|
||||||
if (!dbSaveWarningShownRef.current) {
|
if (!dbSaveWarningShownRef.current) {
|
||||||
@@ -155,14 +168,14 @@ function App() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const settings = getSettings();
|
const settings = getSettings();
|
||||||
applyThemeMode(settings.themeMode);
|
applyThemeMode(settings.themeMode);
|
||||||
applyTheme(settings.theme);
|
applyTheme(settings.theme, settings.baseColor);
|
||||||
applyFont(settings.fontFamily, settings.customFonts);
|
applyFont(settings.fontFamily, settings.customFonts);
|
||||||
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
||||||
const handleChange = () => {
|
const handleChange = () => {
|
||||||
const currentSettings = getSettings();
|
const currentSettings = getSettings();
|
||||||
if (currentSettings.themeMode === "auto") {
|
if (currentSettings.themeMode === "auto") {
|
||||||
applyThemeMode("auto");
|
applyThemeMode("auto");
|
||||||
applyTheme(currentSettings.theme);
|
applyTheme(currentSettings.theme, currentSettings.baseColor);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mediaQuery.addEventListener("change", handleChange);
|
mediaQuery.addEventListener("change", handleChange);
|
||||||
@@ -210,13 +223,27 @@ function App() {
|
|||||||
const checkForUpdates = async () => {
|
const checkForUpdates = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch("https://api.github.com/repos/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/latest");
|
const response = await fetch("https://api.github.com/repos/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/latest");
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error(`GitHub release request failed: ${response.status}`);
|
||||||
|
}
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
const latestVersion = data.tag_name?.replace(/^v/, "") || "";
|
const rawTag = typeof data.tag_name === "string" ? data.tag_name : "";
|
||||||
|
const latestVersion = rawTag.replace(/^v/, "");
|
||||||
if (data.published_at) {
|
if (data.published_at) {
|
||||||
setReleaseDate(data.published_at);
|
setReleaseDate(data.published_at);
|
||||||
}
|
}
|
||||||
if (latestVersion && compareVersionNumbers(latestVersion, CURRENT_VERSION) > 0) {
|
if (latestVersion && isNewerVersion(latestVersion, CURRENT_VERSION)) {
|
||||||
setHasUpdate(true);
|
setHasUpdate(true);
|
||||||
|
setUpdateInfo({
|
||||||
|
version: latestVersion,
|
||||||
|
changelog: extractMarkdownSection(typeof data.body === "string" ? data.body : "", "Changelog"),
|
||||||
|
url: typeof data.html_url === "string" && data.html_url
|
||||||
|
? data.html_url
|
||||||
|
: `https://github.com/afkarxyz/Twitter-X-Media-Batch-Downloader/releases/tag/${encodeURIComponent(rawTag)}`,
|
||||||
|
});
|
||||||
|
if (getSettings().showUpdateNotifications) {
|
||||||
|
setShowUpdateDialog(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@@ -421,6 +448,7 @@ function App() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!await waitForFetch(settings.fetchDelaySeconds, settings.fetchDelayJitterSeconds, () => stopFetchRef.current)) return;
|
||||||
const response = await ExtractDateRange({
|
const response = await ExtractDateRange({
|
||||||
username: username.trim(),
|
username: username.trim(),
|
||||||
auth_token: authToken.trim(),
|
auth_token: authToken.trim(),
|
||||||
@@ -497,6 +525,7 @@ function App() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const batchNum = page + 1;
|
const batchNum = page + 1;
|
||||||
|
if (!await waitForFetch(settings.fetchDelaySeconds, settings.fetchDelayJitterSeconds, () => stopFetchRef.current)) break;
|
||||||
logger.info(`Fetching batch ${batchNum}${cursor ? " (resuming)" : ""}...`);
|
logger.info(`Fetching batch ${batchNum}${cursor ? " (resuming)" : ""}...`);
|
||||||
const response = await ExtractTimeline({
|
const response = await ExtractTimeline({
|
||||||
username: isBookmarks ? "" : username.trim(),
|
username: isBookmarks ? "" : username.trim(),
|
||||||
@@ -714,13 +743,20 @@ function App() {
|
|||||||
toast.error("Failed to parse saved data");
|
toast.error("Failed to parse saved data");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const handleBackToHomeResult = () => {
|
const scrollContentToTop = () => {
|
||||||
setCurrentPage("main");
|
|
||||||
setResult(null);
|
|
||||||
setNewMediaCount(null);
|
|
||||||
const scrollElement = document.getElementById("app-content-scroll");
|
const scrollElement = document.getElementById("app-content-scroll");
|
||||||
scrollElement?.scrollTo({ top: 0, behavior: "smooth" });
|
scrollElement?.scrollTo({ top: 0, behavior: "smooth" });
|
||||||
};
|
};
|
||||||
|
const handleResultBack = () => {
|
||||||
|
setIsResultViewActive(false);
|
||||||
|
scrollContentToTop();
|
||||||
|
};
|
||||||
|
const handleResultForward = () => {
|
||||||
|
if (result && fetchType === "single") {
|
||||||
|
setIsResultViewActive(true);
|
||||||
|
scrollContentToTop();
|
||||||
|
}
|
||||||
|
};
|
||||||
const parseUsername = (input: string): string => {
|
const parseUsername = (input: string): string => {
|
||||||
let clean = input.trim();
|
let clean = input.trim();
|
||||||
if (clean.startsWith("@")) {
|
if (clean.startsWith("@")) {
|
||||||
@@ -945,6 +981,7 @@ function App() {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!await waitForFetch(settings.fetchDelaySeconds, settings.fetchDelayJitterSeconds, () => stopAllRef.current || !!accountStopFlagsRef.current.get(accountId))) break;
|
||||||
const response = await ExtractTimeline({
|
const response = await ExtractTimeline({
|
||||||
username: cleanUsername,
|
username: cleanUsername,
|
||||||
auth_token: authToken.trim(),
|
auth_token: authToken.trim(),
|
||||||
@@ -1156,7 +1193,7 @@ function App() {
|
|||||||
}
|
}
|
||||||
const savedSettings = getSettings();
|
const savedSettings = getSettings();
|
||||||
applyThemeMode(savedSettings.themeMode);
|
applyThemeMode(savedSettings.themeMode);
|
||||||
applyTheme(savedSettings.theme);
|
applyTheme(savedSettings.theme, savedSettings.baseColor);
|
||||||
applyFont(savedSettings.fontFamily, savedSettings.customFonts);
|
applyFont(savedSettings.fontFamily, savedSettings.customFonts);
|
||||||
setHasUnsavedSettings(false);
|
setHasUnsavedSettings(false);
|
||||||
if (pendingPageChange) {
|
if (pendingPageChange) {
|
||||||
@@ -1304,6 +1341,7 @@ function App() {
|
|||||||
if (accountStopFlagsRef.current.get(accountId)) {
|
if (accountStopFlagsRef.current.get(accountId)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!await waitForFetch(settings.fetchDelaySeconds, settings.fetchDelayJitterSeconds, () => stopAllRef.current || !!accountStopFlagsRef.current.get(accountId))) break;
|
||||||
const response = await ExtractTimeline({
|
const response = await ExtractTimeline({
|
||||||
username: cleanUsername,
|
username: cleanUsername,
|
||||||
auth_token: authToken.trim(),
|
auth_token: authToken.trim(),
|
||||||
@@ -1474,6 +1512,7 @@ function App() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
const renderPage = () => {
|
const renderPage = () => {
|
||||||
|
const showSingleResult = isResultViewActive && result !== null && fetchType === "single";
|
||||||
switch (currentPage) {
|
switch (currentPage) {
|
||||||
case "settings":
|
case "settings":
|
||||||
return <SettingsPage onUnsavedChangesChange={setHasUnsavedSettings} onResetRequest={setResetSettingsFn}/>;
|
return <SettingsPage onUnsavedChangesChange={setHasUnsavedSettings} onResetRequest={setResetSettingsFn}/>;
|
||||||
@@ -1487,32 +1526,27 @@ function App() {
|
|||||||
return (<>
|
return (<>
|
||||||
<Header version={CURRENT_VERSION} hasUpdate={hasUpdate} releaseDate={releaseDate}/>
|
<Header version={CURRENT_VERSION} hasUpdate={hasUpdate} releaseDate={releaseDate}/>
|
||||||
|
|
||||||
<SearchBar username={username} loading={loading} onUsernameChange={setUsername} onFetch={handleFetch} onStopFetch={handleStopFetch} onResume={handleResume} onClearResume={handleClearResume} resumeInfo={resumeInfo} history={fetchHistory} onHistorySelect={handleHistorySelect} onHistoryRemove={removeFromHistory} hasResult={!!result} elapsedTime={elapsedTime} remainingTime={remainingTime} fetchType={fetchType} onFetchTypeChange={handleFetchTypeChange} multipleAccounts={multipleAccounts} onImportAccounts={handleImportAccounts} onFetchAll={handleFetchAll} onStopAll={handleStopAll} onStopAccount={handleStopAccount} onRetryAccount={handleRetryAccount} onClearMultipleAccounts={handleClearMultipleAccounts} onRemoveMultipleAccount={handleRemoveMultipleAccount} onOpenSavedAccounts={() => setCurrentPage("database")} isFetchingAll={isFetchingAll} mode={searchMode} privateType={searchPrivateType} onModeChange={(mode, privateType) => {
|
<SearchBar username={username} loading={loading} onUsernameChange={setUsername} onFetch={handleFetch} onStopFetch={handleStopFetch} onResume={handleResume} onClearResume={handleClearResume} resumeInfo={resumeInfo} history={fetchHistory} onHistorySelect={handleHistorySelect} onHistoryRemove={removeFromHistory} hasResult={showSingleResult} elapsedTime={elapsedTime} remainingTime={remainingTime} fetchType={fetchType} onFetchTypeChange={handleFetchTypeChange} multipleAccounts={multipleAccounts} onImportAccounts={handleImportAccounts} onFetchAll={handleFetchAll} onStopAll={handleStopAll} onStopAccount={handleStopAccount} onRetryAccount={handleRetryAccount} onClearMultipleAccounts={handleClearMultipleAccounts} onRemoveMultipleAccount={handleRemoveMultipleAccount} onOpenSavedAccounts={() => setCurrentPage("database")} isFetchingAll={isFetchingAll} mode={searchMode} privateType={searchPrivateType} onModeChange={(mode, privateType) => {
|
||||||
setSearchMode(mode);
|
setSearchMode(mode);
|
||||||
if (privateType) {
|
if (privateType) {
|
||||||
setSearchPrivateType(privateType);
|
setSearchPrivateType(privateType);
|
||||||
}
|
}
|
||||||
}}/>
|
}}/>
|
||||||
|
|
||||||
{result && fetchType === "single" && (<div className="mt-4 space-y-3">
|
{showSingleResult && result && (<div className="mt-4 space-y-3">
|
||||||
<div className="flex justify-start">
|
|
||||||
<Button variant="outline" onClick={handleBackToHomeResult} className="flex items-center gap-2">
|
|
||||||
<ArrowLeft className="h-4 w-4"/>
|
|
||||||
Back to Home
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<MediaList accountInfo={result.account_info} timeline={result.timeline} totalUrls={result.total_urls} fetchedMediaType={fetchedMediaType} newMediaCount={newMediaCount}/>
|
<MediaList accountInfo={result.account_info} timeline={result.timeline} totalUrls={result.total_urls} fetchedMediaType={fetchedMediaType} newMediaCount={newMediaCount}/>
|
||||||
</div>)}
|
</div>)}
|
||||||
</>);
|
</>);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const hasNavigableResult = result !== null && fetchType === "single";
|
||||||
const usesWideContent = currentPage === "main"
|
const usesWideContent = currentPage === "main"
|
||||||
? fetchType === "multiple" || !!result
|
? fetchType === "multiple" || (hasNavigableResult && isResultViewActive)
|
||||||
: !["settings", "support"].includes(currentPage);
|
: !["settings", "support"].includes(currentPage);
|
||||||
return (<TooltipProvider>
|
return (<TooltipProvider>
|
||||||
<div className="h-screen overflow-hidden bg-background">
|
<div className="h-screen overflow-hidden bg-background">
|
||||||
<DependencySetupDialog />
|
<DependencySetupDialog />
|
||||||
<TitleBar />
|
<TitleBar canGoBack={currentPage === "main" && hasNavigableResult && isResultViewActive} canGoForward={currentPage === "main" && hasNavigableResult && !isResultViewActive} navigationDisabled={loading} onBack={handleResultBack} onForward={handleResultForward}/>
|
||||||
<Sidebar currentPage={currentPage} onPageChange={handlePageChange}/>
|
<Sidebar currentPage={currentPage} onPageChange={handlePageChange}/>
|
||||||
|
|
||||||
<div id="app-content-scroll" className="fixed top-10 right-0 bottom-0 left-14 overflow-y-auto overflow-x-hidden">
|
<div id="app-content-scroll" className="fixed top-10 right-0 bottom-0 left-14 overflow-y-auto overflow-x-hidden">
|
||||||
@@ -1523,6 +1557,33 @@ function App() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Dialog open={showUpdateDialog} onOpenChange={setShowUpdateDialog}>
|
||||||
|
<DialogContent className="sm:max-w-125 [&>button]:hidden">
|
||||||
|
<DialogHeader>
|
||||||
|
<DialogTitle>Update Available</DialogTitle>
|
||||||
|
<DialogDescription>
|
||||||
|
A new version (v{updateInfo?.version || ""}) is available. You're on v{CURRENT_VERSION}
|
||||||
|
</DialogDescription>
|
||||||
|
</DialogHeader>
|
||||||
|
{updateInfo?.changelog ? (<div className="custom-scrollbar max-h-72 overflow-y-auto rounded-md border bg-muted/40 p-3">
|
||||||
|
<MarkdownLite content={updateInfo.changelog}/>
|
||||||
|
</div>) : (<p className="text-sm text-muted-foreground">No changelog was provided for this release.</p>)}
|
||||||
|
<DialogFooter className="gap-2">
|
||||||
|
<Button variant="outline" onClick={() => setShowUpdateDialog(false)}>
|
||||||
|
Download Later
|
||||||
|
</Button>
|
||||||
|
<Button onClick={() => {
|
||||||
|
if (updateInfo) {
|
||||||
|
openExternal(updateInfo.url);
|
||||||
|
}
|
||||||
|
setShowUpdateDialog(false);
|
||||||
|
}}>
|
||||||
|
Download Now
|
||||||
|
</Button>
|
||||||
|
</DialogFooter>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
<Dialog open={showUnsavedChangesDialog} onOpenChange={(open) => {
|
<Dialog open={showUnsavedChangesDialog} onOpenChange={(open) => {
|
||||||
if (open) {
|
if (open) {
|
||||||
setShowUnsavedChangesDialog(true);
|
setShowUnsavedChangesDialog(true);
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
|||||||
localStorage.setItem("savedAccountsViewMode", gridView);
|
localStorage.setItem("savedAccountsViewMode", gridView);
|
||||||
}, [gridView]);
|
}, [gridView]);
|
||||||
const [editingAccount, setEditingAccount] = useState<AccountListItem | null>(null);
|
const [editingAccount, setEditingAccount] = useState<AccountListItem | null>(null);
|
||||||
|
const [isBulkGroupEditing, setIsBulkGroupEditing] = useState(false);
|
||||||
const [editGroupName, setEditGroupName] = useState("");
|
const [editGroupName, setEditGroupName] = useState("");
|
||||||
const [editGroupColor, setEditGroupColor] = useState("");
|
const [editGroupColor, setEditGroupColor] = useState("");
|
||||||
const [clearAllDialogOpen, setClearAllDialogOpen] = useState(false);
|
const [clearAllDialogOpen, setClearAllDialogOpen] = useState(false);
|
||||||
@@ -277,18 +278,53 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
|||||||
};
|
};
|
||||||
}, [filteredAccounts.length, visibleCount, loading]);
|
}, [filteredAccounts.length, visibleCount, loading]);
|
||||||
const handleEditGroup = (account: AccountListItem) => {
|
const handleEditGroup = (account: AccountListItem) => {
|
||||||
|
setIsBulkGroupEditing(false);
|
||||||
setEditingAccount(account);
|
setEditingAccount(account);
|
||||||
setEditGroupName(account.group_name || "");
|
setEditGroupName(account.group_name || "");
|
||||||
setEditGroupColor(account.group_color || "#3b82f6");
|
setEditGroupColor(account.group_color || "#3b82f6");
|
||||||
};
|
};
|
||||||
|
const closeGroupEditor = () => {
|
||||||
|
setEditingAccount(null);
|
||||||
|
setIsBulkGroupEditing(false);
|
||||||
|
};
|
||||||
|
const handleBulkEditGroup = () => {
|
||||||
|
const selectedAccounts = accounts.filter((account) => selectedIds.has(account.id) && !isPrivateAccount(account.username));
|
||||||
|
if (selectedAccounts.length === 0) {
|
||||||
|
toast.error("No public accounts selected");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const firstAccount = selectedAccounts[0];
|
||||||
|
const hasSharedGroup = selectedAccounts.every((account) => account.group_name === firstAccount.group_name && account.group_color === firstAccount.group_color);
|
||||||
|
setEditingAccount(null);
|
||||||
|
setEditGroupName(hasSharedGroup ? firstAccount.group_name || "" : "");
|
||||||
|
setEditGroupColor(hasSharedGroup ? firstAccount.group_color || "#3b82f6" : "#3b82f6");
|
||||||
|
setIsBulkGroupEditing(true);
|
||||||
|
};
|
||||||
const handleSaveGroup = async () => {
|
const handleSaveGroup = async () => {
|
||||||
if (!editingAccount)
|
const targetAccounts = isBulkGroupEditing
|
||||||
|
? accounts.filter((account) => selectedIds.has(account.id) && !isPrivateAccount(account.username))
|
||||||
|
: editingAccount ? [editingAccount] : [];
|
||||||
|
if (targetAccounts.length === 0)
|
||||||
return;
|
return;
|
||||||
try {
|
try {
|
||||||
await UpdateAccountGroup(editingAccount.id, editGroupName, editGroupColor);
|
for (const account of targetAccounts) {
|
||||||
toast.success(`Updated group for @${editingAccount.username}`);
|
await UpdateAccountGroup(account.id, editGroupName, editGroupColor);
|
||||||
setEditingAccount(null);
|
}
|
||||||
await loadAccounts();
|
const targetIds = new Set(targetAccounts.map((account) => account.id));
|
||||||
|
setAccounts((currentAccounts) => currentAccounts.map((account) => targetIds.has(account.id)
|
||||||
|
? { ...account, group_name: editGroupName, group_color: editGroupColor }
|
||||||
|
: account));
|
||||||
|
toast.success(isBulkGroupEditing
|
||||||
|
? `Updated group for ${formatNumberWithComma(targetAccounts.length)} accounts`
|
||||||
|
: `Updated group for @${targetAccounts[0].username}`);
|
||||||
|
closeGroupEditor();
|
||||||
|
try {
|
||||||
|
const groupsData = await GetAllGroups();
|
||||||
|
setGroups((groupsData || []).map((group) => ({ name: group.name || "", color: group.color || "" })));
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.error("Failed to refresh groups:", error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
console.error("Failed to update group:", error);
|
console.error("Failed to update group:", error);
|
||||||
@@ -388,6 +424,9 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
|||||||
skip_existing: settings.skipExistingFiles,
|
skip_existing: settings.skipExistingFiles,
|
||||||
delete_incomplete_files: settings.deleteIncompleteFiles,
|
delete_incomplete_files: settings.deleteIncompleteFiles,
|
||||||
retry_attempts: settings.retryAttempts,
|
retry_attempts: settings.retryAttempts,
|
||||||
|
download_speed_limit_kbps: settings.downloadSpeedLimitKBps,
|
||||||
|
download_delay_ms: Math.round(settings.downloadDelaySeconds * 1000),
|
||||||
|
download_delay_jitter_ms: Math.round(settings.downloadDelayJitterSeconds * 1000),
|
||||||
proxy: settings.proxy || "",
|
proxy: settings.proxy || "",
|
||||||
filename_template: settings.filenameTemplate || "",
|
filename_template: settings.filenameTemplate || "",
|
||||||
folder_template: settings.folderTemplate || "",
|
folder_template: settings.folderTemplate || "",
|
||||||
@@ -513,6 +552,9 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
|||||||
skip_existing: settings.skipExistingFiles,
|
skip_existing: settings.skipExistingFiles,
|
||||||
delete_incomplete_files: settings.deleteIncompleteFiles,
|
delete_incomplete_files: settings.deleteIncompleteFiles,
|
||||||
retry_attempts: settings.retryAttempts,
|
retry_attempts: settings.retryAttempts,
|
||||||
|
download_speed_limit_kbps: settings.downloadSpeedLimitKBps,
|
||||||
|
download_delay_ms: Math.round(settings.downloadDelaySeconds * 1000),
|
||||||
|
download_delay_jitter_ms: Math.round(settings.downloadDelayJitterSeconds * 1000),
|
||||||
proxy: settings.proxy || "",
|
proxy: settings.proxy || "",
|
||||||
filename_template: settings.filenameTemplate || "",
|
filename_template: settings.filenameTemplate || "",
|
||||||
folder_template: settings.folderTemplate || "",
|
folder_template: settings.folderTemplate || "",
|
||||||
@@ -795,6 +837,14 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
|||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
|
<Tooltip>
|
||||||
|
<TooltipTrigger asChild>
|
||||||
|
<Button variant="outline" size="icon" onClick={handleBulkEditGroup} disabled={selectedIds.size === 0 || hasPrivateAccountSelected()}>
|
||||||
|
<Tag className="h-4 w-4"/>
|
||||||
|
</Button>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent>Edit Group for Selected ({formatNumberWithComma(selectedIds.size)})</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Button variant="outline" size="icon" onClick={() => {
|
<Button variant="outline" size="icon" onClick={() => {
|
||||||
@@ -1028,7 +1078,7 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
|||||||
.slice(0, visibleCount)
|
.slice(0, visibleCount)
|
||||||
.map((account, index) => (<div key={account.id} onClick={() => handleView(account.id, account.username)} className={`relative rounded-lg border transition-colors p-4 cursor-pointer ${selectedIds.has(account.id) ? "border-primary bg-primary/5" : "bg-card hover:bg-muted/50"}`}>
|
.map((account, index) => (<div key={account.id} onClick={() => handleView(account.id, account.username)} className={`relative rounded-lg border transition-colors p-4 cursor-pointer ${selectedIds.has(account.id) ? "border-primary bg-primary/5" : "bg-card hover:bg-muted/50"}`}>
|
||||||
|
|
||||||
<Checkbox checked={selectedIds.has(account.id)} onCheckedChange={() => toggleSelect(account.id)} onClick={(e) => e.stopPropagation()} className="absolute top-2 left-2 z-10"/>
|
<Checkbox checked={selectedIds.has(account.id)} onCheckedChange={() => toggleSelect(account.id)} onClick={(e) => e.stopPropagation()} className="absolute top-2 left-2 z-10 size-5 cursor-pointer after:absolute after:-inset-2 after:content-['']" aria-label={`Select @${account.username}`}/>
|
||||||
|
|
||||||
<div className="absolute top-2 right-2 z-10 flex gap-1">
|
<div className="absolute top-2 right-2 z-10 flex gap-1">
|
||||||
<Badge variant="secondary" className={cn("text-xs flex items-center gap-1", account.media_type === "text" && "bg-orange-500/20 text-orange-600 dark:text-orange-400", account.media_type === "image" && "bg-blue-500/20 text-blue-600 dark:text-blue-400", account.media_type === "video" && "bg-purple-500/20 text-purple-600 dark:text-purple-400", account.media_type === "gif" && "bg-green-500/20 text-green-600 dark:text-green-400", (!account.media_type || account.media_type === "all") && "bg-indigo-500/20 text-indigo-600 dark:text-indigo-400")}>
|
<Badge variant="secondary" className={cn("text-xs flex items-center gap-1", account.media_type === "text" && "bg-orange-500/20 text-orange-600 dark:text-orange-400", account.media_type === "image" && "bg-blue-500/20 text-blue-600 dark:text-blue-400", account.media_type === "video" && "bg-purple-500/20 text-purple-600 dark:text-purple-400", account.media_type === "gif" && "bg-green-500/20 text-green-600 dark:text-green-400", (!account.media_type || account.media_type === "all") && "bg-indigo-500/20 text-indigo-600 dark:text-indigo-400")}>
|
||||||
@@ -1125,7 +1175,7 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
|||||||
.slice(0, visibleCount)
|
.slice(0, visibleCount)
|
||||||
.map((account, index) => (<div key={account.id} onClick={() => handleView(account.id, account.username)} className={`relative rounded-lg border transition-colors p-3 cursor-pointer ${selectedIds.has(account.id) ? "border-primary bg-primary/5" : "bg-card hover:bg-muted/50"}`}>
|
.map((account, index) => (<div key={account.id} onClick={() => handleView(account.id, account.username)} className={`relative rounded-lg border transition-colors p-3 cursor-pointer ${selectedIds.has(account.id) ? "border-primary bg-primary/5" : "bg-card hover:bg-muted/50"}`}>
|
||||||
|
|
||||||
<Checkbox checked={selectedIds.has(account.id)} onCheckedChange={() => toggleSelect(account.id)} onClick={(e) => e.stopPropagation()} className="absolute top-1.5 left-1.5 z-10"/>
|
<Checkbox checked={selectedIds.has(account.id)} onCheckedChange={() => toggleSelect(account.id)} onClick={(e) => e.stopPropagation()} className="absolute top-1.5 left-1.5 z-10 size-5 cursor-pointer after:absolute after:-inset-2 after:content-['']" aria-label={`Select @${account.username}`}/>
|
||||||
|
|
||||||
<div className="absolute top-1.5 right-1.5 z-10 flex gap-1">
|
<div className="absolute top-1.5 right-1.5 z-10 flex gap-1">
|
||||||
<Badge variant="secondary" className={cn("text-xs p-1", account.media_type === "text" && "bg-orange-500/20 text-orange-600 dark:text-orange-400", account.media_type === "image" && "bg-blue-500/20 text-blue-600 dark:text-blue-400", account.media_type === "video" && "bg-purple-500/20 text-purple-600 dark:text-purple-400", account.media_type === "gif" && "bg-green-500/20 text-green-600 dark:text-green-400", (!account.media_type || account.media_type === "all") && "bg-indigo-500/20 text-indigo-600 dark:text-indigo-400")}>
|
<Badge variant="secondary" className={cn("text-xs p-1", account.media_type === "text" && "bg-orange-500/20 text-orange-600 dark:text-orange-400", account.media_type === "image" && "bg-blue-500/20 text-blue-600 dark:text-blue-400", account.media_type === "video" && "bg-purple-500/20 text-purple-600 dark:text-purple-400", account.media_type === "gif" && "bg-green-500/20 text-green-600 dark:text-green-400", (!account.media_type || account.media_type === "all") && "bg-indigo-500/20 text-indigo-600 dark:text-indigo-400")}>
|
||||||
@@ -1221,7 +1271,7 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
|||||||
.slice(0, visibleCount)
|
.slice(0, visibleCount)
|
||||||
.map((account, index) => (<div key={account.id} className={`rounded-lg border transition-colors ${selectedIds.has(account.id) ? "border-primary bg-primary/5" : "bg-card hover:bg-muted/50"}`}>
|
.map((account, index) => (<div key={account.id} className={`rounded-lg border transition-colors ${selectedIds.has(account.id) ? "border-primary bg-primary/5" : "bg-card hover:bg-muted/50"}`}>
|
||||||
<div className="flex items-center gap-4 p-4 cursor-pointer" onClick={() => handleView(account.id, account.username)}>
|
<div className="flex items-center gap-4 p-4 cursor-pointer" onClick={() => handleView(account.id, account.username)}>
|
||||||
<Checkbox checked={selectedIds.has(account.id)} onCheckedChange={() => toggleSelect(account.id)} onClick={(e) => e.stopPropagation()}/>
|
<Checkbox checked={selectedIds.has(account.id)} onCheckedChange={() => toggleSelect(account.id)} onClick={(e) => e.stopPropagation()} className="relative size-5 cursor-pointer after:absolute after:-inset-2 after:content-['']" aria-label={`Select @${account.username}`}/>
|
||||||
<div className="relative shrink-0">
|
<div className="relative shrink-0">
|
||||||
<span className="absolute -top-1.5 -left-1.5 z-10 flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-xs font-medium text-primary-foreground">
|
<span className="absolute -top-1.5 -left-1.5 z-10 flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-xs font-medium text-primary-foreground">
|
||||||
{index + 1}
|
{index + 1}
|
||||||
@@ -1387,17 +1437,19 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
|||||||
</Button>)}
|
</Button>)}
|
||||||
|
|
||||||
|
|
||||||
<Dialog open={!!editingAccount} onOpenChange={(open) => !open && setEditingAccount(null)}>
|
<Dialog open={isBulkGroupEditing || !!editingAccount} onOpenChange={(open) => !open && closeGroupEditor()}>
|
||||||
<DialogContent className="[&>button]:hidden">
|
<DialogContent className="[&>button]:hidden">
|
||||||
<div className="absolute right-4 top-4">
|
<div className="absolute right-4 top-4">
|
||||||
<Button variant="ghost" size="icon" className="h-6 w-6 opacity-70 hover:opacity-100" onClick={() => setEditingAccount(null)}>
|
<Button variant="ghost" size="icon" className="h-6 w-6 opacity-70 hover:opacity-100" onClick={closeGroupEditor}>
|
||||||
<X className="h-4 w-4"/>
|
<X className="h-4 w-4"/>
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<DialogHeader>
|
<DialogHeader>
|
||||||
<DialogTitle>Edit Group for @{editingAccount?.username}</DialogTitle>
|
<DialogTitle>{isBulkGroupEditing
|
||||||
|
? `Edit Group for ${formatNumberWithComma(selectedIds.size)} Selected Accounts`
|
||||||
|
: `Edit Group for @${editingAccount?.username}`}</DialogTitle>
|
||||||
<DialogDescription>
|
<DialogDescription>
|
||||||
Assign this account to a group for better organization.
|
Assign {isBulkGroupEditing ? "these accounts" : "this account"} to a group for better organization.
|
||||||
</DialogDescription>
|
</DialogDescription>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<div className="space-y-4 py-4">
|
<div className="space-y-4 py-4">
|
||||||
@@ -1459,7 +1511,7 @@ export function DatabaseView({ onLoadAccount, onUpdateSelected }: DatabaseViewPr
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<DialogFooter>
|
<DialogFooter>
|
||||||
<Button variant="outline" onClick={() => setEditingAccount(null)}>
|
<Button variant="outline" onClick={closeGroupEditor}>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
<Button onClick={handleSaveGroup}>
|
<Button onClick={handleSaveGroup}>
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { useState, useEffect, useRef } from "react";
|
import { useState, useEffect, useRef } from "react";
|
||||||
import { Trash2, Copy, Check } from "lucide-react";
|
import { Trash2, Copy, CircleCheck, FileDown } from "lucide-react";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { logger, type LogEntry } from "@/lib/logger";
|
import { logger, type LogEntry } from "@/lib/logger";
|
||||||
|
import { ExportFailedLogs } from "../../wailsjs/go/main/App";
|
||||||
|
import { toastWithSound as toast } from "@/lib/toast-with-sound";
|
||||||
const levelColors: Record<string, string> = {
|
const levelColors: Record<string, string> = {
|
||||||
info: "text-blue-500",
|
info: "text-blue-500",
|
||||||
success: "text-green-500",
|
success: "text-green-500",
|
||||||
@@ -21,6 +23,7 @@ export function DebugLoggerPage() {
|
|||||||
const [logs, setLogs] = useState<LogEntry[]>(() => logger.getLogs());
|
const [logs, setLogs] = useState<LogEntry[]>(() => logger.getLogs());
|
||||||
const [copied, setCopied] = useState(false);
|
const [copied, setCopied] = useState(false);
|
||||||
const scrollRef = useRef<HTMLDivElement>(null);
|
const scrollRef = useRef<HTMLDivElement>(null);
|
||||||
|
const failedLogs = logs.filter((log) => log.level === "error");
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const unsubscribe = logger.subscribe(() => {
|
const unsubscribe = logger.subscribe(() => {
|
||||||
setLogs(logger.getLogs());
|
setLogs(logger.getLogs());
|
||||||
@@ -50,22 +53,49 @@ export function DebugLoggerPage() {
|
|||||||
console.error("Failed to copy logs:", err);
|
console.error("Failed to copy logs:", err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const handleExportFailed = async () => {
|
||||||
|
if (failedLogs.length === 0) {
|
||||||
|
toast.info("No failed logs to export");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const lines = [
|
||||||
|
`Failed Logs Report - ${new Date().toLocaleString()}`,
|
||||||
|
"-".repeat(50),
|
||||||
|
"",
|
||||||
|
...failedLogs.map((log) => `[${formatTime(log.timestamp)}] [${log.level}] ${log.message}`),
|
||||||
|
"",
|
||||||
|
];
|
||||||
|
try {
|
||||||
|
const path = await ExportFailedLogs(lines.join("\n"));
|
||||||
|
if (path) {
|
||||||
|
toast.success(`Exported ${failedLogs.length} failed log${failedLogs.length === 1 ? "" : "s"}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
console.error("Failed to export logs:", error);
|
||||||
|
toast.error(`Failed to export logs: ${error}`);
|
||||||
|
}
|
||||||
|
};
|
||||||
return (<div className="space-y-6">
|
return (<div className="space-y-6">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<h1 className="text-2xl font-bold">Debug Logs</h1>
|
<h1 className="text-2xl font-bold">Debug Logs</h1>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
|
<Button variant="outline" size="sm" onClick={handleExportFailed} className="gap-1.5">
|
||||||
|
<FileDown className="h-4 w-4"/>
|
||||||
|
Export Failed
|
||||||
|
</Button>
|
||||||
<Button variant="outline" size="sm" onClick={handleCopy} disabled={logs.length === 0} className="gap-1.5">
|
<Button variant="outline" size="sm" onClick={handleCopy} disabled={logs.length === 0} className="gap-1.5">
|
||||||
{copied ? <Check className="h-4 w-4"/> : <Copy className="h-4 w-4"/>}
|
{copied ? <CircleCheck className="h-4 w-4"/> : <Copy className="h-4 w-4"/>}
|
||||||
Copy
|
Copy
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="outline" size="sm" onClick={handleClear} className="gap-1.5">
|
<Button variant="destructive" size="sm" onClick={handleClear} disabled={logs.length === 0} className="gap-1.5">
|
||||||
<Trash2 className="h-4 w-4"/>
|
<Trash2 className="h-4 w-4"/>
|
||||||
Clear
|
Clear
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ref={scrollRef} className="h-[calc(100vh-220px)] overflow-y-auto bg-muted/50 rounded-md p-3 font-mono text-xs">
|
<div ref={scrollRef} className="h-[calc(100vh-220px)] overflow-y-auto rounded-lg bg-muted/50 p-4 font-mono text-xs">
|
||||||
{logs.length === 0 ? (<p className="text-muted-foreground lowercase">no logs yet...</p>) : (logs.map((log, i) => (<div key={i} className="flex gap-2 py-0.5">
|
{logs.length === 0 ? (<p className="text-muted-foreground lowercase">no logs yet...</p>) : (logs.map((log, i) => (<div key={i} className="flex gap-2 py-0.5">
|
||||||
<span className="text-muted-foreground shrink-0">
|
<span className="text-muted-foreground shrink-0">
|
||||||
[{formatTime(log.timestamp)}]
|
[{formatTime(log.timestamp)}]
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
import { Fragment, type ReactNode } from "react";
|
||||||
|
import { openExternal } from "@/lib/utils";
|
||||||
|
function renderInline(text: string, keyPrefix: string): ReactNode[] {
|
||||||
|
const nodes: ReactNode[] = [];
|
||||||
|
const pattern = /\[([^\]]+)\]\(([^)]+)\)|\*\*([^*]+)\*\*|\*([^*]+)\*|`([^`]+)`/g;
|
||||||
|
let lastIndex = 0;
|
||||||
|
let match: RegExpExecArray | null;
|
||||||
|
let index = 0;
|
||||||
|
while ((match = pattern.exec(text)) !== null) {
|
||||||
|
if (match.index > lastIndex) {
|
||||||
|
nodes.push(<Fragment key={`${keyPrefix}-t${index}`}>{text.slice(lastIndex, match.index)}</Fragment>);
|
||||||
|
}
|
||||||
|
if (match[1] !== undefined && match[2] !== undefined) {
|
||||||
|
const label = match[1];
|
||||||
|
const url = match[2];
|
||||||
|
nodes.push(<button key={`${keyPrefix}-l${index}`} type="button" onClick={() => openExternal(url)} className="cursor-pointer border-none bg-transparent p-0 text-primary underline hover:opacity-80">
|
||||||
|
{label}
|
||||||
|
</button>);
|
||||||
|
}
|
||||||
|
else if (match[3] !== undefined) {
|
||||||
|
nodes.push(<strong key={`${keyPrefix}-b${index}`} className="font-semibold text-foreground">{match[3]}</strong>);
|
||||||
|
}
|
||||||
|
else if (match[4] !== undefined) {
|
||||||
|
nodes.push(<em key={`${keyPrefix}-i${index}`}>{match[4]}</em>);
|
||||||
|
}
|
||||||
|
else if (match[5] !== undefined) {
|
||||||
|
nodes.push(<code key={`${keyPrefix}-c${index}`} className="rounded bg-muted px-1 py-0.5 font-mono text-xs">{match[5]}</code>);
|
||||||
|
}
|
||||||
|
lastIndex = pattern.lastIndex;
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
if (lastIndex < text.length) {
|
||||||
|
nodes.push(<Fragment key={`${keyPrefix}-t${index}`}>{text.slice(lastIndex)}</Fragment>);
|
||||||
|
}
|
||||||
|
return nodes;
|
||||||
|
}
|
||||||
|
export function MarkdownLite({ content }: {
|
||||||
|
content: string;
|
||||||
|
}) {
|
||||||
|
const lines = (content || "").replace(/\r\n/g, "\n").split("\n");
|
||||||
|
const blocks: ReactNode[] = [];
|
||||||
|
let listItems: string[] = [];
|
||||||
|
let key = 0;
|
||||||
|
const flushList = () => {
|
||||||
|
if (listItems.length === 0)
|
||||||
|
return;
|
||||||
|
const items = listItems;
|
||||||
|
listItems = [];
|
||||||
|
blocks.push(<ul key={`ul-${key++}`} className="list-disc space-y-1 pl-5">
|
||||||
|
{items.map((item, index) => (<li key={index}>{renderInline(item, `li-${key}-${index}`)}</li>))}
|
||||||
|
</ul>);
|
||||||
|
};
|
||||||
|
for (const raw of lines) {
|
||||||
|
const line = raw.trimEnd();
|
||||||
|
const bullet = line.match(/^\s*[-*]\s+(.*)$/);
|
||||||
|
if (bullet) {
|
||||||
|
listItems.push(bullet[1]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
flushList();
|
||||||
|
const heading = line.match(/^(#{1,6})\s+(.*)$/);
|
||||||
|
if (heading) {
|
||||||
|
blocks.push(<p key={`h-${key++}`} className="font-semibold text-foreground">
|
||||||
|
{renderInline(heading[2], `h-${key}`)}
|
||||||
|
</p>);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (line.trim() === "") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
blocks.push(<p key={`p-${key++}`}>{renderInline(line, `p-${key}`)}</p>);
|
||||||
|
}
|
||||||
|
flushList();
|
||||||
|
return <div className="space-y-2 text-sm text-muted-foreground">{blocks}</div>;
|
||||||
|
}
|
||||||
@@ -421,6 +421,9 @@ export function MediaList({ accountInfo, timeline, totalUrls, fetchedMediaType =
|
|||||||
skip_existing: settings.skipExistingFiles,
|
skip_existing: settings.skipExistingFiles,
|
||||||
delete_incomplete_files: settings.deleteIncompleteFiles,
|
delete_incomplete_files: settings.deleteIncompleteFiles,
|
||||||
retry_attempts: settings.retryAttempts,
|
retry_attempts: settings.retryAttempts,
|
||||||
|
download_speed_limit_kbps: settings.downloadSpeedLimitKBps,
|
||||||
|
download_delay_ms: Math.round(settings.downloadDelaySeconds * 1000),
|
||||||
|
download_delay_jitter_ms: Math.round(settings.downloadDelayJitterSeconds * 1000),
|
||||||
proxy: settings.proxy || "",
|
proxy: settings.proxy || "",
|
||||||
filename_template: settings.filenameTemplate || "",
|
filename_template: settings.filenameTemplate || "",
|
||||||
folder_template: settings.folderTemplate || "",
|
folder_template: settings.folderTemplate || "",
|
||||||
@@ -483,6 +486,9 @@ export function MediaList({ accountInfo, timeline, totalUrls, fetchedMediaType =
|
|||||||
skip_existing: settings.skipExistingFiles,
|
skip_existing: settings.skipExistingFiles,
|
||||||
delete_incomplete_files: settings.deleteIncompleteFiles,
|
delete_incomplete_files: settings.deleteIncompleteFiles,
|
||||||
retry_attempts: settings.retryAttempts,
|
retry_attempts: settings.retryAttempts,
|
||||||
|
download_speed_limit_kbps: settings.downloadSpeedLimitKBps,
|
||||||
|
download_delay_ms: Math.round(settings.downloadDelaySeconds * 1000),
|
||||||
|
download_delay_jitter_ms: Math.round(settings.downloadDelayJitterSeconds * 1000),
|
||||||
proxy: settings.proxy || "",
|
proxy: settings.proxy || "",
|
||||||
filename_template: settings.filenameTemplate || "",
|
filename_template: settings.filenameTemplate || "",
|
||||||
folder_template: settings.folderTemplate || "",
|
folder_template: settings.folderTemplate || "",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { toastWithSound as toast } from "@/lib/toast-with-sound";
|
|||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { getSettings, updateSettings, VIDEO_QUALITIES, IMAGE_SIZES, AVATAR_SIZES, BANNER_SIZES, type VideoQuality, type ImageSize, type AvatarSize, type BannerSize } from "@/lib/settings";
|
import { getSettings, updateSettings, VIDEO_QUALITIES, IMAGE_SIZES, AVATAR_SIZES, BANNER_SIZES, type VideoQuality, type ImageSize, type AvatarSize, type BannerSize } from "@/lib/settings";
|
||||||
import { GetStoredAuthToken, SetStoredAuthToken } from "../../wailsjs/go/main/App";
|
import { GetStoredAuthToken, SetStoredAuthToken } from "../../wailsjs/go/main/App";
|
||||||
import { AlertCircle, Bookmark, CheckCircle, Clipboard, CloudDownload, Clock, Database, Eye, EyeOff, Globe, Heart, Hourglass, Info, Lock, RotateCcw, SlidersHorizontal, StopCircle, Trash2, User, Users, XCircle } from "lucide-react";
|
import { AlertCircle, Bookmark, CheckCircle, CircleQuestionMark, Clipboard, CloudDownload, Clock, Database, Eye, EyeOff, Globe, Heart, Hourglass, Lock, RotateCcw, SlidersHorizontal, StopCircle, Trash2, User, Users, XCircle } from "lucide-react";
|
||||||
import { Spinner } from "@/components/ui/spinner";
|
import { Spinner } from "@/components/ui/spinner";
|
||||||
function formatNumberWithComma(num: number): string {
|
function formatNumberWithComma(num: number): string {
|
||||||
return num.toLocaleString();
|
return num.toLocaleString();
|
||||||
@@ -325,7 +325,7 @@ export function SearchBar({ username, loading, onUsernameChange, onFetch, onStop
|
|||||||
<Label className="text-sm">Account List</Label>
|
<Label className="text-sm">Account List</Label>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Info className="h-4 w-4 cursor-help text-muted-foreground"/>
|
<CircleQuestionMark className="h-4 w-4 cursor-help text-muted-foreground"/>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent className="max-w-xs">
|
<TooltipContent className="max-w-xs">
|
||||||
<p className="text-sm">
|
<p className="text-sm">
|
||||||
@@ -703,7 +703,7 @@ export function SearchBar({ username, loading, onUsernameChange, onFetch, onStop
|
|||||||
<Label htmlFor="shared-auth-token" className="text-sm">Auth Token</Label>
|
<Label htmlFor="shared-auth-token" className="text-sm">Auth Token</Label>
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Info className="h-4 w-4 cursor-help text-muted-foreground"/>
|
<CircleQuestionMark className="h-4 w-4 cursor-help text-muted-foreground"/>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent className="max-w-sm">
|
<TooltipContent className="max-w-sm">
|
||||||
<p className="text-sm">{authTokenHelpText}</p>
|
<p className="text-sm">{authTokenHelpText}</p>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { useEffect, useState, useCallback } from "react";
|
import { useEffect, useState, useCallback, useRef } from "react";
|
||||||
import { flushSync } from "react-dom";
|
import { flushSync } from "react-dom";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
@@ -6,14 +6,14 @@ import { InputWithContext } from "@/components/ui/input-with-context";
|
|||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select";
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select";
|
||||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
|
||||||
import { Check, Download, ExternalLink, FolderOpen, Info, MonitorCog, PackageSearch, Plus, RotateCcw, Save, Trash2, FileSignature } from "lucide-react";
|
import { Check, CircleQuestionMark, Download, ExternalLink, FolderOpen, MonitorCog, PackageSearch, Plus, RotateCcw, Save, Trash2, FileSignature } from "lucide-react";
|
||||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@/components/ui/dialog";
|
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@/components/ui/dialog";
|
||||||
import { Spinner } from "@/components/ui/spinner";
|
import { Spinner } from "@/components/ui/spinner";
|
||||||
import { Switch } from "@/components/ui/switch";
|
import { Switch } from "@/components/ui/switch";
|
||||||
import { getSettings, getSettingsWithDefaults, saveSettings, resetToDefaultSettings, applyThemeMode, applyFont, getFontOptions, parseGoogleFontUrl, loadGoogleFontUrl, loadCustomFonts, saveCustomFonts, DEFAULT_FILENAME_TEMPLATE, FILENAME_TEMPLATE_VARIABLES, renderFilenameTemplate, SAMPLE_FILENAME_DATA, DEFAULT_FOLDER_TEMPLATE, FOLDER_TEMPLATE_VARIABLES, renderFolderTemplate, SAMPLE_FOLDER_DATA, type Settings as SettingsType, type FontFamily, type GifQuality, type GifResolution, type CustomFontFamily } from "@/lib/settings";
|
import { getSettings, getSettingsWithDefaults, saveSettings, resetToDefaultSettings, applyThemeMode, applyFont, getFontOptions, parseGoogleFontUrl, loadGoogleFontUrl, loadCustomFonts, saveCustomFonts, DEFAULT_FILENAME_TEMPLATE, FILENAME_TEMPLATE_VARIABLES, renderFilenameTemplate, SAMPLE_FILENAME_DATA, DEFAULT_FOLDER_TEMPLATE, FOLDER_TEMPLATE_VARIABLES, renderFolderTemplate, SAMPLE_FOLDER_DATA, type Settings as SettingsType, type FontFamily, type GifQuality, type GifResolution, type CustomFontFamily } from "@/lib/settings";
|
||||||
import { FormatEditor } from "@/components/FormatEditor";
|
import { FormatEditor } from "@/components/FormatEditor";
|
||||||
import { getCachedDependencyStatus, setCachedDependencyStatus } from "@/lib/runtime-cache";
|
import { getCachedDependencyStatus, setCachedDependencyStatus } from "@/lib/runtime-cache";
|
||||||
import { themes, applyTheme } from "@/lib/themes";
|
import { baseColors, getThemesForBaseColor, normalizeThemeName, applyTheme, type BaseColorName } from "@/lib/themes";
|
||||||
import { compareVersionNumbers } from "@/lib/version";
|
import { compareVersionNumbers } from "@/lib/version";
|
||||||
import { SelectFolder, IsExtractorInstalled, DownloadExtractor, IsFFmpegInstalled, DownloadFFmpeg, IsExifToolInstalled, DownloadExifTool } from "../../wailsjs/go/main/App";
|
import { SelectFolder, IsExtractorInstalled, DownloadExtractor, IsFFmpegInstalled, DownloadFFmpeg, IsExifToolInstalled, DownloadExifTool } from "../../wailsjs/go/main/App";
|
||||||
import { toastWithSound as toast } from "@/lib/toast-with-sound";
|
import { toastWithSound as toast } from "@/lib/toast-with-sound";
|
||||||
@@ -24,6 +24,7 @@ interface DependencyVersionStatus {
|
|||||||
}
|
}
|
||||||
type DependencyVersionMethod = "GetExtractorVersionStatus" | "GetFFmpegVersionStatus" | "GetExifToolVersionStatus";
|
type DependencyVersionMethod = "GetExtractorVersionStatus" | "GetFFmpegVersionStatus" | "GetExifToolVersionStatus";
|
||||||
type SettingsTab = "general" | "downloads" | "naming" | "dependencies";
|
type SettingsTab = "general" | "downloads" | "naming" | "dependencies";
|
||||||
|
const THEME_PREVIEW_DEBOUNCE_MS = 50;
|
||||||
interface SettingsPageProps {
|
interface SettingsPageProps {
|
||||||
onUnsavedChangesChange?: (hasUnsavedChanges: boolean) => void;
|
onUnsavedChangesChange?: (hasUnsavedChanges: boolean) => void;
|
||||||
onResetRequest?: (resetFn: () => void) => void;
|
onResetRequest?: (resetFn: () => void) => void;
|
||||||
@@ -84,14 +85,75 @@ export function SettingsPage({ onUnsavedChangesChange, onResetRequest }: Setting
|
|||||||
const exiftoolUpdateAvailable = hasNewDependencyVersion(exiftoolInstalledVersion, exiftoolLatestVersion);
|
const exiftoolUpdateAvailable = hasNewDependencyVersion(exiftoolInstalledVersion, exiftoolLatestVersion);
|
||||||
const parsedAddFont = parseGoogleFontUrl(addFontUrl);
|
const parsedAddFont = parseGoogleFontUrl(addFontUrl);
|
||||||
const fontOptions = getFontOptions(tempSettings.customFonts);
|
const fontOptions = getFontOptions(tempSettings.customFonts);
|
||||||
|
const availableThemes = getThemesForBaseColor(tempSettings.baseColor);
|
||||||
const hasUnsavedChanges = JSON.stringify(savedSettings) !== JSON.stringify(tempSettings);
|
const hasUnsavedChanges = JSON.stringify(savedSettings) !== JSON.stringify(tempSettings);
|
||||||
|
const themePreviewTimerRef = useRef<number | null>(null);
|
||||||
|
const selectedThemeConfigRef = useRef({
|
||||||
|
baseColor: tempSettings.baseColor,
|
||||||
|
theme: tempSettings.theme,
|
||||||
|
});
|
||||||
|
const cancelThemePreview = useCallback(() => {
|
||||||
|
if (themePreviewTimerRef.current !== null) {
|
||||||
|
window.clearTimeout(themePreviewTimerRef.current);
|
||||||
|
themePreviewTimerRef.current = null;
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
const previewThemeConfig = useCallback((themeName: SettingsType["theme"], baseColorName: BaseColorName) => {
|
||||||
|
cancelThemePreview();
|
||||||
|
themePreviewTimerRef.current = window.setTimeout(() => {
|
||||||
|
themePreviewTimerRef.current = null;
|
||||||
|
applyTheme(themeName, baseColorName);
|
||||||
|
}, THEME_PREVIEW_DEBOUNCE_MS);
|
||||||
|
}, [cancelThemePreview]);
|
||||||
|
const previewTheme = useCallback((themeName: SettingsType["theme"]) => {
|
||||||
|
previewThemeConfig(themeName, selectedThemeConfigRef.current.baseColor);
|
||||||
|
}, [previewThemeConfig]);
|
||||||
|
const previewBaseColor = useCallback((baseColorName: BaseColorName) => {
|
||||||
|
const themeName = normalizeThemeName(selectedThemeConfigRef.current.theme, baseColorName);
|
||||||
|
previewThemeConfig(themeName, baseColorName);
|
||||||
|
}, [previewThemeConfig]);
|
||||||
|
const restoreSelectedTheme = useCallback(() => {
|
||||||
|
cancelThemePreview();
|
||||||
|
const selectedTheme = selectedThemeConfigRef.current;
|
||||||
|
applyTheme(selectedTheme.theme, selectedTheme.baseColor);
|
||||||
|
}, [cancelThemePreview]);
|
||||||
|
const handleThemeChange = useCallback((themeName: SettingsType["theme"]) => {
|
||||||
|
cancelThemePreview();
|
||||||
|
const baseColorName = selectedThemeConfigRef.current.baseColor;
|
||||||
|
selectedThemeConfigRef.current = { baseColor: baseColorName, theme: themeName };
|
||||||
|
applyTheme(themeName, baseColorName);
|
||||||
|
setTempSettings((prev) => ({ ...prev, theme: themeName }));
|
||||||
|
}, [cancelThemePreview]);
|
||||||
|
const handleBaseColorChange = useCallback((baseColorName: BaseColorName) => {
|
||||||
|
cancelThemePreview();
|
||||||
|
const themeName = normalizeThemeName(selectedThemeConfigRef.current.theme, baseColorName);
|
||||||
|
selectedThemeConfigRef.current = { baseColor: baseColorName, theme: themeName };
|
||||||
|
applyTheme(themeName, baseColorName);
|
||||||
|
setTempSettings((prev) => ({ ...prev, baseColor: baseColorName, theme: themeName }));
|
||||||
|
}, [cancelThemePreview]);
|
||||||
const resetToSaved = useCallback(() => {
|
const resetToSaved = useCallback(() => {
|
||||||
|
cancelThemePreview();
|
||||||
const freshSavedSettings = getSettings();
|
const freshSavedSettings = getSettings();
|
||||||
|
selectedThemeConfigRef.current = {
|
||||||
|
baseColor: freshSavedSettings.baseColor,
|
||||||
|
theme: freshSavedSettings.theme,
|
||||||
|
};
|
||||||
flushSync(() => {
|
flushSync(() => {
|
||||||
setTempSettings(freshSavedSettings);
|
setTempSettings(freshSavedSettings);
|
||||||
setIsDark(document.documentElement.classList.contains("dark"));
|
setIsDark(document.documentElement.classList.contains("dark"));
|
||||||
});
|
});
|
||||||
}, []);
|
}, [cancelThemePreview]);
|
||||||
|
useEffect(() => {
|
||||||
|
selectedThemeConfigRef.current = {
|
||||||
|
baseColor: tempSettings.baseColor,
|
||||||
|
theme: tempSettings.theme,
|
||||||
|
};
|
||||||
|
}, [tempSettings.baseColor, tempSettings.theme]);
|
||||||
|
useEffect(() => () => {
|
||||||
|
cancelThemePreview();
|
||||||
|
const persistedSettings = getSettings();
|
||||||
|
applyTheme(persistedSettings.theme, persistedSettings.baseColor);
|
||||||
|
}, [cancelThemePreview]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (onResetRequest) {
|
if (onResetRequest) {
|
||||||
onResetRequest(resetToSaved);
|
onResetRequest(resetToSaved);
|
||||||
@@ -161,25 +223,25 @@ export function SettingsPage({ onUnsavedChangesChange, onResetRequest }: Setting
|
|||||||
};
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
applyThemeMode(savedSettings.themeMode);
|
applyThemeMode(savedSettings.themeMode);
|
||||||
applyTheme(savedSettings.theme);
|
applyTheme(savedSettings.theme, savedSettings.baseColor);
|
||||||
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
||||||
const handleChange = () => {
|
const handleChange = () => {
|
||||||
if (savedSettings.themeMode === "auto") {
|
if (savedSettings.themeMode === "auto") {
|
||||||
applyThemeMode("auto");
|
applyThemeMode("auto");
|
||||||
applyTheme(savedSettings.theme);
|
applyTheme(savedSettings.theme, savedSettings.baseColor);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
mediaQuery.addEventListener("change", handleChange);
|
mediaQuery.addEventListener("change", handleChange);
|
||||||
return () => mediaQuery.removeEventListener("change", handleChange);
|
return () => mediaQuery.removeEventListener("change", handleChange);
|
||||||
}, [savedSettings.themeMode, savedSettings.theme]);
|
}, [savedSettings.themeMode, savedSettings.baseColor, savedSettings.theme]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
applyThemeMode(tempSettings.themeMode);
|
applyThemeMode(tempSettings.themeMode);
|
||||||
applyTheme(tempSettings.theme);
|
applyTheme(tempSettings.theme, tempSettings.baseColor);
|
||||||
applyFont(tempSettings.fontFamily, tempSettings.customFonts);
|
applyFont(tempSettings.fontFamily, tempSettings.customFonts);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setIsDark(document.documentElement.classList.contains("dark"));
|
setIsDark(document.documentElement.classList.contains("dark"));
|
||||||
}, 0);
|
}, 0);
|
||||||
}, [tempSettings.themeMode, tempSettings.theme, tempSettings.fontFamily, tempSettings.customFonts]);
|
}, [tempSettings.themeMode, tempSettings.baseColor, tempSettings.theme, tempSettings.fontFamily, tempSettings.customFonts]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (showAddFontDialog && parsedAddFont) {
|
if (showAddFontDialog && parsedAddFont) {
|
||||||
loadGoogleFontUrl(parsedAddFont.url, "twitter-media-add-font-preview");
|
loadGoogleFontUrl(parsedAddFont.url, "twitter-media-add-font-preview");
|
||||||
@@ -215,7 +277,7 @@ export function SettingsPage({ onUnsavedChangesChange, onResetRequest }: Setting
|
|||||||
setTempSettings(defaultSettings);
|
setTempSettings(defaultSettings);
|
||||||
setSavedSettings(defaultSettings);
|
setSavedSettings(defaultSettings);
|
||||||
applyThemeMode(defaultSettings.themeMode);
|
applyThemeMode(defaultSettings.themeMode);
|
||||||
applyTheme(defaultSettings.theme);
|
applyTheme(defaultSettings.theme, defaultSettings.baseColor);
|
||||||
applyFont(defaultSettings.fontFamily, defaultSettings.customFonts);
|
applyFont(defaultSettings.fontFamily, defaultSettings.customFonts);
|
||||||
setShowResetConfirm(false);
|
setShowResetConfirm(false);
|
||||||
toast.success("Settings reset to default");
|
toast.success("Settings reset to default");
|
||||||
@@ -372,33 +434,66 @@ export function SettingsPage({ onUnsavedChangesChange, onResetRequest }: Setting
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="pt-4">
|
<div className="pt-4">
|
||||||
{activeTab === "general" && (<div className="max-w-3xl space-y-4">
|
{activeTab === "general" && (<div className="grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,1fr)_1px_minmax(0,1fr)] md:gap-6">
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="space-y-2">
|
<div className="grid grid-cols-[8rem_8rem] gap-4">
|
||||||
<Label htmlFor="theme-mode">Mode</Label>
|
<div className="min-w-0 space-y-2">
|
||||||
<Select value={tempSettings.themeMode} onValueChange={(value: "auto" | "light" | "dark") => setTempSettings((prev) => ({ ...prev, themeMode: value }))}>
|
<Label htmlFor="theme-mode">Mode</Label>
|
||||||
<SelectTrigger id="theme-mode">
|
<Select value={tempSettings.themeMode} onValueChange={(value: "auto" | "light" | "dark") => setTempSettings((prev) => ({ ...prev, themeMode: value }))}>
|
||||||
<SelectValue placeholder="Select theme mode"/>
|
<SelectTrigger id="theme-mode" className="w-full">
|
||||||
</SelectTrigger>
|
<SelectValue placeholder="Select theme mode"/>
|
||||||
<SelectContent>
|
</SelectTrigger>
|
||||||
<SelectItem value="auto">Auto</SelectItem>
|
<SelectContent>
|
||||||
<SelectItem value="light">Light</SelectItem>
|
<SelectItem value="auto">Auto</SelectItem>
|
||||||
<SelectItem value="dark">Dark</SelectItem>
|
<SelectItem value="light">Light</SelectItem>
|
||||||
</SelectContent>
|
<SelectItem value="dark">Dark</SelectItem>
|
||||||
</Select>
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="min-w-0 space-y-2">
|
||||||
|
<Label htmlFor="base-color">Base Color</Label>
|
||||||
|
<Select value={tempSettings.baseColor} onValueChange={(value) => handleBaseColorChange(value as BaseColorName)} onOpenChange={(open) => {
|
||||||
|
if (!open) {
|
||||||
|
restoreSelectedTheme();
|
||||||
|
}
|
||||||
|
}}>
|
||||||
|
<SelectTrigger id="base-color" className="w-full">
|
||||||
|
<SelectValue placeholder="Select a base color"/>
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent onMouseLeave={restoreSelectedTheme}>
|
||||||
|
{baseColors.map((baseColor) => (<SelectItem key={baseColor.name} value={baseColor.name} onMouseMove={() => previewBaseColor(baseColor.name)} onFocus={() => previewBaseColor(baseColor.name)}>
|
||||||
|
<span className="flex items-center gap-2">
|
||||||
|
<span className="h-3 w-3 rounded-full border border-border" style={{
|
||||||
|
backgroundColor: isDark
|
||||||
|
? baseColor.cssVars.dark["muted-foreground"]
|
||||||
|
: baseColor.cssVars.light["muted-foreground"],
|
||||||
|
}}/>
|
||||||
|
{baseColor.label}
|
||||||
|
</span>
|
||||||
|
</SelectItem>))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="theme">Accent</Label>
|
<Label htmlFor="theme">Theme</Label>
|
||||||
<Select value={tempSettings.theme} onValueChange={(value) => setTempSettings((prev) => ({ ...prev, theme: value }))}>
|
<Select value={tempSettings.theme} onValueChange={(value) => handleThemeChange(value as SettingsType["theme"])} onOpenChange={(open) => {
|
||||||
<SelectTrigger id="theme">
|
if (!open) {
|
||||||
|
restoreSelectedTheme();
|
||||||
|
}
|
||||||
|
}}>
|
||||||
|
<SelectTrigger id="theme" className="w-32">
|
||||||
<SelectValue placeholder="Select a theme"/>
|
<SelectValue placeholder="Select a theme"/>
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
<SelectContent>
|
<SelectContent onMouseLeave={restoreSelectedTheme}>
|
||||||
{themes.map((theme) => (<SelectItem key={theme.name} value={theme.name}>
|
{availableThemes.map((theme) => (<SelectItem key={theme.name} value={theme.name} onMouseMove={() => previewTheme(theme.name)} onFocus={() => previewTheme(theme.name)}>
|
||||||
<span className="flex items-center gap-2">
|
<span className="flex items-center gap-2">
|
||||||
<span className="h-3 w-3 rounded-full border border-border" style={{
|
<span className="h-3 w-3 rounded-full border border-border" style={{
|
||||||
backgroundColor: isDark ? theme.cssVars.dark.primary : theme.cssVars.light.primary
|
backgroundColor: isDark
|
||||||
|
? theme.cssVars.dark[theme.name === tempSettings.baseColor ? "muted-foreground" : "primary"]
|
||||||
|
: theme.cssVars.light[theme.name === tempSettings.baseColor ? "muted-foreground" : "primary"],
|
||||||
}}/>
|
}}/>
|
||||||
{theme.label}
|
{theme.label}
|
||||||
</span>
|
</span>
|
||||||
@@ -444,14 +539,19 @@ export function SettingsPage({ onUnsavedChangesChange, onResetRequest }: Setting
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center gap-3 pt-2">
|
<div className="flex items-center gap-3 pt-2">
|
||||||
<Label htmlFor="sfx-enabled" className="cursor-pointer text-sm">Sound Effects</Label>
|
|
||||||
<Switch id="sfx-enabled" checked={tempSettings.sfxEnabled} onCheckedChange={(checked) => setTempSettings((prev) => ({ ...prev, sfxEnabled: checked }))}/>
|
<Switch id="sfx-enabled" checked={tempSettings.sfxEnabled} onCheckedChange={(checked) => setTempSettings((prev) => ({ ...prev, sfxEnabled: checked }))}/>
|
||||||
|
<Label htmlFor="sfx-enabled" className="cursor-pointer text-sm">Sound Effects</Label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="flex items-center gap-3 pt-1">
|
||||||
|
<Switch id="show-update-notifications" checked={tempSettings.showUpdateNotifications} onCheckedChange={(checked) => setTempSettings((prev) => ({ ...prev, showUpdateNotifications: checked }))}/>
|
||||||
|
<Label htmlFor="show-update-notifications" className="cursor-pointer text-sm">Update Notifications</Label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>)}
|
|
||||||
|
|
||||||
{activeTab === "downloads" && (<div className="grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,1fr)_1px_minmax(0,1fr)] md:gap-6">
|
<div aria-hidden="true" className="hidden bg-border md:block"/>
|
||||||
<div className="space-y-4">
|
|
||||||
|
<div className="space-y-6">
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="download-path">Download Path</Label>
|
<Label htmlFor="download-path">Download Path</Label>
|
||||||
<div className="flex gap-2">
|
<div className="flex gap-2">
|
||||||
@@ -464,66 +564,165 @@ export function SettingsPage({ onUnsavedChangesChange, onResetRequest }: Setting
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="flex flex-wrap gap-6">
|
<Label>File Handling</Label>
|
||||||
<div className="space-y-2">
|
<div className="flex items-center gap-3">
|
||||||
<Label htmlFor="concurrent-downloads" className="flex items-center gap-2">
|
|
||||||
Concurrent Downloads
|
|
||||||
<Tooltip>
|
|
||||||
<TooltipTrigger asChild>
|
|
||||||
<Info className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
|
||||||
</TooltipTrigger>
|
|
||||||
<TooltipContent side="top">
|
|
||||||
<p>How many media files can download at the same time.</p>
|
|
||||||
</TooltipContent>
|
|
||||||
</Tooltip>
|
|
||||||
</Label>
|
|
||||||
<Select value={String(tempSettings.concurrentDownloads || 10)} onValueChange={(value) => setTempSettings((prev) => ({ ...prev, concurrentDownloads: parseInt(value, 10) }))}>
|
|
||||||
<SelectTrigger id="concurrent-downloads" className="w-fit">
|
|
||||||
<SelectValue placeholder="10"/>
|
|
||||||
</SelectTrigger>
|
|
||||||
<SelectContent>
|
|
||||||
{[1, 2, 3, 5, 8, 10, 15, 20, 25, 30, 40, 50].map((value) => (<SelectItem key={value} value={String(value)}>
|
|
||||||
{value}
|
|
||||||
</SelectItem>))}
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="space-y-2">
|
|
||||||
<Label htmlFor="retry-attempts" className="flex items-center gap-2">
|
|
||||||
Retry Attempts
|
|
||||||
<Tooltip>
|
|
||||||
<TooltipTrigger asChild>
|
|
||||||
<Info className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
|
||||||
</TooltipTrigger>
|
|
||||||
<TooltipContent side="top">
|
|
||||||
<p>How many times to retry a failed download before giving up.</p>
|
|
||||||
</TooltipContent>
|
|
||||||
</Tooltip>
|
|
||||||
</Label>
|
|
||||||
<Select value={String(tempSettings.retryAttempts)} onValueChange={(value) => setTempSettings((prev) => ({ ...prev, retryAttempts: parseInt(value, 10) }))}>
|
|
||||||
<SelectTrigger id="retry-attempts" className="w-fit">
|
|
||||||
<SelectValue placeholder="1"/>
|
|
||||||
</SelectTrigger>
|
|
||||||
<SelectContent>
|
|
||||||
{[1, 2, 3, 4, 5].map((value) => (<SelectItem key={value} value={String(value)}>
|
|
||||||
{value}
|
|
||||||
</SelectItem>))}
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex items-center justify-between gap-4">
|
|
||||||
<Label htmlFor="skip-existing-files" className="cursor-pointer">Skip Existing Files</Label>
|
|
||||||
<Switch id="skip-existing-files" checked={tempSettings.skipExistingFiles} onCheckedChange={(checked) => setTempSettings((prev) => ({ ...prev, skipExistingFiles: checked }))}/>
|
<Switch id="skip-existing-files" checked={tempSettings.skipExistingFiles} onCheckedChange={(checked) => setTempSettings((prev) => ({ ...prev, skipExistingFiles: checked }))}/>
|
||||||
|
<Label htmlFor="skip-existing-files" className="cursor-pointer font-normal">Skip Existing Files</Label>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
<div className="flex items-center justify-between gap-4">
|
|
||||||
<Label htmlFor="delete-incomplete-files" className="cursor-pointer">Delete Incomplete Files</Label>
|
|
||||||
<Switch id="delete-incomplete-files" checked={tempSettings.deleteIncompleteFiles} onCheckedChange={(checked) => setTempSettings((prev) => ({ ...prev, deleteIncompleteFiles: checked }))}/>
|
<Switch id="delete-incomplete-files" checked={tempSettings.deleteIncompleteFiles} onCheckedChange={(checked) => setTempSettings((prev) => ({ ...prev, deleteIncompleteFiles: checked }))}/>
|
||||||
|
<Label htmlFor="delete-incomplete-files" className="cursor-pointer font-normal">Delete Incomplete Files</Label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-3">
|
||||||
|
<Label className="flex items-center gap-2">
|
||||||
|
GIF Conversion
|
||||||
|
<Tooltip>
|
||||||
|
<TooltipTrigger asChild>
|
||||||
|
<CircleQuestionMark className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent side="top">
|
||||||
|
<p>Quality settings for converting Twitter's MP4 into actual GIF files.</p>
|
||||||
|
</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
</Label>
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<Switch id="auto-convert-gifs" checked={tempSettings.autoConvertGifs} onCheckedChange={(checked) => setTempSettings((prev) => ({ ...prev, autoConvertGifs: checked }))} disabled={!ffmpegInstalled}/>
|
||||||
|
<Label htmlFor="auto-convert-gifs" className={!ffmpegInstalled ? "text-muted-foreground" : "cursor-pointer"}>Auto Convert GIFs</Label>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center justify-between gap-4">
|
||||||
|
<Label htmlFor="gif-quality" className={!ffmpegInstalled || !tempSettings.autoConvertGifs ? "text-muted-foreground" : undefined}>GIF Quality</Label>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Select value={tempSettings.gifQuality} onValueChange={(value: GifQuality) => {
|
||||||
|
setTempSettings((prev) => ({
|
||||||
|
...prev,
|
||||||
|
gifQuality: value,
|
||||||
|
}));
|
||||||
|
}} disabled={!ffmpegInstalled || !tempSettings.autoConvertGifs}>
|
||||||
|
<SelectTrigger id="gif-quality" className="w-fit">
|
||||||
|
<SelectValue placeholder="Select quality"/>
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="fast">Fast</SelectItem>
|
||||||
|
<SelectItem value="better">Better</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
<Select value={tempSettings.gifResolution} onValueChange={(value: GifResolution) => setTempSettings((prev) => ({ ...prev, gifResolution: value }))} disabled={!ffmpegInstalled || !tempSettings.autoConvertGifs}>
|
||||||
|
<SelectTrigger id="gif-resolution" className="w-fit">
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>)}
|
||||||
|
|
||||||
|
{activeTab === "downloads" && (<div className="grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,1fr)_1px_minmax(0,1fr)] md:gap-6">
|
||||||
|
<div className="space-y-4">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<Label>Download Controls</Label>
|
||||||
|
<Tooltip>
|
||||||
|
<TooltipTrigger asChild>
|
||||||
|
<CircleQuestionMark className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent side="top" className="max-w-xs">
|
||||||
|
<p>The speed limit is shared by all concurrent downloads. Delay spaces out media requests and adds an optional random variation.</p>
|
||||||
|
</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="grid grid-cols-2 gap-4">
|
||||||
|
<div className="space-y-1.5">
|
||||||
|
<Label htmlFor="concurrent-downloads" className="flex items-center gap-2 text-xs">
|
||||||
|
Concurrent Downloads
|
||||||
|
<Tooltip>
|
||||||
|
<TooltipTrigger asChild>
|
||||||
|
<CircleQuestionMark className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent side="top">
|
||||||
|
<p>How many media files can download at the same time.</p>
|
||||||
|
</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
</Label>
|
||||||
|
<Select value={String(tempSettings.concurrentDownloads || 10)} onValueChange={(value) => setTempSettings((prev) => ({ ...prev, concurrentDownloads: parseInt(value, 10) }))}>
|
||||||
|
<SelectTrigger id="concurrent-downloads" className="w-24">
|
||||||
|
<SelectValue placeholder="10"/>
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{[1, 2, 3, 5, 8, 10, 15, 20, 25, 30, 40, 50].map((value) => (<SelectItem key={value} value={String(value)}>
|
||||||
|
{value}
|
||||||
|
</SelectItem>))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-1.5">
|
||||||
|
<Label htmlFor="retry-attempts" className="flex items-center gap-2 text-xs">
|
||||||
|
Retry Attempts
|
||||||
|
<Tooltip>
|
||||||
|
<TooltipTrigger asChild>
|
||||||
|
<CircleQuestionMark className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent side="top">
|
||||||
|
<p>How many times to retry a failed download before giving up.</p>
|
||||||
|
</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
</Label>
|
||||||
|
<Select value={String(tempSettings.retryAttempts)} onValueChange={(value) => setTempSettings((prev) => ({ ...prev, retryAttempts: parseInt(value, 10) }))}>
|
||||||
|
<SelectTrigger id="retry-attempts" className="w-24">
|
||||||
|
<SelectValue placeholder="1"/>
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{[1, 2, 3, 4, 5].map((value) => (<SelectItem key={value} value={String(value)}>
|
||||||
|
{value}
|
||||||
|
</SelectItem>))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="grid grid-cols-1 gap-3 sm:grid-cols-3">
|
||||||
|
<div className="space-y-1.5">
|
||||||
|
<Label htmlFor="download-speed-limit" className="text-xs">Speed Limit</Label>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<InputWithContext id="download-speed-limit" type="number" min="0" max="10485760" step="1" value={tempSettings.downloadSpeedLimitKBps} onChange={(e) => {
|
||||||
|
const value = Number(e.target.value);
|
||||||
|
setTempSettings((prev) => ({ ...prev, downloadSpeedLimitKBps: Number.isFinite(value) ? Math.min(10485760, Math.max(0, Math.round(value))) : 0 }));
|
||||||
|
}} className="w-24"/>
|
||||||
|
<span className="text-xs text-muted-foreground">KB/s</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-1.5">
|
||||||
|
<Label htmlFor="download-delay" className="text-xs">Base Delay</Label>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<InputWithContext id="download-delay" type="number" min="0" max="3600" step="0.1" value={tempSettings.downloadDelaySeconds} onChange={(e) => {
|
||||||
|
const value = Number(e.target.value);
|
||||||
|
setTempSettings((prev) => ({ ...prev, downloadDelaySeconds: Number.isFinite(value) ? Math.min(3600, Math.max(0, value)) : 0 }));
|
||||||
|
}} className="w-24"/>
|
||||||
|
<span className="text-xs text-muted-foreground">sec</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-1.5">
|
||||||
|
<Label htmlFor="download-delay-jitter" className="text-xs">Random Extra</Label>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<InputWithContext id="download-delay-jitter" type="number" min="0" max="3600" step="0.1" value={tempSettings.downloadDelayJitterSeconds} onChange={(e) => {
|
||||||
|
const value = Number(e.target.value);
|
||||||
|
setTempSettings((prev) => ({ ...prev, downloadDelayJitterSeconds: Number.isFinite(value) ? Math.min(3600, Math.max(0, value)) : 0 }));
|
||||||
|
}} className="w-24"/>
|
||||||
|
<span className="text-xs text-muted-foreground">sec</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div aria-hidden="true" className="hidden bg-border md:block"/>
|
<div aria-hidden="true" className="hidden bg-border md:block"/>
|
||||||
@@ -534,7 +733,7 @@ export function SettingsPage({ onUnsavedChangesChange, onResetRequest }: Setting
|
|||||||
Proxy
|
Proxy
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Info className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
<CircleQuestionMark className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent side="top">
|
<TooltipContent side="top">
|
||||||
<p>Supports one proxy or multiple proxies separated by commas. Requests will rotate through them.</p>
|
<p>Supports one proxy or multiple proxies separated by commas. Requests will rotate through them.</p>
|
||||||
@@ -544,12 +743,36 @@ export function SettingsPage({ onUnsavedChangesChange, onResetRequest }: Setting
|
|||||||
<InputWithContext id="proxy" value={tempSettings.proxy || ""} onChange={(e) => setTempSettings((prev) => ({ ...prev, proxy: e.target.value }))} placeholder="http://proxy1:port, socks5://proxy2:port (optional)" className="max-w-md"/>
|
<InputWithContext id="proxy" value={tempSettings.proxy || ""} onChange={(e) => setTempSettings((prev) => ({ ...prev, proxy: e.target.value }))} placeholder="http://proxy1:port, socks5://proxy2:port (optional)" className="max-w-md"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-2">
|
||||||
|
<Label>Fetch Delay</Label>
|
||||||
|
<div className="flex flex-wrap gap-4">
|
||||||
|
{([
|
||||||
|
["fetchDelaySeconds", "Base Delay"],
|
||||||
|
["fetchDelayJitterSeconds", "Random Extra"],
|
||||||
|
] as const).map(([key, label]) => (
|
||||||
|
<div key={key} className="space-y-1.5">
|
||||||
|
<Label htmlFor={key} className="text-xs">{label}</Label>
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<InputWithContext id={key} type="number" min="0" max="3600" step="0.1" value={tempSettings[key]} onChange={(e) => {
|
||||||
|
const value = Number(e.target.value);
|
||||||
|
setTempSettings((prev) => ({ ...prev, [key]: Number.isFinite(value) ? Math.min(3600, Math.max(0, value)) : 0 }));
|
||||||
|
}} className="w-24"/>
|
||||||
|
<span className="text-xs text-muted-foreground">sec</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
<p className="text-xs text-muted-foreground">Spaces out fetch batch starts, including account switches and retries. Random Extra adds between 0 and the chosen number of seconds. Set both to 0 to disable.</p>
|
||||||
|
<p className="text-xs text-muted-foreground">Suggested starting point: 5 sec base + 5 sec random extra. No delay guarantees avoidance of rate limits. Waiting counts toward Fetch Timeout; increase it for longer delays.</p>
|
||||||
|
<p className="text-xs text-muted-foreground">Applies between extractor runs, including date-range fetches, rather than individual requests inside the extractor.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="fetch-timeout" className="flex items-center gap-2">
|
<Label htmlFor="fetch-timeout" className="flex items-center gap-2">
|
||||||
Fetch Timeout
|
Fetch Timeout
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Info className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
<CircleQuestionMark className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent side="top">
|
<TooltipContent side="top">
|
||||||
<p>Timeout in seconds. Fetch stops automatically when reached</p>
|
<p>Timeout in seconds. Fetch stops automatically when reached</p>
|
||||||
@@ -577,55 +800,6 @@ export function SettingsPage({ onUnsavedChangesChange, onResetRequest }: Setting
|
|||||||
}} placeholder="60" className="w-24"/>
|
}} placeholder="60" className="w-24"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-4">
|
|
||||||
<div className="space-y-3">
|
|
||||||
<Label className="flex items-center gap-2">
|
|
||||||
GIF Conversion
|
|
||||||
<Tooltip>
|
|
||||||
<TooltipTrigger asChild>
|
|
||||||
<Info className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
|
||||||
</TooltipTrigger>
|
|
||||||
<TooltipContent side="top">
|
|
||||||
<p>Quality settings for converting Twitter's MP4 into actual GIF files.</p>
|
|
||||||
</TooltipContent>
|
|
||||||
</Tooltip>
|
|
||||||
</Label>
|
|
||||||
<div className="flex items-center justify-between gap-4">
|
|
||||||
<Label htmlFor="auto-convert-gifs" className={!ffmpegInstalled ? "text-muted-foreground" : undefined}>Auto Convert GIFs</Label>
|
|
||||||
<Switch id="auto-convert-gifs" checked={tempSettings.autoConvertGifs} onCheckedChange={(checked) => setTempSettings((prev) => ({ ...prev, autoConvertGifs: checked }))} disabled={!ffmpegInstalled}/>
|
|
||||||
</div>
|
|
||||||
<div className="flex items-center justify-between gap-4">
|
|
||||||
<Label htmlFor="gif-quality" className={!ffmpegInstalled || !tempSettings.autoConvertGifs ? "text-muted-foreground" : undefined}>GIF Quality</Label>
|
|
||||||
<div className="flex items-center gap-2">
|
|
||||||
<Select value={tempSettings.gifQuality} onValueChange={(value: GifQuality) => {
|
|
||||||
setTempSettings((prev) => ({
|
|
||||||
...prev,
|
|
||||||
gifQuality: value,
|
|
||||||
}));
|
|
||||||
}} disabled={!ffmpegInstalled || !tempSettings.autoConvertGifs}>
|
|
||||||
<SelectTrigger id="gif-quality" className="w-fit">
|
|
||||||
<SelectValue placeholder="Select quality"/>
|
|
||||||
</SelectTrigger>
|
|
||||||
<SelectContent>
|
|
||||||
<SelectItem value="fast">Fast</SelectItem>
|
|
||||||
<SelectItem value="better">Better</SelectItem>
|
|
||||||
</SelectContent>
|
|
||||||
</Select>
|
|
||||||
<Select value={tempSettings.gifResolution} onValueChange={(value: GifResolution) => setTempSettings((prev) => ({ ...prev, gifResolution: value }))} disabled={!ffmpegInstalled || !tempSettings.autoConvertGifs}>
|
|
||||||
<SelectTrigger id="gif-resolution" className="w-fit">
|
|
||||||
<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>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>)}
|
</div>)}
|
||||||
|
|
||||||
@@ -650,7 +824,7 @@ export function SettingsPage({ onUnsavedChangesChange, onResetRequest }: Setting
|
|||||||
</span>)}
|
</span>)}
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Info className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
<CircleQuestionMark className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent side="top">
|
<TooltipContent side="top">
|
||||||
<p>Required to fetch media from Twitter/X. Downloaded from the xtractor-binaries GitHub releases.</p>
|
<p>Required to fetch media from Twitter/X. Downloaded from the xtractor-binaries GitHub releases.</p>
|
||||||
@@ -684,7 +858,7 @@ export function SettingsPage({ onUnsavedChangesChange, onResetRequest }: Setting
|
|||||||
</span>)}
|
</span>)}
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Info className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
<CircleQuestionMark className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent side="top">
|
<TooltipContent side="top">
|
||||||
<p>FFmpeg is required to convert Twitter's MP4 to actual GIF format</p>
|
<p>FFmpeg is required to convert Twitter's MP4 to actual GIF format</p>
|
||||||
@@ -718,7 +892,7 @@ export function SettingsPage({ onUnsavedChangesChange, onResetRequest }: Setting
|
|||||||
</span>)}
|
</span>)}
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<Info className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
<CircleQuestionMark className="h-3.5 w-3.5 cursor-help text-muted-foreground"/>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent side="top">
|
<TooltipContent side="top">
|
||||||
<p>ExifTool is required to embed tweet URL and original filename into media file metadata</p>
|
<p>ExifTool is required to embed tweet URL and original filename into media file metadata</p>
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ export function Sidebar({ currentPage, onPageChange }: SidebarProps) {
|
|||||||
</Button>
|
</Button>
|
||||||
</TooltipTrigger>
|
</TooltipTrigger>
|
||||||
<TooltipContent side="right">
|
<TooltipContent side="right">
|
||||||
<p>Support me on Ko-fi</p>
|
<p>Support Me</p>
|
||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ import { useState } from "react";
|
|||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||||
import { CircleCheck, Copy } from "lucide-react";
|
import { CircleCheck, Copy } from "lucide-react";
|
||||||
import { openExternal } from "@/lib/utils";
|
|
||||||
import KofiLogo from "@/assets/ko-fi.gif";
|
|
||||||
import KofiSvg from "@/assets/kofi_symbol.svg";
|
|
||||||
import UsdtTronQr from "@/assets/usdt.jpg";
|
import UsdtTronQr from "@/assets/usdt.jpg";
|
||||||
import UsdtEvmQr from "@/assets/usdt_evm.jpg";
|
import UsdtEvmQr from "@/assets/usdt_evm.jpg";
|
||||||
import UsdcEvmQr from "@/assets/usdc.jpg";
|
import UsdcEvmQr from "@/assets/usdc.jpg";
|
||||||
@@ -49,34 +46,16 @@ export function SupportPage() {
|
|||||||
setSelectedNetwork("ethereum");
|
setSelectedNetwork("ethereum");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return (<div className="flex min-h-[70vh] items-center justify-center p-4">
|
return (<div className="mx-auto flex min-h-[70vh] w-full max-w-lg flex-col items-center justify-center space-y-4 p-6">
|
||||||
<div className="flex w-full max-w-3xl flex-col items-stretch rounded-xl border bg-card shadow-sm md:flex-row">
|
|
||||||
<div className="flex min-w-0 flex-1 basis-0 flex-col items-center justify-between space-y-6 border-b p-6 md:border-r md:border-b-0">
|
|
||||||
<div className="flex flex-col items-center space-y-4">
|
|
||||||
<div className="relative flex h-32 w-full items-center justify-center">
|
|
||||||
<img src={KofiLogo} className="pointer-events-none absolute w-72" alt="Ko-fi"/>
|
|
||||||
</div>
|
|
||||||
<h4 className="font-semibold text-foreground">Support via Ko-fi</h4>
|
|
||||||
<p className="px-4 text-center text-sm text-muted-foreground">
|
|
||||||
Enjoying the project? You can support ongoing development by buying me a coffee.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<Button className="h-9 w-4/5 gap-2 bg-[#72a4f2] text-sm font-semibold text-white hover:bg-[#5f8cd6]" onClick={() => openExternal("https://ko-fi.com/afkarxyz")}>
|
|
||||||
<img src={KofiSvg} className="h-6 w-6 shrink-0" alt="" aria-hidden="true"/>
|
|
||||||
Support me on Ko-fi
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex min-w-0 flex-1 basis-0 flex-col items-center justify-between space-y-4 p-6">
|
|
||||||
<div className="flex w-full flex-col items-center space-y-3">
|
<div className="flex w-full flex-col items-center space-y-3">
|
||||||
<div className="flex h-32 items-center justify-center">
|
<div className="flex h-40 items-center justify-center">
|
||||||
<div className="rounded-xl border bg-white p-2 shadow-sm">
|
<div className="rounded-xl border bg-white p-2 shadow-sm">
|
||||||
<img src={cryptoQr} className="h-24 w-24 object-contain" alt={`${selectedCoin.toUpperCase()} ${activeNetwork.label} QR code`}/>
|
<img src={cryptoQr} className="h-32 w-32 object-contain" alt={`${selectedCoin.toUpperCase()} ${activeNetwork.label} QR code`}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h4 className="font-semibold text-foreground">Support via Crypto</h4>
|
<h4 className="font-semibold text-foreground">Support via Crypto</h4>
|
||||||
<p className="px-4 text-center text-sm text-muted-foreground">
|
<p className="px-4 text-center text-sm text-muted-foreground">
|
||||||
Crypto donations are also accepted. Scan the QR code or copy the address.
|
Scan the QR code or copy the address to support the project.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full space-y-2">
|
<div className="w-full space-y-2">
|
||||||
@@ -115,7 +94,5 @@ export function SupportPage() {
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>);
|
</div>);
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { X, Minus, Maximize, Info, Puzzle, FileCode2, Globe } from "lucide-react";
|
import { X, Minus, Maximize, Sparkles, Puzzle, FileCode2, Globe, ArrowLeft, ArrowRight, RotateCw } from "lucide-react";
|
||||||
import { WindowMinimise, WindowToggleMaximise, Quit } from "../../wailsjs/runtime/runtime";
|
import { WindowMinimise, WindowToggleMaximise, Quit } from "../../wailsjs/runtime/runtime";
|
||||||
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from "@/components/ui/dropdown-menu";
|
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from "@/components/ui/dropdown-menu";
|
||||||
import { openExternal } from "@/lib/utils";
|
import { openExternal } from "@/lib/utils";
|
||||||
@@ -7,7 +7,14 @@ const INFO_LINKS = [
|
|||||||
{ label: "Userscript", icon: FileCode2, url: "https://greasyfork.org/en/scripts/523157" },
|
{ label: "Userscript", icon: FileCode2, url: "https://greasyfork.org/en/scripts/523157" },
|
||||||
{ label: "Website", icon: Globe, url: "https://twitterdl.app" },
|
{ label: "Website", icon: Globe, url: "https://twitterdl.app" },
|
||||||
];
|
];
|
||||||
export function TitleBar() {
|
interface TitleBarProps {
|
||||||
|
canGoBack?: boolean;
|
||||||
|
canGoForward?: boolean;
|
||||||
|
navigationDisabled?: boolean;
|
||||||
|
onBack?: () => void;
|
||||||
|
onForward?: () => void;
|
||||||
|
}
|
||||||
|
export function TitleBar({ canGoBack = false, canGoForward = false, navigationDisabled = false, onBack, onForward }: TitleBarProps) {
|
||||||
const handleMinimize = () => {
|
const handleMinimize = () => {
|
||||||
WindowMinimise();
|
WindowMinimise();
|
||||||
};
|
};
|
||||||
@@ -21,12 +28,18 @@ export function TitleBar() {
|
|||||||
|
|
||||||
<div className="fixed top-0 left-14 right-0 h-10 z-40 bg-background/80 backdrop-blur-sm" style={{ "--wails-draggable": "drag" } as React.CSSProperties} onDoubleClick={handleMaximize}/>
|
<div className="fixed top-0 left-14 right-0 h-10 z-40 bg-background/80 backdrop-blur-sm" style={{ "--wails-draggable": "drag" } as React.CSSProperties} onDoubleClick={handleMaximize}/>
|
||||||
|
|
||||||
|
<div className="fixed top-1.5 left-16 z-50 flex h-7 items-center gap-0.5" style={{ "--wails-draggable": "no-drag" } as React.CSSProperties}>
|
||||||
|
<button type="button" onClick={onBack} disabled={!canGoBack || navigationDisabled} className="flex size-7 items-center justify-center rounded transition-colors hover:bg-muted disabled:cursor-default disabled:opacity-35 disabled:hover:bg-transparent" aria-label="Go back"><ArrowLeft className="h-3.5 w-3.5"/></button>
|
||||||
|
<button type="button" onClick={onForward} disabled={!canGoForward || navigationDisabled} className="flex size-7 items-center justify-center rounded transition-colors hover:bg-muted disabled:cursor-default disabled:opacity-35 disabled:hover:bg-transparent" aria-label="Go forward"><ArrowRight className="h-3.5 w-3.5"/></button>
|
||||||
|
<button type="button" onClick={() => window.location.reload()} className="flex size-7 items-center justify-center rounded transition-colors hover:bg-muted" aria-label="Reload"><RotateCw className="h-3.5 w-3.5"/></button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div className="fixed top-1.5 right-2 z-50 flex h-7 gap-0.5" style={{ "--wails-draggable": "no-drag" } as React.CSSProperties}>
|
<div className="fixed top-1.5 right-2 z-50 flex h-7 gap-0.5" style={{ "--wails-draggable": "no-drag" } as React.CSSProperties}>
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger asChild>
|
<DropdownMenuTrigger asChild>
|
||||||
<button className="w-8 h-7 flex items-center justify-center hover:bg-muted transition-colors rounded" aria-label="Info">
|
<button className="size-7 flex items-center justify-center hover:bg-muted transition-colors rounded" aria-label="Info">
|
||||||
<Info className="w-3.5 h-3.5"/>
|
<Sparkles className="h-3.5 w-3.5 text-primary"/>
|
||||||
</button>
|
</button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent align="end">
|
<DropdownMenuContent align="end">
|
||||||
@@ -36,13 +49,13 @@ export function TitleBar() {
|
|||||||
</DropdownMenuItem>))}
|
</DropdownMenuItem>))}
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
<button onClick={handleMinimize} className="w-8 h-7 flex items-center justify-center hover:bg-muted transition-colors rounded" aria-label="Minimize">
|
<button onClick={handleMinimize} className="size-7 flex items-center justify-center hover:bg-muted transition-colors rounded" aria-label="Minimize">
|
||||||
<Minus className="w-3.5 h-3.5"/>
|
<Minus className="w-3.5 h-3.5"/>
|
||||||
</button>
|
</button>
|
||||||
<button onClick={handleMaximize} className="w-8 h-7 flex items-center justify-center hover:bg-muted transition-colors rounded" aria-label="Maximize">
|
<button onClick={handleMaximize} className="size-7 flex items-center justify-center hover:bg-muted transition-colors rounded" aria-label="Maximize">
|
||||||
<Maximize className="w-3.5 h-3.5"/>
|
<Maximize className="w-3.5 h-3.5"/>
|
||||||
</button>
|
</button>
|
||||||
<button onClick={handleClose} className="w-8 h-7 flex items-center justify-center hover:bg-destructive hover:text-white transition-colors rounded" aria-label="Close">
|
<button onClick={handleClose} className="size-7 flex items-center justify-center hover:bg-destructive hover:text-white transition-colors rounded" aria-label="Close">
|
||||||
<X className="w-3.5 h-3.5"/>
|
<X className="w-3.5 h-3.5"/>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
export function normalizeFetchDelay(value: unknown): number {
|
||||||
|
return typeof value === "number" && Number.isFinite(value)
|
||||||
|
? Math.round(Math.min(3600, Math.max(0, value)) * 1000) / 1000
|
||||||
|
: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// One gate shared by all fetch paths, so switching accounts also respects pacing.
|
||||||
|
export function createFetchDelayGate({
|
||||||
|
now = () => performance.now(),
|
||||||
|
random = Math.random,
|
||||||
|
sleep = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms)),
|
||||||
|
} = {}) {
|
||||||
|
let lastStarted: number | null = null;
|
||||||
|
return async (baseSeconds: number, extraSeconds: number, stopped: () => boolean): Promise<boolean> => {
|
||||||
|
const delay = (normalizeFetchDelay(baseSeconds) + random() * normalizeFetchDelay(extraSeconds)) * 1000;
|
||||||
|
while (!stopped()) {
|
||||||
|
const remaining = lastStarted === null ? 0 : lastStarted + delay - now();
|
||||||
|
if (remaining <= 0) {
|
||||||
|
lastStarted = now();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Recheck the shared timestamp after each wait to space concurrent callers too.
|
||||||
|
await sleep(Math.min(remaining, 100));
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
export function extractMarkdownSection(body: string, heading: string): string {
|
||||||
|
const text = (body || "").replace(/\r\n/g, "\n");
|
||||||
|
const lines = text.split("\n");
|
||||||
|
const target = heading.trim().toLowerCase();
|
||||||
|
let start = -1;
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
const match = lines[i].match(/^#{1,6}\s+(.*)$/);
|
||||||
|
if (match && match[1].trim().toLowerCase() === target) {
|
||||||
|
start = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (start === -1) {
|
||||||
|
return text.trim();
|
||||||
|
}
|
||||||
|
const collected: string[] = [];
|
||||||
|
for (let i = start; i < lines.length; i++) {
|
||||||
|
if (/^#{1,6}\s+/.test(lines[i])) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
collected.push(lines[i]);
|
||||||
|
}
|
||||||
|
return collected.join("\n").trim();
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
import { GetDefaults } from "../../wailsjs/go/main/App";
|
import { GetDefaults } from "../../wailsjs/go/main/App";
|
||||||
|
import { normalizeFetchDelay } from "./fetch-delay";
|
||||||
|
import { normalizeBaseColorName, normalizeThemeName, type BaseColorName, type ThemeName } from "./themes";
|
||||||
export type BuiltInFontFamily = "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" | "bricolage-grotesque";
|
export type BuiltInFontFamily = "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" | "bricolage-grotesque";
|
||||||
export type CustomFontFamily = `custom-${string}`;
|
export type CustomFontFamily = `custom-${string}`;
|
||||||
export type FontFamily = BuiltInFontFamily | CustomFontFamily;
|
export type FontFamily = BuiltInFontFamily | CustomFontFamily;
|
||||||
@@ -145,22 +147,33 @@ const MAX_CONCURRENT_DOWNLOADS = 50;
|
|||||||
const DEFAULT_RETRY_ATTEMPTS = 1;
|
const DEFAULT_RETRY_ATTEMPTS = 1;
|
||||||
const MIN_RETRY_ATTEMPTS = 1;
|
const MIN_RETRY_ATTEMPTS = 1;
|
||||||
const MAX_RETRY_ATTEMPTS = 5;
|
const MAX_RETRY_ATTEMPTS = 5;
|
||||||
|
const DEFAULT_DOWNLOAD_SPEED_LIMIT_KBPS = 0;
|
||||||
|
const MAX_DOWNLOAD_SPEED_LIMIT_KBPS = 10 * 1024 * 1024;
|
||||||
|
const DEFAULT_DOWNLOAD_DELAY_SECONDS = 0;
|
||||||
|
const MAX_DOWNLOAD_DELAY_SECONDS = 60 * 60;
|
||||||
export interface Settings {
|
export interface Settings {
|
||||||
downloadPath: string;
|
downloadPath: string;
|
||||||
concurrentDownloads: number;
|
concurrentDownloads: number;
|
||||||
skipExistingFiles: boolean;
|
skipExistingFiles: boolean;
|
||||||
deleteIncompleteFiles: boolean;
|
deleteIncompleteFiles: boolean;
|
||||||
retryAttempts: number;
|
retryAttempts: number;
|
||||||
theme: string;
|
downloadSpeedLimitKBps: number;
|
||||||
|
downloadDelaySeconds: number;
|
||||||
|
downloadDelayJitterSeconds: number;
|
||||||
|
baseColor: BaseColorName;
|
||||||
|
theme: ThemeName;
|
||||||
themeMode: "auto" | "light" | "dark";
|
themeMode: "auto" | "light" | "dark";
|
||||||
fontFamily: FontFamily;
|
fontFamily: FontFamily;
|
||||||
customFonts: CustomFontOption[];
|
customFonts: CustomFontOption[];
|
||||||
sfxEnabled: boolean;
|
sfxEnabled: boolean;
|
||||||
|
showUpdateNotifications: boolean;
|
||||||
autoConvertGifs: boolean;
|
autoConvertGifs: boolean;
|
||||||
gifQuality: GifQuality;
|
gifQuality: GifQuality;
|
||||||
gifResolution: GifResolution;
|
gifResolution: GifResolution;
|
||||||
proxy: string;
|
proxy: string;
|
||||||
fetchTimeout: number;
|
fetchTimeout: number;
|
||||||
|
fetchDelaySeconds: number;
|
||||||
|
fetchDelayJitterSeconds: number;
|
||||||
includePhotos: boolean;
|
includePhotos: boolean;
|
||||||
includeVideos: boolean;
|
includeVideos: boolean;
|
||||||
includeGifs: boolean;
|
includeGifs: boolean;
|
||||||
@@ -179,16 +192,23 @@ export const DEFAULT_SETTINGS: Settings = {
|
|||||||
skipExistingFiles: true,
|
skipExistingFiles: true,
|
||||||
deleteIncompleteFiles: true,
|
deleteIncompleteFiles: true,
|
||||||
retryAttempts: DEFAULT_RETRY_ATTEMPTS,
|
retryAttempts: DEFAULT_RETRY_ATTEMPTS,
|
||||||
|
downloadSpeedLimitKBps: DEFAULT_DOWNLOAD_SPEED_LIMIT_KBPS,
|
||||||
|
downloadDelaySeconds: DEFAULT_DOWNLOAD_DELAY_SECONDS,
|
||||||
|
downloadDelayJitterSeconds: DEFAULT_DOWNLOAD_DELAY_SECONDS,
|
||||||
|
baseColor: "neutral",
|
||||||
theme: "yellow",
|
theme: "yellow",
|
||||||
themeMode: "auto",
|
themeMode: "auto",
|
||||||
fontFamily: "google-sans",
|
fontFamily: "google-sans",
|
||||||
customFonts: [],
|
customFonts: [],
|
||||||
sfxEnabled: true,
|
sfxEnabled: true,
|
||||||
|
showUpdateNotifications: true,
|
||||||
autoConvertGifs: false,
|
autoConvertGifs: false,
|
||||||
gifQuality: "fast",
|
gifQuality: "fast",
|
||||||
gifResolution: "original",
|
gifResolution: "original",
|
||||||
proxy: "",
|
proxy: "",
|
||||||
fetchTimeout: 60,
|
fetchTimeout: 60,
|
||||||
|
fetchDelaySeconds: 0,
|
||||||
|
fetchDelayJitterSeconds: 0,
|
||||||
includePhotos: true,
|
includePhotos: true,
|
||||||
includeVideos: true,
|
includeVideos: true,
|
||||||
includeGifs: true,
|
includeGifs: true,
|
||||||
@@ -449,6 +469,19 @@ function normalizeRetryAttempts(value: unknown): number {
|
|||||||
}
|
}
|
||||||
return rounded;
|
return rounded;
|
||||||
}
|
}
|
||||||
|
function normalizeDownloadSpeedLimit(value: unknown): number {
|
||||||
|
if (typeof value !== "number" || !Number.isFinite(value)) {
|
||||||
|
return DEFAULT_DOWNLOAD_SPEED_LIMIT_KBPS;
|
||||||
|
}
|
||||||
|
return Math.min(MAX_DOWNLOAD_SPEED_LIMIT_KBPS, Math.max(0, Math.round(value)));
|
||||||
|
}
|
||||||
|
function normalizeDownloadDelay(value: unknown): number {
|
||||||
|
if (typeof value !== "number" || !Number.isFinite(value)) {
|
||||||
|
return DEFAULT_DOWNLOAD_DELAY_SECONDS;
|
||||||
|
}
|
||||||
|
const milliseconds = Math.round(Math.min(MAX_DOWNLOAD_DELAY_SECONDS, Math.max(0, value)) * 1000);
|
||||||
|
return milliseconds / 1000;
|
||||||
|
}
|
||||||
function normalizeTemplateTokens(value: unknown, fallback: string): string {
|
function normalizeTemplateTokens(value: unknown, fallback: string): string {
|
||||||
if (typeof value !== "string") {
|
if (typeof value !== "string") {
|
||||||
return fallback;
|
return fallback;
|
||||||
@@ -509,13 +542,22 @@ async function fetchDefaultPath(): Promise<string> {
|
|||||||
}
|
}
|
||||||
function toNormalizedSettings(settings: Partial<Settings>): Settings {
|
function toNormalizedSettings(settings: Partial<Settings>): Settings {
|
||||||
const customFonts = normalizeCustomFonts(settings.customFonts);
|
const customFonts = normalizeCustomFonts(settings.customFonts);
|
||||||
|
const baseColor = normalizeBaseColorName(settings.baseColor);
|
||||||
return {
|
return {
|
||||||
...DEFAULT_SETTINGS,
|
...DEFAULT_SETTINGS,
|
||||||
...settings,
|
...settings,
|
||||||
|
baseColor,
|
||||||
|
theme: normalizeThemeName(settings.theme, baseColor),
|
||||||
concurrentDownloads: normalizeConcurrentDownloads(settings.concurrentDownloads),
|
concurrentDownloads: normalizeConcurrentDownloads(settings.concurrentDownloads),
|
||||||
skipExistingFiles: normalizeBoolean(settings.skipExistingFiles, DEFAULT_SETTINGS.skipExistingFiles),
|
skipExistingFiles: normalizeBoolean(settings.skipExistingFiles, DEFAULT_SETTINGS.skipExistingFiles),
|
||||||
deleteIncompleteFiles: normalizeBoolean(settings.deleteIncompleteFiles, DEFAULT_SETTINGS.deleteIncompleteFiles),
|
deleteIncompleteFiles: normalizeBoolean(settings.deleteIncompleteFiles, DEFAULT_SETTINGS.deleteIncompleteFiles),
|
||||||
retryAttempts: normalizeRetryAttempts(settings.retryAttempts),
|
retryAttempts: normalizeRetryAttempts(settings.retryAttempts),
|
||||||
|
downloadSpeedLimitKBps: normalizeDownloadSpeedLimit(settings.downloadSpeedLimitKBps),
|
||||||
|
downloadDelaySeconds: normalizeDownloadDelay(settings.downloadDelaySeconds),
|
||||||
|
downloadDelayJitterSeconds: normalizeDownloadDelay(settings.downloadDelayJitterSeconds),
|
||||||
|
fetchDelaySeconds: normalizeFetchDelay(settings.fetchDelaySeconds),
|
||||||
|
fetchDelayJitterSeconds: normalizeFetchDelay(settings.fetchDelayJitterSeconds),
|
||||||
|
showUpdateNotifications: normalizeBoolean(settings.showUpdateNotifications, DEFAULT_SETTINGS.showUpdateNotifications),
|
||||||
autoConvertGifs: normalizeBoolean(settings.autoConvertGifs, DEFAULT_SETTINGS.autoConvertGifs),
|
autoConvertGifs: normalizeBoolean(settings.autoConvertGifs, DEFAULT_SETTINGS.autoConvertGifs),
|
||||||
filenameTemplate: normalizeFilenameTemplate(settings.filenameTemplate),
|
filenameTemplate: normalizeFilenameTemplate(settings.filenameTemplate),
|
||||||
folderTemplate: normalizeFolderTemplate(settings.folderTemplate),
|
folderTemplate: normalizeFolderTemplate(settings.folderTemplate),
|
||||||
|
|||||||
+397
-95
@@ -1,11 +1,19 @@
|
|||||||
|
export const BASE_COLOR_NAMES = ["neutral", "stone", "zinc", "mauve", "olive", "mist", "taupe"] as const;
|
||||||
|
export const ACCENT_COLOR_NAMES = ["amber", "blue", "cyan", "emerald", "fuchsia", "green", "indigo", "lime", "orange", "pink", "purple", "red", "rose", "sky", "teal", "violet", "yellow"] as const;
|
||||||
|
export type BaseColorName = (typeof BASE_COLOR_NAMES)[number];
|
||||||
|
export type AccentColorName = (typeof ACCENT_COLOR_NAMES)[number];
|
||||||
|
export type ThemeName = BaseColorName | AccentColorName;
|
||||||
export interface Theme {
|
export interface Theme {
|
||||||
name: string;
|
name: ThemeName;
|
||||||
label: string;
|
label: string;
|
||||||
cssVars: {
|
cssVars: {
|
||||||
light: Record<string, string>;
|
light: Record<string, string>;
|
||||||
dark: Record<string, string>;
|
dark: Record<string, string>;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
export interface BaseColor extends Theme {
|
||||||
|
name: BaseColorName;
|
||||||
|
}
|
||||||
const baseLightColors: Record<string, string> = {
|
const baseLightColors: Record<string, string> = {
|
||||||
background: "oklch(1 0 0)",
|
background: "oklch(1 0 0)",
|
||||||
foreground: "oklch(0.145 0 0)",
|
foreground: "oklch(0.145 0 0)",
|
||||||
@@ -13,13 +21,15 @@ const baseLightColors: Record<string, string> = {
|
|||||||
"card-foreground": "oklch(0.145 0 0)",
|
"card-foreground": "oklch(0.145 0 0)",
|
||||||
popover: "oklch(1 0 0)",
|
popover: "oklch(1 0 0)",
|
||||||
"popover-foreground": "oklch(0.145 0 0)",
|
"popover-foreground": "oklch(0.145 0 0)",
|
||||||
secondary: "oklch(0.967 0.001 286.375)",
|
primary: "oklch(0.205 0 0)",
|
||||||
"secondary-foreground": "oklch(0.21 0.006 285.885)",
|
"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: "oklch(0.97 0 0)",
|
||||||
"muted-foreground": "oklch(0.556 0 0)",
|
"muted-foreground": "oklch(0.556 0 0)",
|
||||||
accent: "oklch(0.97 0 0)",
|
accent: "oklch(0.97 0 0)",
|
||||||
"accent-foreground": "oklch(0.205 0 0)",
|
"accent-foreground": "oklch(0.205 0 0)",
|
||||||
destructive: "oklch(0.58 0.22 27)",
|
destructive: "oklch(0.577 0.245 27.325)",
|
||||||
border: "oklch(0.922 0 0)",
|
border: "oklch(0.922 0 0)",
|
||||||
input: "oklch(0.922 0 0)",
|
input: "oklch(0.922 0 0)",
|
||||||
ring: "oklch(0.708 0 0)",
|
ring: "oklch(0.708 0 0)",
|
||||||
@@ -31,17 +41,280 @@ const baseDarkColors: Record<string, string> = {
|
|||||||
"card-foreground": "oklch(0.985 0 0)",
|
"card-foreground": "oklch(0.985 0 0)",
|
||||||
popover: "oklch(0.205 0 0)",
|
popover: "oklch(0.205 0 0)",
|
||||||
"popover-foreground": "oklch(0.985 0 0)",
|
"popover-foreground": "oklch(0.985 0 0)",
|
||||||
secondary: "oklch(0.274 0.006 286.033)",
|
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)",
|
"secondary-foreground": "oklch(0.985 0 0)",
|
||||||
muted: "oklch(0.269 0 0)",
|
muted: "oklch(0.269 0 0)",
|
||||||
"muted-foreground": "oklch(0.708 0 0)",
|
"muted-foreground": "oklch(0.708 0 0)",
|
||||||
accent: "oklch(0.371 0 0)",
|
accent: "oklch(0.269 0 0)",
|
||||||
"accent-foreground": "oklch(0.985 0 0)",
|
"accent-foreground": "oklch(0.985 0 0)",
|
||||||
destructive: "oklch(0.704 0.191 22.216)",
|
destructive: "oklch(0.704 0.191 22.216)",
|
||||||
border: "oklch(1 0 0 / 10%)",
|
border: "oklch(1 0 0 / 10%)",
|
||||||
input: "oklch(1 0 0 / 15%)",
|
input: "oklch(1 0 0 / 15%)",
|
||||||
ring: "oklch(0.556 0 0)",
|
ring: "oklch(0.556 0 0)",
|
||||||
};
|
};
|
||||||
|
function createBaseColor(name: BaseColorName, label: string, cssVars: Theme["cssVars"]): BaseColor {
|
||||||
|
return { name, label, cssVars };
|
||||||
|
}
|
||||||
|
export const baseColors: BaseColor[] = [
|
||||||
|
createBaseColor("neutral", "Neutral", {
|
||||||
|
light: baseLightColors,
|
||||||
|
dark: baseDarkColors,
|
||||||
|
}),
|
||||||
|
createBaseColor("stone", "Stone", {
|
||||||
|
light: {
|
||||||
|
background: "oklch(1 0 0)",
|
||||||
|
foreground: "oklch(0.147 0.004 49.25)",
|
||||||
|
card: "oklch(1 0 0)",
|
||||||
|
"card-foreground": "oklch(0.147 0.004 49.25)",
|
||||||
|
popover: "oklch(1 0 0)",
|
||||||
|
"popover-foreground": "oklch(0.147 0.004 49.25)",
|
||||||
|
primary: "oklch(0.216 0.006 56.043)",
|
||||||
|
"primary-foreground": "oklch(0.985 0.001 106.423)",
|
||||||
|
secondary: "oklch(0.97 0.001 106.424)",
|
||||||
|
"secondary-foreground": "oklch(0.216 0.006 56.043)",
|
||||||
|
muted: "oklch(0.97 0.001 106.424)",
|
||||||
|
"muted-foreground": "oklch(0.553 0.013 58.071)",
|
||||||
|
accent: "oklch(0.97 0.001 106.424)",
|
||||||
|
"accent-foreground": "oklch(0.216 0.006 56.043)",
|
||||||
|
destructive: "oklch(0.577 0.245 27.325)",
|
||||||
|
border: "oklch(0.923 0.003 48.717)",
|
||||||
|
input: "oklch(0.923 0.003 48.717)",
|
||||||
|
ring: "oklch(0.709 0.01 56.259)",
|
||||||
|
},
|
||||||
|
dark: {
|
||||||
|
background: "oklch(0.147 0.004 49.25)",
|
||||||
|
foreground: "oklch(0.985 0.001 106.423)",
|
||||||
|
card: "oklch(0.216 0.006 56.043)",
|
||||||
|
"card-foreground": "oklch(0.985 0.001 106.423)",
|
||||||
|
popover: "oklch(0.216 0.006 56.043)",
|
||||||
|
"popover-foreground": "oklch(0.985 0.001 106.423)",
|
||||||
|
primary: "oklch(0.923 0.003 48.717)",
|
||||||
|
"primary-foreground": "oklch(0.216 0.006 56.043)",
|
||||||
|
secondary: "oklch(0.268 0.007 34.298)",
|
||||||
|
"secondary-foreground": "oklch(0.985 0.001 106.423)",
|
||||||
|
muted: "oklch(0.268 0.007 34.298)",
|
||||||
|
"muted-foreground": "oklch(0.709 0.01 56.259)",
|
||||||
|
accent: "oklch(0.268 0.007 34.298)",
|
||||||
|
"accent-foreground": "oklch(0.985 0.001 106.423)",
|
||||||
|
destructive: "oklch(0.704 0.191 22.216)",
|
||||||
|
border: "oklch(1 0 0 / 10%)",
|
||||||
|
input: "oklch(1 0 0 / 15%)",
|
||||||
|
ring: "oklch(0.553 0.013 58.071)",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
createBaseColor("zinc", "Zinc", {
|
||||||
|
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.21 0.006 285.885)",
|
||||||
|
"primary-foreground": "oklch(0.985 0 0)",
|
||||||
|
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.705 0.015 286.067)",
|
||||||
|
},
|
||||||
|
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.92 0.004 286.32)",
|
||||||
|
"primary-foreground": "oklch(0.21 0.006 285.885)",
|
||||||
|
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.552 0.016 285.938)",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
createBaseColor("mauve", "Mauve", {
|
||||||
|
light: {
|
||||||
|
background: "oklch(1 0 0)",
|
||||||
|
foreground: "oklch(0.145 0.008 326)",
|
||||||
|
card: "oklch(1 0 0)",
|
||||||
|
"card-foreground": "oklch(0.145 0.008 326)",
|
||||||
|
popover: "oklch(1 0 0)",
|
||||||
|
"popover-foreground": "oklch(0.145 0.008 326)",
|
||||||
|
primary: "oklch(0.212 0.019 322.12)",
|
||||||
|
"primary-foreground": "oklch(0.985 0 0)",
|
||||||
|
secondary: "oklch(0.96 0.003 325.6)",
|
||||||
|
"secondary-foreground": "oklch(0.212 0.019 322.12)",
|
||||||
|
muted: "oklch(0.96 0.003 325.6)",
|
||||||
|
"muted-foreground": "oklch(0.542 0.034 322.5)",
|
||||||
|
accent: "oklch(0.96 0.003 325.6)",
|
||||||
|
"accent-foreground": "oklch(0.212 0.019 322.12)",
|
||||||
|
destructive: "oklch(0.577 0.245 27.325)",
|
||||||
|
border: "oklch(0.922 0.005 325.62)",
|
||||||
|
input: "oklch(0.922 0.005 325.62)",
|
||||||
|
ring: "oklch(0.711 0.019 323.02)",
|
||||||
|
},
|
||||||
|
dark: {
|
||||||
|
background: "oklch(0.145 0.008 326)",
|
||||||
|
foreground: "oklch(0.985 0 0)",
|
||||||
|
card: "oklch(0.212 0.019 322.12)",
|
||||||
|
"card-foreground": "oklch(0.985 0 0)",
|
||||||
|
popover: "oklch(0.212 0.019 322.12)",
|
||||||
|
"popover-foreground": "oklch(0.985 0 0)",
|
||||||
|
primary: "oklch(0.922 0.005 325.62)",
|
||||||
|
"primary-foreground": "oklch(0.212 0.019 322.12)",
|
||||||
|
secondary: "oklch(0.263 0.024 320.12)",
|
||||||
|
"secondary-foreground": "oklch(0.985 0 0)",
|
||||||
|
muted: "oklch(0.263 0.024 320.12)",
|
||||||
|
"muted-foreground": "oklch(0.711 0.019 323.02)",
|
||||||
|
accent: "oklch(0.263 0.024 320.12)",
|
||||||
|
"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.542 0.034 322.5)",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
createBaseColor("olive", "Olive", {
|
||||||
|
light: {
|
||||||
|
background: "oklch(1 0 0)",
|
||||||
|
foreground: "oklch(0.153 0.006 107.1)",
|
||||||
|
card: "oklch(1 0 0)",
|
||||||
|
"card-foreground": "oklch(0.153 0.006 107.1)",
|
||||||
|
popover: "oklch(1 0 0)",
|
||||||
|
"popover-foreground": "oklch(0.153 0.006 107.1)",
|
||||||
|
primary: "oklch(0.228 0.013 107.4)",
|
||||||
|
"primary-foreground": "oklch(0.988 0.003 106.5)",
|
||||||
|
secondary: "oklch(0.966 0.005 106.5)",
|
||||||
|
"secondary-foreground": "oklch(0.228 0.013 107.4)",
|
||||||
|
muted: "oklch(0.966 0.005 106.5)",
|
||||||
|
"muted-foreground": "oklch(0.58 0.031 107.3)",
|
||||||
|
accent: "oklch(0.966 0.005 106.5)",
|
||||||
|
"accent-foreground": "oklch(0.228 0.013 107.4)",
|
||||||
|
destructive: "oklch(0.577 0.245 27.325)",
|
||||||
|
border: "oklch(0.93 0.007 106.5)",
|
||||||
|
input: "oklch(0.93 0.007 106.5)",
|
||||||
|
ring: "oklch(0.737 0.021 106.9)",
|
||||||
|
},
|
||||||
|
dark: {
|
||||||
|
background: "oklch(0.153 0.006 107.1)",
|
||||||
|
foreground: "oklch(0.988 0.003 106.5)",
|
||||||
|
card: "oklch(0.228 0.013 107.4)",
|
||||||
|
"card-foreground": "oklch(0.988 0.003 106.5)",
|
||||||
|
popover: "oklch(0.228 0.013 107.4)",
|
||||||
|
"popover-foreground": "oklch(0.988 0.003 106.5)",
|
||||||
|
primary: "oklch(0.93 0.007 106.5)",
|
||||||
|
"primary-foreground": "oklch(0.228 0.013 107.4)",
|
||||||
|
secondary: "oklch(0.286 0.016 107.4)",
|
||||||
|
"secondary-foreground": "oklch(0.988 0.003 106.5)",
|
||||||
|
muted: "oklch(0.286 0.016 107.4)",
|
||||||
|
"muted-foreground": "oklch(0.737 0.021 106.9)",
|
||||||
|
accent: "oklch(0.286 0.016 107.4)",
|
||||||
|
"accent-foreground": "oklch(0.988 0.003 106.5)",
|
||||||
|
destructive: "oklch(0.704 0.191 22.216)",
|
||||||
|
border: "oklch(1 0 0 / 10%)",
|
||||||
|
input: "oklch(1 0 0 / 15%)",
|
||||||
|
ring: "oklch(0.58 0.031 107.3)",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
createBaseColor("mist", "Mist", {
|
||||||
|
light: {
|
||||||
|
background: "oklch(1 0 0)",
|
||||||
|
foreground: "oklch(0.148 0.004 228.8)",
|
||||||
|
card: "oklch(1 0 0)",
|
||||||
|
"card-foreground": "oklch(0.148 0.004 228.8)",
|
||||||
|
popover: "oklch(1 0 0)",
|
||||||
|
"popover-foreground": "oklch(0.148 0.004 228.8)",
|
||||||
|
primary: "oklch(0.218 0.008 223.9)",
|
||||||
|
"primary-foreground": "oklch(0.987 0.002 197.1)",
|
||||||
|
secondary: "oklch(0.963 0.002 197.1)",
|
||||||
|
"secondary-foreground": "oklch(0.218 0.008 223.9)",
|
||||||
|
muted: "oklch(0.963 0.002 197.1)",
|
||||||
|
"muted-foreground": "oklch(0.56 0.021 213.5)",
|
||||||
|
accent: "oklch(0.963 0.002 197.1)",
|
||||||
|
"accent-foreground": "oklch(0.218 0.008 223.9)",
|
||||||
|
destructive: "oklch(0.577 0.245 27.325)",
|
||||||
|
border: "oklch(0.925 0.005 214.3)",
|
||||||
|
input: "oklch(0.925 0.005 214.3)",
|
||||||
|
ring: "oklch(0.723 0.014 214.4)",
|
||||||
|
},
|
||||||
|
dark: {
|
||||||
|
background: "oklch(0.148 0.004 228.8)",
|
||||||
|
foreground: "oklch(0.987 0.002 197.1)",
|
||||||
|
card: "oklch(0.218 0.008 223.9)",
|
||||||
|
"card-foreground": "oklch(0.987 0.002 197.1)",
|
||||||
|
popover: "oklch(0.218 0.008 223.9)",
|
||||||
|
"popover-foreground": "oklch(0.987 0.002 197.1)",
|
||||||
|
primary: "oklch(0.925 0.005 214.3)",
|
||||||
|
"primary-foreground": "oklch(0.218 0.008 223.9)",
|
||||||
|
secondary: "oklch(0.275 0.011 216.9)",
|
||||||
|
"secondary-foreground": "oklch(0.987 0.002 197.1)",
|
||||||
|
muted: "oklch(0.275 0.011 216.9)",
|
||||||
|
"muted-foreground": "oklch(0.723 0.014 214.4)",
|
||||||
|
accent: "oklch(0.275 0.011 216.9)",
|
||||||
|
"accent-foreground": "oklch(0.987 0.002 197.1)",
|
||||||
|
destructive: "oklch(0.704 0.191 22.216)",
|
||||||
|
border: "oklch(1 0 0 / 10%)",
|
||||||
|
input: "oklch(1 0 0 / 15%)",
|
||||||
|
ring: "oklch(0.56 0.021 213.5)",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
createBaseColor("taupe", "Taupe", {
|
||||||
|
light: {
|
||||||
|
background: "oklch(1 0 0)",
|
||||||
|
foreground: "oklch(0.147 0.004 49.3)",
|
||||||
|
card: "oklch(1 0 0)",
|
||||||
|
"card-foreground": "oklch(0.147 0.004 49.3)",
|
||||||
|
popover: "oklch(1 0 0)",
|
||||||
|
"popover-foreground": "oklch(0.147 0.004 49.3)",
|
||||||
|
primary: "oklch(0.214 0.009 43.1)",
|
||||||
|
"primary-foreground": "oklch(0.986 0.002 67.8)",
|
||||||
|
secondary: "oklch(0.96 0.002 17.2)",
|
||||||
|
"secondary-foreground": "oklch(0.214 0.009 43.1)",
|
||||||
|
muted: "oklch(0.96 0.002 17.2)",
|
||||||
|
"muted-foreground": "oklch(0.547 0.021 43.1)",
|
||||||
|
accent: "oklch(0.96 0.002 17.2)",
|
||||||
|
"accent-foreground": "oklch(0.214 0.009 43.1)",
|
||||||
|
destructive: "oklch(0.577 0.245 27.325)",
|
||||||
|
border: "oklch(0.922 0.005 34.3)",
|
||||||
|
input: "oklch(0.922 0.005 34.3)",
|
||||||
|
ring: "oklch(0.714 0.014 41.2)",
|
||||||
|
},
|
||||||
|
dark: {
|
||||||
|
background: "oklch(0.147 0.004 49.3)",
|
||||||
|
foreground: "oklch(0.986 0.002 67.8)",
|
||||||
|
card: "oklch(0.214 0.009 43.1)",
|
||||||
|
"card-foreground": "oklch(0.986 0.002 67.8)",
|
||||||
|
popover: "oklch(0.214 0.009 43.1)",
|
||||||
|
"popover-foreground": "oklch(0.986 0.002 67.8)",
|
||||||
|
primary: "oklch(0.922 0.005 34.3)",
|
||||||
|
"primary-foreground": "oklch(0.214 0.009 43.1)",
|
||||||
|
secondary: "oklch(0.268 0.011 36.5)",
|
||||||
|
"secondary-foreground": "oklch(0.986 0.002 67.8)",
|
||||||
|
muted: "oklch(0.268 0.011 36.5)",
|
||||||
|
"muted-foreground": "oklch(0.714 0.014 41.2)",
|
||||||
|
accent: "oklch(0.268 0.011 36.5)",
|
||||||
|
"accent-foreground": "oklch(0.986 0.002 67.8)",
|
||||||
|
destructive: "oklch(0.704 0.191 22.216)",
|
||||||
|
border: "oklch(1 0 0 / 10%)",
|
||||||
|
input: "oklch(1 0 0 / 15%)",
|
||||||
|
ring: "oklch(0.547 0.021 43.1)",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
];
|
||||||
interface PrimaryColors {
|
interface PrimaryColors {
|
||||||
light: {
|
light: {
|
||||||
primary: string;
|
primary: string;
|
||||||
@@ -52,15 +325,15 @@ interface PrimaryColors {
|
|||||||
"primary-foreground": string;
|
"primary-foreground": string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const primaryColors: Record<string, PrimaryColors> = {
|
const primaryColors: Record<AccentColorName, PrimaryColors> = {
|
||||||
amber: {
|
amber: {
|
||||||
light: {
|
light: {
|
||||||
primary: "oklch(0.67 0.16 58)",
|
primary: "oklch(0.555 0.163 48.998)",
|
||||||
"primary-foreground": "oklch(0.99 0.02 95)",
|
"primary-foreground": "oklch(0.987 0.022 95.277)",
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
primary: "oklch(0.77 0.16 70)",
|
primary: "oklch(0.473 0.137 46.201)",
|
||||||
"primary-foreground": "oklch(0.28 0.07 46)",
|
"primary-foreground": "oklch(0.987 0.022 95.277)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
blue: {
|
blue: {
|
||||||
@@ -69,157 +342,147 @@ const primaryColors: Record<string, PrimaryColors> = {
|
|||||||
"primary-foreground": "oklch(0.97 0.014 254.604)",
|
"primary-foreground": "oklch(0.97 0.014 254.604)",
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
primary: "oklch(0.42 0.18 266)",
|
primary: "oklch(0.424 0.199 265.638)",
|
||||||
"primary-foreground": "oklch(0.97 0.014 254.604)",
|
"primary-foreground": "oklch(0.97 0.014 254.604)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
cyan: {
|
cyan: {
|
||||||
light: {
|
light: {
|
||||||
primary: "oklch(0.61 0.11 222)",
|
primary: "oklch(0.52 0.105 223.128)",
|
||||||
"primary-foreground": "oklch(0.98 0.02 201)",
|
"primary-foreground": "oklch(0.984 0.019 200.873)",
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
primary: "oklch(0.71 0.13 215)",
|
primary: "oklch(0.45 0.085 224.283)",
|
||||||
"primary-foreground": "oklch(0.30 0.05 230)",
|
"primary-foreground": "oklch(0.984 0.019 200.873)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
emerald: {
|
emerald: {
|
||||||
light: {
|
light: {
|
||||||
primary: "oklch(0.60 0.13 163)",
|
primary: "oklch(0.508 0.118 165.612)",
|
||||||
"primary-foreground": "oklch(0.98 0.02 166)",
|
"primary-foreground": "oklch(0.979 0.021 166.113)",
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
primary: "oklch(0.70 0.15 162)",
|
primary: "oklch(0.432 0.095 166.913)",
|
||||||
"primary-foreground": "oklch(0.26 0.05 173)",
|
"primary-foreground": "oklch(0.979 0.021 166.113)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fuchsia: {
|
fuchsia: {
|
||||||
light: {
|
light: {
|
||||||
primary: "oklch(0.59 0.26 323)",
|
primary: "oklch(0.518 0.253 323.949)",
|
||||||
"primary-foreground": "oklch(0.98 0.02 320)",
|
"primary-foreground": "oklch(0.977 0.017 320.058)",
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
primary: "oklch(0.67 0.26 322)",
|
primary: "oklch(0.452 0.211 324.591)",
|
||||||
"primary-foreground": "oklch(0.98 0.02 320)",
|
"primary-foreground": "oklch(0.977 0.017 320.058)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
green: {
|
green: {
|
||||||
light: {
|
light: {
|
||||||
primary: "oklch(0.648 0.2 131.684)",
|
primary: "oklch(0.527 0.154 150.069)",
|
||||||
"primary-foreground": "oklch(0.986 0.031 120.757)",
|
"primary-foreground": "oklch(0.982 0.018 155.826)",
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
primary: "oklch(0.648 0.2 131.684)",
|
primary: "oklch(0.448 0.119 151.328)",
|
||||||
"primary-foreground": "oklch(0.986 0.031 120.757)",
|
"primary-foreground": "oklch(0.982 0.018 155.826)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
indigo: {
|
indigo: {
|
||||||
light: {
|
light: {
|
||||||
primary: "oklch(0.51 0.23 277)",
|
primary: "oklch(0.457 0.24 277.023)",
|
||||||
"primary-foreground": "oklch(0.96 0.02 272)",
|
"primary-foreground": "oklch(0.962 0.018 272.314)",
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
primary: "oklch(0.59 0.20 277)",
|
primary: "oklch(0.398 0.195 277.366)",
|
||||||
"primary-foreground": "oklch(0.96 0.02 272)",
|
"primary-foreground": "oklch(0.962 0.018 272.314)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
lime: {
|
lime: {
|
||||||
light: {
|
light: {
|
||||||
primary: "oklch(0.65 0.18 132)",
|
primary: "oklch(0.841 0.238 128.85)",
|
||||||
"primary-foreground": "oklch(0.99 0.03 121)",
|
"primary-foreground": "oklch(0.405 0.101 131.063)",
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
primary: "oklch(0.77 0.20 131)",
|
primary: "oklch(0.768 0.233 130.85)",
|
||||||
"primary-foreground": "oklch(0.27 0.07 132)",
|
"primary-foreground": "oklch(0.405 0.101 131.063)",
|
||||||
},
|
|
||||||
},
|
|
||||||
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: {
|
orange: {
|
||||||
light: {
|
light: {
|
||||||
primary: "oklch(0.646 0.222 41.116)",
|
primary: "oklch(0.553 0.195 38.402)",
|
||||||
"primary-foreground": "oklch(0.98 0.016 73.684)",
|
"primary-foreground": "oklch(0.98 0.016 73.684)",
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
primary: "oklch(0.705 0.213 47.604)",
|
primary: "oklch(0.47 0.157 37.304)",
|
||||||
"primary-foreground": "oklch(0.98 0.016 73.684)",
|
"primary-foreground": "oklch(0.98 0.016 73.684)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
pink: {
|
pink: {
|
||||||
light: {
|
light: {
|
||||||
primary: "oklch(0.59 0.22 1)",
|
primary: "oklch(0.525 0.223 3.958)",
|
||||||
"primary-foreground": "oklch(0.97 0.01 343)",
|
"primary-foreground": "oklch(0.971 0.014 343.198)",
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
primary: "oklch(0.66 0.21 354)",
|
primary: "oklch(0.459 0.187 3.815)",
|
||||||
"primary-foreground": "oklch(0.97 0.01 343)",
|
"primary-foreground": "oklch(0.971 0.014 343.198)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
purple: {
|
purple: {
|
||||||
light: {
|
light: {
|
||||||
primary: "oklch(0.56 0.25 302)",
|
primary: "oklch(0.496 0.265 301.924)",
|
||||||
"primary-foreground": "oklch(0.98 0.01 308)",
|
"primary-foreground": "oklch(0.977 0.014 308.299)",
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
primary: "oklch(0.63 0.23 304)",
|
primary: "oklch(0.438 0.218 303.724)",
|
||||||
"primary-foreground": "oklch(0.98 0.01 308)",
|
"primary-foreground": "oklch(0.977 0.014 308.299)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
red: {
|
red: {
|
||||||
light: {
|
light: {
|
||||||
primary: "oklch(0.577 0.245 27.325)",
|
primary: "oklch(0.505 0.213 27.518)",
|
||||||
"primary-foreground": "oklch(0.971 0.013 17.38)",
|
"primary-foreground": "oklch(0.971 0.013 17.38)",
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
primary: "oklch(0.637 0.237 25.331)",
|
primary: "oklch(0.444 0.177 26.899)",
|
||||||
"primary-foreground": "oklch(0.971 0.013 17.38)",
|
"primary-foreground": "oklch(0.971 0.013 17.38)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
rose: {
|
rose: {
|
||||||
light: {
|
light: {
|
||||||
primary: "oklch(0.586 0.253 17.585)",
|
primary: "oklch(0.514 0.222 16.935)",
|
||||||
"primary-foreground": "oklch(0.969 0.015 12.422)",
|
"primary-foreground": "oklch(0.969 0.015 12.422)",
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
primary: "oklch(0.645 0.246 16.439)",
|
primary: "oklch(0.455 0.188 13.697)",
|
||||||
"primary-foreground": "oklch(0.969 0.015 12.422)",
|
"primary-foreground": "oklch(0.969 0.015 12.422)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
sky: {
|
sky: {
|
||||||
light: {
|
light: {
|
||||||
primary: "oklch(0.59 0.14 242)",
|
primary: "oklch(0.5 0.134 242.749)",
|
||||||
"primary-foreground": "oklch(0.98 0.01 237)",
|
"primary-foreground": "oklch(0.977 0.013 236.62)",
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
primary: "oklch(0.68 0.15 237)",
|
primary: "oklch(0.443 0.11 240.79)",
|
||||||
"primary-foreground": "oklch(0.29 0.06 243)",
|
"primary-foreground": "oklch(0.977 0.013 236.62)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
teal: {
|
teal: {
|
||||||
light: {
|
light: {
|
||||||
primary: "oklch(0.60 0.10 185)",
|
primary: "oklch(0.511 0.096 186.391)",
|
||||||
"primary-foreground": "oklch(0.98 0.01 181)",
|
"primary-foreground": "oklch(0.984 0.014 180.72)",
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
primary: "oklch(0.70 0.12 183)",
|
primary: "oklch(0.437 0.078 188.216)",
|
||||||
"primary-foreground": "oklch(0.28 0.04 193)",
|
"primary-foreground": "oklch(0.984 0.014 180.72)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
violet: {
|
violet: {
|
||||||
light: {
|
light: {
|
||||||
primary: "oklch(0.541 0.281 293.009)",
|
primary: "oklch(0.491 0.27 292.581)",
|
||||||
"primary-foreground": "oklch(0.969 0.016 293.756)",
|
"primary-foreground": "oklch(0.969 0.016 293.756)",
|
||||||
},
|
},
|
||||||
dark: {
|
dark: {
|
||||||
primary: "oklch(0.606 0.25 292.717)",
|
primary: "oklch(0.432 0.232 292.759)",
|
||||||
"primary-foreground": "oklch(0.969 0.016 293.756)",
|
"primary-foreground": "oklch(0.969 0.016 293.756)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -234,38 +497,77 @@ const primaryColors: Record<string, PrimaryColors> = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
function createTheme(name: string, label: string, primary: PrimaryColors): Theme {
|
const coloredThemeLightColors: Record<string, string> = {
|
||||||
|
secondary: "oklch(0.967 0.001 286.375)",
|
||||||
|
"secondary-foreground": "oklch(0.21 0.006 285.885)",
|
||||||
|
};
|
||||||
|
const coloredThemeDarkColors: Record<string, string> = {
|
||||||
|
secondary: "oklch(0.274 0.006 286.033)",
|
||||||
|
"secondary-foreground": "oklch(0.985 0 0)",
|
||||||
|
};
|
||||||
|
function createAccentTheme(name: AccentColorName, label: string, primary: PrimaryColors): Theme {
|
||||||
return {
|
return {
|
||||||
name,
|
name,
|
||||||
label,
|
label,
|
||||||
cssVars: {
|
cssVars: {
|
||||||
light: { ...baseLightColors, ...primary.light },
|
light: { ...coloredThemeLightColors, ...primary.light },
|
||||||
dark: { ...baseDarkColors, ...primary.dark },
|
dark: { ...coloredThemeDarkColors, ...primary.dark },
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
export const themes: Theme[] = [
|
const accentThemes: Theme[] = [
|
||||||
createTheme("amber", "Amber", primaryColors.amber),
|
createAccentTheme("amber", "Amber", primaryColors.amber),
|
||||||
createTheme("blue", "Blue", primaryColors.blue),
|
createAccentTheme("blue", "Blue", primaryColors.blue),
|
||||||
createTheme("cyan", "Cyan", primaryColors.cyan),
|
createAccentTheme("cyan", "Cyan", primaryColors.cyan),
|
||||||
createTheme("emerald", "Emerald", primaryColors.emerald),
|
createAccentTheme("emerald", "Emerald", primaryColors.emerald),
|
||||||
createTheme("fuchsia", "Fuchsia", primaryColors.fuchsia),
|
createAccentTheme("fuchsia", "Fuchsia", primaryColors.fuchsia),
|
||||||
createTheme("green", "Green", primaryColors.green),
|
createAccentTheme("green", "Green", primaryColors.green),
|
||||||
createTheme("indigo", "Indigo", primaryColors.indigo),
|
createAccentTheme("indigo", "Indigo", primaryColors.indigo),
|
||||||
createTheme("lime", "Lime", primaryColors.lime),
|
createAccentTheme("lime", "Lime", primaryColors.lime),
|
||||||
createTheme("neutral", "Neutral", primaryColors.neutral),
|
createAccentTheme("orange", "Orange", primaryColors.orange),
|
||||||
createTheme("orange", "Orange", primaryColors.orange),
|
createAccentTheme("pink", "Pink", primaryColors.pink),
|
||||||
createTheme("pink", "Pink", primaryColors.pink),
|
createAccentTheme("purple", "Purple", primaryColors.purple),
|
||||||
createTheme("purple", "Purple", primaryColors.purple),
|
createAccentTheme("red", "Red", primaryColors.red),
|
||||||
createTheme("red", "Red", primaryColors.red),
|
createAccentTheme("rose", "Rose", primaryColors.rose),
|
||||||
createTheme("rose", "Rose", primaryColors.rose),
|
createAccentTheme("sky", "Sky", primaryColors.sky),
|
||||||
createTheme("sky", "Sky", primaryColors.sky),
|
createAccentTheme("teal", "Teal", primaryColors.teal),
|
||||||
createTheme("teal", "Teal", primaryColors.teal),
|
createAccentTheme("violet", "Violet", primaryColors.violet),
|
||||||
createTheme("violet", "Violet", primaryColors.violet),
|
createAccentTheme("yellow", "Yellow", primaryColors.yellow),
|
||||||
createTheme("yellow", "Yellow", primaryColors.yellow),
|
];
|
||||||
].sort((a, b) => a.name.localeCompare(b.name));
|
export function normalizeBaseColorName(baseColorName: unknown): BaseColorName {
|
||||||
export function applyTheme(themeName: string) {
|
return typeof baseColorName === "string" && BASE_COLOR_NAMES.includes(baseColorName as BaseColorName)
|
||||||
const theme = themes.find((t) => t.name === themeName) || themes[0];
|
? baseColorName as BaseColorName
|
||||||
|
: "neutral";
|
||||||
|
}
|
||||||
|
const themesByBaseColor = Object.fromEntries(baseColors.map((baseColor) => [
|
||||||
|
baseColor.name,
|
||||||
|
[
|
||||||
|
baseColor,
|
||||||
|
...accentThemes.map((accentTheme) => ({
|
||||||
|
...accentTheme,
|
||||||
|
cssVars: {
|
||||||
|
light: { ...baseColor.cssVars.light, ...accentTheme.cssVars.light },
|
||||||
|
dark: { ...baseColor.cssVars.dark, ...accentTheme.cssVars.dark },
|
||||||
|
},
|
||||||
|
})),
|
||||||
|
],
|
||||||
|
])) as Record<BaseColorName, Theme[]>;
|
||||||
|
export function getThemesForBaseColor(baseColorName: unknown): Theme[] {
|
||||||
|
return themesByBaseColor[normalizeBaseColorName(baseColorName)];
|
||||||
|
}
|
||||||
|
export function normalizeThemeName(themeName: unknown, baseColorName: unknown): ThemeName {
|
||||||
|
const normalizedBaseColor = normalizeBaseColorName(baseColorName);
|
||||||
|
const availableThemes = getThemesForBaseColor(normalizedBaseColor);
|
||||||
|
return typeof themeName === "string" && availableThemes.some((theme) => theme.name === themeName)
|
||||||
|
? themeName as ThemeName
|
||||||
|
: normalizedBaseColor;
|
||||||
|
}
|
||||||
|
export const themes = getThemesForBaseColor("neutral");
|
||||||
|
export function applyTheme(themeName: unknown, baseColorName: unknown = "neutral") {
|
||||||
|
const normalizedBaseColor = normalizeBaseColorName(baseColorName);
|
||||||
|
const availableThemes = getThemesForBaseColor(normalizedBaseColor);
|
||||||
|
const normalizedTheme = normalizeThemeName(themeName, normalizedBaseColor);
|
||||||
|
const theme = availableThemes.find((candidate) => candidate.name === normalizedTheme) || availableThemes[0];
|
||||||
const root = document.documentElement;
|
const root = document.documentElement;
|
||||||
const isDark = root.classList.contains("dark");
|
const isDark = root.classList.contains("dark");
|
||||||
const vars = isDark ? theme.cssVars.dark : theme.cssVars.light;
|
const vars = isDark ? theme.cssVars.dark : theme.cssVars.light;
|
||||||
|
|||||||
@@ -20,3 +20,67 @@ export function compareVersionNumbers(left: string, right: string) {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
interface ParsedVersion {
|
||||||
|
core: number[];
|
||||||
|
prerelease: Array<number | string>;
|
||||||
|
}
|
||||||
|
const VERSION_IDENTIFIER_PATTERN = /^[0-9A-Za-z-]+$/;
|
||||||
|
function parseVersion(value: string): ParsedVersion | null {
|
||||||
|
let normalized = value.trim().replace(/^v/i, "");
|
||||||
|
if (!normalized)
|
||||||
|
return null;
|
||||||
|
const buildIndex = normalized.indexOf("+");
|
||||||
|
if (buildIndex >= 0) {
|
||||||
|
const build = normalized.slice(buildIndex + 1);
|
||||||
|
if (!build || build.split(".").some((identifier) => !VERSION_IDENTIFIER_PATTERN.test(identifier)))
|
||||||
|
return null;
|
||||||
|
normalized = normalized.slice(0, buildIndex);
|
||||||
|
}
|
||||||
|
const prereleaseIndex = normalized.indexOf("-");
|
||||||
|
const corePart = prereleaseIndex >= 0 ? normalized.slice(0, prereleaseIndex) : normalized;
|
||||||
|
const prereleasePart = prereleaseIndex >= 0 ? normalized.slice(prereleaseIndex + 1) : "";
|
||||||
|
const coreIdentifiers = corePart.split(".");
|
||||||
|
if (coreIdentifiers.length === 0 || coreIdentifiers.some((identifier) => !/^\d+$/.test(identifier)))
|
||||||
|
return null;
|
||||||
|
const core = coreIdentifiers.map(Number);
|
||||||
|
if (core.some((identifier) => !Number.isSafeInteger(identifier)))
|
||||||
|
return null;
|
||||||
|
if (prereleaseIndex >= 0 && (!prereleasePart || prereleasePart.split(".").some((identifier) => !VERSION_IDENTIFIER_PATTERN.test(identifier))))
|
||||||
|
return null;
|
||||||
|
const prerelease = prereleasePart
|
||||||
|
? prereleasePart.split(".").map((identifier) => /^\d+$/.test(identifier) ? Number(identifier) : identifier)
|
||||||
|
: [];
|
||||||
|
return { core, prerelease };
|
||||||
|
}
|
||||||
|
export function isNewerVersion(latestValue: string, currentValue: string): boolean {
|
||||||
|
const latest = parseVersion(latestValue);
|
||||||
|
const current = parseVersion(currentValue);
|
||||||
|
if (!latest || !current)
|
||||||
|
return false;
|
||||||
|
for (let i = 0; i < Math.max(latest.core.length, current.core.length); i++) {
|
||||||
|
const latestIdentifier = latest.core[i] ?? 0;
|
||||||
|
const currentIdentifier = current.core[i] ?? 0;
|
||||||
|
if (latestIdentifier !== currentIdentifier)
|
||||||
|
return latestIdentifier > currentIdentifier;
|
||||||
|
}
|
||||||
|
if (latest.prerelease.length === 0 || current.prerelease.length === 0)
|
||||||
|
return latest.prerelease.length === 0 && current.prerelease.length > 0;
|
||||||
|
for (let i = 0; i < Math.max(latest.prerelease.length, current.prerelease.length); i++) {
|
||||||
|
const latestIdentifier = latest.prerelease[i];
|
||||||
|
const currentIdentifier = current.prerelease[i];
|
||||||
|
if (latestIdentifier === undefined)
|
||||||
|
return false;
|
||||||
|
if (currentIdentifier === undefined)
|
||||||
|
return true;
|
||||||
|
if (latestIdentifier === currentIdentifier)
|
||||||
|
continue;
|
||||||
|
const latestIsNumber = typeof latestIdentifier === "number";
|
||||||
|
const currentIsNumber = typeof currentIdentifier === "number";
|
||||||
|
if (latestIsNumber && currentIsNumber)
|
||||||
|
return latestIdentifier > currentIdentifier;
|
||||||
|
if (latestIsNumber !== currentIsNumber)
|
||||||
|
return !latestIsNumber;
|
||||||
|
return latestIdentifier > currentIdentifier;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
@@ -82,7 +82,9 @@ export interface DateRangeRequest {
|
|||||||
}
|
}
|
||||||
export interface Settings {
|
export interface Settings {
|
||||||
downloadPath: string;
|
downloadPath: string;
|
||||||
|
baseColor: string;
|
||||||
theme: string;
|
theme: string;
|
||||||
themeMode: "auto" | "light" | "dark";
|
themeMode: "auto" | "light" | "dark";
|
||||||
sfxEnabled: boolean;
|
sfxEnabled: boolean;
|
||||||
|
showUpdateNotifications: boolean;
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,9 @@ const wailsJson = JSON.parse(fs.readFileSync(wailsJsonPath, "utf-8"));
|
|||||||
const appVersion = wailsJson.info.productVersion;
|
const appVersion = wailsJson.info.productVersion;
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react(), tailwindcss()],
|
plugins: [react(), tailwindcss()],
|
||||||
|
build: {
|
||||||
|
target: "safari15",
|
||||||
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
"@": path.resolve(__dirname, "./src"),
|
"@": path.resolve(__dirname, "./src"),
|
||||||
|
|||||||
Vendored
+2
@@ -37,6 +37,8 @@ export function ExportAccountJSON(arg1:number,arg2:string):Promise<string>;
|
|||||||
|
|
||||||
export function ExportAccountsTXT(arg1:Array<number>,arg2:string):Promise<string>;
|
export function ExportAccountsTXT(arg1:Array<number>,arg2:string):Promise<string>;
|
||||||
|
|
||||||
|
export function ExportFailedLogs(arg1:string):Promise<string>;
|
||||||
|
|
||||||
export function ExtractDateRange(arg1:main.DateRangeRequest):Promise<string>;
|
export function ExtractDateRange(arg1:main.DateRangeRequest):Promise<string>;
|
||||||
|
|
||||||
export function ExtractTimeline(arg1:main.TimelineRequest):Promise<string>;
|
export function ExtractTimeline(arg1:main.TimelineRequest):Promise<string>;
|
||||||
|
|||||||
@@ -70,6 +70,10 @@ export function ExportAccountsTXT(arg1, arg2) {
|
|||||||
return window['go']['main']['App']['ExportAccountsTXT'](arg1, arg2);
|
return window['go']['main']['App']['ExportAccountsTXT'](arg1, arg2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function ExportFailedLogs(arg1) {
|
||||||
|
return window['go']['main']['App']['ExportFailedLogs'](arg1);
|
||||||
|
}
|
||||||
|
|
||||||
export function ExtractDateRange(arg1) {
|
export function ExtractDateRange(arg1) {
|
||||||
return window['go']['main']['App']['ExtractDateRange'](arg1);
|
return window['go']['main']['App']['ExtractDateRange'](arg1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,6 +139,9 @@ export namespace main {
|
|||||||
skip_existing: boolean;
|
skip_existing: boolean;
|
||||||
delete_incomplete_files: boolean;
|
delete_incomplete_files: boolean;
|
||||||
retry_attempts?: number;
|
retry_attempts?: number;
|
||||||
|
download_speed_limit_kbps?: number;
|
||||||
|
download_delay_ms?: number;
|
||||||
|
download_delay_jitter_ms?: number;
|
||||||
proxy?: string;
|
proxy?: string;
|
||||||
|
|
||||||
static createFrom(source: any = {}) {
|
static createFrom(source: any = {}) {
|
||||||
@@ -154,6 +157,9 @@ export namespace main {
|
|||||||
this.skip_existing = source["skip_existing"];
|
this.skip_existing = source["skip_existing"];
|
||||||
this.delete_incomplete_files = source["delete_incomplete_files"];
|
this.delete_incomplete_files = source["delete_incomplete_files"];
|
||||||
this.retry_attempts = source["retry_attempts"];
|
this.retry_attempts = source["retry_attempts"];
|
||||||
|
this.download_speed_limit_kbps = source["download_speed_limit_kbps"];
|
||||||
|
this.download_delay_ms = source["download_delay_ms"];
|
||||||
|
this.download_delay_jitter_ms = source["download_delay_jitter_ms"];
|
||||||
this.proxy = source["proxy"];
|
this.proxy = source["proxy"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -213,6 +219,9 @@ export namespace main {
|
|||||||
skip_existing: boolean;
|
skip_existing: boolean;
|
||||||
delete_incomplete_files: boolean;
|
delete_incomplete_files: boolean;
|
||||||
retry_attempts?: number;
|
retry_attempts?: number;
|
||||||
|
download_speed_limit_kbps?: number;
|
||||||
|
download_delay_ms?: number;
|
||||||
|
download_delay_jitter_ms?: number;
|
||||||
proxy?: string;
|
proxy?: string;
|
||||||
filename_template?: string;
|
filename_template?: string;
|
||||||
folder_template?: string;
|
folder_template?: string;
|
||||||
@@ -233,6 +242,9 @@ export namespace main {
|
|||||||
this.skip_existing = source["skip_existing"];
|
this.skip_existing = source["skip_existing"];
|
||||||
this.delete_incomplete_files = source["delete_incomplete_files"];
|
this.delete_incomplete_files = source["delete_incomplete_files"];
|
||||||
this.retry_attempts = source["retry_attempts"];
|
this.retry_attempts = source["retry_attempts"];
|
||||||
|
this.download_speed_limit_kbps = source["download_speed_limit_kbps"];
|
||||||
|
this.download_delay_ms = source["download_delay_ms"];
|
||||||
|
this.download_delay_jitter_ms = source["download_delay_jitter_ms"];
|
||||||
this.proxy = source["proxy"];
|
this.proxy = source["proxy"];
|
||||||
this.filename_template = source["filename_template"];
|
this.filename_template = source["filename_template"];
|
||||||
this.folder_template = source["folder_template"];
|
this.folder_template = source["folder_template"];
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ module twitterxmediabatchdownloader
|
|||||||
go 1.25.4
|
go 1.25.4
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/wailsapp/wails/v2 v2.12.0
|
github.com/wailsapp/wails/v2 v2.13.0
|
||||||
github.com/zalando/go-keyring v0.2.8
|
github.com/zalando/go-keyring v0.2.8
|
||||||
modernc.org/sqlite v1.50.1
|
modernc.org/sqlite v1.56.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
@@ -18,30 +18,30 @@ require (
|
|||||||
github.com/google/uuid v1.6.0 // indirect
|
github.com/google/uuid v1.6.0 // indirect
|
||||||
github.com/gorilla/websocket v1.5.3 // indirect
|
github.com/gorilla/websocket v1.5.3 // indirect
|
||||||
github.com/jchv/go-winloader v0.0.0-20250406163304-c1995be93bd1 // indirect
|
github.com/jchv/go-winloader v0.0.0-20250406163304-c1995be93bd1 // indirect
|
||||||
github.com/labstack/echo/v4 v4.13.4 // indirect
|
github.com/labstack/echo/v4 v4.15.4 // indirect
|
||||||
github.com/labstack/gommon v0.4.2 // indirect
|
github.com/labstack/gommon v0.5.0 // indirect
|
||||||
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
|
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
|
||||||
github.com/leaanthony/gosod v1.0.4 // indirect
|
github.com/leaanthony/gosod v1.0.4 // indirect
|
||||||
github.com/leaanthony/slicer v1.6.0 // indirect
|
github.com/leaanthony/slicer v1.6.0 // indirect
|
||||||
github.com/leaanthony/u v1.1.1 // indirect
|
github.com/leaanthony/u v1.1.1 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
github.com/mattn/go-colorable v0.1.15 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.24 // indirect
|
||||||
github.com/ncruces/go-strftime v1.0.0 // indirect
|
github.com/ncruces/go-strftime v1.0.0 // indirect
|
||||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
|
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||||
github.com/rivo/uniseg v0.4.7 // indirect
|
github.com/rivo/uniseg v0.4.7 // indirect
|
||||||
github.com/samber/lo v1.52.0 // indirect
|
github.com/samber/lo v1.53.0 // indirect
|
||||||
github.com/tkrajina/go-reflector v0.5.8 // indirect
|
github.com/tkrajina/go-reflector v0.5.8 // indirect
|
||||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||||
github.com/valyala/fasttemplate v1.2.2 // indirect
|
github.com/valyala/fasttemplate v1.2.2 // indirect
|
||||||
github.com/wailsapp/go-webview2 v1.0.23 // indirect
|
github.com/wailsapp/go-webview2 v1.0.23 // indirect
|
||||||
github.com/wailsapp/mimetype v1.4.1 // indirect
|
github.com/wailsapp/mimetype v1.4.1 // indirect
|
||||||
golang.org/x/crypto v0.45.0 // indirect
|
golang.org/x/crypto v0.55.0 // indirect
|
||||||
golang.org/x/net v0.47.0 // indirect
|
golang.org/x/net v0.58.0 // indirect
|
||||||
golang.org/x/sys v0.42.0 // indirect
|
golang.org/x/sys v0.47.0 // indirect
|
||||||
golang.org/x/text v0.31.0 // indirect
|
golang.org/x/text v0.41.0 // indirect
|
||||||
modernc.org/libc v1.72.3 // indirect
|
modernc.org/libc v1.75.3 // indirect
|
||||||
modernc.org/mathutil v1.7.1 // indirect
|
modernc.org/mathutil v1.7.1 // indirect
|
||||||
modernc.org/memory v1.11.0 // indirect
|
modernc.org/memory v1.12.0 // indirect
|
||||||
)
|
)
|
||||||
@@ -12,8 +12,8 @@ github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
|
|||||||
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
|
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
|
||||||
github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ=
|
github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ=
|
||||||
github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c=
|
github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c=
|
||||||
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs=
|
github.com/google/pprof v0.0.0-20260802141513-ef3492d7dac3 h1:LMLX+LgTNWpfvCBdFebv6EsYotImrt/Ppc5cXIriCSo=
|
||||||
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
|
github.com/google/pprof v0.0.0-20260802141513-ef3492d7dac3/go.mod h1:jl5iWTm0/hd5PjEYEOuwAJ57L/CibdZfrqZ5XA5GrCk=
|
||||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||||
@@ -22,10 +22,10 @@ github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs
|
|||||||
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
|
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
|
||||||
github.com/jchv/go-winloader v0.0.0-20250406163304-c1995be93bd1 h1:njuLRcjAuMKr7kI3D85AXWkw6/+v9PwtV6M6o11sWHQ=
|
github.com/jchv/go-winloader v0.0.0-20250406163304-c1995be93bd1 h1:njuLRcjAuMKr7kI3D85AXWkw6/+v9PwtV6M6o11sWHQ=
|
||||||
github.com/jchv/go-winloader v0.0.0-20250406163304-c1995be93bd1/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
|
github.com/jchv/go-winloader v0.0.0-20250406163304-c1995be93bd1/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
|
||||||
github.com/labstack/echo/v4 v4.13.4 h1:oTZZW+T3s9gAu5L8vmzihV7/lkXGZuITzTQkTEhcXEA=
|
github.com/labstack/echo/v4 v4.15.4 h1:DL45vVYa+BWE+XuW+zZNd9H0YEdZ80UAWJGcTVW4EVs=
|
||||||
github.com/labstack/echo/v4 v4.13.4/go.mod h1:g63b33BZ5vZzcIUF8AtRH40DrTlXnx4UMC8rBdndmjQ=
|
github.com/labstack/echo/v4 v4.15.4/go.mod h1:CuMetKIRwsuO/qlAgMq+KTAalwGoB/h4tC+yPdrTj1g=
|
||||||
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
|
github.com/labstack/gommon v0.5.0 h1:6VSQ2NOzsnEJ5W6+84E0RbcaDDmgB6NIAzWCczTEe6c=
|
||||||
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
|
github.com/labstack/gommon v0.5.0/go.mod h1:Rzlg7HHy1maLfzBYGg9NZcVuz1sA68HHhLjhcEllYE0=
|
||||||
github.com/leaanthony/debme v1.2.1 h1:9Tgwf+kjcrbMQ4WnPcEIUcQuIZYqdWftzZkBr+i/oOc=
|
github.com/leaanthony/debme v1.2.1 h1:9Tgwf+kjcrbMQ4WnPcEIUcQuIZYqdWftzZkBr+i/oOc=
|
||||||
github.com/leaanthony/debme v1.2.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
|
github.com/leaanthony/debme v1.2.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
|
||||||
github.com/leaanthony/go-ansi-parser v1.6.1 h1:xd8bzARK3dErqkPFtoF9F3/HgN8UQk0ed1YDKpEz01A=
|
github.com/leaanthony/go-ansi-parser v1.6.1 h1:xd8bzARK3dErqkPFtoF9F3/HgN8UQk0ed1YDKpEz01A=
|
||||||
@@ -39,10 +39,10 @@ github.com/leaanthony/u v1.1.1/go.mod h1:9+o6hejoRljvZ3BzdYlVL0JYCwtnAsVuN9pVTQc
|
|||||||
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
|
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
|
||||||
github.com/matryer/is v1.4.1 h1:55ehd8zaGABKLXQUe2awZ99BD/PTc2ls+KV/dXphgEQ=
|
github.com/matryer/is v1.4.1 h1:55ehd8zaGABKLXQUe2awZ99BD/PTc2ls+KV/dXphgEQ=
|
||||||
github.com/matryer/is v1.4.1/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
|
github.com/matryer/is v1.4.1/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
|
||||||
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
|
github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY=
|
||||||
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI=
|
||||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.24/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A=
|
||||||
github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w=
|
github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w=
|
||||||
github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
|
||||||
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
|
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
|
||||||
@@ -56,8 +56,8 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qq
|
|||||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
|
||||||
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||||
github.com/samber/lo v1.52.0 h1:Rvi+3BFHES3A8meP33VPAxiBZX/Aws5RxrschYGjomw=
|
github.com/samber/lo v1.53.0 h1:t975lj2py4kJPQ6haz1QMgtId2gtmfktACxIXArw3HM=
|
||||||
github.com/samber/lo v1.52.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0=
|
github.com/samber/lo v1.53.0/go.mod h1:4+MXEGsJzbKGaUEQFKBq2xtfuznW9oz/WrgyzMzRoM0=
|
||||||
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
|
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
|
||||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||||
@@ -72,59 +72,58 @@ github.com/wailsapp/go-webview2 v1.0.23 h1:jmv8qhz1lHibCc79bMM/a/FqOnnzOGEisLav+
|
|||||||
github.com/wailsapp/go-webview2 v1.0.23/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc=
|
github.com/wailsapp/go-webview2 v1.0.23/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc=
|
||||||
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
||||||
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
||||||
github.com/wailsapp/wails/v2 v2.12.0 h1:BHO/kLNWFHYjCzucxbzAYZWUjub1Tvb4cSguQozHn5c=
|
github.com/wailsapp/wails/v2 v2.13.0 h1:S7OgXWpj72V91unF8iDWJKbcS9ZpwCT3R0QVru4v2Mg=
|
||||||
github.com/wailsapp/wails/v2 v2.12.0/go.mod h1:mo1bzK1DEJrobt7YrBjgxvb5Sihb1mhAY09hppbibQg=
|
github.com/wailsapp/wails/v2 v2.13.0/go.mod h1:nVr/wSIEZ7xxKPkzK65mjpKpaOPQI2k4pvLwGR/i4kc=
|
||||||
github.com/zalando/go-keyring v0.2.8 h1:6sD/Ucpl7jNq10rM2pgqTs0sZ9V3qMrqfIIy5YPccHs=
|
github.com/zalando/go-keyring v0.2.8 h1:6sD/Ucpl7jNq10rM2pgqTs0sZ9V3qMrqfIIy5YPccHs=
|
||||||
github.com/zalando/go-keyring v0.2.8/go.mod h1:tsMo+VpRq5NGyKfxoBVjCuMrG47yj8cmakZDO5QGii0=
|
github.com/zalando/go-keyring v0.2.8/go.mod h1:tsMo+VpRq5NGyKfxoBVjCuMrG47yj8cmakZDO5QGii0=
|
||||||
golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q=
|
golang.org/x/crypto v0.55.0 h1:+KWHjbgOaAQ66dh/YlkZKHlz9ZUlq61AFirAR9ntP8M=
|
||||||
golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4=
|
golang.org/x/crypto v0.55.0/go.mod h1:uq0V9dE/fzQuJtbnL+2EhWOE63vo164FY8xqEnV9xis=
|
||||||
golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8=
|
golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk=
|
||||||
golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w=
|
golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40=
|
||||||
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||||
golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
|
golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To=
|
||||||
golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
|
golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU=
|
||||||
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
|
golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
|
||||||
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||||
golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
|
||||||
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
|
golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||||
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
|
||||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
|
golang.org/x/text v0.41.0 h1:vz/seA0lnX87Othu2f/0L24RcgrXD9/YFTSuGjj3rH8=
|
||||||
golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
|
golang.org/x/text v0.41.0/go.mod h1:jvf1O8ajNzZqhSrQBPbutR/EB83Cc0CFrezNQIwbb5M=
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
golang.org/x/tools v0.42.0 h1:uNgphsn75Tdz5Ji2q36v/nsFSfR/9BRFvqhGBaJGd5k=
|
golang.org/x/tools v0.48.0 h1:3+hClM1aLL5mjMKm5ovokw9epgRXPuu2tILgismM6RE=
|
||||||
golang.org/x/tools v0.42.0/go.mod h1:Ma6lCIwGZvHK6XtgbswSoWroEkhugApmsXyrUmBhfr0=
|
golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
modernc.org/cc/v4 v4.28.2 h1:3tQ0lf2ADtoby2EtSP+J7IE2SHwEJdP8ioR59wx7XpY=
|
modernc.org/cc/v4 v4.29.2 h1:h6+9ciCnPKutf4I03CvheAvDLX7+IHlqR6Iy6J+cgd8=
|
||||||
modernc.org/cc/v4 v4.28.2/go.mod h1:OnovgIhbbMXMu1aISnJ0wvVD1KnW+cAUJkIrAWh+kVI=
|
modernc.org/cc/v4 v4.29.2/go.mod h1:OnovgIhbbMXMu1aISnJ0wvVD1KnW+cAUJkIrAWh+kVI=
|
||||||
modernc.org/ccgo/v4 v4.34.0 h1:yRLPFZieg532OT4rp4JFNIVcquwalMX26G95WQDqwCQ=
|
modernc.org/ccgo/v4 v4.35.0 h1:F+TUsmw09QxLzmi3aeYYGxjAXarmZaKgj3mKQHNaA8w=
|
||||||
modernc.org/ccgo/v4 v4.34.0/go.mod h1:AS5WYMyBakQ+fhsHhtP8mWB82KTGPkNNJDGfGQCe0/A=
|
modernc.org/ccgo/v4 v4.35.0/go.mod h1:qrVGs9S3Sr2Ztcg9ve+kTAYMp5a3YvWjo+SoN06kJ5I=
|
||||||
modernc.org/fileutil v1.4.0 h1:j6ZzNTftVS054gi281TyLjHPp6CPHr2KCxEXjEbD6SM=
|
modernc.org/fileutil v1.4.0 h1:j6ZzNTftVS054gi281TyLjHPp6CPHr2KCxEXjEbD6SM=
|
||||||
modernc.org/fileutil v1.4.0/go.mod h1:EqdKFDxiByqxLk8ozOxObDSfcVOv/54xDs/DUHdvCUU=
|
modernc.org/fileutil v1.4.0/go.mod h1:EqdKFDxiByqxLk8ozOxObDSfcVOv/54xDs/DUHdvCUU=
|
||||||
modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI=
|
modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI=
|
||||||
modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito=
|
modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito=
|
||||||
modernc.org/gc/v3 v3.1.2 h1:ZtDCnhonXSZexk/AYsegNRV1lJGgaNZJuKjJSWKyEqo=
|
modernc.org/gc/v3 v3.1.5 h1:21ldfPfRYE31Tb7B3mwAK8gy1AxP4+dKjrOQPfqakoc=
|
||||||
modernc.org/gc/v3 v3.1.2/go.mod h1:HFK/6AGESC7Ex+EZJhJ2Gni6cTaYpSMmU/cT9RmlfYY=
|
modernc.org/gc/v3 v3.1.5/go.mod h1:HFK/6AGESC7Ex+EZJhJ2Gni6cTaYpSMmU/cT9RmlfYY=
|
||||||
modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks=
|
modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks=
|
||||||
modernc.org/goabi0 v0.2.0/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI=
|
modernc.org/goabi0 v0.2.0/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI=
|
||||||
modernc.org/libc v1.72.3 h1:ZnDF4tXn4NBXFutMMQC4vtbTFSXhhKzR73fv0beZEAU=
|
modernc.org/libc v1.75.3 h1:vCqT5+R0jPXMnvMkGo0T2zXvFNth+lYXVCx5X7CCX/g=
|
||||||
modernc.org/libc v1.72.3/go.mod h1:dn0dZNnnn1clLyvRxLxYExxiKRZIRENOfqQ8XEeg4Qs=
|
modernc.org/libc v1.75.3/go.mod h1:MjAX68G+0oufI+hNuh0QXcK+Ap+sL8bNPPcIC6EqOfo=
|
||||||
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
|
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
|
||||||
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
|
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
|
||||||
modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
|
modernc.org/memory v1.12.0 h1:twkmYNkGXCvtYWzoux02jtK6eovjZbdI0uHFUYp6kuU=
|
||||||
modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
|
modernc.org/memory v1.12.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
|
||||||
modernc.org/opt v0.2.0 h1:tGyef5ApycA7FSEOMraay9SaTk5zmbx7Tu+cJs4QKZg=
|
modernc.org/opt v0.2.0 h1:tGyef5ApycA7FSEOMraay9SaTk5zmbx7Tu+cJs4QKZg=
|
||||||
modernc.org/opt v0.2.0/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns=
|
modernc.org/opt v0.2.0/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns=
|
||||||
modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w=
|
modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w=
|
||||||
modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE=
|
modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE=
|
||||||
modernc.org/sqlite v1.50.1 h1:l+cQvn0sd0zJJtfygGHuQJ5AjlrwXmWPw4KP3ZMwr9w=
|
modernc.org/sqlite v1.56.0 h1:/D8e2RfFqoy/Zc6PuC76U28zFwmI/sYx1Kjm4yEn9e0=
|
||||||
modernc.org/sqlite v1.50.1/go.mod h1:tcNzv5p84E0skkmJn038y+hWJbLQXQqEnQfeh5r2JLM=
|
modernc.org/sqlite v1.56.0/go.mod h1:yCJ2cmAaIkHQ25oXWrF8H4O1lIfPYPR26yCEDj2P3pQ=
|
||||||
modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0=
|
modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0=
|
||||||
modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A=
|
modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A=
|
||||||
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
|
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,7 @@
|
|||||||
"$schema": "https://wails.io/schemas/config.v2.json",
|
"$schema": "https://wails.io/schemas/config.v2.json",
|
||||||
"name": "TwitterXMediaBatchDownloader",
|
"name": "TwitterXMediaBatchDownloader",
|
||||||
"outputfilename": "TwitterXMediaBatchDownloader",
|
"outputfilename": "TwitterXMediaBatchDownloader",
|
||||||
"frontend:install": "pnpm install",
|
"frontend:install": "pnpm install --frozen-lockfile",
|
||||||
"frontend:build": "pnpm run build",
|
"frontend:build": "pnpm run build",
|
||||||
"frontend:dev:watcher": "pnpm run dev",
|
"frontend:dev:watcher": "pnpm run dev",
|
||||||
"frontend:dev:serverUrl": "auto",
|
"frontend:dev:serverUrl": "auto",
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
},
|
},
|
||||||
"info": {
|
"info": {
|
||||||
"productName": "Twitter/X Media Batch Downloader",
|
"productName": "Twitter/X Media Batch Downloader",
|
||||||
"productVersion": "5.0.0"
|
"productVersion": "5.0.1"
|
||||||
},
|
},
|
||||||
"wailsjsdir": "./frontend",
|
"wailsjsdir": "./frontend",
|
||||||
"assetdir": "./frontend/dist",
|
"assetdir": "./frontend/dist",
|
||||||
|
|||||||
Reference in new issue
Block a user