Compare commits

..

2 Commits

Author SHA1 Message Date
950e488190 Add makefile and vscode tasks 2026-01-07 07:37:59 +01:00
997b165890 Update readme 2026-01-07 07:29:23 +01:00
5 changed files with 147 additions and 17 deletions

4
.gitignore vendored
View File

@@ -1,3 +1 @@
luxtools-client
*.exe
.vscode/
dist/

45
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,45 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug server (default)",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"cwd": "${workspaceFolder}",
"args": [],
"console": "integratedTerminal"
},
{
"name": "Debug server (port 9000)",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"cwd": "${workspaceFolder}",
"args": ["-listen", "127.0.0.1:9000"],
"console": "integratedTerminal"
},
{
"name": "Debug install (dry-run)",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"cwd": "${workspaceFolder}",
"args": ["install", "-dry-run"],
"console": "integratedTerminal"
},
{
"name": "Debug uninstall (dry-run)",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}",
"cwd": "${workspaceFolder}",
"args": ["uninstall", "-dry-run"],
"console": "integratedTerminal"
}
]
}

19
.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,19 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "make",
"args": ["build"],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "always",
"panel": "shared"
}
}
]
}

39
Makefile Normal file
View File

@@ -0,0 +1,39 @@
.PHONY: help build build-linux build-windows build-all clean
APP_NAME := luxtools-client
DIST_DIR := dist
NATIVE_GOOS := $(shell go env GOOS)
NATIVE_GOARCH := $(shell go env GOARCH)
NATIVE_EXT := $(if $(filter windows,$(NATIVE_GOOS)),.exe,)
# Native (current platform)
NATIVE_EXE := $(APP_NAME)$(if $(filter windows,$(OS)),.exe,)
help:
@echo "Targets:"
@echo " make build Build for current platform -> $(DIST_DIR)/$(APP_NAME)$(NATIVE_EXT) ($(NATIVE_GOOS)/$(NATIVE_GOARCH))"
@echo " make build-linux Cross-compile -> $(DIST_DIR)/$(APP_NAME)-linux-amd64"
@echo " make build-windows Cross-compile -> $(DIST_DIR)/$(APP_NAME)-windows-amd64.exe"
@echo " make build-all Build linux + windows artifacts"
@echo " make clean Remove $(DIST_DIR)/"
$(DIST_DIR):
@mkdir -p $(DIST_DIR)
build: $(DIST_DIR)
@echo "Building $(APP_NAME) for current platform..."
go build -trimpath -o $(DIST_DIR)/$(APP_NAME)$(NATIVE_EXT) .
build-linux: $(DIST_DIR)
@echo "Cross-compiling $(APP_NAME) for linux/amd64..."
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -o $(DIST_DIR)/$(APP_NAME)-linux-amd64 .
build-windows: $(DIST_DIR)
@echo "Cross-compiling $(APP_NAME) for windows/amd64..."
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -o $(DIST_DIR)/$(APP_NAME)-windows-amd64.exe .
build-all: build-linux build-windows
clean:
@rm -rf $(DIST_DIR)

View File

@@ -19,7 +19,24 @@ This program runs on the users machine and listens on a loopback address only
Requires Go 1.22+.
```bash
go build -o luxtools-client .
make build
```
Output:
- `dist/luxtools-client` (or `dist/luxtools-client.exe` on Windows)
### Cross-compile
```bash
# Linux (amd64)
make build-linux
# Windows (amd64)
make build-windows
# Both
make build-all
```
## Run
@@ -45,37 +62,43 @@ Examples:
## Install as a service
The scripts below install (or update) the client as a service that starts automatically with the system.
They assume the client binary already exists in the same folder as the scripts.
Use the built-in `install` / `uninstall` commands to install (or update) the client as a per-user service that starts automatically.
The `install` command copies the currently-running binary into the appropriate per-user install location.
### Linux (systemd)
Install / update:
```bash
./install-linux.sh
./luxtools-client install
```
Optional flags:
```bash
# Change listen address (still must be loopback)
./install-linux.sh --listen 127.0.0.1:9000
./luxtools-client install -listen 127.0.0.1:9000
# Restrict allowed folders (repeatable)
./install-linux.sh --allow "$HOME" --allow "/mnt/data"
./luxtools-client install -allow "$HOME" -allow "/mnt/data"
# Validate only (no files written, no service changes)
./luxtools-client install -dry-run
```
Uninstall:
```bash
./uninstall-linux.sh
./luxtools-client uninstall
```
Keep config on uninstall:
```bash
./uninstall-linux.sh --keep-config
./luxtools-client uninstall -keep-config
# Validate only (no files removed, no service changes)
./luxtools-client uninstall -dry-run
```
Notes:
@@ -91,35 +114,41 @@ Because this tool needs to open File Explorer (a GUI app) in the *current user s
Install / update:
```bat
install-windows-task.bat
luxtools-client.exe install
```
Optional flags:
```bat
install-windows-task.bat --listen 127.0.0.1:9000
luxtools-client.exe install -listen 127.0.0.1:9000
REM Restrict allowed folders (repeatable)
install-windows-task.bat --allow "%USERPROFILE%" --allow "D:\Data"
luxtools-client.exe install -allow "%USERPROFILE%" -allow "D:\Data"
REM Validate only (no files written, no task changes)
luxtools-client.exe install -dry-run
```
Uninstall:
```bat
uninstall-windows-task.bat
luxtools-client.exe uninstall
```
Keep config on uninstall:
```bat
uninstall-windows-task.bat --keep-config
luxtools-client.exe uninstall -keep-config
REM Validate only (no files removed, no task changes)
luxtools-client.exe uninstall -dry-run
```
Notes:
- Installs to `%LOCALAPPDATA%\luxtools-client\luxtools-client.exe`
- Stores config in `%LOCALAPPDATA%\luxtools-client\config.json`
- Re-running the install script updates the EXE in place and restarts the task.
- Re-running `install` updates the EXE in place and refreshes the task.
## API