pywebexec 1.5.7__py3-none-any.whl → 1.5.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 +19 -2
- pywebexec/static/js/popup.js +14 -4
- pywebexec/static/js/script.js +12 -0
- pywebexec/templates/popup.html +1 -1
- pywebexec/version.py +2 -2
- {pywebexec-1.5.7.dist-info → pywebexec-1.5.9.dist-info}/METADATA +1 -1
- {pywebexec-1.5.7.dist-info → pywebexec-1.5.9.dist-info}/RECORD +11 -11
- {pywebexec-1.5.7.dist-info → pywebexec-1.5.9.dist-info}/LICENSE +0 -0
- {pywebexec-1.5.7.dist-info → pywebexec-1.5.9.dist-info}/WHEEL +0 -0
- {pywebexec-1.5.7.dist-info → pywebexec-1.5.9.dist-info}/entry_points.txt +0 -0
- {pywebexec-1.5.7.dist-info → pywebexec-1.5.9.dist-info}/top_level.txt +0 -0
pywebexec/pywebexec.py
CHANGED
@@ -323,8 +323,8 @@ def print_urls(command_id=None):
|
|
323
323
|
if token:
|
324
324
|
url_params = f"?token={token}"
|
325
325
|
if command_id:
|
326
|
-
print(f"{protocol}://{hostname}:{args.port}/
|
327
|
-
print(f"{protocol}://{ip}:{args.port}/
|
326
|
+
print(f"{protocol}://{hostname}:{args.port}/dopopup/{command_id}{url_params}")
|
327
|
+
print(f"{protocol}://{ip}:{args.port}/dopopup/{command_id}{url_params}")
|
328
328
|
else:
|
329
329
|
print(f"{protocol}://{hostname}:{args.port}{url_params}")
|
330
330
|
print(f"{protocol}://{ip}:{args.port}{url_params}")
|
@@ -750,6 +750,23 @@ def list_executables():
|
|
750
750
|
def popup(command_id):
|
751
751
|
return render_template('popup.html', command_id=command_id)
|
752
752
|
|
753
|
+
@app.route('/dopopup/<command_id>')
|
754
|
+
def do_popup(command_id):
|
755
|
+
return f"""
|
756
|
+
<html>
|
757
|
+
<head>
|
758
|
+
<script type="text/javascript">
|
759
|
+
window.onload = function() {{
|
760
|
+
window.open('/popup/{command_id}', '_blank', 'width=1000,height=600');
|
761
|
+
window.close();
|
762
|
+
}};
|
763
|
+
</script>
|
764
|
+
</head>
|
765
|
+
<body>
|
766
|
+
</body>
|
767
|
+
</html>
|
768
|
+
"""
|
769
|
+
|
753
770
|
def main():
|
754
771
|
global COMMAND_STATUS_DIR
|
755
772
|
basef = f"{CONFDIR}/pywebexec_{args.listen}:{args.port}"
|
pywebexec/static/js/popup.js
CHANGED
@@ -61,7 +61,6 @@ let outputInterval = null;
|
|
61
61
|
let nextOutputLink = null;
|
62
62
|
let fullOutput = '';
|
63
63
|
let outputLength = 0;
|
64
|
-
let title = null;
|
65
64
|
let slider = null;
|
66
65
|
let isPaused = false;
|
67
66
|
const toggleButton = document.getElementById('toggleFetch');
|
@@ -73,6 +72,14 @@ function getTokenParam() {
|
|
73
72
|
}
|
74
73
|
const urlToken = getTokenParam();
|
75
74
|
|
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);
|
81
|
+
}
|
82
|
+
|
76
83
|
async function fetchOutput(url) {
|
77
84
|
if (isPaused) return;
|
78
85
|
try {
|
@@ -102,11 +109,15 @@ async function fetchOutput(url) {
|
|
102
109
|
}
|
103
110
|
nextOutputLink = data.links.next;
|
104
111
|
if (data.status != 'running') {
|
105
|
-
title
|
112
|
+
document.title = document.title.replace('[running]',`[${data.status}]`);
|
106
113
|
clearInterval(outputInterval);
|
107
114
|
toggleButton.style.display = 'none';
|
108
115
|
} else {
|
109
116
|
toggleButton.style.display = 'block';
|
117
|
+
const title = extractTitle(data.output);
|
118
|
+
if (title) {
|
119
|
+
document.title = `${title} - [running]`;
|
120
|
+
}
|
110
121
|
}
|
111
122
|
}
|
112
123
|
} catch (error) {
|
@@ -130,7 +141,7 @@ async function viewOutput(command_id) {
|
|
130
141
|
return;
|
131
142
|
}
|
132
143
|
const data = await response.json();
|
133
|
-
title
|
144
|
+
document.title = `${data.command} ${data.params.join(' ')} - [${data.status}]`;
|
134
145
|
if (data.command == 'term')
|
135
146
|
terminal.options.cursorInactiveStyle = 'outline';
|
136
147
|
else
|
@@ -195,7 +206,6 @@ toggleButton.addEventListener('click', toggleFetchOutput);
|
|
195
206
|
|
196
207
|
window.addEventListener('resize', adjustOutputHeight);
|
197
208
|
window.addEventListener('load', () => {
|
198
|
-
title = document.getElementById('outputTitle');
|
199
209
|
slider = document.getElementById('outputSlider');
|
200
210
|
slider.addEventListener('input', sliderUpdateOutput);
|
201
211
|
const commandId = window.location.pathname.split('/').slice(-1)[0];
|
pywebexec/static/js/script.js
CHANGED
@@ -159,6 +159,14 @@ async function fetchCommands() {
|
|
159
159
|
}
|
160
160
|
}
|
161
161
|
|
162
|
+
function extractTitle(output) {
|
163
|
+
const titleindex = output.lastIndexOf('\x1b]0;');
|
164
|
+
if (titleindex < 0) return null;
|
165
|
+
const endindex = output.slice(titleindex+4).indexOf('\x07');
|
166
|
+
if (endindex < 0) return null;
|
167
|
+
return output.slice(titleindex+4, titleindex+4+endindex);
|
168
|
+
}
|
169
|
+
|
162
170
|
async function fetchOutput(url) {
|
163
171
|
if (isPaused) return;
|
164
172
|
try {
|
@@ -190,6 +198,10 @@ async function fetchOutput(url) {
|
|
190
198
|
toggleButton.style.display = 'none';
|
191
199
|
} else {
|
192
200
|
toggleButton.style.display = 'block';
|
201
|
+
/*const title = extractTitle(data.output);
|
202
|
+
if (title) {
|
203
|
+
document.title = title;
|
204
|
+
}*/
|
193
205
|
}
|
194
206
|
}
|
195
207
|
} catch (error) {
|
pywebexec/templates/popup.html
CHANGED
@@ -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
|
6
|
+
<title>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
@@ -1,6 +1,6 @@
|
|
1
1
|
pywebexec/__init__.py,sha256=4spIsVaF8RJt8S58AG_wWoORRNkws9Iwqprj27C3ljM,99
|
2
|
-
pywebexec/pywebexec.py,sha256=
|
3
|
-
pywebexec/version.py,sha256=
|
2
|
+
pywebexec/pywebexec.py,sha256=NmetF1ZQ7LsgmXDZwlwa2q05oXduVfh1AiOkKOu5HN8,28893
|
3
|
+
pywebexec/version.py,sha256=ylpxiWr4jebA2etznQR3gR_O42Lb5dOzM-BrUXQTJRA,411
|
4
4
|
pywebexec/static/css/Consolas NF.ttf,sha256=DJEOzF0eqZ-kxu3Gs_VE8X0NJqiobBzmxWDGpdgGRxI,1313900
|
5
5
|
pywebexec/static/css/style.css,sha256=OM-gJPLw0DcJwMgMXHDKc_9C87LYNu3bHssx_UtXi1Y,7273
|
6
6
|
pywebexec/static/css/xterm.css,sha256=uo5phWaUiJgcz0DAzv46uoByLLbJLeetYosL1xf68rY,5559
|
@@ -18,8 +18,8 @@ pywebexec/static/images/resume.svg,sha256=99LP1Ya2JXakRCO9kW8JMuT_4a_CannF65Eiuw
|
|
18
18
|
pywebexec/static/images/running.gif,sha256=iYuzQGkMxrakSIwt6gPieKCImGZoSAHmU5MUNZa7cpw,25696
|
19
19
|
pywebexec/static/images/success.svg,sha256=PJDcCSTevJh7rkfSFLtc7P0pbeh8PVQBS8DaOLQemmc,489
|
20
20
|
pywebexec/static/js/commands.js,sha256=8JDb3Q55EJOYf2Q9Uy6qEuqAnn1oGjM0RndgQ4aOjqo,7725
|
21
|
-
pywebexec/static/js/popup.js,sha256=
|
22
|
-
pywebexec/static/js/script.js,sha256=
|
21
|
+
pywebexec/static/js/popup.js,sha256=8ttMa_aeH0yzTWiM1kzEfPwIR0YqlfesddaccJ1_5Fo,7838
|
22
|
+
pywebexec/static/js/script.js,sha256=hgQsO-U0WoiFJdSPb5TyBJxePC-CxYyMmQGZJ0e7PmA,15472
|
23
23
|
pywebexec/static/js/xterm/LICENSE,sha256=EU1P4eXTull-_T9I80VuwnJXubB-zLzUl3xpEYj2T1M,1083
|
24
24
|
pywebexec/static/js/xterm/addon-canvas.js,sha256=ez6QTVvsmLVNJmdJlM-ZQ5bErwlxAQ_9DUmDIptl2TM,94607
|
25
25
|
pywebexec/static/js/xterm/addon-canvas.js.map,sha256=ECBA4B-BqUpdFeRzlsEWLSQnudnhLP-yPQJ8_hKquMo,379537
|
@@ -31,10 +31,10 @@ pywebexec/static/js/xterm/xterm.js,sha256=H5kaw7Syg-v5bmCuI6AKUnZd06Lkb6b92p8aqw
|
|
31
31
|
pywebexec/static/js/xterm/xterm.js.map,sha256=Y7O2Pb-fIS7Z8AC1D5s04_aiW_Jf1f4mCfN0U_OI6Zw,1118392
|
32
32
|
pywebexec/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
33
|
pywebexec/templates/index.html,sha256=XaT2IU7GcRj3iV-GmDPo8aghsYiUGxSH3kvPFzhaM2Y,2695
|
34
|
-
pywebexec/templates/popup.html,sha256=
|
35
|
-
pywebexec-1.5.
|
36
|
-
pywebexec-1.5.
|
37
|
-
pywebexec-1.5.
|
38
|
-
pywebexec-1.5.
|
39
|
-
pywebexec-1.5.
|
40
|
-
pywebexec-1.5.
|
34
|
+
pywebexec/templates/popup.html,sha256=CSNAVc4_aATG5oHX91BCOl30htMZpMxV4MJAwKXQ7i8,1302
|
35
|
+
pywebexec-1.5.9.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
|
36
|
+
pywebexec-1.5.9.dist-info/METADATA,sha256=53KDtj1as-Es3mPnbAKJ4_iXRYqhra7xZ6CN9AKlSqU,7801
|
37
|
+
pywebexec-1.5.9.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
38
|
+
pywebexec-1.5.9.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
|
39
|
+
pywebexec-1.5.9.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
|
40
|
+
pywebexec-1.5.9.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|