Merge pull request #3 from codex-storage/feature/windows

Feature/windows
This commit is contained in:
Guru 2025-02-14 16:23:27 +05:30 committed by GitHub
commit d0a5814d43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 33 additions and 23 deletions

View File

@ -94,7 +94,9 @@ export async function installCodex(showNavigationMenu) {
try {
await runCommand('setx PATH "%PATH%;%LOCALAPPDATA%\\Codex"');
spinner.success();
console.log(showSuccessMessage('Codex has been installed and PATH has been updated automatically!'));
console.log(showSuccessMessage('Codex has been installed and PATH has been updated automatically!\n' +
`You may need to restart your terminal.`
));
} catch (error) {
spinner.success();
console.log(showInfoMessage(

View File

@ -57,12 +57,6 @@ export async function runCodex(showNavigationMenu) {
]);
try {
if (platform === 'win32') {
console.log(showInfoMessage('Setting up firewall rules...'));
await runCommand(`netsh advfirewall firewall add rule name="Allow Codex (TCP-In)" protocol=TCP dir=in localport=${listenPort} action=allow`);
await runCommand(`netsh advfirewall firewall add rule name="Allow Codex (UDP-In)" protocol=UDP dir=in localport=${discPort} action=allow`);
}
let nat;
if (platform === 'win32') {
const result = await runCommand('for /f "delims=" %a in (\'curl -s --ssl-reqd ip.codex.storage\') do @echo %a');
@ -71,21 +65,18 @@ export async function runCodex(showNavigationMenu) {
nat = await runCommand('curl -s https://ip.codex.storage');
}
const command = platform === 'win32'
? `codex ^
--data-dir=datadir ^
--disc-port=${discPort} ^
--listen-addrs=/ip4/0.0.0.0/tcp/${listenPort} ^
--nat=${nat} ^
--api-cors-origin="*" ^
--bootstrap-node=spr:CiUIAhIhAiJvIcA_ZwPZ9ugVKDbmqwhJZaig5zKyLiuaicRcCGqLEgIDARo8CicAJQgCEiECIm8hwD9nA9n26BUoNuarCEllqKDnMrIuK5qJxFwIaosQ3d6esAYaCwoJBJ_f8zKRAnU6KkYwRAIgM0MvWNJL296kJ9gWvfatfmVvT-A7O2s8Mxp8l9c8EW0CIC-h-H-jBVSgFjg3Eny2u33qF7BDnWFzo7fGfZ7_qc9P`
: `codex \
--data-dir=datadir \
--disc-port=${discPort} \
--listen-addrs=/ip4/0.0.0.0/tcp/${listenPort} \
--nat=\`curl -s https://ip.codex.storage\` \
--api-cors-origin="*" \
--bootstrap-node=spr:CiUIAhIhAiJvIcA_ZwPZ9ugVKDbmqwhJZaig5zKyLiuaicRcCGqLEgIDARo8CicAJQgCEiECIm8hwD9nA9n26BUoNuarCEllqKDnMrIuK5qJxFwIaosQ3d6esAYaCwoJBJ_f8zKRAnU6KkYwRAIgM0MvWNJL296kJ9gWvfatfmVvT-A7O2s8Mxp8l9c8EW0CIC-h-H-jBVSgFjg3Eny2u33qF7BDnWFzo7fGfZ7_qc9P`;
const executable = `codex`;
const args = [
`--data-dir=datadir`,
`--disc-port=${discPort}`,
`--listen-addrs=/ip4/0.0.0.0/tcp/${listenPort}`,
`--nat=${nat}`,
`--api-cors-origin="*"`,
`--bootstrap-node=spr:CiUIAhIhAiJvIcA_ZwPZ9ugVKDbmqwhJZaig5zKyLiuaicRcCGqLEgIDARo8CicAJQgCEiECIm8hwD9nA9n26BUoNuarCEllqKDnMrIuK5qJxFwIaosQ3d6esAYaCwoJBJ_f8zKRAnU6KkYwRAIgM0MvWNJL296kJ9gWvfatfmVvT-A7O2s8Mxp8l9c8EW0CIC-h-H-jBVSgFjg3Eny2u33qF7BDnWFzo7fGfZ7_qc9P`
];
const command =
`${executable} ${args.join(" ")}`
console.log(showInfoMessage(
'🚀 Codex node is running...\n\n' +
@ -256,7 +247,7 @@ export async function checkNodeStatus(showNavigationMenu) {
if (nodeRunning) {
const spinner = createSpinner('Checking node status...').start();
const response = await runCommand('curl http://localhost:8080/api/codex/v1/debug/info -w \'\\n\'');
const response = await runCommand('curl http://localhost:8080/api/codex/v1/debug/info');
spinner.success();
const data = JSON.parse(response);

17
win.md Normal file
View File

@ -0,0 +1,17 @@
# Setting up and running on Win11
## Setup
- Download and run Nodejs installer 'node-v22.14.0-x64.msi' from https://nodejs.org/en/download
## Enable npm for powershell
- Open ps in admin mode
- Run `Set-ExecutionPolicy -ExecutionPolicy RemoteSigned`
- Close admin ps
## Powershell
- 'node --version' returns 'v22.14.0`
- 'npm --version' returns '10.9.2'
### In repository root
- 'npm install' successfully installs package
- 'npm start' run the CLI tool