Compare commits
2 Commits
5763545f10
...
950e488190
| Author | SHA1 | Date | |
|---|---|---|---|
| 950e488190 | |||
| 997b165890 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,3 +1 @@
|
|||||||
luxtools-client
|
dist/
|
||||||
*.exe
|
|
||||||
.vscode/
|
|
||||||
45
.vscode/launch.json
vendored
Normal file
45
.vscode/launch.json
vendored
Normal 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
19
.vscode/tasks.json
vendored
Normal 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
39
Makefile
Normal 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)
|
||||||
57
README.md
57
README.md
@@ -19,7 +19,24 @@ This program runs on the user’s machine and listens on a loopback address only
|
|||||||
Requires Go 1.22+.
|
Requires Go 1.22+.
|
||||||
|
|
||||||
```bash
|
```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
|
## Run
|
||||||
@@ -45,37 +62,43 @@ Examples:
|
|||||||
|
|
||||||
## Install as a service
|
## Install as a service
|
||||||
|
|
||||||
The scripts below install (or update) the client as a service that starts automatically with the system.
|
Use the built-in `install` / `uninstall` commands to install (or update) the client as a per-user service that starts automatically.
|
||||||
They assume the client binary already exists in the same folder as the scripts.
|
The `install` command copies the currently-running binary into the appropriate per-user install location.
|
||||||
|
|
||||||
### Linux (systemd)
|
### Linux (systemd)
|
||||||
|
|
||||||
Install / update:
|
Install / update:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./install-linux.sh
|
./luxtools-client install
|
||||||
```
|
```
|
||||||
|
|
||||||
Optional flags:
|
Optional flags:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Change listen address (still must be loopback)
|
# 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)
|
# 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:
|
Uninstall:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./uninstall-linux.sh
|
./luxtools-client uninstall
|
||||||
```
|
```
|
||||||
|
|
||||||
Keep config on uninstall:
|
Keep config on uninstall:
|
||||||
|
|
||||||
```bash
|
```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:
|
Notes:
|
||||||
@@ -91,35 +114,41 @@ Because this tool needs to open File Explorer (a GUI app) in the *current user s
|
|||||||
Install / update:
|
Install / update:
|
||||||
|
|
||||||
```bat
|
```bat
|
||||||
install-windows-task.bat
|
luxtools-client.exe install
|
||||||
```
|
```
|
||||||
|
|
||||||
Optional flags:
|
Optional flags:
|
||||||
|
|
||||||
```bat
|
```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)
|
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:
|
Uninstall:
|
||||||
|
|
||||||
```bat
|
```bat
|
||||||
uninstall-windows-task.bat
|
luxtools-client.exe uninstall
|
||||||
```
|
```
|
||||||
|
|
||||||
Keep config on uninstall:
|
Keep config on uninstall:
|
||||||
|
|
||||||
```bat
|
```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:
|
Notes:
|
||||||
|
|
||||||
- Installs to `%LOCALAPPDATA%\luxtools-client\luxtools-client.exe`
|
- Installs to `%LOCALAPPDATA%\luxtools-client\luxtools-client.exe`
|
||||||
- Stores config in `%LOCALAPPDATA%\luxtools-client\config.json`
|
- 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
|
## API
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user