1
1
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:
2024-11-01 14:43:47 +05:30
Unverified
parent ddfe7b2db7
commit 2e464674cb
15 changed files with 150 additions and 106 deletions

4
.gitignore vendored
View File

@@ -23,9 +23,11 @@ dist-ssr
*.sln *.sln
*.sw? *.sw?
# Executables # Executables and manifests
pytubepp-helper-msghost.exe pytubepp-helper-msghost.exe
pytubepp-helper-autostart.exe pytubepp-helper-autostart.exe
pytubepp-helper-msghost.json
pytubepp-helper-msghost-moz.json
# Certificate files # Certificate files
certificate.pfx certificate.pfx

View File

@@ -5,11 +5,17 @@ import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url); const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename); const __dirname = path.dirname(__filename);
const msghostsrc = path.join(__dirname, 'src-tauri', 'target', 'release', 'pytubepp-helper-msghost.exe'); const msghostSrc = path.join(__dirname, 'src-tauri', 'target', 'release', 'pytubepp-helper-msghost.exe');
const msghostdest = path.join(__dirname, 'src-tauri', 'pytubepp-helper-msghost.exe'); const msghostDest = path.join(__dirname, 'src-tauri', 'pytubepp-helper-msghost.exe');
const autostartsrc = path.join(__dirname, 'src-tauri', 'target', 'release', 'pytubepp-helper-autostart.exe'); const autostartSrc = path.join(__dirname, 'src-tauri', 'target', 'release', 'pytubepp-helper-autostart.exe');
const autostartdest = path.join(__dirname, 'src-tauri', 'pytubepp-helper-autostart.exe'); const autostartDest = path.join(__dirname, 'src-tauri', 'pytubepp-helper-autostart.exe');
const msghostManifestWinChromeSrc = path.join(__dirname, 'src-tauri', 'msghost-manifest', 'windows', 'chrome', 'com.neosubhamoy.pytubepp.helper.json');
const msghostManifestWinChromeDest = path.join(__dirname, 'src-tauri', 'pytubepp-helper-msghost.json');
const msghostManifestWinFirefoxSrc = path.join(__dirname, 'src-tauri', 'msghost-manifest', 'windows', 'firefox', 'com.neosubhamoy.pytubepp.helper.json');
const msghostManifestWinFirefoxDest = path.join(__dirname, 'src-tauri', 'pytubepp-helper-msghost-moz.json');
fs.copyFileSync(msghostsrc, msghostdest); fs.copyFileSync(msghostSrc, msghostDest);
fs.copyFileSync(autostartsrc, autostartdest); fs.copyFileSync(autostartSrc, autostartDest);
fs.copyFileSync(msghostManifestWinChromeSrc, msghostManifestWinChromeDest);
fs.copyFileSync(msghostManifestWinFirefoxSrc, msghostManifestWinFirefoxDest);
console.log('Files copied successfully'); console.log('Files copied successfully');

View File

@@ -1,59 +0,0 @@
import { exec } from 'child_process';
import { promisify } from 'util';
import dotenv from 'dotenv';
import path from 'path';
dotenv.config();
const execPromise = promisify(exec);
// Common configuration
const config = {
pfxPath: 'certificate.pfx',
pfxPassword: process.env.PFX_PASS,
companyName: 'Subhamoy Biswas',
companyUrl: 'https://neosubhamoy.com',
timestampServer: 'http://timestamp.sectigo.com',
};
// Array of files to sign with their individual configurations
const filesToSign = [
{
path: 'src-tauri/target/release/pytubepp-helper-msghost.exe',
programName: 'PytubePP Helper Native Messaging Host',
},
{
path: 'src-tauri/target/release/pytubepp-helper-autostart.exe',
programName: 'PytubePP Helper (Autostart)',
},
// Add more files as needed
];
const signFile = async (fileConfig) => {
const { path: filePath, programName } = fileConfig;
const command = `signtool sign /f "${config.pfxPath}" /p ${config.pfxPassword} /d "${programName}" /du "${config.companyUrl}" /n "${config.companyName}" /t ${config.timestampServer} /fd sha256 "${filePath}"`;
try {
const { stdout, stderr } = await execPromise(command);
console.log(`Successfully signed ${path.basename(filePath)}`);
console.log(stdout);
} catch (error) {
console.error(`Failed to sign ${path.basename(filePath)}`);
console.error(error.message);
}
};
const signAllFiles = async () => {
if (!config.pfxPassword) {
console.error('PFX password not found in environment variables.');
return;
}
for (const file of filesToSign) {
await signFile(file);
}
console.log('All files processed.');
};
signAllFiles();

60
src-tauri/Cargo.lock generated
View File

@@ -2085,6 +2085,17 @@ dependencies = [
"vcpkg", "vcpkg",
] ]
[[package]]
name = "os_info"
version = "3.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae99c7fa6dd38c7cafe1ec085e804f8f555a2f8659b0dbe03f1f9963a9b51092"
dependencies = [
"log 0.4.22",
"serde",
"windows-sys 0.52.0",
]
[[package]] [[package]]
name = "os_pipe" name = "os_pipe"
version = "1.2.1" version = "1.2.1"
@@ -3232,6 +3243,19 @@ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "sys-locale"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8a11bd9c338fdba09f7881ab41551932ad42e405f61d01e8406baea71c07aee"
dependencies = [
"js-sys",
"libc",
"wasm-bindgen",
"web-sys",
"windows-sys 0.45.0",
]
[[package]] [[package]]
name = "system-deps" name = "system-deps"
version = "5.0.0" version = "5.0.0"
@@ -3359,6 +3383,7 @@ dependencies = [
"objc", "objc",
"once_cell", "once_cell",
"open", "open",
"os_info",
"os_pipe", "os_pipe",
"percent-encoding 2.3.1", "percent-encoding 2.3.1",
"rand 0.8.5", "rand 0.8.5",
@@ -3371,6 +3396,7 @@ dependencies = [
"serialize-to-javascript", "serialize-to-javascript",
"shared_child", "shared_child",
"state", "state",
"sys-locale",
"tar", "tar",
"tauri-macros", "tauri-macros",
"tauri-runtime", "tauri-runtime",
@@ -4148,6 +4174,16 @@ version = "0.2.93"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
[[package]]
name = "web-sys"
version = "0.3.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]] [[package]]
name = "webkit2gtk" name = "webkit2gtk"
version = "0.18.2" version = "0.18.2"
@@ -4390,6 +4426,15 @@ dependencies = [
"windows_x86_64_msvc 0.42.2", "windows_x86_64_msvc 0.42.2",
] ]
[[package]]
name = "windows-sys"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
dependencies = [
"windows-targets 0.42.2",
]
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.48.0" version = "0.48.0"
@@ -4417,6 +4462,21 @@ dependencies = [
"windows-targets 0.52.6", "windows-targets 0.52.6",
] ]
[[package]]
name = "windows-targets"
version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071"
dependencies = [
"windows_aarch64_gnullvm 0.42.2",
"windows_aarch64_msvc 0.42.2",
"windows_i686_gnu 0.42.2",
"windows_i686_msvc 0.42.2",
"windows_x86_64_gnu 0.42.2",
"windows_x86_64_gnullvm 0.42.2",
"windows_x86_64_msvc 0.42.2",
]
[[package]] [[package]]
name = "windows-targets" name = "windows-targets"
version = "0.48.5" version = "0.48.5"

View File

@@ -11,7 +11,7 @@ edition = "2021"
tauri-build = { version = "1", features = [] } tauri-build = { version = "1", features = [] }
[dependencies] [dependencies]
tauri = { version = "1", features = [ "process-relaunch", "window-start-dragging", "window-close", "window-unmaximize", "process-exit", "window-show", "window-unminimize", "window-hide", "window-minimize", "window-maximize", "system-tray", "shell-all"] } tauri = { version = "1", features = [ "os-all", "process-relaunch", "window-start-dragging", "window-close", "window-unmaximize", "process-exit", "window-show", "window-unminimize", "window-hide", "window-minimize", "window-maximize", "system-tray", "shell-all"] }
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_json = "1" serde_json = "1"
tokio = { version = "1.39.2", features = ["full"] } tokio = { version = "1.39.2", features = ["full"] }

View File

@@ -29,8 +29,6 @@ fn connect_with_retry(url: &str, max_attempts: u32) -> Result<websocket::sync::C
fn main() -> Result<(), Box<dyn std::error::Error>> { fn main() -> Result<(), Box<dyn std::error::Error>> {
// Launch the main application // Launch the main application
let _ = Command::new("pytubepp-helper.exe")
.spawn();
let _ = Command::new("pytubepp-helper") let _ = Command::new("pytubepp-helper")
.spawn(); .spawn();

View File

@@ -0,0 +1,7 @@
{
"name": "com.neosubhamoy.pytubepp.helper",
"description": "A helper app for pytubepp-extension to communicate with pytubepp-cli",
"path": "/usr/bin/pytubepp-helper-msghost",
"type": "stdio",
"allowed_origins": ["chrome-extension://adebedkaedobamilbbobbajepnnkkfcg/", "chrome-extension://mmhhbpdhkogpcieblpdilflfoimajepp/", "chrome-extension://ebneapoekcjelholncnlpdohjbjabhbi/", "chrome-extension://cohjehldppmnbfogjdjpbjknhlhmfhjj/"]
}

View File

@@ -0,0 +1,7 @@
{
"name": "com.neosubhamoy.pytubepp.helper",
"description": "A helper app for pytubepp-extention to communicate with pytubepp-cli",
"path": "/usr/bin/pytubepp-helper-msghost",
"type": "stdio",
"allowed_extensions": ["pytubepp-addon@neosubhamoy.com"]
}

View File

@@ -8,6 +8,9 @@
"tauri": { "tauri": {
"allowlist": { "allowlist": {
"all": false, "all": false,
"os": {
"all": true
},
"shell": { "shell": {
"all": true, "all": true,
"execute": true, "execute": true,
@@ -127,9 +130,9 @@
"deb": { "deb": {
"depends": ["python3-pip", "ffmpeg"], "depends": ["python3-pip", "ffmpeg"],
"files": { "files": {
"/etc/opt/chrome/native-messaging-hosts/com.neosubhamoy.pytubepp.helper.json": "./pytubepp-helper-msghost.json", "/etc/opt/chrome/native-messaging-hosts/com.neosubhamoy.pytubepp.helper.json": "./msghost-manifest/linux/chrome/com.neosubhamoy.pytubepp.helper.json",
"/etc/chromium/native-messaging-hosts/com.neosubhamoy.pytubepp.helper.json": "./pytubepp-helper-msghost.json", "/etc/chromium/native-messaging-hosts/com.neosubhamoy.pytubepp.helper.json": "./msghost-manifest/linux/chrome/com.neosubhamoy.pytubepp.helper.json",
"/usr/lib/mozilla/native-messaging-hosts/com.neosubhamoy.pytubepp.helper.json": "./pytubepp-helper-msghost-moz.json", "/usr/lib/mozilla/native-messaging-hosts/com.neosubhamoy.pytubepp.helper.json": "./msghost-manifest/linux/firefox/com.neosubhamoy.pytubepp.helper.json",
"/usr/bin/pytubepp-helper-msghost": "./target/release/pytubepp-helper-msghost", "/usr/bin/pytubepp-helper-msghost": "./target/release/pytubepp-helper-msghost",
"/usr/bin/pytubepp-helper-autostart": "./target/release/pytubepp-helper-autostart", "/usr/bin/pytubepp-helper-autostart": "./target/release/pytubepp-helper-autostart",
"/etc/xdg/autostart/pytubepp-helper-autostart.desktop": "./autostart/pytubepp-helper-autostart.desktop" "/etc/xdg/autostart/pytubepp-helper-autostart.desktop": "./autostart/pytubepp-helper-autostart.desktop"
@@ -141,9 +144,9 @@
"license": "MIT", "license": "MIT",
"depends": ["python3-pip", "ffmpeg-free"], "depends": ["python3-pip", "ffmpeg-free"],
"files": { "files": {
"/etc/opt/chrome/native-messaging-hosts/com.neosubhamoy.pytubepp.helper.json": "./pytubepp-helper-msghost.json", "/etc/opt/chrome/native-messaging-hosts/com.neosubhamoy.pytubepp.helper.json": "./msghost-manifest/linux/chrome/com.neosubhamoy.pytubepp.helper.json",
"/etc/chromium/native-messaging-hosts/com.neosubhamoy.pytubepp.helper.json": "./pytubepp-helper-msghost.json", "/etc/chromium/native-messaging-hosts/com.neosubhamoy.pytubepp.helper.json": "./msghost-manifest/linux/chrome/com.neosubhamoy.pytubepp.helper.json",
"/usr/lib/mozilla/native-messaging-hosts/com.neosubhamoy.pytubepp.helper.json": "./pytubepp-helper-msghost-moz.json", "/usr/lib/mozilla/native-messaging-hosts/com.neosubhamoy.pytubepp.helper.json": "./msghost-manifest/linux/firefox/com.neosubhamoy.pytubepp.helper.json",
"/usr/bin/pytubepp-helper-msghost": "./target/release/pytubepp-helper-msghost", "/usr/bin/pytubepp-helper-msghost": "./target/release/pytubepp-helper-msghost",
"/usr/bin/pytubepp-helper-autostart": "./target/release/pytubepp-helper-autostart", "/usr/bin/pytubepp-helper-autostart": "./target/release/pytubepp-helper-autostart",
"/etc/xdg/autostart/pytubepp-helper-autostart.desktop": "./autostart/pytubepp-helper-autostart.desktop" "/etc/xdg/autostart/pytubepp-helper-autostart.desktop": "./autostart/pytubepp-helper-autostart.desktop"

View File

@@ -8,6 +8,9 @@
"tauri": { "tauri": {
"allowlist": { "allowlist": {
"all": false, "all": false,
"os": {
"all": true
},
"shell": { "shell": {
"all": true, "all": true,
"execute": true, "execute": true,

View File

@@ -8,6 +8,9 @@
"tauri": { "tauri": {
"allowlist": { "allowlist": {
"all": false, "all": false,
"os": {
"all": true
},
"shell": { "shell": {
"all": true, "all": true,
"execute": true, "execute": true,

View File

@@ -4,6 +4,7 @@ import "./index.css";
import { invoke } from "@tauri-apps/api/tauri"; import { invoke } from "@tauri-apps/api/tauri";
import { listen } from '@tauri-apps/api/event'; import { listen } from '@tauri-apps/api/event';
import { appWindow } from '@tauri-apps/api/window'; import { appWindow } from '@tauri-apps/api/window';
import { platform } from '@tauri-apps/api/os';
import { ThemeProvider } from "@/components/theme-provider"; import { ThemeProvider } from "@/components/theme-provider";
import { Button } from "@/components/ui/button"; import { Button } from "@/components/ui/button";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert" import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
@@ -193,26 +194,40 @@ function App() {
useEffect(() => { useEffect(() => {
checkAllPrograms(); checkAllPrograms();
detectWindows().then((result) => { const runPlatformSpecificChecks = async () => {
if(result) { const currentPlatform = await platform();
setIsWindows(true);
setWindowsVersion(extractVersion(result)); 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) => { runPlatformSpecificChecks().catch(console.error);
if(result) { }, [])
setIsMacOs(true);
setMacOsVersion(extractVersion(result));
}
})
detectDistro().then((result) => {
if(result) {
setDistroId(extractDistroId(result))
setDistroBase(detectDistroBase(extractDistroId(result)))
}
})
}
, []);
return ( return (
<ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme"> <ThemeProvider defaultTheme="dark" storageKey="vite-ui-theme">

View File

@@ -85,18 +85,17 @@ export function extractDistroId(input: string): string | null {
export function extractVersion(output: string): string | null { export function extractVersion(output: string): string | null {
const versionPatterns = [ const versionPatterns = [
/ffmpeg version (\d+\.\d+)/, // Pattern for ffmpeg /ffmpeg version (\d+\.\d+)/, // Pattern for ffmpeg
/Python (\d+\.\d+\.\d+)/, // Pattern for Python /Python (\d+\.\d+\.\d+)/, // Pattern for Python
/pytubefix (\d+\.\d+\.\d+)/, // Pattern for pytubefix /pytubefix (\d+\.\d+\.\d+)/, // Pattern for pytubefix
/pytubepp (\d+\.\d+\.\d+)/, // Pattern for pytubepp /pytubepp (\d+\.\d+\.\d+)/, // Pattern for pytubepp
/v(\d+\.\d+\.\d+)/, // Pattern for winget /v(\d+\.\d+\.\d+)/, // Pattern for winget
/pip (\d+\.\d+)/, // Pattern for pip /pip (\d+\.\d+)/, // Pattern for pip
/OS Version:.*Build (\d+)/, // Pattern for Windows build /OS Version:.*Build (\d+)/, // Pattern for Windows build
/apt (\d+\.\d+\.\d+)/, // Pattern for apt /apt (\d+\.\d+\.\d+)/, // Pattern for apt
/(\d+\.\d+\.\d+)/, // Pattern for dnf /(\d+\.\d+\.\d+)/, // Pattern for dnf
/ProductVersion:\s+(\d+\.\d+\.\d+)/, // Pattern for macOS version /ProductVersion:\s+(\d+\.\d+(\.\d+)?)/, // Pattern for macOS version
/Homebrew (\d+\.\d+\.\d+)/, // Pattern for Homebrew /Homebrew (\d+\.\d+\.\d+)/, // Pattern for Homebrew
]; ];
for (const pattern of versionPatterns) { for (const pattern of versionPatterns) {
const match = output.match(pattern); const match = output.match(pattern);