Polish Round
This commit is contained in:
Binary file not shown.
@@ -2,6 +2,8 @@
|
||||
"""RemoteDesktop consent broker for the local EIS input worker."""
|
||||
import json
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
try:
|
||||
import gi
|
||||
gi.require_version('Gio', '2.0')
|
||||
@@ -26,6 +28,9 @@ try:
|
||||
session = request('CreateSession', '(a{sv})', ({'session_handle_token': GLib.Variant('s', token)},))['session_handle']
|
||||
request('SelectDevices', '(oa{sv})', (session, {'types': GLib.Variant('u', 3), 'persist_mode': GLib.Variant('u', 2)}))
|
||||
request('Start', '(osa{sv})', (session, '', {}))
|
||||
if not os.environ.get('JARVIS_LIBEI_BRIDGE'):
|
||||
raise RuntimeError('portal consent succeeded but no local libei injector is configured; refusing to claim input readiness')
|
||||
injector = subprocess.Popen(os.environ['JARVIS_LIBEI_BRIDGE'], shell=True, stdin=subprocess.PIPE, text=True)
|
||||
print(json.dumps({'type': 'ready', 'session': session, 'restore_token_present': True}), flush=True)
|
||||
except Exception as exc:
|
||||
print(json.dumps({'type': 'error', 'reason': str(exc)}), flush=True)
|
||||
@@ -34,5 +39,9 @@ for line in sys.stdin:
|
||||
action = json.loads(line)
|
||||
if action.get('type') == 'close':
|
||||
break
|
||||
if 'injector' in globals() and injector.stdin:
|
||||
injector.stdin.write(json.dumps(action) + '\n'); injector.stdin.flush()
|
||||
except Exception:
|
||||
continue
|
||||
if 'injector' in globals():
|
||||
injector.terminate()
|
||||
|
||||
Reference in New Issue
Block a user