@scrypted/server 0.94.35 → 0.94.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/python/plugin_repl.py +6 -0
package/package.json
CHANGED
package/python/plugin_repl.py
CHANGED
@@ -10,6 +10,7 @@ import prompt_toolkit.application.current
|
|
10
10
|
import prompt_toolkit.key_binding.key_processor
|
11
11
|
import prompt_toolkit.contrib.telnet.server
|
12
12
|
from prompt_toolkit.contrib.telnet.server import TelnetServer, TelnetConnection
|
13
|
+
from prompt_toolkit.output.color_depth import ColorDepth
|
13
14
|
from prompt_toolkit.shortcuts import clear_title, set_title
|
14
15
|
from ptpython.repl import embed, PythonRepl, _has_coroutine_flag
|
15
16
|
import ptpython.key_bindings
|
@@ -29,6 +30,10 @@ from scrypted_python.scrypted_sdk import ScryptedStatic, ScryptedDevice
|
|
29
30
|
from rpc import maybe_await
|
30
31
|
|
31
32
|
|
33
|
+
# Our client is xtermjs, so no need to perform any color depth detection
|
34
|
+
ColorDepth.default = lambda *args, **kwargs: ColorDepth.DEPTH_4_BIT
|
35
|
+
|
36
|
+
|
32
37
|
# This section is a bit of a hack - prompt_toolkit has many assumptions
|
33
38
|
# that there is only one global Application, so multiple REPLs will confuse
|
34
39
|
# the library. The patches here allow us to scope a particular call stack
|
@@ -267,6 +272,7 @@ async def createREPLServer(sdk: ScryptedStatic, plugin: ScryptedDevice) -> int:
|
|
267
272
|
|
268
273
|
# we're not in the main loop, so can't handle any signals anyways
|
269
274
|
repl_loop.add_signal_handler = lambda sig, cb: None
|
275
|
+
repl_loop.remove_signal_handler = lambda sig: True
|
270
276
|
|
271
277
|
def finish_setup():
|
272
278
|
telnet_port, exit_server = server_started_future.result()
|