Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

refactor(frontend): migrate omnibox component, stores, and views to librebox

IGECTf1e7934156ad
diff --git a/src/components/home/HomeUrlBar.svelte b/src/components/home/HomeUrlBar.svelte
index a8b740f4..43500105 100644
--- a/src/components/home/HomeUrlBar.svelte
+++ b/src/components/home/HomeUrlBar.svelte
@@ -1,6 +1,6 @@
<script lang="ts">
- import OmniboxInput from "$components/omnibox/OmniboxInput.svelte";
- import type { HomeInputMode } from "$lib/home/omnibox-controller";
+ import LibreboxInput from "$components/librebox/LibreboxInput.svelte";
+ import type { HomeInputMode } from "$lib/home/librebox-controller";
let {
url = $bindable(""),
@@ -28,7 +28,7 @@
<div class="home-url-bar" class:stage={variant === "stage"}>
{#if mode === "url"}
- <OmniboxInput
+ <LibreboxInput
bind:url
onInput={onInput}
prominent={variant === "stage"}
diff --git a/src/components/omnibox/BatchDownload.svelte b/src/components/librebox/BatchDownload.svelte
similarity index 93%
rename from src/components/omnibox/BatchDownload.svelte
rename to src/components/librebox/BatchDownload.svelte
index 753261cb..4ffca1ae 100644
--- a/src/components/omnibox/BatchDownload.svelte
+++ b/src/components/librebox/BatchDownload.svelte
@@ -6,12 +6,12 @@
<div class="feedback feedback-enter" data-supported="true">
<span class="feedback-text">
- {$t('omnibox.batch_detected', { count })}
+ {$t('librebox.batch_detected', { count })}
</span>
</div>
<button class="button action-btn" onclick={onDownload}>
- {$t('omnibox.batch_download_all')}
+ {$t('librebox.batch_download_all')}
</button>
<style>
diff --git a/src/components/omnibox/BilibiliPreviewExtras.svelte b/src/components/librebox/BilibiliPreviewExtras.svelte
similarity index 100%
rename from src/components/omnibox/BilibiliPreviewExtras.svelte
rename to src/components/librebox/BilibiliPreviewExtras.svelte
diff --git a/src/components/omnibox/CookieAccountPicker.svelte b/src/components/librebox/CookieAccountPicker.svelte
similarity index 96%
rename from src/components/omnibox/CookieAccountPicker.svelte
rename to src/components/librebox/CookieAccountPicker.svelte
index 63f712a6..5ef7fc83 100644
--- a/src/components/omnibox/CookieAccountPicker.svelte
+++ b/src/components/librebox/CookieAccountPicker.svelte
@@ -46,7 +46,7 @@
<circle cx="15" cy="10" r="1.5" />
<circle cx="12" cy="15" r="1.5" />
</svg>
- <span class="cookie-picker-label">{$t('omnibox.cookie_account')}:</span>
+ <span class="cookie-picker-label">{$t('librebox.cookie_account')}:</span>
<span class="cookie-picker-value">{selectedLabel}</span>
<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<polyline points="6 9 12 15 18 9" />
@@ -67,7 +67,7 @@
>
<span class="cookie-picker-option-alias">{acc.alias}</span>
<span class="cookie-picker-option-meta">
- {acc.cookie_count} {$t('omnibox.cookie_account_cookies')}
+ {acc.cookie_count} {$t('librebox.cookie_account_cookies')}
</span>
</button>
</li>
diff --git a/src/components/omnibox/DownloadModeSelector.svelte b/src/components/librebox/DownloadModeSelector.svelte
similarity index 96%
rename from src/components/omnibox/DownloadModeSelector.svelte
rename to src/components/librebox/DownloadModeSelector.svelte
index 08fb3a45..10eb2078 100644
--- a/src/components/omnibox/DownloadModeSelector.svelte
+++ b/src/components/librebox/DownloadModeSelector.svelte
@@ -14,7 +14,7 @@
<rect x="2" y="6" width="14" height="12" rx="2" />
<path d="m22 8-6 4 6 4V8Z" />
</svg>
- {$t('omnibox.mode_auto')}
+ {$t('librebox.mode_auto')}
</button>
<button
class="mode-btn"
@@ -26,7 +26,7 @@
<circle cx="6" cy="18" r="3" />
<circle cx="18" cy="16" r="3" />
</svg>
- {$t('omnibox.mode_audio')}
+ {$t('librebox.mode_audio')}
</button>
<button
class="mode-btn"
@@ -38,7 +38,7 @@
<line x1="23" y1="9" x2="17" y2="15" />
<line x1="17" y1="9" x2="23" y2="15" />
</svg>
- {$t('omnibox.mode_mute')}
+ {$t('librebox.mode_mute')}
</button>
</div>
diff --git a/src/components/omnibox/FormatSelector.svelte b/src/components/librebox/FormatSelector.svelte
similarity index 94%
rename from src/components/omnibox/FormatSelector.svelte
rename to src/components/librebox/FormatSelector.svelte
index 4b38160b..313b570f 100644
--- a/src/components/omnibox/FormatSelector.svelte
+++ b/src/components/librebox/FormatSelector.svelte
@@ -115,7 +115,7 @@
{#if isYtdlpPlatform(platform) && isPlaylist}
<div class="formats-playlist-note">
- {$t('omnibox.formats_playlist_note')}
+ {$t('librebox.formats_playlist_note')}
</div>
{:else if isYtdlpPlatform(platform)}
<button
@@ -131,11 +131,11 @@
</svg>
{/if}
{#if loadingFormats}
- {$t('omnibox.view_formats')}...
+ {$t('librebox.view_formats')}...
{:else if formats.length > 0}
- {$t('omnibox.hide_formats')}
+ {$t('librebox.hide_formats')}
{:else}
- {$t('omnibox.view_formats')}
+ {$t('librebox.view_formats')}
{/if}
</button>
@@ -143,14 +143,14 @@
<div class="formats-error">
<span class="formats-error-text">{formatError}</span>
<button class="button formats-retry-btn" onclick={onLoadFormats}>
- {$t('omnibox.retry')}
+ {$t('librebox.retry')}
</button>
</div>
{/if}
{#if formats.length > 0}
<div class="formats-panel">
- <div class="formats-presets" role="radiogroup" aria-label={$t('omnibox.formats_presets_label')}>
+ <div class="formats-presets" role="radiogroup" aria-label={$t('librebox.formats_presets_label')}>
{#if bestVA || bestVideo}
<button
type="button"
@@ -163,7 +163,7 @@
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<polygon points="5 3 19 12 5 21 5 3" />
</svg>
- <span>{$t('omnibox.preset_best')}</span>
+ <span>{$t('librebox.preset_best')}</span>
</button>
{/if}
{#if hasMusicPreset}
@@ -180,7 +180,7 @@
<circle cx="6" cy="18" r="3" />
<circle cx="18" cy="16" r="3" />
</svg>
- <span>{$t('omnibox.preset_music')}</span>
+ <span>{$t('librebox.preset_music')}</span>
</button>
{/if}
<button
@@ -195,7 +195,7 @@
<circle cx="12" cy="12" r="3" />
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z" />
</svg>
- <span>{$t('omnibox.preset_custom')}</span>
+ <span>{$t('librebox.preset_custom')}</span>
</button>
</div>
@@ -211,7 +211,7 @@
{:else}
<div class="formats-info">
<span class="formats-note">
- {$t('omnibox.formats_merge_note')}
+ {$t('librebox.formats_merge_note')}
</span>
</div>
{/if}
@@ -220,13 +220,13 @@
<div class="formats-list">
<div class="format-header">
<span>ID</span>
- <span>{$t('omnibox.fmt_type')}</span>
- <span>{$t('omnibox.fmt_quality')}</span>
- <span>{$t('omnibox.fmt_streams')}</span>
- <span>{$t('omnibox.fmt_video')}</span>
- <span>{$t('omnibox.fmt_audio')}</span>
- <span>{$t('omnibox.fmt_size')}</span>
- <span>{$t('omnibox.fmt_speed')}</span>
+ <span>{$t('librebox.fmt_type')}</span>
+ <span>{$t('librebox.fmt_quality')}</span>
+ <span>{$t('librebox.fmt_streams')}</span>
+ <span>{$t('librebox.fmt_video')}</span>
+ <span>{$t('librebox.fmt_audio')}</span>
+ <span>{$t('librebox.fmt_size')}</span>
+ <span>{$t('librebox.fmt_speed')}</span>
</div>
{#each formats as fmt (fmt.format_id)}
<button
diff --git a/src/components/omnibox/OmniboxAdvanced.svelte b/src/components/librebox/LibreboxAdvanced.svelte
similarity index 88%
rename from src/components/omnibox/OmniboxAdvanced.svelte
rename to src/components/librebox/LibreboxAdvanced.svelte
index 9211127f..c8c0cbf5 100644
--- a/src/components/omnibox/OmniboxAdvanced.svelte
+++ b/src/components/librebox/LibreboxAdvanced.svelte
@@ -31,7 +31,7 @@
try {
templates = await invoke<Template[]>("yt_templates_list");
} catch (e) {
- console.warn("[advanced-omnibox] list failed:", e);
+ console.warn("[advanced-librebox] list failed:", e);
}
}
@@ -78,7 +78,7 @@
async function saveTemplate() {
if (!saveName.trim()) {
- showToast("error", $t("omnibox.adv.template_name_required"));
+ showToast("error", $t("librebox.adv.template_name_required"));
return;
}
savingTpl = true;
@@ -93,7 +93,7 @@
});
selectedTemplateId = tpl.id;
await refreshTemplates();
- showToast("success", $t("omnibox.adv.template_saved"));
+ showToast("success", $t("librebox.adv.template_saved"));
} catch (e) {
showToast("error", String(e));
} finally {
@@ -123,7 +123,7 @@
async function runDownload() {
const trimmedUrl = url.trim();
if (!trimmedUrl) {
- showToast("error", $t("omnibox.adv.url_required"));
+ showToast("error", $t("librebox.adv.url_required"));
return;
}
const settings = getSettings();
@@ -151,7 +151,7 @@
customArgs: parsedArgs,
cookieSlug: null,
});
- showToast("success", $t("omnibox.adv.queued"));
+ showToast("success", $t("librebox.adv.queued"));
url = "";
} catch (e) {
showToast("error", String(e));
@@ -163,28 +163,28 @@
<div class="advanced">
<div class="row">
- <label class="field-label" for="adv-url">{$t("omnibox.adv.url_label")}</label>
+ <label class="field-label" for="adv-url">{$t("librebox.adv.url_label")}</label>
<input
id="adv-url"
class="text-input"
type="text"
- placeholder={$t("omnibox.adv.url_placeholder")}
+ placeholder={$t("librebox.adv.url_placeholder")}
bind:value={url}
spellcheck="false"
/>
</div>
<div class="row">
- <label class="field-label" for="adv-args">{$t("omnibox.adv.args_label")}</label>
+ <label class="field-label" for="adv-args">{$t("librebox.adv.args_label")}</label>
<textarea
id="adv-args"
class="args-input"
- placeholder={$t("omnibox.adv.args_placeholder")}
+ placeholder={$t("librebox.adv.args_placeholder")}
bind:value={argsText}
spellcheck="false"
rows="4"
></textarea>
- <span class="hint">{$t("omnibox.adv.args_hint")}</span>
+ <span class="hint">{$t("librebox.adv.args_hint")}</span>
</div>
<div class="actions">
@@ -194,15 +194,15 @@
onclick={runDownload}
disabled={submitting || !url.trim()}
>
- {submitting ? $t("omnibox.adv.queuing") : $t("omnibox.adv.run")}
+ {submitting ? $t("librebox.adv.queuing") : $t("librebox.adv.run")}
</button>
</div>
<div class="templates">
<div class="templates-header">
- <h4>{$t("omnibox.adv.templates_title")}</h4>
+ <h4>{$t("librebox.adv.templates_title")}</h4>
<button type="button" class="ghost-btn small" onclick={newTemplate}>
- {$t("omnibox.adv.template_new")}
+ {$t("librebox.adv.template_new")}
</button>
</div>
@@ -210,13 +210,13 @@
<input
class="text-input small"
type="text"
- placeholder={$t("omnibox.adv.template_name_placeholder")}
+ placeholder={$t("librebox.adv.template_name_placeholder")}
bind:value={saveName}
/>
<button type="button" class="ghost-btn small" onclick={saveTemplate} disabled={savingTpl}>
{selectedTemplateId
- ? $t("omnibox.adv.template_update")
- : $t("omnibox.adv.template_save")}
+ ? $t("librebox.adv.template_update")
+ : $t("librebox.adv.template_save")}
</button>
</div>
@@ -226,13 +226,13 @@
<li class="tpl-item" class:active={selectedTemplateId === tpl.id}>
<button type="button" class="tpl-pick" onclick={() => applyTemplate(tpl)}>
<span class="tpl-name">{tpl.name}</span>
- <span class="tpl-count">{tpl.args.length} {$t("omnibox.adv.template_flags")}</span>
+ <span class="tpl-count">{tpl.args.length} {$t("librebox.adv.template_flags")}</span>
</button>
<button
type="button"
class="tpl-delete"
onclick={() => deleteTemplate(tpl)}
- aria-label={$t("omnibox.adv.template_delete")}
+ aria-label={$t("librebox.adv.template_delete")}
>
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6"/>
@@ -242,7 +242,7 @@
{/each}
</ul>
{:else}
- <p class="empty-hint">{$t("omnibox.adv.templates_empty")}</p>
+ <p class="empty-hint">{$t("librebox.adv.templates_empty")}</p>
{/if}
</div>
</div>
diff --git a/src/components/omnibox/OmniboxInput.svelte b/src/components/librebox/LibreboxInput.svelte
similarity index 86%
rename from src/components/omnibox/OmniboxInput.svelte
rename to src/components/librebox/LibreboxInput.svelte
index 71d30a28..efd08f2f 100644
--- a/src/components/omnibox/OmniboxInput.svelte
+++ b/src/components/librebox/LibreboxInput.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
import { t } from "$lib/i18n";
import { shortcut } from "$lib/platform";
- import type { HomeInputMode } from "$lib/home/omnibox-controller";
+ import type { HomeInputMode } from "$lib/home/librebox-controller";
import { readText } from "@tauri-apps/plugin-clipboard-manager";
let {
@@ -108,7 +108,7 @@
<!-- svelte-ignore a11y_click_events_have_key_events -->
<!-- svelte-ignore a11y_no_static_element_interactions -->
<div
- class="omnibox-wrapper"
+ class="librebox-wrapper"
class:drag-over={dragOver}
class:prominent
ondragover={handleDragOver}
@@ -118,12 +118,12 @@
if (e.target === e.currentTarget) focusInput();
}}
>
- <div class="omnibox-plus-wrap" bind:this={menuWrapEl}>
+ <div class="librebox-plus-wrap" bind:this={menuWrapEl}>
<button
type="button"
- class="omnibox-plus-btn"
+ class="librebox-plus-btn"
class:open={menuOpen}
- aria-label={$t('omnibox.more_actions')}
+ aria-label={$t('librebox.more_actions')}
aria-expanded={menuOpen}
aria-haspopup="menu"
onclick={(e) => {
@@ -137,11 +137,11 @@
</button>
{#if menuOpen}
- <div class="omnibox-plus-menu" role="menu">
+ <div class="librebox-plus-menu" role="menu">
{#each secondary as item (item.mode)}
<button
type="button"
- class="omnibox-plus-item"
+ class="librebox-plus-item"
role="menuitem"
onclick={(e) => {
e.stopPropagation();
@@ -156,10 +156,10 @@
</button>
{/each}
{#if onAdvanced}
- <div class="omnibox-plus-sep" role="separator"></div>
+ <div class="librebox-plus-sep" role="separator"></div>
<button
type="button"
- class="omnibox-plus-item"
+ class="librebox-plus-item"
role="menuitem"
onclick={(e) => {
e.stopPropagation();
@@ -179,10 +179,10 @@
<input
bind:this={inputEl}
- class="omnibox"
+ class="librebox"
type="text"
- placeholder={$t('omnibox.placeholder')}
- aria-label={$t('omnibox.placeholder')}
+ placeholder={$t('librebox.placeholder')}
+ aria-label={$t('librebox.placeholder')}
bind:value={url}
oninput={onInput}
autocomplete="off"
@@ -200,18 +200,18 @@
{:else}
<button
type="button"
- class="omnibox-paste-btn"
+ class="librebox-paste-btn"
onclick={handlePasteClick}
aria-label="{$t('tools.ig.download.paste')} ({shortcut('V')})"
>
- <span class="omnibox-paste-label">{$t('tools.ig.download.paste')}</span>
- <span class="omnibox-paste-kbd">{shortcut("V")}</span>
+ <span class="librebox-paste-label">{$t('tools.ig.download.paste')}</span>
+ <span class="librebox-paste-kbd">{shortcut("V")}</span>
</button>
{/if}
</div>
<style>
- .omnibox-wrapper {
+ .librebox-wrapper {
width: 100%;
position: relative;
display: flex;
@@ -226,7 +226,7 @@
transition: box-shadow var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out);
}
- .omnibox-wrapper.prominent {
+ .librebox-wrapper.prominent {
height: 52px;
padding: 0 var(--space-3);
border-radius: var(--radius-xl);
@@ -237,33 +237,33 @@
0 2px 6px rgba(var(--shadow-ink), var(--elev-alpha-1));
}
- .omnibox-wrapper.prominent .omnibox {
+ .librebox-wrapper.prominent .librebox {
font-size: var(--text-lg);
font-weight: 400;
letter-spacing: var(--track-snug);
}
- .omnibox-wrapper.drag-over {
+ .librebox-wrapper.drag-over {
background: var(--accent-soft);
box-shadow:
inset 0 0 0 2px var(--accent),
0 0 0 4px var(--accent-soft);
}
- .omnibox-wrapper:focus-within {
+ .librebox-wrapper:focus-within {
box-shadow:
inset 0 0 0 var(--hairline) var(--accent),
0 0 0 3px var(--accent-soft);
}
- .omnibox-wrapper.prominent:focus-within {
+ .librebox-wrapper.prominent:focus-within {
box-shadow:
inset 0 0 0 var(--hairline) var(--accent),
0 0 0 4px var(--accent-soft),
0 10px 30px rgba(var(--shadow-ink), var(--elev-alpha-2));
}
- .omnibox-plus-wrap {
+ .librebox-plus-wrap {
position: relative;
display: flex;
align-items: center;
@@ -271,7 +271,7 @@
flex-shrink: 0;
}
- .omnibox-plus-btn {
+ .librebox-plus-btn {
display: flex;
align-items: center;
justify-content: center;
@@ -290,38 +290,38 @@
transform var(--duration-fast) var(--ease-out);
}
- .omnibox-wrapper.prominent .omnibox-plus-btn {
+ .librebox-wrapper.prominent .librebox-plus-btn {
width: 32px;
height: 32px;
}
- .omnibox-plus-btn.open {
+ .librebox-plus-btn.open {
background: var(--fill-2);
color: var(--text);
}
- .omnibox-plus-btn.open svg {
+ .librebox-plus-btn.open svg {
transform: rotate(45deg);
}
- .omnibox-plus-btn svg {
+ .librebox-plus-btn svg {
pointer-events: none;
transition: transform var(--duration-fast) var(--ease-out);
}
@media (hover: hover) {
- .omnibox-plus-btn:hover {
+ .librebox-plus-btn:hover {
background: var(--fill-2);
color: var(--text);
}
}
- .omnibox-plus-btn:focus-visible {
+ .librebox-plus-btn:focus-visible {
outline: var(--focus-ring);
outline-offset: var(--focus-ring-offset);
}
- .omnibox-plus-menu {
+ .librebox-plus-menu {
position: absolute;
top: calc(100% + var(--space-2));
inset-inline-start: 0;
@@ -339,7 +339,7 @@
z-index: 40;
}
- .omnibox-plus-item {
+ .librebox-plus-item {
display: flex;
align-items: center;
gap: var(--space-2);
@@ -357,34 +357,34 @@
transition: background var(--duration-fast) var(--ease-out);
}
- .omnibox-plus-item svg {
+ .librebox-plus-item svg {
color: var(--text-muted);
flex-shrink: 0;
pointer-events: none;
}
@media (hover: hover) {
- .omnibox-plus-item:hover {
+ .librebox-plus-item:hover {
background: var(--fill-2);
}
- .omnibox-plus-item:hover svg {
+ .librebox-plus-item:hover svg {
color: var(--text);
}
}
- .omnibox-plus-item:focus-visible {
+ .librebox-plus-item:focus-visible {
outline: var(--focus-ring);
outline-offset: -2px;
}
- .omnibox-plus-sep {
+ .librebox-plus-sep {
height: var(--hairline);
margin: var(--space-1) var(--space-2);
background: var(--separator);
}
- .omnibox {
+ .librebox {
flex: 1;
min-width: 0;
height: 100%;
@@ -395,15 +395,15 @@
border: none;
}
- .omnibox::placeholder {
+ .librebox::placeholder {
color: var(--text-dim);
}
- .omnibox:focus {
+ .librebox:focus {
outline: none;
}
- .omnibox-paste-btn {
+ .librebox-paste-btn {
display: inline-flex;
align-items: center;
gap: 6px;
@@ -423,30 +423,30 @@
color var(--duration-fast) var(--ease-out);
}
- .omnibox-wrapper.prominent .omnibox-paste-btn {
+ .librebox-wrapper.prominent .librebox-paste-btn {
height: 32px;
padding: 0 var(--space-3);
border-radius: var(--radius-md);
}
- .omnibox-paste-label {
+ .librebox-paste-label {
color: var(--text);
}
- .omnibox-paste-kbd {
+ .librebox-paste-kbd {
font-family: var(--font-mono);
font-size: var(--text-xs);
color: var(--text-dim);
}
@media (hover: hover) {
- .omnibox-paste-btn:hover {
+ .librebox-paste-btn:hover {
background: var(--fill-2);
color: var(--text);
}
}
- .omnibox-paste-btn:focus-visible {
+ .librebox-paste-btn:focus-visible {
outline: var(--focus-ring);
outline-offset: var(--focus-ring-offset);
}
@@ -466,7 +466,7 @@
flex-shrink: 0;
}
- .omnibox-wrapper.prominent .clear-btn {
+ .librebox-wrapper.prominent .clear-btn {
width: 32px;
height: 32px;
}
diff --git a/src/components/omnibox/MediaPreview.svelte b/src/components/librebox/MediaPreview.svelte
similarity index 100%
rename from src/components/omnibox/MediaPreview.svelte
rename to src/components/librebox/MediaPreview.svelte
diff --git a/src/components/omnibox/QualityPicker.svelte b/src/components/librebox/QualityPicker.svelte
similarity index 82%
rename from src/components/omnibox/QualityPicker.svelte
rename to src/components/librebox/QualityPicker.svelte
index a54c7692..aae2f8de 100644
--- a/src/components/omnibox/QualityPicker.svelte
+++ b/src/components/librebox/QualityPicker.svelte
@@ -10,13 +10,13 @@
// Full ordered list of resolution options (label, yt-dlp quality value, height for filtering)
const RESOLUTION_OPTIONS = [
- { value: "best", key: "omnibox.quality_best", height: Infinity },
- { value: "2160p", key: "omnibox.quality_2160p", height: 2160 },
- { value: "1440p", key: "omnibox.quality_1440p", height: 1440 },
- { value: "1080p", key: "omnibox.quality_1080p", height: 1080 },
- { value: "720p", key: "omnibox.quality_720p", height: 720 },
- { value: "480p", key: "omnibox.quality_480p", height: 480 },
- { value: "360p", key: "omnibox.quality_360p", height: 360 },
+ { value: "best", key: "librebox.quality_best", height: Infinity },
+ { value: "2160p", key: "librebox.quality_2160p", height: 2160 },
+ { value: "1440p", key: "librebox.quality_1440p", height: 1440 },
+ { value: "1080p", key: "librebox.quality_1080p", height: 1080 },
+ { value: "720p", key: "librebox.quality_720p", height: 720 },
+ { value: "480p", key: "librebox.quality_480p", height: 480 },
+ { value: "360p", key: "librebox.quality_360p", height: 360 },
];
let visibleOptions = $derived.by(() => {
@@ -40,7 +40,7 @@
{#if !selectedFormatId}
<div class="quality-group">
- <span class="quality-label">{$t('omnibox.quality')}</span>
+ <span class="quality-label">{$t('librebox.quality')}</span>
<div class="quality-pills">
{#each visibleOptions as q (q.value)}
<button
@@ -57,12 +57,12 @@
class:active={selectedQuality === "audio"}
onclick={() => { selectedQuality = "audio"; }}
>
- {$t('omnibox.quality_audio')}
+ {$t('librebox.quality_audio')}
</button>
{/if}
</div>
{#if availableHeights}
- <span class="quality-hint">{$t('omnibox.quality_from_formats')}</span>
+ <span class="quality-hint">{$t('librebox.quality_from_formats')}</span>
{/if}
</div>
{/if}
diff --git a/src/components/omnibox/SearchResults.svelte b/src/components/librebox/SearchResults.svelte
similarity index 100%
rename from src/components/omnibox/SearchResults.svelte
rename to src/components/librebox/SearchResults.svelte
diff --git a/src/components/omnibox/quality-and-mode.test.ts b/src/components/librebox/quality-and-mode.test.ts
similarity index 72%
rename from src/components/omnibox/quality-and-mode.test.ts
rename to src/components/librebox/quality-and-mode.test.ts
index d9d1e39a..d5172dce 100644
--- a/src/components/omnibox/quality-and-mode.test.ts
+++ b/src/components/librebox/quality-and-mode.test.ts
@@ -19,36 +19,36 @@ describe("Home v1-hero UI and 4K/2K Quality & Mode wiring", () => {
it("exposes 4K (2160p) and 2K (1440p) in both QualityPicker and Settings QualitySection", () => {
const qualityPicker = fs.readFileSync(
- path.join(repoRoot, "src/components/omnibox/QualityPicker.svelte"),
+ path.join(repoRoot, "src/components/librebox/QualityPicker.svelte"),
"utf8",
);
- expect(qualityPicker).toContain('{ value: "2160p", key: "omnibox.quality_2160p", height: 2160 }');
- expect(qualityPicker).toContain('{ value: "1440p", key: "omnibox.quality_1440p", height: 1440 }');
+ expect(qualityPicker).toContain('{ value: "2160p", key: "librebox.quality_2160p", height: 2160 }');
+ expect(qualityPicker).toContain('{ value: "1440p", key: "librebox.quality_1440p", height: 1440 }');
expect(qualityPicker).not.toContain("o.height <= 1080");
const qualitySection = fs.readFileSync(
path.join(repoRoot, "src/components/settings/downloads/QualitySection.svelte"),
"utf8",
);
- expect(qualitySection).toContain('<option value="2160p">{$t(\'omnibox.quality_2160p\')}</option>');
- expect(qualitySection).toContain('<option value="1440p">{$t(\'omnibox.quality_1440p\')}</option>');
+ expect(qualitySection).toContain('<option value="2160p">{$t(\'librebox.quality_2160p\')}</option>');
+ expect(qualitySection).toContain('<option value="1440p">{$t(\'librebox.quality_1440p\')}</option>');
});
it("uses Video mode label and Quality and more toggle label in en.json", () => {
const en = JSON.parse(
fs.readFileSync(path.join(repoRoot, "src/lib/i18n/en.json"), "utf8"),
);
- expect(en.omnibox.mode_auto).toBe("Video");
- expect(en.omnibox.options).toBe("Quality and more");
- expect(en.omnibox.detecting).toBe("Checking link...");
- expect(en.omnibox.added_to_downloads).toBe("Added to Downloads");
- expect(en.omnibox.open_downloads).toBe("Open Downloads");
+ expect(en.librebox.mode_auto).toBe("Video");
+ expect(en.librebox.options).toBe("Quality and more");
+ expect(en.librebox.detecting).toBe("Checking link...");
+ expect(en.librebox.added_to_downloads).toBe("Added to Downloads");
+ expect(en.librebox.open_downloads).toBe("Open Downloads");
expect(en.downloads.view_downloads).toBe("View downloads");
});
it("renders 3-line MediaPreview info (title, author, duration) without thumbnail overlay badge", () => {
const mediaPreview = fs.readFileSync(
- path.join(repoRoot, "src/components/omnibox/MediaPreview.svelte"),
+ path.join(repoRoot, "src/components/librebox/MediaPreview.svelte"),
"utf8",
);
expect(mediaPreview).toContain('class="preview-title"');
diff --git a/src/components/settings/downloads/QualitySection.svelte b/src/components/settings/downloads/QualitySection.svelte
index 33ff4049..f68b10d2 100644
--- a/src/components/settings/downloads/QualitySection.svelte
+++ b/src/components/settings/downloads/QualitySection.svelte
@@ -54,13 +54,13 @@
<span class="setting-path">{$t('settings.download.video_quality_desc')}</span>
</div>
<select class="select" value={settings.download.video_quality} onchange={changeQuality}>
- <option value="best">{$t('omnibox.quality_best')}</option>
- <option value="2160p">{$t('omnibox.quality_2160p')}</option>
- <option value="1440p">{$t('omnibox.quality_1440p')}</option>
- <option value="1080p">{$t('omnibox.quality_1080p')}</option>
- <option value="720p">{$t('omnibox.quality_720p')}</option>
- <option value="480p">{$t('omnibox.quality_480p')}</option>
- <option value="360p">{$t('omnibox.quality_360p')}</option>
+ <option value="best">{$t('librebox.quality_best')}</option>
+ <option value="2160p">{$t('librebox.quality_2160p')}</option>
+ <option value="1440p">{$t('librebox.quality_1440p')}</option>
+ <option value="1080p">{$t('librebox.quality_1080p')}</option>
+ <option value="720p">{$t('librebox.quality_720p')}</option>
+ <option value="480p">{$t('librebox.quality_480p')}</option>
+ <option value="360p">{$t('librebox.quality_360p')}</option>
</select>
</div>
<div class="divider"></div>
diff --git a/src/lib/home/omnibox-controller.ts b/src/lib/home/librebox-controller.ts
similarity index 93%
rename from src/lib/home/omnibox-controller.ts
rename to src/lib/home/librebox-controller.ts
index 762f0cc2..a25cb099 100644
--- a/src/lib/home/omnibox-controller.ts
+++ b/src/lib/home/librebox-controller.ts
@@ -1,4 +1,4 @@
-export type OmniState =
+export type LibreState =
| { kind: "idle" }
| { kind: "detecting" }
| { kind: "detected"; info: PlatformInfo }
@@ -73,7 +73,7 @@ export function extractUrls(text: string): string[] {
return results;
}
-export function showInspectorForState(state: OmniState): boolean {
+export function showInspectorForState(state: LibreState): boolean {
return (
state.kind === "detected" ||
state.kind === "preparing" ||
@@ -81,7 +81,7 @@ export function showInspectorForState(state: OmniState): boolean {
);
}
-export function showOmniboxForState(state: OmniState): boolean {
+export function showLibreboxForState(state: LibreState): boolean {
return (
state.kind === "idle" ||
state.kind === "detecting" ||
@@ -93,3 +93,4 @@ export function showOmniboxForState(state: OmniState): boolean {
state.kind === "search-empty"
);
}
+
diff --git a/src/lib/home/omnibox-url.test.ts b/src/lib/home/librebox-url.test.ts
similarity index 93%
rename from src/lib/home/omnibox-url.test.ts
rename to src/lib/home/librebox-url.test.ts
index 224d6c4f..0db9553a 100644
--- a/src/lib/home/omnibox-url.test.ts
+++ b/src/lib/home/librebox-url.test.ts
@@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest";
-import { extractUrls, isUrl } from "./omnibox-controller";
+import { extractUrls, isUrl } from "./librebox-controller";
-describe("omnibox URL detection and extraction", () => {
+describe("librebox URL detection and extraction", () => {
it("detects clean URLs directly", () => {
expect(isUrl("https://example.com/video")).toBe(true);
expect(extractUrls("https://example.com/video")).toEqual(["https://example.com/video"]);
diff --git a/src/lib/stores/librebox-draft-store.svelte.ts b/src/lib/stores/librebox-draft-store.svelte.ts
new file mode 100644
index 00000000..2f714ada
--- /dev/null
+++ b/src/lib/stores/librebox-draft-store.svelte.ts
@@ -0,0 +1,14 @@
+let draftUrl = $state("");
+
+export function getLibreboxDraftUrl(): string {
+ return draftUrl;
+}
+
+export function setLibreboxDraftUrl(url: string) {
+ draftUrl = url;
+}
+
+export function clearLibreboxDraftUrl() {
+ draftUrl = "";
+}
+
diff --git a/src/lib/stores/omnibox-draft-store.svelte.ts b/src/lib/stores/omnibox-draft-store.svelte.ts
deleted file mode 100644
index a05c9f6a..00000000
--- a/src/lib/stores/omnibox-draft-store.svelte.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-let draftUrl = $state("");
-
-export function getOmniboxDraftUrl(): string {
- return draftUrl;
-}
-
-export function setOmniboxDraftUrl(url: string) {
- draftUrl = url;
-}
-
-export function clearOmniboxDraftUrl() {
- draftUrl = "";
-}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index e1c0d168..d8a93827 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -3,30 +3,30 @@
import { open } from "@tauri-apps/plugin-dialog";
import { goto } from "$app/navigation";
import { onMount } from "svelte";
- import BilibiliPreviewExtras from "$components/omnibox/BilibiliPreviewExtras.svelte";
- import DownloadModeSelector from "$components/omnibox/DownloadModeSelector.svelte";
- import QualityPicker from "$components/omnibox/QualityPicker.svelte";
- import FormatSelector from "$components/omnibox/FormatSelector.svelte";
- import CookieAccountPicker from "$components/omnibox/CookieAccountPicker.svelte";
- import OmniboxAdvanced from "$components/omnibox/OmniboxAdvanced.svelte";
- import MediaPreview from "$components/omnibox/MediaPreview.svelte";
- import BatchDownload from "$components/omnibox/BatchDownload.svelte";
- import SearchResults from "$components/omnibox/SearchResults.svelte";
+ import BilibiliPreviewExtras from "$components/librebox/BilibiliPreviewExtras.svelte";
+ import DownloadModeSelector from "$components/librebox/DownloadModeSelector.svelte";
+ import QualityPicker from "$components/librebox/QualityPicker.svelte";
+ import FormatSelector from "$components/librebox/FormatSelector.svelte";
+ import CookieAccountPicker from "$components/librebox/CookieAccountPicker.svelte";
+ import LibreboxAdvanced from "$components/librebox/LibreboxAdvanced.svelte";
+ import MediaPreview from "$components/librebox/MediaPreview.svelte";
+ import BatchDownload from "$components/librebox/BatchDownload.svelte";
+ import SearchResults from "$components/librebox/SearchResults.svelte";
import P2pSendDialog from "$components/p2p/P2pSendDialog.svelte";
import P2pReceiveDialog from "$components/p2p/P2pReceiveDialog.svelte";
import HomeHero from "$components/home/HomeHero.svelte";
import HomeUrlBar from "$components/home/HomeUrlBar.svelte";
import HomeInspector from "$components/home/HomeInspector.svelte";
import {
- type OmniState,
+ type LibreState,
type PlatformInfo,
type SearchResult,
type HomeInputMode,
showInspectorForState,
- showOmniboxForState,
+ showLibreboxForState,
isUrl,
extractUrls,
- } from "$lib/home/omnibox-controller";
+ } from "$lib/home/librebox-controller";
import { getDownloads, formatBytes } from "$lib/stores/download-store.svelte";
import { getDownloadStats } from "$lib/stores/download-stats.svelte";
import { getSettings, updateSettings } from "$lib/stores/settings-store.svelte";
@@ -34,7 +34,7 @@
import { onClipboardUrl } from "$lib/stores/clipboard-monitor";
import { getMediaPreview, clearMediaPreview } from "$lib/stores/media-preview-store.svelte";
import { clearPendingExternalPrefill, getPendingExternalPrefill, type ExternalUrlEvent } from "$lib/stores/external-url-store.svelte";
- import { getOmniboxDraftUrl, setOmniboxDraftUrl } from "$lib/stores/omnibox-draft-store.svelte";
+ import { getLibreboxDraftUrl, setLibreboxDraftUrl } from "$lib/stores/librebox-draft-store.svelte";
import { t } from "$lib/i18n";
import { translateBackendError } from "$lib/error-translate";
import { platformDisplayName } from "$lib/platform-display-names";
@@ -65,9 +65,9 @@
// plugin + logged-in account), not from a pasted URL.
const COURSE_PLATFORMS = new Set(["hotmart", "udemy"]);
- let url = $state(getOmniboxDraftUrl());
+ let url = $state(getLibreboxDraftUrl());
let homeInputMode = $state<HomeInputMode>("url");
- let omniState = $state<OmniState>({ kind: "idle" });
+ let libreState = $state<LibreState>({ kind: "idle" });
let debounceTimer = $state<ReturnType<typeof setTimeout> | null>(null);
let downloadMode = $state<"auto" | "audio" | "mute">("auto");
let selectedQuality = $state("best");
@@ -137,7 +137,7 @@
onMount(() => {
onClipboardUrl((detectedUrl) => {
- if (omniState.kind === "preparing") return;
+ if (libreState.kind === "preparing") return;
url = detectedUrl;
const settings = getSettings();
const autoDownload = !!(settings?.download.auto_download_on_paste && settings?.download.clipboard_detection);
@@ -154,15 +154,15 @@
});
$effect(() => {
- setOmniboxDraftUrl(url);
+ setLibreboxDraftUrl(url);
});
const AUTO_DOWNLOAD_DELAY_MS = 2000;
$effect(() => {
if (!pendingAutoDownload) return;
- if (omniState.kind === "detected") {
- const info = omniState.info;
+ if (libreState.kind === "detected") {
+ const info = libreState.info;
if (COURSE_PLATFORMS.has(info.platform) || info.platform === "p2p") {
pendingAutoDownload = false;
return;
@@ -170,17 +170,17 @@
pendingAutoDownload = false;
const snapshotUrl = url;
setTimeout(() => {
- if (url === snapshotUrl && omniState.kind === "detected") {
+ if (url === snapshotUrl && libreState.kind === "detected") {
handleAction();
}
}, AUTO_DOWNLOAD_DELAY_MS);
} else if (
- omniState.kind === "unsupported" ||
- omniState.kind === "error" ||
- omniState.kind === "batch" ||
- omniState.kind === "search-results" ||
- omniState.kind === "search-empty" ||
- omniState.kind === "idle"
+ libreState.kind === "unsupported" ||
+ libreState.kind === "error" ||
+ libreState.kind === "batch" ||
+ libreState.kind === "search-results" ||
+ libreState.kind === "search-empty" ||
+ libreState.kind === "idle"
) {
pendingAutoDownload = false;
}
@@ -252,8 +252,8 @@
return firstCompletionOfSession && completionSeenIds.size === 1 ? "amazed" : "complete";
}
- if (omniState.kind === "preparing") return "downloading";
- if (omniState.kind === "error") return "error";
+ if (libreState.kind === "preparing") return "downloading";
+ if (libreState.kind === "error") return "error";
let hasActiveDownloading = false;
let hasActiveStalled = false;
@@ -297,7 +297,7 @@
else if (mascotEmotion === "downloading") key = "downloading";
else if (mascotEmotion === "stalled") key = "stalled";
else {
- switch (omniState.kind) {
+ switch (libreState.kind) {
case "idle": key = "idle"; break;
case "detecting": key = "detecting"; break;
case "detected": key = "detected"; break;
@@ -318,8 +318,8 @@
});
- let showOmnibox = $derived(showOmniboxForState(omniState));
- let showInspector = $derived(showInspectorForState(omniState));
+ let showLibrebox = $derived(showLibreboxForState(libreState));
+ let showInspector = $derived(showInspectorForState(libreState));
function isValidTimeBound(v: string): boolean {
return /^(\d+:)?\d{1,2}:\d{1,2}(\.\d+)?$|^\d+(\.\d+)?$/.test(v.trim());
@@ -414,14 +414,14 @@
const trimmed = url.trim();
if (!trimmed) {
- omniState = { kind: "idle" };
+ libreState = { kind: "idle" };
return;
}
const urls = extractUrls(trimmed);
if (urls.length > 1) {
- omniState = { kind: "batch", urls };
+ libreState = { kind: "batch", urls };
return;
}
@@ -430,7 +430,7 @@
if (url !== targetUrl) {
url = targetUrl;
}
- omniState = { kind: "detecting" };
+ libreState = { kind: "detecting" };
if (getSettings()?.download.auto_download_on_paste) {
pendingAutoDownload = true;
}
@@ -441,12 +441,12 @@
}
if (trimmed.length >= 2) {
- omniState = { kind: "searching" };
+ libreState = { kind: "searching" };
debounceTimer = setTimeout(() => {
performSearch(trimmed);
}, 600);
} else {
- omniState = { kind: "idle" };
+ libreState = { kind: "idle" };
}
}
@@ -479,13 +479,13 @@
}
}
if (url.trim() !== value) return;
- omniState = { kind: "detected", info: result };
+ libreState = { kind: "detected", info: result };
} else {
- omniState = { kind: "unsupported" };
+ libreState = { kind: "unsupported" };
}
} catch {
if (url.trim() === value) {
- omniState = { kind: "unsupported" };
+ libreState = { kind: "unsupported" };
}
}
}
@@ -605,28 +605,28 @@
});
if (url.trim() !== query) return;
if (results.length > 0) {
- omniState = { kind: "search-results", results };
+ libreState = { kind: "search-results", results };
} else {
- omniState = { kind: "search-empty" };
+ libreState = { kind: "search-empty" };
}
} catch {
if (url.trim() === query) {
- omniState = { kind: "search-empty" };
+ libreState = { kind: "search-empty" };
}
}
}
function selectSearchResult(result: SearchResult) {
url = result.url;
- omniState = { kind: "detecting" };
+ libreState = { kind: "detecting" };
detectPlatform(result.url);
}
function getContentTypeLabel(contentType: string | null): string {
- if (!contentType) return $t("omnibox.content_type.unknown");
- const key = `omnibox.content_type.${contentType}`;
+ if (!contentType) return $t("librebox.content_type.unknown");
+ const key = `librebox.content_type.${contentType}`;
const result = $t(key);
- if (result === key) return $t("omnibox.content_type.unknown");
+ if (result === key) return $t("librebox.content_type.unknown");
return result;
}
@@ -641,7 +641,7 @@
}
const targetUrl = url.trim();
if (!targetUrl) {
- formatError = $t("omnibox.formats_error");
+ formatError = $t("librebox.formats_error");
return;
}
loadingFormats = true;
@@ -652,13 +652,13 @@
if (gen !== formatFetchGeneration) return;
formats = result;
if (result.length === 0) {
- formatError = $t("omnibox.no_formats");
+ formatError = $t("librebox.no_formats");
}
} catch (e: any) {
if (gen !== formatFetchGeneration) return;
formats = [];
const msg = typeof e === "string" ? e : e.message ?? "";
- formatError = msg ? translateBackendError(msg, $t) : $t("omnibox.formats_error");
+ formatError = msg ? translateBackendError(msg, $t) : $t("librebox.formats_error");
} finally {
loadingFormats = false;
}
@@ -696,8 +696,8 @@
}
async function handleAction() {
- if (omniState.kind !== "detected") return;
- const info = omniState.info;
+ if (libreState.kind !== "detected") return;
+ const info = libreState.info;
if (COURSE_PLATFORMS.has(info.platform)) {
goto(`/courses/${encodeURIComponent(info.platform)}`);
@@ -714,13 +714,13 @@
const isPlaylist = info.content_type === "playlist" && playlistEntries.length > 0;
if (isPlaylist && selectedPlaylistItems.size === 0) {
- showToast("error", $t("omnibox.playlist_none_selected") as string);
+ showToast("error", $t("librebox.playlist_none_selected") as string);
return;
}
const isTorrent = torrentEntries.length > 0;
if (isTorrent && selectedTorrentFiles.size === 0) {
- showToast("error", $t("omnibox.torrent_none_selected") as string);
+ showToast("error", $t("librebox.torrent_none_selected") as string);
return;
}
@@ -751,7 +751,7 @@
if (hit) {
if (hit.then.output_dir) outputDir = hit.then.output_dir;
if (hit.then.quality && !selectedQuality) ruleQuality = hit.then.quality;
- showToast("info", $t("omnibox.rule_applied", { name: hit.name }) as string);
+ showToast("info", $t("librebox.rule_applied", { name: hit.name }) as string);
}
} catch {
// Regra é conveniência: se falhar, o download segue com as escolhas manuais.
@@ -771,14 +771,14 @@
current: snapshot,
});
if (mudou) {
- showToast("info", $t("omnibox.media_changed", { summary: mudou }) as string);
+ showToast("info", $t("librebox.media_changed", { summary: mudou }) as string);
}
} catch {
// Aviso é cortesia: se falhar, o download segue como sempre seguiu.
}
void invoke("record_media_snapshot", { url: currentUrl, snapshot }).catch(() => {});
- omniState = { kind: "preparing", platform };
+ libreState = { kind: "preparing", platform };
url = "";
try {
@@ -798,15 +798,15 @@
});
persistLastDownloadOptions();
clearMediaPreview();
- omniState = { kind: "idle" };
+ libreState = { kind: "idle" };
addedNoticeActive = true;
if (addedNoticeTimer) clearTimeout(addedNoticeTimer);
addedNoticeTimer = setTimeout(() => {
addedNoticeActive = false;
}, 3000);
} catch (e: any) {
- const msg = typeof e === "string" ? e : e.message ?? $t("omnibox.error");
- omniState = {
+ const msg = typeof e === "string" ? e : e.message ?? $t("librebox.error");
+ libreState = {
kind: "error",
message: msg,
originalUrl: currentUrl,
@@ -823,8 +823,8 @@
};
async function handleBatchDownload() {
- if (omniState.kind !== "batch") return;
- const batchUrls = omniState.urls;
+ if (libreState.kind !== "batch") return;
+ const batchUrls = libreState.urls;
const settings = getSettings();
let outputDir = settings?.download.default_output_dir ?? "";
@@ -848,13 +848,13 @@
outputDir,
});
if (report.verdict === "stop") {
- showToast("error", $t("omnibox.preflight_stop", { total: report.total }) as string);
+ showToast("error", $t("librebox.preflight_stop", { total: report.total }) as string);
return;
}
if (report.problems.length > 0) {
const ruins = new Set(report.problems.map(p => p.url));
paraBaixar = batchUrls.filter(u => !ruins.has(u));
- showToast("info", $t("omnibox.preflight_skips", {
+ showToast("info", $t("librebox.preflight_skips", {
skipped: report.problems.length,
total: report.total,
}) as string);
@@ -864,7 +864,7 @@
// segue como seguia antes.
}
- omniState = { kind: "idle" };
+ libreState = { kind: "idle" };
url = "";
const results = await Promise.allSettled(
@@ -881,15 +881,15 @@
const queued = results.filter(r => r.status === "fulfilled").length;
if (queued > 0) {
- showToast("info", $t("omnibox.batch_queued", { count: queued }));
+ showToast("info", $t("librebox.batch_queued", { count: queued }));
persistLastDownloadOptions();
}
}
function handleRetry() {
- if (omniState.kind !== "error") return;
- url = omniState.originalUrl;
- omniState = { kind: "detecting" };
+ if (libreState.kind !== "error") return;
+ url = libreState.originalUrl;
+ libreState = { kind: "detecting" };
detectPlatform(url.trim());
}
@@ -910,7 +910,7 @@
outputDir = selected;
}
- omniState = { kind: "preparing", platform: "p2p" };
+ libreState = { kind: "preparing", platform: "p2p" };
url = "";
try {
@@ -923,10 +923,10 @@
referer: null,
cookieSlug: null,
});
- omniState = { kind: "idle" };
+ libreState = { kind: "idle" };
} catch (e: any) {
- const msg = typeof e === "string" ? e : e.message ?? $t("omnibox.error");
- omniState = { kind: "error", message: msg, originalUrl: currentUrl, platform: "p2p" };
+ const msg = typeof e === "string" ? e : e.message ?? $t("librebox.error");
+ libreState = { kind: "error", message: msg, originalUrl: currentUrl, platform: "p2p" };
}
}
@@ -949,7 +949,7 @@
async function openBatchFile() {
const selected = await open({
- title: $t("omnibox.batch_file_title"),
+ title: $t("librebox.batch_file_title"),
filters: [{ name: "Text", extensions: ["txt"] }],
multiple: false,
});
@@ -957,7 +957,7 @@
try {
const urls = await invoke<string[]>("parse_batch_file", { path: selected });
if (urls.length === 0) {
- showToast("info", $t("omnibox.batch_file_empty"));
+ showToast("info", $t("librebox.batch_file_empty"));
return;
}
if (urls.length === 1) {
@@ -966,9 +966,9 @@
return;
}
url = urls.join("\n");
- omniState = { kind: "batch", urls };
+ libreState = { kind: "batch", urls };
} catch (e: any) {
- const msg = typeof e === "string" ? e : e.message ?? $t("omnibox.error");
+ const msg = typeof e === "string" ? e : e.message ?? $t("librebox.error");
showToast("error", msg);
}
}
@@ -993,7 +993,7 @@
function handleDismiss() {
clearMediaPreview();
- omniState = { kind: "idle" };
+ libreState = { kind: "idle" };
url = "";
}
</script>
@@ -1014,13 +1014,13 @@
{$t('home.action_simple')}
</button>
</div>
- <OmniboxAdvanced />
+ <LibreboxAdvanced />
</div>
</div>
{:else}
<div class="home-stage">
<div class="home-stage-inner">
- <div class="home-stage-hero" class:home-stage-hero--detecting={omniState.kind === "detecting"}>
+ <div class="home-stage-hero" class:home-stage-hero--detecting={libreState.kind === "detecting"}>
<HomeHero
emotion={mascotEmotion}
stage
@@ -1036,7 +1036,7 @@
<path d="M12 5v14" />
<path d="M5 12h14" />
</svg>
- <span class="card-title">{$t('omnibox.external_url_ready')}</span>
+ <span class="card-title">{$t('librebox.external_url_ready')}</span>
<button class="dismiss-btn" onclick={() => { externalNotice = null; }} aria-label={$t('common.close')}>
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M18 6L6 18M6 6l12 12" />
@@ -1049,7 +1049,7 @@
</div>
{/if}
- {#if showOmnibox}
+ {#if showLibrebox}
<HomeUrlBar
variant="stage"
bind:url
@@ -1060,78 +1060,78 @@
/>
{/if}
- {#if omniState.kind === "detecting"}
+ {#if libreState.kind === "detecting"}
<div class="feedback feedback-enter">
- <span class="feedback-text">{$t('omnibox.detecting')}</span>
+ <span class="feedback-text">{$t('librebox.detecting')}</span>
</div>
- {:else if omniState.kind === "detected"}
+ {:else if libreState.kind === "detected"}
<div class="feedback feedback-enter" data-supported="true">
- <span class="feedback-text">{platformDisplayName(omniState.info.platform)}</span>
+ <span class="feedback-text">{platformDisplayName(libreState.info.platform)}</span>
</div>
- {:else if omniState.kind === "idle" && addedNoticeActive}
+ {:else if libreState.kind === "idle" && addedNoticeActive}
<div class="feedback feedback-enter added-notice">
- <strong class="added-notice-title">{$t('omnibox.added_to_downloads')}</strong>
+ <strong class="added-notice-title">{$t('librebox.added_to_downloads')}</strong>
<button type="button" class="added-notice-link" onclick={() => goto("/downloads")}>
- {$t('omnibox.open_downloads')}
+ {$t('librebox.open_downloads')}
</button>
</div>
- {:else if omniState.kind === "batch"}
+ {:else if libreState.kind === "batch"}
<div class="batch-options">
<DownloadModeSelector bind:downloadMode />
- <BatchDownload count={omniState.urls.length} onDownload={handleBatchDownload} />
+ <BatchDownload count={libreState.urls.length} onDownload={handleBatchDownload} />
</div>
- {:else if omniState.kind === "searching"}
+ {:else if libreState.kind === "searching"}
<div class="feedback feedback-enter">
<span class="feedback-spinner"></span>
- <span class="feedback-text search-hint">{$t('omnibox.searching')}</span>
+ <span class="feedback-text search-hint">{$t('librebox.searching')}</span>
</div>
- {:else if omniState.kind === "search-results"}
- <SearchResults results={omniState.results} onSelect={selectSearchResult} />
+ {:else if libreState.kind === "search-results"}
+ <SearchResults results={libreState.results} onSelect={selectSearchResult} />
- {:else if omniState.kind === "search-empty"}
+ {:else if libreState.kind === "search-empty"}
<div class="feedback feedback-enter" data-supported="false">
<svg class="feedback-icon" viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="11" cy="11" r="8" />
<path d="M21 21l-4.35-4.35" />
</svg>
- <span class="feedback-text">{$t('omnibox.search_empty')}</span>
+ <span class="feedback-text">{$t('librebox.search_empty')}</span>
</div>
- {:else if omniState.kind === "unsupported"}
+ {:else if libreState.kind === "unsupported"}
<div class="feedback feedback-enter" data-supported="false">
<svg class="feedback-icon" viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="10" />
<path d="M12 8v4m0 4h.01" />
</svg>
- <span class="feedback-text">{$t('omnibox.unsupported')}</span>
+ <span class="feedback-text">{$t('librebox.unsupported')}</span>
</div>
{/if}
<HomeInspector open={showInspector} title={$t('home.inspector_title')}>
- {#if omniState.kind === "detected"}
+ {#if libreState.kind === "detected"}
<MediaPreview bind:mediaPreview bind:imageLoading={previewImageLoading} />
- {#if omniState.info.content_type === "playlist"}
+ {#if libreState.info.content_type === "playlist"}
<div class="playlist-picker">
<div class="playlist-head">
<span class="playlist-count">
- {$t('omnibox.playlist_selected', { selected: selectedPlaylistItems.size, total: playlistEntries.length })}
+ {$t('librebox.playlist_selected', { selected: selectedPlaylistItems.size, total: playlistEntries.length })}
</span>
{#if !playlistLoading && playlistEntries.length > 0}
<div class="playlist-bulk">
- <button type="button" class="playlist-link" onclick={selectAllPlaylist}>{$t('omnibox.playlist_all')}</button>
- <button type="button" class="playlist-link" onclick={selectNonePlaylist}>{$t('omnibox.playlist_none')}</button>
+ <button type="button" class="playlist-link" onclick={selectAllPlaylist}>{$t('librebox.playlist_all')}</button>
+ <button type="button" class="playlist-link" onclick={selectNonePlaylist}>{$t('librebox.playlist_none')}</button>
</div>
{/if}
</div>
{#if playlistLoading}
- <div class="playlist-status"><span class="feedback-spinner"></span> {$t('omnibox.playlist_loading')}</div>
+ <div class="playlist-status"><span class="feedback-spinner"></span> {$t('librebox.playlist_loading')}</div>
{:else if playlistEntries.length === 0}
- <span class="playlist-status">{$t('omnibox.playlist_empty')}</span>
+ <span class="playlist-status">{$t('librebox.playlist_empty')}</span>
{:else}
<ul class="playlist-list">
{#each playlistEntries as entry (entry.index)}
@@ -1151,17 +1151,17 @@
<div class="playlist-picker">
<div class="playlist-head">
<span class="playlist-count">
- {$t('omnibox.torrent_selected', { selected: selectedTorrentFiles.size, total: torrentEntries.length })}
+ {$t('librebox.torrent_selected', { selected: selectedTorrentFiles.size, total: torrentEntries.length })}
</span>
{#if !torrentLoading && torrentEntries.length > 0}
<div class="playlist-bulk">
- <button type="button" class="playlist-link" onclick={selectAllTorrent}>{$t('omnibox.playlist_all')}</button>
- <button type="button" class="playlist-link" onclick={selectNoneTorrent}>{$t('omnibox.playlist_none')}</button>
+ <button type="button" class="playlist-link" onclick={selectAllTorrent}>{$t('librebox.playlist_all')}</button>
+ <button type="button" class="playlist-link" onclick={selectNoneTorrent}>{$t('librebox.playlist_none')}</button>
</div>
{/if}
</div>
{#if torrentLoading}
- <div class="playlist-status"><span class="feedback-spinner"></span> {$t('omnibox.torrent_loading')}</div>
+ <div class="playlist-status"><span class="feedback-spinner"></span> {$t('librebox.torrent_loading')}</div>
{:else}
<ul class="playlist-list">
{#each torrentEntries as entry (entry.index)}
@@ -1179,28 +1179,28 @@
{/if}
{#if cookieHint}
<p class="cookie-hint" class:expired={cookieHint === "expired"} role="status">
- <span>{cookieHint === "expired" ? $t("omnibox.cookie_hint_expired") : $t("omnibox.cookie_hint_stale")}</span>
- <button type="button" class="cookie-hint-link" onclick={() => goto("/settings?tab=cookies")}>{$t("omnibox.cookie_hint_action")}</button>
+ <span>{cookieHint === "expired" ? $t("librebox.cookie_hint_expired") : $t("librebox.cookie_hint_stale")}</span>
+ <button type="button" class="cookie-hint-link" onclick={() => goto("/settings?tab=cookies")}>{$t("librebox.cookie_hint_action")}</button>
</p>
{/if}
- {#if COURSE_PLATFORMS.has(omniState.info.platform)}
+ {#if COURSE_PLATFORMS.has(libreState.info.platform)}
{#if coursesPluginInstalled === false}
- <p class="course-upsell">{$t('omnibox.courses_plugin_needed')}</p>
- <button class="download-primary-btn" onclick={() => goto("/marketplace")}>{$t('omnibox.install_courses_plugin')}</button>
+ <p class="course-upsell">{$t('librebox.courses_plugin_needed')}</p>
+ <button class="download-primary-btn" onclick={() => goto("/marketplace")}>{$t('librebox.install_courses_plugin')}</button>
{:else}
- <p class="course-upsell">{$t('omnibox.courses_plugin_ready')}</p>
- <button class="download-primary-btn" onclick={handleAction}>{$t(omniState.info.platform === "udemy" ? 'omnibox.go_to_udemy' : 'omnibox.go_to_hotmart')}</button>
+ <p class="course-upsell">{$t('librebox.courses_plugin_ready')}</p>
+ <button class="download-primary-btn" onclick={handleAction}>{$t(libreState.info.platform === "udemy" ? 'librebox.go_to_udemy' : 'librebox.go_to_hotmart')}</button>
{/if}
{:else}
- {@const playlistBlocked = omniState.info.content_type === "playlist" && playlistEntries.length > 0 && selectedPlaylistItems.size === 0}
+ {@const playlistBlocked = libreState.info.content_type === "playlist" && playlistEntries.length > 0 && selectedPlaylistItems.size === 0}
{@const torrentBlocked = torrentEntries.length > 0 && selectedTorrentFiles.size === 0}
- {#if omniState.info.platform === "bilibili"}
+ {#if libreState.info.platform === "bilibili"}
<BilibiliPreviewExtras {url} accountSlug={selectedCookieSlug && selectedCookieSlug !== "_anonymous" ? selectedCookieSlug : null} />
{/if}
- <button class="download-primary-btn" disabled={playlistBlocked || torrentBlocked} onclick={handleAction}>{$t('omnibox.download')}</button>
- {#if omniState.info.platform !== "direct_file"}
+ <button class="download-primary-btn" disabled={playlistBlocked || torrentBlocked} onclick={handleAction}>{$t('librebox.download')}</button>
+ {#if libreState.info.platform !== "direct_file"}
<details class="options-panel">
- <summary class="options-toggle">{$t('omnibox.options')}</summary>
+ <summary class="options-toggle">{$t('librebox.options')}</summary>
<div class="options-content">
<DownloadModeSelector bind:downloadMode onChange={() => { selectedFormatId = null; }} />
{#if downloadMode !== "audio"}
@@ -1210,47 +1210,47 @@
<CookieAccountPicker accounts={cookieAccounts} bind:selectedSlug={selectedCookieSlug} />
{/if}
<details class="options-panel">
- <summary class="options-toggle">{$t('omnibox.advanced')}</summary>
+ <summary class="options-toggle">{$t('librebox.advanced')}</summary>
<div class="options-content">
- {#if omniState.info.platform === "vimeo" || omniState.info.platform === "generic"}
+ {#if libreState.info.platform === "vimeo" || libreState.info.platform === "generic"}
<div class="referer-input-wrapper">
- <label class="referer-label" for="referer-input">{$t('omnibox.referer_label')}</label>
- <input id="referer-input" class="referer-input" type="text" placeholder={$t('omnibox.referer_placeholder')} bind:value={referer} spellcheck="false" />
+ <label class="referer-label" for="referer-input">{$t('librebox.referer_label')}</label>
+ <input id="referer-input" class="referer-input" type="text" placeholder={$t('librebox.referer_placeholder')} bind:value={referer} spellcheck="false" />
</div>
{/if}
- {#if omniState.info.content_type !== "playlist"}
+ {#if libreState.info.content_type !== "playlist"}
<div class="timerange-wrapper">
- <span class="timerange-label">{$t('omnibox.timerange_label')}</span>
+ <span class="timerange-label">{$t('librebox.timerange_label')}</span>
<div class="timerange-inputs">
- <input class="timerange-input" type="text" placeholder={$t('omnibox.timerange_start')} bind:value={clipStart} spellcheck="false" inputmode="numeric" aria-label={$t('omnibox.timerange_start') as string} />
+ <input class="timerange-input" type="text" placeholder={$t('librebox.timerange_start')} bind:value={clipStart} spellcheck="false" inputmode="numeric" aria-label={$t('librebox.timerange_start') as string} />
<span class="timerange-sep" aria-hidden="true">—</span>
- <input class="timerange-input" type="text" placeholder={$t('omnibox.timerange_end')} bind:value={clipEnd} spellcheck="false" inputmode="numeric" aria-label={$t('omnibox.timerange_end') as string} />
+ <input class="timerange-input" type="text" placeholder={$t('librebox.timerange_end')} bind:value={clipEnd} spellcheck="false" inputmode="numeric" aria-label={$t('librebox.timerange_end') as string} />
</div>
- <span class="timerange-hint">{$t('omnibox.timerange_hint')}</span>
+ <span class="timerange-hint">{$t('librebox.timerange_hint')}</span>
</div>
{/if}
<div class="timerange-wrapper">
- <span class="timerange-label">{$t('omnibox.schedule_label')}</span>
+ <span class="timerange-label">{$t('librebox.schedule_label')}</span>
<div class="schedule-presets">
- <button type="button" class="schedule-preset" onclick={() => setSchedulePreset('1h')}>{$t('omnibox.schedule_1h')}</button>
- <button type="button" class="schedule-preset" onclick={() => setSchedulePreset('tonight')}>{$t('omnibox.schedule_tonight')}</button>
- <button type="button" class="schedule-preset" onclick={() => setSchedulePreset('1d')}>{$t('omnibox.schedule_1d')}</button>
+ <button type="button" class="schedule-preset" onclick={() => setSchedulePreset('1h')}>{$t('librebox.schedule_1h')}</button>
+ <button type="button" class="schedule-preset" onclick={() => setSchedulePreset('tonight')}>{$t('librebox.schedule_tonight')}</button>
+ <button type="button" class="schedule-preset" onclick={() => setSchedulePreset('1d')}>{$t('librebox.schedule_1d')}</button>
{#if scheduleAt || scheduleStop}
- <button type="button" class="schedule-preset" onclick={() => { scheduleAt = ""; scheduleStop = ""; }}>{$t('omnibox.schedule_clear')}</button>
+ <button type="button" class="schedule-preset" onclick={() => { scheduleAt = ""; scheduleStop = ""; }}>{$t('librebox.schedule_clear')}</button>
{/if}
</div>
<div class="timerange-inputs schedule-row">
- <input class="timerange-input schedule-date" type="date" value={schedulePart(scheduleAt, "date")} oninput={(e) => { scheduleAt = withSchedulePart(scheduleAt, "date", e.currentTarget.value); }} aria-label={$t('omnibox.schedule_start') as string} />
- <input class="timerange-input schedule-time" type="time" step="60" value={schedulePart(scheduleAt, "time")} oninput={(e) => { scheduleAt = withSchedulePart(scheduleAt, "time", e.currentTarget.value); }} aria-label={$t('omnibox.schedule_start') as string} />
+ <input class="timerange-input schedule-date" type="date" value={schedulePart(scheduleAt, "date")} oninput={(e) => { scheduleAt = withSchedulePart(scheduleAt, "date", e.currentTarget.value); }} aria-label={$t('librebox.schedule_start') as string} />
+ <input class="timerange-input schedule-time" type="time" step="60" value={schedulePart(scheduleAt, "time")} oninput={(e) => { scheduleAt = withSchedulePart(scheduleAt, "time", e.currentTarget.value); }} aria-label={$t('librebox.schedule_start') as string} />
<span class="timerange-sep" aria-hidden="true">—</span>
- <input class="timerange-input schedule-date" type="date" value={schedulePart(scheduleStop, "date")} oninput={(e) => { scheduleStop = withSchedulePart(scheduleStop, "date", e.currentTarget.value); }} aria-label={$t('omnibox.schedule_stop') as string} />
- <input class="timerange-input schedule-time" type="time" step="60" value={schedulePart(scheduleStop, "time")} oninput={(e) => { scheduleStop = withSchedulePart(scheduleStop, "time", e.currentTarget.value); }} aria-label={$t('omnibox.schedule_stop') as string} />
+ <input class="timerange-input schedule-date" type="date" value={schedulePart(scheduleStop, "date")} oninput={(e) => { scheduleStop = withSchedulePart(scheduleStop, "date", e.currentTarget.value); }} aria-label={$t('librebox.schedule_stop') as string} />
+ <input class="timerange-input schedule-time" type="time" step="60" value={schedulePart(scheduleStop, "time")} oninput={(e) => { scheduleStop = withSchedulePart(scheduleStop, "time", e.currentTarget.value); }} aria-label={$t('librebox.schedule_stop') as string} />
</div>
- <span class="timerange-hint">{$t('omnibox.schedule_hint')}</span>
+ <span class="timerange-hint">{$t('librebox.schedule_hint')}</span>
</div>
<FormatSelector
- platform={omniState.info.platform}
- isPlaylist={omniState.info.content_type === "playlist"}
+ platform={libreState.info.platform}
+ isPlaylist={libreState.info.content_type === "playlist"}
bind:formats
bind:selectedFormatId
{loadingFormats}
@@ -1267,20 +1267,20 @@
</details>
{/if}
{/if}
- {:else if omniState.kind === "preparing"}
+ {:else if libreState.kind === "preparing"}
<div class="feedback-card feedback-enter">
<div class="card-row">
<span class="feedback-spinner"></span>
- <span class="card-text">{$t('omnibox.preparing')}</span>
+ <span class="card-text">{$t('librebox.preparing')}</span>
</div>
</div>
- {:else if omniState.kind === "error"}
+ {:else if libreState.kind === "error"}
<div class="feedback-card feedback-enter" data-status="error">
<div class="card-row">
- <span class="card-title card-error-text">{omniState.message}</span>
+ <span class="card-title card-error-text">{libreState.message}</span>
</div>
<div class="card-row card-actions">
- <button class="button card-action-btn" onclick={handleRetry}>{$t('omnibox.retry')}</button>
+ <button class="button card-action-btn" onclick={handleRetry}>{$t('librebox.retry')}</button>
</div>
</div>
{/if}
@@ -1316,7 +1316,7 @@
gap: var(--space-3);
}
- /* detection line under the omnibox */
+ /* detection line under the librebox */
.feedback {
display: flex;
align-items: center;
diff --git a/src/routes/downloads/+page.svelte b/src/routes/downloads/+page.svelte
index 282f27e7..87017dc9 100644
--- a/src/routes/downloads/+page.svelte
+++ b/src/routes/downloads/+page.svelte
@@ -59,12 +59,12 @@
}
function qualityChip(item: GenericDownloadItem): string | null {
- if (item.downloadMode === "audio") return $t('omnibox.quality_audio') as string;
+ if (item.downloadMode === "audio") return $t('librebox.quality_audio') as string;
if (!item.quality) return null;
const q = item.quality.toLowerCase();
- if (q === "audio") return $t('omnibox.quality_audio') as string;
+ if (q === "audio") return $t('librebox.quality_audio') as string;
if (!isVideoItem(item)) return null;
- if (q === "best" || q === "highest") return $t('omnibox.quality_best_short') as string;
+ if (q === "best" || q === "highest") return $t('librebox.quality_best_short') as string;
return item.quality;
}
@@ -83,7 +83,7 @@
const a = s.acodec && s.acodec !== "none" ? s.acodec.split(".")[0] : null;
if (v && s.height) parts.push(`${s.height}p${s.fps && s.fps >= 48 ? Math.round(s.fps) : ""}`);
else if (v) parts.push(s.format_note ?? s.format_id);
- else if (a) parts.push($t('omnibox.quality_audio') as string);
+ else if (a) parts.push($t('librebox.quality_audio') as string);
if (s.ext) parts.push(s.ext);
if (v) parts.push(v);
else if (a) parts.push(a);