mirror of
https://github.com/neosubhamoy/pytubepp-helper.git
synced 2026-02-04 11:22:22 +05:30
(ci/cd): ci test7
This commit is contained in:
53
src/App.tsx
53
src/App.tsx
@@ -4,6 +4,7 @@ import "./index.css";
|
||||
import { invoke } from "@tauri-apps/api/tauri";
|
||||
import { listen } from '@tauri-apps/api/event';
|
||||
import { appWindow } from '@tauri-apps/api/window';
|
||||
import { platform } from '@tauri-apps/api/os';
|
||||
import { ThemeProvider } from "@/components/theme-provider";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
|
||||
@@ -193,26 +194,40 @@ function App() {
|
||||
|
||||
useEffect(() => {
|
||||
checkAllPrograms();
|
||||
detectWindows().then((result) => {
|
||||
if(result) {
|
||||
setIsWindows(true);
|
||||
setWindowsVersion(extractVersion(result));
|
||||
const runPlatformSpecificChecks = async () => {
|
||||
const currentPlatform = await platform();
|
||||
|
||||
switch (currentPlatform) {
|
||||
case 'win32':
|
||||
const windowsResult = await detectWindows();
|
||||
if (windowsResult) {
|
||||
setIsWindows(true);
|
||||
setWindowsVersion(extractVersion(windowsResult));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'darwin':
|
||||
const macResult = await detectMacOs();
|
||||
if (macResult) {
|
||||
setIsMacOs(true);
|
||||
setMacOsVersion(extractVersion(macResult));
|
||||
}
|
||||
break;
|
||||
|
||||
case 'linux':
|
||||
const distroResult = await detectDistro();
|
||||
if (distroResult) {
|
||||
setDistroId(extractDistroId(distroResult));
|
||||
setDistroBase(detectDistroBase(extractDistroId(distroResult)));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
console.log('Unsupported platform');
|
||||
}
|
||||
})
|
||||
detectMacOs().then((result) => {
|
||||
if(result) {
|
||||
setIsMacOs(true);
|
||||
setMacOsVersion(extractVersion(result));
|
||||
}
|
||||
})
|
||||
detectDistro().then((result) => {
|
||||
if(result) {
|
||||
setDistroId(extractDistroId(result))
|
||||
setDistroBase(detectDistroBase(extractDistroId(result)))
|
||||
}
|
||||
})
|
||||
}
|
||||
, []);
|
||||
};
|
||||
runPlatformSpecificChecks().catch(console.error);
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">
|
||||
|
||||
@@ -85,18 +85,17 @@ export function extractDistroId(input: string): string | null {
|
||||
|
||||
export function extractVersion(output: string): string | null {
|
||||
const versionPatterns = [
|
||||
/ffmpeg version (\d+\.\d+)/, // Pattern for ffmpeg
|
||||
/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
|
||||
/pip (\d+\.\d+)/, // Pattern for pip
|
||||
/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
|
||||
|
||||
/ffmpeg version (\d+\.\d+)/, // Pattern for ffmpeg
|
||||
/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
|
||||
/pip (\d+\.\d+)/, // Pattern for pip
|
||||
/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) {
|
||||
const match = output.match(pattern);
|
||||
|
||||
Reference in New Issue
Block a user