pywebexec 1.4.7__py3-none-any.whl → 1.4.9__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,
@@ -31,6 +34,8 @@ let outputInterval = null;
31
34
  let nextOutputLink = null;
32
35
  let fullOutput = '';
33
36
  let outputLength = 0;
37
+ let title = null;
38
+ let slider = null;
34
39
 
35
40
  function getTokenParam() {
36
41
  const urlParams = new URLSearchParams(window.location.search);
@@ -49,9 +54,10 @@ async function fetchOutput(url) {
49
54
  terminal.write(data.error);
50
55
  clearInterval(outputInterval);
51
56
  } else {
52
- slider = document.getElementById('outputSlider')
53
57
  percentage = slider.value;
54
58
  fullOutput += data.output;
59
+ if (fullOutput.length > maxSize)
60
+ fullOutput = fullOutput.slice(-maxSize);
55
61
  if (percentage == 100)
56
62
  terminal.write(data.output);
57
63
  else {
@@ -61,6 +67,7 @@ async function fetchOutput(url) {
61
67
  }
62
68
  nextOutputLink = data.links.next;
63
69
  if (data.status != 'running') {
70
+ title.innerText = `${data.status} ${title.innerText.split(' ').slice(1).join(' ')}`;
64
71
  clearInterval(outputInterval);
65
72
  }
66
73
  }
@@ -70,7 +77,7 @@ async function fetchOutput(url) {
70
77
  }
71
78
 
72
79
  async function viewOutput(command_id) {
73
- document.getElementById('outputSlider').value = 100;
80
+ slider.value = 100;
74
81
  adjustOutputHeight();
75
82
  currentCommandId = command_id;
76
83
  nextOutputLink = `/command_output/${command_id}${urlToken}`;
@@ -84,7 +91,7 @@ async function viewOutput(command_id) {
84
91
  return;
85
92
  }
86
93
  const data = await response.json();
87
- document.getElementsByTagName('title')[0].innerText = `${data.command} ${data.status}`;
94
+ title.innerText = `${data.status} ${data.command} ${data.params.join(' ')}`;
88
95
  if (data.command == 'term')
89
96
  terminal.options.cursorInactiveStyle = 'outline';
90
97
  else
@@ -107,10 +114,10 @@ function adjustOutputHeight() {
107
114
  const maxHeight = windowHeight - outputTop - 60; // Adjusted for slider height
108
115
  outputDiv.style.height = `${maxHeight}px`;
109
116
  fitAddon.fit();
117
+ sliderUpdateOutput();
110
118
  }
111
119
 
112
120
  function sliderUpdateOutput() {
113
- const slider = document.getElementById('outputSlider');
114
121
  const percentage = slider.value;
115
122
  outputLength = Math.floor((fullOutput.length * percentage) / 100);
116
123
  const limitedOutput = fullOutput.slice(0, outputLength);
@@ -120,10 +127,12 @@ function sliderUpdateOutput() {
120
127
  document.getElementById('outputPercentage').innerText = `${percentage}%`;
121
128
  }
122
129
 
123
- document.getElementById('outputSlider').addEventListener('input', sliderUpdateOutput);
124
130
 
125
131
  window.addEventListener('resize', adjustOutputHeight);
126
132
  window.addEventListener('load', () => {
133
+ title = document.getElementById('outputTitle');
134
+ slider = document.getElementById('outputSlider');
135
+ slider.addEventListener('input', sliderUpdateOutput);
127
136
  const commandId = window.location.pathname.split('/').slice(-1)[0];
128
137
  viewOutput(commandId);
129
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 {
@@ -187,7 +192,7 @@ async function viewOutput(command_id) {
187
192
 
188
193
  async function openPopup(command_id) {
189
194
  const popupUrl = `/popup/${command_id}${urlToken}`;
190
- window.open(popupUrl, '_blank', 'width=800,height=600');
195
+ window.open(popupUrl, '_blank', 'width=1000,height=600');
191
196
  }
192
197
 
193
198
  async function relaunchCommand(command_id, event) {
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="UTF-8">
5
5
  <link rel="icon" href="/static/images/favicon.svg" type="image/svg+xml">
6
- <title>Command Output</title>
6
+ <title id="outputTitle">Command Output</title>
7
7
  <link rel="stylesheet" href="/static/css/style.css">
8
8
  <link rel="stylesheet" href="/static/css/xterm.css">
9
9
  </head>
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.7'
16
- __version_tuple__ = version_tuple = (1, 4, 7)
15
+ __version__ = version = '1.4.9'
16
+ __version_tuple__ = version_tuple = (1, 4, 9)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pywebexec
3
- Version: 1.4.7
3
+ Version: 1.4.9
4
4
  Summary: Simple Python HTTP Exec Server
5
5
  Home-page: https://github.com/joknarf/pywebexec
6
6
  Author: Franck Jouvanceau
@@ -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=6M0bnfqGZEQvwGyTAgOkscrVPq1huIWdr9OdJlVIiPk,411
2
+ pywebexec/pywebexec.py,sha256=7N8cq8qDn7z9mXXWVAOd-eijNAkd-EYvWBGKKSOWeTQ,26211
3
+ pywebexec/version.py,sha256=7YfyzKekRBziu-K_N0hnrpsNnrC-U6NwEUBuUEQ_xUA,411
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,18 +14,18 @@ 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=1AczXkJrqqjajT8ji4Rxz_xRyPSO8NJmIsx-ckmbNEw,4239
18
- pywebexec/static/js/script.js,sha256=QAXrNqHrqrAF2MpgFagnMe59AIT57bAe7crzYYzKGB4,11972
17
+ pywebexec/static/js/popup.js,sha256=VdkDXEIwd4IawhDIWew6poWhpE7sAReVn0MopdSx5wY,4519
18
+ pywebexec/static/js/script.js,sha256=opY6g03aeTZH_PuZEEb3x-RtYDnDonVqJINUy_NP2Ik,12181
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
22
22
  pywebexec/static/js/xterm/xterm.js,sha256=Bzka76jZwEhVt_LlS0e0qMw7ryGa1p5qfxFyeohphBo,283371
23
23
  pywebexec/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  pywebexec/templates/index.html,sha256=DYtT555wSNhnFtzzHhPMWJireynCJNnAuTytpoORQeE,2321
25
- pywebexec/templates/popup.html,sha256=PfhAi1LwS06MvjqJA45IN_eLxy49Tq2Q_qOPzX8JTrU,820
26
- pywebexec-1.4.7.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
27
- pywebexec-1.4.7.dist-info/METADATA,sha256=Jzlkrd79ANeEkb5ZI98Bc0GnBQUWlEYNRLanQSDeyKQ,7399
28
- pywebexec-1.4.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
29
- pywebexec-1.4.7.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
30
- pywebexec-1.4.7.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
31
- pywebexec-1.4.7.dist-info/RECORD,,
25
+ pywebexec/templates/popup.html,sha256=6kmZKb0tGJ7jsr9DqDEriSMlbkW-PJTtCiUE9U5_FOE,837
26
+ pywebexec-1.4.9.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
27
+ pywebexec-1.4.9.dist-info/METADATA,sha256=E6Kc1LaQN1358Xw9tZY7nD9rPELY4iWEuAmaUKkHLbU,7399
28
+ pywebexec-1.4.9.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
29
+ pywebexec-1.4.9.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
30
+ pywebexec-1.4.9.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
31
+ pywebexec-1.4.9.dist-info/RECORD,,