git-cli-yt 1.1.3 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +3 -62
- package/package.json +8 -2
- package/PRIVACY_POLICY.md +0 -7
- package/client_secret.json +0 -1
package/bin/cli.js
CHANGED
|
@@ -1,75 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const { execSync, spawn } = require("child_process");
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const fs = require("fs");
|
|
6
|
-
const os = require("os");
|
|
7
|
-
|
|
8
|
-
// Carrega o arquivo .env da pasta atual
|
|
9
|
-
require("dotenv").config({ path: path.join(process.cwd(), ".env") });
|
|
10
|
-
|
|
11
|
-
const packageDir = path.join(__dirname, "..");
|
|
12
|
-
const isWindows = process.platform === "win32";
|
|
13
|
-
|
|
14
|
-
// Ambiente virtual isolado no Temp do usuário
|
|
15
|
-
const venvDir = path.join(os.tmpdir(), "cli-yt-venv");
|
|
16
|
-
|
|
17
|
-
const pythonExecutable = isWindows
|
|
18
|
-
? path.join(venvDir, "Scripts", "python.exe")
|
|
19
|
-
: path.join(venvDir, "bin", "python");
|
|
20
|
-
|
|
21
|
-
const pipExecutable = isWindows
|
|
22
|
-
? path.join(venvDir, "Scripts", "pip.exe")
|
|
23
|
-
: path.join(venvDir, "bin", "pip");
|
|
24
|
-
|
|
25
|
-
// Tenta pegar do .env ou do ambiente do sistema
|
|
26
|
-
const CLIENT_ID = process.env.GOOGLE_CLIENT_ID;
|
|
27
|
-
const CLIENT_SECRET = process.env.GOOGLE_CLIENT_SECRET;
|
|
28
|
-
|
|
29
|
-
function checkPython() {
|
|
30
|
-
try {
|
|
31
|
-
const cmd = isWindows ? "where python" : "which python3 || which python";
|
|
32
|
-
execSync(cmd, { stdio: "ignore" });
|
|
33
|
-
} catch (e) {
|
|
34
|
-
console.error("❌ Erro: Python 3 não foi encontrado no sistema.");
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function setupVenv() {
|
|
40
|
-
const pythonCmd = isWindows ? "python" : "python3";
|
|
41
|
-
|
|
42
|
-
if (!fs.existsSync(pythonExecutable)) {
|
|
43
|
-
console.log("⚙️ Criando ambiente virtual Python isolado...");
|
|
44
|
-
execSync(`${pythonCmd} -m venv "${venvDir}"`, { stdio: "inherit" });
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const reqFile = path.join(packageDir, "requirements.txt");
|
|
48
|
-
if (fs.existsSync(reqFile)) {
|
|
49
|
-
console.log("📦 Verificando/Instalando dependências...");
|
|
50
|
-
execSync(`"${pipExecutable}" install -q -r "${reqFile}"`, { stdio: "inherit" });
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
3
|
function runPlayer() {
|
|
55
4
|
const mainPy = path.join(packageDir, "main.py");
|
|
56
5
|
|
|
57
|
-
//
|
|
6
|
+
// Apenas repassa o process.env original sem injetar strings vazias
|
|
58
7
|
const child = spawn(pythonExecutable, [mainPy], {
|
|
59
8
|
stdio: "inherit",
|
|
60
9
|
cwd: process.cwd(),
|
|
61
|
-
env:
|
|
62
|
-
...process.env,
|
|
63
|
-
GOOGLE_CLIENT_ID: CLIENT_ID || "",
|
|
64
|
-
GOOGLE_CLIENT_SECRET: CLIENT_SECRET || "",
|
|
65
|
-
},
|
|
10
|
+
env: process.env,
|
|
66
11
|
});
|
|
67
12
|
|
|
68
13
|
child.on("exit", (code) => {
|
|
69
14
|
process.exit(code || 0);
|
|
70
15
|
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
checkPython();
|
|
74
|
-
setupVenv();
|
|
75
|
-
runPlayer();
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "git-cli-yt",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "YouTube TUI Player executável via NPX",
|
|
5
5
|
"main": "bin/cli.js",
|
|
6
6
|
"bin": {
|
|
7
|
+
"git-cli-yt": "bin/cli.js",
|
|
7
8
|
"meu-player-tui": "bin/cli.js"
|
|
8
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin/cli.js",
|
|
12
|
+
"main.py",
|
|
13
|
+
"requirements.txt"
|
|
14
|
+
],
|
|
9
15
|
"publishConfig": {
|
|
10
16
|
"access": "public"
|
|
11
17
|
},
|
|
@@ -20,4 +26,4 @@
|
|
|
20
26
|
"dependencies": {
|
|
21
27
|
"dotenv": "^17.4.2"
|
|
22
28
|
}
|
|
23
|
-
}
|
|
29
|
+
}
|
package/PRIVACY_POLICY.md
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# Política de Privacidade - CLI YT Music Player
|
|
2
|
-
|
|
3
|
-
O aplicativo CLI YT Music Player utiliza a API do YouTube apenas para leitura de dados necessários para reprodução de áudio local.
|
|
4
|
-
|
|
5
|
-
1. **Coleta de Dados:** O aplicativo não coleta, armazena ou compartilha dados pessoais em servidores externos.
|
|
6
|
-
2. **Autenticação:** O token de acesso OAuth é armazenado exclusivamente de forma local e segura no gerenciador de credenciais do sistema do usuário (`keyring`).
|
|
7
|
-
3. **Uso de Dados:** O acesso à conta do YouTube é estritamente limitado à leitura da lista de vídeos curtidos (`youtube.readonly`) para exibição na interface do usuário.
|
package/client_secret.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"installed":{"client_id":"50790974670-qshvlqkejhu0ksj76v0t0lpcq3krm593.apps.googleusercontent.com","project_id":"cli-yt-507511","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"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","redirect_uris":["http://localhost"]}}
|