Compare commits
4
Commits
95552ca7c9
...
v1.1.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62559a59c9 | ||
|
|
e0df32f42b | ||
|
|
d409b64efa | ||
|
|
2f855bf720 |
@@ -87,9 +87,21 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
$ErrorActionPreference = 'Stop'
|
$ErrorActionPreference = 'Stop'
|
||||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
|
# Native command failures do NOT trip $ErrorActionPreference, so check
|
||||||
|
# $LASTEXITCODE explicitly — otherwise a broken install ships silently.
|
||||||
& $env:PYTHON -m pip install --upgrade pip
|
& $env:PYTHON -m pip install --upgrade pip
|
||||||
|
if ($LASTEXITCODE -ne 0) { throw "pip upgrade failed ($LASTEXITCODE)" }
|
||||||
& $env:PYTHON -m pip install -e .
|
& $env:PYTHON -m pip install -e .
|
||||||
|
if ($LASTEXITCODE -ne 0) { throw "pip install -e . failed ($LASTEXITCODE)" }
|
||||||
& $env:PYTHON -m pip install pyinstaller
|
& $env:PYTHON -m pip install pyinstaller
|
||||||
|
if ($LASTEXITCODE -ne 0) { throw "pip install pyinstaller failed ($LASTEXITCODE)" }
|
||||||
|
|
||||||
|
- name: Verify runtime imports
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
# Fail fast if any runtime dependency is missing before we bundle.
|
||||||
|
& $env:PYTHON -c "import PySide6.QtWidgets, fastapi, uvicorn, aiohttp, PIL, pystray, qrcode, pyautogui, pyperclip, websockets, multipart; print('deps OK')"
|
||||||
|
if ($LASTEXITCODE -ne 0) { throw "dependency import smoke test failed ($LASTEXITCODE)" }
|
||||||
|
|
||||||
- name: Build Windows executable
|
- name: Build Windows executable
|
||||||
shell: powershell
|
shell: powershell
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ A cross-platform macro management application with desktop and web interfaces. C
|
|||||||
- PyAutoGUI (Keyboard automation)
|
- PyAutoGUI (Keyboard automation)
|
||||||
- Pillow (Image processing)
|
- Pillow (Image processing)
|
||||||
- pystray (System tray)
|
- pystray (System tray)
|
||||||
- netifaces (Network detection)
|
|
||||||
- qrcode (QR code generation)
|
- qrcode (QR code generation)
|
||||||
- aiohttp (Relay server client)
|
- aiohttp (Relay server client)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Configuration and constants for MacroPad Server
|
# Configuration and constants for MacroPad Server
|
||||||
|
|
||||||
VERSION = "1.1.0"
|
VERSION = "1.1.1"
|
||||||
DEFAULT_PORT = 40000
|
DEFAULT_PORT = 40000
|
||||||
SETTINGS_FILE = "settings.json"
|
SETTINGS_FILE = "settings.json"
|
||||||
|
|
||||||
|
|||||||
+30
-10
@@ -469,19 +469,39 @@ class MainWindow(QMainWindow):
|
|||||||
# QR/copied URL lets a LAN device authenticate against the API.
|
# QR/copied URL lets a LAN device authenticate against the API.
|
||||||
token = self.settings_manager.get_web_auth_token()
|
token = self.settings_manager.get_web_auth_token()
|
||||||
token_qs = f"?token={token}" if token else ""
|
token_qs = f"?token={token}" if token else ""
|
||||||
|
ip = self._detect_lan_ip()
|
||||||
|
if ip:
|
||||||
|
self.ip_label.setText(f"http://{ip}:{DEFAULT_PORT}{token_qs}")
|
||||||
|
return
|
||||||
|
self.ip_label.setText(f"http://localhost:{DEFAULT_PORT}{token_qs}")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _detect_lan_ip():
|
||||||
|
"""Best-effort primary LAN IPv4, with no third-party dependency.
|
||||||
|
|
||||||
|
Uses a UDP socket to discover which local interface would be used to
|
||||||
|
reach the internet (no packets are actually sent), then falls back to
|
||||||
|
resolving the hostname. Returns None if only loopback is available.
|
||||||
|
"""
|
||||||
|
import socket
|
||||||
try:
|
try:
|
||||||
import netifaces
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
for iface in netifaces.interfaces():
|
try:
|
||||||
addrs = netifaces.ifaddresses(iface)
|
s.connect(("8.8.8.8", 80))
|
||||||
if netifaces.AF_INET in addrs:
|
ip = s.getsockname()[0]
|
||||||
for addr in addrs[netifaces.AF_INET]:
|
finally:
|
||||||
ip = addr.get('addr', '')
|
s.close()
|
||||||
if ip and not ip.startswith('127.'):
|
if ip and not ip.startswith("127."):
|
||||||
self.ip_label.setText(f"http://{ip}:{DEFAULT_PORT}{token_qs}")
|
return ip
|
||||||
return
|
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
self.ip_label.setText(f"http://localhost:{DEFAULT_PORT}{token_qs}")
|
try:
|
||||||
|
for ip in socket.gethostbyname_ex(socket.gethostname())[2]:
|
||||||
|
if not ip.startswith("127."):
|
||||||
|
return ip
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
return None
|
||||||
|
|
||||||
def copy_url_to_clipboard(self):
|
def copy_url_to_clipboard(self):
|
||||||
"""Copy the web interface URL to clipboard."""
|
"""Copy the web interface URL to clipboard."""
|
||||||
|
|||||||
+14
-6
@@ -416,15 +416,23 @@ class MacroManager:
|
|||||||
|
|
||||||
elif cmd_type == "app":
|
elif cmd_type == "app":
|
||||||
# Launch application.
|
# Launch application.
|
||||||
# SECURITY: shell=True was removed to kill shell-metacharacter
|
# SECURITY: never use shell=True — that would allow shell-metacharacter
|
||||||
# injection (no ; && | $() chaining). We tokenize the command
|
# injection (; && | $() chaining, redirection). Both branches below run
|
||||||
# and exec the program directly without a shell.
|
# without a shell, so the command can only launch a program with args.
|
||||||
command = cmd.get("command", "")
|
command = cmd.get("command", "")
|
||||||
if command:
|
if command:
|
||||||
try:
|
try:
|
||||||
args = shlex.split(command, posix=(os.name != "nt"))
|
if os.name == "nt":
|
||||||
if args:
|
# Windows: pass the string so CreateProcess parses it
|
||||||
subprocess.Popen(args)
|
# (correctly handling quoted paths like "C:\Program
|
||||||
|
# Files\app.exe"). shell=False means no cmd.exe, so no
|
||||||
|
# metacharacter chaining.
|
||||||
|
subprocess.Popen(command)
|
||||||
|
else:
|
||||||
|
# POSIX: split into an argv list; no shell involved.
|
||||||
|
args = shlex.split(command)
|
||||||
|
if args:
|
||||||
|
subprocess.Popen(args)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error launching app command: {e}")
|
print(f"Error launching app command: {e}")
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ a = Analysis(
|
|||||||
'pyautogui',
|
'pyautogui',
|
||||||
'pyperclip',
|
'pyperclip',
|
||||||
'pystray',
|
'pystray',
|
||||||
'netifaces',
|
|
||||||
'websockets',
|
'websockets',
|
||||||
'multipart',
|
'multipart',
|
||||||
# Relay client (imported lazily in the GUI, so declare explicitly)
|
# Relay client (imported lazily in the GUI, so declare explicitly)
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ a = Analysis(
|
|||||||
'pyperclip',
|
'pyperclip',
|
||||||
'pystray',
|
'pystray',
|
||||||
'pystray._base',
|
'pystray._base',
|
||||||
'netifaces',
|
|
||||||
'websockets',
|
'websockets',
|
||||||
'multipart',
|
'multipart',
|
||||||
# Linux system tray
|
# Linux system tray
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ a = Analysis(
|
|||||||
'pyautogui',
|
'pyautogui',
|
||||||
'pyperclip',
|
'pyperclip',
|
||||||
'pystray',
|
'pystray',
|
||||||
'netifaces',
|
|
||||||
'websockets',
|
'websockets',
|
||||||
'multipart',
|
'multipart',
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -23,8 +23,6 @@ dependencies = [
|
|||||||
"uvicorn>=0.24.0",
|
"uvicorn>=0.24.0",
|
||||||
"websockets>=12.0",
|
"websockets>=12.0",
|
||||||
"python-multipart>=0.0.6", # For file uploads
|
"python-multipart>=0.0.6", # For file uploads
|
||||||
# Network utilities
|
|
||||||
"netifaces>=0.11.0",
|
|
||||||
# QR code generation
|
# QR code generation
|
||||||
"qrcode>=7.4.2",
|
"qrcode>=7.4.2",
|
||||||
# Desktop GUI
|
# Desktop GUI
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
1.1.0
|
1.1.1
|
||||||
Reference in New Issue
Block a user