-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.cpp
More file actions
71 lines (56 loc) · 2.52 KB
/
Copy pathmain.cpp
File metadata and controls
71 lines (56 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <iostream>
#include <cstdlib>
#include <string>
#include <fstream>
void updateProxies(const std::string& newProxyFile, const std::string& proxyFile) {
std::ifstream newFile(newProxyFile);
std::ofstream oldFile(proxyFile);
if (!newFile.is_open()) {
std::cerr << "Erro ao abrir o arquivo " << newProxyFile << std::endl;
return;
}
if (!oldFile.is_open()) {
std::cerr << "Erro ao abrir o arquivo " << proxyFile << std::endl;
return;
}
std::string line;
while (getline(newFile, line)) {
oldFile << line << std::endl;
}
newFile.close();
oldFile.close();
std::cout << "Lista de proxies atualizada com sucesso!\n";
}
int main() {
std::string proxyFile = "proxies.txt";
std::string tsScript = "bun install && bun --env-file .env ./src/app.ts";
std::string encoding = "echo off && chcp 65001";
system(encoding.c_str());
std::cout << R"(
██╗ ██╗██╗ ██╗██╗ ██╗ ██████╗ ███████╗███╗ ██╗
██║ ██║██║ ██║╚██╗ ██╔╝ ██╔════╝ ██╔════╝████╗ ██║
██║ █╗ ██║███████║ ╚████╔╝ ██║ ███╗█████╗ ██╔██╗ ██║
██║███╗██║██╔══██║ ╚██╔╝ ██║ ██║██╔══╝ ██║╚██╗██║
╚███╔███╔╝██║ ██║ ██║ ╚██████╔╝███████╗██║ ╚████║
╚══╝╚══╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝
)" << std::endl;
char choice;
std::cout << "Deseja atualizar a lista de proxies? (s/n): ";
std::cin >> choice;
if (choice == 's' || choice == 'S') {
std::string newProxyFile;
std::cout << "Digite o caminho do novo arquivo de proxies: ";
std::cin >> newProxyFile;
updateProxies(newProxyFile, proxyFile);
} else {
std::cout << "A lista de proxies não foi atualizada.\n";
}
std::cout << "Executando workflow...\n";
int result = system(tsScript.c_str());
if (result == 0) {
std::cout << "Execução concluída com sucesso.\n";
} else {
std::cerr << "Falha na execução do Workflow.\n";
}
return result;
}