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.

feat(opennami): port standalone engine architecture with dual-engine fallback and anti-bot hardening

IGECTd9ea9640ec39
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
index 986672e7..d022e347 100644
--- a/.github/FUNDING.yml
+++ b/.github/FUNDING.yml
@@ -1 +1 @@
-github: tonhowtf
+github: OpenSelena
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 0d491a93..da69995e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -198,4 +198,4 @@ jobs:
sudo apt-get install -y appstream
- name: Validate flatpak metainfo
- run: appstreamcli validate flatpak/wtf.tonho.omniget.metainfo.xml
+ run: appstreamcli validate flatpak/com.openselena.omniget.metainfo.xml
diff --git a/.github/workflows/homebrew.yml b/.github/workflows/homebrew.yml
index a854a9be..e3306ae5 100644
--- a/.github/workflows/homebrew.yml
+++ b/.github/workflows/homebrew.yml
@@ -31,7 +31,7 @@ jobs:
if: steps.gate.outputs.skip != 'true'
uses: actions/checkout@v4
with:
- repository: tonhowtf/homebrew-tap
+ repository: OpenSelena/homebrew-tap
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
path: tap
@@ -48,16 +48,33 @@ jobs:
curl -fsSL -o intel.dmg "$base/omniget_${version}_x64.dmg"
arm_sha=$(sha256sum arm.dmg | cut -d' ' -f1)
intel_sha=$(sha256sum intel.dmg | cut -d' ' -f1)
+ mkdir -p tap/Casks
cask=tap/Casks/omniget.rb
- sed -i -E "s/^ version \".*\"/ version \"$version\"/" "$cask"
- python3 - "$cask" "$arm_sha" "$intel_sha" <<'PY'
- import re, sys
- path, arm, intel = sys.argv[1:4]
- src = open(path).read()
- src = re.sub(r'(on_arm do\n\s+sha256 ")[0-9a-f]{64}', lambda m: m.group(1) + arm, src, count=1)
- src = re.sub(r'(on_intel do\n\s+sha256 ")[0-9a-f]{64}', lambda m: m.group(1) + intel, src, count=1)
- open(path, "w").write(src)
- PY
+ cat > "$cask" <<EOF
+cask "omniget" do
+ version "$version"
+
+ on_arm do
+ url "https://github.com/$REPO/releases/download/$TAG/omniget_#{version}_aarch64.dmg"
+ sha256 "$arm_sha"
+ end
+ on_intel do
+ url "https://github.com/$REPO/releases/download/$TAG/omniget_#{version}_x64.dmg"
+ sha256 "$intel_sha"
+ end
+
+ name "OmniGet"
+ desc "Universal downloader and media workstation"
+ homepage "https://github.com/$REPO"
+
+ app "omniget.app"
+
+ zap trash: [
+ "~/Library/Application Support/com.openselena.omniget",
+ "~/Library/Caches/com.openselena.omniget",
+ ]
+end
+EOF
cd tap
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 5c1d01ad..13dece04 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -72,7 +72,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
- LDAI_UPDATE_INFORMATION: ${{ contains(matrix.platform, 'ubuntu') && 'gh-releases-zsync|tonhowtf|omniget|latest|*AppImage.zsync' || '' }}
+ LDAI_UPDATE_INFORMATION: ${{ contains(matrix.platform, 'ubuntu') && 'gh-releases-zsync|OpenSelena|omniget|latest|*AppImage.zsync' || '' }}
# linuxdeploy bundles an old `strip` that fails on modern .relr.dyn
# relocations; disable stripping so AppImage bundling succeeds.
NO_STRIP: ${{ contains(matrix.platform, 'ubuntu') && '1' || '' }}
diff --git a/.github/workflows/winget.yml b/.github/workflows/winget.yml
index 992d4c12..25909ba7 100644
--- a/.github/workflows/winget.yml
+++ b/.github/workflows/winget.yml
@@ -32,7 +32,7 @@ jobs:
$version = $env:TAG.TrimStart('v')
$url = "https://github.com/$env:REPO/releases/download/$env:TAG/omniget_${version}_x64-setup.exe"
Invoke-WebRequest -Uri 'https://aka.ms/wingetcreate/latest' -OutFile wingetcreate.exe
- .\wingetcreate.exe update tonhowtf.OmniGet `
+ .\wingetcreate.exe update OpenSelena.OmniGet `
--version $version `
--urls $url `
--submit `
diff --git a/.nojekyll b/.nojekyll
new file mode 100644
index 00000000..e6085f80
--- /dev/null
+++ b/.nojekyll
@@ -0,0 +1 @@
+# Disable Jekyll processing for GitHub Pages
diff --git a/CNAME b/CNAME
new file mode 100644
index 00000000..2485019d
--- /dev/null
+++ b/CNAME
@@ -0,0 +1 @@
+omniget.nav.bd
\ No newline at end of file
diff --git a/README.md b/README.md
index fb42573e..a33edba1 100644
--- a/README.md
+++ b/README.md
@@ -36,9 +36,9 @@ twitch-downloader, subtitle-downloader, epub-reader, spaced-repetition
</p>
<p align="center">
- <a href="https://github.com/tonhowtf/omniget/releases/latest"><img src="https://img.shields.io/github/v/release/tonhowtf/omniget?style=for-the-badge&label=release&color=F28500" alt="Latest release" /></a>
- <a href="https://github.com/tonhowtf/omniget/releases"><img src="https://img.shields.io/github/downloads/tonhowtf/omniget/total?style=for-the-badge&label=downloads&color=1E6FE8" alt="Total downloads" /></a>
- <a href="https://github.com/tonhowtf/omniget/stargazers"><img src="https://img.shields.io/github/stars/tonhowtf/omniget?style=for-the-badge&color=FFD426" alt="GitHub stars" /></a>
+ <a href="https://github.com/OpenSelena/omniget/releases/latest"><img src="https://img.shields.io/github/v/release/OpenSelena/omniget?style=for-the-badge&label=release&color=F28500" alt="Latest release" /></a>
+ <a href="https://github.com/OpenSelena/omniget/releases"><img src="https://img.shields.io/github/downloads/OpenSelena/omniget/total?style=for-the-badge&label=downloads&color=1E6FE8" alt="Total downloads" /></a>
+ <a href="https://github.com/OpenSelena/omniget/stargazers"><img src="https://img.shields.io/github/stars/OpenSelena/omniget?style=for-the-badge&color=FFD426" alt="GitHub stars" /></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-GPL--3.0-2AA845?style=for-the-badge" alt="License GPL-3.0" /></a>
<a href="https://discord.gg/jgdxyPy7Vn"><img src="https://img.shields.io/badge/Discord-community-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Discord community" /></a>
<a href="https://hosted.weblate.org/engage/omniget/"><img src="https://hosted.weblate.org/widget/omniget/frontend-json/svg-badge.svg" alt="Translation status" /></a>
@@ -109,7 +109,7 @@ yt-dlp is the engine OmniGet runs on, and OmniGet would not exist without it. If
## Download and install
-Pick your system. Every build is published on the [Releases page](https://github.com/tonhowtf/omniget/releases/latest). Updates arrive inside the app.
+Pick your system. Every build is published on the [Releases page](https://github.com/OpenSelena/omniget/releases/latest). Updates arrive inside the app.
<table>
<tr>
@@ -120,12 +120,12 @@ Pick your system. Every build is published on the [Releases page](https://github
<tr>
<td><b>Windows 10 / 11</b></td>
<td><code>omniget_x.y.z_x64-setup.exe</code> (installer)<br/><code>omniget_x.y.z_x64-portable.exe</code> (no install, runs from anywhere)<br/><code>omniget_x.y.z_x64_en-US.msi</code> (for IT deployments)</td>
- <td><code>winget install -e --id tonhowtf.OmniGet</code></td>
+ <td><code>winget install -e --id OpenSelena.OmniGet</code></td>
</tr>
<tr>
<td><b>macOS 10.15+</b></td>
<td><code>omniget_x.y.z_aarch64.dmg</code> for Apple Silicon (M1 and later)<br/><code>omniget_x.y.z_x64.dmg</code> for Intel Macs</td>
- <td><code>brew install --cask tonhowtf/tap/omniget</code></td>
+ <td><code>brew install --cask OpenSelena/tap/omniget</code></td>
</tr>
<tr>
<td><b>Linux</b></td>
@@ -235,7 +235,7 @@ From now on, visit any supported page and click the icon. The page, its cookies
### Level 2: from the release zip
-Every release ships `omniget-chrome-extension-vX.Y.Z.zip`. Download it from the [latest release](https://github.com/tonhowtf/omniget/releases/latest), unzip it, then follow steps 3 to 7 above pointing **Load unpacked** at the unzipped folder. Use this if you keep the app on one machine and the browser on another, or if you are installing for someone else.
+Every release ships `omniget-chrome-extension-vX.Y.Z.zip`. Download it from the [latest release](https://github.com/OpenSelena/omniget/releases/latest), unzip it, then follow steps 3 to 7 above pointing **Load unpacked** at the unzipped folder. Use this if you keep the app on one machine and the browser on another, or if you are installing for someone else.
### Level 3: Firefox, other browsers and manual pairing
@@ -687,7 +687,7 @@ Debian and Ubuntu: `.deb`. Fedora, openSUSE, RHEL family: `.rpm`. Anything else:
## Command line
-`omniget-cli` ships with every release for Windows, macOS (Intel and Apple Silicon) and Linux. Grab `omniget-cli-<version>-<target>` from the [latest release](https://github.com/tonhowtf/omniget/releases/latest).
+`omniget-cli` ships with every release for Windows, macOS (Intel and Apple Silicon) and Linux. Grab `omniget-cli-<version>-<target>` from the [latest release](https://github.com/OpenSelena/omniget/releases/latest).
```bash
omniget info <url> # title, formats and size, downloads nothing
@@ -704,7 +704,7 @@ omniget import-cookies cookies.txt # Netscape format
If you only want to use OmniGet, [grab a release](#download-and-install). To build it you need [Rust](https://rustup.rs/) (the exact toolchain is pinned in `rust-toolchain.toml` because the plugin ABI depends on it), [Node.js](https://nodejs.org/) 18+ and [pnpm](https://pnpm.io/).
```bash
-git clone https://github.com/tonhowtf/omniget.git
+git clone https://github.com/OpenSelena/omniget.git
cd omniget
pnpm install
pnpm tauri dev
@@ -736,7 +736,7 @@ Stack: Tauri 2, Rust, SvelteKit with Svelte 5, SQLite, yt-dlp, FFmpeg, librqbit
## Contributing and translations
-Bug reports and pull requests go to [Issues](https://github.com/tonhowtf/omniget/issues) and [Pull requests](https://github.com/tonhowtf/omniget/pulls). Questions and quick help live on [Discord](https://discord.gg/jgdxyPy7Vn).
+Bug reports and pull requests go to [Issues](https://github.com/OpenSelena/omniget/issues) and [Pull requests](https://github.com/OpenSelena/omniget/pulls). Questions and quick help live on [Discord](https://discord.gg/jgdxyPy7Vn). Security inquiries and vulnerability reports: [SECURITY.md](SECURITY.md) or [[email protected]](mailto:[email protected]).
Translations are managed on [Weblate](https://hosted.weblate.org/engage/omniget/). Pick your language and translate in the browser. New strings appear there a few hours after they land in `main`.
@@ -745,9 +745,9 @@ OmniGet is built on [yt-dlp](https://github.com/yt-dlp/yt-dlp), [FFmpeg](https:/
Loop, the creature on the home screen, is OmniGet's mascot. Fan art is welcome. The original artwork may not be used commercially or redistributed modified. The illustrations in this README were generated with [Higgsfield](https://higgsfield.ai) from the original Loop artwork.
<p align="center">
- <a href="https://star-history.com/#tonhowtf/omniget&Date"><img src="https://api.star-history.com/svg?repos=tonhowtf/omniget&type=Date" alt="Star history of tonhowtf/omniget" width="600" /></a>
+ <a href="https://star-history.com/#OpenSelena/omniget&Date"><img src="https://api.star-history.com/svg?repos=OpenSelena/omniget&type=Date" alt="Star history of OpenSelena/omniget" width="600" /></a>
</p>
<p align="center">
- <a href="https://github.com/tonhowtf/omniget/releases/latest"><b>Download OmniGet</b></a> · <a href="LICENSE">GPL-3.0</a>
+ <a href="https://github.com/OpenSelena/omniget/releases/latest"><b>Download OmniGet</b></a> · <a href="LICENSE">GPL-3.0</a>
</p>
diff --git a/README.ru.md b/README.ru.md
index 537a8aa9..b32494fa 100644
--- a/README.ru.md
+++ b/README.ru.md
@@ -22,7 +22,7 @@ OmniGet — бесплатный загрузчик и набор медиаин
</p>
<p align="center">
- <sub>Русский перевод начал <a href="https://github.com/xJaroslav69">@xJaroslav69</a> (<a href="https://github.com/tonhowtf/omniget/pull/130">PR #130</a>). Спасибо.</sub>
+ <sub>Русский перевод начал <a href="https://github.com/xJaroslav69">@xJaroslav69</a> (<a href="https://github.com/OpenSelena/omniget/pull/130">PR #130</a>). Спасибо.</sub>
</p>
<p align="center">
@@ -30,9 +30,9 @@ OmniGet — бесплатный загрузчик и набор медиаин
</p>
<p align="center">
- <a href="https://github.com/tonhowtf/omniget/releases/latest"><img src="https://img.shields.io/github/v/release/tonhowtf/omniget?style=for-the-badge&label=release&color=F28500" alt="Последний релиз" /></a>
- <a href="https://github.com/tonhowtf/omniget/releases"><img src="https://img.shields.io/github/downloads/tonhowtf/omniget/total?style=for-the-badge&label=downloads&color=1E6FE8" alt="Всего загрузок" /></a>
- <a href="https://github.com/tonhowtf/omniget/stargazers"><img src="https://img.shields.io/github/stars/tonhowtf/omniget?style=for-the-badge&color=FFD426" alt="Звёзды на GitHub" /></a>
+ <a href="https://github.com/OpenSelena/omniget/releases/latest"><img src="https://img.shields.io/github/v/release/OpenSelena/omniget?style=for-the-badge&label=release&color=F28500" alt="Последний релиз" /></a>
+ <a href="https://github.com/OpenSelena/omniget/releases"><img src="https://img.shields.io/github/downloads/OpenSelena/omniget/total?style=for-the-badge&label=downloads&color=1E6FE8" alt="Всего загрузок" /></a>
+ <a href="https://github.com/OpenSelena/omniget/stargazers"><img src="https://img.shields.io/github/stars/OpenSelena/omniget?style=for-the-badge&color=FFD426" alt="Звёзды на GitHub" /></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-GPL--3.0-2AA845?style=for-the-badge" alt="Лицензия GPL-3.0" /></a>
<a href="https://discord.gg/jgdxyPy7Vn"><img src="https://img.shields.io/badge/Discord-сообщество-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Сообщество в Discord" /></a>
<a href="https://hosted.weblate.org/engage/omniget/"><img src="https://hosted.weblate.org/widget/omniget/frontend-json/svg-badge.svg" alt="Статус перевода" /></a>
@@ -102,7 +102,7 @@ yt-dlp — это движок, на котором работает OmniGet, и
## Скачать и установить
-Выберите свою систему. Все сборки публикуются на [странице релизов](https://github.com/tonhowtf/omniget/releases/latest). Обновления приходят внутри приложения.
+Выберите свою систему. Все сборки публикуются на [странице релизов](https://github.com/OpenSelena/omniget/releases/latest). Обновления приходят внутри приложения.
<table>
<tr>
@@ -113,12 +113,12 @@ yt-dlp — это движок, на котором работает OmniGet, и
<tr>
<td><b>Windows 10 / 11</b></td>
<td><code>omniget_x.y.z_x64-setup.exe</code> (установщик)<br/><code>omniget_x.y.z_x64-portable.exe</code> (без установки, запускается откуда угодно)<br/><code>omniget_x.y.z_x64_en-US.msi</code> (для ИТ-развёртывания)</td>
- <td><code>winget install -e --id tonhowtf.OmniGet</code></td>
+ <td><code>winget install -e --id OpenSelena.OmniGet</code></td>
</tr>
<tr>
<td><b>macOS 10.15+</b></td>
<td><code>omniget_x.y.z_aarch64.dmg</code> для Apple Silicon (M1 и новее)<br/><code>omniget_x.y.z_x64.dmg</code> для Mac на Intel</td>
- <td><code>brew install --cask tonhowtf/tap/omniget</code></td>
+ <td><code>brew install --cask OpenSelena/tap/omniget</code></td>
</tr>
<tr>
<td><b>Linux</b></td>
@@ -214,7 +214,7 @@ codesign --force --deep --sign - /Applications/omniget.app
### Уровень 2: из zip-архива релиза
-В каждом релизе есть `omniget-chrome-extension-vX.Y.Z.zip`. Скачайте его из [последнего релиза](https://github.com/tonhowtf/omniget/releases/latest), распакуйте и повторите шаги 3–7, указав в **Загрузить распакованное расширение** распакованную папку. Это удобно, если приложение стоит на одной машине, а браузер на другой, или вы ставите расширение кому-то ещё.
+В каждом релизе есть `omniget-chrome-extension-vX.Y.Z.zip`. Скачайте его из [последнего релиза](https://github.com/OpenSelena/omniget/releases/latest), распакуйте и повторите шаги 3–7, указав в **Загрузить распакованное расширение** распакованную папку. Это удобно, если приложение стоит на одной машине, а браузер на другой, или вы ставите расширение кому-то ещё.
### Уровень 3: Firefox, другие браузеры и ручное сопряжение
@@ -531,7 +531,7 @@ Debian и Ubuntu: `.deb`. Fedora, openSUSE, семейство RHEL: `.rpm`. В
## Командная строка
-`omniget-cli` выходит с каждым релизом для Windows, macOS (Intel и Apple Silicon) и Linux. Возьмите `omniget-cli-<версия>-<платформа>` из [последнего релиза](https://github.com/tonhowtf/omniget/releases/latest).
+`omniget-cli` выходит с каждым релизом для Windows, macOS (Intel и Apple Silicon) и Linux. Возьмите `omniget-cli-<версия>-<платформа>` из [последнего релиза](https://github.com/OpenSelena/omniget/releases/latest).
```bash
omniget info <url> # название, форматы и размер, ничего не скачивает
@@ -548,7 +548,7 @@ omniget import-cookies cookies.txt # формат Netscape
Если вы просто хотите пользоваться OmniGet, [возьмите релиз](#скачать-и-установить). Для сборки нужны [Rust](https://rustup.rs/) (точная версия тулчейна закреплена в `rust-toolchain.toml`, потому что от неё зависит ABI плагинов), [Node.js](https://nodejs.org/) 18+ и [pnpm](https://pnpm.io/).
```bash
-git clone https://github.com/tonhowtf/omniget.git
+git clone https://github.com/OpenSelena/omniget.git
cd omniget
pnpm install
pnpm tauri dev
@@ -580,7 +580,7 @@ pnpm tauri build --config '{"bundle":{"createUpdaterArtifacts":false}}'
## Участие и переводы
-Сообщения об ошибках и pull request'ы — в [Issues](https://github.com/tonhowtf/omniget/issues) и [Pull requests](https://github.com/tonhowtf/omniget/pulls). Вопросы и быстрая помощь — в [Discord](https://discord.gg/jgdxyPy7Vn).
+Сообщения об ошибках и pull request'ы — в [Issues](https://github.com/OpenSelena/omniget/issues) и [Pull requests](https://github.com/OpenSelena/omniget/pulls). Вопросы и быстрая помощь — в [Discord](https://discord.gg/jgdxyPy7Vn).
Переводы ведутся на [Weblate](https://hosted.weblate.org/engage/omniget/). Выберите свой язык и переводите в браузере. Новые строки появляются там через несколько часов после попадания в `main`.
@@ -589,9 +589,9 @@ OmniGet построен на [yt-dlp](https://github.com/yt-dlp/yt-dlp), [FFmpe
Loop, существо на главном экране, — маскот OmniGet. Фан-арт приветствуется. Оригинальную графику нельзя использовать в коммерческих целях и распространять в изменённом виде.
<p align="center">
- <a href="https://star-history.com/#tonhowtf/omniget&Date"><img src="https://api.star-history.com/svg?repos=tonhowtf/omniget&type=Date" alt="История звёзд tonhowtf/omniget" width="600" /></a>
+ <a href="https://star-history.com/#OpenSelena/omniget&Date"><img src="https://api.star-history.com/svg?repos=OpenSelena/omniget&type=Date" alt="История звёзд OpenSelena/omniget" width="600" /></a>
</p>
<p align="center">
- <a href="https://github.com/tonhowtf/omniget/releases/latest"><b>Скачать OmniGet</b></a> · <a href="LICENSE">GPL-3.0</a>
+ <a href="https://github.com/OpenSelena/omniget/releases/latest"><b>Скачать OmniGet</b></a> · <a href="LICENSE">GPL-3.0</a>
</p>
diff --git a/README_pt_br.md b/README_pt_br.md
index abf55c26..38def25a 100644
--- a/README_pt_br.md
+++ b/README_pt_br.md
@@ -22,7 +22,7 @@ leitor pdf, flashcards anki, repetição espaçada, player de música, spicetify
</p>
<p align="center">
- <sub>Tradução para o português do Brasil iniciada por <a href="https://github.com/alvarorichard">@alvarorichard</a> (<a href="https://github.com/tonhowtf/omniget/pull/280">PR #280</a>). Obrigado.</sub>
+ <sub>Tradução para o português do Brasil iniciada por <a href="https://github.com/alvarorichard">@alvarorichard</a> (<a href="https://github.com/OpenSelena/omniget/pull/280">PR #280</a>). Obrigado.</sub>
</p>
<p align="center">
@@ -30,9 +30,9 @@ leitor pdf, flashcards anki, repetição espaçada, player de música, spicetify
</p>
<p align="center">
- <a href="https://github.com/tonhowtf/omniget/releases/latest"><img src="https://img.shields.io/github/v/release/tonhowtf/omniget?style=for-the-badge&label=release&color=F28500" alt="Última versão" /></a>
- <a href="https://github.com/tonhowtf/omniget/releases"><img src="https://img.shields.io/github/downloads/tonhowtf/omniget/total?style=for-the-badge&label=downloads&color=1E6FE8" alt="Total de downloads" /></a>
- <a href="https://github.com/tonhowtf/omniget/stargazers"><img src="https://img.shields.io/github/stars/tonhowtf/omniget?style=for-the-badge&color=FFD426" alt="Estrelas no GitHub" /></a>
+ <a href="https://github.com/OpenSelena/omniget/releases/latest"><img src="https://img.shields.io/github/v/release/OpenSelena/omniget?style=for-the-badge&label=release&color=F28500" alt="Última versão" /></a>
+ <a href="https://github.com/OpenSelena/omniget/releases"><img src="https://img.shields.io/github/downloads/OpenSelena/omniget/total?style=for-the-badge&label=downloads&color=1E6FE8" alt="Total de downloads" /></a>
+ <a href="https://github.com/OpenSelena/omniget/stargazers"><img src="https://img.shields.io/github/stars/OpenSelena/omniget?style=for-the-badge&color=FFD426" alt="Estrelas no GitHub" /></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-GPL--3.0-2AA845?style=for-the-badge" alt="Licença GPL-3.0" /></a>
<a href="https://discord.gg/jgdxyPy7Vn"><img src="https://img.shields.io/badge/Discord-comunidade-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Comunidade no Discord" /></a>
<a href="https://hosted.weblate.org/engage/omniget/"><img src="https://hosted.weblate.org/widget/omniget/frontend-json/svg-badge.svg" alt="Status da tradução" /></a>
@@ -102,7 +102,7 @@ O yt-dlp é o motor sobre o qual o OmniGet roda, e o OmniGet não existiria sem
## Baixar e instalar
-Escolha o seu sistema. Todas as versões estão na [página de Releases](https://github.com/tonhowtf/omniget/releases/latest). As atualizações chegam dentro do app.
+Escolha o seu sistema. Todas as versões estão na [página de Releases](https://github.com/OpenSelena/omniget/releases/latest). As atualizações chegam dentro do app.
<table>
<tr>
@@ -113,12 +113,12 @@ Escolha o seu sistema. Todas as versões estão na [página de Releases](https:/
<tr>
<td><b>Windows 10 / 11</b></td>
<td><code>omniget_x.y.z_x64-setup.exe</code> (instalador)<br/><code>omniget_x.y.z_x64-portable.exe</code> (sem instalar, roda de qualquer pasta)<br/><code>omniget_x.y.z_x64_en-US.msi</code> (para TI)</td>
- <td><code>winget install -e --id tonhowtf.OmniGet</code></td>
+ <td><code>winget install -e --id OpenSelena.OmniGet</code></td>
</tr>
<tr>
<td><b>macOS 10.15+</b></td>
<td><code>omniget_x.y.z_aarch64.dmg</code> para Apple Silicon (M1 em diante)<br/><code>omniget_x.y.z_x64.dmg</code> para Macs Intel</td>
- <td><code>brew install --cask tonhowtf/tap/omniget</code></td>
+ <td><code>brew install --cask OpenSelena/tap/omniget</code></td>
</tr>
<tr>
<td><b>Linux</b></td>
@@ -214,7 +214,7 @@ Daí em diante, entre em qualquer página suportada e clique no ícone. A págin
### Nível 2: pelo zip da release
-Toda release traz o `omniget-chrome-extension-vX.Y.Z.zip`. Baixe da [última release](https://github.com/tonhowtf/omniget/releases/latest), descompacte e siga os passos 3 a 7 acima apontando **Carregar sem compactação** para a pasta descompactada. Use isso se o app fica numa máquina e o navegador em outra, ou se está instalando para outra pessoa.
+Toda release traz o `omniget-chrome-extension-vX.Y.Z.zip`. Baixe da [última release](https://github.com/OpenSelena/omniget/releases/latest), descompacte e siga os passos 3 a 7 acima apontando **Carregar sem compactação** para a pasta descompactada. Use isso se o app fica numa máquina e o navegador em outra, ou se está instalando para outra pessoa.
### Nível 3: Firefox, outros navegadores e pareamento manual
@@ -531,7 +531,7 @@ Debian e Ubuntu: `.deb`. Fedora, openSUSE, família RHEL: `.rpm`. Qualquer outro
## Linha de comando
-O `omniget-cli` sai com toda release para Windows, macOS (Intel e Apple Silicon) e Linux. Pegue o `omniget-cli-<versão>-<alvo>` na [última release](https://github.com/tonhowtf/omniget/releases/latest).
+O `omniget-cli` sai com toda release para Windows, macOS (Intel e Apple Silicon) e Linux. Pegue o `omniget-cli-<versão>-<alvo>` na [última release](https://github.com/OpenSelena/omniget/releases/latest).
```bash
omniget info <url> # título, formatos e tamanho, sem baixar nada
@@ -548,7 +548,7 @@ omniget import-cookies cookies.txt # formato Netscape
Se você só quer usar o OmniGet, [pegue uma release](#baixar-e-instalar). Para compilar você precisa de [Rust](https://rustup.rs/) (a toolchain exata está fixada em `rust-toolchain.toml` porque a ABI dos plugins depende dela), [Node.js](https://nodejs.org/) 18+ e [pnpm](https://pnpm.io/).
```bash
-git clone https://github.com/tonhowtf/omniget.git
+git clone https://github.com/OpenSelena/omniget.git
cd omniget
pnpm install
pnpm tauri dev
@@ -580,7 +580,7 @@ Stack: Tauri 2, Rust, SvelteKit com Svelte 5, SQLite, yt-dlp, FFmpeg, librqbit p
## Contribuir e traduzir
-Relatos de bug e pull requests vão para [Issues](https://github.com/tonhowtf/omniget/issues) e [Pull requests](https://github.com/tonhowtf/omniget/pulls). Perguntas e ajuda rápida ficam no [Discord](https://discord.gg/jgdxyPy7Vn).
+Relatos de bug e pull requests vão para [Issues](https://github.com/OpenSelena/omniget/issues) e [Pull requests](https://github.com/OpenSelena/omniget/pulls). Perguntas e ajuda rápida ficam no [Discord](https://discord.gg/jgdxyPy7Vn).
As traduções são feitas no [Weblate](https://hosted.weblate.org/engage/omniget/). Escolha o seu idioma e traduza pelo navegador. Novas strings aparecem lá algumas horas depois de entrarem na `main`.
@@ -589,9 +589,9 @@ O OmniGet é construído sobre [yt-dlp](https://github.com/yt-dlp/yt-dlp), [FFmp
O Loop, a criatura da tela inicial, é o mascote do OmniGet. Fan art é bem-vinda. A arte original não pode ser usada comercialmente nem redistribuída modificada.
<p align="center">
- <a href="https://star-history.com/#tonhowtf/omniget&Date"><img src="https://api.star-history.com/svg?repos=tonhowtf/omniget&type=Date" alt="Histórico de estrelas de tonhowtf/omniget" width="600" /></a>
+ <a href="https://star-history.com/#OpenSelena/omniget&Date"><img src="https://api.star-history.com/svg?repos=OpenSelena/omniget&type=Date" alt="Histórico de estrelas de OpenSelena/omniget" width="600" /></a>
</p>
<p align="center">
- <a href="https://github.com/tonhowtf/omniget/releases/latest"><b>Baixar o OmniGet</b></a> · <a href="LICENSE">GPL-3.0</a>
+ <a href="https://github.com/OpenSelena/omniget/releases/latest"><b>Baixar o OmniGet</b></a> · <a href="LICENSE">GPL-3.0</a>
</p>
diff --git a/README_zh_CN.md b/README_zh_CN.md
index 380cc3c0..439c4b1f 100644
--- a/README_zh_CN.md
+++ b/README_zh_CN.md
@@ -22,7 +22,7 @@ spicetify, 下载管理器, tauri, rust, svelte.
</p>
<p align="center">
- <sub>简体中文版由维护者创建,文字由 <a href="https://github.com/Tan665565">@Tan665565</a> 润色(<a href="https://github.com/tonhowtf/omniget/pull/154">PR #154</a>)。感谢。</sub>
+ <sub>简体中文版由维护者创建,文字由 <a href="https://github.com/Tan665565">@Tan665565</a> 润色(<a href="https://github.com/OpenSelena/omniget/pull/154">PR #154</a>)。感谢。</sub>
</p>
<p align="center">
@@ -30,9 +30,9 @@ spicetify, 下载管理器, tauri, rust, svelte.
</p>
<p align="center">
- <a href="https://github.com/tonhowtf/omniget/releases/latest"><img src="https://img.shields.io/github/v/release/tonhowtf/omniget?style=for-the-badge&label=release&color=F28500" alt="最新版本" /></a>
- <a href="https://github.com/tonhowtf/omniget/releases"><img src="https://img.shields.io/github/downloads/tonhowtf/omniget/total?style=for-the-badge&label=downloads&color=1E6FE8" alt="总下载量" /></a>
- <a href="https://github.com/tonhowtf/omniget/stargazers"><img src="https://img.shields.io/github/stars/tonhowtf/omniget?style=for-the-badge&color=FFD426" alt="GitHub Star 数" /></a>
+ <a href="https://github.com/OpenSelena/omniget/releases/latest"><img src="https://img.shields.io/github/v/release/OpenSelena/omniget?style=for-the-badge&label=release&color=F28500" alt="最新版本" /></a>
+ <a href="https://github.com/OpenSelena/omniget/releases"><img src="https://img.shields.io/github/downloads/OpenSelena/omniget/total?style=for-the-badge&label=downloads&color=1E6FE8" alt="总下载量" /></a>
+ <a href="https://github.com/OpenSelena/omniget/stargazers"><img src="https://img.shields.io/github/stars/OpenSelena/omniget?style=for-the-badge&color=FFD426" alt="GitHub Star 数" /></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-GPL--3.0-2AA845?style=for-the-badge" alt="GPL-3.0 许可证" /></a>
<a href="https://discord.gg/jgdxyPy7Vn"><img src="https://img.shields.io/badge/Discord-社区-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Discord 社区" /></a>
<a href="https://hosted.weblate.org/engage/omniget/"><img src="https://hosted.weblate.org/widget/omniget/frontend-json/svg-badge.svg" alt="翻译状态" /></a>
@@ -102,7 +102,7 @@ yt-dlp 是 OmniGet 运行的引擎,没有它就没有 OmniGet。如果你常
## 下载与安装
-选择你的系统。所有构建都发布在 [Releases 页面](https://github.com/tonhowtf/omniget/releases/latest)。更新在应用内推送。
+选择你的系统。所有构建都发布在 [Releases 页面](https://github.com/OpenSelena/omniget/releases/latest)。更新在应用内推送。
<table>
<tr>
@@ -113,12 +113,12 @@ yt-dlp 是 OmniGet 运行的引擎,没有它就没有 OmniGet。如果你常
<tr>
<td><b>Windows 10 / 11</b></td>
<td><code>omniget_x.y.z_x64-setup.exe</code>(安装版)<br/><code>omniget_x.y.z_x64-portable.exe</code>(免安装,放哪儿都能跑)<br/><code>omniget_x.y.z_x64_en-US.msi</code>(企业部署用)</td>
- <td><code>winget install -e --id tonhowtf.OmniGet</code></td>
+ <td><code>winget install -e --id OpenSelena.OmniGet</code></td>
</tr>
<tr>
<td><b>macOS 10.15+</b></td>
<td><code>omniget_x.y.z_aarch64.dmg</code>,Apple Silicon(M1 及之后)<br/><code>omniget_x.y.z_x64.dmg</code>,Intel Mac</td>
- <td><code>brew install --cask tonhowtf/tap/omniget</code></td>
+ <td><code>brew install --cask OpenSelena/tap/omniget</code></td>
</tr>
<tr>
<td><b>Linux</b></td>
@@ -214,7 +214,7 @@ OmniGet 为最常用的平台写了原生提取器,其余的交给 [yt-dlp](ht
### 级别二:从发布包的 zip 安装
-每个版本都附带 `omniget-chrome-extension-vX.Y.Z.zip`。从[最新版本](https://github.com/tonhowtf/omniget/releases/latest)下载、解压,然后按上面第 3 到第 7 步操作,把**加载已解压的扩展程序**指向解压出的文件夹。适合应用装在一台电脑、浏览器在另一台的情况,或者你在帮别人安装。
+每个版本都附带 `omniget-chrome-extension-vX.Y.Z.zip`。从[最新版本](https://github.com/OpenSelena/omniget/releases/latest)下载、解压,然后按上面第 3 到第 7 步操作,把**加载已解压的扩展程序**指向解压出的文件夹。适合应用装在一台电脑、浏览器在另一台的情况,或者你在帮别人安装。
### 级别三:Firefox、其他浏览器和手动配对
@@ -531,7 +531,7 @@ Debian 和 Ubuntu:`.deb`。Fedora、openSUSE、RHEL 系:`.rpm`。其他:`.
## 命令行
-`omniget-cli` 随每个版本发布,支持 Windows、macOS(Intel 和 Apple Silicon)和 Linux。从[最新版本](https://github.com/tonhowtf/omniget/releases/latest)下载 `omniget-cli-<版本>-<平台>`。
+`omniget-cli` 随每个版本发布,支持 Windows、macOS(Intel 和 Apple Silicon)和 Linux。从[最新版本](https://github.com/OpenSelena/omniget/releases/latest)下载 `omniget-cli-<版本>-<平台>`。
```bash
omniget info <url> # 标题、格式和大小,不下载任何东西
@@ -548,7 +548,7 @@ omniget import-cookies cookies.txt # Netscape 格式
如果你只是想用 OmniGet,请[直接下载发布版](#下载与安装)。构建需要 [Rust](https://rustup.rs/)(精确的工具链版本固定在 `rust-toolchain.toml` 里,因为插件 ABI 依赖它)、[Node.js](https://nodejs.org/) 18+ 和 [pnpm](https://pnpm.io/)。
```bash
-git clone https://github.com/tonhowtf/omniget.git
+git clone https://github.com/OpenSelena/omniget.git
cd omniget
pnpm install
pnpm tauri dev
@@ -580,7 +580,7 @@ pnpm tauri build --config '{"bundle":{"createUpdaterArtifacts":false}}'
## 参与贡献与翻译
-Bug 报告和 Pull Request 请提到 [Issues](https://github.com/tonhowtf/omniget/issues) 和 [Pull requests](https://github.com/tonhowtf/omniget/pulls)。提问和快速求助在 [Discord](https://discord.gg/jgdxyPy7Vn)。
+Bug 报告和 Pull Request 请提到 [Issues](https://github.com/OpenSelena/omniget/issues) 和 [Pull requests](https://github.com/OpenSelena/omniget/pulls)。提问和快速求助在 [Discord](https://discord.gg/jgdxyPy7Vn)。
翻译在 [Weblate](https://hosted.weblate.org/engage/omniget/) 上进行。选择你的语言,直接在浏览器里翻译。新字符串合入 `main` 几小时后就会出现在那里。
@@ -589,9 +589,9 @@ OmniGet 建立在 [yt-dlp](https://github.com/yt-dlp/yt-dlp)、[FFmpeg](https://
主界面上的小生物 Loop 是 OmniGet 的吉祥物。欢迎同人创作。原始美术不得用于商业用途,也不得修改后再分发。
<p align="center">
- <a href="https://star-history.com/#tonhowtf/omniget&Date"><img src="https://api.star-history.com/svg?repos=tonhowtf/omniget&type=Date" alt="tonhowtf/omniget 的 Star 历史" width="600" /></a>
+ <a href="https://star-history.com/#OpenSelena/omniget&Date"><img src="https://api.star-history.com/svg?repos=OpenSelena/omniget&type=Date" alt="OpenSelena/omniget 的 Star 历史" width="600" /></a>
</p>
<p align="center">
- <a href="https://github.com/tonhowtf/omniget/releases/latest"><b>下载 OmniGet</b></a> · <a href="LICENSE">GPL-3.0</a>
+ <a href="https://github.com/OpenSelena/omniget/releases/latest"><b>下载 OmniGet</b></a> · <a href="LICENSE">GPL-3.0</a>
</p>
diff --git a/assets/readme/en/home-hero.png b/assets/readme/en/home-hero.png
new file mode 100644
index 00000000..9723fac0
Binary files /dev/null and b/assets/readme/en/home-hero.png differ
diff --git a/assets/readme/en/plugins.png b/assets/readme/en/plugins.png
new file mode 100644
index 00000000..0255c4ba
Binary files /dev/null and b/assets/readme/en/plugins.png differ
diff --git a/assets/readme/en/settings-drill.png b/assets/readme/en/settings-drill.png
new file mode 100644
index 00000000..f5a3ee7e
Binary files /dev/null and b/assets/readme/en/settings-drill.png differ
diff --git a/assets/readme/en/settings-output.png b/assets/readme/en/settings-output.png
new file mode 100644
index 00000000..da44c0a5
Binary files /dev/null and b/assets/readme/en/settings-output.png differ
diff --git a/assets/readme/global-hotkey.png b/assets/readme/global-hotkey.png
new file mode 100644
index 00000000..cd65f14a
Binary files /dev/null and b/assets/readme/global-hotkey.png differ
diff --git a/assets/screenshot-courses.png b/assets/screenshot-courses.png
new file mode 100644
index 00000000..66db42ce
Binary files /dev/null and b/assets/screenshot-courses.png differ
diff --git a/assets/screenshot-flow.png b/assets/screenshot-flow.png
new file mode 100644
index 00000000..a7f1a0ef
Binary files /dev/null and b/assets/screenshot-flow.png differ
diff --git a/assets/screenshot-music.png b/assets/screenshot-music.png
new file mode 100644
index 00000000..53bb939e
Binary files /dev/null and b/assets/screenshot-music.png differ
diff --git a/assets/screenshot-omnibox.png b/assets/screenshot-omnibox.png
new file mode 100644
index 00000000..a2e49b6d
Binary files /dev/null and b/assets/screenshot-omnibox.png differ
diff --git a/assets/screenshot-reader.png b/assets/screenshot-reader.png
new file mode 100644
index 00000000..8f5003ae
Binary files /dev/null and b/assets/screenshot-reader.png differ
diff --git a/assets/screenshot.png b/assets/screenshot.png
new file mode 100644
index 00000000..492f8c23
Binary files /dev/null and b/assets/screenshot.png differ
diff --git a/browser-extension/chrome/pages/error.js b/browser-extension/chrome/pages/error.js
index 7d364c1a..cd17a31a 100644
--- a/browser-extension/chrome/pages/error.js
+++ b/browser-extension/chrome/pages/error.js
@@ -5,7 +5,7 @@ const params = new URLSearchParams(window.location.search);
const code = params.get("code") ?? "LAUNCH_FAILED";
const message = params.get("message") ?? "";
const url = params.get("url") ?? "";
-const installUrl = params.get("installUrl") ?? "https://github.com/tonhowtf/omniget/releases/latest";
+const installUrl = params.get("installUrl") ?? "https://github.com/OpenSelena/omniget/releases/latest";
const eyebrow = document.getElementById("eyebrow");
const title = document.getElementById("title");
diff --git a/browser-extension/chrome/pages/options.html b/browser-extension/chrome/pages/options.html
index be13b98b..510a2650 100644
--- a/browser-extension/chrome/pages/options.html
+++ b/browser-extension/chrome/pages/options.html
@@ -179,8 +179,8 @@
<summary>Don't have OmniGet installed yet?</summary>
<p>
Install the desktop app from
- <a href="https://github.com/tonhowtf/omniget/releases/latest" target="_blank" rel="noreferrer">
- github.com/tonhowtf/omniget
+ <a href="https://github.com/OpenSelena/omniget/releases/latest" target="_blank" rel="noreferrer">
+ github.com/OpenSelena/omniget
</a>, launch it once, then come back to this page.
</p>
</details>
diff --git a/browser-extension/chrome/popup/popup.js b/browser-extension/chrome/popup/popup.js
index d4a8abe1..9ded6e8a 100644
--- a/browser-extension/chrome/popup/popup.js
+++ b/browser-extension/chrome/popup/popup.js
@@ -9,7 +9,7 @@ import { formatBytes } from "../src/format-size.js";
import { isListableMedia } from "../src/media-list.js";
import { captureCookiesForTab } from "../src/cookie-capture.js";
-const APP_URL = "https://github.com/tonhowtf/omniget/releases/latest";
+const APP_URL = "https://github.com/OpenSelena/omniget/releases/latest";
const tr = (k, ...subs) =>
(chrome.i18n?.getMessage?.(k, subs.length ? subs.map(String) : undefined) || k);
diff --git a/browser-extension/chrome/src/background.js b/browser-extension/chrome/src/background.js
index 68072c44..2f807e27 100644
--- a/browser-extension/chrome/src/background.js
+++ b/browser-extension/chrome/src/background.js
@@ -85,7 +85,7 @@ if (chrome.storage?.onChanged) {
});
}
-const INSTALL_URL = "https://github.com/tonhowtf/omniget/releases/latest";
+const INSTALL_URL = "https://github.com/OpenSelena/omniget/releases/latest";
const PROTOCOL_VERSION = 1;
function getIconPath(iconSet) {
diff --git a/browser-extension/chrome/tests/detect.test.mjs b/browser-extension/chrome/tests/detect.test.mjs
index 73304af5..a37d4d72 100644
--- a/browser-extension/chrome/tests/detect.test.mjs
+++ b/browser-extension/chrome/tests/detect.test.mjs
@@ -44,7 +44,7 @@ test("returns null for malformed URLs", () => {
test("returns null for unsupported sites", () => {
assertNull("https://www.google.com/search?q=omniget");
- assertNull("https://github.com/tonhowtf/omniget");
+ assertNull("https://github.com/OpenSelena/omniget");
assertNull("https://example.com/video/123");
});
diff --git a/browser-extension/firefox/manifest.json b/browser-extension/firefox/manifest.json
index 4c3ea917..d161df26 100644
--- a/browser-extension/firefox/manifest.json
+++ b/browser-extension/firefox/manifest.json
@@ -6,7 +6,7 @@
"default_locale": "en",
"browser_specific_settings": {
"gecko": {
"strict_min_version": "109.0"
}
},
diff --git a/browser-extension/firefox/pages/error.js b/browser-extension/firefox/pages/error.js
index 7d364c1a..cd17a31a 100644
--- a/browser-extension/firefox/pages/error.js
+++ b/browser-extension/firefox/pages/error.js
@@ -5,7 +5,7 @@ const params = new URLSearchParams(window.location.search);
const code = params.get("code") ?? "LAUNCH_FAILED";
const message = params.get("message") ?? "";
const url = params.get("url") ?? "";
-const installUrl = params.get("installUrl") ?? "https://github.com/tonhowtf/omniget/releases/latest";
+const installUrl = params.get("installUrl") ?? "https://github.com/OpenSelena/omniget/releases/latest";
const eyebrow = document.getElementById("eyebrow");
const title = document.getElementById("title");
diff --git a/browser-extension/firefox/pages/options.html b/browser-extension/firefox/pages/options.html
index be13b98b..510a2650 100644
--- a/browser-extension/firefox/pages/options.html
+++ b/browser-extension/firefox/pages/options.html
@@ -179,8 +179,8 @@
<summary>Don't have OmniGet installed yet?</summary>
<p>
Install the desktop app from
- <a href="https://github.com/tonhowtf/omniget/releases/latest" target="_blank" rel="noreferrer">
- github.com/tonhowtf/omniget
+ <a href="https://github.com/OpenSelena/omniget/releases/latest" target="_blank" rel="noreferrer">
+ github.com/OpenSelena/omniget
</a>, launch it once, then come back to this page.
</p>
</details>
diff --git a/browser-extension/firefox/popup/popup.js b/browser-extension/firefox/popup/popup.js
index d4a8abe1..9ded6e8a 100644
--- a/browser-extension/firefox/popup/popup.js
+++ b/browser-extension/firefox/popup/popup.js
@@ -9,7 +9,7 @@ import { formatBytes } from "../src/format-size.js";
import { isListableMedia } from "../src/media-list.js";
import { captureCookiesForTab } from "../src/cookie-capture.js";
-const APP_URL = "https://github.com/tonhowtf/omniget/releases/latest";
+const APP_URL = "https://github.com/OpenSelena/omniget/releases/latest";
const tr = (k, ...subs) =>
(chrome.i18n?.getMessage?.(k, subs.length ? subs.map(String) : undefined) || k);
diff --git a/browser-extension/firefox/src/background.js b/browser-extension/firefox/src/background.js
index 68072c44..2f807e27 100644
--- a/browser-extension/firefox/src/background.js
+++ b/browser-extension/firefox/src/background.js
@@ -85,7 +85,7 @@ if (chrome.storage?.onChanged) {
});
}
-const INSTALL_URL = "https://github.com/tonhowtf/omniget/releases/latest";
+const INSTALL_URL = "https://github.com/OpenSelena/omniget/releases/latest";
const PROTOCOL_VERSION = 1;
function getIconPath(iconSet) {
diff --git a/claude-plugin/omniget/scripts/doctor.sh b/claude-plugin/omniget/scripts/doctor.sh
index 5e40b64c..4c4cfd3d 100755
--- a/claude-plugin/omniget/scripts/doctor.sh
+++ b/claude-plugin/omniget/scripts/doctor.sh
@@ -70,12 +70,12 @@ case "$(og_os)" in
echo " uv tool install mlx-whisper (faster on Apple Silicon)"
;;
linux)
- echo " OmniGet app: https://github.com/tonhowtf/omniget/releases/latest (.deb/.rpm/.AppImage)"
+ echo " OmniGet app: https://github.com/OpenSelena/omniget/releases/latest (.deb/.rpm/.AppImage)"
echo " yt-dlp + ffmpeg: sudo apt install ffmpeg && pip install -U yt-dlp (or your distro's packages)"
echo " local whisper: whisper-bin-ubuntu-x64.tar.gz from https://github.com/ggml-org/whisper.cpp/releases"
;;
windows)
- echo " OmniGet app: winget install -e --id tonhowtf.OmniGet"
+ echo " OmniGet app: winget install -e --id OpenSelena.OmniGet"
echo " yt-dlp + ffmpeg: winget install yt-dlp.yt-dlp Gyan.FFmpeg"
echo " local whisper: whisper-bin-x64.zip from https://github.com/ggml-org/whisper.cpp/releases"
;;
diff --git a/claude-plugin/omniget/scripts/resolve-tools.sh b/claude-plugin/omniget/scripts/resolve-tools.sh
index 31e0eb6b..fa9347d1 100755
--- a/claude-plugin/omniget/scripts/resolve-tools.sh
+++ b/claude-plugin/omniget/scripts/resolve-tools.sh
@@ -26,10 +26,29 @@ og_data_dir() {
echo "$OMNIGET_DATA_DIR"
return
fi
+ local p
case "$(og_os)" in
- mac) echo "$HOME/Library/Application Support/wtf.tonho.omniget" ;;
- linux) echo "${XDG_DATA_HOME:-$HOME/.local/share}/wtf.tonho.omniget" ;;
- windows) echo "${APPDATA:-$HOME/AppData/Roaming}/wtf.tonho.omniget" ;;
+ mac)
+ p="$HOME/Library/Application Support/com.openselena.omniget"
+ [ -d "$p" ] && echo "$p" && return
+ p="$HOME/Library/Application Support/wtf.tonho.omniget"
+ [ -d "$p" ] && echo "$p" && return
+ echo "$HOME/Library/Application Support/com.openselena.omniget"
+ ;;
+ linux)
+ p="${XDG_DATA_HOME:-$HOME/.local/share}/com.openselena.omniget"
+ [ -d "$p" ] && echo "$p" && return
+ p="${XDG_DATA_HOME:-$HOME/.local/share}/wtf.tonho.omniget"
+ [ -d "$p" ] && echo "$p" && return
+ echo "${XDG_DATA_HOME:-$HOME/.local/share}/com.openselena.omniget"
+ ;;
+ windows)
+ p="${APPDATA:-$HOME/AppData/Roaming}/com.openselena.omniget"
+ [ -d "$p" ] && echo "$p" && return
+ p="${APPDATA:-$HOME/AppData/Roaming}/wtf.tonho.omniget"
+ [ -d "$p" ] && echo "$p" && return
+ echo "${APPDATA:-$HOME/AppData/Roaming}/com.openselena.omniget"
+ ;;
*) echo "$HOME/.omniget" ;;
esac
}
diff --git a/claude-plugin/omniget/scripts/setup.sh b/claude-plugin/omniget/scripts/setup.sh
index 69966a2a..164531d5 100755
--- a/claude-plugin/omniget/scripts/setup.sh
+++ b/claude-plugin/omniget/scripts/setup.sh
@@ -125,7 +125,7 @@ else
fi
echo
-OMNIGET_REPO="${OMNIGET_REPO:-tonhowtf/omniget}"
+OMNIGET_REPO="${OMNIGET_REPO:-OpenSelena/omniget}"
# Prebuilt omniget-cli asset triple for this machine, or empty if unsupported.
cli_triple() {
diff --git a/flatpak/wtf.tonho.omniget.desktop b/flatpak/com.openselena.omniget.desktop
similarity index 92%
rename from flatpak/wtf.tonho.omniget.desktop
rename to flatpak/com.openselena.omniget.desktop
index cc88bdf7..50bc1ceb 100644
--- a/flatpak/wtf.tonho.omniget.desktop
+++ b/flatpak/com.openselena.omniget.desktop
@@ -3,7 +3,7 @@ Name=Omniget
Comment=Download media from multiple platforms
GenericName=Download Manager
Exec=omniget %u
-Icon=wtf.tonho.omniget
+Icon=com.openselena.omniget
Terminal=false
Type=Application
Categories=Network;FileTransfer;Utility;
diff --git a/flatpak/wtf.tonho.omniget.metainfo.xml b/flatpak/com.openselena.omniget.metainfo.xml
similarity index 98%
rename from flatpak/wtf.tonho.omniget.metainfo.xml
rename to flatpak/com.openselena.omniget.metainfo.xml
index 08dccdc1..d7252eca 100644
--- a/flatpak/wtf.tonho.omniget.metainfo.xml
+++ b/flatpak/com.openselena.omniget.metainfo.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
- <id>wtf.tonho.omniget</id>
+ <id>com.openselena.omniget</id>
<name>Omniget</name>
<summary>Download media from multiple platforms</summary>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license>
- <developer id="wtf.tonho">
- <name>Tonho</name>
+ <developer id="com.openselena">
+ <name>OpenSelena</name>
</developer>
<description>
<p>
@@ -23,17 +23,17 @@
<li>Queue management with concurrent downloads</li>
</ul>
</description>
- <url type="homepage">https://github.com/tonhowtf/omniget</url>
- <url type="bugtracker">https://github.com/tonhowtf/omniget/issues</url>
- <url type="vcs-browser">https://github.com/tonhowtf/omniget</url>
- <launchable type="desktop-id">wtf.tonho.omniget.desktop</launchable>
+ <url type="homepage">https://github.com/OpenSelena/omniget</url>
+ <url type="bugtracker">https://github.com/OpenSelena/omniget/issues</url>
+ <url type="vcs-browser">https://github.com/OpenSelena/omniget</url>
+ <launchable type="desktop-id">com.openselena.omniget.desktop</launchable>
<provides>
<binary>omniget</binary>
</provides>
<screenshots>
<screenshot type="default">
<caption>Main download interface</caption>
- <image>https://raw.githubusercontent.com/tonhowtf/omniget/main/flatpak/screenshots/main.png</image>
+ <image>https://raw.githubusercontent.com/OpenSelena/omniget/main/flatpak/screenshots/main.png</image>
</screenshot>
</screenshots>
<branding>
diff --git a/flatpak/wtf.tonho.omniget.png b/flatpak/com.openselena.omniget.png
similarity index 100%
rename from flatpak/wtf.tonho.omniget.png
rename to flatpak/com.openselena.omniget.png
diff --git a/flatpak/wtf.tonho.omniget.yml b/flatpak/com.openselena.omniget.yml
similarity index 92%
rename from flatpak/wtf.tonho.omniget.yml
rename to flatpak/com.openselena.omniget.yml
index 87454034..840fce75 100644
--- a/flatpak/wtf.tonho.omniget.yml
+++ b/flatpak/com.openselena.omniget.yml
@@ -1,4 +1,4 @@
-app-id: wtf.tonho.omniget
+app-id: com.openselena.omniget
runtime: org.gnome.Platform
runtime-version: '48'
sdk: org.gnome.Sdk
@@ -143,9 +143,9 @@ modules:
- npx vite build
- cargo --offline build --release --manifest-path src-tauri/Cargo.toml
- install -Dm755 src-tauri/target/release/omniget /app/bin/omniget
- - install -Dm644 flatpak/wtf.tonho.omniget.desktop /app/share/applications/wtf.tonho.omniget.desktop
- - install -Dm644 flatpak/wtf.tonho.omniget.metainfo.xml /app/share/metainfo/wtf.tonho.omniget.metainfo.xml
- - install -Dm644 flatpak/wtf.tonho.omniget.png /app/share/icons/hicolor/128x128/apps/wtf.tonho.omniget.png
+ - install -Dm644 flatpak/com.openselena.omniget.desktop /app/share/applications/com.openselena.omniget.desktop
+ - install -Dm644 flatpak/com.openselena.omniget.metainfo.xml /app/share/metainfo/com.openselena.omniget.metainfo.xml
+ - install -Dm644 flatpak/com.openselena.omniget.png /app/share/icons/hicolor/128x128/apps/com.openselena.omniget.png
sources:
- type: dir
path: ..
diff --git a/funding.json b/funding.json
index 8a51b8b4..03cbbdff 100644
--- a/funding.json
+++ b/funding.json
@@ -1,13 +1,13 @@
{
"version": "v1.1.0",
"entity": {
- "type": "individual",
+ "type": "organization",
"role": "owner",
- "name": "Antonio Leandro",
- "email": "[email protected]",
- "description": "Software engineer in Recife, Brazil. Author and sole maintainer of OmniGet.",
+ "name": "OpenSelena",
+ "email": "[email protected]",
+ "description": "OpenSelena IGECT - OmniGet Project.",
"webpageUrl": {
- "url": "https://tonho.wtf"
+ "url": "https://github.com/OpenSelena/omniget"
}
},
"projects": [
@@ -16,10 +16,10 @@
"name": "OmniGet",
"description": "A free desktop app for Windows, macOS and Linux that turns a link into a file. yt-dlp and gallery-dl run underneath, with a torrent client and 156 built-in tools for what comes after the download: transcribing, converting, reading and studying what you saved. No account, no ads, no telemetry on what anyone downloads. Files stay on the machine that fetched them.",
"webpageUrl": {
- "url": "https://github.com/tonhowtf/omniget"
+ "url": "https://github.com/OpenSelena/omniget"
},
"repositoryUrl": {
- "url": "https://github.com/tonhowtf/omniget"
+ "url": "https://github.com/OpenSelena/omniget"
},
"licenses": ["spdx:GPL-3.0-only"],
"tags": ["downloader", "desktop", "media", "rust", "tauri", "privacy"]
@@ -30,7 +30,7 @@
{
"guid": "github-sponsors",
"type": "payment-provider",
- "address": "https://github.com/sponsors/tonhowtf",
+ "address": "https://github.com/sponsors/OpenSelena",
"description": "GitHub Sponsors, recurring or one-off."
},
{
diff --git a/llms.txt b/llms.txt
index 5d12ac4f..bd2e4db0 100644
--- a/llms.txt
+++ b/llms.txt
@@ -11,7 +11,7 @@ Plugins: Courses, Study (course player with timestamped notes, PDF/EPUB/CBZ read
## Key facts
- Name: OmniGet
-- Repository: https://github.com/tonhowtf/omniget
+- Repository: https://github.com/OpenSelena/omniget
- License: GPL-3.0
- Platforms: Windows, macOS (Apple Silicon and Intel), Linux (x86_64 and ARM64)
- Cost: free, no account, no ads, no paid tier, no telemetry on what is downloaded
@@ -23,8 +23,8 @@ Plugins: Courses, Study (course player with timestamped notes, PDF/EPUB/CBZ read
## Install
-- Windows: `.exe` installer, portable `.exe` or `.msi` from Releases, or `winget install -e --id tonhowtf.OmniGet`
-- macOS: `.dmg` from Releases or `brew install --cask tonhowtf/tap/omniget`. Unsigned, so first launch needs `xattr -cr /Applications/omniget.app`
+- Windows: `.exe` installer, portable `.exe` or `.msi` from Releases, or `winget install -e --id OpenSelena.OmniGet`
+- macOS: `.dmg` from Releases or `brew install --cask OpenSelena/tap/omniget`. Unsigned, so first launch needs `xattr -cr /Applications/omniget.app`
- Linux: `.deb` for Debian and Ubuntu, `.rpm` for Fedora and openSUSE, `.AppImage` elsewhere. On Debian 12+ and Ubuntu 24.04+ the AppImage needs `sudo apt install libfuse2`
- Browser extension: exported from Settings → Plugins → Browser extension, or `omniget-chrome-extension-vX.Y.Z.zip` from Releases; loaded unpacked and paired with one click
- OmniGet is not published on Flathub.
diff --git a/scripts/bump-version.js b/scripts/bump-version.js
index 684660c2..8819a68c 100644
--- a/scripts/bump-version.js
+++ b/scripts/bump-version.js
@@ -172,7 +172,7 @@ function hasBinary(name) {
}
}
-const metainfoAbs = path.join(root, "flatpak", "wtf.tonho.omniget.metainfo.xml");
+const metainfoAbs = path.join(root, "flatpak", "com.openselena.omniget.metainfo.xml");
if (hasBinary("appstreamcli")) {
try {
execSync(`appstreamcli validate "${metainfoAbs}"`, { stdio: "inherit" });
diff --git a/scripts/deploy-plugins-local.mjs b/scripts/deploy-plugins-local.mjs
index 4e3841f4..22218dad 100644
--- a/scripts/deploy-plugins-local.mjs
+++ b/scripts/deploy-plugins-local.mjs
@@ -23,19 +23,19 @@ function appDataPluginsDir() {
const platform = process.platform;
if (platform === "win32") {
const base = process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming");
- return path.join(base, "wtf.tonho.omniget", "plugins");
+ return path.join(base, "com.openselena.omniget", "plugins");
}
if (platform === "darwin") {
return path.join(
os.homedir(),
"Library",
"Application Support",
- "wtf.tonho.omniget",
+ "com.openselena.omniget",
"plugins",
);
}
const xdg = process.env.XDG_DATA_HOME || path.join(os.homedir(), ".local", "share");
- return path.join(xdg, "wtf.tonho.omniget", "plugins");
+ return path.join(xdg, "com.openselena.omniget", "plugins");
}
function dllFilename(crate) {
diff --git a/scripts/smoke-test.mjs b/scripts/smoke-test.mjs
index 66f6d49d..506ad022 100644
--- a/scripts/smoke-test.mjs
+++ b/scripts/smoke-test.mjs
@@ -120,6 +120,10 @@ if (code !== 0) {
if (portable) {
const vazouParaOPerfil = [
+ join(fakeProfile, "Local", "com.openselena.omniget"),
+ join(fakeProfile, "Roaming", "com.openselena.omniget"),
+ join(fakeProfile, "share", "com.openselena.omniget"),
+ join(fakeProfile, "Library", "Application Support", "com.openselena.omniget"),
join(fakeProfile, "Local", "wtf.tonho.omniget"),
join(fakeProfile, "Roaming", "wtf.tonho.omniget"),
join(fakeProfile, "share", "wtf.tonho.omniget"),
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 10e3e3e8..c7a4f697 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -5,8 +5,8 @@ resolver = "2"
[package]
name = "omniget"
version = "0.9.2"
-description = "A Tauri App"
-authors = ["you"]
+description = "OmniGet — Universal Downloader & Media Player"
+authors = ["OpenSelena", "igect"]
edition = "2021"
[lib]
diff --git a/src-tauri/desktop.template b/src-tauri/desktop.template
index 923a1f47..c7ee666f 100644
--- a/src-tauri/desktop.template
+++ b/src-tauri/desktop.template
@@ -2,7 +2,7 @@
# Categories, GenericName and Keywords are hardcoded rather than derived from
# `bundle.category`: settings.app_category() maps through a fixed AppCategory
# table that cannot express a multi-value list like Network;FileTransfer;.
-# Keep these three lines in sync with flatpak/wtf.tonho.omniget.desktop.
+# Keep these three lines in sync with flatpak/com.openselena.omniget.desktop.
Categories=Network;FileTransfer;Utility;
GenericName=Download Manager
Keywords=omniget;download;downloader;video;media;udemy;hotmart;youtube;telegram;
diff --git a/src-tauri/omnidisc-media/src/capture/linux/portal.rs b/src-tauri/omnidisc-media/src/capture/linux/portal.rs
index d60953b8..ce48f091 100644
--- a/src-tauri/omnidisc-media/src/capture/linux/portal.rs
+++ b/src-tauri/omnidisc-media/src/capture/linux/portal.rs
@@ -31,21 +31,22 @@ pub struct ScreencastSession {
}
fn token_path() -> Option<PathBuf> {
- let base = std::env::var_os("OMNIGET_DATA_DIR")
+ if let Some(dir) = std::env::var_os("OMNIGET_DATA_DIR") {
+ return Some(PathBuf::from(dir).join("omnidisc-screencast.json"));
+ }
+ let data_root = std::env::var_os("XDG_DATA_HOME")
.map(PathBuf::from)
- .or_else(|| {
- std::env::var_os("XDG_DATA_HOME")
- .map(PathBuf::from)
- .map(|p| p.join("wtf.tonho.omniget"))
- })
- .or_else(|| {
- std::env::var_os("HOME").map(|h| {
- PathBuf::from(h)
- .join(".local/share")
- .join("wtf.tonho.omniget")
- })
- })?;
- Some(base.join("omnidisc-screencast.json"))
+ .or_else(|| std::env::var_os("HOME").map(|h| PathBuf::from(h).join(".local/share")))?;
+
+ let modern = data_root.join("com.openselena.omniget").join("omnidisc-screencast.json");
+ if modern.exists() {
+ return Some(modern);
+ }
+ let legacy = data_root.join("wtf.tonho.omniget").join("omnidisc-screencast.json");
+ if legacy.exists() {
+ return Some(legacy);
+ }
+ Some(modern)
}
fn load_token() -> Option<String> {
diff --git a/src-tauri/omniget-core/src/core/paths.rs b/src-tauri/omniget-core/src/core/paths.rs
index c36d9075..40cdf2ed 100644
--- a/src-tauri/omniget-core/src/core/paths.rs
+++ b/src-tauri/omniget-core/src/core/paths.rs
@@ -4,26 +4,28 @@ pub fn app_data_dir() -> Option<std::path::PathBuf> {
}
let base = dirs::data_dir()?;
- let new_path = base.join("wtf.tonho.omniget");
- let old_path = base.join("omniget");
+ let new_path = base.join("com.openselena.omniget");
+ let legacy_paths = [base.join("wtf.tonho.omniget"), base.join("omniget")];
- if old_path.exists() {
- let _ = std::fs::create_dir_all(&new_path);
+ for old_path in &legacy_paths {
+ if old_path.exists() {
+ let _ = std::fs::create_dir_all(&new_path);
- for dir_name in &["bin", "plugins"] {
- let src = old_path.join(dir_name);
- let dst = new_path.join(dir_name);
- if src.exists() && !dst.exists() {
- let _ = copy_dir_recursive(&src, &dst);
+ for dir_name in &["bin", "plugins"] {
+ let src = old_path.join(dir_name);
+ let dst = new_path.join(dir_name);
+ if src.exists() && !dst.exists() {
+ let _ = copy_dir_recursive(&src, &dst);
+ }
}
- }
- if let Ok(entries) = std::fs::read_dir(&old_path) {
- for entry in entries.flatten() {
- if entry.file_type().map(|t| t.is_file()).unwrap_or(false) {
- let dest = new_path.join(entry.file_name());
- if !dest.exists() {
- let _ = std::fs::copy(entry.path(), &dest);
+ if let Ok(entries) = std::fs::read_dir(old_path) {
+ for entry in entries.flatten() {
+ if entry.file_type().map(|t| t.is_file()).unwrap_or(false) {
+ let dest = new_path.join(entry.file_name());
+ if !dest.exists() {
+ let _ = std::fs::copy(entry.path(), &dest);
+ }
}
}
}
diff --git a/src-tauri/omniget-core/src/core/tools/linkedin/checklist.rs b/src-tauri/omniget-core/src/core/tools/linkedin/checklist.rs
index 93e357f2..99a3ecf0 100644
--- a/src-tauri/omniget-core/src/core/tools/linkedin/checklist.rs
+++ b/src-tauri/omniget-core/src/core/tools/linkedin/checklist.rs
@@ -359,7 +359,7 @@ mod tests {
fn pontua_o_perfil_sintetico() {
let dir = fixture::dir();
let r = run_dir(&dir);
- assert_eq!(r.name, "Tonho Dev");
+ assert_eq!(r.name, "OpenSelena Dev");
assert_eq!(r.items.len(), 14);
// Sem imagens no export: foto fica fora da conta.
assert!(r.unknown.contains(&"photo".to_string()));
@@ -397,12 +397,12 @@ mod tests {
let r = run_dir(&dir);
let u = r.items.iter().find(|i| i.id == "custom_url").expect("url");
assert_eq!(u.state, "ok");
- assert_eq!(u.value, "tonhodev");
+ assert_eq!(u.value, "openselena");
}
#[test]
fn url_com_sufixo_aleatorio_nao_conta_como_custom() {
- assert!(looks_custom("tonho-dev"));
+ assert!(looks_custom("openselena-dev"));
assert!(looks_custom("anasilva"));
assert!(!looks_custom("ana-silva-1a2b3c4"));
assert!(!looks_custom("anasilva123456"));
diff --git a/src-tauri/omniget-core/src/core/tools/linkedin/messages.rs b/src-tauri/omniget-core/src/core/tools/linkedin/messages.rs
index b415523a..07cbe023 100644
--- a/src-tauri/omniget-core/src/core/tools/linkedin/messages.rs
+++ b/src-tauri/omniget-core/src/core/tools/linkedin/messages.rs
@@ -425,7 +425,7 @@ mod tests {
let r = run(&opts(&dir), &noop_progress()).expect("roda");
assert_eq!(r.conversations_total, 2);
assert_eq!(r.total, 5);
- assert_eq!(r.me, "Tonho Dev");
+ assert_eq!(r.me, "OpenSelena Dev");
assert!(r.me_guessed);
assert_eq!(r.sent, 2);
assert_eq!(r.received, 3);
diff --git a/src-tauri/omniget-core/src/core/tools/linkedin/overview.rs b/src-tauri/omniget-core/src/core/tools/linkedin/overview.rs
index 6f90f2da..b8f89885 100644
--- a/src-tauri/omniget-core/src/core/tools/linkedin/overview.rs
+++ b/src-tauri/omniget-core/src/core/tools/linkedin/overview.rs
@@ -514,7 +514,7 @@ mod tests {
assert_eq!(o.connections.by_year.len(), 2);
assert_eq!(o.messages.total, 5);
assert_eq!(o.messages.conversations, 2);
- assert_eq!(o.messages.me, "Tonho Dev");
+ assert_eq!(o.messages.me, "OpenSelena Dev");
assert_eq!(o.posts.total, 2);
assert_eq!(o.posts.with_media, 1);
assert_eq!(o.reactions.total, 3);
diff --git a/src-tauri/omniget-core/src/core/tools/linkedin/source.rs b/src-tauri/omniget-core/src/core/tools/linkedin/source.rs
index 9ff3ba64..8daabf40 100644
--- a/src-tauri/omniget-core/src/core/tools/linkedin/source.rs
+++ b/src-tauri/omniget-core/src/core/tools/linkedin/source.rs
@@ -177,11 +177,11 @@ pub(crate) mod fixture {
"messages.csv",
concat!(
"CONVERSATION ID,CONVERSATION TITLE,FROM,SENDER PROFILE URL,TO,DATE,SUBJECT,CONTENT\n",
- "c1,,Ana Silva,https://www.linkedin.com/in/anasilva,Tonho Dev,2021-08-07 10:00:00 UTC,Oi,\"Bom dia!\nTudo certo?\"\n",
- "c1,,Tonho Dev,https://www.linkedin.com/in/tonhodev,Ana Silva,2021-08-07 10:05:00 UTC,,\"Tudo, e ai?\"\n",
- "c1,,Ana Silva,https://www.linkedin.com/in/anasilva,Tonho Dev,2021-08-07 10:06:00 UTC,,\n",
- "c2,,Tonho Dev,https://www.linkedin.com/in/tonhodev,Carla Dias,2022-03-04 09:00:00 UTC,Vaga,\"Oi, Carla\"\n",
- "c2,,Carla Dias,https://www.linkedin.com/in/carladias,Tonho Dev,2022-03-04 09:30:00 UTC,,Fechado\n"
+ "c1,,Ana Silva,https://www.linkedin.com/in/anasilva,OpenSelena Dev,2021-08-07 10:00:00 UTC,Oi,\"Bom dia!\nTudo certo?\"\n",
+ "c1,,OpenSelena Dev,https://www.linkedin.com/in/openselena,Ana Silva,2021-08-07 10:05:00 UTC,,\"Tudo, e ai?\"\n",
+ "c1,,Ana Silva,https://www.linkedin.com/in/anasilva,OpenSelena Dev,2021-08-07 10:06:00 UTC,,\n",
+ "c2,,OpenSelena Dev,https://www.linkedin.com/in/openselena,Carla Dias,2022-03-04 09:00:00 UTC,Vaga,\"Oi, Carla\"\n",
+ "c2,,Carla Dias,https://www.linkedin.com/in/carladias,OpenSelena Dev,2022-03-04 09:30:00 UTC,,Fechado\n"
)
.to_string(),
),
@@ -200,13 +200,13 @@ pub(crate) mod fixture {
),
(
"Invitations.csv",
- "From,To,Sent At,Message,Direction\nTonho Dev,Ana Silva,2021-08-01 10:00:00,,OUTGOING\nCarla Dias,Tonho Dev,2022-03-01 10:00:00,,INCOMING\n".to_string(),
+ "From,To,Sent At,Message,Direction\nOpenSelena Dev,Ana Silva,2021-08-01 10:00:00,,OUTGOING\nCarla Dias,OpenSelena Dev,2022-03-01 10:00:00,,INCOMING\n".to_string(),
),
(
"Profile.csv",
concat!(
"First Name,Last Name,Headline,Summary,Industry,Geo Location,Websites\n",
- "Tonho,Dev,\"Dev de Rust e Svelte que gosta de ferramenta local\",\"Trabalho com aplicativos de desktop ha dez anos.\",Software Development,\"Sao Paulo, Brasil\",[MY_WEBSITE:https://omniget.wtf]\n"
+ "OpenSelena,Dev,\"Dev de Rust e Svelte que gosta de ferramenta local\",\"Trabalho com aplicativos de desktop ha dez anos.\",Software Development,\"Sao Paulo, Brasil\",[MY_WEBSITE:https://omniget.wtf]\n"
)
.to_string(),
),
diff --git a/src-tauri/omniget-core/src/core/tools/sticker.rs b/src-tauri/omniget-core/src/core/tools/sticker.rs
index cd724f77..d62b4274 100644
--- a/src-tauri/omniget-core/src/core/tools/sticker.rs
+++ b/src-tauri/omniget-core/src/core/tools/sticker.rs
@@ -852,14 +852,14 @@ mod tests {
fn the_pack_manifest_has_what_the_apps_read() {
let v = pack_json(
"Meu Pack",
- "Tonho",
+ "OpenSelena",
true,
&["a.webp".into(), "b.webp".into()],
&["😀".into()],
);
let pack = &v["sticker_packs"][0];
assert_eq!(pack["name"], "Meu Pack");
- assert_eq!(pack["publisher"], "Tonho");
+ assert_eq!(pack["publisher"], "OpenSelena");
assert_eq!(pack["identifier"], "meu-pack");
assert_eq!(pack["tray_image_file"], "tray.png");
assert_eq!(pack["animated_sticker_pack"], true);
diff --git a/src-tauri/omniget-core/src/core/tools/subtitle.rs b/src-tauri/omniget-core/src/core/tools/subtitle.rs
index b91cf4f8..7776ffcf 100644
--- a/src-tauri/omniget-core/src/core/tools/subtitle.rs
+++ b/src-tauri/omniget-core/src/core/tools/subtitle.rs
@@ -646,8 +646,8 @@ mod tests {
#[test]
fn windows_paths_are_escaped_for_the_filter() {
- let e = escape_filter_path(r"C:\Users\tonho\aula.srt");
- assert_eq!(e, "C\\:/Users/tonho/aula.srt");
+ let e = escape_filter_path(r"C:\Users\openselena\aula.srt");
+ assert_eq!(e, "C\\:/Users/openselena/aula.srt");
assert!(!e.contains('\\') || e.contains("\\:"));
}
diff --git a/src-tauri/omniget-core/src/core/tools/sysclean.rs b/src-tauri/omniget-core/src/core/tools/sysclean.rs
index 04a01c28..cd918455 100644
--- a/src-tauri/omniget-core/src/core/tools/sysclean.rs
+++ b/src-tauri/omniget-core/src/core/tools/sysclean.rs
@@ -68,7 +68,7 @@ const DEFS: &[Def] = &[
d("adobe", "apps", "Adobe (Media Cache)", "review", &["~/Library/Application Support/Adobe/Common/Media Cache Files", "~/Library/Application Support/Adobe/Common/Media Cache", "~/Library/Application Support/Adobe/Common/Peak Files"]),
d("telegram", "apps", "Telegram", "review", &["~/Library/Group Containers/6N38VWS5BX.ru.keepcoder.Telegram/appstore/account-*/postbox/media", "~/Library/Application Support/Telegram Desktop/tdata/user_data/cache"]),
d("whatsapp", "apps", "WhatsApp", "safe", &["~/Library/Group Containers/group.net.whatsapp.WhatsApp.shared/Message/Media/tmp", "~/Library/Containers/net.whatsapp.WhatsApp/Data/Library/Caches"]),
- d("omniget-tmp", "apps", "OmniGet (temporários das tools)", "safe", &["~/Library/Application Support/wtf.tonho.omniget/tools/tmp"]),
+ d("omniget-tmp", "apps", "OmniGet (temporários das tools)", "safe", &["~/Library/Application Support/com.openselena.omniget/tools/tmp", "~/Library/Application Support/wtf.tonho.omniget/tools/tmp"]),
d("xcode-derived", "dev", "Xcode DerivedData", "safe", &["~/Library/Developer/Xcode/DerivedData"]),
d("xcode-device-support", "dev", "Xcode iOS DeviceSupport", "review", &["~/Library/Developer/Xcode/iOS DeviceSupport", "~/Library/Developer/Xcode/watchOS DeviceSupport", "~/Library/Developer/Xcode/tvOS DeviceSupport"]),
d("simulator-caches", "dev", "Simulator caches", "safe", &["~/Library/Developer/CoreSimulator/Caches"]),
@@ -343,7 +343,10 @@ const DEFS: &[Def] = &[
"apps",
"OmniGet (temporários das tools)",
"safe",
- &["%APPDATA%\\wtf.tonho.omniget\\tools\\tmp"],
+ &[
+ "%APPDATA%\\com.openselena.omniget\\tools\\tmp",
+ "%APPDATA%\\wtf.tonho.omniget\\tools\\tmp",
+ ],
),
d(
"npm",
@@ -621,6 +624,8 @@ const DEFS: &[Def] = &[
"OmniGet (temporários das tools)",
"safe",
&[
+ "~/.local/share/com.openselena.omniget/tools/tmp",
+ "~/.var/app/com.openselena.omniget/data/com.openselena.omniget/tools/tmp",
"~/.local/share/wtf.tonho.omniget/tools/tmp",
"~/.var/app/wtf.tonho.omniget/data/wtf.tonho.omniget/tools/tmp",
],
diff --git a/src-tauri/omniget-core/src/core/tools/x/fx.rs b/src-tauri/omniget-core/src/core/tools/x/fx.rs
index d70704a6..d0493188 100644
--- a/src-tauri/omniget-core/src/core/tools/x/fx.rs
+++ b/src-tauri/omniget-core/src/core/tools/x/fx.rs
@@ -16,7 +16,7 @@ fn client() -> anyhow::Result<reqwest::Client> {
let mut headers = HeaderMap::new();
headers.insert(
USER_AGENT,
- HeaderValue::from_static("OmniGet/0.9 (+https://github.com/tonhowtf/omniget)"),
+ HeaderValue::from_static("OmniGet/0.9 (+https://github.com/OpenSelena/omniget)"),
);
Ok(
crate::core::http_client::apply_global_proxy(reqwest::Client::builder())
diff --git a/src-tauri/omniget-plugin-sdk/src/host.rs b/src-tauri/omniget-plugin-sdk/src/host.rs
index d7fd6bd0..9619daf0 100644
--- a/src-tauri/omniget-plugin-sdk/src/host.rs
+++ b/src-tauri/omniget-plugin-sdk/src/host.rs
@@ -42,9 +42,9 @@ pub trait PluginHost: Send + Sync {
///
/// # Platform layout
///
- /// - Windows: `%LOCALAPPDATA%\wtf.tonho.omniget\external-cache\{plugin_id}\{namespace}\`
- /// - Linux: `$XDG_CACHE_HOME/wtf.tonho.omniget/external-cache/{plugin_id}/{namespace}/` (falls back to `~/.cache/...`)
- /// - macOS: `~/Library/Caches/wtf.tonho.omniget/external-cache/{plugin_id}/{namespace}/`
+ /// - Windows: `%LOCALAPPDATA%\com.openselena.omniget\external-cache\{plugin_id}\{namespace}\`
+ /// - Linux: `$XDG_CACHE_HOME/com.openselena.omniget/external-cache/{plugin_id}/{namespace}/` (falls back to `~/.cache/...`)
+ /// - macOS: `~/Library/Caches/com.openselena.omniget/external-cache/{plugin_id}/{namespace}/`
///
/// These are the OS-canonical cache locations (non-roaming on Windows,
/// `$XDG_CACHE_HOME` on Linux, `Caches/` on macOS). They are deliberately
diff --git a/src-tauri/src/commands/omnidisc/store.rs b/src-tauri/src/commands/omnidisc/store.rs
index d4d79450..e772a1e2 100644
--- a/src-tauri/src/commands/omnidisc/store.rs
+++ b/src-tauri/src/commands/omnidisc/store.rs
@@ -24,7 +24,8 @@ use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::sync::{Mutex, OnceLock};
-pub const SERVICE: &str = "wtf.tonho.omniget.omnidisc";
+pub const SERVICE: &str = "com.openselena.omniget.omnidisc";
+const LEGACY_SERVICE: &str = "wtf.tonho.omniget.omnidisc";
const SESSIONS_FILE: &str = "sessions.bin";
const KEY_FILE: &str = "session.key";
const IV_LEN: usize = 16;
@@ -194,7 +195,17 @@ fn keyring_get(url: &str) -> Option<Result<Option<String>, String>> {
}
Some(keyring_entry(url).and_then(|e| match e.get_password() {
Ok(t) => Ok(Some(t)),
- Err(keyring::Error::NoEntry) => Ok(None),
+ Err(keyring::Error::NoEntry) => {
+ if let Ok(legacy_e) = keyring::Entry::new(LEGACY_SERVICE, url) {
+ match legacy_e.get_password() {
+ Ok(t) => Ok(Some(t)),
+ Err(keyring::Error::NoEntry) => Ok(None),
+ Err(err) => Err(err.to_string()),
+ }
+ } else {
+ Ok(None)
+ }
+ }
Err(err) => Err(err.to_string()),
}))
}
@@ -204,6 +215,9 @@ fn keyring_delete(url: &str) -> Option<Result<(), String>> {
if !use_keyring() {
return None;
}
+ if let Ok(legacy_e) = keyring::Entry::new(LEGACY_SERVICE, url) {
+ let _ = legacy_e.delete_credential();
+ }
Some(
keyring_entry(url).and_then(|e| match e.delete_credential() {
Ok(()) | Err(keyring::Error::NoEntry) => Ok(()),
diff --git a/src-tauri/src/commands/open_nami.rs b/src-tauri/src/commands/open_nami.rs
deleted file mode 100644
index b5ca7598..00000000
--- a/src-tauri/src/commands/open_nami.rs
+++ /dev/null
@@ -1,1099 +0,0 @@
-#![allow(clippy::all)]
-#![allow(warnings)]
-
-use chrono::Utc;
-use serde::{Deserialize, Serialize};
-use std::collections::{HashMap, VecDeque};
-use std::fs;
-use std::io::{BufRead, BufReader};
-use std::path::{Path, PathBuf};
-use std::process::{Command, Stdio};
-use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
-use std::sync::{Arc, LazyLock, Mutex};
-use std::thread;
-use std::time::Duration;
-use tauri::{command, AppHandle, Emitter};
-
-#[cfg(target_os = "windows")]
-use std::os::windows::process::CommandExt;
-
-#[derive(Debug, Serialize, Deserialize, Clone)]
-pub struct Profile {
- pub url: String,
- pub username: Option<String>,
- pub platform: String,
- pub added_at: i64,
-}
-
-#[derive(Debug, Serialize, Deserialize, Clone)]
-pub struct DownloadResult {
- pub success: bool,
- pub message: String,
- pub files_count: u32,
- pub cancelled: bool,
-}
-
-#[derive(Debug, Serialize, Deserialize, Clone)]
-pub struct DownloadProgress {
- pub message: String,
- pub files_downloaded: u32,
- pub stage: Option<String>,
- pub stage_index: Option<u32>,
- pub stage_total: Option<u32>,
-}
-
-#[derive(Debug, Serialize, Deserialize, Clone)]
-pub struct AppSettings {
- pub output_directory: Option<String>,
- pub cookies_file: Option<String>,
-}
-
-#[derive(Debug, Serialize, Deserialize, Clone)]
-pub struct DependencyStatus {
- pub ok: bool,
- pub message: String,
- pub gallery_dl_version: Option<String>,
-}
-
-struct RunningDownload {
- pid: Option<u32>,
- cancelled: Arc<AtomicBool>,
-}
-
-static RUNNING_DOWNLOADS: LazyLock<Mutex<HashMap<String, RunningDownload>>> =
- LazyLock::new(|| Mutex::new(HashMap::new()));
-
-fn get_running_downloads() -> std::sync::MutexGuard<'static, HashMap<String, RunningDownload>> {
- RUNNING_DOWNLOADS.lock().unwrap_or_else(|p| p.into_inner())
-}
-
-// RAII guard for the download lifecycle across all stages
-struct DownloadRegistration {
- id: String,
- cancelled: Arc<AtomicBool>,
-}
-
-impl DownloadRegistration {
- fn new(id: &str) -> Result<Self, String> {
- let mut map = get_running_downloads();
- if map.contains_key(id) {
- return Err("A download with this ID is already registered".to_string());
- }
- let cancelled = Arc::new(AtomicBool::new(false));
- map.insert(
- id.to_string(),
- RunningDownload {
- pid: None,
- cancelled: cancelled.clone(),
- },
- );
- Ok(Self {
- id: id.to_string(),
- cancelled,
- })
- }
-
- fn is_cancelled(&self) -> bool {
- self.cancelled.load(Ordering::SeqCst)
- }
-
- fn set_pid(&self, pid: Option<u32>) {
- let mut map = get_running_downloads();
- if let Some(rd) = map.get_mut(&self.id) {
- rd.pid = pid;
- }
- }
-}
-
-impl Drop for DownloadRegistration {
- fn drop(&mut self) {
- let pid = get_running_downloads()
- .remove(&self.id)
- .and_then(|rd| rd.pid);
- if let (Some(pid), true) = (pid, thread::panicking()) {
- kill_process_tree(pid);
- }
- }
-}
-
-static OPEN_NAMI_STORAGE_LOCK: LazyLock<Mutex<()>> = LazyLock::new(|| Mutex::new(()));
-
-fn omniget_open_nami_dir() -> Result<PathBuf, String> {
- let base =
- omniget_core::core::paths::app_data_dir().ok_or("Could not find app data directory")?;
- let dir = base.join("open_nami");
- let legacy_dir = base.join("open_omni");
-
- // Seamless automatic data migration from legacy open_omni to open_nami
- if !dir.exists() && legacy_dir.exists() {
- if let Err(e) = fs::rename(&legacy_dir, &dir) {
- tracing::warn!("Failed to rename legacy open_omni directory: {}. Creating fresh open_nami dir.", e);
- } else {
- tracing::info!("Successfully migrated legacy open_omni user data directory to open_nami.");
- }
- }
-
- fs::create_dir_all(&dir).map_err(|e| format!("Failed to create config dir: {}", e))?;
- Ok(dir)
-}
-
-fn atomic_write(path: &Path, content: &str) -> Result<(), String> {
- let parent = path.parent().ok_or("Missing parent directory")?;
- fs::create_dir_all(parent).map_err(|e| format!("Failed to create directory: {}", e))?;
- let tmp_path = path.with_extension(format!(
- "tmp.{}",
- Utc::now().timestamp_nanos_opt().unwrap_or(0)
- ));
- fs::write(&tmp_path, content).map_err(|e| format!("Failed to write temporary file: {}", e))?;
- fs::rename(&tmp_path, path).map_err(|e| {
- let _ = fs::remove_file(&tmp_path);
- format!("Failed to commit file {}: {}", path.display(), e)
- })?;
- Ok(())
-}
-
-#[command]
-pub async fn open_nami_check_python_dependencies() -> Result<DependencyStatus, String> {
- tauri::async_runtime::spawn_blocking(|| {
- let python_bin = ["python3", "python"].iter().find(|bin| {
- let mut cmd = Command::new(bin);
- #[cfg(target_os = "windows")]
- cmd.creation_flags(0x08000000);
- cmd.arg("--version")
- .output()
- .map(|out| out.status.success())
- .unwrap_or(false)
- });
-
- if python_bin.is_none() {
- return Ok(DependencyStatus {
- ok: false,
- message: "Python is not installed or not in PATH".to_string(),
- gallery_dl_version: None,
- });
- }
-
- let mut gallery_cmd = Command::new("gallery-dl");
- #[cfg(target_os = "windows")]
- gallery_cmd.creation_flags(0x08000000);
-
- let gallery_check = match gallery_cmd.arg("--version").output() {
- Ok(out) if out.status.success() => {
- let v = String::from_utf8_lossy(&out.stdout).trim().to_string();
- Some(v)
- }
- _ => None,
- };
-
- if gallery_check.is_none() {
- return Ok(DependencyStatus {
- ok: false,
- message: "gallery-dl is not installed or not in PATH".to_string(),
- gallery_dl_version: None,
- });
- }
-
- Ok(DependencyStatus {
- ok: true,
- message: "All dependencies OK".to_string(),
- gallery_dl_version: gallery_check,
- })
- })
- .await
- .map_err(|e| format!("Task failed: {}", e))?
-}
-
-fn detect_platform_name(url: &str) -> &'static str {
- let low = url.to_lowercase();
- let host = if let Some(after_scheme) = low.split("://").nth(1) {
- after_scheme.split('/').next().unwrap_or("")
- } else {
- low.split('/').next().unwrap_or("")
- };
- let host = host.split(':').next().unwrap_or("");
-
- if host == "instagram.com" || host.ends_with(".instagram.com") {
- "Instagram"
- } else if host == "tiktok.com" || host.ends_with(".tiktok.com") {
- "TikTok"
- } else if host == "facebook.com" || host.ends_with(".facebook.com") {
- "Facebook"
- } else if host == "x.com"
- || host.ends_with(".x.com")
- || host == "twitter.com"
- || host.ends_with(".twitter.com")
- {
- "X"
- } else {
- "Other"
- }
-}
-
-fn sanitize_path_component(input: &str) -> String {
- let mut cleaned: String = input
- .chars()
- .map(|c| {
- if c.is_ascii_alphanumeric() || c == ' ' || c == '-' || c == '.' || c == '_' {
- c
- } else {
- '_'
- }
- })
- .collect();
-
- while cleaned.starts_with('.') || cleaned.starts_with('-') || cleaned.starts_with(' ') {
- cleaned.remove(0);
- }
- while cleaned.ends_with('.') || cleaned.ends_with(' ') {
- cleaned.pop();
- }
- while cleaned.contains("..") {
- cleaned = cleaned.replace("..", "_");
- }
- let trimmed = cleaned.trim().trim_matches('_');
- let lower = trimmed.to_ascii_lowercase();
- const RESERVED: &[&str] = &[
- "con", "prn", "aux", "nul", "com1", "com2", "com3", "com4", "com5", "com6", "com7", "com8",
- "com9", "lpt1", "lpt2", "lpt3", "lpt4", "lpt5", "lpt6", "lpt7", "lpt8", "lpt9",
- ];
- if trimmed.is_empty() || RESERVED.contains(&lower.as_str()) {
- return "unknown_user".to_string();
- }
- trimmed.chars().take(120).collect()
-}
-
-fn extract_username_generic(url: &str) -> Option<String> {
- let trimmed = url.trim().trim_end_matches('/');
- if trimmed.is_empty() {
- return None;
- }
-
- let candidate = if trimmed.contains("://") {
- let after_scheme = trimmed.split("://").nth(1).unwrap_or(trimmed);
- let mut parts = after_scheme.split('/');
- parts.next()?;
- parts.next()?
- } else {
- trimmed
- };
-
- let cleaned = candidate.split(['?', '#']).next()?;
- let cleaned = cleaned.trim_start_matches('@');
- if cleaned.is_empty() || ["p", "reel", "tv", "stories", "highlights"].contains(&cleaned) {
- return None;
- }
-
- Some(sanitize_path_component(cleaned))
-}
-
-fn normalize_profile_url(platform: &str, raw_input: &str) -> String {
- let trimmed = raw_input.trim();
-
- if !trimmed.contains("://") && !trimmed.contains('/') {
- let username = trimmed.trim_start_matches('@').to_lowercase();
- return match platform {
- "instagram" => format!("https://www.instagram.com/{}/", username),
- "tiktok" => format!("https://www.tiktok.com/@{}", username),
- "facebook" => format!("https://www.facebook.com/{}", username),
- "x" => format!("https://x.com/{}", username),
- _ => trimmed.to_string(),
- };
- }
-
- let without_scheme = trimmed
- .trim_start_matches("https://")
- .trim_start_matches("http://");
- let (host_and_path, _) = without_scheme
- .split_once(['?', '#'])
- .unwrap_or((without_scheme, ""));
-
- let mut parts = host_and_path.splitn(2, '/');
- let host = parts.next().unwrap_or("").to_lowercase();
- let path = parts.next().unwrap_or("").trim_matches('/');
-
- let canonical_host = match platform {
- "instagram" => "www.instagram.com",
- "tiktok" => "www.tiktok.com",
- "facebook" => "www.facebook.com",
- "x" => "x.com",
- _ => host.trim_start_matches("www."),
- };
-
- let path_part = if path.is_empty() {
- String::new()
- } else {
- format!("/{}/", path.to_lowercase())
- };
-
- if platform == "tiktok" && !path_part.is_empty() {
- let user = path.trim_start_matches('@');
- return format!("https://www.tiktok.com/@{}", user.to_lowercase());
- }
-
- format!("https://{}{}", canonical_host, path_part)
-}
-
-fn validate_content_type(content_type: &str) -> Result<(), String> {
- match content_type {
- "all" | "photos" | "videos" | "stories" | "highlights" => Ok(()),
- _ => Err("Unsupported content type".to_string()),
- }
-}
-
-fn validate_profile_platform(platform: &str) -> Result<(), String> {
- match platform {
- "instagram" | "tiktok" | "facebook" | "x" => Ok(()),
- _ => Err("Unsupported profile platform".to_string()),
- }
-}
-
-fn validate_download_url(url: &str) -> Result<(), String> {
- let trimmed = url.trim();
- if trimmed.is_empty() {
- return Err("URL cannot be empty".to_string());
- }
- if !trimmed.starts_with("http://") && !trimmed.starts_with("https://") {
- return Err("URL must start with http:// or https://".to_string());
- }
- if trimmed.starts_with('-') || trimmed.contains(char::is_whitespace) {
- return Err("URL contains invalid CLI flags or whitespace".to_string());
- }
- Ok(())
-}
-
-#[command]
-pub async fn open_nami_run_gallery_dl_download(
- app: AppHandle,
- url: String,
- output_dir: String,
- cookies_file: Option<String>,
- content_type: String,
- download_id: String,
-) -> Result<DownloadResult, String> {
- tauri::async_runtime::spawn_blocking(move || {
- run_gallery_dl_download_blocking(
- app,
- url,
- output_dir,
- cookies_file,
- content_type,
- download_id,
- )
- })
- .await
- .map_err(|e| format!("Download task panicked: {}", e))?
-}
-
-fn run_gallery_dl_download_blocking(
- app: AppHandle,
- url: String,
- output_dir: String,
- cookies_file: Option<String>,
- content_type: String,
- download_id: String,
-) -> Result<DownloadResult, String> {
- validate_content_type(&content_type)?;
- validate_download_url(&url)?;
-
- let reg = DownloadRegistration::new(&download_id)?;
-
- fs::create_dir_all(&output_dir)
- .map_err(|e| format!("Failed to create output directory: {}", e))?;
- let test_file = PathBuf::from(&output_dir).join(".open_nami_write_test");
- fs::write(&test_file, b"ok")
- .map_err(|e| format!("Output directory is not writable: {} ({})", output_dir, e))?;
- let _ = fs::remove_file(&test_file);
-
- let cookies_trimmed = cookies_file
- .as_ref()
- .map(|c| c.trim().to_string())
- .filter(|c| !c.is_empty());
- if let Some(ref cookies) = cookies_trimmed {
- if !Path::new(cookies).is_file() {
- return Err("The configured cookies file does not exist or is not a file.".to_string());
- }
- }
-
- let platform_name = detect_platform_name(&url);
- if content_type == "all" {
- let mut sub_types: Vec<&str> = vec!["photos", "videos"];
- if platform_name == "Instagram" {
- if cookies_trimmed.is_some() {
- sub_types.push("stories");
- sub_types.push("highlights");
- }
- }
-
- let stage_total = sub_types.len() as u32;
- let mut total_files = 0u32;
- let mut failures: Vec<String> = Vec::new();
-
- for (idx, sub_type) in sub_types.into_iter().enumerate() {
- if reg.is_cancelled() {
- return Ok(DownloadResult {
- success: false,
- message: "Download cancelled".to_string(),
- files_count: total_files,
- cancelled: true,
- });
- }
-
- let stage_index = idx as u32 + 1;
- let stage_label = match sub_type {
- "photos" => "Photos",
- "videos" => "Videos",
- "stories" => "Stories",
- "highlights" => "Highlights",
- _ => "Media",
- };
-
- let _ = app.emit(
- &format!("download_{}", download_id),
- DownloadProgress {
- message: format!("Starting {}", stage_label),
- files_downloaded: total_files,
- stage: Some(stage_label.to_string()),
- stage_index: Some(stage_index),
- stage_total: Some(stage_total),
- },
- );
-
- match run_single_content_download(
- &app,
- &url,
- &output_dir,
- &cookies_trimmed,
- sub_type,
- &reg,
- platform_name,
- total_files,
- stage_index,
- stage_total,
- ) {
- Ok(result) => {
- total_files += result.files_count;
- if result.cancelled || reg.is_cancelled() {
- return Ok(DownloadResult {
- success: false,
- message: "Download cancelled".to_string(),
- files_count: total_files,
- cancelled: true,
- });
- }
- if !result.success {
- failures.push(format!("{}: {}", sub_type, result.message));
- }
- }
- Err(e) => {
- if reg.is_cancelled() {
- return Ok(DownloadResult {
- success: false,
- message: "Download cancelled".to_string(),
- files_count: total_files,
- cancelled: true,
- });
- }
- failures.push(format!("{}: {}", sub_type, e));
- }
- }
- }
-
- if reg.is_cancelled() {
- return Ok(DownloadResult {
- success: false,
- message: "Download cancelled".to_string(),
- files_count: total_files,
- cancelled: true,
- });
- }
-
- if failures.is_empty() {
- Ok(DownloadResult {
- success: true,
- message: format!(
- "Download completed successfully. {} files downloaded.",
- total_files
- ),
- files_count: total_files,
- cancelled: false,
- })
- } else {
- Ok(DownloadResult {
- success: false,
- message: format!(
- "{} files downloaded, but some steps failed: {}",
- total_files,
- failures.join(" | ")
- ),
- files_count: total_files,
- cancelled: false,
- })
- }
- } else {
- run_single_content_download(
- &app,
- &url,
- &output_dir,
- &cookies_trimmed,
- &content_type,
- &reg,
- platform_name,
- 0,
- 1,
- 1,
- )
- }
-}
-
-#[allow(clippy::too_many_arguments)]
-fn run_single_content_download(
- app: &AppHandle,
- url: &str,
- output_dir: &str,
- cookies_file: &Option<String>,
- content_type: &str,
- reg: &DownloadRegistration,
- platform_name: &str,
- base_count: u32,
- stage_index: u32,
- stage_total: u32,
-) -> Result<DownloadResult, String> {
- if reg.is_cancelled() {
- return Ok(DownloadResult {
- success: false,
- message: "Download cancelled".to_string(),
- files_count: 0,
- cancelled: true,
- });
- }
-
- if (content_type == "stories" || content_type == "highlights") && platform_name != "Instagram" {
- let label = if content_type == "stories" {
- "Stories"
- } else {
- "Highlights"
- };
- return Err(format!(
- "{} are only available for Instagram. gallery-dl has no {} support for {}.",
- label, content_type, platform_name
- ));
- }
-
- if (content_type == "stories" || content_type == "highlights")
- && cookies_file.as_deref().unwrap_or("").trim().is_empty()
- {
- let label = if content_type == "stories" {
- "Stories"
- } else {
- "Highlights"
- };
- return Err(format!(
- "{} require an Instagram cookies file to be configured.",
- label
- ));
- }
-
- let username = extract_username_generic(url).unwrap_or_else(|| "unknown_user".to_string());
- let media_folder = match content_type {
- "photos" => "photos",
- "videos" => "videos",
- "stories" => "stories",
- "highlights" => "highlights",
- _ => "all",
- };
-
- let final_dest = PathBuf::from(output_dir)
- .join("OpenNami")
- .join(sanitize_path_component(platform_name))
- .join(sanitize_path_component(&username))
- .join(media_folder);
-
- fs::create_dir_all(&final_dest).map_err(|e| {
- format!(
- "Failed to create output folder {}: {}",
- final_dest.display(),
- e
- )
- })?;
-
- let media_type_name = match content_type {
- "photos" => "Photos",
- "videos" => "Videos",
- "stories" => "Stories",
- "highlights" => "Highlights",
- _ => "Media",
- };
-
- let _ = app.emit(
- &format!("download_{}", reg.id),
- DownloadProgress {
- message: format!(
- "Preparing to download {} for {}...",
- media_type_name, username
- ),
- files_downloaded: base_count,
- stage: Some(media_type_name.to_string()),
- stage_index: Some(stage_index),
- stage_total: Some(stage_total),
- },
- );
-
- let mut cmd = Command::new("gallery-dl");
- cmd.stdin(Stdio::null());
- cmd.arg("--directory").arg(&final_dest);
-
- #[cfg(target_os = "windows")]
- cmd.creation_flags(0x08000000);
-
- #[cfg(unix)]
- {
- use std::os::unix::process::CommandExt;
- cmd.process_group(0);
- }
-
- match content_type {
- "photos" => {
- if platform_name == "Instagram" {
- cmd.arg("-o").arg("include=posts,reels");
- }
- cmd.arg("--filter").arg(
- "extension in ('jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp', 'jfif', 'heic', 'avif', 'tiff', 'svg')",
- );
- }
- "videos" => {
- if platform_name == "Instagram" {
- cmd.arg("-o").arg("include=posts,reels");
- }
- cmd.arg("--filter").arg(
- "extension in ('mp4', 'webm', 'mkv', 'mov', 'avi', 'm4v', 'flv', 'wmv', '3gp', 'mpeg', 'mpg', 'ts', 'f4v', 'mts', 'm2ts')",
- );
- }
- "stories" => {
- cmd.arg("-o").arg("include=stories");
- }
- "highlights" => {
- cmd.arg("-o").arg("include=highlights");
- }
- _ => {}
- }
-
- if let Some(cookies) = cookies_file {
- if !cookies.trim().is_empty() {
- cmd.arg("--cookies").arg(cookies);
- }
- }
-
- let app_settings = crate::storage::config::load_settings_standalone();
- let user_agent = app_settings.advanced.user_agent.trim();
- if !user_agent.is_empty() {
- cmd.arg("--user-agent").arg(user_agent);
- }
-
- if let Some(proxy) = omniget_core::core::http_client::proxy_url() {
- cmd.arg("--proxy").arg(&proxy);
- }
-
- cmd.arg("--Print")
- .arg("after:FILE_OK:{filename}.{extension}");
- cmd.arg("--sleep-request")
- .arg(if platform_name == "Instagram" {
- "6-12"
- } else {
- "2"
- });
- cmd.arg("--http-timeout").arg("30");
- cmd.arg(url);
-
- cmd.stdout(Stdio::piped());
- cmd.stderr(Stdio::piped());
-
- let mut child = cmd
- .spawn()
- .map_err(|e| format!("Failed to start gallery-dl: {}", e))?;
-
- let pid = child.id();
- reg.set_pid(Some(pid));
-
- if reg.is_cancelled() {
- kill_process_tree(pid);
- }
-
- let stdout = child.stdout.take().ok_or("Failed to capture stdout")?;
- let stderr = child.stderr.take().ok_or("Failed to capture stderr")?;
-
- let files_downloaded = Arc::new(AtomicU32::new(0));
-
- let stdout_handle = {
- let app = app.clone();
- let download_id = reg.id.clone();
- let files_downloaded = files_downloaded.clone();
- let stage_label = media_type_name.to_string();
- thread::spawn(move || {
- let reader = BufReader::new(stdout);
- for line in reader.lines().map_while(Result::ok) {
- if let Some(pos) = line.find("FILE_OK:") {
- let filename = line[pos + "FILE_OK:".len()..].trim();
- let count = files_downloaded.fetch_add(1, Ordering::SeqCst) + 1;
- let _ = app.emit(
- &format!("download_{}", download_id),
- DownloadProgress {
- message: format!("Downloaded: {}", filename),
- files_downloaded: base_count + count,
- stage: Some(stage_label.clone()),
- stage_index: Some(stage_index),
- stage_total: Some(stage_total),
- },
- );
- }
- }
- })
- };
-
- let stderr_tail = Arc::new(Mutex::new(VecDeque::<String>::with_capacity(40)));
- let stderr_handle = {
- let app = app.clone();
- let download_id = reg.id.clone();
- let files_downloaded = files_downloaded.clone();
- let stderr_tail = stderr_tail.clone();
- let stage_label = media_type_name.to_string();
- thread::spawn(move || {
- let reader = BufReader::new(stderr);
- for line in reader.lines().map_while(Result::ok) {
- let trimmed = line.trim();
- if trimmed.is_empty() {
- continue;
- }
-
- {
- let mut tail = stderr_tail.lock().unwrap_or_else(|p| p.into_inner());
- if tail.len() >= 40 {
- tail.pop_front();
- }
- tail.push_back(line.clone());
- }
-
- let lower = trimmed.to_lowercase();
- let is_noise = lower.starts_with("[debug]")
- || lower.contains("sleeping")
- || lower.contains("waiting")
- || lower.starts_with("# ");
- if is_noise {
- continue;
- }
-
- let count = files_downloaded.load(Ordering::SeqCst);
- let _ = app.emit(
- &format!("download_{}", download_id),
- DownloadProgress {
- message: trimmed.to_string(),
- files_downloaded: base_count + count,
- stage: Some(stage_label.clone()),
- stage_index: Some(stage_index),
- stage_total: Some(stage_total),
- },
- );
- }
- })
- };
-
- let watchdog_completed = Arc::new(AtomicBool::new(false));
- let watchdog_done = watchdog_completed.clone();
- let watchdog_pid = pid;
- let _watchdog = thread::spawn(move || {
- for _ in 0..(45 * 60 / 5) {
- if watchdog_done.load(Ordering::SeqCst) {
- return;
- }
- thread::sleep(Duration::from_secs(5));
- }
- if !watchdog_done.load(Ordering::SeqCst) {
- kill_process_tree(watchdog_pid);
- }
- });
-
- let status = child
- .wait()
- .map_err(|e| format!("Download process failed: {}", e))?;
-
- reg.set_pid(None);
- watchdog_completed.store(true, Ordering::SeqCst);
-
- let _ = stdout_handle.join();
- let _ = stderr_handle.join();
-
- let final_count = files_downloaded.load(Ordering::SeqCst);
-
- if reg.is_cancelled() {
- return Ok(DownloadResult {
- success: false,
- message: "Download cancelled".to_string(),
- files_count: final_count,
- cancelled: true,
- });
- }
-
- if status.success() {
- Ok(DownloadResult {
- success: true,
- message: format!(
- "Download completed successfully. {} files downloaded.",
- final_count
- ),
- files_count: final_count,
- cancelled: false,
- })
- } else {
- let stderr_message = stderr_tail
- .lock()
- .unwrap_or_else(|p| p.into_inner())
- .iter()
- .cloned()
- .collect::<Vec<_>>()
- .join("\n");
- let error_msg = if !stderr_message.is_empty() {
- stderr_message
- } else {
- format!(
- "gallery-dl exited with code {}",
- status.code().unwrap_or(-1)
- )
- };
- Ok(DownloadResult {
- success: false,
- message: error_msg,
- files_count: final_count,
- cancelled: false,
- })
- }
-}
-
-fn kill_process_tree(pid: u32) {
- #[cfg(target_os = "windows")]
- {
- let mut kill_cmd = Command::new("taskkill");
- kill_cmd.args(["/PID", &pid.to_string(), "/T", "/F"]);
- kill_cmd.creation_flags(0x08000000);
- let _ = kill_cmd.output();
- }
- #[cfg(not(target_os = "windows"))]
- {
- let _ = Command::new("kill")
- .args(["-9", &format!("-{}", pid)])
- .output();
- }
-}
-
-#[command]
-pub async fn open_nami_cancel_download(download_id: String) -> Result<String, String> {
- tauri::async_runtime::spawn_blocking(move || {
- let pid = {
- let mut map = get_running_downloads();
- let rd = map
- .get_mut(&download_id)
- .ok_or("No running download found for that ID")?;
- rd.cancelled.store(true, Ordering::SeqCst);
- rd.pid
- };
- if let Some(pid) = pid {
- kill_process_tree(pid);
- }
- Ok("Download cancelled".to_string())
- })
- .await
- .map_err(|e| format!("Cancel task panicked: {}", e))?
-}
-
-#[command]
-pub fn open_nami_save_app_settings(
- output_directory: Option<String>,
- cookies_file: Option<String>,
-) -> Result<String, String> {
- let _storage_guard = OPEN_NAMI_STORAGE_LOCK
- .lock()
- .unwrap_or_else(|p| p.into_inner());
-
- let settings = AppSettings {
- output_directory,
- cookies_file,
- };
-
- let config_dir = omniget_open_nami_dir()?;
- let settings_file = config_dir.join("app_settings.json");
- let content = serde_json::to_string_pretty(&settings)
- .map_err(|e| format!("Failed to serialize settings: {}", e))?;
-
- atomic_write(&settings_file, &content)?;
- Ok("Settings saved successfully".to_string())
-}
-
-#[command]
-pub fn open_nami_load_app_settings() -> Result<AppSettings, String> {
- let _storage_guard = OPEN_NAMI_STORAGE_LOCK
- .lock()
- .unwrap_or_else(|p| p.into_inner());
-
- let settings_file = omniget_open_nami_dir()?.join("app_settings.json");
- if !settings_file.exists() {
- return Ok(AppSettings {
- output_directory: None,
- cookies_file: None,
- });
- }
-
- let content = fs::read_to_string(&settings_file)
- .map_err(|e| format!("Failed to read settings: {}", e))?;
- let settings: AppSettings =
- serde_json::from_str(&content).map_err(|e| format!("Failed to parse settings: {}", e))?;
- Ok(settings)
-}
-
-#[command]
-pub fn open_nami_load_profiles(platform: String) -> Result<Vec<Profile>, String> {
- validate_profile_platform(&platform)?;
- let _storage_guard = OPEN_NAMI_STORAGE_LOCK
- .lock()
- .unwrap_or_else(|p| p.into_inner());
-
- let profiles_file = omniget_open_nami_dir()?.join("profiles.json");
- if !profiles_file.exists() {
- return Ok(vec![]);
- }
-
- let content = fs::read_to_string(&profiles_file)
- .map_err(|e| format!("Failed to read profiles: {}", e))?;
- let all_profiles: serde_json::Value =
- serde_json::from_str(&content).map_err(|e| format!("Failed to parse profiles: {}", e))?;
-
- let platform_profiles = all_profiles
- .get(&platform)
- .and_then(|v| v.as_array())
- .map(|arr| {
- arr.iter()
- .filter_map(|v| serde_json::from_value(v.clone()).ok())
- .collect()
- })
- .unwrap_or_default();
-
- Ok(platform_profiles)
-}
-
-#[command]
-pub fn open_nami_save_profile(platform: String, url: String) -> Result<String, String> {
- validate_profile_platform(&platform)?;
- let _storage_guard = OPEN_NAMI_STORAGE_LOCK
- .lock()
- .unwrap_or_else(|p| p.into_inner());
-
- let raw_input = url.trim().to_string();
- if raw_input.is_empty() {
- return Err("URL or username cannot be empty".to_string());
- }
-
- let url = normalize_profile_url(&platform, &raw_input);
- let config_dir = omniget_open_nami_dir()?;
- let profiles_file = config_dir.join("profiles.json");
-
- let mut all_profiles: serde_json::Value = if profiles_file.exists() {
- let content = fs::read_to_string(&profiles_file)
- .map_err(|e| format!("Failed to read profiles: {}", e))?;
- serde_json::from_str(&content)
- .map_err(|e| format!("Failed to parse profiles file (corrupted): {}", e))?
- } else {
- serde_json::json!({})
- };
-
- let username = extract_username_generic(&url);
-
- if let Some(arr) = all_profiles
- .as_object()
- .and_then(|obj| obj.get(&platform))
- .and_then(|v| v.as_array())
- {
- for profile in arr {
- let existing_url = profile.get("url").and_then(|v| v.as_str());
- if existing_url == Some(url.as_str()) {
- return Err("Profile already exists".to_string());
- }
- if let Some(existing) = existing_url {
- if normalize_profile_url(&platform, existing) == url {
- return Err("Profile already exists".to_string());
- }
- }
- if let Some(new_name) = &username {
- let existing_name = profile.get("username").and_then(|v| v.as_str());
- if let Some(existing_name) = existing_name {
- if !existing_name.is_empty() && existing_name.eq_ignore_ascii_case(new_name) {
- return Err("Profile already exists".to_string());
- }
- }
- }
- }
- }
-
- let new_profile = serde_json::json!({
- "url": url,
- "username": username,
- "platform": platform,
- "added_at": Utc::now().timestamp()
- });
-
- if let Some(arr) = all_profiles
- .as_object_mut()
- .and_then(|obj| obj.get_mut(&platform))
- .and_then(|v| v.as_array_mut())
- {
- arr.push(new_profile);
- } else if let Some(obj) = all_profiles.as_object_mut() {
- obj.insert(platform.clone(), serde_json::json!([new_profile]));
- }
-
- let content = serde_json::to_string_pretty(&all_profiles)
- .map_err(|e| format!("Failed to serialize: {}", e))?;
-
- atomic_write(&profiles_file, &content)?;
- Ok("Profile saved successfully".to_string())
-}
-
-#[command]
-pub fn open_nami_delete_profile(platform: String, profile_url: String) -> Result<String, String> {
- validate_profile_platform(&platform)?;
- let _storage_guard = OPEN_NAMI_STORAGE_LOCK
- .lock()
- .unwrap_or_else(|p| p.into_inner());
-
- let profiles_file = omniget_open_nami_dir()?.join("profiles.json");
- if !profiles_file.exists() {
- return Err("Profiles file not found".to_string());
- }
-
- let content = fs::read_to_string(&profiles_file)
- .map_err(|e| format!("Failed to read profiles: {}", e))?;
- let mut all_profiles: serde_json::Value =
- serde_json::from_str(&content).map_err(|e| format!("Failed to parse profiles: {}", e))?;
-
- let normalized_target = normalize_profile_url(&platform, &profile_url);
-
- let deleted = all_profiles
- .as_object_mut()
- .and_then(|obj| obj.get_mut(&platform))
- .and_then(|v| v.as_array_mut())
- .map(|arr| {
- let len_before = arr.len();
- arr.retain(|p| {
- let u = p.get("url").and_then(|u| u.as_str()).unwrap_or("");
- u != profile_url && normalize_profile_url(&platform, u) != normalized_target
- });
- len_before != arr.len()
- })
- .unwrap_or(false);
-
- if !deleted {
- return Err("Profile not found".to_string());
- }
-
- let content = serde_json::to_string_pretty(&all_profiles)
- .map_err(|e| format!("Failed to serialize: {}", e))?;
-
- atomic_write(&profiles_file, &content)?;
- Ok("Profile deleted".to_string())
-}
diff --git a/src-tauri/src/commands/open_nami/args.rs b/src-tauri/src/commands/open_nami/args.rs
new file mode 100644
index 00000000..2d24c90a
--- /dev/null
+++ b/src-tauri/src/commands/open_nami/args.rs
@@ -0,0 +1,259 @@
+use std::path::Path;
+
+pub const GDL_ARCHIVE: &str = "archive_gallery-dl.sqlite3";
+pub const YTDLP_ARCHIVE: &str = "archive_yt-dlp.txt";
+pub const UA: &str = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36";
+
+pub const PHOTO_FILTER: &str = "extension in ('jpg','jpeg','png','gif','webp','bmp','jfif','heic','avif','tiff','svg')";
+pub const VIDEO_FILTER: &str = "extension in ('mp4','webm','mkv','mov','avi','m4v','flv','wmv','3gp','mpeg','mpg','ts','f4v','mts','m2ts')";
+
+#[derive(Debug, Clone)]
+pub struct GalleryDlArgsOptions<'a> {
+ pub dest_dir: &'a Path,
+ pub content_type: &'a str,
+ pub platform: &'a str,
+ pub clean_url: &'a str,
+ pub username: &'a str,
+ pub cookie_path: Option<&'a str>,
+ pub custom_ua: Option<&'a str>,
+ pub proxy: Option<&'a str>,
+}
+
+#[derive(Debug, Clone)]
+pub struct YtDlpArgsOptions<'a> {
+ pub dest_dir: &'a Path,
+ pub platform: &'a str,
+ pub clean_url: &'a str,
+ pub cookie_path: Option<&'a str>,
+ pub proxy: Option<&'a str>,
+}
+
+pub fn get_platform_sleep(platform: &str) -> &'static str {
+ match platform.to_lowercase().as_str() {
+ "tiktok" => "0.6-1.2",
+ "instagram" => "2.0-2.8",
+ "facebook" => "1.5-2.5",
+ _ => "0.8-1.5",
+ }
+}
+
+pub fn build_gallery_dl_args(options: &GalleryDlArgsOptions) -> Vec<String> {
+ let mut args: Vec<String> = vec![
+ "-D".to_string(),
+ options.dest_dir.to_string_lossy().to_string(),
+ "-o".to_string(),
+ format!("user-agent={}", options.custom_ua.unwrap_or(UA)),
+ "-o".to_string(),
+ "cookies-update=false".to_string(),
+ "-o".to_string(),
+ "headers.sec-ch-ua=\"Google Chrome\";v=\"131\", \"Chromium\";v=\"131\", \"Not_A Brand\";v=\"24\"".to_string(),
+ "-o".to_string(),
+ "headers.sec-ch-ua-mobile=?0".to_string(),
+ "-o".to_string(),
+ "headers.sec-ch-ua-platform=\"Windows\"".to_string(),
+ "--download-archive".to_string(),
+ options.dest_dir.join(GDL_ARCHIVE).to_string_lossy().to_string(),
+ "--retries".to_string(),
+ "3".to_string(),
+ "--sleep-429".to_string(),
+ "10".to_string(),
+ "--Print".to_string(),
+ "after:FILE_OK:{filename}.{extension}".to_string(),
+ ];
+
+ if let Some(proxy) = options.proxy {
+ if !proxy.trim().is_empty() {
+ args.push("--proxy".to_string());
+ args.push(proxy.to_string());
+ }
+ }
+
+ let sleep_delay = get_platform_sleep(options.platform);
+ let mut target_url = options.clean_url.to_string();
+
+ match options.content_type {
+ "photos" => {
+ args.push("--filter".to_string());
+ args.push(PHOTO_FILTER.to_string());
+ if options.platform.eq_ignore_ascii_case("tiktok") {
+ args.push("-o".to_string());
+ args.push("videos=false".to_string());
+ args.push("-o".to_string());
+ args.push("audio=false".to_string());
+ } else if options.platform.eq_ignore_ascii_case("instagram") {
+ args.push("-o".to_string());
+ args.push("videos=false".to_string());
+ args.push("-o".to_string());
+ args.push("include=posts,reels".to_string());
+ }
+ args.push("--sleep-request".to_string());
+ args.push(sleep_delay.to_string());
+ }
+ "videos" => {
+ args.push("--filter".to_string());
+ args.push(VIDEO_FILTER.to_string());
+ if options.platform.eq_ignore_ascii_case("instagram") {
+ args.push("-o".to_string());
+ args.push("include=posts,reels".to_string());
+ }
+ args.push("--sleep-request".to_string());
+ args.push(sleep_delay.to_string());
+ }
+ "stories" => {
+ if options.platform.eq_ignore_ascii_case("instagram") {
+ args.push("-o".to_string());
+ args.push("include=stories".to_string());
+ args.push("--sleep-request".to_string());
+ args.push("2.0-3.0".to_string());
+ if !options.username.is_empty() {
+ target_url = format!("https://www.instagram.com/stories/{}/", options.username);
+ }
+ }
+ }
+ "highlights" => {
+ if options.platform.eq_ignore_ascii_case("instagram") {
+ args.push("-o".to_string());
+ args.push("include=highlights".to_string());
+ args.push("--sleep-request".to_string());
+ args.push("2.0-3.0".to_string());
+ if !options.username.is_empty() {
+ target_url = format!("https://www.instagram.com/{}/highlights/", options.username);
+ }
+ }
+ }
+ _ => {
+ args.push("--sleep-request".to_string());
+ args.push(sleep_delay.to_string());
+ }
+ }
+
+ if let Some(cookie_path) = options.cookie_path {
+ if !cookie_path.trim().is_empty() {
+ args.push("--cookies".to_string());
+ args.push(cookie_path.to_string());
+ }
+ }
+
+ // Guard against CLI argument injection
+ args.push("--".to_string());
+ args.push(target_url);
+
+ args
+}
+
+pub fn build_yt_dlp_args(options: &YtDlpArgsOptions) -> Vec<String> {
+ let out_template = options.dest_dir.join("%(title).150B [%(id)s].%(ext)s").to_string_lossy().to_string();
+ let mut args: Vec<String> = vec![
+ "-o".to_string(),
+ out_template,
+ "--windows-filenames".to_string(),
+ "--newline".to_string(),
+ "--ignore-errors".to_string(),
+ "--no-overwrites".to_string(),
+ "--user-agent".to_string(),
+ UA.to_string(),
+ "--download-archive".to_string(),
+ options.dest_dir.join(YTDLP_ARCHIVE).to_string_lossy().to_string(),
+ "--concurrent-fragments".to_string(),
+ "4".to_string(),
+ "--retries".to_string(),
+ "3".to_string(),
+ "--fragment-retries".to_string(),
+ "5".to_string(),
+ "--impersonate".to_string(),
+ "chrome".to_string(),
+ ];
+
+ let plat_lower = options.platform.to_lowercase();
+ if plat_lower == "tiktok" {
+ args.push("--sleep-requests".to_string());
+ args.push("0.5:1.2".to_string());
+ args.push("--retry-sleep".to_string());
+ args.push("429:exp=5:30".to_string());
+ } else if plat_lower == "instagram" {
+ args.push("--sleep-requests".to_string());
+ args.push("1.0:2.0".to_string());
+ args.push("--retry-sleep".to_string());
+ args.push("429:exp=5:30".to_string());
+ } else if plat_lower == "x" {
+ args.push("--sleep-requests".to_string());
+ args.push("0.8:1.8".to_string());
+ args.push("--retry-sleep".to_string());
+ args.push("429:exp=5:30".to_string());
+ }
+
+ if let Some(proxy) = options.proxy {
+ if !proxy.trim().is_empty() {
+ args.push("--proxy".to_string());
+ args.push(proxy.to_string());
+ }
+ }
+
+ if let Some(cookie_path) = options.cookie_path {
+ if !cookie_path.trim().is_empty() {
+ args.push("--cookies".to_string());
+ args.push(cookie_path.to_string());
+ }
+ }
+
+ // Guard against CLI argument injection
+ args.push("--".to_string());
+ args.push(options.clean_url.to_string());
+
+ args
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use std::path::PathBuf;
+
+ #[test]
+ fn test_gallery_dl_args_anti_bot_and_injection_guard() {
+ let dest = PathBuf::from("C:/downloads/OpenNami/instagram/test/photos");
+ let opts = GalleryDlArgsOptions {
+ dest_dir: &dest,
+ content_type: "photos",
+ platform: "instagram",
+ clean_url: "https://www.instagram.com/test/",
+ username: "test",
+ cookie_path: Some("C:/cookies/ig.txt"),
+ custom_ua: None,
+ proxy: None,
+ };
+
+ let args = build_gallery_dl_args(&opts);
+
+ assert!(args.contains(&"cookies-update=false".to_string()));
+ assert!(args.contains(&"--sleep-429".to_string()));
+ assert!(args.contains(&"--cookies".to_string()));
+ assert!(args.contains(&"C:/cookies/ig.txt".to_string()));
+
+ let dash_dash_pos = args.iter().position(|r| r == "--").unwrap();
+ assert_eq!(dash_dash_pos, args.len() - 2);
+ assert_eq!(args[args.len() - 1], "https://www.instagram.com/test/");
+ }
+
+ #[test]
+ fn test_yt_dlp_args_impersonate_and_backoff() {
+ let dest = PathBuf::from("C:/downloads/OpenNami/tiktok/creator/videos");
+ let opts = YtDlpArgsOptions {
+ dest_dir: &dest,
+ platform: "tiktok",
+ clean_url: "https://www.tiktok.com/@creator",
+ cookie_path: None,
+ proxy: None,
+ };
+
+ let args = build_yt_dlp_args(&opts);
+
+ assert!(args.contains(&"--impersonate".to_string()));
+ assert!(args.contains(&"chrome".to_string()));
+ assert!(args.contains(&"--retry-sleep".to_string()));
+ assert!(args.contains(&"429:exp=5:30".to_string()));
+
+ let dash_dash_pos = args.iter().position(|r| r == "--").unwrap();
+ assert_eq!(dash_dash_pos, args.len() - 2);
+ assert_eq!(args[args.len() - 1], "https://www.tiktok.com/@creator");
+ }
+}
diff --git a/src-tauri/src/commands/open_nami/cookies.rs b/src-tauri/src/commands/open_nami/cookies.rs
new file mode 100644
index 00000000..b8190c73
--- /dev/null
+++ b/src-tauri/src/commands/open_nami/cookies.rs
@@ -0,0 +1,123 @@
+use std::fs;
+use std::path::{Path, PathBuf};
+use std::time::{SystemTime, UNIX_EPOCH};
+
+pub struct SafeCookieSandbox {
+ pub temp_path: PathBuf,
+}
+
+impl SafeCookieSandbox {
+ pub fn create(master_path: &Path, temp_base: &Path) -> Result<Self, String> {
+ if !master_path.exists() {
+ return Err(format!("Master cookie file does not exist: {}", master_path.display()));
+ }
+
+ fs::create_dir_all(temp_base).map_err(|e| format!("Failed to create temp cookie directory: {}", e))?;
+
+ let timestamp = SystemTime::now()
+ .duration_since(UNIX_EPOCH)
+ .map(|d| d.as_millis())
+ .unwrap_or(0);
+ let rand_suffix: u32 = rand::random();
+ let temp_filename = format!("nami_cookie_{}_{:x}.txt", timestamp, rand_suffix);
+ let temp_path = temp_base.join(temp_filename);
+
+ fs::copy(master_path, &temp_path).map_err(|e| {
+ format!(
+ "Failed to copy cookie file to sandbox {} -> {}: {}",
+ master_path.display(),
+ temp_path.display(),
+ e
+ )
+ })?;
+
+ #[cfg(unix)]
+ {
+ use std::os::unix::fs::PermissionsExt;
+ let perms = fs::Permissions::from_mode(0o600);
+ let _ = fs::set_permissions(&temp_path, perms);
+ }
+
+ Ok(Self { temp_path })
+ }
+
+ pub fn path(&self) -> &Path {
+ &self.temp_path
+ }
+}
+
+impl Drop for SafeCookieSandbox {
+ fn drop(&mut self) {
+ if self.temp_path.exists() {
+ let _ = fs::remove_file(&self.temp_path);
+ }
+ }
+}
+
+pub fn find_candidate_cookie(platform: &str, custom_path: Option<&str>, app_data_dir: &Path) -> Option<PathBuf> {
+ if let Some(custom) = custom_path {
+ let p = PathBuf::from(custom.trim());
+ if p.exists() && fs::metadata(&p).map(|m| m.len() > 10).unwrap_or(false) {
+ return Some(p);
+ }
+ }
+
+ let filenames = match platform.to_lowercase().as_str() {
+ "instagram" => vec!["instagram.com_cookies.txt"],
+ "tiktok" => vec!["tiktok.com_cookies.txt"],
+ "facebook" => vec!["facebook.com_cookies.txt", "fb.com_cookies.txt"],
+ "x" | "twitter" => vec!["x.com_cookies.txt", "twitter.com_cookies.txt"],
+ _ => vec![],
+ };
+
+ let mut candidate_dirs: Vec<PathBuf> = vec![
+ app_data_dir.join("open_nami").join("cookies"),
+ app_data_dir.join("cookies"),
+ ];
+
+ if let Some(user_home) = dirs::home_dir() {
+ candidate_dirs.push(user_home.join(".open-nami").join("cookies"));
+ candidate_dirs.push(user_home.join("cookies"));
+ }
+
+ for dir in candidate_dirs {
+ for fname in &filenames {
+ let full = dir.join(fname);
+ if full.exists() && fs::metadata(&full).map(|m| m.len() > 10).unwrap_or(false) {
+ return Some(full);
+ }
+ }
+ }
+
+ None
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use std::io::Write;
+
+ #[test]
+ fn test_safe_cookie_sandbox_lifecycle() {
+ let temp_dir = std::env::temp_dir().join("opennami_test_cookie");
+ let _ = fs::create_dir_all(&temp_dir);
+
+ let master = temp_dir.join("master_cookies.txt");
+ let mut f = fs::File::create(&master).unwrap();
+ writeln!(f, "# Netscape HTTP Cookie File").unwrap();
+ drop(f);
+
+ let sandbox_dir = temp_dir.join("sandbox");
+ let temp_file_path;
+ {
+ let sandbox = SafeCookieSandbox::create(&master, &sandbox_dir).expect("Create sandbox");
+ temp_file_path = sandbox.path().to_path_buf();
+ assert!(temp_file_path.exists());
+ assert_ne!(temp_file_path, master);
+ }
+ // After exiting block, sandbox is dropped and temp file is automatically cleaned up
+ assert!(!temp_file_path.exists());
+
+ let _ = fs::remove_dir_all(&temp_dir);
+ }
+}
diff --git a/src-tauri/src/commands/open_nami/dispatcher.rs b/src-tauri/src/commands/open_nami/dispatcher.rs
new file mode 100644
index 00000000..1f187a3f
--- /dev/null
+++ b/src-tauri/src/commands/open_nami/dispatcher.rs
@@ -0,0 +1,638 @@
+use super::args::{build_gallery_dl_args, build_yt_dlp_args, GalleryDlArgsOptions, YtDlpArgsOptions};
+use super::cookies::{find_candidate_cookie, SafeCookieSandbox};
+use super::fetcher::{ensure_latest_gallery_dl, resolve_gallery_dl, resolve_yt_dlp};
+use serde::{Deserialize, Serialize};
+use std::collections::{HashMap, VecDeque};
+use std::fs;
+use std::io::{BufRead, BufReader};
+use std::path::{Path, PathBuf};
+use std::process::{Command, Stdio};
+use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
+use std::sync::{Arc, LazyLock, Mutex};
+use std::thread;
+use std::time::Duration;
+use tauri::{AppHandle, Emitter};
+
+#[derive(Debug, Serialize, Deserialize, Clone)]
+pub struct DownloadResult {
+ pub success: bool,
+ pub message: String,
+ pub files_count: u32,
+ pub cancelled: bool,
+}
+
+#[derive(Debug, Serialize, Deserialize, Clone)]
+pub struct DownloadProgress {
+ pub message: String,
+ pub files_downloaded: u32,
+ pub stage: Option<String>,
+ pub stage_index: Option<u32>,
+ pub stage_total: Option<u32>,
+}
+
+struct RunningDownload {
+ pid: Option<u32>,
+ cancelled: Arc<AtomicBool>,
+}
+
+static RUNNING_DOWNLOADS: LazyLock<Mutex<HashMap<String, RunningDownload>>> =
+ LazyLock::new(|| Mutex::new(HashMap::new()));
+
+fn get_running_downloads() -> std::sync::MutexGuard<'static, HashMap<String, RunningDownload>> {
+ RUNNING_DOWNLOADS.lock().unwrap_or_else(|p| p.into_inner())
+}
+
+pub struct DownloadRegistration {
+ pub id: String,
+ pub cancelled: Arc<AtomicBool>,
+}
+
+impl DownloadRegistration {
+ pub fn new(id: &str) -> Result<Self, String> {
+ let mut map = get_running_downloads();
+ if map.contains_key(id) {
+ return Err("A download with this ID is already registered".to_string());
+ }
+ let cancelled = Arc::new(AtomicBool::new(false));
+ map.insert(
+ id.to_string(),
+ RunningDownload {
+ pid: None,
+ cancelled: cancelled.clone(),
+ },
+ );
+ Ok(Self {
+ id: id.to_string(),
+ cancelled,
+ })
+ }
+
+ pub fn is_cancelled(&self) -> bool {
+ self.cancelled.load(Ordering::SeqCst)
+ }
+
+ pub fn set_pid(&self, pid: Option<u32>) {
+ let mut map = get_running_downloads();
+ if let Some(rd) = map.get_mut(&self.id) {
+ rd.pid = pid;
+ }
+ }
+}
+
+impl Drop for DownloadRegistration {
+ fn drop(&mut self) {
+ let pid = get_running_downloads()
+ .remove(&self.id)
+ .and_then(|rd| rd.pid);
+ if let (Some(pid), true) = (pid, thread::panicking()) {
+ kill_process_tree(pid);
+ }
+ }
+}
+
+pub fn kill_process_tree(pid: u32) {
+ #[cfg(target_os = "windows")]
+ {
+ use std::os::windows::process::CommandExt;
+ let mut kill_cmd = Command::new("taskkill");
+ kill_cmd.args(["/PID", &pid.to_string(), "/T", "/F"]);
+ kill_cmd.creation_flags(0x08000000);
+ let _ = kill_cmd.output();
+ }
+ #[cfg(not(target_os = "windows"))]
+ {
+ let _ = Command::new("kill")
+ .args(["-9", &format!("-{}", pid)])
+ .output();
+ }
+}
+
+pub fn cancel_running_download(download_id: &str) -> Result<String, String> {
+ let pid = {
+ let mut map = get_running_downloads();
+ let rd = map
+ .get_mut(download_id)
+ .ok_or("No running download found for that ID")?;
+ rd.cancelled.store(true, Ordering::SeqCst);
+ rd.pid
+ };
+ if let Some(pid) = pid {
+ kill_process_tree(pid);
+ }
+ Ok("Download cancelled".to_string())
+}
+
+pub fn detect_platform_name(url: &str) -> &'static str {
+ let low = url.to_lowercase();
+ let host = if let Some(after_scheme) = low.split("://").nth(1) {
+ after_scheme.split('/').next().unwrap_or("")
+ } else {
+ low.split('/').next().unwrap_or("")
+ };
+ let host = host.split(':').next().unwrap_or("");
+
+ if host == "instagram.com" || host.ends_with(".instagram.com") {
+ "Instagram"
+ } else if host == "tiktok.com" || host.ends_with(".tiktok.com") {
+ "TikTok"
+ } else if host == "facebook.com" || host.ends_with(".facebook.com") {
+ "Facebook"
+ } else if host == "x.com"
+ || host.ends_with(".x.com")
+ || host == "twitter.com"
+ || host.ends_with(".twitter.com")
+ {
+ "X"
+ } else {
+ "Other"
+ }
+}
+
+pub fn sanitize_path_component(input: &str) -> String {
+ let mut cleaned: String = input
+ .chars()
+ .map(|c| {
+ if c.is_ascii_alphanumeric() || c == ' ' || c == '-' || c == '.' || c == '_' {
+ c
+ } else {
+ '_'
+ }
+ })
+ .collect();
+
+ while cleaned.starts_with('.') || cleaned.starts_with('-') || cleaned.starts_with(' ') {
+ cleaned.remove(0);
+ }
+ while cleaned.ends_with('.') || cleaned.ends_with(' ') {
+ cleaned.pop();
+ }
+ while cleaned.contains("..") {
+ cleaned = cleaned.replace("..", "_");
+ }
+ let trimmed = cleaned.trim().trim_matches('_');
+ let lower = trimmed.to_ascii_lowercase();
+ const RESERVED: &[&str] = &[
+ "con", "prn", "aux", "nul", "com1", "com2", "com3", "com4", "com5", "com6", "com7", "com8",
+ "com9", "lpt1", "lpt2", "lpt3", "lpt4", "lpt5", "lpt6", "lpt7", "lpt8", "lpt9",
+ ];
+ if trimmed.is_empty() || RESERVED.contains(&lower.as_str()) {
+ return "unknown_user".to_string();
+ }
+ trimmed.chars().take(120).collect()
+}
+
+pub fn extract_username_generic(url: &str) -> Option<String> {
+ let trimmed = url.trim().trim_end_matches('/');
+ if trimmed.is_empty() {
+ return None;
+ }
+
+ let candidate = if trimmed.contains("://") {
+ let after_scheme = trimmed.split("://").nth(1).unwrap_or(trimmed);
+ let mut parts = after_scheme.split('/');
+ parts.next()?;
+ parts.next()?
+ } else {
+ trimmed
+ };
+
+ let cleaned = candidate.split(['?', '#']).next()?;
+ let cleaned = cleaned.trim_start_matches('@');
+ if cleaned.is_empty() || ["p", "reel", "tv", "stories", "highlights"].contains(&cleaned) {
+ return None;
+ }
+
+ Some(sanitize_path_component(cleaned))
+}
+
+pub async fn execute_download_workflow(
+ app: AppHandle,
+ url: String,
+ output_dir: String,
+ cookies_file: Option<String>,
+ content_type: String,
+ download_id: String,
+ app_data_dir: PathBuf,
+) -> Result<DownloadResult, String> {
+ let reg = DownloadRegistration::new(&download_id)?;
+
+ // 1. Ensure primary engine binary exists (auto-fetch if needed)
+ let gallery_bin = match resolve_gallery_dl(&app_data_dir) {
+ Some(p) => p,
+ None => {
+ let _ = app.emit(
+ &format!("download_{}", download_id),
+ DownloadProgress {
+ message: "Provisioning download engine binary...".to_string(),
+ files_downloaded: 0,
+ stage: Some("Setup".to_string()),
+ stage_index: Some(0),
+ stage_total: Some(1),
+ },
+ );
+ ensure_latest_gallery_dl(&app_data_dir).await?
+ }
+ };
+
+ let yt_bin = resolve_yt_dlp(&app_data_dir);
+
+ // 2. Discover and create ephemeral cookie sandbox if cookies exist
+ let platform_name = detect_platform_name(&url);
+ let resolved_cookie_path = find_candidate_cookie(platform_name, cookies_file.as_deref(), &app_data_dir);
+ let temp_base = app_data_dir.join("open_nami").join("temp");
+ let cookie_sandbox = resolved_cookie_path
+ .as_deref()
+ .and_then(|p| SafeCookieSandbox::create(p, &temp_base).ok());
+
+ let active_cookie_str = cookie_sandbox
+ .as_ref()
+ .map(|s| s.path().to_string_lossy().to_string());
+
+ // 3. Plan stages
+ let mut sub_types: Vec<&str> = match content_type.as_str() {
+ "photos" => vec!["photos"],
+ "videos" => vec!["videos"],
+ "stories" => vec!["stories"],
+ "highlights" => vec!["highlights"],
+ _ => vec!["photos", "videos"],
+ };
+
+ if platform_name == "Instagram" && active_cookie_str.is_some() && content_type == "all" {
+ sub_types.push("stories");
+ sub_types.push("highlights");
+ }
+
+ let stage_total = sub_types.len() as u32;
+ let mut total_files = 0u32;
+ let mut failures: Vec<String> = Vec::new();
+
+ for (idx, sub_type) in sub_types.into_iter().enumerate() {
+ if reg.is_cancelled() {
+ return Ok(DownloadResult {
+ success: false,
+ message: "Download cancelled".to_string(),
+ files_count: total_files,
+ cancelled: true,
+ });
+ }
+
+ let stage_index = idx as u32 + 1;
+ let stage_label = match sub_type {
+ "photos" => "Photos",
+ "videos" => "Videos",
+ "stories" => "Stories",
+ "highlights" => "Highlights",
+ _ => "Media",
+ };
+
+ let _ = app.emit(
+ &format!("download_{}", download_id),
+ DownloadProgress {
+ message: format!("Starting {}", stage_label),
+ files_downloaded: total_files,
+ stage: Some(stage_label.to_string()),
+ stage_index: Some(stage_index),
+ stage_total: Some(stage_total),
+ },
+ );
+
+ match run_single_stage(
+ &app,
+ &gallery_bin,
+ yt_bin.as_deref(),
+ &url,
+ &output_dir,
+ active_cookie_str.as_deref(),
+ sub_type,
+ &reg,
+ platform_name,
+ total_files,
+ stage_index,
+ stage_total,
+ ) {
+ Ok(result) => {
+ total_files += result.files_count;
+ if result.cancelled || reg.is_cancelled() {
+ return Ok(DownloadResult {
+ success: false,
+ message: "Download cancelled".to_string(),
+ files_count: total_files,
+ cancelled: true,
+ });
+ }
+ if !result.success {
+ failures.push(format!("{}: {}", sub_type, result.message));
+ }
+ }
+ Err(e) => {
+ if reg.is_cancelled() {
+ return Ok(DownloadResult {
+ success: false,
+ message: "Download cancelled".to_string(),
+ files_count: total_files,
+ cancelled: true,
+ });
+ }
+ failures.push(format!("{}: {}", sub_type, e));
+ }
+ }
+ }
+
+ if reg.is_cancelled() {
+ return Ok(DownloadResult {
+ success: false,
+ message: "Download cancelled".to_string(),
+ files_count: total_files,
+ cancelled: true,
+ });
+ }
+
+ if failures.is_empty() || total_files > 0 {
+ Ok(DownloadResult {
+ success: true,
+ message: format!(
+ "Download completed successfully. {} files downloaded.",
+ total_files
+ ),
+ files_count: total_files,
+ cancelled: false,
+ })
+ } else {
+ Ok(DownloadResult {
+ success: false,
+ message: failures.join("\n"),
+ files_count: total_files,
+ cancelled: false,
+ })
+ }
+}
+
+fn run_single_stage(
+ app: &AppHandle,
+ gallery_bin: &Path,
+ yt_bin: Option<&Path>,
+ url: &str,
+ output_dir: &str,
+ cookie_path: Option<&str>,
+ content_type: &str,
+ reg: &DownloadRegistration,
+ platform_name: &str,
+ base_count: u32,
+ stage_index: u32,
+ stage_total: u32,
+) -> Result<DownloadResult, String> {
+ if reg.is_cancelled() {
+ return Ok(DownloadResult {
+ success: false,
+ message: "Download cancelled".to_string(),
+ files_count: 0,
+ cancelled: true,
+ });
+ }
+
+ let username = extract_username_generic(url).unwrap_or_else(|| "unknown_user".to_string());
+ let media_folder = match content_type {
+ "photos" => "photos",
+ "videos" => "videos",
+ "stories" => "stories",
+ "highlights" => "highlights",
+ _ => "all",
+ };
+
+ let final_dest = PathBuf::from(output_dir)
+ .join("OpenNami")
+ .join(sanitize_path_component(platform_name))
+ .join(sanitize_path_component(&username))
+ .join(media_folder);
+
+ fs::create_dir_all(&final_dest).map_err(|e| {
+ format!(
+ "Failed to create output folder {}: {}",
+ final_dest.display(),
+ e
+ )
+ })?;
+
+ let media_type_name = match content_type {
+ "photos" => "Photos",
+ "videos" => "Videos",
+ "stories" => "Stories",
+ "highlights" => "Highlights",
+ _ => "Media",
+ };
+
+ // Primary execution via gallery-dl
+ let gdl_opts = GalleryDlArgsOptions {
+ dest_dir: &final_dest,
+ content_type,
+ platform: platform_name,
+ clean_url: url,
+ username: &username,
+ cookie_path,
+ custom_ua: None,
+ proxy: None,
+ };
+ let gdl_args = build_gallery_dl_args(&gdl_opts);
+
+ let gdl_result = run_process_stream(
+ app,
+ gallery_bin,
+ &gdl_args,
+ reg,
+ base_count,
+ media_type_name,
+ stage_index,
+ stage_total,
+ )?;
+
+ // Dual-Engine Fallback for Videos
+ if content_type == "videos" && gdl_result.files_count == 0 && !reg.is_cancelled() {
+ if let Some(yt_executable) = yt_bin {
+ let _ = app.emit(
+ &format!("download_{}", reg.id),
+ DownloadProgress {
+ message: "Switching to secondary video engine (yt-dlp)...".to_string(),
+ files_downloaded: base_count,
+ stage: Some(media_type_name.to_string()),
+ stage_index: Some(stage_index),
+ stage_total: Some(stage_total),
+ },
+ );
+
+ let yt_opts = YtDlpArgsOptions {
+ dest_dir: &final_dest,
+ platform: platform_name,
+ clean_url: url,
+ cookie_path,
+ proxy: None,
+ };
+ let yt_args = build_yt_dlp_args(&yt_opts);
+
+ return run_process_stream(
+ app,
+ yt_executable,
+ &yt_args,
+ reg,
+ base_count,
+ media_type_name,
+ stage_index,
+ stage_total,
+ );
+ }
+ }
+
+ Ok(gdl_result)
+}
+
+fn run_process_stream(
+ app: &AppHandle,
+ executable: &Path,
+ args: &[String],
+ reg: &DownloadRegistration,
+ base_count: u32,
+ stage_label: &str,
+ stage_index: u32,
+ stage_total: u32,
+) -> Result<DownloadResult, String> {
+ let mut cmd = Command::new(executable);
+ cmd.args(args);
+ cmd.stdin(Stdio::null());
+ cmd.stdout(Stdio::piped());
+ cmd.stderr(Stdio::piped());
+
+ #[cfg(target_os = "windows")]
+ {
+ use std::os::windows::process::CommandExt;
+ cmd.creation_flags(0x08000000); // CREATE_NO_WINDOW
+ }
+
+ let mut child = cmd
+ .spawn()
+ .map_err(|e| format!("Failed to start engine {}: {}", executable.display(), e))?;
+
+ let pid = child.id();
+ reg.set_pid(Some(pid));
+
+ if reg.is_cancelled() {
+ kill_process_tree(pid);
+ }
+
+ let stdout = child.stdout.take().ok_or("Failed to capture stdout")?;
+ let stderr = child.stderr.take().ok_or("Failed to capture stderr")?;
+ let files_downloaded = Arc::new(AtomicU32::new(0));
+
+ let stdout_handle = {
+ let app = app.clone();
+ let download_id = reg.id.clone();
+ let files_downloaded = files_downloaded.clone();
+ let stage_label = stage_label.to_string();
+ thread::spawn(move || {
+ let reader = BufReader::new(stdout);
+ for line in reader.lines().map_while(Result::ok) {
+ if let Some(pos) = line.find("FILE_OK:") {
+ let filename = line[pos + "FILE_OK:".len()..].trim();
+ let count = files_downloaded.fetch_add(1, Ordering::SeqCst) + 1;
+ let _ = app.emit(
+ &format!("download_{}", download_id),
+ DownloadProgress {
+ message: format!("Downloaded: {}", filename),
+ files_downloaded: base_count + count,
+ stage: Some(stage_label.clone()),
+ stage_index: Some(stage_index),
+ stage_total: Some(stage_total),
+ },
+ );
+ } else if line.contains("[download]") && line.contains("Destination:") {
+ let count = files_downloaded.fetch_add(1, Ordering::SeqCst) + 1;
+ let _ = app.emit(
+ &format!("download_{}", download_id),
+ DownloadProgress {
+ message: line.trim().to_string(),
+ files_downloaded: base_count + count,
+ stage: Some(stage_label.clone()),
+ stage_index: Some(stage_index),
+ stage_total: Some(stage_total),
+ },
+ );
+ }
+ }
+ })
+ };
+
+ let stderr_tail = Arc::new(Mutex::new(VecDeque::<String>::with_capacity(30)));
+ let stderr_handle = {
+ let app = app.clone();
+ let download_id = reg.id.clone();
+ let files_downloaded = files_downloaded.clone();
+ let stderr_tail = stderr_tail.clone();
+ let stage_label = stage_label.to_string();
+ thread::spawn(move || {
+ let reader = BufReader::new(stderr);
+ for line in reader.lines().map_while(Result::ok) {
+ let trimmed = line.trim();
+ if trimmed.is_empty() {
+ continue;
+ }
+ {
+ let mut tail = stderr_tail.lock().unwrap_or_else(|p| p.into_inner());
+ if tail.len() >= 30 {
+ tail.pop_front();
+ }
+ tail.push_back(line.clone());
+ }
+
+ let lower = trimmed.to_lowercase();
+ if !lower.starts_with("[debug]") && !lower.contains("sleeping") {
+ let count = files_downloaded.load(Ordering::SeqCst);
+ let _ = app.emit(
+ &format!("download_{}", download_id),
+ DownloadProgress {
+ message: trimmed.to_string(),
+ files_downloaded: base_count + count,
+ stage: Some(stage_label.clone()),
+ stage_index: Some(stage_index),
+ stage_total: Some(stage_total),
+ },
+ );
+ }
+ }
+ })
+ };
+
+ let status = child
+ .wait()
+ .map_err(|e| format!("Engine process failed: {}", e))?;
+
+ reg.set_pid(None);
+ let _ = stdout_handle.join();
+ let _ = stderr_handle.join();
+
+ let final_count = files_downloaded.load(Ordering::SeqCst);
+
+ if reg.is_cancelled() {
+ return Ok(DownloadResult {
+ success: false,
+ message: "Download cancelled".to_string(),
+ files_count: final_count,
+ cancelled: true,
+ });
+ }
+
+ if status.success() || final_count > 0 {
+ Ok(DownloadResult {
+ success: true,
+ message: format!("Successfully downloaded {} files", final_count),
+ files_count: final_count,
+ cancelled: false,
+ })
+ } else {
+ let err_tail = stderr_tail.lock().unwrap_or_else(|p| p.into_inner());
+ let err_msg = err_tail.iter().cloned().collect::<Vec<_>>().join("\n");
+ Ok(DownloadResult {
+ success: false,
+ message: if !err_msg.is_empty() { err_msg } else { "Download engine exited with error".to_string() },
+ files_count: final_count,
+ cancelled: false,
+ })
+ }
+}
diff --git a/src-tauri/src/commands/open_nami/fetcher.rs b/src-tauri/src/commands/open_nami/fetcher.rs
new file mode 100644
index 00000000..cf5e4402
--- /dev/null
+++ b/src-tauri/src/commands/open_nami/fetcher.rs
@@ -0,0 +1,192 @@
+use std::fs;
+use std::path::{Path, PathBuf};
+use std::process::{Command, Stdio};
+
+pub const YTDLP_RELEASE_BASE: &str = "https://github.com/yt-dlp/yt-dlp/releases/latest/download";
+pub const GALLERYDL_GITHUB_FALLBACK: &str = "https://github.com/mikf/gallery-dl/releases/latest/download";
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub struct EngineStatus {
+ pub gallery_dl_path: Option<PathBuf>,
+ pub gallery_dl_version: Option<String>,
+ pub yt_dlp_path: Option<PathBuf>,
+ pub yt_dlp_version: Option<String>,
+ pub ready: bool,
+}
+
+pub fn get_open_nami_bin_dir(app_data_dir: &Path) -> PathBuf {
+ app_data_dir.join("open_nami").join("bin")
+}
+
+pub fn gallery_dl_asset_name() -> &'static str {
+ if cfg!(target_os = "windows") {
+ "gallery-dl.exe"
+ } else {
+ "gallery-dl.bin"
+ }
+}
+
+pub fn yt_dlp_asset_name() -> &'static str {
+ if cfg!(target_os = "windows") {
+ "yt-dlp.exe"
+ } else if cfg!(target_os = "macos") {
+ "yt-dlp_macos"
+ } else if cfg!(target_arch = "aarch64") {
+ "yt-dlp_linux_aarch64"
+ } else {
+ "yt-dlp_linux"
+ }
+}
+
+pub fn get_binary_version(executable_path: &Path) -> Option<String> {
+ let mut cmd = Command::new(executable_path);
+ cmd.arg("--version");
+ cmd.stdin(Stdio::null());
+ cmd.stdout(Stdio::piped());
+ cmd.stderr(Stdio::null());
+
+ #[cfg(target_os = "windows")]
+ {
+ use std::os::windows::process::CommandExt;
+ cmd.creation_flags(0x08000000); // CREATE_NO_WINDOW
+ }
+
+ match cmd.output() {
+ Ok(out) if out.status.success() => {
+ let v = String::from_utf8_lossy(&out.stdout).trim().to_string();
+ if !v.is_empty() {
+ Some(v)
+ } else {
+ None
+ }
+ }
+ _ => None,
+ }
+}
+
+pub fn resolve_gallery_dl(app_data_dir: &Path) -> Option<PathBuf> {
+ let bin_dir = get_open_nami_bin_dir(app_data_dir);
+ let local = bin_dir.join(if cfg!(target_os = "windows") { "gallery-dl.exe" } else { "gallery-dl" });
+ if local.exists() {
+ return Some(local);
+ }
+
+ if let Ok(p) = which::which("gallery-dl") {
+ return Some(p);
+ }
+
+ None
+}
+
+pub fn resolve_yt_dlp(app_data_dir: &Path) -> Option<PathBuf> {
+ let bin_dir = get_open_nami_bin_dir(app_data_dir);
+ let local = bin_dir.join(if cfg!(target_os = "windows") { "yt-dlp.exe" } else { "yt-dlp" });
+ if local.exists() {
+ return Some(local);
+ }
+
+ if let Ok(p) = which::which("yt-dlp") {
+ return Some(p);
+ }
+
+ None
+}
+
+pub fn check_engines_status(app_data_dir: &Path) -> EngineStatus {
+ let g_path = resolve_gallery_dl(app_data_dir);
+ let g_ver = g_path.as_deref().and_then(get_binary_version);
+
+ let yt_path = resolve_yt_dlp(app_data_dir);
+ let yt_ver = yt_path.as_deref().and_then(get_binary_version);
+
+ let ready = g_ver.is_some();
+
+ EngineStatus {
+ gallery_dl_path: g_path,
+ gallery_dl_version: g_ver,
+ yt_dlp_path: yt_path,
+ yt_dlp_version: yt_ver,
+ ready,
+ }
+}
+
+pub async fn download_binary(url: &str, target_path: &Path) -> Result<PathBuf, String> {
+ if let Some(parent) = target_path.parent() {
+ fs::create_dir_all(parent).map_err(|e| format!("Failed to create binary dir: {}", e))?;
+ }
+
+ let client = reqwest::Client::builder()
+ .user_agent("omniget-open-nami/1.0")
+ .build()
+ .map_err(|e| format!("Client builder error: {}", e))?;
+
+ let response = client
+ .get(url)
+ .send()
+ .await
+ .map_err(|e| format!("Download request error from {}: {}", url, e))?;
+
+ if !response.status().is_success() {
+ return Err(format!("Download failed with HTTP status {}", response.status()));
+ }
+
+ let bytes = response
+ .bytes()
+ .await
+ .map_err(|e| format!("Failed reading response bytes: {}", e))?;
+
+ let temp_download = target_path.with_extension("download");
+ fs::write(&temp_download, bytes).map_err(|e| format!("Failed writing temp binary: {}", e))?;
+
+ #[cfg(unix)]
+ {
+ use std::os::unix::fs::PermissionsExt;
+ let perms = fs::Permissions::from_mode(0o755);
+ let _ = fs::set_permissions(&temp_download, perms);
+ }
+
+ fs::rename(&temp_download, target_path).map_err(|e| format!("Failed to finalize binary rename: {}", e))?;
+
+ Ok(target_path.to_path_buf())
+}
+
+pub async fn ensure_latest_gallery_dl(app_data_dir: &Path) -> Result<PathBuf, String> {
+ if let Some(existing) = resolve_gallery_dl(app_data_dir) {
+ if get_binary_version(&existing).is_some() {
+ return Ok(existing);
+ }
+ }
+
+ let bin_dir = get_open_nami_bin_dir(app_data_dir);
+ let target = bin_dir.join(if cfg!(target_os = "windows") { "gallery-dl.exe" } else { "gallery-dl" });
+ let url = format!("{}/{}", GALLERYDL_GITHUB_FALLBACK, gallery_dl_asset_name());
+
+ download_binary(&url, &target).await
+}
+
+pub async fn ensure_latest_yt_dlp(app_data_dir: &Path) -> Result<PathBuf, String> {
+ if let Some(existing) = resolve_yt_dlp(app_data_dir) {
+ if get_binary_version(&existing).is_some() {
+ return Ok(existing);
+ }
+ }
+
+ let bin_dir = get_open_nami_bin_dir(app_data_dir);
+ let target = bin_dir.join(if cfg!(target_os = "windows") { "yt-dlp.exe" } else { "yt-dlp" });
+ let url = format!("{}/{}", YTDLP_RELEASE_BASE, yt_dlp_asset_name());
+
+ download_binary(&url, &target).await
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_asset_names() {
+ let g_asset = gallery_dl_asset_name();
+ let yt_asset = yt_dlp_asset_name();
+ assert!(!g_asset.is_empty());
+ assert!(!yt_asset.is_empty());
+ }
+}
diff --git a/src-tauri/src/commands/open_nami/mod.rs b/src-tauri/src/commands/open_nami/mod.rs
new file mode 100644
index 00000000..e6f12607
--- /dev/null
+++ b/src-tauri/src/commands/open_nami/mod.rs
@@ -0,0 +1,398 @@
+pub mod args;
+pub mod cookies;
+pub mod dispatcher;
+pub mod fetcher;
+
+use chrono::Utc;
+pub use dispatcher::{DownloadProgress, DownloadResult};
+use serde::{Deserialize, Serialize};
+use std::fs;
+use std::path::{Path, PathBuf};
+use std::sync::{LazyLock, Mutex};
+use tauri::{command, AppHandle};
+
+#[derive(Debug, Serialize, Deserialize, Clone)]
+pub struct Profile {
+ pub url: String,
+ pub username: Option<String>,
+ pub platform: String,
+ pub added_at: i64,
+}
+
+#[derive(Debug, Serialize, Deserialize, Clone)]
+pub struct AppSettings {
+ pub output_directory: Option<String>,
+ pub cookies_file: Option<String>,
+}
+
+#[derive(Debug, Serialize, Deserialize, Clone)]
+pub struct DependencyStatus {
+ pub ok: bool,
+ pub message: String,
+ pub gallery_dl_version: Option<String>,
+ pub yt_dlp_version: Option<String>,
+ pub auto_provision_available: bool,
+}
+
+static OPEN_NAMI_STORAGE_LOCK: LazyLock<Mutex<()>> = LazyLock::new(|| Mutex::new(()));
+
+pub fn omniget_open_nami_dir() -> Result<PathBuf, String> {
+ let base =
+ omniget_core::core::paths::app_data_dir().ok_or("Could not find app data directory")?;
+ let dir = base.join("open_nami");
+ let legacy_dir = base.join("open_omni");
+
+ // Seamless automatic data migration from legacy open_omni to open_nami
+ if !dir.exists() && legacy_dir.exists() {
+ if let Err(e) = fs::rename(&legacy_dir, &dir) {
+ tracing::warn!("Failed to rename legacy open_omni directory: {}. Creating fresh open_nami dir.", e);
+ } else {
+ tracing::info!("Successfully migrated legacy open_omni user data directory to open_nami.");
+ }
+ }
+
+ fs::create_dir_all(&dir).map_err(|e| format!("Failed to create config dir: {}", e))?;
+ Ok(dir)
+}
+
+pub fn atomic_write(path: &Path, content: &str) -> Result<(), String> {
+ let parent = path.parent().ok_or("Missing parent directory")?;
+ fs::create_dir_all(parent).map_err(|e| format!("Failed to create directory: {}", e))?;
+ let tmp_path = path.with_extension(format!(
+ "tmp.{}",
+ Utc::now().timestamp_nanos_opt().unwrap_or(0)
+ ));
+ fs::write(&tmp_path, content).map_err(|e| format!("Failed to write temporary file: {}", e))?;
+ fs::rename(&tmp_path, path).map_err(|e| {
+ let _ = fs::remove_file(&tmp_path);
+ format!("Failed to commit file {}: {}", path.display(), e)
+ })?;
+ Ok(())
+}
+
+fn validate_profile_platform(platform: &str) -> Result<(), String> {
+ match platform {
+ "instagram" | "tiktok" | "facebook" | "x" => Ok(()),
+ _ => Err("Unsupported profile platform".to_string()),
+ }
+}
+
+fn normalize_profile_url(platform: &str, raw_input: &str) -> String {
+ let trimmed = raw_input.trim();
+
+ if !trimmed.contains("://") && !trimmed.contains('/') {
+ let username = trimmed.trim_start_matches('@').to_lowercase();
+ return match platform {
+ "instagram" => format!("https://www.instagram.com/{}/", username),
+ "tiktok" => format!("https://www.tiktok.com/@{}", username),
+ "facebook" => format!("https://www.facebook.com/{}", username),
+ "x" => format!("https://x.com/{}", username),
+ _ => trimmed.to_string(),
+ };
+ }
+
+ let without_scheme = trimmed
+ .trim_start_matches("https://")
+ .trim_start_matches("http://");
+ let (host_and_path, _) = without_scheme
+ .split_once(['?', '#'])
+ .unwrap_or((without_scheme, ""));
+
+ let mut parts = host_and_path.splitn(2, '/');
+ let host = parts.next().unwrap_or("").to_lowercase();
+ let path = parts.next().unwrap_or("").trim_matches('/');
+
+ let canonical_host = match platform {
+ "instagram" => "www.instagram.com",
+ "tiktok" => "www.tiktok.com",
+ "facebook" => "www.facebook.com",
+ "x" => "x.com",
+ _ => host.trim_start_matches("www."),
+ };
+
+ let path_part = if path.is_empty() {
+ String::new()
+ } else {
+ format!("/{}/", path.to_lowercase())
+ };
+
+ if platform == "tiktok" && !path_part.is_empty() {
+ let user = path.trim_start_matches('@');
+ return format!("https://www.tiktok.com/@{}", user.to_lowercase());
+ }
+
+ format!("https://{}{}", canonical_host, path_part)
+}
+
+#[command]
+pub async fn open_nami_check_python_dependencies() -> Result<DependencyStatus, String> {
+ let app_dir = omniget_open_nami_dir().unwrap_or_else(|_| PathBuf::from("."));
+ let status = fetcher::check_engines_status(&app_dir);
+
+ let ok = status.ready;
+ let message = if ok {
+ "All download engines ready".to_string()
+ } else {
+ "Engine not found (auto-download available)".to_string()
+ };
+
+ Ok(DependencyStatus {
+ ok,
+ message,
+ gallery_dl_version: status.gallery_dl_version,
+ yt_dlp_version: status.yt_dlp_version,
+ auto_provision_available: true,
+ })
+}
+
+#[command]
+pub async fn open_nami_ensure_binaries() -> Result<DependencyStatus, String> {
+ let app_dir = omniget_open_nami_dir()?;
+ let _ = fetcher::ensure_latest_gallery_dl(&app_dir).await;
+ let _ = fetcher::ensure_latest_yt_dlp(&app_dir).await;
+
+ open_nami_check_python_dependencies().await
+}
+
+#[command]
+pub async fn open_nami_run_gallery_dl_download(
+ app: AppHandle,
+ url: String,
+ output_dir: String,
+ cookies_file: Option<String>,
+ content_type: String,
+ download_id: String,
+) -> Result<DownloadResult, String> {
+ let app_dir = omniget_open_nami_dir()?;
+ dispatcher::execute_download_workflow(
+ app,
+ url,
+ output_dir,
+ cookies_file,
+ content_type,
+ download_id,
+ app_dir,
+ )
+ .await
+}
+
+#[command]
+pub async fn open_nami_cancel_download(download_id: String) -> Result<String, String> {
+ dispatcher::cancel_running_download(&download_id)
+}
+
+#[command]
+pub fn open_nami_save_app_settings(
+ output_directory: Option<String>,
+ cookies_file: Option<String>,
+) -> Result<String, String> {
+ let _storage_guard = OPEN_NAMI_STORAGE_LOCK
+ .lock()
+ .unwrap_or_else(|p| p.into_inner());
+
+ let settings = AppSettings {
+ output_directory,
+ cookies_file,
+ };
+
+ let config_dir = omniget_open_nami_dir()?;
+ let settings_file = config_dir.join("app_settings.json");
+ let content = serde_json::to_string_pretty(&settings)
+ .map_err(|e| format!("Failed to serialize settings: {}", e))?;
+
+ atomic_write(&settings_file, &content)?;
+ Ok("Settings saved successfully".to_string())
+}
+
+#[command]
+pub fn open_nami_load_app_settings() -> Result<AppSettings, String> {
+ let _storage_guard = OPEN_NAMI_STORAGE_LOCK
+ .lock()
+ .unwrap_or_else(|p| p.into_inner());
+
+ let settings_file = omniget_open_nami_dir()?.join("app_settings.json");
+ if !settings_file.exists() {
+ return Ok(AppSettings {
+ output_directory: None,
+ cookies_file: None,
+ });
+ }
+
+ let content = fs::read_to_string(&settings_file)
+ .map_err(|e| format!("Failed to read settings: {}", e))?;
+ let settings: AppSettings =
+ serde_json::from_str(&content).map_err(|e| format!("Failed to parse settings: {}", e))?;
+ Ok(settings)
+}
+
+#[command]
+pub fn open_nami_load_profiles(platform: String) -> Result<Vec<Profile>, String> {
+ validate_profile_platform(&platform)?;
+ let _storage_guard = OPEN_NAMI_STORAGE_LOCK
+ .lock()
+ .unwrap_or_else(|p| p.into_inner());
+
+ let profiles_file = omniget_open_nami_dir()?.join("profiles.json");
+ if !profiles_file.exists() {
+ return Ok(vec![]);
+ }
+
+ let content = fs::read_to_string(&profiles_file)
+ .map_err(|e| format!("Failed to read profiles: {}", e))?;
+ let all_profiles: serde_json::Value =
+ serde_json::from_str(&content).map_err(|e| format!("Failed to parse profiles: {}", e))?;
+
+ let platform_profiles = all_profiles
+ .get(&platform)
+ .and_then(|v| v.as_array())
+ .map(|arr| {
+ arr.iter()
+ .filter_map(|v| serde_json::from_value(v.clone()).ok())
+ .collect()
+ })
+ .unwrap_or_default();
+
+ Ok(platform_profiles)
+}
+
+#[command]
+pub fn open_nami_save_profile(platform: String, url: String) -> Result<String, String> {
+ validate_profile_platform(&platform)?;
+ let _storage_guard = OPEN_NAMI_STORAGE_LOCK
+ .lock()
+ .unwrap_or_else(|p| p.into_inner());
+
+ let raw_input = url.trim().to_string();
+ if raw_input.is_empty() {
+ return Err("URL or username cannot be empty".to_string());
+ }
+
+ let url = normalize_profile_url(&platform, &raw_input);
+ let config_dir = omniget_open_nami_dir()?;
+ let profiles_file = config_dir.join("profiles.json");
+
+ let mut all_profiles: serde_json::Value = if profiles_file.exists() {
+ let content = fs::read_to_string(&profiles_file)
+ .map_err(|e| format!("Failed to read profiles: {}", e))?;
+ serde_json::from_str(&content)
+ .map_err(|e| format!("Failed to parse profiles file (corrupted): {}", e))?
+ } else {
+ serde_json::json!({})
+ };
+
+ let username = dispatcher::extract_username_generic(&url);
+
+ if let Some(arr) = all_profiles
+ .as_object()
+ .and_then(|obj| obj.get(&platform))
+ .and_then(|v| v.as_array())
+ {
+ for profile in arr {
+ let existing_url = profile.get("url").and_then(|v| v.as_str());
+ if existing_url == Some(url.as_str()) {
+ return Err("Profile already exists".to_string());
+ }
+ if let Some(existing) = existing_url {
+ if normalize_profile_url(&platform, existing) == url {
+ return Err("Profile already exists".to_string());
+ }
+ }
+ if let Some(new_name) = &username {
+ let existing_name = profile.get("username").and_then(|v| v.as_str());
+ if let Some(existing_name) = existing_name {
+ if !existing_name.is_empty() && existing_name.eq_ignore_ascii_case(new_name) {
+ return Err("Profile already exists".to_string());
+ }
+ }
+ }
+ }
+ }
+
+ let new_profile = serde_json::json!({
+ "url": url,
+ "username": username,
+ "platform": platform,
+ "added_at": Utc::now().timestamp()
+ });
+
+ if let Some(arr) = all_profiles
+ .as_object_mut()
+ .and_then(|obj| obj.get_mut(&platform))
+ .and_then(|v| v.as_array_mut())
+ {
+ arr.push(new_profile);
+ } else if let Some(obj) = all_profiles.as_object_mut() {
+ obj.insert(platform.clone(), serde_json::json!([new_profile]));
+ }
+
+ let content = serde_json::to_string_pretty(&all_profiles)
+ .map_err(|e| format!("Failed to serialize: {}", e))?;
+
+ atomic_write(&profiles_file, &content)?;
+ Ok("Profile saved successfully".to_string())
+}
+
+#[command]
+pub fn open_nami_delete_profile(platform: String, profile_url: String) -> Result<String, String> {
+ validate_profile_platform(&platform)?;
+ let _storage_guard = OPEN_NAMI_STORAGE_LOCK
+ .lock()
+ .unwrap_or_else(|p| p.into_inner());
+
+ let profiles_file = omniget_open_nami_dir()?.join("profiles.json");
+ if !profiles_file.exists() {
+ return Err("Profiles file not found".to_string());
+ }
+
+ let content = fs::read_to_string(&profiles_file)
+ .map_err(|e| format!("Failed to read profiles: {}", e))?;
+ let mut all_profiles: serde_json::Value =
+ serde_json::from_str(&content).map_err(|e| format!("Failed to parse profiles: {}", e))?;
+
+ let normalized_target = normalize_profile_url(&platform, &profile_url);
+
+ let deleted = all_profiles
+ .as_object_mut()
+ .and_then(|obj| obj.get_mut(&platform))
+ .and_then(|v| v.as_array_mut())
+ .map(|arr| {
+ let len_before = arr.len();
+ arr.retain(|p| {
+ let u = p.get("url").and_then(|u| u.as_str()).unwrap_or("");
+ u != profile_url && normalize_profile_url(&platform, u) != normalized_target
+ });
+ len_before != arr.len()
+ })
+ .unwrap_or(false);
+
+ if !deleted {
+ return Err("Profile not found".to_string());
+ }
+
+ let content = serde_json::to_string_pretty(&all_profiles)
+ .map_err(|e| format!("Failed to serialize: {}", e))?;
+
+ atomic_write(&profiles_file, &content)?;
+ Ok("Profile deleted".to_string())
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_normalize_profile_url() {
+ assert_eq!(
+ normalize_profile_url("instagram", "selenagomez"),
+ "https://www.instagram.com/selenagomez/"
+ );
+ assert_eq!(
+ normalize_profile_url("tiktok", "@creator"),
+ "https://www.tiktok.com/@creator"
+ );
+ assert_eq!(
+ normalize_profile_url("x", "OpenSelena"),
+ "https://x.com/OpenSelena"
+ );
+ }
+}
diff --git a/src-tauri/src/core/flight_recorder.rs b/src-tauri/src/core/flight_recorder.rs
index f8c2dec6..f5dae1c0 100644
--- a/src-tauri/src/core/flight_recorder.rs
+++ b/src-tauri/src/core/flight_recorder.rs
@@ -231,7 +231,7 @@ mod tests {
// Path pessoal identifica a pessoa sozinho, e e o que mais aparece em
// log colado em issue publica.
for (entrada, proibido) in [
- ("/Users/tonho/Downloads/x.mp4", "tonho"),
+ ("/Users/openselena/Downloads/x.mp4", "openselena"),
("/home/maria/videos", "maria"),
("C:\\Users\\Joao\\AppData", "Joao"),
] {
diff --git a/src-tauri/src/core/rpc.rs b/src-tauri/src/core/rpc.rs
index fad9fe9f..df5a42f2 100644
--- a/src-tauri/src/core/rpc.rs
+++ b/src-tauri/src/core/rpc.rs
@@ -9,7 +9,7 @@ use serde_json::{json, Value};
pub use omniget_core::models::settings::RpcSettings;
const GITHUB_BUTTON_LABEL: &str = "View on GitHub";
-const GITHUB_BUTTON_URL: &str = "https://github.com/tonhowtf/omniget";
+const GITHUB_BUTTON_URL: &str = "https://github.com/OpenSelena/omniget";
const APP_LARGE_TEXT: &str = "omniget";
const SOURCE_PRIORITIES: &[&str] = &["focus", "music", "video", "course", "reading"];
diff --git a/src-tauri/src/extension_storage.rs b/src-tauri/src/extension_storage.rs
index 6e8314d0..b7e9f1a6 100644
--- a/src-tauri/src/extension_storage.rs
+++ b/src-tauri/src/extension_storage.rs
@@ -350,7 +350,7 @@ pub fn read_extension_metadata(url: &str) -> Option<ExtensionMetadata> {
/// best we can do is delete the files and let Chrome / Firefox skip them
/// silently the next time they look for a host.
pub fn cleanup_legacy_native_messaging() {
- let host_name = "wtf.tonho.omniget";
+ let host_names = ["wtf.tonho.omniget", "com.openselena.omniget"];
if let Some(data_dir) = crate::core::paths::app_data_dir() {
let dir = data_dir.join("chrome-native-host");
@@ -359,61 +359,63 @@ pub fn cleanup_legacy_native_messaging() {
}
}
- #[cfg(target_os = "linux")]
- {
- if let Some(config_dir) = dirs::config_dir() {
- let chrome = config_dir
- .join("google-chrome")
- .join("NativeMessagingHosts")
- .join(format!("{host_name}.json"));
- let _ = std::fs::remove_file(chrome);
- }
- if let Some(home) = dirs::home_dir() {
- let firefox = home
- .join(".mozilla")
- .join("native-messaging-hosts")
- .join(format!("{host_name}.json"));
- let _ = std::fs::remove_file(firefox);
+ for host_name in host_names {
+ #[cfg(target_os = "linux")]
+ {
+ if let Some(config_dir) = dirs::config_dir() {
+ let chrome = config_dir
+ .join("google-chrome")
+ .join("NativeMessagingHosts")
+ .join(format!("{host_name}.json"));
+ let _ = std::fs::remove_file(chrome);
+ }
+ if let Some(home) = dirs::home_dir() {
+ let firefox = home
+ .join(".mozilla")
+ .join("native-messaging-hosts")
+ .join(format!("{host_name}.json"));
+ let _ = std::fs::remove_file(firefox);
+ }
}
- }
- #[cfg(target_os = "macos")]
- {
- if let Some(data_dir) = dirs::data_dir() {
- let chrome = data_dir
- .join("Google")
- .join("Chrome")
- .join("NativeMessagingHosts")
- .join(format!("{host_name}.json"));
- let _ = std::fs::remove_file(chrome);
- }
- if let Some(home) = dirs::home_dir() {
- let firefox = home
- .join("Library")
- .join("Application Support")
- .join("Mozilla")
- .join("NativeMessagingHosts")
- .join(format!("{host_name}.json"));
- let _ = std::fs::remove_file(firefox);
+ #[cfg(target_os = "macos")]
+ {
+ if let Some(data_dir) = dirs::data_dir() {
+ let chrome = data_dir
+ .join("Google")
+ .join("Chrome")
+ .join("NativeMessagingHosts")
+ .join(format!("{host_name}.json"));
+ let _ = std::fs::remove_file(chrome);
+ }
+ if let Some(home) = dirs::home_dir() {
+ let firefox = home
+ .join("Library")
+ .join("Application Support")
+ .join("Mozilla")
+ .join("NativeMessagingHosts")
+ .join(format!("{host_name}.json"));
+ let _ = std::fs::remove_file(firefox);
+ }
}
- }
- #[cfg(target_os = "windows")]
- {
- // Remove the registry keys created by the legacy `ensure_registered`
- // path. Failure (key absent, no permissions) is fine — we ignore it.
- use std::os::windows::process::CommandExt;
- const CREATE_NO_WINDOW: u32 = 0x08000000;
-
- for vendor in ["Google\\Chrome", "Mozilla"] {
- let _ = std::process::Command::new("reg")
- .args([
- "delete",
- &format!("HKCU\\Software\\{vendor}\\NativeMessagingHosts\\{host_name}"),
- "/f",
- ])
- .creation_flags(CREATE_NO_WINDOW)
- .status();
+ #[cfg(target_os = "windows")]
+ {
+ // Remove the registry keys created by the legacy `ensure_registered`
+ // path. Failure (key absent, no permissions) is fine — we ignore it.
+ use std::os::windows::process::CommandExt;
+ const CREATE_NO_WINDOW: u32 = 0x08000000;
+
+ for vendor in ["Google\\Chrome", "Mozilla"] {
+ let _ = std::process::Command::new("reg")
+ .args([
+ "delete",
+ &format!("HKCU\\Software\\{vendor}\\NativeMessagingHosts\\{host_name}"),
+ "/f",
+ ])
+ .creation_flags(CREATE_NO_WINDOW)
+ .status();
+ }
}
}
}
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 89e84663..c6edc4a3 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -24,11 +24,19 @@ fn check_portable_mode() {
// OS profile. Adopt that file once if the portable dir has none.
let portable_settings = data_dir.join("settings.json");
if !portable_settings.exists() {
- if let Some(os_settings) = dirs::data_dir()
- .map(|d| d.join("wtf.tonho.omniget").join("settings.json"))
- .filter(|p| p.exists())
- {
- let _ = std::fs::copy(&os_settings, &portable_settings);
+ if let Some(base) = dirs::data_dir() {
+ let modern_settings = base.join("com.openselena.omniget").join("settings.json");
+ let legacy_settings = base.join("wtf.tonho.omniget").join("settings.json");
+ let source = if modern_settings.exists() {
+ Some(modern_settings)
+ } else if legacy_settings.exists() {
+ Some(legacy_settings)
+ } else {
+ None
+ };
+ if let Some(src) = source {
+ let _ = std::fs::copy(&src, &portable_settings);
+ }
}
}
}
diff --git a/src-tauri/src/plugin_host.rs b/src-tauri/src/plugin_host.rs
index 48e2f30c..9b1f6c37 100644
--- a/src-tauri/src/plugin_host.rs
+++ b/src-tauri/src/plugin_host.rs
@@ -137,7 +137,7 @@ impl<R: Runtime + 'static> PluginHost for PluginHostImpl<R> {
"external_data_cache: OS cache dir unavailable on this platform"
)
})?
- .join("wtf.tonho.omniget")
+ .join("com.openselena.omniget")
};
let dir = base.join("external-cache").join(plugin_id).join(namespace);
std::fs::create_dir_all(&dir).map_err(|e| {
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 9a0ad305..39f3dfe0 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -2,7 +2,7 @@
"$schema": "https://schema.tauri.app/config/2",
"productName": "omniget",
"version": "0.9.2",
- "identifier": "wtf.tonho.omniget",
+ "identifier": "com.openselena.omniget",
"build": {
"beforeDevCommand": "pnpm dev",
"devUrl": "http://localhost:1420",
@@ -41,9 +41,9 @@
},
"plugins": {
"updater": {
- "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDYyOTlEMzE0MUJDMkREMTkKUldRWjNjSWJGTk9aWWtnazV5aTdTNTZ4dk93TVh3cUpxSWlpclRXNjlwYXA1ZXdrdlZsYUxQYzkK",
+ "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDlCNTZBNUMzRTY2MEIwN0MKUldSOHNHRG13NlZXbTc2N0Z0aTV5elV3MGQ2ci9zUm1jOHpna2ozY2pJRkJMSEdXNU5UeU0rZ0sK",
"endpoints": [
- "https://github.com/tonhowtf/omniget/releases/latest/download/latest.json"
+ "https://github.com/OpenSelena/omniget/releases/latest/download/latest.json"
]
},
"deep-link": {
diff --git a/src/components/tools/youtube/CodecTool.svelte b/src/components/tools/youtube/CodecTool.svelte
index 64ed0396..67797b67 100644
--- a/src/components/tools/youtube/CodecTool.svelte
+++ b/src/components/tools/youtube/CodecTool.svelte
@@ -36,7 +36,7 @@
<div class="group-row"><div class="group-row-content"><div class="group-row-title">{$t("tools.codec.how")}</div><ol class="steps"><li>{$t("tools.codec.step1")}</li><li>{$t("tools.codec.step2")}</li><li>{$t("tools.codec.step3")}</li></ol></div></div>
<div class="group-row">
<div class="group-row-content"><div class="group-row-title">{$t("tools.codec.extension")}</div><div class="group-row-sub">{$t("tools.codec.extension_hint")}</div></div>
- <div class="group-row-trailing btn-row"><a class="btn btn-secondary btn-sm" href="/settings">{$t("tools.codec.open_settings")}</a><button class="btn btn-ghost btn-sm" type="button" onclick={() => openUrl("https://github.com/tonhowtf/omniget#browser-extension")}>GitHub</button></div>
+ <div class="group-row-trailing btn-row"><a class="btn btn-secondary btn-sm" href="/settings">{$t("tools.codec.open_settings")}</a><button class="btn btn-ghost btn-sm" type="button" onclick={() => openUrl("https://github.com/OpenSelena/omniget#browser-extension")}>GitHub</button></div>
</div>
</div>
</section>
diff --git a/src/lib/api/open_nami.ts b/src/lib/api/open_nami.ts
index a9c051c5..0087a1ca 100644
--- a/src/lib/api/open_nami.ts
+++ b/src/lib/api/open_nami.ts
@@ -32,12 +32,18 @@ export interface DependencyStatus {
ok: boolean;
message: string;
gallery_dl_version: string | null;
+ yt_dlp_version?: string | null;
+ auto_provision_available?: boolean;
}
export async function checkPythonDependencies(): Promise<DependencyStatus> {
return await invoke<DependencyStatus>('open_nami_check_python_dependencies');
}
+export async function ensureBinaries(): Promise<DependencyStatus> {
+ return await invoke<DependencyStatus>('open_nami_ensure_binaries');
+}
+
export async function runGalleryDlDownload(
url: string,
outputDir: string,
diff --git a/src/lib/i18n/el.json b/src/lib/i18n/el.json
index 8b522cc0..0b3b95a0 100644
--- a/src/lib/i18n/el.json
+++ b/src/lib/i18n/el.json
@@ -4049,7 +4049,7 @@
"silence_done": "Βρέθηκε σιωπή {{saved}} — ο player μπορεί να την προσπερνά",
"portable_label": "Portable Mode",
"portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
- "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/OpenSelena/omniget/issues/227."
},
"dependencies": {
"title": "Εξαρτήσεις",
@@ -4584,7 +4584,7 @@
"roadmap_community_discord": "βρείτε μας στο discord:",
"roadmap_community_issue": "ή ανοίξτε ένα θέμα (issue) στο αποθετήριο:",
"tagline": "Κατεβάστε οτιδήποτε, από οπουδήποτε.",
- "credit": "Φτιαγμένο με αγάπη από tonho.wtf"
+ "credit": "Φτιαγμένο με αγάπη από OpenSelena IGECT"
},
"marketplace": {
"title": "Marketplace",
diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json
index da7d78cf..64f2b52c 100644
--- a/src/lib/i18n/en.json
+++ b/src/lib/i18n/en.json
@@ -4049,7 +4049,7 @@
"silence_done": "{{saved}} of silence found — playback can skip it",
"portable_label": "Portable Mode",
"portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
- "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/OpenSelena/omniget/issues/227."
},
"dependencies": {
"title": "Dependencies",
@@ -4584,7 +4584,7 @@
"roadmap_community_discord": "reach out on discord:",
"roadmap_community_issue": "or open an issue on the repository:",
"tagline": "Download anything, from anywhere.",
- "credit": "Made with love by tonho.wtf"
+ "credit": "Made with love by OpenSelena IGECT"
},
"marketplace": {
"title": "Marketplace",
diff --git a/src/lib/i18n/es.json b/src/lib/i18n/es.json
index 646dfe55..c022038a 100644
--- a/src/lib/i18n/es.json
+++ b/src/lib/i18n/es.json
@@ -4049,7 +4049,7 @@
"silence_done": "{{saved}} de silencio encontrado: el reproductor puede saltarlo",
"portable_label": "Portable Mode",
"portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
- "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/OpenSelena/omniget/issues/227."
},
"dependencies": {
"title": "Dependencias",
@@ -4584,7 +4584,7 @@
"roadmap_community_discord": "habla con nosotros en discord:",
"roadmap_community_issue": "o abre un issue en el repositorio:",
"tagline": "Descarga lo que sea, desde donde sea.",
- "credit": "Hecho con cariño por tonho.wtf"
+ "credit": "Hecho con cariño por OpenSelena IGECT"
},
"marketplace": {
"title": "Marketplace",
diff --git a/src/lib/i18n/fa.json b/src/lib/i18n/fa.json
index 5f4cf113..1463d9b2 100644
--- a/src/lib/i18n/fa.json
+++ b/src/lib/i18n/fa.json
@@ -4049,7 +4049,7 @@
"silence_done": "{{saved}} of silence found — playback can skip it",
"portable_label": "Portable Mode",
"portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
- "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/OpenSelena/omniget/issues/227."
},
"dependencies": {
"title": "Dependencies",
@@ -4584,7 +4584,7 @@
"roadmap_community_discord": "reach out on discord:",
"roadmap_community_issue": "or open an issue on the repository:",
"tagline": "Download anything, from anywhere.",
- "credit": "Made with love by tonho.wtf"
+ "credit": "Made with love by OpenSelena IGECT"
},
"marketplace": {
"title": "Marketplace",
diff --git a/src/lib/i18n/fr.json b/src/lib/i18n/fr.json
index 6a285815..ead7ca6b 100644
--- a/src/lib/i18n/fr.json
+++ b/src/lib/i18n/fr.json
@@ -4049,7 +4049,7 @@
"silence_done": "{{saved}} de silence trouvé — le lecteur peut le sauter",
"portable_label": "Portable Mode",
"portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
- "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/OpenSelena/omniget/issues/227."
},
"dependencies": {
"title": "Dépendances",
@@ -4584,7 +4584,7 @@
"roadmap_community_discord": "contactez-nous sur discord :",
"roadmap_community_issue": "ou ouvrez une issue sur le dépôt :",
"tagline": "Téléchargez tout, de partout.",
- "credit": "Fait avec amour par tonho.wtf"
+ "credit": "Fait avec amour par OpenSelena IGECT"
},
"marketplace": {
"title": "Marketplace",
diff --git a/src/lib/i18n/it.json b/src/lib/i18n/it.json
index ea52f2c0..4e334e95 100644
--- a/src/lib/i18n/it.json
+++ b/src/lib/i18n/it.json
@@ -4049,7 +4049,7 @@
"silence_done": "{{saved}} di silenzio trovato — il player può saltarlo",
"portable_label": "Portable Mode",
"portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
- "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/OpenSelena/omniget/issues/227."
},
"dependencies": {
"title": "Dipendenze",
@@ -4584,7 +4584,7 @@
"roadmap_community_discord": "scrivici su Discord:",
"roadmap_community_issue": "oppure apri una issue nel repository:",
"tagline": "Scarica qualsiasi cosa, da qualsiasi luogo.",
- "credit": "Fatto con amore da tonho.wtf"
+ "credit": "Fatto con amore da OpenSelena IGECT"
},
"marketplace": {
"title": "Marketplace",
diff --git a/src/lib/i18n/ja.json b/src/lib/i18n/ja.json
index 4ba7d43d..62fd3c38 100644
--- a/src/lib/i18n/ja.json
+++ b/src/lib/i18n/ja.json
@@ -4049,7 +4049,7 @@
"silence_done": "無音 {{saved}} 分を検出 — 再生時にスキップできます",
"portable_label": "Portable Mode",
"portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
- "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/OpenSelena/omniget/issues/227."
},
"dependencies": {
"title": "依存関係",
@@ -4584,7 +4584,7 @@
"roadmap_community_discord": "Discordでお気軽にどうぞ:",
"roadmap_community_issue": "またはリポジトリでIssueを作成してください:",
"tagline": "どこからでも、何でもダウンロード。",
- "credit": "tonho.wtf が愛を込めて作りました"
+ "credit": "OpenSelena IGECT が愛を込めて作りました"
},
"marketplace": {
"title": "マーケットプレイス",
diff --git a/src/lib/i18n/lo.json b/src/lib/i18n/lo.json
index 0747164b..b694e755 100644
--- a/src/lib/i18n/lo.json
+++ b/src/lib/i18n/lo.json
@@ -3871,6 +3871,7 @@
"section_per_platform": "ຕົວເລືອກຕາມແພລດຟອມ",
"section_per_platform_desc": "ການຕັ້ງຄ່າສະເພາະ YouTube, ຄອສຮຽນ ແລະ Bilibili.",
"download_attachments": "ດາວໂຫຼດໄຟລ໌ແນບ",
+ "download_attachments_desc": "ບັນທຶກໄຟລ໌ແນບຂອງຄອສຮຽນໄວ້ຂ້າງບົດຮຽນທີ່ດາວໂຫຼດ.",
"download_descriptions": "ບັນທຶກຄຳອະທິບາຍ",
"embed_metadata": "ຝັງເມຕາເດຕາ",
"embed_metadata_desc": "ຂຽນຊື່ ແລະ ຂໍ້ມູນສິລະປິນລົງໃນໄຟລ໌ທີ່ດາວໂຫຼດ",
@@ -4048,7 +4049,7 @@
"silence_done": "ພົບຊ່ວງງຽບ {{saved}} — ການຫຼິ້ນສາມາດຂ້າມໄດ້",
"portable_label": "ໂໝດພົກພາ",
"portable_active": "ໂໝດພົກພາເປີດໃຊ້ຢູ່. ຂໍ້ມູນຂອງ OmniGet ຖືກເກັບໄວ້ໃນ {{dir}}.",
- "portable_macos_notice": "ໃນ macOS, WebView ຍັງເກັບຂໍ້ມູນເຊສຊັນໄວ້ພາຍໃຕ້ ~/Library ແລະ ໂໝດພົກພາບໍ່ສາມາດປ່ຽນເສັ້ນທາງໄດ້. ມີແຕ່ຂໍ້ມູນຂອງ OmniGet ເອງທີ່ພົກພາໄດ້ — ເບິ່ງ github.com/tonhowtf/omniget/issues/227."
+ "portable_macos_notice": "ໃນ macOS, WebView ຍັງເກັບຂໍ້ມູນເຊສຊັນໄວ້ພາຍໃຕ້ ~/Library ແລະ ໂໝດພົກພາບໍ່ສາມາດປ່ຽນເສັ້ນທາງໄດ້. ມີແຕ່ຂໍ້ມູນຂອງ OmniGet ເອງທີ່ພົກພາໄດ້ — ເບິ່ງ github.com/OpenSelena/omniget/issues/227."
},
"dependencies": {
"title": "ສ່ວນປະກອບທີ່ຈຳເປັນ",
@@ -4583,7 +4584,7 @@
"roadmap_community_discord": "ຕິດຕໍ່ຫາພວກເຮົາໃນ discord:",
"roadmap_community_issue": "ຫຼື ເປີດ issue ໃນ repository:",
"tagline": "ດາວໂຫຼດທຸກຢ່າງ, ຈາກທຸກບ່ອນ.",
- "credit": "ສ້າງດ້ວຍຄວາມຮັກໂດຍ tonho.wtf"
+ "credit": "ສ້າງດ້ວຍຄວາມຮັກໂດຍ OpenSelena IGECT"
},
"marketplace": {
"title": "ຕະຫຼາດ",
diff --git a/src/lib/i18n/pt.json b/src/lib/i18n/pt.json
index 8de786f7..246ca7bd 100644
--- a/src/lib/i18n/pt.json
+++ b/src/lib/i18n/pt.json
@@ -4049,7 +4049,7 @@
"silence_done": "{{saved}} de silêncio encontrado — o player pode pular",
"portable_label": "Portable Mode",
"portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
- "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/OpenSelena/omniget/issues/227."
},
"dependencies": {
"title": "Dependências",
@@ -4584,7 +4584,7 @@
"roadmap_community_discord": "me chama no discord:",
"roadmap_community_issue": "ou abra uma issue no repositório:",
"tagline": "Baixe qualquer coisa, de qualquer lugar.",
- "credit": "Feito com amor por tonho.wtf"
+ "credit": "Feito com amor por OpenSelena IGECT"
},
"marketplace": {
"title": "Marketplace",
diff --git a/src/lib/i18n/ru.json b/src/lib/i18n/ru.json
index 019698f4..ae31d363 100644
--- a/src/lib/i18n/ru.json
+++ b/src/lib/i18n/ru.json
@@ -4049,7 +4049,7 @@
"silence_done": "Найдено тишины: {{saved}} — плеер может её пропускать",
"portable_label": "Portable Mode",
"portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
- "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/OpenSelena/omniget/issues/227."
},
"dependencies": {
"title": "Зависимости",
@@ -4584,7 +4584,7 @@
"roadmap_community_discord": "свяжитесь с нами в Discord:",
"roadmap_community_issue": "или откройте задачу в репозитории:",
"tagline": "Скачивайте что угодно, откуда угодно.",
- "credit": "Сделано с любовью tonho.wtf"
+ "credit": "Сделано с любовью OpenSelena IGECT"
},
"marketplace": {
"title": "Маркетплейс",
diff --git a/src/lib/i18n/zh-TW.json b/src/lib/i18n/zh-TW.json
index 1b0c02f9..289c2bd5 100644
--- a/src/lib/i18n/zh-TW.json
+++ b/src/lib/i18n/zh-TW.json
@@ -4049,7 +4049,7 @@
"silence_done": "發現 {{saved}} 的靜音 —— 播放時可以略過",
"portable_label": "Portable Mode",
"portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
- "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/OpenSelena/omniget/issues/227."
},
"dependencies": {
"title": "相依元件",
@@ -4584,7 +4584,7 @@
"roadmap_community_discord": "可透過 Discord 聯絡:",
"roadmap_community_issue": "或在專案儲存庫建立 Issue:",
"tagline": "隨時隨地,下載一切。",
- "credit": "由 tonho.wtf 用心打造"
+ "credit": "由 OpenSelena IGECT 用心打造"
},
"marketplace": {
"title": "插件市场",
diff --git a/src/lib/i18n/zh.json b/src/lib/i18n/zh.json
index 862bf1b3..09906f55 100644
--- a/src/lib/i18n/zh.json
+++ b/src/lib/i18n/zh.json
@@ -4049,7 +4049,7 @@
"silence_done": "发现 {{saved}} 的静音 —— 播放时可以跳过",
"portable_label": "Portable Mode",
"portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
- "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/OpenSelena/omniget/issues/227."
},
"dependencies": {
"title": "依赖项",
@@ -4584,7 +4584,7 @@
"roadmap_community_discord": "在 Discord 上联系我们:",
"roadmap_community_issue": "或在代码仓库中提交 Issue:",
"tagline": "随时随地,下载一切。",
- "credit": "由 tonho.wtf 用心打造"
+ "credit": "由 OpenSelena IGECT 用心打造"
},
"marketplace": {
"title": "插件市场",
diff --git a/src/lib/stores/changelog-store.svelte.ts b/src/lib/stores/changelog-store.svelte.ts
index da64be36..fa5b0e93 100644
--- a/src/lib/stores/changelog-store.svelte.ts
+++ b/src/lib/stores/changelog-store.svelte.ts
@@ -71,7 +71,7 @@ export async function fetchChangelog(): Promise<string> {
try {
const res = await fetch(
- `https://api.github.com/repos/tonhowtf/omniget/releases/tags/v${currentVersion}`,
+ `https://api.github.com/repos/OpenSelena/omniget/releases/tags/v${currentVersion}`,
{ headers: { Accept: "application/vnd.github.v3+json" } }
);
if (res.ok) {
@@ -85,7 +85,7 @@ export async function fetchChangelog(): Promise<string> {
try {
const res = await fetch(
- "https://api.github.com/repos/tonhowtf/omniget/releases/latest",
+ "https://api.github.com/repos/OpenSelena/omniget/releases/latest",
{ headers: { Accept: "application/vnd.github.v3+json" } }
);
if (res.ok) {
diff --git a/src/lib/stores/open_nami_deps_store.svelte.ts b/src/lib/stores/open_nami_deps_store.svelte.ts
index 1c54460b..8a71134e 100644
--- a/src/lib/stores/open_nami_deps_store.svelte.ts
+++ b/src/lib/stores/open_nami_deps_store.svelte.ts
@@ -1,4 +1,4 @@
-import { checkPythonDependencies, type DependencyStatus } from '$lib/api/open_nami';
+import { checkPythonDependencies, ensureBinaries, type DependencyStatus } from '$lib/api/open_nami';
let status = $state<DependencyStatus | null>(null);
let checking = $state(false);
@@ -27,7 +27,9 @@ export async function ensureDependenciesChecked(force = false): Promise<Dependen
status = {
ok: false,
message: err instanceof Error ? err.message : String(err),
- gallery_dl_version: null
+ gallery_dl_version: null,
+ yt_dlp_version: null,
+ auto_provision_available: true
};
} finally {
checking = false;
@@ -38,3 +40,22 @@ export async function ensureDependenciesChecked(force = false): Promise<Dependen
await inflight;
return status;
}
+
+export async function autoInstallEngines(): Promise<DependencyStatus | null> {
+ checking = true;
+ try {
+ status = await ensureBinaries();
+ } catch (err: unknown) {
+ status = {
+ ok: false,
+ message: err instanceof Error ? err.message : String(err),
+ gallery_dl_version: null,
+ yt_dlp_version: null,
+ auto_provision_available: true
+ };
+ } finally {
+ checking = false;
+ }
+ return status;
+}
+
diff --git a/src/lib/stores/open_nami_download_store.svelte.ts b/src/lib/stores/open_nami_download_store.svelte.ts
index 0e56d1b0..5d0b9fe1 100644
--- a/src/lib/stores/open_nami_download_store.svelte.ts
+++ b/src/lib/stores/open_nami_download_store.svelte.ts
@@ -6,6 +6,7 @@ import {
type DownloadProgress,
type DownloadResult,
} from "$lib/api/open_nami";
+import { parseProfileUrl } from "$lib/utils/open_nami_parser";
export type StatusType = "success" | "error" | "info";
@@ -130,7 +131,8 @@ export async function startDownload(
throw new Error("A download is already in progress");
}
- const cleanUrl = url.trim();
+ const parsed = parseProfileUrl(url.trim());
+ const cleanUrl = parsed.cleanUrl || url.trim();
const cleanOutputDir = outputDir.trim();
const cleanCookiesFile = cookiesFile.trim();
diff --git a/src/lib/study-music-components/AboutLink.svelte b/src/lib/study-music-components/AboutLink.svelte
index 7d1f5672..5f437555 100644
--- a/src/lib/study-music-components/AboutLink.svelte
+++ b/src/lib/study-music-components/AboutLink.svelte
@@ -8,7 +8,7 @@
let { variant = "inline", text }: Props = $props();
- const url = "https://github.com/tonhowtf/omniget";
+ const url = "https://github.com/OpenSelena/omniget";
async function open() {
try {
diff --git a/src/lib/tracker-bridge.ts b/src/lib/tracker-bridge.ts
new file mode 100644
index 00000000..0df9a8a1
--- /dev/null
+++ b/src/lib/tracker-bridge.ts
@@ -0,0 +1,175 @@
+import { listen, type UnlistenFn } from "@tauri-apps/api/event";
+import { pluginInvoke } from "$lib/plugin-invoke";
+
+export type Carrier =
+ | "loggi"
+ | "cainiao"
+ | "melhor_envio"
+ | "anjun"
+ | "shopee"
+ | "total_express"
+ | "jt_express"
+ | "correios"
+ | "unknown";
+
+export type CanonicalStatus =
+ | "preadvice"
+ | "picked_up"
+ | "in_transit"
+ | "in_warehouse"
+ | "customs"
+ | "customs_held"
+ | "customs_cleared"
+ | "out_for_delivery"
+ | "awaiting_pickup"
+ | "delivered"
+ | "delivery_failure"
+ | "delayed"
+ | "returning_to_sender"
+ | "returned_to_sender"
+ | "damaged"
+ | "unknown";
+
+export type TrackedPackage = {
+ id: number;
+ code: string;
+ alias: string | null;
+ carrier: Carrier | string;
+ cpf: string | null;
+ last_status: string | null;
+ last_event_at_ms: number | null;
+ days_in_transit: string | null;
+ created_at_ms: number;
+ updated_at_ms: number;
+ is_delivered: boolean;
+ canonical_status: CanonicalStatus | null;
+ is_archived: boolean;
+ archive_prompt_dismissed: boolean;
+};
+
+export type ListFilter = "active" | "archived" | "all";
+
+export type TrackingEvent = {
+ id: number;
+ package_id: number;
+ seq: number;
+ status: string | null;
+ date: string | null;
+ time: string | null;
+ location: string | null;
+ sub_status: string[];
+};
+
+export type NewPackageInput = {
+ code: string;
+ alias?: string;
+ carrier_hint?: string;
+ cpf?: string;
+};
+
+export type CarrierDetection = {
+ carrier: Carrier | string;
+ display_name: string;
+ requires_cpf: boolean;
+};
+
+export type TrackingGetResponse = {
+ package: TrackedPackage;
+ events: TrackingEvent[];
+} | null;
+
+export type RefreshResult = {
+ ok: boolean;
+ id: number;
+ events_added?: number;
+ status_changed?: boolean;
+};
+
+export type TrackerEventName =
+ | "status-changed"
+ | "refresh-started"
+ | "refresh-progress"
+ | "refresh-done";
+
+export type TrackerEventPayload = {
+ "status-changed": {
+ id: number;
+ code: string;
+ old_status: string | null;
+ new_status: string;
+ old_canonical: CanonicalStatus | null;
+ new_canonical: CanonicalStatus | null;
+ canonical_changed: boolean;
+ location: string | null;
+ };
+ "refresh-started": { id: number; code: string; carrier: string };
+ "refresh-progress": { id: number; ok: boolean };
+ "refresh-done": {
+ id: number;
+ events_added: number;
+ status_changed: boolean;
+ error?: string;
+ };
+};
+
+const PLUGIN_ID = "misc";
+
+export function trackerList(filter: ListFilter = "active"): Promise<TrackedPackage[]> {
+ return pluginInvoke<TrackedPackage[]>(PLUGIN_ID, "misc:tracking:list", { filter });
+}
+
+export function trackerGet(id: number): Promise<TrackingGetResponse> {
+ return pluginInvoke<TrackingGetResponse>(PLUGIN_ID, "misc:tracking:get", { id });
+}
+
+export function trackerAdd(input: NewPackageInput): Promise<TrackedPackage> {
+ const args: Record<string, unknown> = { code: input.code };
+ if (input.alias != null) args.alias = input.alias;
+ if (input.carrier_hint != null) args.carrier_hint = input.carrier_hint;
+ if (input.cpf != null) args.cpf = input.cpf;
+ return pluginInvoke<TrackedPackage>(PLUGIN_ID, "misc:tracking:add", args);
+}
+
+export function trackerRemove(id: number): Promise<{ ok: boolean; id: number }> {
+ return pluginInvoke(PLUGIN_ID, "misc:tracking:remove", { id });
+}
+
+export function trackerRefresh(id: number): Promise<RefreshResult> {
+ return pluginInvoke<RefreshResult>(PLUGIN_ID, "misc:tracking:refresh", { id });
+}
+
+export function trackerRefreshAll(): Promise<{ ok: boolean }> {
+ return pluginInvoke(PLUGIN_ID, "misc:tracking:refresh_all", {});
+}
+
+export function trackerDetectCarrier(code: string): Promise<CarrierDetection> {
+ return pluginInvoke<CarrierDetection>(PLUGIN_ID, "misc:tracking:detect_carrier", { code });
+}
+
+export function trackerSetAlias(id: number, alias: string | null): Promise<{ ok: boolean; id: number }> {
+ return pluginInvoke(PLUGIN_ID, "misc:tracking:set_alias", { id, alias });
+}
+
+export function trackerSetCpf(id: number, cpf: string | null): Promise<{ ok: boolean; id: number }> {
+ return pluginInvoke(PLUGIN_ID, "misc:tracking:set_cpf", { id, cpf });
+}
+
+export function trackerSetArchived(
+ id: number,
+ archived: boolean,
+): Promise<{ ok: boolean; id: number; archived: boolean }> {
+ return pluginInvoke(PLUGIN_ID, "misc:tracking:set_archived", { id, archived });
+}
+
+export function trackerDismissArchivePrompt(
+ id: number,
+): Promise<{ ok: boolean; id: number }> {
+ return pluginInvoke(PLUGIN_ID, "misc:tracking:dismiss_archive_prompt", { id });
+}
+
+export async function onTrackerEvent<N extends TrackerEventName>(
+ name: N,
+ cb: (payload: TrackerEventPayload[N]) => void,
+): Promise<UnlistenFn> {
+ return listen<TrackerEventPayload[N]>(`misc:tracking:${name}`, (e) => cb(e.payload));
+}
diff --git a/src/lib/tracker-carrier-icons.ts b/src/lib/tracker-carrier-icons.ts
new file mode 100644
index 00000000..c4166590
--- /dev/null
+++ b/src/lib/tracker-carrier-icons.ts
@@ -0,0 +1,83 @@
+import type { Carrier } from "$lib/tracker-bridge";
+
+export type CarrierIcon = {
+ svgPath: string;
+ color: string;
+ /// Nome de exibição. Nomes de transportadora são marcas registradas e
+ /// permanecem literais em todos os idiomas — exceto `unknown`, que usa
+ /// `labelKey` pra resolver via i18n. Quando `labelKey` está presente, o
+ /// caller deve preferi-la sobre `label`.
+ label: string;
+ labelKey?: string;
+};
+
+const ICONS: Record<Carrier, CarrierIcon> = {
+ correios: {
+ label: "Correios",
+ color: "#FFB300",
+ svgPath: "M4 6h16v12H4z M4 6l8 6 8-6",
+ },
+ loggi: {
+ label: "Loggi",
+ color: "#FF6F00",
+ svgPath: "M3 17V7h11v10 M14 11h4l3 3v3h-7 M7 20a2 2 0 1 0 0-4 2 2 0 0 0 0 4z M17 20a2 2 0 1 0 0-4 2 2 0 0 0 0 4z",
+ },
+ shopee: {
+ label: "Shopee",
+ color: "#EE4D2D",
+ svgPath: "M5 8h14l-1 12H6L5 8z M9 8V5a3 3 0 0 1 6 0v3",
+ },
+ cainiao: {
+ label: "Cainiao",
+ color: "#1E88E5",
+ svgPath: "M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z M2 12h20 M12 2a15 15 0 0 1 0 20 M12 2a15 15 0 0 0 0 20",
+ },
+ melhor_envio: {
+ label: "Melhor Envio",
+ color: "#43A047",
+ svgPath: "M4 13h16v8H4z M4 13l2-4h12l2 4 M12 9V2 M8.5 5.5 12 2l3.5 3.5",
+ },
+ anjun: {
+ label: "Anjun",
+ color: "#8E24AA",
+ svgPath: "M21 16v-2l-8-5V3.5a1.5 1.5 0 0 0-3 0V9l-8 5v2l8-2.5V19l-2 1.5V22l3.5-1 3.5 1v-1.5L13 19v-5.5l8 2.5z",
+ },
+ total_express: {
+ label: "Total Express",
+ color: "#E53935",
+ svgPath: "M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z M7.5 4.21 12 6.81l4.5-2.6 M7.5 19.79V14.6L3 12 M21 12l-4.5 2.6v5.19 M3.27 6.96 12 12.01l8.73-5.05 M12 22.08V12",
+ },
+ jt_express: {
+ label: "J&T Express",
+ color: "#C62828",
+ svgPath: "M4 10h11v8H4z M4 10l2-3h7l2 3 M17 11h3 M17 14h3 M17 17h3",
+ },
+ unknown: {
+ label: "Unknown",
+ labelKey: "tracking.carrier.unknown",
+ color: "#757575",
+ svgPath: "M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3 M12 17h.01",
+ },
+};
+
+export function getCarrierIcon(carrier: string): CarrierIcon {
+ return ICONS[(carrier as Carrier)] ?? ICONS.unknown;
+}
+
+export type CarrierRoute = { from: string; to: string };
+
+const ROUTES: Record<Carrier, CarrierRoute | null> = {
+ correios: { from: "BRA", to: "BRA" },
+ loggi: { from: "BRA", to: "BRA" },
+ shopee: { from: "BRA", to: "BRA" },
+ melhor_envio: { from: "BRA", to: "BRA" },
+ total_express: { from: "BRA", to: "BRA" },
+ jt_express: { from: "BRA", to: "BRA" },
+ cainiao: { from: "CHN", to: "BRA" },
+ anjun: { from: "CHN", to: "BRA" },
+ unknown: null,
+};
+
+export function getCarrierRoute(carrier: string): CarrierRoute | null {
+ return ROUTES[(carrier as Carrier)] ?? null;
+}
diff --git a/src/lib/tracker-notifications.svelte.ts b/src/lib/tracker-notifications.svelte.ts
new file mode 100644
index 00000000..a853d2ba
--- /dev/null
+++ b/src/lib/tracker-notifications.svelte.ts
@@ -0,0 +1,132 @@
+import {
+ isPermissionGranted,
+ requestPermission,
+ sendNotification,
+} from "@tauri-apps/plugin-notification";
+import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow";
+import { get } from "svelte/store";
+
+import { onTrackerEvent, type TrackerEventPayload } from "$lib/tracker-bridge";
+import { getTrackerSettings } from "$lib/tracker-settings.svelte";
+import { privacyEnabled, maskCode } from "$lib/tracker-privacy.svelte";
+import { t } from "$lib/i18n";
+
+const NOTIFICATION_DEBOUNCE_MS = 60_000;
+const lastNotifiedAt = new Map<number, number>();
+
+let registered = false;
+let permissionCache: boolean | null = null;
+
+async function ensurePermissionGranted(): Promise<boolean> {
+ if (permissionCache === true) return true;
+ try {
+ if (await isPermissionGranted()) {
+ permissionCache = true;
+ return true;
+ }
+ const status = await requestPermission();
+ const granted = status === "granted";
+ permissionCache = granted;
+ return granted;
+ } catch (e) {
+ console.warn("[tracker-notifications] permission check failed", e);
+ return false;
+ }
+}
+
+async function windowIsFocused(): Promise<boolean> {
+ try {
+ return await getCurrentWebviewWindow().isFocused();
+ } catch {
+ return false;
+ }
+}
+
+function tStr(key: string, params?: Record<string, unknown>): string {
+ const fn = get(t);
+ return fn(key, params) as unknown as string;
+}
+
+function buildNotificationTitle(code: string, status: string): string {
+ const displayCode = privacyEnabled() ? maskCode(code) : code;
+ return tStr("tracking.notification.title_template", {
+ code: displayCode,
+ status,
+ });
+}
+
+function buildNotificationBody(location: string | null): string {
+ if (location && location.trim().length > 0) return location;
+ return tStr("tracking.notification.body_fallback");
+}
+
+async function handleStatusChanged(p: TrackerEventPayload["status-changed"]) {
+ const settings = getTrackerSettings();
+ if (!settings.notificationsEnabled) return;
+ if (!p.canonical_changed) return;
+
+ // Suppress when foreground — in-app toast on /misc/tracking already covers it.
+ if (await windowIsFocused()) return;
+
+ const now = Date.now();
+ const last = lastNotifiedAt.get(p.id) ?? 0;
+ if (now - last < NOTIFICATION_DEBOUNCE_MS) return;
+
+ if (!(await ensurePermissionGranted())) return;
+
+ try {
+ await sendNotification({
+ title: buildNotificationTitle(p.code, p.new_status),
+ body: buildNotificationBody(p.location),
+ });
+ lastNotifiedAt.set(p.id, now);
+ } catch (e) {
+ console.warn("[tracker-notifications] sendNotification failed", e);
+ }
+}
+
+export async function ensureTrackerNotifications(): Promise<void> {
+ if (registered) return;
+ registered = true;
+
+ // Best-effort upfront permission probe — don't block startup if it fails.
+ void ensurePermissionGranted();
+
+ try {
+ await onTrackerEvent("status-changed", (p) => {
+ void handleStatusChanged(p);
+ });
+ } catch (e) {
+ console.warn("[tracker-notifications] listener registration failed", e);
+ registered = false;
+ }
+}
+
+export async function requestNotificationPermission(): Promise<boolean> {
+ permissionCache = null;
+ return await ensurePermissionGranted();
+}
+
+export async function isNotificationPermissionGranted(): Promise<boolean> {
+ try {
+ return await isPermissionGranted();
+ } catch {
+ return false;
+ }
+}
+
+export async function sendTestNotification(): Promise<{ ok: boolean; denied: boolean }> {
+ if (!(await ensurePermissionGranted())) {
+ return { ok: false, denied: true };
+ }
+ try {
+ await sendNotification({
+ title: tStr("tracking.notification.test_title"),
+ body: tStr("tracking.notification.test_body"),
+ });
+ return { ok: true, denied: false };
+ } catch (e) {
+ console.warn("[tracker-notifications] test send failed", e);
+ return { ok: false, denied: false };
+ }
+}
diff --git a/src/lib/tracker-privacy.svelte.ts b/src/lib/tracker-privacy.svelte.ts
new file mode 100644
index 00000000..e90a8086
--- /dev/null
+++ b/src/lib/tracker-privacy.svelte.ts
@@ -0,0 +1,41 @@
+const STORAGE_KEY = "omniget.tracking.privacy";
+
+function readInitial(): boolean {
+ if (typeof localStorage === "undefined") return false;
+ try {
+ return localStorage.getItem(STORAGE_KEY) === "1";
+ } catch {
+ return false;
+ }
+}
+
+let enabled = $state(readInitial());
+
+function persist() {
+ try {
+ localStorage.setItem(STORAGE_KEY, enabled ? "1" : "0");
+ } catch {
+ // localStorage unavailable — state still works in-memory
+ }
+}
+
+export function privacyEnabled(): boolean {
+ return enabled;
+}
+
+export function togglePrivacy() {
+ enabled = !enabled;
+ persist();
+}
+
+export function setPrivacy(v: boolean) {
+ enabled = v;
+ persist();
+}
+
+export function maskCode(code: string | null | undefined): string {
+ if (!code) return "";
+ if (!enabled) return code;
+ if (code.length <= 6) return "•".repeat(code.length);
+ return code.slice(0, 2) + "•".repeat(code.length - 5) + code.slice(-3);
+}
diff --git a/src/lib/tracker-settings.svelte.ts b/src/lib/tracker-settings.svelte.ts
new file mode 100644
index 00000000..c4a58afc
--- /dev/null
+++ b/src/lib/tracker-settings.svelte.ts
@@ -0,0 +1,40 @@
+const STORAGE_KEY = "omniget.tracking.settings";
+
+export type TrackerSettings = {
+ notificationsEnabled: boolean;
+};
+
+const DEFAULTS: TrackerSettings = {
+ notificationsEnabled: true,
+};
+
+function readInitial(): TrackerSettings {
+ if (typeof localStorage === "undefined") return { ...DEFAULTS };
+ try {
+ const raw = localStorage.getItem(STORAGE_KEY);
+ if (!raw) return { ...DEFAULTS };
+ const parsed = JSON.parse(raw) as Partial<TrackerSettings>;
+ return { ...DEFAULTS, ...parsed };
+ } catch {
+ return { ...DEFAULTS };
+ }
+}
+
+let settings = $state<TrackerSettings>(readInitial());
+
+function persist() {
+ try {
+ localStorage.setItem(STORAGE_KEY, JSON.stringify(settings));
+ } catch {
+ // localStorage unavailable — state still works in-memory
+ }
+}
+
+export function getTrackerSettings(): TrackerSettings {
+ return settings;
+}
+
+export function updateTrackerSettings(patch: Partial<TrackerSettings>) {
+ settings = { ...settings, ...patch };
+ persist();
+}
diff --git a/src/lib/tracker-status-icons.ts b/src/lib/tracker-status-icons.ts
new file mode 100644
index 00000000..1f1846e4
--- /dev/null
+++ b/src/lib/tracker-status-icons.ts
@@ -0,0 +1,293 @@
+// Ícones de estado canônico (Sessão 7 + Sessão 8). A UI usa esses paths SVG
+// inline pra distinguir visualmente cada estado. Cores são **tokens semânticos
+// do design system do host** (`--success`, `--danger`, `--warning`,
+// `--info`, `--orange`, `--gray`), de modo que cada tema apresente
+// status com cores coerentes com o resto da UI (catppuccin, dracula, eink
+// etc). Mapeamento:
+// - `--info` → movimento (picked_up / in_transit / in_warehouse).
+// `--info` aliases `--cta` no app.css, que é um azul real em todos os
+// temas (mesmo nos defaults light/dark, onde `--blue` aliases o accent
+// laranja da marca e portanto não serve).
+// - `--orange` → ação ativa/atenção (customs / out_for_delivery /
+// awaiting_pickup).
+// - `--warning` → atraso sem problema concreto (delayed).
+// - `--danger` → problema (customs_held / delivery_failure / damaged).
+// - `--success` → estado terminal feliz (delivered / customs_cleared).
+// - `--gray` → inerte/desconhecido (preadvice / returning / returned
+// / unknown).
+//
+// Os SVG paths usam o estilo Feather/Lucide (stroke-only, `viewBox="0 0 24 24"`,
+// `stroke-width="1.6"`, sem fills). Cada `svgPath` é uma string concatenada de
+// múltiplos `M ... L ...` subpaths que serão renderizados num único `<path>`.
+
+import type { CanonicalStatus } from "$lib/tracker-bridge";
+
+export type StatusIcon = {
+ svgPath: string;
+ /// CSS color expression — tipicamente `var(--info)`, `var(--success)`, etc.
+ /// O caller injeta via `style="--status-color: {icon.color}"`, então
+ /// qualquer expressão CSS válida funciona.
+ color: string;
+ /// i18n key (no formato `tracking.status.*`). O caller resolve via `$t(...)`.
+ labelKey: string;
+};
+
+const ICONS: Record<CanonicalStatus, StatusIcon> = {
+ preadvice: {
+ labelKey: "tracking.status.preadvice",
+ color: "var(--gray)",
+ // Caixa lacrada — package outline com um quadrado interno (a etiqueta).
+ svgPath:
+ "M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z M3.27 6.96 12 12.01l8.73-5.05 M12 22.08V12 M9 12.5h6",
+ },
+ picked_up: {
+ labelKey: "tracking.status.picked_up",
+ color: "var(--info)",
+ // Caixa + check pequeno em cima — coletado/postado.
+ svgPath:
+ "M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z M3.27 6.96 12 12.01l8.73-5.05 M9 16l2 2 4-4",
+ },
+ in_transit: {
+ labelKey: "tracking.status.in_transit",
+ color: "var(--info)",
+ // Caminhão clássico (Feather "truck").
+ svgPath:
+ "M3 17V7h11v10 M14 11h4l3 3v3h-7 M7 20a2 2 0 1 0 0-4 2 2 0 0 0 0 4z M17 20a2 2 0 1 0 0-4 2 2 0 0 0 0 4z",
+ },
+ in_warehouse: {
+ labelKey: "tracking.status.in_warehouse",
+ color: "var(--info)",
+ // Galpão — telhado de duas águas + portão central.
+ svgPath:
+ "M3 21V10l9-6 9 6v11 M3 21h18 M9 21v-7h6v7 M10 15h4",
+ },
+ customs: {
+ labelKey: "tracking.status.customs",
+ color: "var(--orange)",
+ // Edifício com colunas (landmark-style).
+ svgPath:
+ "M3 21h18 M5 21V10 M9 21V10 M15 21V10 M19 21V10 M3 10h18 M12 3 3 8h18l-9-5z",
+ },
+ customs_held: {
+ labelKey: "tracking.status.customs_held",
+ color: "var(--danger)",
+ // Edifício + cadeado.
+ svgPath:
+ "M3 21h12 M5 21V11 M9 21V11 M13 21V11 M3 11h12 M9 4 3 8h12 M16 17a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v4h-6v-4z M18 15v-2a2 2 0 1 1 4 0v2",
+ },
+ customs_cleared: {
+ labelKey: "tracking.status.customs_cleared",
+ color: "var(--success)",
+ // Edifício + check.
+ svgPath:
+ "M3 21h12 M5 21V11 M9 21V11 M13 21V11 M3 11h12 M9 4 3 8h12 M16 17l2 2 4-4",
+ },
+ out_for_delivery: {
+ labelKey: "tracking.status.out_for_delivery",
+ color: "var(--orange)",
+ // Caminhão acelerando — truck com linhas de movimento atrás.
+ svgPath:
+ "M5 17V8h9v9 M14 12h3l3 3v2h-6 M9 20a2 2 0 1 0 0-4 2 2 0 0 0 0 4z M18 20a2 2 0 1 0 0-4 2 2 0 0 0 0 4z M1 9h3 M1 12h2 M1 15h3",
+ },
+ awaiting_pickup: {
+ labelKey: "tracking.status.awaiting_pickup",
+ color: "var(--orange)",
+ // Pin de localização (Feather "map-pin") — aponta onde retirar.
+ svgPath:
+ "M21 10c0 7-9 13-9 13S3 17 3 10a9 9 0 0 1 18 0z M12 13a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",
+ },
+ delivered: {
+ labelKey: "tracking.status.delivered",
+ color: "var(--success)",
+ // Check-circle (Feather).
+ svgPath: "M22 11.08V12a10 10 0 1 1-5.93-9.14 M22 4 12 14.01l-3-3",
+ },
+ delivery_failure: {
+ labelKey: "tracking.status.delivery_failure",
+ color: "var(--danger)",
+ // Alert-circle (Feather).
+ svgPath:
+ "M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z M12 8v4 M12 16h.01",
+ },
+ delayed: {
+ labelKey: "tracking.status.delayed",
+ color: "var(--warning)",
+ // Clock (Feather).
+ svgPath: "M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z M12 6v6l4 2",
+ },
+ returning_to_sender: {
+ labelKey: "tracking.status.returning_to_sender",
+ color: "var(--gray)",
+ // Corner-up-left arrow (Feather).
+ svgPath: "M9 14 4 9l5-5 M4 9h11a5 5 0 0 1 5 5v6",
+ },
+ returned_to_sender: {
+ labelKey: "tracking.status.returned_to_sender",
+ color: "var(--gray)",
+ // Corner-up-left + dot fechado.
+ svgPath: "M9 14 4 9l5-5 M4 9h11a5 5 0 0 1 5 5v6 M20 18h-4",
+ },
+ damaged: {
+ labelKey: "tracking.status.damaged",
+ color: "var(--danger)",
+ // Alert-triangle (Feather).
+ svgPath:
+ "m10.29 3.86-8.18 14.18A2 2 0 0 0 3.84 21h16.32a2 2 0 0 0 1.73-2.96L13.71 3.86a2 2 0 0 0-3.42 0z M12 9v4 M12 17h.01",
+ },
+ unknown: {
+ labelKey: "tracking.status.unknown",
+ color: "var(--gray)",
+ // Help-circle (Feather).
+ svgPath:
+ "M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3 M12 17h.01",
+ },
+};
+
+export function getStatusIcon(status: CanonicalStatus | string | null | undefined): StatusIcon {
+ if (status == null) return ICONS.unknown;
+ const key = status as CanonicalStatus;
+ return ICONS[key] ?? ICONS.unknown;
+}
+
+/// Classificador client-side espelhando `classify_text` do backend Rust. Usado
+/// na timeline da página de detalhe pra dar a cada evento seu próprio ícone
+/// canônico sem precisar de uma round-trip ao plugin. Mantém a mesma ordem de
+/// precedência (`Delivered` ganha de `OutForDelivery`, etc).
+export function classifyEvent(rawStatus: string | null | undefined, rawLocation?: string | null): CanonicalStatus {
+ const t = `${rawStatus ?? ""} ${rawLocation ?? ""}`.toLowerCase().trim();
+ if (!t) return "unknown";
+
+ // Terminais.
+ if (
+ t.includes("devolvido ao remetente") ||
+ t.includes("objeto devolvido") ||
+ t.includes("returned to sender") ||
+ t.includes("devolução concluída")
+ )
+ return "returned_to_sender";
+ if (
+ t.includes("entrega realizada") ||
+ t.includes("entregue ao destinat") ||
+ t.includes("objeto entregue") ||
+ t.includes("pacote entregue") ||
+ t.includes("delivered") ||
+ t.includes("recebido por") ||
+ t.includes("assinado pelo destinat") ||
+ (t.startsWith("entregue") && !t.includes("não foi"))
+ )
+ return "delivered";
+
+ // Problemas.
+ if (t.includes("avariad") || t.includes("danific") || t.includes("damaged") || t.includes("destru"))
+ return "damaged";
+ if (
+ t.includes("não foi possível entregar") ||
+ t.includes("tentativa de entrega") ||
+ t.includes("entrega não realizada") ||
+ t.includes("destinatário ausente") ||
+ t.includes("delivery failure") ||
+ t.includes("delivery attempted")
+ )
+ return "delivery_failure";
+ if (
+ t.includes("em devolução") ||
+ t.includes("retornando ao remetente") ||
+ t.includes("returning to sender")
+ )
+ return "returning_to_sender";
+
+ // Retirada.
+ if (
+ t.includes("disponível para retirada") ||
+ t.includes("aguardando retirada") ||
+ t.includes("pronto para retirada") ||
+ t.includes("retirar na agência") ||
+ t.includes("ready for pickup") ||
+ t.includes("available for pickup")
+ )
+ return "awaiting_pickup";
+
+ // Alfândega.
+ if (
+ t.includes("liberado pela alfândega") ||
+ t.includes("liberado pela aduana") ||
+ t.includes("customs released") ||
+ t.includes("customs cleared") ||
+ (t.includes("liberado") && (t.includes("alfândega") || t.includes("aduane")))
+ )
+ return "customs_cleared";
+ if (
+ t.includes("retido na alfândega") ||
+ t.includes("retido na aduana") ||
+ t.includes("aguardando pagamento") ||
+ t.includes("aguardando documento") ||
+ t.includes("customs held")
+ )
+ return "customs_held";
+ if (
+ t.includes("desembaraço aduaneiro") ||
+ t.includes("alfândega") ||
+ t.includes("aduana") ||
+ t.includes("customs")
+ )
+ return "customs";
+
+ // Saiu pra entrega antes de in_transit.
+ if (
+ t.includes("saiu para entrega") ||
+ t.includes("em rota de entrega") ||
+ t.includes("em rota") ||
+ t.includes("rota de entrega") ||
+ t.includes("em entrega") ||
+ t.includes("out for delivery")
+ )
+ return "out_for_delivery";
+
+ // Warehouse.
+ if (
+ t.includes("centro de distribuição") ||
+ t.includes("centro logístico") ||
+ t.includes("chegou ao centro") ||
+ t.includes("triagem") ||
+ t.includes("unidade de tratamento") ||
+ t.includes("warehouse") ||
+ t.includes("sorting center") ||
+ t.includes("left sorting")
+ )
+ return "in_warehouse";
+
+ if (t.includes("atras") || t.includes("delayed") || t.includes("sem movimenta")) return "delayed";
+
+ if (
+ t.includes("em trânsito") ||
+ t.includes("em transito") ||
+ t.includes("encaminhado") ||
+ t.includes("in transit") ||
+ t.includes("trânsito para")
+ )
+ return "in_transit";
+
+ if (
+ t.includes("objeto postado") ||
+ t.includes("postagem") ||
+ t.includes("postado") ||
+ t.includes("coletado") ||
+ t.includes("collected") ||
+ t.includes("picked up") ||
+ t.includes("recebido pelo") ||
+ t.includes("origem")
+ )
+ return "picked_up";
+
+ if (
+ t.includes("pedido criado") ||
+ t.includes("aguardando coleta") ||
+ t.includes("preparing") ||
+ t.includes("preadvice") ||
+ t.includes("etiqueta gerada") ||
+ t.includes("pending pickup")
+ )
+ return "preadvice";
+
+ return "unknown";
+}
diff --git a/src/lib/utils/open_nami_parser.test.ts b/src/lib/utils/open_nami_parser.test.ts
new file mode 100644
index 00000000..81b9545f
--- /dev/null
+++ b/src/lib/utils/open_nami_parser.test.ts
@@ -0,0 +1,53 @@
+import { describe, it, expect } from 'vitest';
+import { parseProfileUrl } from './open_nami_parser';
+
+describe('open_nami_parser', () => {
+ it('parses instagram user profile and removes tracking params', () => {
+ const raw = 'https://www.instagram.com/opennami/?igsh=MWQ1Z3==&utm_source=qr';
+ const parsed = parseProfileUrl(raw);
+ expect(parsed.platform).toBe('instagram');
+ expect(parsed.username).toBe('opennami');
+ expect(parsed.cleanUrl).toBe('https://www.instagram.com/opennami/');
+ expect(parsed.isSpecificMedia).toBe(false);
+ });
+
+ it('parses instagram reel URL and flags as specific media', () => {
+ const raw = 'https://instagram.com/reel/C8XYZ123/?utm_source=ig_web_copy_link';
+ const parsed = parseProfileUrl(raw);
+ expect(parsed.platform).toBe('instagram');
+ expect(parsed.cleanUrl).toBe('https://www.instagram.com/reel/C8XYZ123/');
+ expect(parsed.isSpecificMedia).toBe(true);
+ });
+
+ it('parses tiktok user handle with or without @', () => {
+ const raw = 'https://www.tiktok.com/@creator_zone?is_from_webapp=1';
+ const parsed = parseProfileUrl(raw);
+ expect(parsed.platform).toBe('tiktok');
+ expect(parsed.username).toBe('creator_zone');
+ expect(parsed.cleanUrl).toBe('https://www.tiktok.com/@creator_zone');
+ expect(parsed.isSpecificMedia).toBe(false);
+ });
+
+ it('parses x/twitter user handle', () => {
+ const raw = 'https://x.com/OpenSelena?s=20&t=abcdef';
+ const parsed = parseProfileUrl(raw);
+ expect(parsed.platform).toBe('x');
+ expect(parsed.username).toBe('OpenSelena');
+ expect(parsed.cleanUrl).toBe('https://x.com/OpenSelena');
+ });
+
+ it('parses facebook profile URL', () => {
+ const raw = 'https://www.facebook.com/nami.official';
+ const parsed = parseProfileUrl(raw);
+ expect(parsed.platform).toBe('facebook');
+ expect(parsed.username).toBe('nami.official');
+ expect(parsed.cleanUrl).toBe('https://www.facebook.com/nami.official');
+ });
+
+ it('returns unknown for generic URLs', () => {
+ const raw = 'https://example.com/user/page';
+ const parsed = parseProfileUrl(raw);
+ expect(parsed.platform).toBe('unknown');
+ expect(parsed.cleanUrl).toBe('https://example.com/user/page');
+ });
+});
diff --git a/src/lib/utils/open_nami_parser.ts b/src/lib/utils/open_nami_parser.ts
new file mode 100644
index 00000000..cda99312
--- /dev/null
+++ b/src/lib/utils/open_nami_parser.ts
@@ -0,0 +1,210 @@
+export type Platform = 'instagram' | 'tiktok' | 'facebook' | 'x' | 'unknown';
+export type SupportedPlatform = 'instagram' | 'tiktok' | 'facebook' | 'x';
+
+export interface ParsedProfile {
+ platform: Platform;
+ username: string;
+ cleanUrl: string;
+ rawInput: string;
+ isSpecificMedia?: boolean;
+}
+
+const INVALID_CHARS_REGEX = /[<>:"/\\|?*\x00-\x1f]/g;
+const WINDOWS_RESERVED_NAMES = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\..*)?$/i;
+
+export function sanitizeUsername(username: string): string {
+ let cleaned = username.replace(INVALID_CHARS_REGEX, '_').trim().replace(/^[.\s]+|[.\s]+$/g, '');
+ if (WINDOWS_RESERVED_NAMES.test(cleaned)) {
+ cleaned = `_${cleaned}`;
+ }
+ return cleaned.slice(0, 120) || 'unknown';
+}
+
+export function buildProfileUrl(platform: SupportedPlatform, username: string): string {
+ const cleanUser = username.trim().replace(/^@/, '').replace(/^[.\s]+|[.\s]+$/g, '');
+ switch (platform) {
+ case 'instagram':
+ return `https://www.instagram.com/${cleanUser}/`;
+ case 'tiktok':
+ return `https://www.tiktok.com/@${cleanUser}`;
+ case 'facebook':
+ return `https://www.facebook.com/${cleanUser}`;
+ case 'x':
+ return `https://x.com/${cleanUser}`;
+ }
+}
+
+export function parseProfileUrl(raw: string): ParsedProfile {
+ const trimmed = raw.trim();
+ if (!trimmed) {
+ return { platform: 'unknown', username: '', cleanUrl: '', rawInput: raw, isSpecificMedia: false };
+ }
+
+ // Handle prefix shortcuts (ig:user, tt:user, etc.)
+ const prefixMatch = trimmed.match(/^(ig|instagram|tt|tiktok|fb|facebook|x|twitter):([^\s/]+)$/i);
+ if (prefixMatch) {
+ const rawPrefix = prefixMatch[1].toLowerCase();
+ const rawUser = prefixMatch[2].replace(/^@/, '');
+ const platform: SupportedPlatform =
+ rawPrefix === 'ig' || rawPrefix === 'instagram'
+ ? 'instagram'
+ : rawPrefix === 'tt' || rawPrefix === 'tiktok'
+ ? 'tiktok'
+ : rawPrefix === 'fb' || rawPrefix === 'facebook'
+ ? 'facebook'
+ : 'x';
+ return {
+ platform,
+ username: sanitizeUsername(rawUser),
+ cleanUrl: buildProfileUrl(platform, rawUser),
+ rawInput: raw,
+ isSpecificMedia: false,
+ };
+ }
+
+ let candidate = trimmed;
+ if (!/^https?:\/\//i.test(candidate)) {
+ if (
+ candidate.includes('instagram.com') ||
+ candidate.includes('tiktok.com') ||
+ candidate.includes('facebook.com') ||
+ candidate.includes('x.com') ||
+ candidate.includes('twitter.com')
+ ) {
+ candidate = 'https://' + candidate;
+ }
+ }
+
+ try {
+ const url = new URL(candidate);
+ const host = url.hostname.toLowerCase().replace(/^www\./, '').replace(/^m\./, '');
+ const pathname = url.pathname.replace(/\/+$/, '');
+ const pathParts = pathname.split('/').filter(Boolean);
+
+ // 1. Instagram
+ if (host.includes('instagram.com')) {
+ const firstPart = pathParts[0]?.toLowerCase() || '';
+ const isMedia = firstPart === 'p' || firstPart === 'reel' || firstPart === 'reels' || firstPart === 'tv';
+ if (isMedia) {
+ return {
+ platform: 'instagram',
+ username: '',
+ cleanUrl: `https://www.instagram.com/${pathParts[0]}/${pathParts[1] || ''}/`,
+ rawInput: raw,
+ isSpecificMedia: true,
+ };
+ }
+
+ const reserved = ['explore', 'direct', 'accounts', 'stories'];
+ if (firstPart === 'stories' && pathParts[1]) {
+ return {
+ platform: 'instagram',
+ username: sanitizeUsername(pathParts[1]),
+ cleanUrl: `https://www.instagram.com/stories/${pathParts[1]}/`,
+ rawInput: raw,
+ isSpecificMedia: true,
+ };
+ }
+
+ if (firstPart && !reserved.includes(firstPart)) {
+ const username = pathParts[0].replace(/^@/, '');
+ return {
+ platform: 'instagram',
+ username: sanitizeUsername(username),
+ cleanUrl: `https://www.instagram.com/${username}/`,
+ rawInput: raw,
+ isSpecificMedia: false,
+ };
+ }
+ }
+
+ // 2. TikTok
+ if (host.includes('tiktok.com')) {
+ const userPart = pathParts[0] || '';
+ const username = userPart.startsWith('@') ? userPart.slice(1) : userPart;
+ const isVideo = pathParts[1] === 'video';
+ if (username) {
+ return {
+ platform: 'tiktok',
+ username: sanitizeUsername(username),
+ cleanUrl: isVideo
+ ? `https://www.tiktok.com/@${username}/video/${pathParts[2] || ''}`
+ : `https://www.tiktok.com/@${username}`,
+ rawInput: raw,
+ isSpecificMedia: isVideo,
+ };
+ }
+ }
+
+ // 3. Facebook
+ if (host.includes('facebook.com') || host === 'fb.com') {
+ if (pathParts[0]?.toLowerCase() === 'profile.php') {
+ const id = url.searchParams.get('id');
+ if (id) {
+ return {
+ platform: 'facebook',
+ username: sanitizeUsername(id),
+ cleanUrl: `https://www.facebook.com/profile.php?id=${id}`,
+ rawInput: raw,
+ isSpecificMedia: false,
+ };
+ }
+ } else if (pathParts[0]?.toLowerCase() === 'people' && pathParts[1]) {
+ return {
+ platform: 'facebook',
+ username: sanitizeUsername(pathParts[1]),
+ cleanUrl: `https://www.facebook.com/people/${pathParts[1]}`,
+ rawInput: raw,
+ isSpecificMedia: false,
+ };
+ } else if (pathParts[0]) {
+ const reserved = ['watch', 'videos', 'reel', 'groups', 'pages', 'events', 'photo'];
+ const isMedia = reserved.includes(pathParts[0].toLowerCase());
+ const username = isMedia ? '' : sanitizeUsername(pathParts[0]);
+ return {
+ platform: 'facebook',
+ username,
+ cleanUrl: `https://www.facebook.com/${pathParts.join('/')}`,
+ rawInput: raw,
+ isSpecificMedia: isMedia,
+ };
+ }
+ }
+
+ // 4. X / Twitter
+ if (host.includes('x.com') || host.includes('twitter.com')) {
+ const firstPart = pathParts[0]?.toLowerCase() || '';
+ const reserved = ['home', 'explore', 'notifications', 'messages', 'i', 'settings'];
+ if (firstPart && !reserved.includes(firstPart)) {
+ const username = pathParts[0].replace(/^@/, '');
+ const isStatus = pathParts[1] === 'status';
+ return {
+ platform: 'x',
+ username: sanitizeUsername(username),
+ cleanUrl: isStatus
+ ? `https://x.com/${username}/status/${pathParts[2] || ''}`
+ : `https://x.com/${username}`,
+ rawInput: raw,
+ isSpecificMedia: isStatus,
+ };
+ }
+ }
+
+ // Generic URL fallback
+ return {
+ platform: 'unknown',
+ username: '',
+ cleanUrl: `${url.origin}${url.pathname}`,
+ rawInput: raw,
+ isSpecificMedia: false,
+ };
+ } catch {
+ return {
+ platform: 'unknown',
+ username: '',
+ cleanUrl: trimmed,
+ rawInput: raw,
+ isSpecificMedia: false,
+ };
+ }
+}
diff --git a/src/routes/about/+page.svelte b/src/routes/about/+page.svelte
index 4311bc6a..621fd764 100644
--- a/src/routes/about/+page.svelte
+++ b/src/routes/about/+page.svelte
@@ -24,7 +24,7 @@
async function openAuthorGithub(e: Event) {
e.preventDefault();
- await open("https://github.com/tonhowtf");
+ await open("https://github.com/OpenSelena");
}
</script>
@@ -61,7 +61,7 @@
</div>
<div class="about-external">
- <a href="https://github.com/tonhowtf/omniget" target="_blank" rel="noopener" class="btn about-ext-link">
+ <a href="https://github.com/OpenSelena/omniget" target="_blank" rel="noopener" class="btn about-ext-link">
<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"/>
</svg>
@@ -78,8 +78,8 @@
<footer class="about-footer">
<hr class="separator" />
<p class="about-credit">{$t("about.credit")}</p>
- <a href="https://github.com/tonhowtf" class="about-watermark" onclick={openAuthorGithub} title="@tonhowtf">
- @tonhowtf
+ <a href="https://github.com/OpenSelena" class="about-watermark" onclick={openAuthorGithub} title="@OpenSelena">
+ @OpenSelena
</a>
</footer>
</div>
diff --git a/src/routes/about/project/+page.svelte b/src/routes/about/project/+page.svelte
index 2a98e9d6..8dcf5729 100644
--- a/src/routes/about/project/+page.svelte
+++ b/src/routes/about/project/+page.svelte
@@ -2,7 +2,7 @@
import { open } from "@tauri-apps/plugin-shell";
import { t } from "$lib/i18n";
- const GITHUB_URL = "https://github.com/tonhowtf/omniget";
+ const GITHUB_URL = "https://github.com/OpenSelena/omniget";
const APP_VERSION = "0.9.2";
async function openGitHub() {
@@ -14,7 +14,7 @@
<p class="star-description">{$t('about.star_description')}</p>
<div class="star-iframe-wrapper">
<iframe
- src="https://ghbtns.com/github-btn.html?user=tonhowtf&repo=omniget&type=star&count=true&size=large"
+ src="https://ghbtns.com/github-btn.html?user=OpenSelena&repo=omniget&type=star&count=true&size=large"
frameborder="0"
scrolling="0"
width="170"