1
1
mirror of https://github.com/neosubhamoy/neodlp.git synced 2026-03-22 10:15:50 +05:30

53 Commits

36 changed files with 1209 additions and 717 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 KiB

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 KiB

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

BIN
.github/images/flathub/downloader.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

BIN
.github/images/flathub/settings.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 86 KiB

View File

@@ -1,10 +1,6 @@
### ✨ Changelog ### ✨ Changelog
- Added delay/sleep configuration settings (delay is now also configurable on search) - Added support for linux Flatpak (some features are unavailable on Flatpak build due to it's strict sandboxing, check 'Settings > Info > Health Check' section for more info)
- Added support for YouTube PO Token generation (based on [bgutil-ytdlp-pot-provider-rs](https://github.com/jim60105/bgutil-ytdlp-pot-provider-rs))
- Implemented custom app titlebar on windows and linux
- Further improved and persisted app logs (stored in [platform specific log directory](https://v2.tauri.app/plugin/logging/#persisting-logs))
- Fixed webview window creation is failing on wayland with nvidia gpu
- Other minor fixes and improvements - Other minor fixes and improvements
### 📝 Notes ### 📝 Notes
@@ -13,7 +9,7 @@
> Users are always adviced to complete/cancel all paused downloads before updating to a newer version, otherwise paused downloads may not resume properly and re-start from the begining. > Users are always adviced to complete/cancel all paused downloads before updating to a newer version, otherwise paused downloads may not resume properly and re-start from the begining.
> [!WARNING] > [!WARNING]
> Linux users make sure `yt-dlp` and `deno` is not installed in your distro (otherwise you will get package installation conflict). Don't worry, You can still use yt-dlp cli as before (the only difference is that now it will be installed and auto-updated by neo-dlp, which You can also disable from neo-dlp Settings if you don't want to auto-update yt-dlp) > Linux users make sure `yt-dlp`, `aria2c` and `deno` is not installed in your distro (otherwise you will get package installation conflict). Don't worry, You can still use yt-dlp cli as before (the only difference is that now it will be installed and auto-updated by neodlp, which You can also disable from neodlp Settings if you don't want to auto-update yt-dlp) (ignore this if you are installing AppImage/Flatpak)
> This is an Un-Signed Build (Windows doesn't trust this Certificate so, it may flag this as malicious software, in that case, disable Windows SmartScreen and Defender, install it, and then re-enable them) > This is an Un-Signed Build (Windows doesn't trust this Certificate so, it may flag this as malicious software, in that case, disable Windows SmartScreen and Defender, install it, and then re-enable them)
@@ -23,11 +19,11 @@
| yt-dlp (updateable) | ffmpeg | ffprobe | aria2c | deno | bgutil-pot-rs | | yt-dlp (updateable) | ffmpeg | ffprobe | aria2c | deno | bgutil-pot-rs |
| :---- | :---- | :---- | :---- | :---- | :---- | | :---- | :---- | :---- | :---- | :---- | :---- |
| v2026.02.17.233631 (nightly) | v7.1.1 | v7.1.1 | v1.37.0 | v2.6.10 | v0.7.1-1.2.2 | | v2026.03.03.162408 (nightly) | v7.1.1 | v7.1.1 | v1.37.0 | v2.7.4 | v0.7.2-1.3.0 |
> ‼️ Linux builds (deb, rpm) does not ships with `ffmpeg` and `ffprobe` (though it will be auto installed as a dependency by your package manager, if you are on fedora make sure to [enable rpmfusion free+nonfree repos](https://docs.fedoraproject.org/en-US/quick-docs/rpmfusion-setup/#_enabling_the_rpm_fusion_repositories_using_command_line_utilities) before installing the rpm package) > ‼️ Linux builds (deb, rpm) does not ships with `ffmpeg` and `ffprobe` (though it will be auto installed as a dependency by your package manager, if you are on fedora make sure to [enable rpmfusion free+nonfree repos](https://docs.fedoraproject.org/en-US/quick-docs/rpmfusion-setup/#_enabling_the_rpm_fusion_repositories_using_command_line_utilities) before installing the rpm package)
> ‼️ MacOS builds (dmg, app) does not ships with `aria2c`, If you want to use [aria2](https://formulae.brew.sh/formula/aria2) install it via [homebrew](https://brew.sh) > ‼️ MacOS builds (dmg, app) does not ships with `aria2c`, If you want to use [aria2](https://formulae.brew.sh/formula/aria2) install it via [homebrew](https://brew.sh) (though it will be auto installed as a dependency if you install neodlp via homebrew)
### ⬇️ Download Section ### ⬇️ Download Section
@@ -40,7 +36,7 @@
> 🪟 Windows x86_64 binary also works on ARM64 (Windows on ARM) devices with emulation (Not planning to release native Windows ARM64 build anytime soon as, x86_64 one works fine on ARM64 without noticeable performance impact) > 🪟 Windows x86_64 binary also works on ARM64 (Windows on ARM) devices with emulation (Not planning to release native Windows ARM64 build anytime soon as, x86_64 one works fine on ARM64 without noticeable performance impact)
> 🚫 Linux AppImage builds are experimental and does not support neodlp's browser intergration features due to it's sandboxed nature. Also, don't run the AppImage with portable (.home, .config) folders, it will break things (it is highly recommended to use native [deb, rpm, AUR] builds if possible for the full experiance, otherwise AppImages are good for trying out NeoDLP without installing) > 🚫 Linux AppImage builds are experimental and does not support neodlp's browser intergration features due to it's limitations. Also, don't run the AppImage with portable (.home, .config) folders, it will break things (it is highly recommended to use native [deb, rpm, AUR] builds if possible for the full experiance, otherwise AppImages are good for trying out NeoDLP without installing)
> ⚠️ MacOS ARM64 binary downloads are experimental and may not open on Apple Silicon Macs if downloaded from browser (You will get 'Damaged File' error) it's because the binaries are not signed (signing MacOS binaries requires 99$/year Apple Developer Account subscription, which I can't afford RN!) and Apple Silicon Macs don't allow unsigned apps (downloaded from browser) to be installed on the system. If you want to use NeoDLP on your Apple Silicon Macs, There are few ways you can bypass these restrictions: > ⚠️ MacOS ARM64 binary downloads are experimental and may not open on Apple Silicon Macs if downloaded from browser (You will get 'Damaged File' error) it's because the binaries are not signed (signing MacOS binaries requires 99$/year Apple Developer Account subscription, which I can't afford RN!) and Apple Silicon Macs don't allow unsigned apps (downloaded from browser) to be installed on the system. If you want to use NeoDLP on your Apple Silicon Macs, There are few ways you can bypass these restrictions:
> 1. Using our automated [Curl-Bash Installer](https://neodlp.neosubhamoy.com/download) (Recommended) > 1. Using our automated [Curl-Bash Installer](https://neodlp.neosubhamoy.com/download) (Recommended)

View File

@@ -83,9 +83,10 @@ After installing the extension you can do the following directly from the browse
| Platform (OS) | Distribution Channel | Installation Command / Instruction | | Platform (OS) | Distribution Channel | Installation Command / Instruction |
| :---- | :---- | :---- | | :---- | :---- | :---- |
| Windows x86_64 / ARM64 | WinGet | `winget install neosubhamoy.neodlp` | | Windows x86_64 / ARM64 | WinGet | `winget install neosubhamoy.neodlp` |
| MacOS x86_64 / ARM64 | Homebrew | `brew install neosubhamoy/tap/neodlp` |
| MacOS x86_64 / ARM64 | Curl-Bash Installer | `curl -sSL https://neodlp.neosubhamoy.com/macos_installer.sh \| bash` | | MacOS x86_64 / ARM64 | Curl-Bash Installer | `curl -sSL https://neodlp.neosubhamoy.com/macos_installer.sh \| bash` |
| Linux x86_64 / ARM64 | Curl-Bash Installer | `curl -sSL https://neodlp.neosubhamoy.com/linux_installer.sh \| bash` | | Linux x86_64 / ARM64 | Curl-Bash Installer | `curl -sSL https://neodlp.neosubhamoy.com/linux_installer.sh \| bash` |
| Arch Linux x86_64 / ARM64 | AUR | `yay -S neodlp` | | Arch Linux x86_64 / ARM64 | AUR | `yay -S neodlp` or `paru -S neodlp` |
## 🧪 Package Testing Status ## 🧪 Package Testing Status

View File

@@ -0,0 +1,10 @@
[Desktop Entry]
Type=Application
Name=NeoDLP
Comment=Modern feature-rich video/audio downloader based on yt-dlp.
Icon=com.neosubhamoy.neodlp
Exec=neodlp
Terminal=false
Categories=Utility;
Keywords=neodlp;downloader;yt-dlp-gui;

View File

@@ -0,0 +1,46 @@
<?xml version='1.0' encoding='UTF-8'?>
<component type="desktop-application">
<id>com.neosubhamoy.neodlp</id>
<name>NeoDLP</name>
<summary>Modern feature-rich video/audio downloader based on yt-dlp</summary>
<developer id="com.neosubhamoy">
<name>Subhamoy Biswas</name>
</developer>
<metadata_license>CC0-1.0</metadata_license>
<project_license>MIT</project_license>
<url type="homepage">https://neodlp.neosubhamoy.com</url>
<url type="vcs-browser">https://github.com/neosubhamoy/neodlp</url>
<url type="bugtracker">https://github.com/neosubhamoy/neodlp/issues</url>
<description>
<p>
NeoDLP is a cross-platform desktop application designed for downloading videos and audio from various online sources based on yt-dlp.
It offers modern user interface, lots of features and customization options.
</p>
</description>
<launchable type="desktop-id">com.neosubhamoy.neodlp.desktop</launchable>
<screenshots>
<screenshot type="default">
<image>https://raw.githubusercontent.com/neosubhamoy/neodlp/main/.github/images/flathub/downloader.png</image>
<caption>Downloader page of NeoDLP</caption>
</screenshot>
<screenshot>
<image>https://raw.githubusercontent.com/neosubhamoy/neodlp/main/.github/images/flathub/completed-downloads.png</image>
<caption>Completed downloads page of NeoDLP</caption>
</screenshot>
<screenshot>
<image>https://raw.githubusercontent.com/neosubhamoy/neodlp/main/.github/images/flathub/ongoing-downloads.png</image>
<caption>Ongoing downloads page of NeoDLP</caption>
</screenshot>
<screenshot>
<image>https://raw.githubusercontent.com/neosubhamoy/neodlp/main/.github/images/flathub/settings.png</image>
<caption>Settings page of NeoDLP</caption>
</screenshot>
</screenshots>
<content_rating type="oars-1.1" />
<releases>
<release version="0.4.3" date="2026-03-07">
<url type="details">https://github.com/neosubhamoy/neodlp/releases/tag/v0.4.3</url>
</release>
</releases>
</component>

708
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{ {
"name": "neodlp", "name": "neodlp",
"private": true, "private": true,
"version": "0.4.1", "version": "0.4.3",
"description": "Cross-platform Video/Audio Downloader Desktop App based on YT-DLP with Modern UI and Browser Integration", "description": "Cross-platform Video/Audio Downloader Desktop App based on YT-DLP with Modern UI and Browser Integration",
"type": "module", "type": "module",
"scripts": { "scripts": {
@@ -21,8 +21,8 @@
}, },
"dependencies": { "dependencies": {
"@hookform/resolvers": "^5.2.2", "@hookform/resolvers": "^5.2.2",
"@tanstack/devtools-vite": "^0.5.1", "@tanstack/devtools-vite": "^0.5.3",
"@tanstack/react-devtools": "^0.9.6", "@tanstack/react-devtools": "^0.9.9",
"@tanstack/react-pacer": "^0.20.0", "@tanstack/react-pacer": "^0.20.0",
"@tanstack/react-pacer-devtools": "^0.5.2", "@tanstack/react-pacer-devtools": "^0.5.2",
"@tanstack/react-query": "^5.90.21", "@tanstack/react-query": "^5.90.21",
@@ -41,30 +41,30 @@
"@tauri-apps/plugin-updater": "^2.10.0", "@tauri-apps/plugin-updater": "^2.10.0",
"class-variance-authority": "^0.7.1", "class-variance-authority": "^0.7.1",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"lucide-react": "^0.574.0", "lucide-react": "^0.577.0",
"next-themes": "^0.4.6", "next-themes": "^0.4.6",
"radix-ui": "^1.4.3", "radix-ui": "^1.4.3",
"react": "^19.2.4", "react": "^19.2.4",
"react-dom": "^19.2.4", "react-dom": "^19.2.4",
"react-hook-form": "^7.71.1", "react-hook-form": "^7.71.2",
"react-resizable-panels": "^4.6.4", "react-resizable-panels": "^4.7.1",
"react-router-dom": "^7.13.0", "react-router-dom": "^7.13.1",
"sonner": "^2.0.7", "sonner": "^2.0.7",
"tailwind-merge": "^3.4.1", "tailwind-merge": "^3.5.0",
"ulid": "^3.0.2", "ulid": "^3.0.2",
"zod": "^4.3.6", "zod": "^4.3.6",
"zustand": "^5.0.11" "zustand": "^5.0.11"
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/postcss": "^4.2.0", "@tailwindcss/postcss": "^4.2.1",
"@tailwindcss/vite": "^4.2.0", "@tailwindcss/vite": "^4.2.1",
"@tauri-apps/cli": "^2.10.0", "@tauri-apps/cli": "^2.10.1",
"@types/node": "^25.2.3", "@types/node": "^25.3.5",
"@types/react": "^19.2.14", "@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3", "@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^5.1.4", "@vitejs/plugin-react": "^5.1.4",
"postcss": "^8.5.6", "postcss": "^8.5.8",
"tailwindcss": "^4.2.0", "tailwindcss": "^4.2.1",
"tw-animate-css": "^1.4.0", "tw-animate-css": "^1.4.0",
"typescript": "~5.9.3", "typescript": "~5.9.3",
"vite": "^7.3.1" "vite": "^7.3.1"

View File

@@ -16,11 +16,11 @@ const targetPlatform = process.argv[2];
const targetBin = process.argv[3]; const targetBin = process.argv[3];
const versions = { const versions = {
'yt-dlp': 'latest', 'yt-dlp': '2026.03.03.162408',
'ffmpeg-ffprobe': 'latest', 'ffmpeg-ffprobe': 'latest',
'deno': 'latest', 'deno': '2.7.4',
'aria2c': '1.37.0', 'aria2c': '1.37.0',
'neodlp-pot': 'latest' 'neodlp-pot': '0.7.2'
}; };
const binaries = { const binaries = {
@@ -146,10 +146,54 @@ const binaries = {
path.join(downloadDir, 'ffmpeg-master-latest-linuxarm64-gpl') path.join(downloadDir, 'ffmpeg-master-latest-linuxarm64-gpl')
] ]
}, },
// {
// name: 'ffmpeg-universal-apple-darwin',
// platform: 'darwin',
// url: `https://evermeet.cx/ffmpeg/get/zip`,
// src: path.join(downloadDir, 'ffmpeg-universal-apple-darwin.zip'),
// dest: null,
// archive: {
// type: 'zip',
// binSrc: [
// path.join(downloadDir, 'ffmpeg'),
// path.join(downloadDir, 'ffmpeg')
// ],
// binDest: [
// path.join(binDir, 'ffmpeg-x86_64-apple-darwin'),
// path.join(binDir, 'ffmpeg-aarch64-apple-darwin')
// ]
// },
// cleanup: [
// path.join(downloadDir, 'ffmpeg-universal-apple-darwin.zip'),
// path.join(downloadDir, 'ffmpeg')
// ]
// },
// {
// name: 'ffprobe-universal-apple-darwin',
// platform: 'darwin',
// url: `https://evermeet.cx/ffmpeg/get/ffprobe/zip`,
// src: path.join(downloadDir, 'ffprobe-universal-apple-darwin.zip'),
// dest: null,
// archive: {
// type: 'zip',
// binSrc: [
// path.join(downloadDir, 'ffprobe'),
// path.join(downloadDir, 'ffprobe')
// ],
// binDest: [
// path.join(binDir, 'ffprobe-x86_64-apple-darwin'),
// path.join(binDir, 'ffprobe-aarch64-apple-darwin')
// ]
// },
// cleanup: [
// path.join(downloadDir, 'ffprobe-universal-apple-darwin.zip'),
// path.join(downloadDir, 'ffprobe')
// ]
// },
{ {
name: 'ffmpeg-universal-apple-darwin', name: 'ffmpeg-universal-apple-darwin',
platform: 'darwin', platform: 'darwin',
url: `https://evermeet.cx/ffmpeg/get/zip`, url: `https://github.com/neosubhamoy/evermeet-static-ffmpeg/releases${versions['ffmpeg-ffprobe'] === 'latest' ? '/latest' : ''}/download${versions['ffmpeg-ffprobe'] !== 'latest' ? '/'+versions['ffmpeg-ffprobe'] : ''}/ffmpeg-universal-apple-darwin.zip`,
src: path.join(downloadDir, 'ffmpeg-universal-apple-darwin.zip'), src: path.join(downloadDir, 'ffmpeg-universal-apple-darwin.zip'),
dest: null, dest: null,
archive: { archive: {
@@ -171,7 +215,7 @@ const binaries = {
{ {
name: 'ffprobe-universal-apple-darwin', name: 'ffprobe-universal-apple-darwin',
platform: 'darwin', platform: 'darwin',
url: `https://evermeet.cx/ffmpeg/get/ffprobe/zip`, url: `https://github.com/neosubhamoy/evermeet-static-ffmpeg/releases${versions['ffmpeg-ffprobe'] === 'latest' ? '/latest' : ''}/download${versions['ffmpeg-ffprobe'] !== 'latest' ? '/'+versions['ffmpeg-ffprobe'] : ''}/ffprobe-universal-apple-darwin.zip`,
src: path.join(downloadDir, 'ffprobe-universal-apple-darwin.zip'), src: path.join(downloadDir, 'ffprobe-universal-apple-darwin.zip'),
dest: null, dest: null,
archive: { archive: {
@@ -195,7 +239,7 @@ const binaries = {
{ {
name: 'deno-x86_64-pc-windows-msvc', name: 'deno-x86_64-pc-windows-msvc',
platform: 'win32', platform: 'win32',
url: `https://github.com/denoland/deno/releases${versions['deno'] === 'latest' ? '/latest' : ''}/download${versions['deno'] !== 'latest' ? '/'+versions['deno'] : ''}/deno-x86_64-pc-windows-msvc.zip`, url: `https://github.com/denoland/deno/releases${versions['deno'] === 'latest' ? '/latest' : ''}/download${versions['deno'] !== 'latest' ? '/v'+versions['deno'] : ''}/deno-x86_64-pc-windows-msvc.zip`,
src: path.join(downloadDir, 'deno-x86_64-pc-windows-msvc.zip'), src: path.join(downloadDir, 'deno-x86_64-pc-windows-msvc.zip'),
dest: null, dest: null,
archive: { archive: {
@@ -215,7 +259,7 @@ const binaries = {
{ {
name: 'deno-x86_64-unknown-linux-gnu', name: 'deno-x86_64-unknown-linux-gnu',
platform: 'linux', platform: 'linux',
url: `https://github.com/denoland/deno/releases${versions['deno'] === 'latest' ? '/latest' : ''}/download${versions['deno'] !== 'latest' ? '/'+versions['deno'] : ''}/deno-x86_64-unknown-linux-gnu.zip`, url: `https://github.com/denoland/deno/releases${versions['deno'] === 'latest' ? '/latest' : ''}/download${versions['deno'] !== 'latest' ? '/v'+versions['deno'] : ''}/deno-x86_64-unknown-linux-gnu.zip`,
src: path.join(downloadDir, 'deno-x86_64-unknown-linux-gnu.zip'), src: path.join(downloadDir, 'deno-x86_64-unknown-linux-gnu.zip'),
dest: null, dest: null,
archive: { archive: {
@@ -235,7 +279,7 @@ const binaries = {
{ {
name: 'deno-aarch64-unknown-linux-gnu', name: 'deno-aarch64-unknown-linux-gnu',
platform: 'linux', platform: 'linux',
url: `https://github.com/denoland/deno/releases${versions['deno'] === 'latest' ? '/latest' : ''}/download${versions['deno'] !== 'latest' ? '/'+versions['deno'] : ''}/deno-aarch64-unknown-linux-gnu.zip`, url: `https://github.com/denoland/deno/releases${versions['deno'] === 'latest' ? '/latest' : ''}/download${versions['deno'] !== 'latest' ? '/v'+versions['deno'] : ''}/deno-aarch64-unknown-linux-gnu.zip`,
src: path.join(downloadDir, 'deno-aarch64-unknown-linux-gnu.zip'), src: path.join(downloadDir, 'deno-aarch64-unknown-linux-gnu.zip'),
dest: null, dest: null,
archive: { archive: {
@@ -255,7 +299,7 @@ const binaries = {
{ {
name: 'deno-x86_64-apple-darwin', name: 'deno-x86_64-apple-darwin',
platform: 'darwin', platform: 'darwin',
url: `https://github.com/denoland/deno/releases${versions['deno'] === 'latest' ? '/latest' : ''}/download${versions['deno'] !== 'latest' ? '/'+versions['deno'] : ''}/deno-x86_64-apple-darwin.zip`, url: `https://github.com/denoland/deno/releases${versions['deno'] === 'latest' ? '/latest' : ''}/download${versions['deno'] !== 'latest' ? '/v'+versions['deno'] : ''}/deno-x86_64-apple-darwin.zip`,
src: path.join(downloadDir, 'deno-x86_64-apple-darwin.zip'), src: path.join(downloadDir, 'deno-x86_64-apple-darwin.zip'),
dest: null, dest: null,
archive: { archive: {
@@ -275,7 +319,7 @@ const binaries = {
{ {
name: 'deno-aarch64-apple-darwin', name: 'deno-aarch64-apple-darwin',
platform: 'darwin', platform: 'darwin',
url: `https://github.com/denoland/deno/releases${versions['deno'] === 'latest' ? '/latest' : ''}/download${versions['deno'] !== 'latest' ? '/'+versions['deno'] : ''}/deno-aarch64-apple-darwin.zip`, url: `https://github.com/denoland/deno/releases${versions['deno'] === 'latest' ? '/latest' : ''}/download${versions['deno'] !== 'latest' ? '/v'+versions['deno'] : ''}/deno-aarch64-apple-darwin.zip`,
src: path.join(downloadDir, 'deno-aarch64-apple-darwin.zip'), src: path.join(downloadDir, 'deno-aarch64-apple-darwin.zip'),
dest: null, dest: null,
archive: { archive: {
@@ -359,7 +403,7 @@ const binaries = {
{ {
name: 'neodlp-pot-x86_64-pc-windows-msvc', name: 'neodlp-pot-x86_64-pc-windows-msvc',
platform: 'win32', platform: 'win32',
url: `https://github.com/jim60105/bgutil-ytdlp-pot-provider-rs/releases${versions['neodlp-pot'] === 'latest' ? '/latest' : ''}/download${versions['neodlp-pot'] !== 'latest' ? '/'+versions['neodlp-pot'] : ''}/bgutil-pot-windows-x86_64.exe`, url: `https://github.com/jim60105/bgutil-ytdlp-pot-provider-rs/releases${versions['neodlp-pot'] === 'latest' ? '/latest' : ''}/download${versions['neodlp-pot'] !== 'latest' ? '/v'+versions['neodlp-pot'] : ''}/bgutil-pot-windows-x86_64.exe`,
src: path.join(downloadDir, 'bgutil-pot-windows-x86_64.exe'), src: path.join(downloadDir, 'bgutil-pot-windows-x86_64.exe'),
dest: [ dest: [
path.join(binDir, 'neodlp-pot-x86_64-pc-windows-msvc.exe') path.join(binDir, 'neodlp-pot-x86_64-pc-windows-msvc.exe')
@@ -372,7 +416,7 @@ const binaries = {
{ {
name: 'neodlp-pot-x86_64-unknown-linux-gnu', name: 'neodlp-pot-x86_64-unknown-linux-gnu',
platform: 'linux', platform: 'linux',
url: `https://github.com/jim60105/bgutil-ytdlp-pot-provider-rs/releases${versions['neodlp-pot'] === 'latest' ? '/latest' : ''}/download${versions['neodlp-pot'] !== 'latest' ? '/'+versions['neodlp-pot'] : ''}/bgutil-pot-linux-x86_64`, url: `https://github.com/jim60105/bgutil-ytdlp-pot-provider-rs/releases${versions['neodlp-pot'] === 'latest' ? '/latest' : ''}/download${versions['neodlp-pot'] !== 'latest' ? '/v'+versions['neodlp-pot'] : ''}/bgutil-pot-linux-x86_64`,
src: path.join(downloadDir, 'bgutil-pot-linux-x86_64'), src: path.join(downloadDir, 'bgutil-pot-linux-x86_64'),
dest: [ dest: [
path.join(binDir, 'neodlp-pot-x86_64-unknown-linux-gnu') path.join(binDir, 'neodlp-pot-x86_64-unknown-linux-gnu')
@@ -385,7 +429,7 @@ const binaries = {
{ {
name: 'neodlp-pot-aarch64-unknown-linux-gnu', name: 'neodlp-pot-aarch64-unknown-linux-gnu',
platform: 'linux', platform: 'linux',
url: `https://github.com/jim60105/bgutil-ytdlp-pot-provider-rs/releases${versions['neodlp-pot'] === 'latest' ? '/latest' : ''}/download${versions['neodlp-pot'] !== 'latest' ? '/'+versions['neodlp-pot'] : ''}/bgutil-pot-linux-aarch64`, url: `https://github.com/jim60105/bgutil-ytdlp-pot-provider-rs/releases${versions['neodlp-pot'] === 'latest' ? '/latest' : ''}/download${versions['neodlp-pot'] !== 'latest' ? '/v'+versions['neodlp-pot'] : ''}/bgutil-pot-linux-aarch64`,
src: path.join(downloadDir, 'bgutil-pot-linux-aarch64'), src: path.join(downloadDir, 'bgutil-pot-linux-aarch64'),
dest: [ dest: [
path.join(binDir, 'neodlp-pot-aarch64-unknown-linux-gnu') path.join(binDir, 'neodlp-pot-aarch64-unknown-linux-gnu')
@@ -398,7 +442,7 @@ const binaries = {
{ {
name: 'neodlp-pot-x86_64-apple-darwin', name: 'neodlp-pot-x86_64-apple-darwin',
platform: 'darwin', platform: 'darwin',
url: `https://github.com/jim60105/bgutil-ytdlp-pot-provider-rs/releases${versions['neodlp-pot'] === 'latest' ? '/latest' : ''}/download${versions['neodlp-pot'] !== 'latest' ? '/'+versions['neodlp-pot'] : ''}/bgutil-pot-macos-x86_64`, url: `https://github.com/jim60105/bgutil-ytdlp-pot-provider-rs/releases${versions['neodlp-pot'] === 'latest' ? '/latest' : ''}/download${versions['neodlp-pot'] !== 'latest' ? '/v'+versions['neodlp-pot'] : ''}/bgutil-pot-macos-x86_64`,
src: path.join(downloadDir, 'bgutil-pot-macos-x86_64'), src: path.join(downloadDir, 'bgutil-pot-macos-x86_64'),
dest: [ dest: [
path.join(binDir, 'neodlp-pot-x86_64-apple-darwin') path.join(binDir, 'neodlp-pot-x86_64-apple-darwin')
@@ -411,7 +455,7 @@ const binaries = {
{ {
name: 'neodlp-pot-aarch64-apple-darwin', name: 'neodlp-pot-aarch64-apple-darwin',
platform: 'darwin', platform: 'darwin',
url: `https://github.com/jim60105/bgutil-ytdlp-pot-provider-rs/releases${versions['neodlp-pot'] === 'latest' ? '/latest' : ''}/download${versions['neodlp-pot'] !== 'latest' ? '/'+versions['neodlp-pot'] : ''}/bgutil-pot-macos-aarch64`, url: `https://github.com/jim60105/bgutil-ytdlp-pot-provider-rs/releases${versions['neodlp-pot'] === 'latest' ? '/latest' : ''}/download${versions['neodlp-pot'] !== 'latest' ? '/v'+versions['neodlp-pot'] : ''}/bgutil-pot-macos-aarch64`,
src: path.join(downloadDir, 'bgutil-pot-macos-aarch64'), src: path.join(downloadDir, 'bgutil-pot-macos-aarch64'),
dest: [ dest: [
path.join(binDir, 'neodlp-pot-aarch64-apple-darwin') path.join(binDir, 'neodlp-pot-aarch64-apple-darwin')

495
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "neodlp" name = "neodlp"
version = "0.4.1" version = "0.4.3"
description = "Cross-platform Video/Audio Downloader Desktop App based on YT-DLP with Modern UI and Browser Integration" description = "Cross-platform Video/Audio Downloader Desktop App based on YT-DLP with Modern UI and Browser Integration"
authors = ["neosubhamoy <hey@neosubhamoy.com>"] authors = ["neosubhamoy <hey@neosubhamoy.com>"]
edition = "2021" edition = "2021"

View File

@@ -31,7 +31,7 @@
"notification:default", "notification:default",
"log:default", "log:default",
{ {
"identifier": "opener:allow-open-path", "identifier": "fs:scope",
"allow": [ "allow": [
{ {
"path": "**" "path": "**"
@@ -39,7 +39,7 @@
] ]
}, },
{ {
"identifier": "fs:scope", "identifier": "opener:allow-open-path",
"allow": [ "allow": [
{ {
"path": "**" "path": "**"

View File

@@ -40,6 +40,11 @@
"args": true, "args": true,
"sidecar": true "sidecar": true
}, },
{
"name": "yt-dlp",
"cmd": "yt-dlp",
"args": true
},
{ {
"name": "ffmpeg", "name": "ffmpeg",
"cmd": "ffmpeg", "cmd": "ffmpeg",
@@ -64,6 +69,11 @@
"name": "powershell", "name": "powershell",
"cmd": "powershell", "cmd": "powershell",
"args": true "args": true
},
{
"name": "sh",
"cmd": "sh",
"args": true
} }
] ]
}, },
@@ -100,6 +110,11 @@
"args": true, "args": true,
"sidecar": true "sidecar": true
}, },
{
"name": "yt-dlp",
"cmd": "yt-dlp",
"args": true
},
{ {
"name": "ffmpeg", "name": "ffmpeg",
"cmd": "ffmpeg", "cmd": "ffmpeg",
@@ -114,6 +129,21 @@
"name": "deno", "name": "deno",
"cmd": "deno", "cmd": "deno",
"args": true "args": true
},
{
"name": "pkexec",
"cmd": "pkexec",
"args": true
},
{
"name": "powershell",
"cmd": "powershell",
"args": true
},
{
"name": "sh",
"cmd": "sh",
"args": true
} }
] ]
} }

View File

@@ -1,6 +1,6 @@
from __future__ import annotations from __future__ import annotations
__version__ = '1.2.2' __version__ = '1.3.0'
import abc import abc
import json import json
@@ -52,28 +52,32 @@ class BgUtilPTPBase(PoTokenProvider, abc.ABC):
def _get_attestation(self, webpage: str | None): def _get_attestation(self, webpage: str | None):
if not webpage: if not webpage:
return None return None
raw_challenge_data = self.ie._search_regex( raw_cd = (
r'''(?sx)window\.ytAtR\s*=\s*(?P<raw_cd>(?P<q>['"]) traverse_obj(
(?: self.ie._search_regex(
\\.| r'''(?sx)window\s*\.\s*ytAtN\s*\(\s*
(?!(?P=q)). (?P<js>\{.+?}\s*)
)* \s*\)\s*;''',
(?P=q))\s*;''', webpage,
webpage, 'ytAtN challenge',
'raw challenge data', default=None),
default=None, ({js_to_json}, {json.loads}, 'R'))
group='raw_cd', or traverse_obj(
) self.ie._search_regex(
att_txt = traverse_obj( r'''(?sx)window\.ytAtR\s*=\s*(?P<raw_cd>(?P<q>['"])
raw_challenge_data, (?:
({js_to_json}, {json.loads}, {json.loads}, 'bgChallenge') \\.|
) (?!(?P=q)).
if not att_txt: )*
self.logger.warning( (?P=q))\s*;''',
'Failed to extract initial attestation from the webpage' webpage,
) 'ytAtR challenge',
return None default=None),
return att_txt ({js_to_json}, {json.loads})))
if att_txt := traverse_obj(raw_cd, ({json.loads}, 'bgChallenge')):
return att_txt
self.logger.warning('Failed to extract initial attestation from the webpage')
return None
__all__ = ['__version__'] __all__ = ['__version__']

View File

@@ -21,6 +21,7 @@ use std::{
use tauri::{ use tauri::{
menu::{Menu, MenuItem}, menu::{Menu, MenuItem},
tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent}, tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent},
path::BaseDirectory,
Emitter, Manager, State, Emitter, Manager, State,
}; };
use tauri_plugin_opener::OpenerExt; use tauri_plugin_opener::OpenerExt;
@@ -30,6 +31,7 @@ use tokio::{
time::sleep, time::sleep,
}; };
use tokio_tungstenite::accept_async; use tokio_tungstenite::accept_async;
use log::{info, error};
struct ImageCache(StdMutex<HashMap<String, String>>); struct ImageCache(StdMutex<HashMap<String, String>>);
@@ -184,6 +186,16 @@ fn get_current_app_path() -> Result<String, String> {
.into_owned()) .into_owned())
} }
#[tauri::command]
fn is_flatpak() -> bool {
std::env::var("FLATPAK").is_ok()
}
#[tauri::command]
fn get_appimage_path() -> Option<String> {
std::env::var("APPDIR").ok()
}
#[tauri::command] #[tauri::command]
async fn update_config( async fn update_config(
new_config: Config, new_config: Config,
@@ -346,21 +358,48 @@ async fn open_file_with_app(
) -> Result<(), String> { ) -> Result<(), String> {
if let Some(name) = &app_name { if let Some(name) = &app_name {
if name == "explorer" { if name == "explorer" {
println!("Revealing file: {} in explorer", file_path); info!("Revealing file: {} in explorer", file_path);
return app_handle return app_handle
.opener() .opener()
.reveal_item_in_dir(file_path) .reveal_item_in_dir(file_path)
.map_err(|e| e.to_string()); .map_err(|e| {
error!("Failed to reveal file in explorer: {}", e);
e.to_string()
});
} }
println!("Opening file: {} with app: {}", file_path, name); info!("Opening file: {} with app: {}", file_path, name);
} else { } else {
println!("Opening file: {} with default app", file_path); info!("Opening file: {} with default app", file_path);
} }
app_handle app_handle
.opener() .opener()
.open_path(file_path, app_name) .open_path(file_path, app_name)
.map_err(|e| e.to_string()) .map_err(|e| {
error!("Failed to open file: {}", e);
e.to_string()
})
}
#[tauri::command]
async fn open_link_with_app(
app_handle: tauri::AppHandle,
url: String,
app_name: Option<String>,
) -> Result<(), String> {
if let Some(name) = &app_name {
info!("Opening link: {} with app: {}", url, name);
} else {
info!("Opening link: {} with default app", url);
}
app_handle
.opener()
.open_url(url, app_name)
.map_err(|e| {
error!("Failed to open link: {}", e);
e.to_string()
})
} }
#[tauri::command] #[tauri::command]
@@ -574,6 +613,20 @@ pub async fn run() {
.build(app) .build(app)
.map_err(|e| format!("Failed to create tray: {}", e))?; .map_err(|e| format!("Failed to create tray: {}", e))?;
// Fix tray icon in sandboxed environments (e.g., Flatpak)
// libappindicator uses the full path of the icon in dbus messages,
// so the path needs to be accessible from both the host and the sandbox.
// The default /tmp path doesn't work across sandbox boundaries.
if let Ok(local_data_path) = app
.path()
.resolve("tray-icon", BaseDirectory::AppLocalData)
{
let _ = fs::create_dir_all(&local_data_path);
let _ = tray.set_temp_dir_path(Some(local_data_path));
// Re-set the icon so it gets written to the new temp dir path
let _ = tray.set_icon(Some(app.default_window_icon().unwrap().clone()));
}
app.manage(tray); app.manage(tray);
let window = app.get_webview_window("main").unwrap(); let window = app.get_webview_window("main").unwrap();
@@ -594,6 +647,7 @@ pub async fn run() {
kill_all_process, kill_all_process,
fetch_image, fetch_image,
open_file_with_app, open_file_with_app,
open_link_with_app,
list_ongoing_downloads, list_ongoing_downloads,
pause_ongoing_downloads, pause_ongoing_downloads,
send_to_extension, send_to_extension,
@@ -604,6 +658,8 @@ pub async fn run() {
get_config_file_path, get_config_file_path,
restart_websocket_server, restart_websocket_server,
get_current_app_path, get_current_app_path,
is_flatpak,
get_appimage_path
]) ])
.run(tauri::generate_context!()) .run(tauri::generate_context!())
.expect("error while running tauri application"); .expect("error while running tauri application");

View File

@@ -2,7 +2,7 @@
"$schema": "https://schema.tauri.app/config/2", "$schema": "https://schema.tauri.app/config/2",
"productName": "NeoDLP", "productName": "NeoDLP",
"mainBinaryName": "neodlp", "mainBinaryName": "neodlp",
"version": "0.4.1", "version": "0.4.3",
"identifier": "com.neosubhamoy.neodlp", "identifier": "com.neosubhamoy.neodlp",
"build": { "build": {
"beforeDevCommand": "npm run dev", "beforeDevCommand": "npm run dev",

View File

@@ -29,6 +29,7 @@
"targets": ["deb", "rpm"], "targets": ["deb", "rpm"],
"createUpdaterArtifacts": true, "createUpdaterArtifacts": true,
"licenseFile": "../LICENSE", "licenseFile": "../LICENSE",
"category": "Utility",
"icon": [ "icon": [
"icons/32x32.png", "icons/32x32.png",
"icons/128x128.png", "icons/128x128.png",

View File

@@ -0,0 +1,46 @@
{
"identifier": "com.neosubhamoy.neodlp",
"build": {
"beforeDevCommand": "npm run dev",
"beforeBuildCommand": "npm run build",
"devUrl": "http://localhost:1420",
"frontendDist": "../dist"
},
"app": {
"windows": [
{
"title": "NeoDLP",
"width": 1080,
"height": 680,
"decorations": false,
"visible": false
}
],
"security": {
"csp": null,
"capabilities": [
"default",
"shell-scope"
]
}
},
"bundle": {
"active": true,
"targets": ["deb"],
"createUpdaterArtifacts": true,
"licenseFile": "../LICENSE",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"externalBin": [
"binaries/deno"
],
"resources": {
"resources/plugins/yt-dlp-plugins/": "yt-dlp-plugins/"
}
}
}

View File

@@ -29,6 +29,7 @@
"targets": ["deb", "rpm", "appimage"], "targets": ["deb", "rpm", "appimage"],
"createUpdaterArtifacts": true, "createUpdaterArtifacts": true,
"licenseFile": "../LICENSE", "licenseFile": "../LICENSE",
"category": "Utility",
"icon": [ "icon": [
"icons/32x32.png", "icons/32x32.png",
"icons/128x128.png", "icons/128x128.png",

View File

@@ -4,14 +4,14 @@ import { AppContext } from "@/providers/appContextProvider";
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
import { arch, exeExtension } from "@tauri-apps/plugin-os"; import { arch, exeExtension } from "@tauri-apps/plugin-os";
import { downloadDir, join, resourceDir, tempDir } from "@tauri-apps/api/path"; import { downloadDir, join, resourceDir, tempDir } from "@tauri-apps/api/path";
import { useBasePathsStore, useCurrentVideoMetadataStore, useDownloaderPageStatesStore, useDownloadStatesStore, useKvPairsStatesStore, useSettingsPageStatesStore } from "@/services/store"; import { useBasePathsStore, useCurrentVideoMetadataStore, useDownloaderPageStatesStore, useDownloadStatesStore, useEnvironmentStore, useKvPairsStatesStore, useSettingsPageStatesStore } from "@/services/store";
import { isObjEmpty} from "@/utils"; import { isObjEmpty} from "@/utils";
import { Command } from "@tauri-apps/plugin-shell"; import { Command } from "@tauri-apps/plugin-shell";
import { useUpdateDownloadStatus } from "@/services/mutations"; import { useUpdateDownloadStatus } from "@/services/mutations";
import { useQueryClient } from "@tanstack/react-query"; import { useQueryClient } from "@tanstack/react-query";
import { useFetchAllDownloadStates, useFetchAllkVPairs, useFetchAllSettings } from "@/services/queries"; import { useFetchAllDownloadStates, useFetchAllkVPairs, useFetchAllSettings } from "@/services/queries";
import { config } from "@/config"; import { config } from "@/config";
import * as fs from "@tauri-apps/plugin-fs"; // import * as fs from "@tauri-apps/plugin-fs";
import { useYtDlpUpdater } from "@/helpers/use-ytdlp-updater"; import { useYtDlpUpdater } from "@/helpers/use-ytdlp-updater";
import { getVersion } from "@tauri-apps/api/app"; import { getVersion } from "@tauri-apps/api/app";
import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow"; import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow";
@@ -27,6 +27,8 @@ import { useLogger } from "@/helpers/use-logger";
import useDownloader from "@/helpers/use-downloader"; import useDownloader from "@/helpers/use-downloader";
import usePotServer from "@/helpers/use-pot-server"; import usePotServer from "@/helpers/use-pot-server";
import { useLinuxRegisterer } from "@/helpers/use-linux-registerer"; import { useLinuxRegisterer } from "@/helpers/use-linux-registerer";
import { invoke } from "@tauri-apps/api/core";
export default function App({ children }: { children: React.ReactNode }) { export default function App({ children }: { children: React.ReactNode }) {
const { data: downloadStates, isSuccess: isSuccessFetchingDownloadStates } = useFetchAllDownloadStates(); const { data: downloadStates, isSuccess: isSuccessFetchingDownloadStates } = useFetchAllDownloadStates();
@@ -38,6 +40,10 @@ export default function App({ children }: { children: React.ReactNode }) {
const setDownloadStates = useDownloadStatesStore((state) => state.setDownloadStates); const setDownloadStates = useDownloadStatesStore((state) => state.setDownloadStates);
const setPath = useBasePathsStore((state) => state.setPath); const setPath = useBasePathsStore((state) => state.setPath);
const setIsFlatpak = useEnvironmentStore((state) => state.setIsFlatpak);
const setIsAppimage = useEnvironmentStore((state) => state.setIsAppimage);
const setAppDirPath = useEnvironmentStore((state) => state.setAppDirPath);
const setIsUsingDefaultSettings = useSettingsPageStatesStore((state) => state.setIsUsingDefaultSettings); const setIsUsingDefaultSettings = useSettingsPageStatesStore((state) => state.setIsUsingDefaultSettings);
const setSettingsKey = useSettingsPageStatesStore((state) => state.setSettingsKey); const setSettingsKey = useSettingsPageStatesStore((state) => state.setSettingsKey);
const appVersion = useSettingsPageStatesStore(state => state.appVersion); const appVersion = useSettingsPageStatesStore(state => state.appVersion);
@@ -120,6 +126,26 @@ export default function App({ children }: { children: React.ReactNode }) {
}; };
}, [stopPotServer]); }, [stopPotServer]);
// Detect sandbox environments
useEffect(() => {
const detectEnvironment = async () => {
try {
const isFlatpak = await invoke<boolean>('is_flatpak');
const appimagePath = await invoke<string | null>('get_appimage_path');
console.log('Environment detection results:', { isFlatpak, appimagePath });
if (isFlatpak) setIsFlatpak(true);
if (appimagePath) {
setIsAppimage(true);
setAppDirPath(appimagePath);
}
} catch (e) {
console.error('Failed to detect environment:', e);
}
}
detectEnvironment();
}, [setIsFlatpak, setIsAppimage, setAppDirPath]);
// Listen for websocket messages // Listen for websocket messages
useEffect(() => { useEffect(() => {
const unlisten = listen<WebSocketMessage>('websocket-message', (event) => { const unlisten = listen<WebSocketMessage>('websocket-message', (event) => {
@@ -182,22 +208,23 @@ export default function App({ children }: { children: React.ReactNode }) {
try { try {
const currentArch = arch(); const currentArch = arch();
const currentExeExtension = exeExtension(); const currentExeExtension = exeExtension();
const isFlatpak = await invoke<boolean>('is_flatpak');
const downloadDirPath = await downloadDir(); const downloadDirPath = await downloadDir();
const tempDirPath = await tempDir(); const tempDirPath = await tempDir();
const resourceDirPath = await resourceDir(); const resourceDirPath = await resourceDir();
const ffmpegPath = await join(resourceDirPath, 'binaries', `ffmpeg-${currentArch}${currentExeExtension ? '.' + currentExeExtension : ''}`); const ffmpegPath = await join(resourceDirPath, 'binaries', `ffmpeg-${currentArch}${currentExeExtension ? '.' + currentExeExtension : ''}`);
const tempDownloadDirPath = await join(tempDirPath, config.appPkgName, 'downloads'); const tempDownloadDirPath = isFlatpak ? await join(downloadDirPath, config.appName, '.tempdownloads') : await join(tempDirPath, config.appPkgName, 'downloads');
const appDownloadDirPath = await join(downloadDirPath, config.appName); const appDownloadDirPath = await join(downloadDirPath, config.appName);
if (!await fs.exists(tempDownloadDirPath)) fs.mkdir(tempDownloadDirPath, { recursive: true }).then(() => { console.log(`Created DIR: ${tempDownloadDirPath}`) }); // if (!await fs.exists(tempDownloadDirPath)) fs.mkdir(tempDownloadDirPath, { recursive: true }).then(() => { console.log(`Created DIR: ${tempDownloadDirPath}`) });
setPath('ffmpegPath', ffmpegPath); setPath('ffmpegPath', ffmpegPath);
setPath('tempDownloadDirPath', tempDownloadDirPath); setPath('tempDownloadDirPath', tempDownloadDirPath);
if (DOWNLOAD_DIR) { if (DOWNLOAD_DIR) {
setPath('downloadDirPath', DOWNLOAD_DIR); setPath('downloadDirPath', DOWNLOAD_DIR);
} else { } else {
if(!await fs.exists(appDownloadDirPath)) fs.mkdir(appDownloadDirPath, { recursive: true }).then(() => { console.log(`Created DIR: ${appDownloadDirPath}`) }); // if(!await fs.exists(appDownloadDirPath)) fs.mkdir(appDownloadDirPath, { recursive: true }).then(() => { console.log(`Created DIR: ${appDownloadDirPath}`) });
setPath('downloadDirPath', appDownloadDirPath); setPath('downloadDirPath', appDownloadDirPath);
} }
console.log('Paths initialized:', { ffmpegPath, tempDownloadDirPath, downloadDirPath: DOWNLOAD_DIR || appDownloadDirPath }); console.log('Paths initialized:', { ffmpegPath, tempDownloadDirPath, downloadDirPath: DOWNLOAD_DIR || appDownloadDirPath });
@@ -230,7 +257,10 @@ export default function App({ children }: { children: React.ReactNode }) {
const fetchYtDlpVersion = async () => { const fetchYtDlpVersion = async () => {
setIsFetchingYtDlpVersion(true); setIsFetchingYtDlpVersion(true);
try { try {
const command = Command.sidecar('binaries/yt-dlp', ['--version']); const isFlatpak = await invoke<boolean>('is_flatpak');
const command = isFlatpak
? Command.create('sh', ['-c', `yt-dlp --version`])
: Command.sidecar('binaries/yt-dlp', ['--version']);
const output = await command.execute(); const output = await command.execute();
if (output.code === 0) { if (output.code === 0) {
const version = output.stdout.trim(); const version = output.stdout.trim();
@@ -268,30 +298,38 @@ export default function App({ children }: { children: React.ReactNode }) {
// Check for yt-dlp auto-update // Check for yt-dlp auto-update
useEffect(() => { useEffect(() => {
// Only run once when both settings and KV pairs are loaded const handleYtDlpAutoUpdate = async () => {
if (!isSettingsStatePropagated || !isKvPairsStatePropagated) { // Only run once when both settings and KV pairs are loaded
console.log("Skipping yt-dlp auto-update check, waiting for configs to load..."); if (!isSettingsStatePropagated || !isKvPairsStatePropagated) {
return; console.log("Skipping yt-dlp auto-update check, waiting for configs to load...");
} return;
// Skip if we've already run the auto-update once }
if (hasRunYtDlpAutoUpdateRef.current) { // Skip if we've already run the auto-update once
console.log("Auto-update check already performed in this session, skipping"); if (hasRunYtDlpAutoUpdateRef.current) {
return; console.log("Auto-update check already performed in this session, skipping");
} return;
hasRunYtDlpAutoUpdateRef.current = true; }
console.log("Checking yt-dlp auto-update with loaded config values:", { const isFlatpak = await invoke<boolean>('is_flatpak');
autoUpdate: YTDLP_AUTO_UPDATE, if (isFlatpak) {
updateChannel: YTDLP_UPDATE_CHANNEL, console.log("Flatpak detected! Skipping yt-dlp auto-update");
lastCheck: ytDlpUpdateLastCheck return;
}); }
const currentTimestamp = Date.now() hasRunYtDlpAutoUpdateRef.current = true;
const YTDLP_UPDATE_INTERVAL = 86400000 // 24H; console.log("Checking yt-dlp auto-update with loaded config values:", {
if (YTDLP_AUTO_UPDATE && (ytDlpUpdateLastCheck === null || currentTimestamp - ytDlpUpdateLastCheck > YTDLP_UPDATE_INTERVAL)) { autoUpdate: YTDLP_AUTO_UPDATE,
console.log("Running auto-update for yt-dlp..."); updateChannel: YTDLP_UPDATE_CHANNEL,
updateYtDlp(); lastCheck: ytDlpUpdateLastCheck
} else { });
console.log("Skipping yt-dlp auto-update, either disabled or recently updated."); const currentTimestamp = Date.now()
const YTDLP_UPDATE_INTERVAL = 86400000 // 24H;
if (YTDLP_AUTO_UPDATE && (ytDlpUpdateLastCheck === null || currentTimestamp - ytDlpUpdateLastCheck > YTDLP_UPDATE_INTERVAL)) {
console.log("Running auto-update for yt-dlp...");
updateYtDlp();
} else {
console.log("Skipping yt-dlp auto-update, either disabled or recently updated.");
}
} }
handleYtDlpAutoUpdate()
}, [isSettingsStatePropagated, isKvPairsStatePropagated]); }, [isSettingsStatePropagated, isKvPairsStatePropagated]);
// Check POT server status and auto-start if enabled // Check POT server status and auto-start if enabled

View File

@@ -4,7 +4,7 @@ import { AspectRatio } from "@/components/ui/aspect-ratio";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Separator } from "@/components/ui/separator"; import { Separator } from "@/components/ui/separator";
import { toast } from "sonner"; import { toast } from "sonner";
import { useCurrentVideoMetadataStore, useDownloadActionStatesStore, useLibraryPageStatesStore } from "@/services/store"; import { useCurrentVideoMetadataStore, useDownloadActionStatesStore, useEnvironmentStore, useLibraryPageStatesStore } from "@/services/store";
import { formatBitrate, formatCodec, formatDurationString, formatFileSize, paginate } from "@/utils"; import { formatBitrate, formatCodec, formatDurationString, formatFileSize, paginate } from "@/utils";
import { ArrowUpRightIcon, AudioLines, CircleArrowDown, Clock, File, FileAudio2, FileQuestion, FileVideo2, FolderInput, ListVideo, Music, Play, Search, Trash2, Video } from "lucide-react"; import { ArrowUpRightIcon, AudioLines, CircleArrowDown, Clock, File, FileAudio2, FileQuestion, FileVideo2, FolderInput, ListVideo, Music, Play, Search, Trash2, Video } from "lucide-react";
import { invoke } from "@tauri-apps/api/core"; import { invoke } from "@tauri-apps/api/core";
@@ -33,6 +33,8 @@ export function CompletedDownload({ state }: CompletedDownloadProps) {
const downloadActions = useDownloadActionStatesStore(state => state.downloadActions); const downloadActions = useDownloadActionStatesStore(state => state.downloadActions);
const setIsDeleteFileChecked = useDownloadActionStatesStore(state => state.setIsDeleteFileChecked); const setIsDeleteFileChecked = useDownloadActionStatesStore(state => state.setIsDeleteFileChecked);
const isFlatpak = useEnvironmentStore(state => state.isFlatpak);
const queryClient = useQueryClient(); const queryClient = useQueryClient();
const downloadStateDeleter = useDeleteDownloadState(); const downloadStateDeleter = useDeleteDownloadState();
const navigate = useNavigate(); const navigate = useNavigate();
@@ -276,10 +278,12 @@ export function CompletedDownload({ state }: CompletedDownloadProps) {
<Play className="w-4 h-4" /> <Play className="w-4 h-4" />
Open Open
</Button> </Button>
<Button size="sm" variant="outline" onClick={() => openFile(state.filepath, 'explorer')}> {!isFlatpak && (
<FolderInput className="w-4 h-4" /> <Button size="sm" variant="outline" onClick={() => openFile(state.filepath, 'explorer')}>
Reveal <FolderInput className="w-4 h-4" />
</Button> Reveal
</Button>
)}
<Button size="sm" variant="outline" onClick={() => handleSearch(state.url, state.playlist_id ? true : false)}> <Button size="sm" variant="outline" onClick={() => handleSearch(state.url, state.playlist_id ? true : false)}>
<Search className="w-4 h-4" /> <Search className="w-4 h-4" />
Search Search

View File

@@ -1,13 +1,13 @@
import { useEffect } from "react"; import { useEffect } from "react";
import { Card } from "@/components/ui/card"; import { Card } from "@/components/ui/card";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { useBasePathsStore, useDownloaderPageStatesStore, useDownloadStatesStore, useSettingsPageStatesStore } from "@/services/store"; import { useBasePathsStore, useDownloaderPageStatesStore, useDownloadStatesStore, useEnvironmentStore, useSettingsPageStatesStore } from "@/services/store";
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue } from "@/components/ui/select"; import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue } from "@/components/ui/select";
import { Switch } from "@/components/ui/switch"; import { Switch } from "@/components/ui/switch";
import { Label } from "@/components/ui/label"; import { Label } from "@/components/ui/label";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { toast } from "sonner"; import { toast } from "sonner";
import { BadgeCheck, BellRing, BrushCleaning, Bug, Cookie, ExternalLink, FilePen, FileVideo, Folder, FolderOpen, Github, Globe, Heart, Info, KeyRound, Loader2, LucideIcon, Mail, Monitor, Moon, Package, Scale, ShieldMinus, SquareTerminal, Sun, Terminal, Timer, Trash, TriangleAlert, WandSparkles, Wifi, Wrench } from "lucide-react"; import { BadgeCheck, BellRing, BrushCleaning, Bug, CircleCheck, Cookie, ExternalLink, FilePen, FileVideo, Folder, FolderOpen, Github, Globe, Heart, Info, KeyRound, Loader2, LucideIcon, Mail, Monitor, Moon, Package, Scale, ShieldMinus, SquareTerminal, Sun, Terminal, Timer, Trash, TriangleAlert, WandSparkles, Wifi, Wrench } from "lucide-react";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { Slider } from "@/components/ui/slider"; import { Slider } from "@/components/ui/slider";
import { Input } from "@/components/ui/input"; import { Input } from "@/components/ui/input";
@@ -285,6 +285,8 @@ function AppAppearanceSettings() {
function AppFolderSettings() { function AppFolderSettings() {
const { saveSettingsKey } = useSettings(); const { saveSettingsKey } = useSettings();
const isFlatpak = useEnvironmentStore(state => state.isFlatpak);
const formResetTrigger = useSettingsPageStatesStore(state => state.formResetTrigger); const formResetTrigger = useSettingsPageStatesStore(state => state.formResetTrigger);
const acknowledgeFormReset = useSettingsPageStatesStore(state => state.acknowledgeFormReset); const acknowledgeFormReset = useSettingsPageStatesStore(state => state.acknowledgeFormReset);
@@ -364,6 +366,7 @@ function AppFolderSettings() {
<Input className="focus-visible:ring-0" type="text" placeholder="Select download directory" value={downloadDirPath ?? 'Unknown'} readOnly/> <Input className="focus-visible:ring-0" type="text" placeholder="Select download directory" value={downloadDirPath ?? 'Unknown'} readOnly/>
<Button <Button
variant="outline" variant="outline"
disabled={isFlatpak}
onClick={async () => { onClick={async () => {
try { try {
const folder = await open({ const folder = await open({
@@ -395,7 +398,7 @@ function AppFolderSettings() {
<AlertDialogTrigger asChild> <AlertDialogTrigger asChild>
<Button <Button
variant="destructive" variant="destructive"
disabled={ongoingDownloads.length > 0} disabled={ongoingDownloads.length > 0 || isFlatpak}
> >
<BrushCleaning className="size-4" /> Clean <BrushCleaning className="size-4" /> Clean
</Button> </Button>
@@ -782,6 +785,8 @@ function AppNetworkSettings() {
function AppCookiesSettings() { function AppCookiesSettings() {
const { saveSettingsKey } = useSettings(); const { saveSettingsKey } = useSettings();
const isFlatpak = useEnvironmentStore(state => state.isFlatpak);
const useCookies = useSettingsPageStatesStore(state => state.settings.use_cookies); const useCookies = useSettingsPageStatesStore(state => state.settings.use_cookies);
const importCookiesFrom = useSettingsPageStatesStore(state => state.settings.import_cookies_from); const importCookiesFrom = useSettingsPageStatesStore(state => state.settings.import_cookies_from);
const cookiesBrowser = useSettingsPageStatesStore(state => state.settings.cookies_browser); const cookiesBrowser = useSettingsPageStatesStore(state => state.settings.cookies_browser);
@@ -798,7 +803,7 @@ function AppCookiesSettings() {
id="use-cookies" id="use-cookies"
checked={useCookies} checked={useCookies}
onCheckedChange={(checked) => saveSettingsKey('use_cookies', checked)} onCheckedChange={(checked) => saveSettingsKey('use_cookies', checked)}
disabled={useCustomCommands} disabled={useCustomCommands || isFlatpak}
/> />
<Label htmlFor="use-cookies">Use Cookies</Label> <Label htmlFor="use-cookies">Use Cookies</Label>
</div> </div>
@@ -807,7 +812,7 @@ function AppCookiesSettings() {
className="flex items-center gap-4" className="flex items-center gap-4"
value={importCookiesFrom} value={importCookiesFrom}
onValueChange={(value) => saveSettingsKey('import_cookies_from', value)} onValueChange={(value) => saveSettingsKey('import_cookies_from', value)}
disabled={!useCookies || useCustomCommands} disabled={!useCookies || useCustomCommands || isFlatpak}
> >
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<RadioGroupItem value="browser" id="cookies-browser" /> <RadioGroupItem value="browser" id="cookies-browser" />
@@ -823,7 +828,7 @@ function AppCookiesSettings() {
<Select <Select
value={cookiesBrowser} value={cookiesBrowser}
onValueChange={(value) => saveSettingsKey('cookies_browser', value)} onValueChange={(value) => saveSettingsKey('cookies_browser', value)}
disabled={importCookiesFrom !== "browser" || !useCookies || useCustomCommands} disabled={importCookiesFrom !== "browser" || !useCookies || useCustomCommands || isFlatpak}
> >
<SelectTrigger className="w-57.5 ring-0 focus:ring-0"> <SelectTrigger className="w-57.5 ring-0 focus:ring-0">
<SelectValue placeholder="Select browser to import cookies" /> <SelectValue placeholder="Select browser to import cookies" />
@@ -850,7 +855,7 @@ function AppCookiesSettings() {
<Input className="focus-visible:ring-0" type="text" placeholder="Select cookies text file" value={cookiesFile ?? ''} disabled={importCookiesFrom !== "file" || !useCookies} readOnly/> <Input className="focus-visible:ring-0" type="text" placeholder="Select cookies text file" value={cookiesFile ?? ''} disabled={importCookiesFrom !== "file" || !useCookies} readOnly/>
<Button <Button
variant="outline" variant="outline"
disabled={importCookiesFrom !== "file" || !useCookies || useCustomCommands} disabled={importCookiesFrom !== "file" || !useCookies || useCustomCommands || isFlatpak}
onClick={async () => { onClick={async () => {
try { try {
const file = await open({ const file = await open({
@@ -1249,6 +1254,8 @@ function AppDelaySettings() {
} }
function AppPoTokenSettings() { function AppPoTokenSettings() {
const isFlatpak = useEnvironmentStore(state => state.isFlatpak);
const formResetTrigger = useSettingsPageStatesStore(state => state.formResetTrigger); const formResetTrigger = useSettingsPageStatesStore(state => state.formResetTrigger);
const acknowledgeFormReset = useSettingsPageStatesStore(state => state.acknowledgeFormReset); const acknowledgeFormReset = useSettingsPageStatesStore(state => state.acknowledgeFormReset);
@@ -1320,7 +1327,7 @@ function AppPoTokenSettings() {
await stopPotServer(); await stopPotServer();
} }
}} }}
disabled={useCustomCommands || isStartingPotServer || isChangingPotServerPort} disabled={useCustomCommands || isStartingPotServer || isChangingPotServerPort || isFlatpak}
/> />
<Label htmlFor="use-potoken">Use PO Token</Label> <Label htmlFor="use-potoken">Use PO Token</Label>
</div> </div>
@@ -1346,7 +1353,7 @@ function AppPoTokenSettings() {
id="disable-innertube" id="disable-innertube"
checked={disableInnertube} checked={disableInnertube}
onCheckedChange={(checked) => saveSettingsKey('disable_innertube', checked)} onCheckedChange={(checked) => saveSettingsKey('disable_innertube', checked)}
disabled={useCustomCommands || !usePotoken} disabled={useCustomCommands || !usePotoken || isFlatpak}
/> />
</div> </div>
</div> </div>
@@ -1359,7 +1366,7 @@ function AppPoTokenSettings() {
<FormField <FormField
control={potServerPortForm.control} control={potServerPortForm.control}
name="port" name="port"
disabled={!usePotoken || useCustomCommands || isChangingPotServerPort || isStartingPotServer} disabled={!usePotoken || isChangingPotServerPort || isStartingPotServer || isFlatpak}
render={({ field }) => ( render={({ field }) => (
<FormItem className="w-full"> <FormItem className="w-full">
<FormControl> <FormControl>
@@ -1378,7 +1385,7 @@ function AppPoTokenSettings() {
/> />
<Button <Button
type="submit" type="submit"
disabled={!watchedPotServerPort || Number(watchedPotServerPort) === potServerPort || Object.keys(potServerPortFormErrors).length > 0 || !usePotoken || useCustomCommands || isChangingPotServerPort || isStartingPotServer} disabled={!watchedPotServerPort || Number(watchedPotServerPort) === potServerPort || Object.keys(potServerPortFormErrors).length > 0 || !usePotoken || useCustomCommands || isChangingPotServerPort || isStartingPotServer || isFlatpak}
> >
{isChangingPotServerPort ? ( {isChangingPotServerPort ? (
<> <>
@@ -1400,6 +1407,8 @@ function AppPoTokenSettings() {
function AppNotificationSettings() { function AppNotificationSettings() {
const { saveSettingsKey } = useSettings(); const { saveSettingsKey } = useSettings();
const isFlatpak = useEnvironmentStore(state => state.isFlatpak);
const enableNotifications = useSettingsPageStatesStore(state => state.settings.enable_notifications); const enableNotifications = useSettingsPageStatesStore(state => state.settings.enable_notifications);
const updateNotification = useSettingsPageStatesStore(state => state.settings.update_notification); const updateNotification = useSettingsPageStatesStore(state => state.settings.update_notification);
const downloadCompletionNotification = useSettingsPageStatesStore(state => state.settings.download_completion_notification); const downloadCompletionNotification = useSettingsPageStatesStore(state => state.settings.download_completion_notification);
@@ -1413,6 +1422,7 @@ function AppNotificationSettings() {
<Switch <Switch
id="enable-notifications" id="enable-notifications"
checked={enableNotifications} checked={enableNotifications}
disabled={isFlatpak}
onCheckedChange={async (checked) => { onCheckedChange={async (checked) => {
if (checked) { if (checked) {
const granted = await isPermissionGranted(); const granted = await isPermissionGranted();
@@ -1438,7 +1448,7 @@ function AppNotificationSettings() {
id="update-notification" id="update-notification"
checked={updateNotification} checked={updateNotification}
onCheckedChange={(checked) => saveSettingsKey('update_notification', checked)} onCheckedChange={(checked) => saveSettingsKey('update_notification', checked)}
disabled={!enableNotifications} disabled={!enableNotifications || isFlatpak}
/> />
<Label htmlFor="update-notification">App Updates</Label> <Label htmlFor="update-notification">App Updates</Label>
</div> </div>
@@ -1447,7 +1457,7 @@ function AppNotificationSettings() {
id="download-completion-notification" id="download-completion-notification"
checked={downloadCompletionNotification} checked={downloadCompletionNotification}
onCheckedChange={(checked) => saveSettingsKey('download_completion_notification', checked)} onCheckedChange={(checked) => saveSettingsKey('download_completion_notification', checked)}
disabled={!enableNotifications} disabled={!enableNotifications || isFlatpak}
/> />
<Label htmlFor="download-completion-notification">Download Completion</Label> <Label htmlFor="download-completion-notification">Download Completion</Label>
</div> </div>
@@ -1686,6 +1696,9 @@ function AppDebugSettings() {
} }
function AppInfoSettings() { function AppInfoSettings() {
const isFlatpak = useEnvironmentStore(state => state.isFlatpak);
const isAppimage = useEnvironmentStore(state => state.isAppimage);
const appVersion = useSettingsPageStatesStore(state => state.appVersion); const appVersion = useSettingsPageStatesStore(state => state.appVersion);
const binDepsList = [ const binDepsList = [
@@ -1799,6 +1812,35 @@ function AppInfoSettings() {
</Button> </Button>
</Card> </Card>
</div> </div>
<div className="healthcheck">
<h3 className="font-semibold">Health Check</h3>
<p className="text-xs text-muted-foreground mb-3">Ensure everything is working fine</p>
{isFlatpak ? (
<Alert className="">
<TriangleAlert className="size-4 stroke-primary" />
<AlertTitle className="text-sm">Flatpak Sandbox Detected!</AlertTitle>
<AlertDescription className="text-xs">
It looks like you are running NeoDLP in a Flatpak sandbox. Some features like browser integration, desktop notifications, cookies, po tokens, changing download folder, revealing completed downloads in explorer, automatic yt-dlp updates and auto-launch on startup are not available in Flatpak due to sandbox restrictions. To use these features, please install the native linux build (DEB, RPM or AUR) of NeoDLP.
</AlertDescription>
</Alert>
) : isAppimage ? (
<Alert className="">
<TriangleAlert className="size-4 stroke-primary" />
<AlertTitle className="text-sm">Appimage Environment Detected!</AlertTitle>
<AlertDescription className="text-xs">
Looks like you are using NeoDLP Appimage. NeoDLP's browser integration features are not available on Appimage environment due to it's limitations. To use NeoDLP's browser integration features please install the native linux build (DEB, RPM or AUR) of NeoDLP.
</AlertDescription>
</Alert>
) : (
<Alert className="">
<CircleCheck className="size-4 stroke-primary" />
<AlertTitle className="text-sm">All Set! Cheers :)</AlertTitle>
<AlertDescription className="text-xs">
NeoDLP is running as normal without any limitations! You should be able to use all the features of NeoDLP without any issues. If you face any problem, feel free to report it to us.
</AlertDescription>
</Alert>
)}
</div>
<div className="bug-report"> <div className="bug-report">
<h3 className="font-semibold">Bug Report</h3> <h3 className="font-semibold">Bug Report</h3>
<p className="text-xs text-muted-foreground mb-3">Noticed any bug or inconsistencies? Report it to help us improve</p> <p className="text-xs text-muted-foreground mb-3">Noticed any bug or inconsistencies? Report it to help us improve</p>
@@ -1869,6 +1911,8 @@ function AppInfoSettings() {
} }
export function ApplicationSettings() { export function ApplicationSettings() {
const isFlatpak = useEnvironmentStore(state => state.isFlatpak);
const activeSubAppTab = useSettingsPageStatesStore(state => state.activeSubAppTab); const activeSubAppTab = useSettingsPageStatesStore(state => state.activeSubAppTab);
const setActiveSubAppTab = useSettingsPageStatesStore(state => state.setActiveSubAppTab); const setActiveSubAppTab = useSettingsPageStatesStore(state => state.setActiveSubAppTab);
@@ -1926,12 +1970,14 @@ export function ApplicationSettings() {
<Switch <Switch
id="ytdlp-auto-update" id="ytdlp-auto-update"
checked={ytDlpAutoUpdate} checked={ytDlpAutoUpdate}
disabled={isFlatpak}
onCheckedChange={(checked) => saveSettingsKey('ytdlp_auto_update', checked)} onCheckedChange={(checked) => saveSettingsKey('ytdlp_auto_update', checked)}
/> />
<Label htmlFor="ytdlp-auto-update">Auto Update</Label> <Label htmlFor="ytdlp-auto-update">Auto Update</Label>
</div> </div>
<Select <Select
value={ytDlpUpdateChannel} value={ytDlpUpdateChannel}
disabled={isFlatpak}
onValueChange={(value) => saveSettingsKey('ytdlp_update_channel', value)} onValueChange={(value) => saveSettingsKey('ytdlp_update_channel', value)}
> >
<SelectTrigger className="w-37.5 ring-0 focus:ring-0"> <SelectTrigger className="w-37.5 ring-0 focus:ring-0">
@@ -1946,7 +1992,7 @@ export function ApplicationSettings() {
</SelectContent> </SelectContent>
</Select> </Select>
<Button <Button
disabled={ytDlpAutoUpdate || isUpdatingYtDlp || ongoingDownloads.length > 0} disabled={ytDlpAutoUpdate || isUpdatingYtDlp || ongoingDownloads.length > 0 || isFlatpak}
onClick={async () => await updateYtDlp()} onClick={async () => await updateYtDlp()}
> >
{isUpdatingYtDlp ? ( {isUpdatingYtDlp ? (

View File

@@ -1,7 +1,7 @@
import { useEffect } from "react"; import { useEffect } from "react";
import { Card } from "@/components/ui/card"; import { Card } from "@/components/ui/card";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { useSettingsPageStatesStore } from "@/services/store"; import { useEnvironmentStore, useSettingsPageStatesStore } from "@/services/store";
import { Label } from "@/components/ui/label"; import { Label } from "@/components/ui/label";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { toast } from "sonner"; import { toast } from "sonner";
@@ -15,6 +15,7 @@ import { invoke } from "@tauri-apps/api/core";
import { SlidingButton } from "@/components/custom/slidingButton"; import { SlidingButton } from "@/components/custom/slidingButton";
import clsx from "clsx"; import clsx from "clsx";
import { NumberInput } from "@/components/custom/numberInput"; import { NumberInput } from "@/components/custom/numberInput";
import { platform } from "@tauri-apps/plugin-os";
const websocketPortSchema = z.object({ const websocketPortSchema = z.object({
port: z.coerce.number<number>({ port: z.coerce.number<number>({
@@ -31,9 +32,12 @@ const websocketPortSchema = z.object({
}); });
function ExtInstallSettings() { function ExtInstallSettings() {
const currentPlatform = platform();
const isFlatpak = useEnvironmentStore(state => state.isFlatpak);
const openLink = async (url: string, app: string | null) => { const openLink = async (url: string, app: string | null) => {
try { try {
await invoke('open_file_with_app', { filePath: url, appName: app }).then(() => { await invoke('open_link_with_app', { url: url, appName: app }).then(() => {
toast.info("Opening link", { toast.info("Opening link", {
description: `Opening link with ${app ? app : 'default app'}.`, description: `Opening link with ${app ? app : 'default app'}.`,
}) })
@@ -58,7 +62,7 @@ function ExtInstallSettings() {
<span>Get Now</span> <span>Get Now</span>
</div> </div>
} }
onClick={() => openLink('https://chromewebstore.google.com/detail/neo-downloader-plus/mehopeailfjmiloiiohgicphlcgpompf', 'chrome')} onClick={() => openLink('https://chromewebstore.google.com/detail/neo-downloader-plus/mehopeailfjmiloiiohgicphlcgpompf', isFlatpak ? null : currentPlatform === "linux" ? 'google-chrome' : 'chrome')}
> >
<span className="font-semibold flex items-center gap-2"> <span className="font-semibold flex items-center gap-2">
<svg className="size-4 fill-primary-foreground" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"> <svg className="size-4 fill-primary-foreground" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -75,7 +79,7 @@ function ExtInstallSettings() {
<span>Get Now</span> <span>Get Now</span>
</div> </div>
} }
onClick={() => openLink('https://addons.mozilla.org/en-US/firefox/addon/neo-downloader-plus', 'firefox')} onClick={() => openLink('https://addons.mozilla.org/en-US/firefox/addon/neo-downloader-plus', isFlatpak ? null : 'firefox')}
> >
<span className="font-semibold flex items-center gap-2"> <span className="font-semibold flex items-center gap-2">
<svg className="size-4 fill-primary-foreground" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"> <svg className="size-4 fill-primary-foreground" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -87,11 +91,11 @@ function ExtInstallSettings() {
</SlidingButton> </SlidingButton>
</div> </div>
<div className="flex gap-2 mb-4"> <div className="flex gap-2 mb-4">
<Button variant="outline" onClick={() => openLink('https://chromewebstore.google.com/detail/neo-downloader-plus/mehopeailfjmiloiiohgicphlcgpompf', 'msedge')}>Edge</Button> <Button variant="outline" onClick={() => openLink('https://chromewebstore.google.com/detail/neo-downloader-plus/mehopeailfjmiloiiohgicphlcgpompf', isFlatpak ? null : 'msedge')}>Edge</Button>
<Button variant="outline" onClick={() => openLink('https://chromewebstore.google.com/detail/neo-downloader-plus/mehopeailfjmiloiiohgicphlcgpompf', 'opera')}>Opera</Button> <Button variant="outline" onClick={() => openLink('https://chromewebstore.google.com/detail/neo-downloader-plus/mehopeailfjmiloiiohgicphlcgpompf', isFlatpak ? null : 'opera')}>Opera</Button>
<Button variant="outline" onClick={() => openLink('https://chromewebstore.google.com/detail/neo-downloader-plus/mehopeailfjmiloiiohgicphlcgpompf', 'brave')}>Brave</Button> <Button variant="outline" onClick={() => openLink('https://chromewebstore.google.com/detail/neo-downloader-plus/mehopeailfjmiloiiohgicphlcgpompf', isFlatpak ? null : 'brave')}>Brave</Button>
<Button variant="outline" onClick={() => openLink('https://chromewebstore.google.com/detail/neo-downloader-plus/mehopeailfjmiloiiohgicphlcgpompf', 'vivaldi')}>Vivaldi</Button> <Button variant="outline" onClick={() => openLink('https://chromewebstore.google.com/detail/neo-downloader-plus/mehopeailfjmiloiiohgicphlcgpompf', isFlatpak ? null : 'vivaldi')}>Vivaldi</Button>
<Button variant="outline" onClick={() => openLink('https://addons.mozilla.org/en-US/firefox/addon/neo-downloader-plus', 'zen')}>Zen</Button> <Button variant="outline" onClick={() => openLink('https://addons.mozilla.org/en-US/firefox/addon/neo-downloader-plus', isFlatpak ? null : 'zen')}>Zen</Button>
</div> </div>
<p className="text-xs text-muted-foreground mb-2">* These links opens with coresponding browsers only. Make sure the browser is installed before clicking the link</p> <p className="text-xs text-muted-foreground mb-2">* These links opens with coresponding browsers only. Make sure the browser is installed before clicking the link</p>
</div> </div>

View File

@@ -46,7 +46,7 @@ export function AppSidebar() {
]; ];
useEffect(() => { useEffect(() => {
let timeout: NodeJS.Timeout; let timeout: ReturnType<typeof setTimeout>;
if (open) { if (open) {
timeout = setTimeout(() => { timeout = setTimeout(() => {
setShowBadge(true); setShowBadge(true);

View File

@@ -196,7 +196,10 @@ export default function useDownloader() {
} }
} }
const command = Command.sidecar('binaries/yt-dlp', args); const isFlatpak = await invoke<boolean>('is_flatpak');
const command = isFlatpak
? Command.create('sh', ['-c', `yt-dlp ${args.map(arg => `'${arg.replace(/'/g, "'\\''")}'`).join(' ')}`])
: Command.sidecar('binaries/yt-dlp', args);
let jsonOutput = ''; let jsonOutput = '';
@@ -557,7 +560,10 @@ export default function useDownloader() {
} }
console.log('Starting download with args:', args); console.log('Starting download with args:', args);
const command = Command.sidecar('binaries/yt-dlp', args); const isFlatpak = await invoke<boolean>('is_flatpak');
const command = isFlatpak
? Command.create('sh', ['-c', `yt-dlp ${args.map(arg => `'${arg.replace(/'/g, "'\\''")}'`).join(' ')}`])
: Command.sidecar('binaries/yt-dlp', args);
command.on('close', async (data) => { command.on('close', async (data) => {
if (data.code !== 0) { if (data.code !== 0) {

View File

@@ -2,11 +2,14 @@ import { join, resourceDir, homeDir } from "@tauri-apps/api/path";
import * as fs from "@tauri-apps/plugin-fs"; import * as fs from "@tauri-apps/plugin-fs";
import { useKvPairs } from "@/helpers/use-kvpairs"; import { useKvPairs } from "@/helpers/use-kvpairs";
import { useSettingsPageStatesStore } from "@/services/store"; import { useSettingsPageStatesStore } from "@/services/store";
// import { Command } from "@tauri-apps/plugin-shell";
import { invoke } from "@tauri-apps/api/core";
interface FileMap { interface FileMap {
source: string; source: string;
destination: string; destination: string;
dir: string; dir: string;
content?: string;
} }
export function useLinuxRegisterer() { export function useLinuxRegisterer() {
@@ -15,29 +18,87 @@ export function useLinuxRegisterer() {
const registerToLinux = async () => { const registerToLinux = async () => {
try { try {
const isFlatpak = await invoke<boolean>('is_flatpak');
const resourceDirPath = isFlatpak ? '/app/lib/neodlp' : await resourceDir();
const homeDirPath = await homeDir();
// const flatpakChromeManifestContent = {
// name: "com.neosubhamoy.neodlp",
// description: "NeoDLP MsgHost",
// path: `${homeDirPath}/.local/bin/neodlp-msghost`,
// type: "stdio",
// allowed_origins: ["chrome-extension://mehopeailfjmiloiiohgicphlcgpompf/"]
// };
// const flatpakFirefoxManifestContent = {
// name: "com.neosubhamoy.neodlp",
// description: "NeoDLP MsgHost",
// path: `${homeDirPath}/.local/bin/neodlp-msghost`,
// type: "stdio",
// allowed_extensions: ["neodlp@neosubhamoy.com"]
// };
const filesToCopy: FileMap[] = [ const filesToCopy: FileMap[] = [
{ source: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil.py', destination: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil.py', dir: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/' }, { source: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil.py', destination: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil.py', dir: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/' },
{ source: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_cli.py', destination: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_cli.py', dir: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/' }, { source: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_cli.py', destination: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_cli.py', dir: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/' },
{ source: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_http.py', destination: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_http.py', dir: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/' }, { source: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_http.py', destination: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_http.py', dir: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/' },
]; ];
const resourceDirPath = await resourceDir(); // const filesToCopyFlatpak: FileMap[] = [
const homeDirPath = await homeDir(); // { source: 'chrome.json', destination: '.config/google-chrome/NativeMessagingHosts/com.neosubhamoy.neodlp.json', dir: '.config/google-chrome/NativeMessagingHosts/', content: JSON.stringify(flatpakChromeManifestContent) },
// { source: 'chrome.json', destination: '.config/chromium/NativeMessagingHosts/com.neosubhamoy.neodlp.json', dir: '.config/chromium/NativeMessagingHosts/', content: JSON.stringify(flatpakChromeManifestContent) },
// { source: 'firefox.json', destination: '.mozilla/native-messaging-hosts/com.neosubhamoy.neodlp.json', dir: '.mozilla/native-messaging-hosts/', content: JSON.stringify(flatpakFirefoxManifestContent) },
// { source: 'neodlp-msghost', destination: '.local/bin/neodlp-msghost', dir: '.local/bin/' },
for (const file of filesToCopy) { // { source: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil.py', destination: '.var/app/com.neosubhamoy.neodlp/config/yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil.py', dir: '.var/app/com.neosubhamoy.neodlp/config/yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/' },
const sourcePath = await join(resourceDirPath, file.source); // { source: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_cli.py', destination: '.var/app/com.neosubhamoy.neodlp/config/yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_cli.py', dir: '.var/app/com.neosubhamoy.neodlp/config/yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/' },
const destinationDir = await join(homeDirPath, file.dir); // { source: 'yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_http.py', destination: '.var/app/com.neosubhamoy.neodlp/config/yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/getpot_bgutil_http.py', dir: '.var/app/com.neosubhamoy.neodlp/config/yt-dlp-plugins/bgutil-ytdlp-pot-provider/yt_dlp_plugins/extractor/' },
const destinationPath = await join(homeDirPath, file.destination); // ];
const dirExists = await fs.exists(destinationDir); if (isFlatpak) {
if (dirExists) { // Skip linux registration for Flatpak
await fs.copyFile(sourcePath, destinationPath); console.log('Flatpak sandbox detected! Skipping Linux registration...');
console.log(`File ${file.source} copied successfully to ${destinationPath}`);
} else { // for (const file of filesToCopyFlatpak) {
await fs.mkdir(destinationDir, { recursive: true }) // const sourcePath = await join(resourceDirPath, file.source);
console.log(`Created dir ${destinationDir}`); // const destinationDir = await join(homeDirPath, file.dir);
await fs.copyFile(sourcePath, destinationPath); // const destinationPath = await join(homeDirPath, file.destination);
console.log(`File ${file.source} copied successfully to ${destinationPath}`); // const escapedContent = file.content?.replace(/'/g, `'\\''`) || '';
// const copyCommand = Command.create('sh', ['-c', `mkdir -p "${destinationDir}" && cp "${sourcePath}" "${destinationPath}"`]);
// const writeCommand = Command.create('sh', ['-c', `printf '%s' '${escapedContent}' > "${destinationPath}"`]);
// if (file.content) {
// const writeOutput = await writeCommand.execute();
// if (writeOutput.code === 0) {
// console.log(`File ${file.destination} created successfully at ${destinationPath}`);
// } else {
// console.error(`Failed to create file ${file.destination} at ${destinationPath}:`, writeOutput.stderr);
// return { success: false, message: 'Failed to register' };
// }
// } else {
// const copyOutput = await copyCommand.execute();
// if (copyOutput.code === 0) {
// console.log(`File ${file.source} copied successfully to ${destinationPath}`);
// } else {
// console.error(`Failed to copy file ${file.source} to ${destinationPath}:`, copyOutput.stderr);
// return { success: false, message: 'Failed to register' };
// }
// }
// }
} else {
for (const file of filesToCopy) {
const sourcePath = await join(resourceDirPath, file.source);
const destinationDir = await join(homeDirPath, file.dir);
const destinationPath = await join(homeDirPath, file.destination);
const dirExists = await fs.exists(destinationDir);
if (dirExists) {
await fs.copyFile(sourcePath, destinationPath);
console.log(`File ${file.source} copied successfully to ${destinationPath}`);
} else {
await fs.mkdir(destinationDir, { recursive: true })
console.log(`Created dir ${destinationDir}`);
await fs.copyFile(sourcePath, destinationPath);
console.log(`File ${file.source} copied successfully to ${destinationPath}`);
}
} }
} }
saveKvPair('linux_registered_version', appVersion); saveKvPair('linux_registered_version', appVersion);

View File

@@ -17,7 +17,13 @@ export default function usePotServer() {
}; };
const startPotServer = async (port?: number) => { const startPotServer = async (port?: number) => {
const runCommand = Command.sidecar('binaries/neodlp-pot', [ const isFlatpak = await invoke<boolean>('is_flatpak');
const runCommand = isFlatpak
? Command.create('sh', [
'-c',
`neodlp-pot server --port ${port ? port.toString() : potServerPort.toString()}`
])
: Command.sidecar('binaries/neodlp-pot', [
'server', 'server',
'--port', '--port',
port ? port.toString() : potServerPort.toString(), port ? port.toString() : potServerPort.toString(),

View File

@@ -17,10 +17,17 @@ export function useYtDlpUpdater() {
const updateYtDlp = async () => { const updateYtDlp = async () => {
const CURRENT_TIMESTAMP = Date.now(); const CURRENT_TIMESTAMP = Date.now();
const isFlatpak = await invoke<boolean>('is_flatpak');
setIsUpdatingYtDlp(true); setIsUpdatingYtDlp(true);
LOG.info('NEODLP', 'Updating yt-dlp to latest version'); LOG.info('NEODLP', 'Updating yt-dlp to latest version');
try { try {
const command = currentPlatform === 'linux' ? Command.create('pkexec', ['yt-dlp', '--update-to', ytDlpUpdateChannel]) : Command.sidecar('binaries/yt-dlp', ['--update-to', ytDlpUpdateChannel]); const command = currentPlatform === 'linux' && isFlatpak
? ytDlpUpdateChannel === 'nightly'
? Command.create('sh', ['-c', 'pip3 install -U --pre "yt-dlp[default,curl-cffi]"'])
: Command.create('sh', ['-c', 'pip3 install -U "yt-dlp[default,curl-cffi]"'])
: currentPlatform === 'linux'
? Command.create('pkexec', ['yt-dlp', '--update-to', ytDlpUpdateChannel])
: Command.sidecar('binaries/yt-dlp', ['--update-to', ytDlpUpdateChannel]);
const output = await command.execute(); const output = await command.execute();
if (output.code === 0) { if (output.code === 0) {
console.log("yt-dlp updated successfully:", output.stdout); console.log("yt-dlp updated successfully:", output.stdout);

View File

@@ -1,4 +1,4 @@
import { BasePathsStore, CurrentVideoMetadataStore, DownloadActionStatesStore, DownloaderPageStatesStore, DownloadStatesStore, KvPairsStatesStore, LibraryPageStatesStore, LogsStore, SettingsPageStatesStore } from '@/types/store'; import { BasePathsStore, CurrentVideoMetadataStore, DownloadActionStatesStore, DownloaderPageStatesStore, DownloadStatesStore, EnvironmentStore, KvPairsStatesStore, LibraryPageStatesStore, LogsStore, SettingsPageStatesStore } from '@/types/store';
import { create } from 'zustand'; import { create } from 'zustand';
export const useBasePathsStore = create<BasePathsStore>((set) => ({ export const useBasePathsStore = create<BasePathsStore>((set) => ({
@@ -352,3 +352,12 @@ export const useLogsStore = create<LogsStore>((set) => ({
addLog: (log) => set((state) => ({ logs: [...state.logs, log] })), addLog: (log) => set((state) => ({ logs: [...state.logs, log] })),
clearLogs: () => set(() => ({ logs: [] })) clearLogs: () => set(() => ({ logs: [] }))
})); }));
export const useEnvironmentStore = create<EnvironmentStore>((set) => ({
isFlatpak: false,
isAppimage: false,
appDirPath: null,
setIsFlatpak: (isFlatpak) => set(() => ({ isFlatpak })),
setIsAppimage: (isAppimage) => set(() => ({ isAppimage })),
setAppDirPath: (path) => set(() => ({ appDirPath: path }))
}));

View File

@@ -152,3 +152,12 @@ export interface LogsStore {
addLog: (log: Log) => void; addLog: (log: Log) => void;
clearLogs: () => void; clearLogs: () => void;
} }
export interface EnvironmentStore {
isFlatpak: boolean;
isAppimage: boolean;
appDirPath: string | null;
setIsFlatpak: (isFlatpak: boolean) => void;
setIsAppimage: (isAppimage: boolean) => void;
setAppDirPath: (path: string) => void;
}