Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions opengeodeweb_back_schemas.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,6 @@
"required": [],
"additionalProperties": false
},
"import_extension": {
"$id": "opengeodeweb_back/import_extension",
"route": "/import_extension",
"methods": [
"POST"
],
"type": "object",
"properties": {},
"required": [],
"additionalProperties": false
},
"geographic_coordinate_systems": {
"$id": "opengeodeweb_back/geographic_coordinate_systems",
"route": "/geographic_coordinate_systems",
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,3 @@ werkzeug==3.1.2
# flask
# flask-cors

opengeodeweb-microservice==1.*,>=1.0.16
70 changes: 0 additions & 70 deletions src/opengeodeweb_back/routes/blueprint_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,76 +535,6 @@ def import_project() -> flask.Response:
return flask.make_response({"snapshot": snapshot}, 200)


@routes.route(
schemas_dict["import_extension"]["route"],
methods=schemas_dict["import_extension"]["methods"],
)
def import_extension() -> flask.Response:
"""Import a .vext extension file and extract its contents."""
utils_functions.validate_request(flask.request, schemas_dict["import_extension"])

if "file" not in flask.request.files:
flask.abort(400, "No .vext file provided under 'file'")

vext_file = flask.request.files["file"]
assert vext_file.filename is not None
filename = werkzeug.utils.secure_filename(os.path.basename(vext_file.filename))

if not filename.lower().endswith(".vext"):
flask.abort(400, "Uploaded file must be a .vext")

# Create extensions directory in the data folder
extensions_folder = flask.current_app.config["EXTENSIONS_FOLDER_PATH"]
os.makedirs(extensions_folder, exist_ok=True)

extension_name = (
filename.rsplit("-", 1)[0] if "-" in filename else filename.replace(".vext", "")
)
extension_path = os.path.join(extensions_folder, extension_name)

# Remove existing extension if present
if os.path.exists(extension_path):
shutil.rmtree(extension_path)

os.makedirs(extension_path, exist_ok=True)

# Extract the .vext file
vext_file.stream.seek(0)
with zipfile.ZipFile(vext_file.stream) as zip_archive:
zip_archive.extractall(extension_path)

# Look for the backend executable and frontend JS
backend_executable = None
frontend_file = None

for file in os.listdir(extension_path):
file_path = os.path.join(extension_path, file)
if os.path.isfile(file_path):
if file.endswith(".es.js"):
frontend_file = file_path
elif not file.endswith(".js") and not file.endswith(".css"):
backend_executable = file_path
os.chmod(backend_executable, 0o755)

if not frontend_file:
flask.abort(400, "Invalid .vext file: missing frontend JavaScript")
if not backend_executable:
flask.abort(400, "Invalid .vext file: missing backend executable")

assert frontend_file is not None
with open(frontend_file, "r", encoding="utf-8") as f:
frontend_content = f.read()

return flask.make_response(
{
"extension_name": extension_name,
"frontend_content": frontend_content,
"backend_path": backend_executable,
},
200,
)


@routes.route(
schemas_dict["geode_object_inheritance"]["route"],
methods=schemas_dict["geode_object_inheritance"]["methods"],
Expand Down
1 change: 0 additions & 1 deletion src/opengeodeweb_back/routes/schemas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from .kill import *
from .inspect_file import *
from .import_project import *
from .import_extension import *
from .geographic_coordinate_systems import *
from .geode_objects_and_output_extensions import *
from .geode_object_inheritance import *
Expand Down
10 changes: 0 additions & 10 deletions src/opengeodeweb_back/routes/schemas/import_extension.json

This file was deleted.

10 changes: 0 additions & 10 deletions src/opengeodeweb_back/routes/schemas/import_extension.py

This file was deleted.

Loading