Apply black formatter to all Python files
Reformatted 29 files for consistent code style and CI compliance. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -24,7 +24,7 @@ import traceback
|
||||
from pathlib import Path
|
||||
|
||||
# Ensure stegasoo is importable
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent.parent / 'src'))
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent.parent / "src"))
|
||||
sys.path.insert(0, str(Path(__file__).parent))
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ def _get_channel_info(resolved_key):
|
||||
# Auto mode - check server config
|
||||
if has_channel_key():
|
||||
status = get_channel_status()
|
||||
return "private", status.get('fingerprint')
|
||||
return "private", status.get("fingerprint")
|
||||
|
||||
return "public", None
|
||||
|
||||
@@ -76,62 +76,62 @@ def encode_operation(params: dict) -> dict:
|
||||
from stegasoo import FilePayload, encode
|
||||
|
||||
# Decode base64 inputs
|
||||
carrier_data = base64.b64decode(params['carrier_b64'])
|
||||
reference_data = base64.b64decode(params['reference_b64'])
|
||||
carrier_data = base64.b64decode(params["carrier_b64"])
|
||||
reference_data = base64.b64decode(params["reference_b64"])
|
||||
|
||||
# Optional RSA key
|
||||
rsa_key_data = None
|
||||
if params.get('rsa_key_b64'):
|
||||
rsa_key_data = base64.b64decode(params['rsa_key_b64'])
|
||||
if params.get("rsa_key_b64"):
|
||||
rsa_key_data = base64.b64decode(params["rsa_key_b64"])
|
||||
|
||||
# Determine payload type
|
||||
if params.get('file_b64'):
|
||||
file_data = base64.b64decode(params['file_b64'])
|
||||
if params.get("file_b64"):
|
||||
file_data = base64.b64decode(params["file_b64"])
|
||||
payload = FilePayload(
|
||||
data=file_data,
|
||||
filename=params.get('file_name', 'file'),
|
||||
mime_type=params.get('file_mime', 'application/octet-stream'),
|
||||
filename=params.get("file_name", "file"),
|
||||
mime_type=params.get("file_mime", "application/octet-stream"),
|
||||
)
|
||||
else:
|
||||
payload = params.get('message', '')
|
||||
payload = params.get("message", "")
|
||||
|
||||
# Resolve channel key (v4.0.0)
|
||||
resolved_channel_key = _resolve_channel_key(params.get('channel_key', 'auto'))
|
||||
resolved_channel_key = _resolve_channel_key(params.get("channel_key", "auto"))
|
||||
|
||||
# Call encode with correct parameter names
|
||||
result = encode(
|
||||
message=payload,
|
||||
reference_photo=reference_data,
|
||||
carrier_image=carrier_data,
|
||||
passphrase=params.get('passphrase', ''),
|
||||
pin=params.get('pin'),
|
||||
passphrase=params.get("passphrase", ""),
|
||||
pin=params.get("pin"),
|
||||
rsa_key_data=rsa_key_data,
|
||||
rsa_password=params.get('rsa_password'),
|
||||
embed_mode=params.get('embed_mode', 'lsb'),
|
||||
dct_output_format=params.get('dct_output_format', 'png'),
|
||||
dct_color_mode=params.get('dct_color_mode', 'color'),
|
||||
rsa_password=params.get("rsa_password"),
|
||||
embed_mode=params.get("embed_mode", "lsb"),
|
||||
dct_output_format=params.get("dct_output_format", "png"),
|
||||
dct_color_mode=params.get("dct_color_mode", "color"),
|
||||
channel_key=resolved_channel_key, # v4.0.0
|
||||
)
|
||||
|
||||
# Build stats dict if available
|
||||
stats = None
|
||||
if hasattr(result, 'stats') and result.stats:
|
||||
if hasattr(result, "stats") and result.stats:
|
||||
stats = {
|
||||
'pixels_modified': getattr(result.stats, 'pixels_modified', 0),
|
||||
'capacity_used': getattr(result.stats, 'capacity_used', 0),
|
||||
'bytes_embedded': getattr(result.stats, 'bytes_embedded', 0),
|
||||
"pixels_modified": getattr(result.stats, "pixels_modified", 0),
|
||||
"capacity_used": getattr(result.stats, "capacity_used", 0),
|
||||
"bytes_embedded": getattr(result.stats, "bytes_embedded", 0),
|
||||
}
|
||||
|
||||
# Get channel info for response (v4.0.0)
|
||||
channel_mode, channel_fingerprint = _get_channel_info(resolved_channel_key)
|
||||
|
||||
return {
|
||||
'success': True,
|
||||
'stego_b64': base64.b64encode(result.stego_image).decode('ascii'),
|
||||
'filename': getattr(result, 'filename', None),
|
||||
'stats': stats,
|
||||
'channel_mode': channel_mode,
|
||||
'channel_fingerprint': channel_fingerprint,
|
||||
"success": True,
|
||||
"stego_b64": base64.b64encode(result.stego_image).decode("ascii"),
|
||||
"filename": getattr(result, "filename", None),
|
||||
"stats": stats,
|
||||
"channel_mode": channel_mode,
|
||||
"channel_fingerprint": channel_fingerprint,
|
||||
}
|
||||
|
||||
|
||||
@@ -140,42 +140,42 @@ def decode_operation(params: dict) -> dict:
|
||||
from stegasoo import decode
|
||||
|
||||
# Decode base64 inputs
|
||||
stego_data = base64.b64decode(params['stego_b64'])
|
||||
reference_data = base64.b64decode(params['reference_b64'])
|
||||
stego_data = base64.b64decode(params["stego_b64"])
|
||||
reference_data = base64.b64decode(params["reference_b64"])
|
||||
|
||||
# Optional RSA key
|
||||
rsa_key_data = None
|
||||
if params.get('rsa_key_b64'):
|
||||
rsa_key_data = base64.b64decode(params['rsa_key_b64'])
|
||||
if params.get("rsa_key_b64"):
|
||||
rsa_key_data = base64.b64decode(params["rsa_key_b64"])
|
||||
|
||||
# Resolve channel key (v4.0.0)
|
||||
resolved_channel_key = _resolve_channel_key(params.get('channel_key', 'auto'))
|
||||
resolved_channel_key = _resolve_channel_key(params.get("channel_key", "auto"))
|
||||
|
||||
# Call decode with correct parameter names
|
||||
result = decode(
|
||||
stego_image=stego_data,
|
||||
reference_photo=reference_data,
|
||||
passphrase=params.get('passphrase', ''),
|
||||
pin=params.get('pin'),
|
||||
passphrase=params.get("passphrase", ""),
|
||||
pin=params.get("pin"),
|
||||
rsa_key_data=rsa_key_data,
|
||||
rsa_password=params.get('rsa_password'),
|
||||
embed_mode=params.get('embed_mode', 'auto'),
|
||||
rsa_password=params.get("rsa_password"),
|
||||
embed_mode=params.get("embed_mode", "auto"),
|
||||
channel_key=resolved_channel_key, # v4.0.0
|
||||
)
|
||||
|
||||
if result.is_file:
|
||||
return {
|
||||
'success': True,
|
||||
'is_file': True,
|
||||
'file_b64': base64.b64encode(result.file_data).decode('ascii'),
|
||||
'filename': result.filename,
|
||||
'mime_type': result.mime_type,
|
||||
"success": True,
|
||||
"is_file": True,
|
||||
"file_b64": base64.b64encode(result.file_data).decode("ascii"),
|
||||
"filename": result.filename,
|
||||
"mime_type": result.mime_type,
|
||||
}
|
||||
else:
|
||||
return {
|
||||
'success': True,
|
||||
'is_file': False,
|
||||
'message': result.message,
|
||||
"success": True,
|
||||
"is_file": False,
|
||||
"message": result.message,
|
||||
}
|
||||
|
||||
|
||||
@@ -183,12 +183,12 @@ def compare_operation(params: dict) -> dict:
|
||||
"""Handle compare_modes operation."""
|
||||
from stegasoo import compare_modes
|
||||
|
||||
carrier_data = base64.b64decode(params['carrier_b64'])
|
||||
carrier_data = base64.b64decode(params["carrier_b64"])
|
||||
result = compare_modes(carrier_data)
|
||||
|
||||
return {
|
||||
'success': True,
|
||||
'comparison': result,
|
||||
"success": True,
|
||||
"comparison": result,
|
||||
}
|
||||
|
||||
|
||||
@@ -196,17 +196,17 @@ def capacity_check_operation(params: dict) -> dict:
|
||||
"""Handle will_fit_by_mode operation."""
|
||||
from stegasoo import will_fit_by_mode
|
||||
|
||||
carrier_data = base64.b64decode(params['carrier_b64'])
|
||||
carrier_data = base64.b64decode(params["carrier_b64"])
|
||||
|
||||
result = will_fit_by_mode(
|
||||
payload=params['payload_size'],
|
||||
payload=params["payload_size"],
|
||||
carrier_image=carrier_data,
|
||||
embed_mode=params.get('embed_mode', 'lsb'),
|
||||
embed_mode=params.get("embed_mode", "lsb"),
|
||||
)
|
||||
|
||||
return {
|
||||
'success': True,
|
||||
'result': result,
|
||||
"success": True,
|
||||
"result": result,
|
||||
}
|
||||
|
||||
|
||||
@@ -215,17 +215,17 @@ def channel_status_operation(params: dict) -> dict:
|
||||
from stegasoo import get_channel_status
|
||||
|
||||
status = get_channel_status()
|
||||
reveal = params.get('reveal', False)
|
||||
reveal = params.get("reveal", False)
|
||||
|
||||
return {
|
||||
'success': True,
|
||||
'status': {
|
||||
'mode': status['mode'],
|
||||
'configured': status['configured'],
|
||||
'fingerprint': status.get('fingerprint'),
|
||||
'source': status.get('source'),
|
||||
'key': status.get('key') if reveal and status['configured'] else None,
|
||||
}
|
||||
"success": True,
|
||||
"status": {
|
||||
"mode": status["mode"],
|
||||
"configured": status["configured"],
|
||||
"fingerprint": status.get("fingerprint"),
|
||||
"source": status.get("source"),
|
||||
"key": status.get("key") if reveal and status["configured"] else None,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -236,37 +236,37 @@ def main():
|
||||
input_text = sys.stdin.read()
|
||||
|
||||
if not input_text.strip():
|
||||
output = {'success': False, 'error': 'No input provided'}
|
||||
output = {"success": False, "error": "No input provided"}
|
||||
else:
|
||||
params = json.loads(input_text)
|
||||
operation = params.get('operation')
|
||||
operation = params.get("operation")
|
||||
|
||||
if operation == 'encode':
|
||||
if operation == "encode":
|
||||
output = encode_operation(params)
|
||||
elif operation == 'decode':
|
||||
elif operation == "decode":
|
||||
output = decode_operation(params)
|
||||
elif operation == 'compare':
|
||||
elif operation == "compare":
|
||||
output = compare_operation(params)
|
||||
elif operation == 'capacity':
|
||||
elif operation == "capacity":
|
||||
output = capacity_check_operation(params)
|
||||
elif operation == 'channel_status':
|
||||
elif operation == "channel_status":
|
||||
output = channel_status_operation(params)
|
||||
else:
|
||||
output = {'success': False, 'error': f'Unknown operation: {operation}'}
|
||||
output = {"success": False, "error": f"Unknown operation: {operation}"}
|
||||
|
||||
except json.JSONDecodeError as e:
|
||||
output = {'success': False, 'error': f'Invalid JSON: {e}'}
|
||||
output = {"success": False, "error": f"Invalid JSON: {e}"}
|
||||
except Exception as e:
|
||||
output = {
|
||||
'success': False,
|
||||
'error': str(e),
|
||||
'error_type': type(e).__name__,
|
||||
'traceback': traceback.format_exc(),
|
||||
"success": False,
|
||||
"error": str(e),
|
||||
"error_type": type(e).__name__,
|
||||
"traceback": traceback.format_exc(),
|
||||
}
|
||||
|
||||
# Write output as JSON
|
||||
print(json.dumps(output), flush=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -55,12 +55,13 @@ from typing import Any
|
||||
DEFAULT_TIMEOUT = 120
|
||||
|
||||
# Path to worker script - adjust if needed
|
||||
WORKER_SCRIPT = Path(__file__).parent / 'stego_worker.py'
|
||||
WORKER_SCRIPT = Path(__file__).parent / "stego_worker.py"
|
||||
|
||||
|
||||
@dataclass
|
||||
class EncodeResult:
|
||||
"""Result from encode operation."""
|
||||
|
||||
success: bool
|
||||
stego_data: bytes | None = None
|
||||
filename: str | None = None
|
||||
@@ -75,6 +76,7 @@ class EncodeResult:
|
||||
@dataclass
|
||||
class DecodeResult:
|
||||
"""Result from decode operation."""
|
||||
|
||||
success: bool
|
||||
is_file: bool = False
|
||||
message: str | None = None
|
||||
@@ -88,6 +90,7 @@ class DecodeResult:
|
||||
@dataclass
|
||||
class CompareResult:
|
||||
"""Result from compare_modes operation."""
|
||||
|
||||
success: bool
|
||||
width: int = 0
|
||||
height: int = 0
|
||||
@@ -99,6 +102,7 @@ class CompareResult:
|
||||
@dataclass
|
||||
class CapacityResult:
|
||||
"""Result from capacity check operation."""
|
||||
|
||||
success: bool
|
||||
fits: bool = False
|
||||
payload_size: int = 0
|
||||
@@ -112,6 +116,7 @@ class CapacityResult:
|
||||
@dataclass
|
||||
class ChannelStatusResult:
|
||||
"""Result from channel status check (v4.0.0)."""
|
||||
|
||||
success: bool
|
||||
mode: str = "public"
|
||||
configured: bool = False
|
||||
@@ -177,37 +182,37 @@ class SubprocessStego:
|
||||
if result.returncode != 0:
|
||||
# Worker crashed
|
||||
return {
|
||||
'success': False,
|
||||
'error': f'Worker crashed (exit code {result.returncode})',
|
||||
'stderr': result.stderr,
|
||||
"success": False,
|
||||
"error": f"Worker crashed (exit code {result.returncode})",
|
||||
"stderr": result.stderr,
|
||||
}
|
||||
|
||||
if not result.stdout.strip():
|
||||
return {
|
||||
'success': False,
|
||||
'error': 'Worker returned empty output',
|
||||
'stderr': result.stderr,
|
||||
"success": False,
|
||||
"error": "Worker returned empty output",
|
||||
"stderr": result.stderr,
|
||||
}
|
||||
|
||||
return json.loads(result.stdout)
|
||||
|
||||
except subprocess.TimeoutExpired:
|
||||
return {
|
||||
'success': False,
|
||||
'error': f'Operation timed out after {timeout} seconds',
|
||||
'error_type': 'TimeoutError',
|
||||
"success": False,
|
||||
"error": f"Operation timed out after {timeout} seconds",
|
||||
"error_type": "TimeoutError",
|
||||
}
|
||||
except json.JSONDecodeError as e:
|
||||
return {
|
||||
'success': False,
|
||||
'error': f'Invalid JSON from worker: {e}',
|
||||
'raw_output': result.stdout if 'result' in dir() else None,
|
||||
"success": False,
|
||||
"error": f"Invalid JSON from worker: {e}",
|
||||
"raw_output": result.stdout if "result" in dir() else None,
|
||||
}
|
||||
except Exception as e:
|
||||
return {
|
||||
'success': False,
|
||||
'error': str(e),
|
||||
'error_type': type(e).__name__,
|
||||
"success": False,
|
||||
"error": str(e),
|
||||
"error_type": type(e).__name__,
|
||||
}
|
||||
|
||||
def encode(
|
||||
@@ -253,43 +258,43 @@ class SubprocessStego:
|
||||
EncodeResult with stego_data and extension on success
|
||||
"""
|
||||
params = {
|
||||
'operation': 'encode',
|
||||
'carrier_b64': base64.b64encode(carrier_data).decode('ascii'),
|
||||
'reference_b64': base64.b64encode(reference_data).decode('ascii'),
|
||||
'message': message,
|
||||
'passphrase': passphrase,
|
||||
'pin': pin,
|
||||
'embed_mode': embed_mode,
|
||||
'dct_output_format': dct_output_format,
|
||||
'dct_color_mode': dct_color_mode,
|
||||
'channel_key': channel_key, # v4.0.0
|
||||
"operation": "encode",
|
||||
"carrier_b64": base64.b64encode(carrier_data).decode("ascii"),
|
||||
"reference_b64": base64.b64encode(reference_data).decode("ascii"),
|
||||
"message": message,
|
||||
"passphrase": passphrase,
|
||||
"pin": pin,
|
||||
"embed_mode": embed_mode,
|
||||
"dct_output_format": dct_output_format,
|
||||
"dct_color_mode": dct_color_mode,
|
||||
"channel_key": channel_key, # v4.0.0
|
||||
}
|
||||
|
||||
if file_data:
|
||||
params['file_b64'] = base64.b64encode(file_data).decode('ascii')
|
||||
params['file_name'] = file_name
|
||||
params['file_mime'] = file_mime
|
||||
params["file_b64"] = base64.b64encode(file_data).decode("ascii")
|
||||
params["file_name"] = file_name
|
||||
params["file_mime"] = file_mime
|
||||
|
||||
if rsa_key_data:
|
||||
params['rsa_key_b64'] = base64.b64encode(rsa_key_data).decode('ascii')
|
||||
params['rsa_password'] = rsa_password
|
||||
params["rsa_key_b64"] = base64.b64encode(rsa_key_data).decode("ascii")
|
||||
params["rsa_password"] = rsa_password
|
||||
|
||||
result = self._run_worker(params, timeout)
|
||||
|
||||
if result.get('success'):
|
||||
if result.get("success"):
|
||||
return EncodeResult(
|
||||
success=True,
|
||||
stego_data=base64.b64decode(result['stego_b64']),
|
||||
filename=result.get('filename'),
|
||||
stats=result.get('stats'),
|
||||
channel_mode=result.get('channel_mode'),
|
||||
channel_fingerprint=result.get('channel_fingerprint'),
|
||||
stego_data=base64.b64decode(result["stego_b64"]),
|
||||
filename=result.get("filename"),
|
||||
stats=result.get("stats"),
|
||||
channel_mode=result.get("channel_mode"),
|
||||
channel_fingerprint=result.get("channel_fingerprint"),
|
||||
)
|
||||
else:
|
||||
return EncodeResult(
|
||||
success=False,
|
||||
error=result.get('error', 'Unknown error'),
|
||||
error_type=result.get('error_type'),
|
||||
error=result.get("error", "Unknown error"),
|
||||
error_type=result.get("error_type"),
|
||||
)
|
||||
|
||||
def decode(
|
||||
@@ -323,41 +328,41 @@ class SubprocessStego:
|
||||
DecodeResult with message or file_data on success
|
||||
"""
|
||||
params = {
|
||||
'operation': 'decode',
|
||||
'stego_b64': base64.b64encode(stego_data).decode('ascii'),
|
||||
'reference_b64': base64.b64encode(reference_data).decode('ascii'),
|
||||
'passphrase': passphrase,
|
||||
'pin': pin,
|
||||
'embed_mode': embed_mode,
|
||||
'channel_key': channel_key, # v4.0.0
|
||||
"operation": "decode",
|
||||
"stego_b64": base64.b64encode(stego_data).decode("ascii"),
|
||||
"reference_b64": base64.b64encode(reference_data).decode("ascii"),
|
||||
"passphrase": passphrase,
|
||||
"pin": pin,
|
||||
"embed_mode": embed_mode,
|
||||
"channel_key": channel_key, # v4.0.0
|
||||
}
|
||||
|
||||
if rsa_key_data:
|
||||
params['rsa_key_b64'] = base64.b64encode(rsa_key_data).decode('ascii')
|
||||
params['rsa_password'] = rsa_password
|
||||
params["rsa_key_b64"] = base64.b64encode(rsa_key_data).decode("ascii")
|
||||
params["rsa_password"] = rsa_password
|
||||
|
||||
result = self._run_worker(params, timeout)
|
||||
|
||||
if result.get('success'):
|
||||
if result.get('is_file'):
|
||||
if result.get("success"):
|
||||
if result.get("is_file"):
|
||||
return DecodeResult(
|
||||
success=True,
|
||||
is_file=True,
|
||||
file_data=base64.b64decode(result['file_b64']),
|
||||
filename=result.get('filename'),
|
||||
mime_type=result.get('mime_type'),
|
||||
file_data=base64.b64decode(result["file_b64"]),
|
||||
filename=result.get("filename"),
|
||||
mime_type=result.get("mime_type"),
|
||||
)
|
||||
else:
|
||||
return DecodeResult(
|
||||
success=True,
|
||||
is_file=False,
|
||||
message=result.get('message'),
|
||||
message=result.get("message"),
|
||||
)
|
||||
else:
|
||||
return DecodeResult(
|
||||
success=False,
|
||||
error=result.get('error', 'Unknown error'),
|
||||
error_type=result.get('error_type'),
|
||||
error=result.get("error", "Unknown error"),
|
||||
error_type=result.get("error_type"),
|
||||
)
|
||||
|
||||
def compare_modes(
|
||||
@@ -376,25 +381,25 @@ class SubprocessStego:
|
||||
CompareResult with capacity information
|
||||
"""
|
||||
params = {
|
||||
'operation': 'compare',
|
||||
'carrier_b64': base64.b64encode(carrier_data).decode('ascii'),
|
||||
"operation": "compare",
|
||||
"carrier_b64": base64.b64encode(carrier_data).decode("ascii"),
|
||||
}
|
||||
|
||||
result = self._run_worker(params, timeout)
|
||||
|
||||
if result.get('success'):
|
||||
comparison = result.get('comparison', {})
|
||||
if result.get("success"):
|
||||
comparison = result.get("comparison", {})
|
||||
return CompareResult(
|
||||
success=True,
|
||||
width=comparison.get('width', 0),
|
||||
height=comparison.get('height', 0),
|
||||
lsb=comparison.get('lsb'),
|
||||
dct=comparison.get('dct'),
|
||||
width=comparison.get("width", 0),
|
||||
height=comparison.get("height", 0),
|
||||
lsb=comparison.get("lsb"),
|
||||
dct=comparison.get("dct"),
|
||||
)
|
||||
else:
|
||||
return CompareResult(
|
||||
success=False,
|
||||
error=result.get('error', 'Unknown error'),
|
||||
error=result.get("error", "Unknown error"),
|
||||
)
|
||||
|
||||
def check_capacity(
|
||||
@@ -417,29 +422,29 @@ class SubprocessStego:
|
||||
CapacityResult with fit information
|
||||
"""
|
||||
params = {
|
||||
'operation': 'capacity',
|
||||
'carrier_b64': base64.b64encode(carrier_data).decode('ascii'),
|
||||
'payload_size': payload_size,
|
||||
'embed_mode': embed_mode,
|
||||
"operation": "capacity",
|
||||
"carrier_b64": base64.b64encode(carrier_data).decode("ascii"),
|
||||
"payload_size": payload_size,
|
||||
"embed_mode": embed_mode,
|
||||
}
|
||||
|
||||
result = self._run_worker(params, timeout)
|
||||
|
||||
if result.get('success'):
|
||||
r = result.get('result', {})
|
||||
if result.get("success"):
|
||||
r = result.get("result", {})
|
||||
return CapacityResult(
|
||||
success=True,
|
||||
fits=r.get('fits', False),
|
||||
payload_size=r.get('payload_size', 0),
|
||||
capacity=r.get('capacity', 0),
|
||||
usage_percent=r.get('usage_percent', 0.0),
|
||||
headroom=r.get('headroom', 0),
|
||||
mode=r.get('mode', embed_mode),
|
||||
fits=r.get("fits", False),
|
||||
payload_size=r.get("payload_size", 0),
|
||||
capacity=r.get("capacity", 0),
|
||||
usage_percent=r.get("usage_percent", 0.0),
|
||||
headroom=r.get("headroom", 0),
|
||||
mode=r.get("mode", embed_mode),
|
||||
)
|
||||
else:
|
||||
return CapacityResult(
|
||||
success=False,
|
||||
error=result.get('error', 'Unknown error'),
|
||||
error=result.get("error", "Unknown error"),
|
||||
)
|
||||
|
||||
def get_channel_status(
|
||||
@@ -458,26 +463,26 @@ class SubprocessStego:
|
||||
ChannelStatusResult with channel info
|
||||
"""
|
||||
params = {
|
||||
'operation': 'channel_status',
|
||||
'reveal': reveal,
|
||||
"operation": "channel_status",
|
||||
"reveal": reveal,
|
||||
}
|
||||
|
||||
result = self._run_worker(params, timeout)
|
||||
|
||||
if result.get('success'):
|
||||
status = result.get('status', {})
|
||||
if result.get("success"):
|
||||
status = result.get("status", {})
|
||||
return ChannelStatusResult(
|
||||
success=True,
|
||||
mode=status.get('mode', 'public'),
|
||||
configured=status.get('configured', False),
|
||||
fingerprint=status.get('fingerprint'),
|
||||
source=status.get('source'),
|
||||
key=status.get('key') if reveal else None,
|
||||
mode=status.get("mode", "public"),
|
||||
configured=status.get("configured", False),
|
||||
fingerprint=status.get("fingerprint"),
|
||||
source=status.get("source"),
|
||||
key=status.get("key") if reveal else None,
|
||||
)
|
||||
else:
|
||||
return ChannelStatusResult(
|
||||
success=False,
|
||||
error=result.get('error', 'Unknown error'),
|
||||
error=result.get("error", "Unknown error"),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user