pywebexec 1.6.7__py3-none-any.whl → 1.6.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.
@@ -55,6 +55,18 @@ const fitAddon = new FitAddon.FitAddon();
55
55
  terminal.loadAddon(fitAddon);
56
56
  terminal.open(document.getElementById('output'));
57
57
  fitAddon.fit();
58
+ terminal.onTitleChange((title) => {
59
+ document.getElementById('commandInfo').innerText = title;
60
+ })
61
+ terminal.onSelectionChange(() => {
62
+ const selectionText = terminal.getSelection();
63
+ if (selectionText) {
64
+ navigator.clipboard.writeText(selectionText).catch(err => {
65
+ console.error('Failed to copy text to clipboard:', err);
66
+ });
67
+ }
68
+ });
69
+
58
70
 
59
71
  let currentCommandId = null;
60
72
  let outputInterval = null;
@@ -72,14 +84,12 @@ function getTokenParam() {
72
84
  }
73
85
  const urlToken = getTokenParam();
74
86
 
75
- function extractTitle(output) {
76
- const titleindex = output.lastIndexOf('\x1b]0;');
77
- if (titleindex < 0) return null;
78
- const endindex = output.slice(titleindex+4).indexOf('\x07');
79
- if (endindex < 0) return null;
80
- return output.slice(titleindex+4, titleindex+4+endindex);
87
+
88
+ function setCommandStatus(status) {
89
+ document.getElementById("commandStatus").className = `status-icon status-${status}`;
81
90
  }
82
91
 
92
+
83
93
  async function fetchOutput(url) {
84
94
  if (isPaused) return;
85
95
  try {
@@ -112,15 +122,10 @@ async function fetchOutput(url) {
112
122
  clearInterval(outputInterval);
113
123
  document.title = document.title.replace('[running]',`[${data.status}]`);
114
124
  toggleButton.style.display = 'none';
115
- document.getElementById('commandStatus').classList.remove('status-running');
116
- document.getElementById('commandStatus').classList.add(`status-${data.status}`);
125
+ setCommandStatus(data.status)
117
126
  } else {
118
127
  toggleButton.style.display = 'block';
119
- const title = extractTitle(data.output);
120
- if (title) {
121
- document.title = `${title} - [running]`;
122
- document.getElementById('commandInfo').innerHTML = `<span id="commandStatus" class="status-icon status-running"></span>${title}`;
123
- }
128
+ setCommandStatus(data.status)
124
129
  }
125
130
  }
126
131
  } catch (error) {
@@ -146,7 +151,8 @@ async function viewOutput(command_id) {
146
151
  const data = await response.json();
147
152
  const commandInfo = document.getElementById('commandInfo');
148
153
  const command = `${data.command.replace(/^\.\//, '')} ${data.params.join(' ')}`;
149
- commandInfo.innerHTML = `<span id="commandStatus" class="status-icon status-${data.status}"></span>${command}`;
154
+ setCommandStatus(data.status);
155
+ commandInfo.innerText = command;
150
156
  commandInfo.setAttribute('title', command);
151
157
  document.title = `${data.command} ${data.params.join(' ')} - [${data.status}]`;
152
158
  if (data.command == 'term')
@@ -18,7 +18,7 @@ function initTerminal()
18
18
  cursorBlink: false,
19
19
  cursorInactiveStyle: 'none',
20
20
  disableStdin: true,
21
- convertEol: true,
21
+ //convertEol: true,
22
22
  fontFamily: '"Consolas NF", "Fira Code", monospace, "Powerline Extra Symbols", courier-new, courier',
23
23
  fontSize: fontSize,
24
24
  scrollback: maxScrollback,
@@ -76,11 +76,17 @@ terminal.loadAddon(fitAddon);
76
76
  terminal.open(document.getElementById('output'));
77
77
  fitAddon.fit();
78
78
 
79
- function getTokenParam() {
80
- const urlParams = new URLSearchParams(window.location.search);
81
- return urlParams.get('token') ? `?token=${urlParams.get('token')}` : '';
82
- }
83
- const urlToken = getTokenParam();
79
+ terminal.onTitleChange((title) => {
80
+ document.getElementById('commandInfo').innerText = title;
81
+ })
82
+
83
+ /*terminal.onResize((evt) => {
84
+ const terminal_size = {
85
+ Width: evt.cols,
86
+ Height: evt.rows,
87
+ };
88
+ console.log(terminal_size);
89
+ })*/
84
90
 
85
91
  terminal.onSelectionChange(() => {
86
92
  const selectionText = terminal.getSelection();
@@ -91,6 +97,13 @@ terminal.onSelectionChange(() => {
91
97
  }
92
98
  });
93
99
 
100
+ function getTokenParam() {
101
+ const urlParams = new URLSearchParams(window.location.search);
102
+ return urlParams.get('token') ? `?token=${urlParams.get('token')}` : '';
103
+ }
104
+ const urlToken = getTokenParam();
105
+
106
+
94
107
  document.getElementById('launchForm').addEventListener('submit', async (event) => {
95
108
  event.preventDefault();
96
109
  const commandName = document.getElementById('commandName').value;
@@ -175,14 +188,6 @@ async function fetchCommands(hide=false) {
175
188
  }
176
189
  }
177
190
 
178
- function extractTitle(output) {
179
- const titleindex = output.lastIndexOf('\x1b]0;');
180
- if (titleindex < 0) return null;
181
- const endindex = output.slice(titleindex+4).indexOf('\x07');
182
- if (endindex < 0) return null;
183
- return output.slice(titleindex+4, titleindex+4+endindex);
184
- }
185
-
186
191
  async function fetchOutput(url) {
187
192
  if (isPaused) return;
188
193
  try {
@@ -212,15 +217,11 @@ async function fetchOutput(url) {
212
217
  if (data.status != 'running') {
213
218
  clearInterval(outputInterval);
214
219
  toggleButton.style.display = 'none';
215
- document.getElementById('commandStatus').classList.remove('status-running');
216
- document.getElementById('commandStatus').classList.add(`status-${data.status}`);
220
+ setCommandStatus(data.status);
217
221
  fetchCommands();
218
222
  } else {
219
223
  toggleButton.style.display = 'block';
220
- const title = extractTitle(data.output);
221
- if (title) {
222
- document.getElementById('commandInfo').innerHTML = `<span id="commandStatus" class="status-icon status-running"></span>${title}`;
223
- }
224
+ setCommandStatus(data.status);
224
225
  }
225
226
  }
226
227
  } catch (error) {
@@ -228,6 +229,10 @@ async function fetchOutput(url) {
228
229
  }
229
230
  }
230
231
 
232
+ function setCommandStatus(status) {
233
+ document.getElementById("commandStatus").className = `status-icon status-${status}`;
234
+ }
235
+
231
236
  async function viewOutput(command_id) {
232
237
  slider.value = 100;
233
238
  outputPercentage.innerText = '100%';
@@ -246,7 +251,8 @@ async function viewOutput(command_id) {
246
251
  const data = await response.json();
247
252
  const commandInfo = document.getElementById('commandInfo');
248
253
  const command = `${data.command.replace(/^\.\//, '')} ${data.params.join(' ')}`;
249
- commandInfo.innerHTML = `<span id="commandStatus" class="status-icon status-${data.status}"></span>${command}`;
254
+ setCommandStatus(data.status)
255
+ commandInfo.innerText = command;
250
256
  commandInfo.setAttribute('title', command);
251
257
  if (data.command == 'term')
252
258
  terminal.options.cursorInactiveStyle = 'outline';
@@ -46,7 +46,7 @@
46
46
  <div id="output" class="output"></div>
47
47
  <div id="pausedMessage" class="paused-message">Paused</div>
48
48
  <div class="slider-container">
49
- <span id="commandInfo" class="command-info"></span>
49
+ <span class="command-info"><span id="commandStatus" class="status-icon"></span><span id="commandInfo"></span></span>
50
50
  <input type="range" id="outputSlider" min="0" max="100" value="100">
51
51
  <label for="outputSlider"><span id="outputPercentage">100%</span></label>
52
52
  <button id="toggleFetch" class="pause-resume-button pause"></button>
@@ -14,7 +14,7 @@
14
14
  <div id="output" class="output"></div>
15
15
  <div id="pausedMessage" class="paused-message">Paused</div>
16
16
  <div class="slider-container">
17
- <span id="commandInfo" class="command-info"></span>
17
+ <span class="command-info"><span id="commandStatus"></span><span id="commandInfo"></span></span>
18
18
  <input type="range" id="outputSlider" min="0" max="100" value="100">
19
19
  <label for="outputSlider"><span id="outputPercentage">100%</span></label>
20
20
  <button id="toggleFetch" class="pause-resume-button pause"></button>
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.6.7'
16
- __version_tuple__ = version_tuple = (1, 6, 7)
15
+ __version__ = version = '1.6.9'
16
+ __version_tuple__ = version_tuple = (1, 6, 9)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pywebexec
3
- Version: 1.6.7
3
+ Version: 1.6.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
2
  pywebexec/pywebexec.py,sha256=L47T3dB78GvW2CD09kRFncjaNjLxJ_NqB4VvOftSodo,31719
3
- pywebexec/version.py,sha256=UBH9kvxesdE0svvcKwHfK8rz5bJUzNXPBHo7APqVEfk,411
3
+ pywebexec/version.py,sha256=H4tpGbuK5q1tqtuUh1Nr2Buwsz8VycRrcpqeBxyquBg,411
4
4
  pywebexec/static/css/Consolas NF.ttf,sha256=DJEOzF0eqZ-kxu3Gs_VE8X0NJqiobBzmxWDGpdgGRxI,1313900
5
5
  pywebexec/static/css/style.css,sha256=MJHUBpjWL4sLxM7a7DxypmPKaFJQbmA_ESNXsbLviNI,8201
6
6
  pywebexec/static/css/xterm.css,sha256=uo5phWaUiJgcz0DAzv46uoByLLbJLeetYosL1xf68rY,5559
@@ -19,8 +19,8 @@ pywebexec/static/images/resume.svg,sha256=99LP1Ya2JXakRCO9kW8JMuT_4a_CannF65Eiuw
19
19
  pywebexec/static/images/running.svg,sha256=fBCYwYb2O9K4N3waC2nURP25NRwZlqR4PbDZy6JQMww,610
20
20
  pywebexec/static/images/success.svg,sha256=NVwezvVMplt46ElW798vqGfrL21Mw_DWHUp_qiD_FU8,489
21
21
  pywebexec/static/js/commands.js,sha256=h2fkd9qpypLBxvhEEbay23nwuqUwcKJA0vHugcyL8pU,7961
22
- pywebexec/static/js/popup.js,sha256=TCzGoPVS_EvwzGc544SvRgLYG7XWXRF8tIQGfu3atrU,8533
23
- pywebexec/static/js/script.js,sha256=mGY_-A1rZNjgpTU8FsVH0j6Tj7v4pHpSaREPbTttvEs,17376
22
+ pywebexec/static/js/popup.js,sha256=I5TLYUm5s2p12a0VfFONOxxzhXLBmnpVzM-B5W-GPis,8294
23
+ pywebexec/static/js/script.js,sha256=8CcIn-O4I1ojbiAYOeQl3yTnykn0Lj3xdWdx6m6HyNs,17085
24
24
  pywebexec/static/js/xterm/LICENSE,sha256=EU1P4eXTull-_T9I80VuwnJXubB-zLzUl3xpEYj2T1M,1083
25
25
  pywebexec/static/js/xterm/addon-canvas.js,sha256=ez6QTVvsmLVNJmdJlM-ZQ5bErwlxAQ_9DUmDIptl2TM,94607
26
26
  pywebexec/static/js/xterm/addon-canvas.js.map,sha256=ECBA4B-BqUpdFeRzlsEWLSQnudnhLP-yPQJ8_hKquMo,379537
@@ -31,11 +31,11 @@ pywebexec/static/js/xterm/addon-unicode11.js.map,sha256=paDj5KKtTIUGedQn2x7CaUTD
31
31
  pywebexec/static/js/xterm/xterm.js,sha256=H5kaw7Syg-v5bmCuI6AKUnZd06Lkb6b92p8aqwMvdJU,289441
32
32
  pywebexec/static/js/xterm/xterm.js.map,sha256=Y7O2Pb-fIS7Z8AC1D5s04_aiW_Jf1f4mCfN0U_OI6Zw,1118392
33
33
  pywebexec/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
- pywebexec/templates/index.html,sha256=3XAXlpluzmTxC75KLzHDI4aJvQyQrOShB_weJ27PE2U,2815
35
- pywebexec/templates/popup.html,sha256=6FfzMjxuAC_xwyMGPf3p5tm6iPVY0QCsqY80eotD0z8,1362
36
- pywebexec-1.6.7.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
37
- pywebexec-1.6.7.dist-info/METADATA,sha256=6CuS17ptfqw8Xm5GB-KADbxnr3CSIo0koygGIA_BHIc,7801
38
- pywebexec-1.6.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
39
- pywebexec-1.6.7.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
40
- pywebexec-1.6.7.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
41
- pywebexec-1.6.7.dist-info/RECORD,,
34
+ pywebexec/templates/index.html,sha256=5h8kLyzAhbvUDU9sEwrGIvD6FxAMcDZLXlN-ldlO8KU,2880
35
+ pywebexec/templates/popup.html,sha256=3ZqQcE9mYs-RXv0Lfb24zntOlvR137ZYI9mtCZNVAo0,1407
36
+ pywebexec-1.6.9.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
37
+ pywebexec-1.6.9.dist-info/METADATA,sha256=ECfHWHQFub3yEsBHe32T47A2mpHgqXTs0bX10WAmdOs,7801
38
+ pywebexec-1.6.9.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
39
+ pywebexec-1.6.9.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
40
+ pywebexec-1.6.9.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
41
+ pywebexec-1.6.9.dist-info/RECORD,,