pywebexec 1.9.7__py3-none-any.whl → 1.9.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
@@ -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):
@@ -99,6 +99,9 @@ form {
99
99
  vertical-align: bottom;
100
100
  padding-left: 35px;
101
101
  }
102
+ code {
103
+ font-family: "CommitMono Nerd Font Mono", Consolas, "Courier New", monospace;
104
+ }
102
105
  #paramsHelp {
103
106
  position: absolute;
104
107
  background-color: #e0e0ff;
@@ -126,9 +129,16 @@ form {
126
129
  td, th{
127
130
  margin: 0;
128
131
  padding: 4px 6px;
129
- border-bottom: 1px solid #aaa;
132
+ border-bottom: 1px solid #ccc;
133
+ }
134
+ ul, ol{
135
+ margin: 0;
136
+ padding: 0;
137
+ padding-left: 30px;
138
+ }
139
+ p {
140
+ margin-bottom: 4px;
130
141
  }
131
-
132
142
  th:last-child {
133
143
  border-top-right-radius: 10px;
134
144
  }
@@ -147,9 +157,14 @@ form {
147
157
  tr > td:last-child {
148
158
  border-right: 1px solid #aaa;
149
159
  }
150
- code {
151
- font-family: "CommitMono Nerd Font Mono", Consolas, "Courier New", monospace;
160
+ code, pre {
152
161
  font-size: 14px;
162
+ background-color: #d5d5fe;
163
+ }
164
+ pre {
165
+ padding: 5px 10px;
166
+ border-radius: 10px;
167
+ overflow-x: auto;
153
168
  }
154
169
  }
155
170
  #thStatus {
@@ -320,14 +335,6 @@ body.dimmed * {
320
335
  left: 50%;
321
336
  transform: translate(-50%, -50%);
322
337
  }
323
- /* allow wide chars in terminal */
324
- /*
325
- span {
326
- letter-spacing: 0px !important;
327
- margin-right: -0.17px;
328
- margin-left: -0.09px
329
- }
330
- */
331
338
  .slider-container {
332
339
  display: flex;
333
340
  align-items: center;
@@ -225,7 +225,7 @@ window.addEventListener('load', () => {
225
225
 
226
226
  async function fetchExecutables() {
227
227
  try {
228
- const response = await fetch(`/executables`);
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.executables.forEach(exeObj => {
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
@@ -190,7 +190,7 @@ paths:
190
190
  properties:
191
191
  message:
192
192
  type: string
193
- /executables:
193
+ /commands/exposed:
194
194
  get:
195
195
  summary: "List available executable commands"
196
196
  tags:
@@ -199,11 +199,11 @@ paths:
199
199
  - application/json
200
200
  responses:
201
201
  "200":
202
- description: "List of executables returned as an array of executable objects"
202
+ description: "List of commands with markdown help"
203
203
  schema:
204
204
  type: object
205
205
  properties:
206
- executables:
206
+ commands:
207
207
  type: array
208
208
  items:
209
209
  type: object
@@ -214,8 +214,8 @@ paths:
214
214
  type: string
215
215
  examples:
216
216
  application/json:
217
- executables:
217
+ commands:
218
218
  - command: ls
219
- help: "List directory contents\nparams:\n <ls_params>"
219
+ help: "List directory contents \n**params**:\n* `<ls_params>`"
220
220
  - command: cat
221
- help: "Concatenate and display files\nparams:\n <cat_params>"
221
+ help: "Concatenate and display files \n**params**:\n* `<cat_params>`"
pywebexec/version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '1.9.7'
21
- __version_tuple__ = version_tuple = (1, 9, 7)
20
+ __version__ = version = '1.9.9'
21
+ __version_tuple__ = version_tuple = (1, 9, 9)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: pywebexec
3
- Version: 1.9.7
3
+ Version: 1.9.9
4
4
  Summary: Simple Python HTTP Exec Server
5
5
  Home-page: https://github.com/joknarf/pywebexec
6
6
  Author: Franck Jouvanceau
@@ -207,24 +207,26 @@ The help message is displayed:
207
207
  * in the response when calling the API `/executables`
208
208
  * in the swagger-ui in the `/commands/<command>` route.
209
209
 
210
- <img src="https://github.com/user-attachments/assets/b51b14f7-c349-42ca-98c5-29f0cb5dd656" width="300"/>
210
+ <img src="https://github.com/user-attachments/assets/ecdeb890-5018-498f-872a-57dd4bf542cf" width="400"/>
211
211
 
212
212
  ## Swagger UI
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/60649510-4edb-4275-9339-181b451c603b" width="400"/>
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 | /executables | | executables: [<br>&nbsp;&nbsp;{command: str,help: str},<br>] |
223
+ | GET | /commands/exposed | | commands: [<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;command: str,<br>&nbsp;&nbsp;&nbsp;&nbsp;help: str<br>&nbsp;&nbsp;},<br>] |
224
224
  | GET | /commands | | commands: [<br>&nbsp;&nbsp;{<br>&nbsp;&nbsp;&nbsp;&nbsp;command_id: uuid<br>&nbsp;&nbsp;&nbsp;&nbsp;command: str<br>&nbsp;&nbsp;&nbsp;&nbsp;start_time: isotime<br>&nbsp;&nbsp;&nbsp;&nbsp;end_time: isotime<br>&nbsp;&nbsp;&nbsp;&nbsp;status: str<br>&nbsp;&nbsp;&nbsp;&nbsp;exit_code: int<br>&nbsp;&nbsp;&nbsp;&nbsp;last_output_line: str<br>&nbsp;&nbsp;},<br>] |
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 |
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
+
232
+ * to get command output as text (without ANSI codes/Control characters) use: `/commands/{id}/output` with header `"Accept: text/plain"`
@@ -1,9 +1,9 @@
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=Ow5vhzTfC74nFuA8Nc6JDjRPawegHIT046AHH55-8dE,37979
4
- pywebexec/swagger.yaml,sha256=NaJ0CVXqHJyJ0Vm4_WAZGruW1eEnTy5ctcKgWglucTk,5690
5
- pywebexec/version.py,sha256=T2LvI7xUHqs7nVg-NAymK8dr62YfyHOhBN3LG1nsnJg,511
6
- pywebexec/static/css/style.css,sha256=M2zqrDSolDUxeVVeJ0e6NMTMM8B4_LUEmG-lWQwtUoI,9530
3
+ pywebexec/pywebexec.py,sha256=SU-iD3FQIyWsw0-iGjM2P8INpBW9JhzZ1lI3Y50Fwqk,37983
4
+ pywebexec/swagger.yaml,sha256=pGG4ikpASgBnzoZ44jJJ8l5JrNz7GOBpCakSJta-30c,5676
5
+ pywebexec/version.py,sha256=qOm1uilBcYzlcy6ghcmqbDb5vPaWJKJYDFCEytaVpSE,511
6
+ pywebexec/static/css/style.css,sha256=Le69gWTGbSh7TOERegKvKnqYUy1LC-XLifrPPxoXeCs,9661
7
7
  pywebexec/static/css/xterm.css,sha256=uo5phWaUiJgcz0DAzv46uoByLLbJLeetYosL1xf68rY,5559
8
8
  pywebexec/static/fonts/CommitMonoNerdFontMono-Regular.ttf,sha256=v6nZdSx5cs_TIic8Fujrjzg9u9glWjorDIr7RlwNceM,2370228
9
9
  pywebexec/static/fonts/LICENSE,sha256=gsBdbFPfoMkCWYXBnjcYEAILdO0sYdUdNw8qirJQbVI,4395
@@ -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=Dalcybfllp1GdZT6WCfQ96U4GAwZ0Aqiv4_LfhOeP3Y,9471
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.7.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
46
- pywebexec-1.9.7.dist-info/METADATA,sha256=O9oN7etjVy1paNdug5tmWq10kiSAa31v-IH2kvt9FV0,9450
47
- pywebexec-1.9.7.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
48
- pywebexec-1.9.7.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
49
- pywebexec-1.9.7.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
50
- pywebexec-1.9.7.dist-info/RECORD,,
45
+ pywebexec-1.9.9.dist-info/LICENSE,sha256=gRJf0JPT_wsZJsUGlWPTS8Vypfl9vQ1qjp6sNbKykuA,1064
46
+ pywebexec-1.9.9.dist-info/METADATA,sha256=unYofKfmomCtcJjzH0DX3v6IAzOqNujP7BN1Rmt-anc,9684
47
+ pywebexec-1.9.9.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
48
+ pywebexec-1.9.9.dist-info/entry_points.txt,sha256=l52GBkPCXRkmlHfEyoVauyfBdg8o-CAtC8qQpOIjJK0,55
49
+ pywebexec-1.9.9.dist-info/top_level.txt,sha256=vHoHyzngrfGdm_nM7Xn_5iLmaCrf10XO1EhldgNLEQ8,10
50
+ pywebexec-1.9.9.dist-info/RECORD,,