pywebexec 1.9.6__py3-none-any.whl → 1.9.8__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 +7 -4
- pywebexec/static/js/executables.js +2 -2
- pywebexec/swagger.yaml +18 -6
- pywebexec/version.py +2 -2
- {pywebexec-1.9.6.dist-info → pywebexec-1.9.8.dist-info}/METADATA +10 -9
- {pywebexec-1.9.6.dist-info → pywebexec-1.9.8.dist-info}/RECORD +10 -10
- {pywebexec-1.9.6.dist-info → pywebexec-1.9.8.dist-info}/LICENSE +0 -0
- {pywebexec-1.9.6.dist-info → pywebexec-1.9.8.dist-info}/WHEEL +0 -0
- {pywebexec-1.9.6.dist-info → pywebexec-1.9.8.dist-info}/entry_points.txt +0 -0
- {pywebexec-1.9.6.dist-info → pywebexec-1.9.8.dist-info}/top_level.txt +0 -0
pywebexec/pywebexec.py
CHANGED
@@ -766,6 +766,12 @@ def run_command_endpoint():
|
|
766
766
|
|
767
767
|
return jsonify({'message': 'Command is running', 'command_id': command_id})
|
768
768
|
|
769
|
+
@app.route('/commands/exposed', methods=['GET'])
|
770
|
+
def list_executables():
|
771
|
+
executables_list = get_executables()
|
772
|
+
return jsonify({"commands": executables_list})
|
773
|
+
|
774
|
+
|
769
775
|
@app.route('/commands/<cmd>', methods=['POST'])
|
770
776
|
def run_dynamic_command(cmd):
|
771
777
|
# Validate that 'cmd' is an executable in the current directory
|
@@ -871,10 +877,6 @@ def get_command_output_raw(command_id):
|
|
871
877
|
return
|
872
878
|
return Response(generate(offset), content_type='text/plain')
|
873
879
|
|
874
|
-
@app.route('/executables', methods=['GET'])
|
875
|
-
def list_executables():
|
876
|
-
executables_list = get_executables()
|
877
|
-
return jsonify({"executables": executables_list})
|
878
880
|
|
879
881
|
@app.route('/commands/<command_id>/popup')
|
880
882
|
def popup(command_id):
|
@@ -923,6 +925,7 @@ def swagger_yaml():
|
|
923
925
|
swagger_spec.setdefault("paths", {})[dynamic_path] = {
|
924
926
|
"post": {
|
925
927
|
"summary": f"Run command {exe["command"]}",
|
928
|
+
"tags": ["run_commands"],
|
926
929
|
"description": f"{exe["help"]}",
|
927
930
|
"consumes": ["application/json"],
|
928
931
|
"produces": ["application/json"],
|
@@ -225,7 +225,7 @@ window.addEventListener('load', () => {
|
|
225
225
|
|
226
226
|
async function fetchExecutables() {
|
227
227
|
try {
|
228
|
-
const response = await fetch(`/
|
228
|
+
const response = await fetch(`/commands/exposed`);
|
229
229
|
if (!response.ok) {
|
230
230
|
throw new Error('Failed to fetch executables');
|
231
231
|
}
|
@@ -233,7 +233,7 @@ async function fetchExecutables() {
|
|
233
233
|
// Build mapping from executable name to its object
|
234
234
|
gExecutables = {};
|
235
235
|
commandListDiv.innerHTML = '';
|
236
|
-
data.
|
236
|
+
data.commands.forEach(exeObj => {
|
237
237
|
gExecutables[exeObj.command] = exeObj;
|
238
238
|
const div = document.createElement('div');
|
239
239
|
div.className = 'command-item';
|
pywebexec/swagger.yaml
CHANGED
@@ -6,6 +6,8 @@ paths:
|
|
6
6
|
/commands:
|
7
7
|
get:
|
8
8
|
summary: "List commands status"
|
9
|
+
tags:
|
10
|
+
- commands
|
9
11
|
responses:
|
10
12
|
"200":
|
11
13
|
description: "List of all commands status"
|
@@ -37,6 +39,8 @@ paths:
|
|
37
39
|
type: string
|
38
40
|
post:
|
39
41
|
summary: "Run a command"
|
42
|
+
tags:
|
43
|
+
- commands
|
40
44
|
consumes:
|
41
45
|
- application/json
|
42
46
|
produces:
|
@@ -77,6 +81,8 @@ paths:
|
|
77
81
|
/commands/{command_id}:
|
78
82
|
get:
|
79
83
|
summary: "Get command status"
|
84
|
+
tags:
|
85
|
+
- commands
|
80
86
|
parameters:
|
81
87
|
- in: path
|
82
88
|
name: command_id
|
@@ -122,6 +128,8 @@ paths:
|
|
122
128
|
/commands/{command_id}/output:
|
123
129
|
get:
|
124
130
|
summary: "Get command output"
|
131
|
+
tags:
|
132
|
+
- commands
|
125
133
|
parameters:
|
126
134
|
- in: path
|
127
135
|
name: command_id
|
@@ -167,6 +175,8 @@ paths:
|
|
167
175
|
/commands/{command_id}/stop:
|
168
176
|
patch:
|
169
177
|
summary: "Stop a running command"
|
178
|
+
tags:
|
179
|
+
- commands
|
170
180
|
parameters:
|
171
181
|
- in: path
|
172
182
|
name: command_id
|
@@ -180,18 +190,20 @@ paths:
|
|
180
190
|
properties:
|
181
191
|
message:
|
182
192
|
type: string
|
183
|
-
/
|
193
|
+
/commands/exposed:
|
184
194
|
get:
|
185
195
|
summary: "List available executable commands"
|
196
|
+
tags:
|
197
|
+
- commands
|
186
198
|
produces:
|
187
199
|
- application/json
|
188
200
|
responses:
|
189
201
|
"200":
|
190
|
-
description: "List of
|
202
|
+
description: "List of commands with markdown help"
|
191
203
|
schema:
|
192
204
|
type: object
|
193
205
|
properties:
|
194
|
-
|
206
|
+
commands:
|
195
207
|
type: array
|
196
208
|
items:
|
197
209
|
type: object
|
@@ -202,8 +214,8 @@ paths:
|
|
202
214
|
type: string
|
203
215
|
examples:
|
204
216
|
application/json:
|
205
|
-
|
217
|
+
commands:
|
206
218
|
- command: ls
|
207
|
-
help: "List directory contents\
|
219
|
+
help: "List directory contents \n**params**:\n* `<ls_params>`"
|
208
220
|
- command: cat
|
209
|
-
help: "Concatenate and display files\
|
221
|
+
help: "Concatenate and display files \n**params**:\n* `<cat_params>`"
|
pywebexec/version.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: pywebexec
|
3
|
-
Version: 1.9.
|
3
|
+
Version: 1.9.8
|
4
4
|
Summary: Simple Python HTTP Exec Server
|
5
5
|
Home-page: https://github.com/joknarf/pywebexec
|
6
6
|
Author: Franck Jouvanceau
|
@@ -213,18 +213,19 @@ The help message is displayed:
|
|
213
213
|
|
214
214
|
A swagger UI is available at `http[s]://<srv>/v0/documentation`
|
215
215
|
|
216
|
-
<img src="https://github.com/user-attachments/assets/
|
216
|
+
<img src="https://github.com/user-attachments/assets/c80a341e-c04c-4606-9510-a57b473a74e5" width="400"/>
|
217
217
|
|
218
218
|
## API reference
|
219
219
|
|
220
220
|
|
221
221
|
| method | route | params/payload | returns
|
222
222
|
|-----------|-----------------------------|--------------------|---------------------|
|
223
|
-
| GET | /
|
223
|
+
| GET | /commands/exposed | | executables: [<br> {command: str,help: str},<br>] |
|
224
224
|
| GET | /commands | | commands: [<br> {<br> command_id: uuid<br> command: str<br> start_time: isotime<br> end_time: isotime<br> status: str<br> exit_code: int<br> last_output_line: str<br> },<br>] |
|
225
|
-
| GET | /commands/{id}
|
226
|
-
| GET | /commands/{id}/output
|
227
|
-
| GET | /commands/{id}/output_raw
|
228
|
-
| POST | /commands
|
229
|
-
| POST | /commands/{cmd}
|
230
|
-
| PATCH
|
225
|
+
| GET | /commands/{id} | | command_id: uuid<br>command: str<br>params: array[str]<br>start_time: isotime<br>end_time: isotime<br>status: str<br>exit_code: int<br>last_output_line: str |
|
226
|
+
| GET | /commands/{id}/output | offset: int | output: str<br>status: str<br>links: { next: str } |
|
227
|
+
| GET | /commands/{id}/output_raw | offset: int | output: stream raw output until end of command<br>curl -Ns http://srv/commands/{id}/output_raw|
|
228
|
+
| POST | /commands | command: str<br>params: array[str]<br>rows: int<br>cols: int | command_id: uuid<br>message: str |
|
229
|
+
| POST | /commands/{cmd} | params: array[str]<br>rows: int<br>cols: int | command_id: uuid<br>message: str |
|
230
|
+
| PATCH | /commands/{id}/stop | | message: str |
|
231
|
+
|
@@ -1,8 +1,8 @@
|
|
1
1
|
pywebexec/__init__.py,sha256=197fHJy0UDBwTTpGCGortZRr-w2kTaD7MxqdbVmTEi0,61
|
2
2
|
pywebexec/host_ip.py,sha256=Ud_HTflWVQ8789aoQ2RZdT1wGI-ccvrwSWGz_c7T3TI,1241
|
3
|
-
pywebexec/pywebexec.py,sha256=
|
4
|
-
pywebexec/swagger.yaml,sha256=
|
5
|
-
pywebexec/version.py,sha256=
|
3
|
+
pywebexec/pywebexec.py,sha256=SU-iD3FQIyWsw0-iGjM2P8INpBW9JhzZ1lI3Y50Fwqk,37983
|
4
|
+
pywebexec/swagger.yaml,sha256=pGG4ikpASgBnzoZ44jJJ8l5JrNz7GOBpCakSJta-30c,5676
|
5
|
+
pywebexec/version.py,sha256=70T59qHdyEgYEEdFJ1UeLYBCA8Ap6rFY6TI0tAG2O2k,511
|
6
6
|
pywebexec/static/css/style.css,sha256=M2zqrDSolDUxeVVeJ0e6NMTMM8B4_LUEmG-lWQwtUoI,9530
|
7
7
|
pywebexec/static/css/xterm.css,sha256=uo5phWaUiJgcz0DAzv46uoByLLbJLeetYosL1xf68rY,5559
|
8
8
|
pywebexec/static/fonts/CommitMonoNerdFontMono-Regular.ttf,sha256=v6nZdSx5cs_TIic8Fujrjzg9u9glWjorDIr7RlwNceM,2370228
|
@@ -23,7 +23,7 @@ pywebexec/static/images/popup.svg,sha256=0Bl9A_v5cBsMPn6FnOlVWlAQKgd2zqiWQbhjcL9
|
|
23
23
|
pywebexec/static/images/resume.svg,sha256=99LP1Ya2JXakRCO9kW8JMuT_4a_CannF65EiuwtvK4A,607
|
24
24
|
pywebexec/static/images/running.svg,sha256=fBCYwYb2O9K4N3waC2nURP25NRwZlqR4PbDZy6JQMww,610
|
25
25
|
pywebexec/static/images/success.svg,sha256=NVwezvVMplt46ElW798vqGfrL21Mw_DWHUp_qiD_FU8,489
|
26
|
-
pywebexec/static/js/executables.js,sha256=
|
26
|
+
pywebexec/static/js/executables.js,sha256=ISRtkAlpjv3agIbTc3MIKV62g22h6NQW8stxA43ZD9Y,9473
|
27
27
|
pywebexec/static/js/popup.js,sha256=0fr3pp4j9D2fXEVnHyQrx2bPWFHfgbb336dbewgH1d8,9023
|
28
28
|
pywebexec/static/js/script.js,sha256=EpDwM1CyvHgsfkMSAkYmS9nU0sKOEXpQ6L3xhDIabEY,17933
|
29
29
|
pywebexec/static/js/marked/LICENSE.md,sha256=jjo_gvWaYJWPVsoI9EVkfDKkcz3HymwsRvbriYRxq5w,2942
|
@@ -42,9 +42,9 @@ pywebexec/static/js/xterm/xterm.js.map,sha256=Y7O2Pb-fIS7Z8AC1D5s04_aiW_Jf1f4mCf
|
|
42
42
|
pywebexec/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
43
43
|
pywebexec/templates/index.html,sha256=66Oevi5umxCK81IoGoudx3vWp0ltdFMFsymXsnLQw-c,3209
|
44
44
|
pywebexec/templates/popup.html,sha256=3kpMccKD_OLLhJ4Y9KRw6Ny8wQWjVaRrUfV9y5-bDiQ,1580
|
45
|
-
pywebexec-1.9.
|
46
|
-
pywebexec-1.9.
|
47
|
-
pywebexec-1.9.
|
48
|
-
pywebexec-1.9.
|
49
|
-
pywebexec-1.9.
|
50
|
-
pywebexec-1.9.
|
45
|
+
pywebexec-1.9.8.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
|
46
|
+
pywebexec-1.9.8.dist-info/METADATA,sha256=ELM9BreZt2lJ2u-2QhY5sJ1ukVmvK2FfZltv07rFcJo,9479
|
47
|
+
pywebexec-1.9.8.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
48
|
+
pywebexec-1.9.8.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
|
49
|
+
pywebexec-1.9.8.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
|
50
|
+
pywebexec-1.9.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|