geovisio 2.8.0__py3-none-any.whl → 2.9.0__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.
- geovisio/__init__.py +16 -3
- geovisio/config_app.py +11 -1
- geovisio/translations/br/LC_MESSAGES/messages.mo +0 -0
- geovisio/translations/br/LC_MESSAGES/messages.po +762 -0
- geovisio/translations/da/LC_MESSAGES/messages.mo +0 -0
- geovisio/translations/da/LC_MESSAGES/messages.po +10 -1
- geovisio/translations/de/LC_MESSAGES/messages.mo +0 -0
- geovisio/translations/de/LC_MESSAGES/messages.po +10 -1
- geovisio/translations/en/LC_MESSAGES/messages.mo +0 -0
- geovisio/translations/en/LC_MESSAGES/messages.po +9 -7
- geovisio/translations/eo/LC_MESSAGES/messages.mo +0 -0
- geovisio/translations/eo/LC_MESSAGES/messages.po +67 -1
- geovisio/translations/es/LC_MESSAGES/messages.mo +0 -0
- geovisio/translations/es/LC_MESSAGES/messages.po +4 -3
- geovisio/translations/fr/LC_MESSAGES/messages.mo +0 -0
- geovisio/translations/fr/LC_MESSAGES/messages.po +37 -4
- geovisio/translations/hu/LC_MESSAGES/messages.mo +0 -0
- geovisio/translations/hu/LC_MESSAGES/messages.po +4 -3
- geovisio/translations/it/LC_MESSAGES/messages.mo +0 -0
- geovisio/translations/it/LC_MESSAGES/messages.po +10 -1
- geovisio/translations/ja/LC_MESSAGES/messages.mo +0 -0
- geovisio/translations/ja/LC_MESSAGES/messages.po +242 -154
- geovisio/translations/nl/LC_MESSAGES/messages.mo +0 -0
- geovisio/translations/nl/LC_MESSAGES/messages.po +131 -25
- geovisio/translations/pl/LC_MESSAGES/messages.mo +0 -0
- geovisio/translations/pl/LC_MESSAGES/messages.po +4 -3
- geovisio/translations/sv/LC_MESSAGES/messages.mo +0 -0
- geovisio/translations/sv/LC_MESSAGES/messages.po +822 -0
- geovisio/utils/annotations.py +186 -0
- geovisio/utils/cql2.py +134 -0
- geovisio/utils/db.py +7 -0
- geovisio/utils/fields.py +24 -7
- geovisio/utils/loggers.py +14 -0
- geovisio/utils/model_query.py +2 -2
- geovisio/utils/params.py +7 -4
- geovisio/utils/pic_shape.py +63 -0
- geovisio/utils/pictures.py +54 -12
- geovisio/utils/reports.py +10 -17
- geovisio/utils/semantics.py +165 -55
- geovisio/utils/sentry.py +0 -1
- geovisio/utils/sequences.py +141 -60
- geovisio/utils/tags.py +31 -0
- geovisio/utils/upload_set.py +26 -21
- geovisio/utils/website.py +3 -0
- geovisio/web/annotations.py +205 -9
- geovisio/web/auth.py +3 -2
- geovisio/web/collections.py +49 -34
- geovisio/web/configuration.py +2 -1
- geovisio/web/docs.py +55 -16
- geovisio/web/items.py +55 -54
- geovisio/web/map.py +25 -13
- geovisio/web/params.py +11 -21
- geovisio/web/stac.py +19 -12
- geovisio/web/upload_set.py +92 -11
- geovisio/web/users.py +31 -4
- geovisio/workers/runner_pictures.py +71 -10
- {geovisio-2.8.0.dist-info → geovisio-2.9.0.dist-info}/METADATA +24 -22
- geovisio-2.9.0.dist-info/RECORD +98 -0
- {geovisio-2.8.0.dist-info → geovisio-2.9.0.dist-info}/WHEEL +1 -1
- geovisio-2.8.0.dist-info/RECORD +0 -89
- {geovisio-2.8.0.dist-info → geovisio-2.9.0.dist-info/licenses}/LICENSE +0 -0
geovisio/__init__.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""GeoVisio API - Main"""
|
|
2
2
|
|
|
3
|
-
__version__ = "2.
|
|
3
|
+
__version__ = "2.9.0"
|
|
4
4
|
|
|
5
5
|
import os
|
|
6
|
-
from flask import Flask, jsonify, stream_template, send_from_directory, redirect, request
|
|
6
|
+
from flask import Flask, jsonify, stream_template, send_from_directory, redirect, request, url_for
|
|
7
7
|
from flask.cli import with_appcontext
|
|
8
8
|
from flask_cors import CORS
|
|
9
9
|
from flask_compress import Compress
|
|
@@ -106,7 +106,9 @@ def create_app(test_config=None, app=None):
|
|
|
106
106
|
# https://flask.palletsprojects.com/en/2.2.x/deploying/proxy_fix/
|
|
107
107
|
from werkzeug.middleware.proxy_fix import ProxyFix
|
|
108
108
|
|
|
109
|
-
app.wsgi_app = ProxyFix(
|
|
109
|
+
app.wsgi_app = ProxyFix(
|
|
110
|
+
app.wsgi_app, x_for=nb_proxies, x_proto=nb_proxies, x_host=nb_proxies, x_prefix=nb_proxies, x_port=nb_proxies
|
|
111
|
+
)
|
|
110
112
|
|
|
111
113
|
# store the background processor in the app context
|
|
112
114
|
app.background_processor = runner_pictures.PictureBackgroundProcessor(app)
|
|
@@ -185,6 +187,17 @@ def create_app(test_config=None, app=None):
|
|
|
185
187
|
def favicon():
|
|
186
188
|
return redirect("/static/img/favicon.ico")
|
|
187
189
|
|
|
190
|
+
@app.route("/api/debug_headers")
|
|
191
|
+
def debug_headers():
|
|
192
|
+
"""Endpoint handy when setting a new instance to check if all the headers are set correctly,
|
|
193
|
+
and especially the X-Forwarded-* header that needs to be set by the proxies in order for the API to correctly build internal urls.
|
|
194
|
+
|
|
195
|
+
The headers are only printed to the console, so it's only for the instance administrator that has access to those logs.
|
|
196
|
+
"""
|
|
197
|
+
logging.info(request.headers)
|
|
198
|
+
|
|
199
|
+
return jsonify({"test_url": url_for("index", _external=True)}), 200
|
|
200
|
+
|
|
188
201
|
# Errors
|
|
189
202
|
@app.errorhandler(errors.InvalidAPIUsage)
|
|
190
203
|
def invalid_api_usage(e):
|
geovisio/config_app.py
CHANGED
|
@@ -33,12 +33,13 @@ class DefaultConfig:
|
|
|
33
33
|
PERMANENT_SESSION_LIFETIME = datetime.timedelta(days=7).total_seconds()
|
|
34
34
|
API_FORCE_AUTH_ON_UPLOAD = False
|
|
35
35
|
PICTURE_PROCESS_DERIVATES_STRATEGY = "ON_DEMAND"
|
|
36
|
+
PICTURE_PROCESS_NB_RETRIES = 5
|
|
37
|
+
PICTURE_PROCESS_KEEP_UNBLURRED_PARTS = False
|
|
36
38
|
API_BLUR_URL = None
|
|
37
39
|
PICTURE_PROCESS_THREADS_LIMIT = 1
|
|
38
40
|
DB_CHECK_SCHEMA = True # If True check the database schema, and do not start the api if not up to date
|
|
39
41
|
API_PICTURES_LICENSE_SPDX_ID = None
|
|
40
42
|
API_PICTURES_LICENSE_URL = None
|
|
41
|
-
API_WEBSITE_URL = None # URL to the website, used to generate links to the website. If not set, the API will presume the website runs from the same url.
|
|
42
43
|
DEBUG_PICTURES_SKIP_FS_CHECKS_WITH_PUBLIC_URL = False
|
|
43
44
|
SESSION_COOKIE_HTTPONLY = False
|
|
44
45
|
PICTURE_PROCESS_REFRESH_CRON = (
|
|
@@ -52,6 +53,7 @@ class DefaultConfig:
|
|
|
52
53
|
API_WEBSITE_URL = (
|
|
53
54
|
website.WEBSITE_UNDER_SAME_HOST
|
|
54
55
|
) # by default we consider that there is a panoramax website on the same host as the API
|
|
56
|
+
API_REGISTRATION_IS_OPEN = False # tells that anyone can create an account. Only used for reference in the federation for the moment
|
|
55
57
|
|
|
56
58
|
|
|
57
59
|
def read_config(app, test_config):
|
|
@@ -93,10 +95,13 @@ def read_config(app, test_config):
|
|
|
93
95
|
"API_DEFAULT_COLLABORATIVE_METADATA_EDITING",
|
|
94
96
|
"API_ENFORCE_TOS_ACCEPTANCE",
|
|
95
97
|
"API_WEBSITE_URL",
|
|
98
|
+
"API_REGISTRATION_IS_OPEN",
|
|
96
99
|
# Picture process
|
|
97
100
|
"PICTURE_PROCESS_DERIVATES_STRATEGY",
|
|
98
101
|
"PICTURE_PROCESS_THREADS_LIMIT",
|
|
99
102
|
"PICTURE_PROCESS_REFRESH_CRON",
|
|
103
|
+
"PICTURE_PROCESS_NB_RETRIES",
|
|
104
|
+
"PICTURE_PROCESS_KEEP_UNBLURRED_PARTS",
|
|
100
105
|
# OAUTH
|
|
101
106
|
"OAUTH_PROVIDER",
|
|
102
107
|
"OAUTH_OIDC_URL",
|
|
@@ -166,6 +171,7 @@ def read_config(app, test_config):
|
|
|
166
171
|
raise Exception(
|
|
167
172
|
f"Unknown picture derivates strategy: '{app.config['PICTURE_PROCESS_DERIVATES_STRATEGY']}'. Please set to one of ON_DEMAND, PREPROCESS"
|
|
168
173
|
)
|
|
174
|
+
app.config["PICTURE_PROCESS_NB_RETRIES"] = int(app.config["PICTURE_PROCESS_NB_RETRIES"])
|
|
169
175
|
|
|
170
176
|
# Parse API summary
|
|
171
177
|
if not isinstance(app.config.get("API_SUMMARY"), ApiSummary):
|
|
@@ -179,6 +185,8 @@ def read_config(app, test_config):
|
|
|
179
185
|
except Exception as e:
|
|
180
186
|
raise Exception("Parameter API_SUMMARY is not recognized") from e
|
|
181
187
|
|
|
188
|
+
app.config["API_REGISTRATION_IS_OPEN"] = _read_bool(app.config, "API_REGISTRATION_IS_OPEN")
|
|
189
|
+
|
|
182
190
|
# Checks on front-end related variables
|
|
183
191
|
templateFolder = os.path.join(app.root_path, app.template_folder)
|
|
184
192
|
for pageParam in ["API_MAIN_PAGE", "API_VIEWER_PAGE"]:
|
|
@@ -221,6 +229,8 @@ def read_config(app, test_config):
|
|
|
221
229
|
if not croniter.croniter.is_valid(cron_val):
|
|
222
230
|
raise Exception(f"PICTURE_PROCESS_REFRESH_CRON should be a valid cron syntax, got '{cron_val}'")
|
|
223
231
|
|
|
232
|
+
app.config["PICTURE_PROCESS_KEEP_UNBLURRED_PARTS"] = _read_bool(app.config, "PICTURE_PROCESS_KEEP_UNBLURRED_PARTS")
|
|
233
|
+
|
|
224
234
|
app.config["API_ACCEPT_DUPLICATE"] = _read_bool(app.config, "API_ACCEPT_DUPLICATE")
|
|
225
235
|
app.config["API_ENFORCE_TOS_ACCEPTANCE"] = _read_bool(app.config, "API_ENFORCE_TOS_ACCEPTANCE")
|
|
226
236
|
app.config["API_DEFAULT_COLLABORATIVE_METADATA_EDITING"] = _read_bool(app.config, "API_DEFAULT_COLLABORATIVE_METADATA_EDITING")
|
|
Binary file
|