diff --git a/.gitignore b/.gitignore
index f423183..b8b703c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,4 +17,5 @@ build/
.env
-temp
\ No newline at end of file
+temp
+.aider*
diff --git a/src/main/AutoUpdaterPoA.ts b/src/main/AutoUpdaterPoA.ts
index 4ca166d..85df94d 100644
--- a/src/main/AutoUpdaterPoA.ts
+++ b/src/main/AutoUpdaterPoA.ts
@@ -52,7 +52,7 @@ class PoAInstaller extends EventEmitter {
return null;
}
}
- async install() {
+ async install() {
const installDir = Path.join(os.homedir(), (await this.getDefaultPath()) || '');
console.log(`Installing PoA to ${installDir}`);
if (!fs.existsSync(installDir)) {
@@ -69,7 +69,14 @@ class PoAInstaller extends EventEmitter {
if (compareVersions.compare(tag_name, currentVersion, '>')) {
console.log('Update available');
this.emit('update-available', tag_name);
- const asset = assets.find((a) => a.name.includes('win-main') && a.name.includes('exe') && isWin);
+
+ let asset;
+
+ if (isWin) {
+ asset = assets.find((a) => a.name.includes('win-main') && a.name.includes('exe'));
+ } else if (process.platform === 'linux') {
+ asset = assets.find((a) => a.name.includes(`linux-main-${tag_name}`)); // Modified this line
+ }
if (!asset) {
console.error('Could not find PoA asset for this platform');
@@ -84,7 +91,7 @@ class PoAInstaller extends EventEmitter {
responseType: 'arraybuffer',
});
- const installPath = Path.join(installDir, 'PoA.exe');
+ const installPath = isWin ? Path.join(installDir, 'PoA.exe') : Path.join(installDir, 'PoA');
fs.writeFileSync(installPath, Buffer.from(response.data));
diff --git a/src/main/core/components/ProgramRunner.ts b/src/main/core/components/ProgramRunner.ts
index 82891de..a62542a 100644
--- a/src/main/core/components/ProgramRunner.ts
+++ b/src/main/core/components/ProgramRunner.ts
@@ -1,5 +1,5 @@
// ProgramRunner.ts
-import { exec, ChildProcess } from 'child_process';
+import { spawn, SpawnOptions, ChildProcess } from 'child_process';
import treeKill from 'tree-kill';
class ProgramRunner {
@@ -15,23 +15,24 @@ class ProgramRunner {
public setupProgram(onExit: () => void): void {
console.log(`Setting up command: ${this.command}`);
- this.process = exec(this.command, (error, stdout, stderr) => {
- if (error && this.process && !this.process.killed) {
- console.error(`Error running program: ${error.message}`);
- console.error('Error details:', error);
- return;
- }
+ const commandParts = this.command.split(' ');
+ const cmd = commandParts[0];
+ const args = commandParts.slice(1);
- console.log(`stdout: ${stdout}`);
- console.error(`stderr: ${stderr}`);
- });
+ const options: SpawnOptions = {
+ stdio: 'pipe',
+ detached: true, // This might help in some scenarios to open the program in a new process group.
+ shell: true // Running in a shell can sometimes help with GUI apps.
+ };
+
+ this.process = spawn(cmd, args, options);
this.process.stdout.on('data', (data) => {
- this.outputHandler(data);
+ this.outputHandler(data.toString());
});
this.process.stderr.on('data', (data) => {
- this.outputHandler(data);
+ this.outputHandler(data.toString());
});
this.process.on('exit', () => {
diff --git a/src/renderer/views/PoAView.tsx b/src/renderer/views/PoAView.tsx
index 51ac5da..d8f03e8 100644
--- a/src/renderer/views/PoAView.tsx
+++ b/src/renderer/views/PoAView.tsx
@@ -18,7 +18,7 @@ export function PoAView() {
const { programRunner, setProgramRunner, terminalRef } = usePoAProgramRunnerContext();
const updater = usePoAInstaller();
- const { terminal, setTerminal, isPoARunning, runPoA, contextValue } = usePoAProgramRunner();
+ const { terminal, setTerminal, isPoARunning, runPoA, contextValue, storageSize, autoPin, setAutoPin, setStorageSize } = usePoAProgramRunner();
const { stopPoA } = contextValue;
useEffect(() => {
if (terminalRef.current && !terminal) {
@@ -40,8 +40,12 @@ export function PoAView() {
isPoARunning={isPoARunning}
updatePoA={updater.updatePoA}
runPoA={runPoA}
- stopPoA={stopPoA} // Pass the stopPoA function as a prop
+ stopPoA={stopPoA}
terminalRef={terminalRef}
+ storageSize={storageSize}
+ autoPin={autoPin}
+ setStorageSize={setStorageSize}
+ setAutoPin={setAutoPin}
/>
);
}
diff --git a/src/renderer/views/PoAView/PoAViewContent.tsx b/src/renderer/views/PoAView/PoAViewContent.tsx
index 18355e9..80f95a6 100644
--- a/src/renderer/views/PoAView/PoAViewContent.tsx
+++ b/src/renderer/views/PoAView/PoAViewContent.tsx
@@ -1,5 +1,6 @@
+//Path: src\renderer\views\PoAView\PoAViewContent.tsx
import React, { useEffect, useRef, useState, RefObject } from 'react';
-import { Button, OverlayTrigger, Tooltip, Card } from 'react-bootstrap';
+import { Form, Button, OverlayTrigger, Tooltip, Card } from 'react-bootstrap';
import { IoIosRadioButtonOn } from 'react-icons/io';
import { usePoAState } from './PoAStateContext';
import { usePoAProgramRunner } from './usePoAProgramRunner';
@@ -7,9 +8,15 @@ import { usePoAProgramRunner } from './usePoAProgramRunner';
interface PoAViewContentProps {
isPoARunning: boolean;
updatePoA: () => Promise Enter storage size in GB to auto pin