mirror of
https://github.com/neosubhamoy/pytubepp-helper.git
synced 2026-02-04 11:22:22 +05:30
(ci/cd): ci test6
This commit is contained in:
959
package-lock.json
generated
959
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
2
src-tauri/Cargo.lock
generated
2
src-tauri/Cargo.lock
generated
@@ -2443,7 +2443,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pytubepp-helper"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"serde",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "pytubepp-helper"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
description = "PytubePP Helper"
|
||||
authors = ["neosubhamoy"]
|
||||
edition = "2021"
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
"cmd": "systeminfo",
|
||||
"args": []
|
||||
},
|
||||
{
|
||||
"name": "detect-macos",
|
||||
"cmd": "sw_vers",
|
||||
"args": []
|
||||
},
|
||||
{
|
||||
"name": "detect-distro",
|
||||
"cmd": "grep",
|
||||
@@ -49,6 +54,11 @@
|
||||
"cmd": "winget",
|
||||
"args": ["--version"]
|
||||
},
|
||||
{
|
||||
"name": "is-homebrew-installed",
|
||||
"cmd": "brew",
|
||||
"args": ["--version"]
|
||||
},
|
||||
{
|
||||
"name": "is-python-installed",
|
||||
"cmd": "python",
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
"cmd": "systeminfo",
|
||||
"args": []
|
||||
},
|
||||
{
|
||||
"name": "detect-macos",
|
||||
"cmd": "sw_vers",
|
||||
"args": []
|
||||
},
|
||||
{
|
||||
"name": "detect-distro",
|
||||
"cmd": "grep",
|
||||
@@ -49,6 +54,11 @@
|
||||
"cmd": "winget",
|
||||
"args": ["--version"]
|
||||
},
|
||||
{
|
||||
"name": "is-homebrew-installed",
|
||||
"cmd": "brew",
|
||||
"args": ["--version"]
|
||||
},
|
||||
{
|
||||
"name": "is-python-installed",
|
||||
"cmd": "python",
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
"cmd": "systeminfo",
|
||||
"args": []
|
||||
},
|
||||
{
|
||||
"name": "detect-macos",
|
||||
"cmd": "sw_vers",
|
||||
"args": []
|
||||
},
|
||||
{
|
||||
"name": "detect-distro",
|
||||
"cmd": "grep",
|
||||
@@ -49,6 +54,11 @@
|
||||
"cmd": "winget",
|
||||
"args": ["--version"]
|
||||
},
|
||||
{
|
||||
"name": "is-homebrew-installed",
|
||||
"cmd": "brew",
|
||||
"args": ["--version"]
|
||||
},
|
||||
{
|
||||
"name": "is-python-installed",
|
||||
"cmd": "python",
|
||||
|
||||
103
src/App.tsx
103
src/App.tsx
@@ -8,7 +8,7 @@ import { ThemeProvider } from "@/components/theme-provider";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
|
||||
import { InstalledPrograms, WebSocketMessage, } from "./types";
|
||||
import { compareVersions, extractVersion, isInstalled, sendStreamInfo, detectWindows, detectDistro, extractDistroId, detectDistroBase } from "./lib/utils";
|
||||
import { compareVersions, extractVersion, isInstalled, sendStreamInfo, detectWindows, detectDistro, extractDistroId, detectDistroBase, detectMacOs } from "./lib/utils";
|
||||
import { CircleCheck, TriangleAlert, CircleAlert } from 'lucide-react';
|
||||
|
||||
function App() {
|
||||
@@ -23,6 +23,8 @@ function App() {
|
||||
|
||||
const [isWindows, setIsWindows] = useState<boolean>(false)
|
||||
const [windowsVersion, setWindowsVersion] = useState<string | null>(null)
|
||||
const [isMacOs, setIsMacOs] = useState<boolean>(false)
|
||||
const [macOsVersion, setMacOsVersion] = useState<string | null>(null)
|
||||
const [distroId, setDistroId] = useState<string | null>(null)
|
||||
const [distroBase, setDistroBase] = useState<string | null>(null)
|
||||
const [installedPrograms, setInstalledPrograms] = useState<InstalledPrograms>({
|
||||
@@ -38,6 +40,10 @@ function App() {
|
||||
installed: false,
|
||||
version: null,
|
||||
},
|
||||
brew: {
|
||||
installed: false,
|
||||
version: null,
|
||||
},
|
||||
python: {
|
||||
installed: false,
|
||||
version: null,
|
||||
@@ -120,6 +126,15 @@ function App() {
|
||||
}
|
||||
}));
|
||||
});
|
||||
isInstalled('homebrew', '--version').then((result) => {
|
||||
setInstalledPrograms((prevState) => ({
|
||||
...prevState,
|
||||
brew: {
|
||||
installed: result.installed,
|
||||
version: result.output ? extractVersion(result.output) : null,
|
||||
}
|
||||
}));
|
||||
});
|
||||
isInstalled('python', '--version').then((result) => {
|
||||
setInstalledPrograms((prevState) => ({
|
||||
...prevState,
|
||||
@@ -184,6 +199,12 @@ function App() {
|
||||
setWindowsVersion(extractVersion(result));
|
||||
}
|
||||
})
|
||||
detectMacOs().then((result) => {
|
||||
if(result) {
|
||||
setIsMacOs(true);
|
||||
setMacOsVersion(extractVersion(result));
|
||||
}
|
||||
})
|
||||
detectDistro().then((result) => {
|
||||
if(result) {
|
||||
setDistroId(extractDistroId(result))
|
||||
@@ -212,7 +233,7 @@ function App() {
|
||||
</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: 'pip install pytubepp --break-system-packages'})}}>install</Button> : null}
|
||||
{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}
|
||||
</div>
|
||||
{(!installedPrograms.apt.installed && (!installedPrograms.python3.installed || !installedPrograms.ffmpeg.installed)) ?
|
||||
<Alert className="mt-5" variant="destructive">
|
||||
@@ -254,9 +275,9 @@ function App() {
|
||||
</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: 'pip install pytubepp'})}}>install</Button> : null}
|
||||
{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'})}}>install</Button> : null}
|
||||
</div>
|
||||
{(!installedPrograms.dnf.installed && (!installedPrograms.python.installed || !installedPrograms.ffmpeg.installed)) ?
|
||||
{(!installedPrograms.dnf.installed && (!installedPrograms.python3.installed || !installedPrograms.ffmpeg.installed)) ?
|
||||
<Alert className="mt-5" variant="destructive">
|
||||
<CircleAlert className="h-5 w-5" />
|
||||
<AlertTitle>DNF Not Found</AlertTitle>
|
||||
@@ -317,6 +338,48 @@ function App() {
|
||||
</Alert>
|
||||
: null}
|
||||
</div>
|
||||
: isMacOs && macOsVersion && compareVersions(macOsVersion, '10.13') > 0 ? /* Section for macOS */
|
||||
<div className="programstats mt-5 mx-3">
|
||||
<div className="programitem flex items-center justify-between">
|
||||
<p><b>Python:</b> {installedPrograms.python3.installed ? 'installed' : 'not installed'} {installedPrograms.python3.version ? `(${installedPrograms.python3.version})` : ''}</p>
|
||||
{installedPrograms.python3.installed ? installedPrograms.python3.version ? compareVersions(installedPrograms.python3.version, '3.8') < 0 ? <TriangleAlert className="w-5 h-5 my-2 text-orange-400"/> : <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 python3 -y'})}}>install</Button> : <TriangleAlert className="w-5 h-5 my-2 text-orange-400"/> : null}
|
||||
</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.brew.installed ? <Button variant="link" className="text-blue-600 px-0" onClick={async () => { await invoke('install_program', {icommand: 'brew install ffmpeg -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}
|
||||
</div>
|
||||
{(!installedPrograms.brew.installed && (!installedPrograms.python3.installed || !installedPrograms.ffmpeg.installed)) ?
|
||||
<Alert className="mt-5" variant="destructive">
|
||||
<CircleAlert className="h-5 w-5" />
|
||||
<AlertTitle>Homebrew Not Found</AlertTitle>
|
||||
<AlertDescription>
|
||||
Homebrew is required to install necessary unix packages. Please install it manually for your mac.
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
: null}
|
||||
{(!installedPrograms.pip3.installed && !installedPrograms.pytubepp.installed) ?
|
||||
<Alert className="mt-5" variant="destructive">
|
||||
<CircleAlert className="h-5 w-5" />
|
||||
<AlertTitle>PIP Not Found</AlertTitle>
|
||||
<AlertDescription>
|
||||
PIP is required to install necessary python packages. Please install it now to continue: <Button variant="link" className="text-blue-600 p-0" onClick={async () => { await invoke('install_program', {icommand: 'brew install python3-pip -y'})}}>install</Button>
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
: null}
|
||||
{(installedPrograms.python3.installed && installedPrograms.ffmpeg.installed && installedPrograms.pytubepp.installed) ?
|
||||
<Alert className="mt-5">
|
||||
<CircleCheck className="h-5 w-5" />
|
||||
<AlertTitle>Ready</AlertTitle>
|
||||
<AlertDescription>
|
||||
Everything looks ok! You can close this window now. Make sure it's always running in the background.
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
: null}
|
||||
</div>
|
||||
:
|
||||
<div className="programstats mt-5 mx-3">
|
||||
<Alert className="mt-5" variant="destructive">
|
||||
@@ -328,38 +391,6 @@ function App() {
|
||||
</Alert>
|
||||
</div>
|
||||
}
|
||||
{/* <div className="programstats mt-5">
|
||||
<div className="programitem flex items-center justify-between">
|
||||
<p><b>Python:</b> {installedPrograms.python.installed ? 'installed' : 'not installed'} {installedPrograms.python.version ? `(${installedPrograms.python.version})` : ''}</p>
|
||||
{installedPrograms.python.installed ? installedPrograms.python.version ? compareVersions(installedPrograms.python.version, '3.8') < 0 ? <TriangleAlert className="w-5 h-5 my-2 text-orange-400"/> : <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', {installer: 'winget', program: 'Python.Python.3.11'})}}>install</Button> : <TriangleAlert className="w-5 h-5 my-2 text-orange-400"/> : null}
|
||||
</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.winget.installed ? <Button variant="link" className="text-blue-600 px-0" onClick={async () => { await invoke('install_program', {installer: 'winget', program: 'ffmpeg'})}}>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', {installer: 'pip', program: 'pytubepp'})}}>install</Button> : null}
|
||||
</div>
|
||||
{(!installedPrograms.winget.installed && (!installedPrograms.python.installed || !installedPrograms.ffmpeg.installed)) ?
|
||||
<Alert className="mt-5" variant="destructive">
|
||||
<CircleAlert className="h-5 w-5" />
|
||||
<AlertTitle>WinGet Not Found</AlertTitle>
|
||||
<AlertDescription>
|
||||
WinGet is required to install necessary packages. Please install it manually from <a className="underline" href="https://learn.microsoft.com/en-us/windows/package-manager/winget/#install-winget" target="_blank">here</a>.
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
: null}
|
||||
{(installedPrograms.python.installed && installedPrograms.ffmpeg.installed && installedPrograms.pytubepp.installed) ?
|
||||
<Alert className="mt-5">
|
||||
<CircleCheck className="h-5 w-5" />
|
||||
<AlertTitle>Ready</AlertTitle>
|
||||
<AlertDescription>
|
||||
Everything looks ok! You can close this window now. Make sure it's always running in the background.
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
: null}
|
||||
</div> */}
|
||||
</div>
|
||||
</ThemeProvider>
|
||||
);
|
||||
|
||||
@@ -35,6 +35,20 @@ export async function detectWindows(): Promise<string | null> {
|
||||
}
|
||||
}
|
||||
|
||||
export async function detectMacOs(): Promise<string | null> {
|
||||
try{
|
||||
const output = await new Command('detect-macos', []).execute();
|
||||
if (output.code === 0) {
|
||||
return output.stdout;
|
||||
} else {
|
||||
return output.stdout;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export async function detectDistro(): Promise<string | null> {
|
||||
try{
|
||||
const output = await new Command('detect-distro', ['^ID=', '/etc/os-release']).execute();
|
||||
@@ -80,6 +94,8 @@ export function extractVersion(output: string): string | null {
|
||||
/OS Version:.*Build (\d+)/, // Pattern for Windows build
|
||||
/apt (\d+\.\d+\.\d+)/, // Pattern for apt
|
||||
/(\d+\.\d+\.\d+)/, // Pattern for dnf
|
||||
/ProductVersion:\s+(\d+\.\d+\.\d+)/, // Pattern for macOS version
|
||||
/Homebrew (\d+\.\d+\.\d+)/, // Pattern for Homebrew
|
||||
|
||||
];
|
||||
for (const pattern of versionPatterns) {
|
||||
|
||||
@@ -11,6 +11,10 @@ export interface InstalledPrograms {
|
||||
installed: boolean;
|
||||
version: string | null;
|
||||
};
|
||||
brew: {
|
||||
installed: boolean;
|
||||
version: string | null;
|
||||
};
|
||||
python: {
|
||||
installed: boolean;
|
||||
version: string | null;
|
||||
|
||||
Reference in New Issue
Block a user