feat(remote.py): show own git commit in status command
This commit is contained in:
parent
6643a33570
commit
0439c70a27
1 changed files with 22 additions and 5 deletions
|
|
@ -253,9 +253,24 @@ def cmd_screenshot_window(args):
|
|||
return out_path
|
||||
|
||||
|
||||
def _script_commit() -> str:
|
||||
"""Return the git commit hash of remote.py itself."""
|
||||
import subprocess, os
|
||||
try:
|
||||
r = subprocess.run(
|
||||
["git", "log", "-1", "--format=%h", "--", __file__],
|
||||
capture_output=True, text=True,
|
||||
cwd=os.path.dirname(os.path.abspath(__file__))
|
||||
)
|
||||
return r.stdout.strip() or "unknown"
|
||||
except Exception:
|
||||
return "unknown"
|
||||
|
||||
|
||||
def cmd_status(args):
|
||||
"""Show relay, server, and client version/commit in one call."""
|
||||
"""Show relay, remote.py, and client commit in one call."""
|
||||
import requests as _requests
|
||||
|
||||
# 1. Relay (public endpoint, no auth)
|
||||
try:
|
||||
r = _requests.get(f"{BASE_URL}/version", timeout=10)
|
||||
|
|
@ -272,12 +287,14 @@ def cmd_status(args):
|
|||
client = {"commit": str(e)}
|
||||
|
||||
relay_commit = relay.get("commit", "?")
|
||||
script_commit = _script_commit()
|
||||
client_commit = client.get("commit", "?")
|
||||
in_sync = "✅" if relay_commit == client_commit else "⚠️ "
|
||||
all_same = relay_commit == script_commit == client_commit
|
||||
|
||||
print(f" relay {relay_commit}")
|
||||
print(f" client {client_commit}")
|
||||
print(f" {in_sync} {'in sync' if relay_commit == client_commit else 'OUT OF SYNC — client needs update'}")
|
||||
print(f" relay {relay_commit}")
|
||||
print(f" remote.py {script_commit}")
|
||||
print(f" client {client_commit}")
|
||||
print(f" {'✅ all in sync' if all_same else '⚠️ OUT OF SYNC'}")
|
||||
|
||||
|
||||
def cmd_server_version(_args):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue