pywebexec 1.4.8__py3-none-any.whl → 1.4.10__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 CHANGED
@@ -655,6 +655,7 @@ def list_commands():
655
655
  @app.route('/command_output/<command_id>', methods=['GET'])
656
656
  def get_command_output(command_id):
657
657
  offset = int(request.args.get('offset', 0))
658
+ maxsize = int(request.args.get('maxsize', 10485760))
658
659
  output_file_path = get_output_file_path(command_id)
659
660
  if os.path.exists(output_file_path):
660
661
  with open(output_file_path, 'rb') as output_file:
@@ -665,10 +666,10 @@ def get_command_output(command_id):
665
666
  token = app.config.get("TOKEN_URL")
666
667
  token_param = f"&token={token}" if token else ""
667
668
  response = {
668
- 'output': output,
669
+ 'output': output[-maxsize:],
669
670
  'status': status_data.get("status"),
670
671
  'links': {
671
- 'next': f'{request.url_root}command_output/{command_id}?offset={new_offset}{token_param}'
672
+ 'next': f'{request.url_root}command_output/{command_id}?offset={new_offset}&maxsize={maxsize}{token_param}'
672
673
  }
673
674
  }
674
675
  if request.headers.get('Accept') == 'text/plain':
@@ -1,10 +1,12 @@
1
+ const maxScrollback = 99999;
2
+ const maxSize = 10485760; // 10MB
1
3
  let terminal = new Terminal({
2
4
  cursorBlink: false,
3
5
  cursorInactiveStyle: 'none',
4
6
  disableStdin: true,
5
7
  convertEol: true,
6
8
  fontFamily: 'Consolas NF, monospace, courier-new, courier',
7
- scrollback: 999999,
9
+ scrollback: maxScrollback,
8
10
  theme: {
9
11
  background: '#111412',
10
12
  black: '#111412',
@@ -16,6 +18,7 @@ let terminal = new Terminal({
16
18
  cyan: "#00a7aa",
17
19
  brightBlack: "#243C4F",
18
20
  brightBlue: "#5584b1",
21
+ brightGreen: "#18Ed93",
19
22
  },
20
23
  customGlyphs: false,
21
24
  rescaleOverlappingGlyphs: true,
@@ -32,6 +35,7 @@ let nextOutputLink = null;
32
35
  let fullOutput = '';
33
36
  let outputLength = 0;
34
37
  let title = null;
38
+ let slider = null;
35
39
 
36
40
  function getTokenParam() {
37
41
  const urlParams = new URLSearchParams(window.location.search);
@@ -50,9 +54,10 @@ async function fetchOutput(url) {
50
54
  terminal.write(data.error);
51
55
  clearInterval(outputInterval);
52
56
  } else {
53
- slider = document.getElementById('outputSlider')
54
57
  percentage = slider.value;
55
58
  fullOutput += data.output;
59
+ if (fullOutput.length > maxSize)
60
+ fullOutput = fullOutput.slice(-maxSize);
56
61
  if (percentage == 100)
57
62
  terminal.write(data.output);
58
63
  else {
@@ -72,7 +77,7 @@ async function fetchOutput(url) {
72
77
  }
73
78
 
74
79
  async function viewOutput(command_id) {
75
- document.getElementById('outputSlider').value = 100;
80
+ slider.value = 100;
76
81
  adjustOutputHeight();
77
82
  currentCommandId = command_id;
78
83
  nextOutputLink = `/command_output/${command_id}${urlToken}`;
@@ -109,10 +114,10 @@ function adjustOutputHeight() {
109
114
  const maxHeight = windowHeight - outputTop - 60; // Adjusted for slider height
110
115
  outputDiv.style.height = `${maxHeight}px`;
111
116
  fitAddon.fit();
117
+ sliderUpdateOutput();
112
118
  }
113
119
 
114
120
  function sliderUpdateOutput() {
115
- const slider = document.getElementById('outputSlider');
116
121
  const percentage = slider.value;
117
122
  outputLength = Math.floor((fullOutput.length * percentage) / 100);
118
123
  const limitedOutput = fullOutput.slice(0, outputLength);
@@ -122,11 +127,12 @@ function sliderUpdateOutput() {
122
127
  document.getElementById('outputPercentage').innerText = `${percentage}%`;
123
128
  }
124
129
 
125
- document.getElementById('outputSlider').addEventListener('input', sliderUpdateOutput);
126
130
 
127
131
  window.addEventListener('resize', adjustOutputHeight);
128
132
  window.addEventListener('load', () => {
129
133
  title = document.getElementById('outputTitle');
134
+ slider = document.getElementById('outputSlider');
135
+ slider.addEventListener('input', sliderUpdateOutput);
130
136
  const commandId = window.location.pathname.split('/').slice(-1)[0];
131
137
  viewOutput(commandId);
132
138
  });
@@ -3,6 +3,8 @@ let outputInterval = null;
3
3
  let nextOutputLink = null;
4
4
  let fullOutput = '';
5
5
  let outputLength = 0;
6
+ const maxScrollback = 99999;
7
+ const maxSize = 10485760; // 10MB
6
8
 
7
9
  function initTerminal()
8
10
  {
@@ -12,7 +14,7 @@ function initTerminal()
12
14
  disableStdin: true,
13
15
  convertEol: true,
14
16
  fontFamily: 'Consolas NF, monospace, courier-new, courier',
15
- scrollback: 999999,
17
+ scrollback: maxScrollback,
16
18
  theme: {
17
19
  background: '#111412',
18
20
  black: '#111412',
@@ -24,6 +26,7 @@ function initTerminal()
24
26
  cyan: "#00a7aa",
25
27
  brightBlack: "#243C4F",
26
28
  brightBlue: "#5584b1",
29
+ brightGreen: "#18Ed93",
27
30
  },
28
31
  customGlyphs: false,
29
32
  rescaleOverlappingGlyphs: true,
@@ -137,6 +140,8 @@ async function fetchOutput(url) {
137
140
  slider = document.getElementById('outputSlider')
138
141
  percentage = slider.value;
139
142
  fullOutput += data.output;
143
+ if (fullOutput.length > maxSize)
144
+ fullOutput = fullOutput.slice(-maxSize);
140
145
  if (percentage == 100)
141
146
  terminal.write(data.output); //.replace(/ \r/g, "\r\n")); tty size mismatch
142
147
  else {
@@ -185,7 +190,9 @@ async function viewOutput(command_id) {
185
190
  }
186
191
  }
187
192
 
188
- async function openPopup(command_id) {
193
+ async function openPopup(command_id, event) {
194
+ event.stopPropagation();
195
+ event.stopImmediatePropagation();
189
196
  const popupUrl = `/popup/${command_id}${urlToken}`;
190
197
  window.open(popupUrl, '_blank', 'width=1000,height=600');
191
198
  }
pywebexec/version.py CHANGED
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '1.4.8'
16
- __version_tuple__ = version_tuple = (1, 4, 8)
15
+ __version__ = version = '1.4.10'
16
+ __version_tuple__ = version_tuple = (1, 4, 10)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pywebexec
3
- Version: 1.4.8
3
+ Version: 1.4.10
4
4
  Summary: Simple Python HTTP Exec Server
5
5
  Home-page: https://github.com/joknarf/pywebexec
6
6
  Author: Franck Jouvanceau
@@ -85,9 +85,9 @@ $ pywebexec -d <dir>
85
85
  * Launch commands with params/view live output/Status using browser
86
86
  * Share your terminal output using `pywebexec -d <dir> term`
87
87
 
88
+ ![pywebexecnew9](https://github.com/user-attachments/assets/a57864ab-c5ee-4301-addd-cc68abc90f15)
88
89
 
89
90
  all commands output / statuses are available in the executables directory in subdirectory `.web_status`
90
- ![pywebexecnew8](https://github.com/user-attachments/assets/b36c98e7-8209-46f9-a320-57f460255bc7)
91
91
 
92
92
  ## features
93
93
 
@@ -1,6 +1,6 @@
1
1
  pywebexec/__init__.py,sha256=4spIsVaF8RJt8S58AG_wWoORRNkws9Iwqprj27C3ljM,99
2
- pywebexec/pywebexec.py,sha256=wediupUiLmpCaER3b_-07QitIiTimgmEBBxFLGT6-DQ,26125
3
- pywebexec/version.py,sha256=5V0g1zXAYqZG41mH-4FajHcVE05C9vUQm3ybra2NhKU,411
2
+ pywebexec/pywebexec.py,sha256=7N8cq8qDn7z9mXXWVAOd-eijNAkd-EYvWBGKKSOWeTQ,26211
3
+ pywebexec/version.py,sha256=PSfQzSIY-TCmDuz8UpHfMXvNhO-iyRNDmP7WVYUSfx8,413
4
4
  pywebexec/static/css/Consolas NF.ttf,sha256=DJEOzF0eqZ-kxu3Gs_VE8X0NJqiobBzmxWDGpdgGRxI,1313900
5
5
  pywebexec/static/css/style.css,sha256=sDBhZ-csW5THIKfTDsHqxCSg6rIJ91Oh15sjw_HjJo4,5702
6
6
  pywebexec/static/css/xterm.css,sha256=gy8_LGA7Q61DUf8ElwFQzHqHMBQnbbEmpgZcbdgeSHI,5383
@@ -14,8 +14,8 @@ pywebexec/static/images/popup.svg,sha256=0Bl9A_v5cBsMPn6FnOlVWlAQKgd2zqiWQbhjcL9
14
14
  pywebexec/static/images/running.gif,sha256=iYuzQGkMxrakSIwt6gPieKCImGZoSAHmU5MUNZa7cpw,25696
15
15
  pywebexec/static/images/success.svg,sha256=PJDcCSTevJh7rkfSFLtc7P0pbeh8PVQBS8DaOLQemmc,489
16
16
  pywebexec/static/js/commands.js,sha256=8JDb3Q55EJOYf2Q9Uy6qEuqAnn1oGjM0RndgQ4aOjqo,7725
17
- pywebexec/static/js/popup.js,sha256=n5JaFwuoiBkYQJGOIva__qVY7eQBNQ9vHEr0lIKHTY4,4399
18
- pywebexec/static/js/script.js,sha256=B7_rpQiiwgKpqtAprZx0RcSYjwPvd4SRbvgyF9dNzP0,11973
17
+ pywebexec/static/js/popup.js,sha256=VdkDXEIwd4IawhDIWew6poWhpE7sAReVn0MopdSx5wY,4519
18
+ pywebexec/static/js/script.js,sha256=QlYuIdvolTwxkJtgp7-X1IRM9Hr8D08iQCyCzZjv3hk,12255
19
19
  pywebexec/static/js/xterm/LICENSE,sha256=EU1P4eXTull-_T9I80VuwnJXubB-zLzUl3xpEYj2T1M,1083
20
20
  pywebexec/static/js/xterm/ansi_up.min.js,sha256=KNGV0vEr30hNqKQimTAvGVy-icD5A1JqMQTtvYtKR2Y,13203
21
21
  pywebexec/static/js/xterm/xterm-addon-fit.js,sha256=Pprm9pZe4SadVXS5Bc8b9VnC9Ex4QlWwA0pxOH53Gck,1460
@@ -23,9 +23,9 @@ pywebexec/static/js/xterm/xterm.js,sha256=Bzka76jZwEhVt_LlS0e0qMw7ryGa1p5qfxFyeo
23
23
  pywebexec/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  pywebexec/templates/index.html,sha256=DYtT555wSNhnFtzzHhPMWJireynCJNnAuTytpoORQeE,2321
25
25
  pywebexec/templates/popup.html,sha256=6kmZKb0tGJ7jsr9DqDEriSMlbkW-PJTtCiUE9U5_FOE,837
26
- pywebexec-1.4.8.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
27
- pywebexec-1.4.8.dist-info/METADATA,sha256=1yv4C31GoevftBY7JMF3wp14lHRZmkCg4PVZoXjjgx8,7399
28
- pywebexec-1.4.8.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
29
- pywebexec-1.4.8.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
30
- pywebexec-1.4.8.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
31
- pywebexec-1.4.8.dist-info/RECORD,,
26
+ pywebexec-1.4.10.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
27
+ pywebexec-1.4.10.dist-info/METADATA,sha256=_S8L2p92CQ1byTr4-reMaJRQZ2V14zem_j65ZUawpgU,7400
28
+ pywebexec-1.4.10.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
29
+ pywebexec-1.4.10.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
30
+ pywebexec-1.4.10.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
31
+ pywebexec-1.4.10.dist-info/RECORD,,