Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf319c502e |
Binary file not shown.
28
tools/ssh.py
28
tools/ssh.py
@@ -42,6 +42,7 @@ S3 (type: s3):
|
||||
python ssh.py --s3-upload ALIAS local bucket/key # upload file
|
||||
python ssh.py --s3-download ALIAS bucket/key local # download file
|
||||
python ssh.py --s3-delete ALIAS bucket/key # delete object
|
||||
python ssh.py --s3-url ALIAS bucket/key [SEC] # presigned URL (default 3600s)
|
||||
|
||||
WinRM (type: winrm):
|
||||
python ssh.py --ps ALIAS "Get-Process" # PowerShell via WinRM
|
||||
@@ -1459,6 +1460,27 @@ def s3_delete(server: dict, remote_path: str):
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def s3_url(server: dict, remote_path: str, expires: int = 3600):
|
||||
"""Generate a presigned URL for an S3 object."""
|
||||
client = _get_s3_client(server)
|
||||
parts = remote_path.split("/", 1)
|
||||
bucket = parts[0] if parts else server.get("bucket", "")
|
||||
key = parts[1] if len(parts) > 1 else ""
|
||||
if not bucket or not key:
|
||||
print("ERROR: Usage: --s3-url ALIAS bucket/key [seconds]", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
try:
|
||||
url = client.generate_presigned_url(
|
||||
"get_object",
|
||||
Params={"Bucket": bucket, "Key": key},
|
||||
ExpiresIn=expires,
|
||||
)
|
||||
print(url)
|
||||
except Exception as e:
|
||||
print(f"ERROR: {e}", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
# ── Grafana commands ──────────────────────────────────
|
||||
|
||||
def _grafana_request(server: dict, endpoint: str) -> dict:
|
||||
@@ -1763,6 +1785,12 @@ def main():
|
||||
alias = _resolve_alias(sys.argv[2], servers)
|
||||
s3_delete(servers[alias], sys.argv[3])
|
||||
sys.exit(0)
|
||||
if cmd == "--s3-url" and len(sys.argv) >= 4:
|
||||
_, servers = load_servers()
|
||||
alias = _resolve_alias(sys.argv[2], servers)
|
||||
expires = int(sys.argv[4]) if len(sys.argv) >= 5 else 3600
|
||||
s3_url(servers[alias], sys.argv[3], expires)
|
||||
sys.exit(0)
|
||||
|
||||
# ── Grafana commands ──
|
||||
if cmd == "--grafana-dashboards" and len(sys.argv) >= 3:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"""Version info for ServerManager."""
|
||||
|
||||
__version__ = "1.9.15"
|
||||
__version__ = "1.9.16"
|
||||
__app_name__ = "ServerManager"
|
||||
__author__ = "aibot777"
|
||||
__description__ = "Desktop GUI for managing remote servers"
|
||||
|
||||
Reference in New Issue
Block a user