pywebexec 1.4.7__tar.gz → 1.4.9__tar.gz

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.
Files changed (38) hide show
  1. {pywebexec-1.4.7/pywebexec.egg-info → pywebexec-1.4.9}/PKG-INFO +1 -1
  2. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/pywebexec.py +3 -2
  3. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/js/popup.js +15 -6
  4. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/js/script.js +7 -2
  5. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/templates/popup.html +1 -1
  6. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/version.py +2 -2
  7. {pywebexec-1.4.7 → pywebexec-1.4.9/pywebexec.egg-info}/PKG-INFO +1 -1
  8. {pywebexec-1.4.7 → pywebexec-1.4.9}/.github/workflows/python-publish.yml +0 -0
  9. {pywebexec-1.4.7 → pywebexec-1.4.9}/.gitignore +0 -0
  10. {pywebexec-1.4.7 → pywebexec-1.4.9}/LICENSE +0 -0
  11. {pywebexec-1.4.7 → pywebexec-1.4.9}/README.md +0 -0
  12. {pywebexec-1.4.7 → pywebexec-1.4.9}/pyproject.toml +0 -0
  13. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/__init__.py +0 -0
  14. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/css/Consolas NF.ttf +0 -0
  15. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/css/style.css +0 -0
  16. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/css/xterm.css +0 -0
  17. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/images/aborted.svg +0 -0
  18. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/images/copy.svg +0 -0
  19. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/images/copy_ok.svg +0 -0
  20. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/images/down-arrow.svg +0 -0
  21. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/images/failed.svg +0 -0
  22. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/images/favicon.svg +0 -0
  23. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/images/popup.svg +0 -0
  24. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/images/running.gif +0 -0
  25. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/images/success.svg +0 -0
  26. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/js/commands.js +0 -0
  27. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/js/xterm/LICENSE +0 -0
  28. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/js/xterm/ansi_up.min.js +0 -0
  29. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/js/xterm/xterm-addon-fit.js +0 -0
  30. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/static/js/xterm/xterm.js +0 -0
  31. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/templates/__init__.py +0 -0
  32. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec/templates/index.html +0 -0
  33. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec.egg-info/SOURCES.txt +0 -0
  34. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec.egg-info/dependency_links.txt +0 -0
  35. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec.egg-info/entry_points.txt +0 -0
  36. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec.egg-info/requires.txt +0 -0
  37. {pywebexec-1.4.7 → pywebexec-1.4.9}/pywebexec.egg-info/top_level.txt +0 -0
  38. {pywebexec-1.4.7 → pywebexec-1.4.9}/setup.cfg +0 -0
@@ -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
@@ -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>
@@ -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
File without changes
File without changes
File without changes
File without changes
File without changes