pywebexec 1.7.16__py3-none-any.whl → 1.7.19__py3-none-any.whl
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.
- pywebexec/pywebexec.py +5 -6
- pywebexec/static/js/script.js +2 -2
- pywebexec/version.py +2 -2
- {pywebexec-1.7.16.dist-info → pywebexec-1.7.19.dist-info}/METADATA +1 -1
- {pywebexec-1.7.16.dist-info → pywebexec-1.7.19.dist-info}/RECORD +9 -9
- {pywebexec-1.7.16.dist-info → pywebexec-1.7.19.dist-info}/LICENSE +0 -0
- {pywebexec-1.7.16.dist-info → pywebexec-1.7.19.dist-info}/WHEEL +0 -0
- {pywebexec-1.7.16.dist-info → pywebexec-1.7.19.dist-info}/entry_points.txt +0 -0
- {pywebexec-1.7.16.dist-info → pywebexec-1.7.19.dist-info}/top_level.txt +0 -0
pywebexec/pywebexec.py
CHANGED
@@ -25,6 +25,7 @@ import termios
|
|
25
25
|
import struct
|
26
26
|
import subprocess
|
27
27
|
import logging
|
28
|
+
from pathlib import Path
|
28
29
|
import pyte
|
29
30
|
from . import host_ip
|
30
31
|
|
@@ -404,14 +405,16 @@ def get_output_file_path(command_id):
|
|
404
405
|
def update_command_status(command_id, updates):
|
405
406
|
status_file_path = get_status_file_path(command_id)
|
406
407
|
status = read_command_status(command_id) or {}
|
408
|
+
status = status.copy()
|
407
409
|
status.update(updates)
|
408
410
|
if status.get('status') != 'running':
|
409
411
|
output_file_path = get_output_file_path(command_id)
|
410
412
|
if os.path.exists(output_file_path):
|
411
413
|
status['last_output_line'] = get_last_line(output_file_path, status.get('cols'), status.get('rows'))
|
412
|
-
status_cache[command_id] = status
|
413
414
|
with open(status_file_path, 'w') as f:
|
414
415
|
json.dump(status, f)
|
416
|
+
os.sync()
|
417
|
+
status_cache[command_id] = status
|
415
418
|
|
416
419
|
|
417
420
|
def read_command_status(command_id):
|
@@ -465,7 +468,6 @@ def run_command(fromip, user, command, params, command_id, rows, cols):
|
|
465
468
|
log_info(fromip, user, f'run_command {command_id}: {command_str(command, params)}')
|
466
469
|
start_time = datetime.now(timezone.utc).isoformat()
|
467
470
|
update_command_status(command_id, {
|
468
|
-
'status': 'running',
|
469
471
|
'command': command,
|
470
472
|
'params': params,
|
471
473
|
'start_time': start_time,
|
@@ -492,7 +494,6 @@ def run_command(fromip, user, command, params, command_id, rows, cols):
|
|
492
494
|
'status': 'aborted',
|
493
495
|
'end_time': end_time,
|
494
496
|
'exit_code': exit_code,
|
495
|
-
'user': user
|
496
497
|
})
|
497
498
|
log_info(fromip, user, f'run_command {command_id}: {command_str(command, params)}: command aborted')
|
498
499
|
else:
|
@@ -502,7 +503,6 @@ def run_command(fromip, user, command, params, command_id, rows, cols):
|
|
502
503
|
'status': 'success',
|
503
504
|
'end_time': end_time,
|
504
505
|
'exit_code': exit_code,
|
505
|
-
'user': user
|
506
506
|
})
|
507
507
|
log_info(fromip, user, f'run_command {command_id}: {command_str(command, params)}: completed successfully')
|
508
508
|
else:
|
@@ -510,7 +510,6 @@ def run_command(fromip, user, command, params, command_id, rows, cols):
|
|
510
510
|
'status': 'failed',
|
511
511
|
'end_time': end_time,
|
512
512
|
'exit_code': exit_code,
|
513
|
-
'user': user
|
514
513
|
})
|
515
514
|
log_info(fromip, user, f'run_command {command_id}: {command_str(command, params)}: exit code {exit_code}')
|
516
515
|
|
@@ -520,7 +519,6 @@ def run_command(fromip, user, command, params, command_id, rows, cols):
|
|
520
519
|
'status': 'failed',
|
521
520
|
'end_time': end_time,
|
522
521
|
'exit_code': 1,
|
523
|
-
'user': user
|
524
522
|
})
|
525
523
|
with open(get_output_file_path(command_id), 'a') as output_file:
|
526
524
|
output_file.write(str(e))
|
@@ -720,6 +718,7 @@ def run_command_endpoint():
|
|
720
718
|
'from': request.remote_addr,
|
721
719
|
})
|
722
720
|
|
721
|
+
Path(get_output_file_path(command_id)).touch()
|
723
722
|
# Run the command in a separate thread
|
724
723
|
thread = threading.Thread(target=run_command, args=(request.remote_addr, user, command_path, params, command_id, rows, cols))
|
725
724
|
thread.start()
|
pywebexec/static/js/script.js
CHANGED
@@ -270,7 +270,7 @@ async function viewOutput(command_id) {
|
|
270
270
|
try {
|
271
271
|
const response = await fetch(`/command_status/${command_id}${urlToken}`);
|
272
272
|
if (!response.ok) {
|
273
|
-
|
273
|
+
outputInterval = setInterval(() => fetchOutput(nextOutputLink), 500);
|
274
274
|
}
|
275
275
|
const data = await response.json();
|
276
276
|
const commandInfo = document.getElementById('commandInfo');
|
@@ -428,7 +428,7 @@ function sliderUpdateOutput()
|
|
428
428
|
{
|
429
429
|
const percentage = slider.value/10;
|
430
430
|
outputLength = Math.floor((fullOutput.length * percentage) / 100);
|
431
|
-
|
431
|
+
limitedOutput = fullOutput.slice(0, outputLength);
|
432
432
|
terminal.clear();
|
433
433
|
terminal.reset();
|
434
434
|
terminal.write(limitedOutput);
|
pywebexec/version.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
pywebexec/__init__.py,sha256=197fHJy0UDBwTTpGCGortZRr-w2kTaD7MxqdbVmTEi0,61
|
2
2
|
pywebexec/host_ip.py,sha256=Ud_HTflWVQ8789aoQ2RZdT1wGI-ccvrwSWGz_c7T3TI,1241
|
3
|
-
pywebexec/pywebexec.py,sha256=
|
4
|
-
pywebexec/version.py,sha256=
|
3
|
+
pywebexec/pywebexec.py,sha256=gMkPagOLSc_8OUGxQJBKbwPivyQVK5og8-NgyR6xRl4,32607
|
4
|
+
pywebexec/version.py,sha256=TkFaFsruX5Otm0LH6piM1yaTwAuulEqgHrPqtArFw5s,513
|
5
5
|
pywebexec/static/css/Consolas NF.ttf,sha256=DJEOzF0eqZ-kxu3Gs_VE8X0NJqiobBzmxWDGpdgGRxI,1313900
|
6
6
|
pywebexec/static/css/style.css,sha256=fU-_eAk6Xy0L_GbH9rJBkeCFe5M2RYQA99cvRZ3pW9w,7934
|
7
7
|
pywebexec/static/css/xterm.css,sha256=uo5phWaUiJgcz0DAzv46uoByLLbJLeetYosL1xf68rY,5559
|
@@ -23,7 +23,7 @@ pywebexec/static/images/running.svg,sha256=fBCYwYb2O9K4N3waC2nURP25NRwZlqR4PbDZy
|
|
23
23
|
pywebexec/static/images/success.svg,sha256=NVwezvVMplt46ElW798vqGfrL21Mw_DWHUp_qiD_FU8,489
|
24
24
|
pywebexec/static/js/commands.js,sha256=TmfcauQlfIeAeC8pwQvKspc4PA_VYLbPTnVCDVBZ87I,8420
|
25
25
|
pywebexec/static/js/popup.js,sha256=_2GzUizJ-sdZFWG7SZwbYJTPbu4EvVq7D5Q_UE8nepA,9452
|
26
|
-
pywebexec/static/js/script.js,sha256=
|
26
|
+
pywebexec/static/js/script.js,sha256=0vyxfgYYPsnnfscn11YcFYDyDYwmIGEVTe0dx0UJIqA,18538
|
27
27
|
pywebexec/static/js/xterm/LICENSE,sha256=EU1P4eXTull-_T9I80VuwnJXubB-zLzUl3xpEYj2T1M,1083
|
28
28
|
pywebexec/static/js/xterm/addon-canvas.js,sha256=ez6QTVvsmLVNJmdJlM-ZQ5bErwlxAQ_9DUmDIptl2TM,94607
|
29
29
|
pywebexec/static/js/xterm/addon-canvas.js.map,sha256=ECBA4B-BqUpdFeRzlsEWLSQnudnhLP-yPQJ8_hKquMo,379537
|
@@ -36,9 +36,9 @@ pywebexec/static/js/xterm/xterm.js.map,sha256=Y7O2Pb-fIS7Z8AC1D5s04_aiW_Jf1f4mCf
|
|
36
36
|
pywebexec/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
37
|
pywebexec/templates/index.html,sha256=KSdQYBdzWKP6v0ETZsMO_729aosGBAzJxAss8T5jCto,2953
|
38
38
|
pywebexec/templates/popup.html,sha256=f5m4u8WKpkevL2mQamGqo4_y-rSuLOXGuNsezuUbniY,1508
|
39
|
-
pywebexec-1.7.
|
40
|
-
pywebexec-1.7.
|
41
|
-
pywebexec-1.7.
|
42
|
-
pywebexec-1.7.
|
43
|
-
pywebexec-1.7.
|
44
|
-
pywebexec-1.7.
|
39
|
+
pywebexec-1.7.19.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
|
40
|
+
pywebexec-1.7.19.dist-info/METADATA,sha256=yD7jkQlQGWpQfEYpoZ62JpLU4wjW8jEYn6uk9NjD5tc,8147
|
41
|
+
pywebexec-1.7.19.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
42
|
+
pywebexec-1.7.19.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
|
43
|
+
pywebexec-1.7.19.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
|
44
|
+
pywebexec-1.7.19.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|