1
1
mirror of https://github.com/neosubhamoy/pytubepp-helper.git synced 2026-02-04 03:12:22 +05:30

(feat): added nodejs detection

This commit is contained in:
2025-01-26 19:42:04 +05:30
Verified
parent 01c50cd339
commit 8bae029b5a
6 changed files with 56 additions and 8 deletions

View File

@@ -82,6 +82,11 @@
"cmd": "ffmpeg",
"args": ["-version"]
},
{
"name": "is-nodejs-installed",
"cmd": "node",
"args": ["--version"]
},
{
"name": "is-pytubepp-installed",
"cmd": "pytubepp",
@@ -114,8 +119,8 @@
"windows": [
{
"title": "PytubePP Helper",
"width": 500,
"height": 320
"width": 510,
"height": 345
}
],
"security": {

View File

@@ -82,6 +82,11 @@
"cmd": "ffmpeg",
"args": ["-version"]
},
{
"name": "is-nodejs-installed",
"cmd": "node",
"args": ["--version"]
},
{
"name": "is-pytubepp-installed",
"cmd": "pytubepp",
@@ -133,8 +138,8 @@
"windows": [
{
"title": "PytubePP Helper",
"width": 500,
"height": 335
"width": 515,
"height": 365
}
],
"security": {

View File

@@ -82,6 +82,11 @@
"cmd": "ffmpeg",
"args": ["-version"]
},
{
"name": "is-nodejs-installed",
"cmd": "node",
"args": ["--version"]
},
{
"name": "is-pytubepp-installed",
"cmd": "pytubepp",
@@ -121,8 +126,8 @@
"windows": [
{
"title": "PytubePP Helper",
"width": 500,
"height": 320
"width": 510,
"height": 345
}
],
"security": {

View File

@@ -65,6 +65,10 @@ function App() {
installed: false,
version: null,
},
nodejs: {
installed: false,
version: null,
},
pytubepp: {
installed: false,
version: null,
@@ -181,6 +185,15 @@ function App() {
}
}));
});
isInstalled('nodejs', '--version').then((result) => {
setInstalledPrograms((prevState) => ({
...prevState,
nodejs: {
installed: result.installed,
version: result.output ? extractVersion(result.output) : null,
}
}));
});
isInstalled('pytubepp', '--version').then((result) => {
setInstalledPrograms((prevState) => ({
...prevState,
@@ -256,6 +269,10 @@ function App() {
<p><b>FFmpeg:</b> {installedPrograms.ffmpeg.installed ? 'installed' : 'not installed'} {installedPrograms.ffmpeg.version ? `(${installedPrograms.ffmpeg.version})` : ''}</p>
{installedPrograms.ffmpeg.installed ? <CircleCheck className="w-5 h-5 my-2 text-green-400"/> : installedPrograms.apt.installed ? <Button variant="link" className="text-blue-600 px-0" onClick={async () => { await invoke('install_program', {icommand: 'sudo apt install ffmpeg -y'})}}>install</Button> : null}
</div>
<div className="programitem flex items-center justify-between">
<p><b>Node.js:</b> {installedPrograms.nodejs.installed ? 'installed' : 'not installed'} {installedPrograms.nodejs.version ? `(${installedPrograms.nodejs.version})` : ''}</p>
{installedPrograms.nodejs.installed ? <CircleCheck className="w-5 h-5 my-2 text-green-400"/> : installedPrograms.apt.installed ? <Button variant="link" className="text-blue-600 px-0" onClick={async () => { await invoke('install_program', {icommand: 'sudo apt install nodejs -y'})}}>install</Button> : null}
</div>
<div className="programitem flex items-center justify-between">
<p><b>PytubePP:</b> {installedPrograms.pytubepp.installed ? 'installed' : 'not installed'} {installedPrograms.pytubepp.version ? `(${installedPrograms.pytubepp.version})` : ''}</p>
{installedPrograms.pytubepp.installed ? <CircleCheck className="w-5 h-5 my-2 text-green-400"/> : installedPrograms.pip3.installed ? <Button variant="link" className="text-blue-600 px-0" onClick={async () => { await invoke('install_program', {icommand: 'pip3 install pytubepp --break-system-packages'})}}>install</Button> : null}
@@ -296,7 +313,11 @@ function App() {
</div>
<div className="programitem flex items-center justify-between">
<p><b>FFmpeg:</b> {installedPrograms.ffmpeg.installed ? 'installed' : 'not installed'} {installedPrograms.ffmpeg.version ? `(${installedPrograms.ffmpeg.version})` : ''}</p>
{installedPrograms.ffmpeg.installed ? <CircleCheck className="w-5 h-5 my-2 text-green-400"/> : installedPrograms.dnf.installed ? <Button variant="link" className="text-blue-600 px-0" onClick={async () => { await invoke('install_program', {icommand: 'sudo dnf install ffmpeg-free -y'})}}>install</Button> : null}
{installedPrograms.ffmpeg.installed ? <CircleCheck className="w-5 h-5 my-2 text-green-400"/> : installedPrograms.dnf.installed ? <Button variant="link" className="text-blue-600 px-0" onClick={async () => { await invoke('install_program', {icommand: 'sudo dnf install ffmpeg -y'})}}>install</Button> : null}
</div>
<div className="programitem flex items-center justify-between">
<p><b>Node.js:</b> {installedPrograms.nodejs.installed ? 'installed' : 'not installed'} {installedPrograms.nodejs.version ? `(${installedPrograms.nodejs.version})` : ''}</p>
{installedPrograms.nodejs.installed ? <CircleCheck className="w-5 h-5 my-2 text-green-400"/> : installedPrograms.dnf.installed ? <Button variant="link" className="text-blue-600 px-0" onClick={async () => { await invoke('install_program', {icommand: 'sudo dnf install nodejs -y'})}}>install</Button> : null}
</div>
<div className="programitem flex items-center justify-between">
<p><b>PytubePP:</b> {installedPrograms.pytubepp.installed ? 'installed' : 'not installed'} {installedPrograms.pytubepp.version ? `(${installedPrograms.pytubepp.version})` : ''}</p>
@@ -340,6 +361,10 @@ function App() {
<p><b>FFmpeg:</b> {installedPrograms.ffmpeg.installed ? 'installed' : 'not installed'} {installedPrograms.ffmpeg.version ? `(${installedPrograms.ffmpeg.version})` : ''}</p>
{installedPrograms.ffmpeg.installed ? <CircleCheck className="w-5 h-5 my-2 text-green-400"/> : installedPrograms.winget.installed ? <Button variant="link" className="text-blue-600 px-0" onClick={async () => { await invoke('install_program', {icommand: 'winget install ffmpeg'})}}>install</Button> : null}
</div>
<div className="programitem flex items-center justify-between">
<p><b>Node.js:</b> {installedPrograms.nodejs.installed ? 'installed' : 'not installed'} {installedPrograms.nodejs.version ? `(${installedPrograms.nodejs.version})` : ''}</p>
{installedPrograms.nodejs.installed ? <CircleCheck className="w-5 h-5 my-2 text-green-400"/> : installedPrograms.winget.installed ? <Button variant="link" className="text-blue-600 px-0" onClick={async () => { await invoke('install_program', {icommand: 'winget install OpenJS.NodeJS.LTS'})}}>install</Button> : null}
</div>
<div className="programitem flex items-center justify-between">
<p><b>PytubePP:</b> {installedPrograms.pytubepp.installed ? 'installed' : 'not installed'} {installedPrograms.pytubepp.version ? `(${installedPrograms.pytubepp.version})` : ''}</p>
{installedPrograms.pytubepp.installed ? <CircleCheck className="w-5 h-5 my-2 text-green-400"/> : installedPrograms.pip.installed ? <Button variant="link" className="text-blue-600 px-0" onClick={async () => { await invoke('install_program', {icommand: 'pip install pytubepp'})}}>install</Button> : null}
@@ -373,6 +398,10 @@ function App() {
<p><b>FFmpeg:</b> {installedPrograms.ffmpeg.installed ? 'installed' : 'not installed'} {installedPrograms.ffmpeg.version ? `(${installedPrograms.ffmpeg.version})` : ''}</p>
{installedPrograms.ffmpeg.installed ? <CircleCheck className="w-5 h-5 my-2 text-green-400"/> : installedPrograms.brew.installed ? <Button variant="link" className="text-blue-600 px-0" onClick={async () => { await invoke('install_program', {icommand: 'brew install ffmpeg'})}}>install</Button> : null}
</div>
<div className="programitem flex items-center justify-between">
<p><b>Node.js:</b> {installedPrograms.nodejs.installed ? 'installed' : 'not installed'} {installedPrograms.nodejs.version ? `(${installedPrograms.nodejs.version})` : ''}</p>
{installedPrograms.nodejs.installed ? <CircleCheck className="w-5 h-5 my-2 text-green-400"/> : installedPrograms.brew.installed ? <Button variant="link" className="text-blue-600 px-0" onClick={async () => { await invoke('install_program', {icommand: 'brew install node'})}}>install</Button> : null}
</div>
<div className="programitem flex items-center justify-between">
<p><b>PytubePP:</b> {installedPrograms.pytubepp.installed ? 'installed' : 'not installed'} {installedPrograms.pytubepp.version ? `(${installedPrograms.pytubepp.version})` : ''}</p>
{installedPrograms.pytubepp.installed ? <CircleCheck className="w-5 h-5 my-2 text-green-400"/> : installedPrograms.pip3.installed ? <Button variant="link" className="text-blue-600 px-0" onClick={async () => { await invoke('install_program', {icommand: 'pip3 install pytubepp --break-system-packages'})}}>install</Button> : null}

View File

@@ -98,7 +98,7 @@ export function extractVersion(output: string): string | null {
/Python (\d+\.\d+\.\d+)/, // Pattern for Python
/pytubefix (\d+\.\d+\.\d+)/, // Pattern for pytubefix
/pytubepp (\d+\.\d+\.\d+)/, // Pattern for pytubepp
/v(\d+\.\d+\.\d+)/, // Pattern for winget
/v(\d+\.\d+\.\d+)/, // Pattern for winget, Node.js
/pip (\d+\.\d+)/, // Pattern for pip
/OS Version:.*Build (\d+)/, // Pattern for Windows build
/apt (\d+\.\d+\.\d+)/, // Pattern for apt

View File

@@ -35,6 +35,10 @@ export interface InstalledPrograms {
installed: boolean;
version: string | null;
};
nodejs: {
installed: boolean;
version: string | null;
};
pytubepp: {
installed: boolean;
version: string | null;