jvserve 2.0.11__py3-none-any.whl → 2.0.12__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.
Potentially problematic release.
This version of jvserve might be problematic. Click here for more details.
- jvserve/__init__.py +1 -1
- jvserve/cli.py +37 -16
- {jvserve-2.0.11.dist-info → jvserve-2.0.12.dist-info}/METADATA +1 -1
- jvserve-2.0.12.dist-info/RECORD +13 -0
- {jvserve-2.0.11.dist-info → jvserve-2.0.12.dist-info}/WHEEL +1 -1
- jvserve-2.0.11.dist-info/RECORD +0 -13
- {jvserve-2.0.11.dist-info → jvserve-2.0.12.dist-info}/entry_points.txt +0 -0
- {jvserve-2.0.11.dist-info → jvserve-2.0.12.dist-info}/licenses/LICENSE +0 -0
- {jvserve-2.0.11.dist-info → jvserve-2.0.12.dist-info}/top_level.txt +0 -0
jvserve/__init__.py
CHANGED
jvserve/cli.py
CHANGED
|
@@ -176,7 +176,7 @@ class JacCmd:
|
|
|
176
176
|
def jvfileserve(
|
|
177
177
|
directory: str, host: str = "0.0.0.0", port: int = 9000
|
|
178
178
|
) -> None:
|
|
179
|
-
"""Launch the file server."""
|
|
179
|
+
"""Launch the file server for local files."""
|
|
180
180
|
# load FastAPI
|
|
181
181
|
from fastapi import FastAPI
|
|
182
182
|
from fastapi.middleware.cors import CORSMiddleware
|
|
@@ -194,21 +194,45 @@ class JacCmd:
|
|
|
194
194
|
allow_headers=["*"],
|
|
195
195
|
)
|
|
196
196
|
|
|
197
|
-
if
|
|
198
|
-
|
|
199
|
-
os.environ["JIVAS_FILES_ROOT_PATH"] = directory
|
|
197
|
+
if not os.path.exists(directory):
|
|
198
|
+
os.makedirs(directory)
|
|
200
199
|
|
|
201
|
-
|
|
202
|
-
|
|
200
|
+
# Set the environment variable for the file root path
|
|
201
|
+
os.environ["JIVAS_FILES_ROOT_PATH"] = directory
|
|
203
202
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
203
|
+
# Mount the static files directory
|
|
204
|
+
app.mount(
|
|
205
|
+
"/files",
|
|
206
|
+
StaticFiles(directory=directory),
|
|
207
|
+
name="files",
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
# run the app
|
|
211
|
+
_run(app, host=host, port=port)
|
|
212
|
+
|
|
213
|
+
@cmd_registry.register
|
|
214
|
+
def jvproxyserve(
|
|
215
|
+
directory: str, host: str = "0.0.0.0", port: int = 9000
|
|
216
|
+
) -> None:
|
|
217
|
+
"""Launch the file proxy server for remote files."""
|
|
218
|
+
# load FastAPI
|
|
219
|
+
from bson import ObjectId
|
|
220
|
+
from fastapi import FastAPI, HTTPException
|
|
221
|
+
from fastapi.middleware.cors import CORSMiddleware
|
|
222
|
+
|
|
223
|
+
# Setup custom routes
|
|
224
|
+
app = FastAPI()
|
|
225
|
+
|
|
226
|
+
# Add CORS middleware
|
|
227
|
+
app.add_middleware(
|
|
228
|
+
CORSMiddleware,
|
|
229
|
+
allow_origins=["*"],
|
|
230
|
+
allow_credentials=True,
|
|
231
|
+
allow_methods=["*"],
|
|
232
|
+
allow_headers=["*"],
|
|
233
|
+
)
|
|
211
234
|
|
|
235
|
+
# Add proxy routes only if using S3
|
|
212
236
|
if FILE_INTERFACE == "s3":
|
|
213
237
|
|
|
214
238
|
@app.get("/files/{file_path:path}", response_model=None)
|
|
@@ -221,9 +245,6 @@ class JacCmd:
|
|
|
221
245
|
async def get_proxied_file(
|
|
222
246
|
file_id: str,
|
|
223
247
|
) -> Response:
|
|
224
|
-
from bson import ObjectId
|
|
225
|
-
from fastapi import HTTPException
|
|
226
|
-
|
|
227
248
|
params = file_id.split("/")
|
|
228
249
|
object_id = params[0]
|
|
229
250
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
jvserve/__init__.py,sha256=hT0e0Ny1xLqK83tJ8AFjLfpMvrs5MB9of01udMpC4Cw,191
|
|
2
|
+
jvserve/cli.py,sha256=uWUfujG-YX-jXiGWeMo66d4p3f1Aix7zfNTr7xwUqqk,8380
|
|
3
|
+
jvserve/lib/__init__.py,sha256=cnzfSHLoTWG9Ygut2nOpDys5aPlQz-m0BSkB-nd7OMs,31
|
|
4
|
+
jvserve/lib/agent_interface.py,sha256=vGJQ9A_9kWfa6YoW7BiidZO6Huf-0XSlunMLMNGqgws,31053
|
|
5
|
+
jvserve/lib/agent_pulse.py,sha256=6hBF6KQYr6Z9Mi_yoWKGfdnW7gg84kK20Slu-bLR_m8,2067
|
|
6
|
+
jvserve/lib/file_interface.py,sha256=sqwTmBnZsVFQUGt7mE1EWA-jHnZlRtBAFeb4Rb_QgQ8,6079
|
|
7
|
+
jvserve/lib/jvlogger.py,sha256=RNiB9PHuBzTvNIQWhxoDgrDlNYA0PYm1SVpvzlqu8mE,4180
|
|
8
|
+
jvserve-2.0.12.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
9
|
+
jvserve-2.0.12.dist-info/METADATA,sha256=QySsRhK1sCoAVIfVvH_a29JrXShLRLId_kmqBM1pGo8,4791
|
|
10
|
+
jvserve-2.0.12.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
|
11
|
+
jvserve-2.0.12.dist-info/entry_points.txt,sha256=HYyg1QXoLs0JRb004L300VeLOZyDLY27ynD1tnTnEN4,35
|
|
12
|
+
jvserve-2.0.12.dist-info/top_level.txt,sha256=afoCXZv-zXNBuhVIvfJGjafXKEiJl_ooy4BtgQwAG4Q,8
|
|
13
|
+
jvserve-2.0.12.dist-info/RECORD,,
|
jvserve-2.0.11.dist-info/RECORD
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
jvserve/__init__.py,sha256=sJ_mBKN30rjktWYox9bigWcSsNjhSIbEq-EWFvhYAAc,191
|
|
2
|
-
jvserve/cli.py,sha256=ptbu2_u6fZHXyIPPYRt5xKJL_l0OVhq8hETGkAGuvqk,7699
|
|
3
|
-
jvserve/lib/__init__.py,sha256=cnzfSHLoTWG9Ygut2nOpDys5aPlQz-m0BSkB-nd7OMs,31
|
|
4
|
-
jvserve/lib/agent_interface.py,sha256=vGJQ9A_9kWfa6YoW7BiidZO6Huf-0XSlunMLMNGqgws,31053
|
|
5
|
-
jvserve/lib/agent_pulse.py,sha256=6hBF6KQYr6Z9Mi_yoWKGfdnW7gg84kK20Slu-bLR_m8,2067
|
|
6
|
-
jvserve/lib/file_interface.py,sha256=sqwTmBnZsVFQUGt7mE1EWA-jHnZlRtBAFeb4Rb_QgQ8,6079
|
|
7
|
-
jvserve/lib/jvlogger.py,sha256=RNiB9PHuBzTvNIQWhxoDgrDlNYA0PYm1SVpvzlqu8mE,4180
|
|
8
|
-
jvserve-2.0.11.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
9
|
-
jvserve-2.0.11.dist-info/METADATA,sha256=avBB2xIYh266s2UxgR9MF3hVK4dUzWBxgYPJr0Fn2qc,4791
|
|
10
|
-
jvserve-2.0.11.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
|
11
|
-
jvserve-2.0.11.dist-info/entry_points.txt,sha256=HYyg1QXoLs0JRb004L300VeLOZyDLY27ynD1tnTnEN4,35
|
|
12
|
-
jvserve-2.0.11.dist-info/top_level.txt,sha256=afoCXZv-zXNBuhVIvfJGjafXKEiJl_ooy4BtgQwAG4Q,8
|
|
13
|
-
jvserve-2.0.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|