@@ -2072,25 +2058,9 @@ var mv = (function () {
`;
}
$("#liste_applications").append(applications);
- // can't delete all with Python backend
- // delete all is available with first PHP backend only
- if (_conf.is_php) {
- document.querySelector("#deleteAllBtn").classList.remove("d-none");
- } else {
- document.querySelector("#deleteAllBtn").classList.add("d-none");
- }
},
getListeApplications(search = "") {
- // default python backend
- let url = `${_conf.api}?search=${search}`;
- // if backend is PHP
- if (_conf?.is_php && _conf?.php?.list_service) {
- if (document.querySelector("#searchBydescriptionInput")) {
- document.querySelector("#searchBydescriptionInput").remove();
- }
- // use php url file
- url = _conf.php.list_service;
- }
+ const url = `${_conf.api}?search=${search}`;
fetch(url)
.then((r) => (r.ok ? r.json() : Promise.reject(r)))
.catch((detail) => {
@@ -2806,12 +2776,6 @@ var mv = (function () {
}
},
openTemplateGenerator: () => {
- // not compliant with php backend
- if (_conf?.is_php) {
- liTemplateArea.classList.add("d-none");
- dismissTemplateGeneratorMsg.classList.remove("d-none");
- return;
- }
if (mv.templateGenerator) {
mv.destroyTemplateGenerator();
}
diff --git a/lib/ogc.js b/src/static/lib/ogc.js
similarity index 100%
rename from lib/ogc.js
rename to src/static/lib/ogc.js
diff --git a/lib/openlayers/7.1/ol.css b/src/static/lib/openlayers/7.1/ol.css
similarity index 100%
rename from lib/openlayers/7.1/ol.css
rename to src/static/lib/openlayers/7.1/ol.css
diff --git a/lib/openlayers/7.1/ol.js b/src/static/lib/openlayers/7.1/ol.js
similarity index 100%
rename from lib/openlayers/7.1/ol.js
rename to src/static/lib/openlayers/7.1/ol.js
diff --git a/lib/openlayers/7.1/ol.js.map b/src/static/lib/openlayers/7.1/ol.js.map
similarity index 100%
rename from lib/openlayers/7.1/ol.js.map
rename to src/static/lib/openlayers/7.1/ol.js.map
diff --git a/lib/slug.js b/src/static/lib/slug.js
similarity index 100%
rename from lib/slug.js
rename to src/static/lib/slug.js
diff --git a/lib/template-generator/ComponentsSelector.js b/src/static/lib/template-generator/ComponentsSelector.js
similarity index 100%
rename from lib/template-generator/ComponentsSelector.js
rename to src/static/lib/template-generator/ComponentsSelector.js
diff --git a/lib/template-generator/README.md b/src/static/lib/template-generator/README.md
similarity index 100%
rename from lib/template-generator/README.md
rename to src/static/lib/template-generator/README.md
diff --git a/lib/template-generator/TemplateGenerator.js b/src/static/lib/template-generator/TemplateGenerator.js
similarity index 100%
rename from lib/template-generator/TemplateGenerator.js
rename to src/static/lib/template-generator/TemplateGenerator.js
diff --git a/lib/template-generator/components/content/BottomPanelLocation.js b/src/static/lib/template-generator/components/content/BottomPanelLocation.js
similarity index 100%
rename from lib/template-generator/components/content/BottomPanelLocation.js
rename to src/static/lib/template-generator/components/content/BottomPanelLocation.js
diff --git a/lib/template-generator/components/content/RightPanelLocation.js b/src/static/lib/template-generator/components/content/RightPanelLocation.js
similarity index 100%
rename from lib/template-generator/components/content/RightPanelLocation.js
rename to src/static/lib/template-generator/components/content/RightPanelLocation.js
diff --git a/lib/template-generator/components/forms/ColorSelector.js b/src/static/lib/template-generator/components/forms/ColorSelector.js
similarity index 100%
rename from lib/template-generator/components/forms/ColorSelector.js
rename to src/static/lib/template-generator/components/forms/ColorSelector.js
diff --git a/lib/template-generator/components/forms/IconSelector.js b/src/static/lib/template-generator/components/forms/IconSelector.js
similarity index 100%
rename from lib/template-generator/components/forms/IconSelector.js
rename to src/static/lib/template-generator/components/forms/IconSelector.js
diff --git a/lib/template-generator/components/forms/InputFieldListComponent.js b/src/static/lib/template-generator/components/forms/InputFieldListComponent.js
similarity index 100%
rename from lib/template-generator/components/forms/InputFieldListComponent.js
rename to src/static/lib/template-generator/components/forms/InputFieldListComponent.js
diff --git a/lib/template-generator/components/forms/InputFieldValueComponent.js b/src/static/lib/template-generator/components/forms/InputFieldValueComponent.js
similarity index 100%
rename from lib/template-generator/components/forms/InputFieldValueComponent.js
rename to src/static/lib/template-generator/components/forms/InputFieldValueComponent.js
diff --git a/lib/template-generator/components/forms/InputStaticValueComponent.js b/src/static/lib/template-generator/components/forms/InputStaticValueComponent.js
similarity index 100%
rename from lib/template-generator/components/forms/InputStaticValueComponent.js
rename to src/static/lib/template-generator/components/forms/InputStaticValueComponent.js
diff --git a/lib/template-generator/components/forms/InputTagsComponent.js b/src/static/lib/template-generator/components/forms/InputTagsComponent.js
similarity index 100%
rename from lib/template-generator/components/forms/InputTagsComponent.js
rename to src/static/lib/template-generator/components/forms/InputTagsComponent.js
diff --git a/lib/template-generator/components/forms/InputTextComponent.js b/src/static/lib/template-generator/components/forms/InputTextComponent.js
similarity index 100%
rename from lib/template-generator/components/forms/InputTextComponent.js
rename to src/static/lib/template-generator/components/forms/InputTextComponent.js
diff --git a/lib/template-generator/components/forms/StyleCustom.js b/src/static/lib/template-generator/components/forms/StyleCustom.js
similarity index 100%
rename from lib/template-generator/components/forms/StyleCustom.js
rename to src/static/lib/template-generator/components/forms/StyleCustom.js
diff --git a/lib/template-generator/components/forms/TextArea.js b/src/static/lib/template-generator/components/forms/TextArea.js
similarity index 100%
rename from lib/template-generator/components/forms/TextArea.js
rename to src/static/lib/template-generator/components/forms/TextArea.js
diff --git a/lib/template-generator/components/forms/TypeFieldSelector.js b/src/static/lib/template-generator/components/forms/TypeFieldSelector.js
similarity index 100%
rename from lib/template-generator/components/forms/TypeFieldSelector.js
rename to src/static/lib/template-generator/components/forms/TypeFieldSelector.js
diff --git a/lib/template-generator/components/forms/tags.js b/src/static/lib/template-generator/components/forms/tags.js
similarity index 100%
rename from lib/template-generator/components/forms/tags.js
rename to src/static/lib/template-generator/components/forms/tags.js
diff --git a/lib/template-generator/components/library/ButtonComponent.js b/src/static/lib/template-generator/components/library/ButtonComponent.js
similarity index 100%
rename from lib/template-generator/components/library/ButtonComponent.js
rename to src/static/lib/template-generator/components/library/ButtonComponent.js
diff --git a/lib/template-generator/components/library/FreeComponent.js b/src/static/lib/template-generator/components/library/FreeComponent.js
similarity index 100%
rename from lib/template-generator/components/library/FreeComponent.js
rename to src/static/lib/template-generator/components/library/FreeComponent.js
diff --git a/lib/template-generator/components/library/IframeComponent.js b/src/static/lib/template-generator/components/library/IframeComponent.js
similarity index 100%
rename from lib/template-generator/components/library/IframeComponent.js
rename to src/static/lib/template-generator/components/library/IframeComponent.js
diff --git a/lib/template-generator/components/library/ImageComponent.js b/src/static/lib/template-generator/components/library/ImageComponent.js
similarity index 100%
rename from lib/template-generator/components/library/ImageComponent.js
rename to src/static/lib/template-generator/components/library/ImageComponent.js
diff --git a/lib/template-generator/components/library/ListComponent.js b/src/static/lib/template-generator/components/library/ListComponent.js
similarity index 100%
rename from lib/template-generator/components/library/ListComponent.js
rename to src/static/lib/template-generator/components/library/ListComponent.js
diff --git a/lib/template-generator/components/library/NumbersComponent.js b/src/static/lib/template-generator/components/library/NumbersComponent.js
similarity index 100%
rename from lib/template-generator/components/library/NumbersComponent.js
rename to src/static/lib/template-generator/components/library/NumbersComponent.js
diff --git a/lib/template-generator/components/library/TemplateComponent.js b/src/static/lib/template-generator/components/library/TemplateComponent.js
similarity index 100%
rename from lib/template-generator/components/library/TemplateComponent.js
rename to src/static/lib/template-generator/components/library/TemplateComponent.js
diff --git a/lib/template-generator/components/library/TextComponent.js b/src/static/lib/template-generator/components/library/TextComponent.js
similarity index 100%
rename from lib/template-generator/components/library/TextComponent.js
rename to src/static/lib/template-generator/components/library/TextComponent.js
diff --git a/lib/template-generator/components/library/TextH1Component.js b/src/static/lib/template-generator/components/library/TextH1Component.js
similarity index 100%
rename from lib/template-generator/components/library/TextH1Component.js
rename to src/static/lib/template-generator/components/library/TextH1Component.js
diff --git a/lib/template-generator/components/library/TextH3Component.js b/src/static/lib/template-generator/components/library/TextH3Component.js
similarity index 100%
rename from lib/template-generator/components/library/TextH3Component.js
rename to src/static/lib/template-generator/components/library/TextH3Component.js
diff --git a/lib/template-generator/main.js b/src/static/lib/template-generator/main.js
similarity index 100%
rename from lib/template-generator/main.js
rename to src/static/lib/template-generator/main.js
diff --git a/lib/template-generator/style.css b/src/static/lib/template-generator/style.css
similarity index 100%
rename from lib/template-generator/style.css
rename to src/static/lib/template-generator/style.css
diff --git a/lib/template-generator/utils.js b/src/static/lib/template-generator/utils.js
similarity index 100%
rename from lib/template-generator/utils.js
rename to src/static/lib/template-generator/utils.js
diff --git a/mviewerstudio.i18n.json b/src/static/mviewerstudio.i18n.json
similarity index 99%
rename from mviewerstudio.i18n.json
rename to src/static/mviewerstudio.i18n.json
index 926cadb9..af64c3d7 100644
--- a/mviewerstudio.i18n.json
+++ b/src/static/mviewerstudio.i18n.json
@@ -236,7 +236,6 @@
"modal.layer.customtemplate.create": "Créer",
"modal.layer.customtemplate.new": "Créer une fiche d'information personnalisée",
"modal.layer.customtemplate.subtitle": "Sélectionner les champs à afficher et leurs aspects",
- "modal.layer.customtemplate.phpmsg": "Le générateur de template n'est pas disponible. Veuillez contacter un administrateur.",
"modal.layer.featurecount": "Limitation du nombre de réponses",
"modal.layer.featurecount.ph": "Nombre max d'entités retournées",
"modal.layer.query.useexternaltemplate": "Utiliser un template externe",
@@ -938,7 +937,6 @@
"modal.layer.displayoptions.title": "Display options",
"modal.layer.customtemplate.create": "Create",
"modal.layer.customtemplate.new": "Create a personalised information sheet",
- "modal.layer.customtemplate.phpmsg": "The template generator is not available. Please contact an administrator.",
"template.text.color": "Text color",
"template.bg.color": "Background color",
"template.input.static.ph": "Input value...",
diff --git a/src/static/package.json b/src/static/package.json
new file mode 100644
index 00000000..2e3a0223
--- /dev/null
+++ b/src/static/package.json
@@ -0,0 +1,27 @@
+{
+ "name": "mviewerstudio",
+ "version": "4.0.0",
+ "description": "mviewerstudio",
+ "main": "index.html",
+ "directories": {
+ "doc": "docs",
+ "lib": "lib"
+ },
+ "scripts": {
+ "pretty": "prettier --write \"./mviewerstudio.i18n.json\" \"./js/**/*.{js,json}\" \"./lib/mv.js\"",
+ "prettier-check": "prettier --check \"./mviewerstudio.i18n.json\" \"./js/**/*.{js,json}\" \"./lib/mv.js\""
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/mviewer/mviewerstudio.git"
+ },
+ "author": "psc mviewer",
+ "license": "GPLv3",
+ "bugs": {
+ "url": "https://github.com/mviewer/mviewerstudio/issues"
+ },
+ "homepage": "https://github.com/mviewer/mviewerstudio#readme",
+ "devDependencies": {
+ "prettier": "^3.0.3"
+ }
+}
diff --git a/srv/python/mviewerstudio_backend/swagger.yaml b/src/swagger.yaml
similarity index 100%
rename from srv/python/mviewerstudio_backend/swagger.yaml
rename to src/swagger.yaml
diff --git a/srv/python/mviewerstudio_backend/test.py b/src/test.py
similarity index 100%
rename from srv/python/mviewerstudio_backend/test.py
rename to src/test.py
diff --git a/src/utils/__pycache__/commons.cpython-312.pyc b/src/utils/__pycache__/commons.cpython-312.pyc
new file mode 100644
index 00000000..ecb29ab9
Binary files /dev/null and b/src/utils/__pycache__/commons.cpython-312.pyc differ
diff --git a/src/utils/__pycache__/config_utils.cpython-312.pyc b/src/utils/__pycache__/config_utils.cpython-312.pyc
new file mode 100644
index 00000000..d7800a50
Binary files /dev/null and b/src/utils/__pycache__/config_utils.cpython-312.pyc differ
diff --git a/src/utils/__pycache__/git_utils.cpython-312.pyc b/src/utils/__pycache__/git_utils.cpython-312.pyc
new file mode 100644
index 00000000..04176c71
Binary files /dev/null and b/src/utils/__pycache__/git_utils.cpython-312.pyc differ
diff --git a/src/utils/__pycache__/login_utils.cpython-312.pyc b/src/utils/__pycache__/login_utils.cpython-312.pyc
new file mode 100644
index 00000000..57682d59
Binary files /dev/null and b/src/utils/__pycache__/login_utils.cpython-312.pyc differ
diff --git a/src/utils/__pycache__/register_utils.cpython-312.pyc b/src/utils/__pycache__/register_utils.cpython-312.pyc
new file mode 100644
index 00000000..aa635583
Binary files /dev/null and b/src/utils/__pycache__/register_utils.cpython-312.pyc differ
diff --git a/srv/python/mviewerstudio_backend/utils/commons.py b/src/utils/commons.py
similarity index 90%
rename from srv/python/mviewerstudio_backend/utils/commons.py
rename to src/utils/commons.py
index f82a48de..7c5b1428 100644
--- a/srv/python/mviewerstudio_backend/utils/commons.py
+++ b/src/utils/commons.py
@@ -94,10 +94,9 @@ def create_zip(dir, name):
def custom_make_archive(source, destination):
- base = path.basename(destination)
- name = base.split(".")[0]
- format = base.split(".")[1]
+ base_name, ext = path.splitext(destination)
+ archive_format = ext.lstrip(".")
archive_from = path.dirname(source)
- archive_to = path.basename(source.strip(sep))
- make_archive(name, format, archive_from, archive_to)
- move("%s.%s" % (name, format), destination)
+ archive_to = path.basename(source.rstrip(sep))
+
+ make_archive(base_name, archive_format, archive_from, archive_to)
diff --git a/srv/python/mviewerstudio_backend/utils/config_utils.py b/src/utils/config_utils.py
similarity index 100%
rename from srv/python/mviewerstudio_backend/utils/config_utils.py
rename to src/utils/config_utils.py
diff --git a/srv/python/mviewerstudio_backend/utils/git_utils.py b/src/utils/git_utils.py
similarity index 100%
rename from srv/python/mviewerstudio_backend/utils/git_utils.py
rename to src/utils/git_utils.py
diff --git a/srv/python/mviewerstudio_backend/utils/login_utils.py b/src/utils/login_utils.py
similarity index 100%
rename from srv/python/mviewerstudio_backend/utils/login_utils.py
rename to src/utils/login_utils.py
diff --git a/srv/python/mviewerstudio_backend/utils/register_utils.py b/src/utils/register_utils.py
similarity index 100%
rename from srv/python/mviewerstudio_backend/utils/register_utils.py
rename to src/utils/register_utils.py
diff --git a/srv/README.md b/srv/README.md
deleted file mode 100644
index 874648cf..00000000
--- a/srv/README.md
+++ /dev/null
@@ -1,77 +0,0 @@
- ### user_info.php
-
-Ce service retourne les informations liées à l'utilisateur connecté. Il sert d'intermédiaire entre un backend spécifique gérant l'authentification et mviewerstudio
-
-**Propriétés**
- | Method | Parameter | Content-Type |
-| --- | --- | --- |
-| GET | - | `application/json`
-
-**Exemple de réponse**
-
-Selon mviewerstudio.js, on devrait avoir :
-
- {
- "first_name": "",
- "last_name":"",
- "user_groups": [{"full_name":""}]
- }
-
- A la place, nous avons :
-
- {
- "first_name": "",
- "last_name":"",
- "organisation": {"legal_name":""}
- }
-
-
-### srv/list.php
-Ce service retourne la liste des applications (config.xml) créées par l'utilisateur courant (utlisateur connecté ou anonymous)
-
-**Propriétés**
- | Method | Parameter | Content-Type |
-| --- | --- | --- |
-| GET | - | `application/json`
-
-**Exemple de réponse**
-
- [{
- "url":"apps/store/f212c672d9e3968e39cffad5caf26426.xml",
- "creator":"anonymous",
- "date":"2020-02-18T14:42:35.667Z",
- "title":"Démo GéoBretagne",
- "subjects":["Randonnée","Supervision"]
- }]
-
-
-
-### srv/store.php
-Enregistrement d'un fichier de configuration pour l'utilisateur courant
-
-**Propriétés**
- | Method | Parameter | Content-Type |
-| --- | --- | --- |
-| POST | config.xml | `application/json`
-
-**Exemple de réponse**
-
- {
- "success":true,
- "filepath":"06c143f8760b2392a1637c8dd3c6aef2.xml"
- }
-
-
-### srv/delete.php
-Supprime toutes les applications de l'utilisateur connecté
-
-**Propriétés**
- | Method | Parameter | Content-Type |
-| --- | --- | --- |
-| GET | - | `application/json`
-
-**Exemple de réponse**
-
- {
- "deleted_files": 13
- }
diff --git a/srv/php/delete.php b/srv/php/delete.php
deleted file mode 100644
index 3e57c000..00000000
--- a/srv/php/delete.php
+++ /dev/null
@@ -1,29 +0,0 @@
- $counter));
-}
-?>
diff --git a/srv/php/list.php b/srv/php/list.php
deleted file mode 100644
index c8c23edb..00000000
--- a/srv/php/list.php
+++ /dev/null
@@ -1,40 +0,0 @@
- !empty($url) ? $url : '',
- "creator" => !empty($description["creator"]) ? $description["creator"] : '',
- "date" => !empty($description["date"]) ? $description["date"] : '',
- "title" => !empty($description["title"]) ? $description["title"] : '',
- "subjects" => !empty($description["subject"]) ? $description["subject"] : '',
- );
- array_push( $data , $metadata);
- }
- }
-
- }
-
- header('Content-type: application/json',true);
- echo json_encode($data);
-
-}
-?>
diff --git a/srv/php/store.php b/srv/php/store.php
deleted file mode 100755
index 2b7ccffd..00000000
--- a/srv/php/store.php
+++ /dev/null
@@ -1,13 +0,0 @@
-
diff --git a/srv/php/store/style.php b/srv/php/store/style.php
deleted file mode 100644
index 351c018b..00000000
--- a/srv/php/store/style.php
+++ /dev/null
@@ -1,13 +0,0 @@
-
\ No newline at end of file
diff --git a/srv/php/user_info.php b/srv/php/user_info.php
deleted file mode 100644
index d2900932..00000000
--- a/srv/php/user_info.php
+++ /dev/null
@@ -1,6 +0,0 @@
-
\ No newline at end of file
diff --git a/srv/php/who.php b/srv/php/who.php
deleted file mode 100644
index 5f70cead..00000000
--- a/srv/php/who.php
+++ /dev/null
@@ -1,46 +0,0 @@
- $value) {
- if (substr($name, 0, 5) == "HTTP_") {
- $headers[str_replace(" ", "-", ucwords(strtolower(str_replace("_", " ", substr($name, 5)))))] = $value;
- }
- }
- return $headers;
- }
-}
-
-function getUser() {
- $user = "anonymous";
- foreach (getallheaders() as $name => $value) {
- if (substr( $name, 0, 4 ) === "sec-") {
- if ($name === "sec-username") {
- $user=$value;
- }
- }
- }
- return $user;
-}
-
-function getUserInfos() {
- $firstname = "";
- $lastname = "";
- $orgname = "";
- foreach (getallheaders() as $name => $value) {
- if (substr( $name, 0, 4 ) === "sec-") {
- if ($name === "sec-firstname") {
- $firstname=utf8_encode($value);
- }
- if ($name === "sec-lastname") {
- $lastname=utf8_encode($value);
- }
- if ($name === "sec-orgname") {
- $orgname=utf8_encode($value);
- }
-
- }
- }
- return array( $firstname, $lastname, $orgname );
-}
diff --git a/srv/python/install_backend_python.sh b/srv/python/install_backend_python.sh
deleted file mode 100644
index 16170dca..00000000
--- a/srv/python/install_backend_python.sh
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/bash
-
-#==========================================================================================
-# Script name : install_backend_python.sh
-# Autor : PSC mviewer
-# Description : This script ease mviewerstudio install
-# Usage : ./install_backend_python.sh [parent_directory] [branch] [directory_name]
-# Documentation : https://mviewerstudio.readthedocs.io/fr/stable/doc_tech/install_python.html
-#==========================================================================================
-
-# Install required packages
-apt install libxslt1-dev libxml2-dev python3 python3-pip python3-venv
-pip install virtualenv
-
-# FULL PATH - WILL CLONE REPO TO THIS LOCATION
-# EX : /home/
/git
-WORKING_PATH="$1"
-
-# To use a specific branch - will use master if no set
-BRANCH="$2"
-
-MVIEWERSTUDIO_DIR="$3"
-
-# Adapt this repo URL to get source from your own Git space
-REPO_URL="https://github.com/mviewer/mviewerstudio.git"
-
-# use default mviewerstudio dir name if not set from param
-if [ -z "${MVIEWERSTUDIO_DIR}" ]; then
- MVIEWERSTUDIO_DIR="mviewerstudio"
-fi
-
-# custom install path
-if [ "${WORKING_PATH}" ]; then
- cd "${WORKING_PATH}"
- MVIEWERSTUDIO_DIR="${WORKING_PATH}/${MVIEWERSTUDIO_DIR}"
-else
- MVIEWERSTUDIO_DIR="$(pwd)/${MVIEWERSTUDIO_DIR}"
-fi
-
-STATIC_DIR="${MVIEWERSTUDIO_DIR}/srv/python/mviewerstudio_backend/static"
-
-# Clone repo and change branch if needed
-
-if [ ! -d "${MVIEWERSTUDIO_DIR}" ]; then
- git clone "${REPO_URL}" "${MVIEWERSTUDIO_DIR}"
- if [ "${BRANCH}" ]; then
- cd "${MVIEWERSTUDIO_DIR}"
- git checkout "${BRANCH}"
- fi
-fi
-
-# Copy front resources
-
-mkdir -p "${MVIEWERSTUDIO_DIR}/srv/python/mviewerstudio_backend/static/apps"
-cp -r "${MVIEWERSTUDIO_DIR}/css" "${STATIC_DIR}"
-cp -r "${MVIEWERSTUDIO_DIR}/img" "${STATIC_DIR}"
-cp -r "${MVIEWERSTUDIO_DIR}/js" "${STATIC_DIR}"
-cp -r "${MVIEWERSTUDIO_DIR}/lib" "${STATIC_DIR}"
-cp -r "${MVIEWERSTUDIO_DIR}/index.html" "${STATIC_DIR}"
-
-cp "${MVIEWERSTUDIO_DIR}/mviewerstudio.i18n.json" "${STATIC_DIR}/mviewerstudio.i18n.json"
-cp "${MVIEWERSTUDIO_DIR}/config-python-sample.json" "${STATIC_DIR}/apps/config.json"
-
-cd "${MVIEWERSTUDIO_DIR}/srv/python"
-
-# install python venv and requirements
-
-python3 -m venv .venv
-. "${MVIEWERSTUDIO_DIR}/srv/python/.venv/bin/activate"
-pip install -r requirements.txt -r dev-requirements.txt
-pip install -e .
diff --git a/srv/python/mviewerstudio_backend/__init__.py b/srv/python/mviewerstudio_backend/__init__.py
deleted file mode 100644
index e69de29b..00000000
diff --git a/srv/python/mviewerstudio_backend/store/a.txt b/srv/python/mviewerstudio_backend/store/a.txt
deleted file mode 100644
index e69de29b..00000000
diff --git a/srv/python/setup.py b/srv/python/setup.py
deleted file mode 100644
index 0c94bcda..00000000
--- a/srv/python/setup.py
+++ /dev/null
@@ -1,24 +0,0 @@
-from setuptools import setup, find_packages
-
-with open("requirements.txt") as f:
- REQUIREMENTS = f.read().split("\n")
-
-setup(
- name="mviewerstudio_backend",
- version="0.2",
- description="A simple API for mviewerstudio",
- author="mviewer community",
- author_email="",
- url="https://github.com/mviewer/mviewerstudio",
- packages=find_packages(),
- install_requires=REQUIREMENTS,
- python_requires=">=3.11",
- classifiers=[
- "Programming Language :: Python",
- "Programming Language :: Python :: 3",
- "Programming Language :: Python :: 3.11",
- "Framework :: Flask",
- "Topic :: Internet :: WWW/HTTP",
- "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
- ],
-)
diff --git a/srv/python/sync.sh b/srv/python/sync.sh
deleted file mode 100644
index 087e8bb4..00000000
--- a/srv/python/sync.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/bash
-
-# =====================
-# THIS SCRIPT EASE SYNC BETWEEN ROOT FOLDER AND PYTHON'S SRV DIRECTORY.
-# USE ONE PARAM : action
-# VALUE: pull or push
-#
-# EXAMPLE TO SYNC AFTER GIT PULL:
-# sh ./sync.sh pull
-#
-# EXAMPLE TO SYNC BEFORE GIT PUSH:
-# sh ./sync.sh push
-# =====================
-
-echo "START...."
-
-if [ -z "$1" ]
-then
- echo "No action param | First arg value 'push' or 'pull' missing"
- echo "Exemple : echo sh ./sync.sh pull /home/user/git/mviewerstudio"
- echo "....END."
- exit 0
-fi
-
-if [ -z "$2" ]
-then
- echo "No root path param | second arg missing"
- echo "Exemple : echo sh ./sync.sh pull /home/user/git/mviewerstudio"
- echo "....END."
- exit 0
-fi
-
-root_path="$2"
-srv_path="${root_path}/srv/python/"
-srv_static_path="${srv_path}/mviewerstudio_backend/static"
-action="$1"
-
-if [ "${action}" = "pull" ]
-then
- src="${root_path}"
- target="${srv_static_path}"
-elif [ "${action}" = "push" ]
-then
- src="${srv_static_path}"
- target="${root_path}"
-fi
-
-echo "Copy files...."
-cp -pr "${src}/index.html" "${target}/index.html"
-cp -pr "${src}/lib" "${target}"
-cp -pr "${src}/js" "${target}"
-cp -pr "${src}/css/mviewerstudio.css" "${target}/css/mviewerstudio.css"
-cp -pr "${src}/mviewerstudio.i18n.json" "${target}/mviewerstudio.i18n.json"
-
-echo "....END."
-#exit 0
-
-
-
diff --git a/start.sh b/start.sh
new file mode 100755
index 00000000..10efc0a1
--- /dev/null
+++ b/start.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+set -euo pipefail
+
+ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+VENV_DIR="${ROOT_DIR}/.venv"
+FRONT_CONFIG="${ROOT_DIR}/src/static/config.json"
+
+needs_install=false
+
+if [ ! -d "${VENV_DIR}" ]; then
+ needs_install=true
+fi
+
+if [ ! -f "${FRONT_CONFIG}" ]; then
+ needs_install=true
+fi
+
+if [ "${needs_install}" = true ]; then
+ echo "Environment not ready. Installing local dependencies..."
+ sudo apt install -y libxslt1-dev libxml2-dev python3 python3-pip python3-venv git
+ python3 -m venv "${VENV_DIR}"
+ . "${VENV_DIR}/bin/activate"
+ pip install -r "${ROOT_DIR}/install/requirements.txt" -r "${ROOT_DIR}/install/dev-requirements.txt"
+ pip install -e "${ROOT_DIR}/src"
+else
+ . "${VENV_DIR}/bin/activate"
+fi
+
+if ! command -v flask >/dev/null 2>&1; then
+ echo "Flask not available in the current virtualenv. Reinstalling local dependencies..."
+ pip install -r "${ROOT_DIR}/install/requirements.txt" -r "${ROOT_DIR}/install/dev-requirements.txt"
+ pip install -e "${ROOT_DIR}/src"
+fi
+
+if [ ! -f "${FRONT_CONFIG}" ]; then
+ echo "Missing front config: ${FRONT_CONFIG}"
+ exit 1
+fi
+
+export CONF_PATH_FROM_MVIEWER="${CONF_PATH_FROM_MVIEWER:-apps/store}"
+export CONF_PUBLISH_PATH_FROM_MVIEWER="${CONF_PUBLISH_PATH_FROM_MVIEWER:-apps/public}"
+export EXPORT_CONF_FOLDER="${EXPORT_CONF_FOLDER:-${ROOT_DIR}/apps/store}"
+export MVIEWERSTUDIO_PUBLISH_PATH="${MVIEWERSTUDIO_PUBLISH_PATH:-${ROOT_DIR}/apps/public}"
+export DEFAULT_ORG="${DEFAULT_ORG:-public}"
+export LOG_LEVEL="${LOG_LEVEL:-INFO}"
+export FLASK_DEBUG="${FLASK_DEBUG:-1}"
+
+mkdir -p "${EXPORT_CONF_FOLDER}" "${MVIEWERSTUDIO_PUBLISH_PATH}"
+
+exec flask --app "${ROOT_DIR}/src/app.py" run -p "${FLASK_PORT:-5007}"