diff --git a/.prod.env b/.prod.env index fd65c8ce..1638fa6a 100644 --- a/.prod.env +++ b/.prod.env @@ -8,8 +8,8 @@ CONTACT_EMAIL=fixme #DEBUG=FLASK_DEBUG | False -#LOCAL_PROJECTS=os.path.join(config_dir, os.pardir, os.pardir, 'projects') # for local storage type -LOCAL_PROJECTS=/data/live +#LOCAL_PROJECTS=/data/live +LOCAL_PROJECTS=os.path.join(config_dir, os.pardir, os.pardir, 'projects') # for local storage type #MAINTENANCE_FILE=os.path.join(LOCAL_PROJECTS, 'MAINTENANCE') # locking file when backups are created MAINTENANCE_FILE=/data/MAINTENANCE @@ -23,8 +23,8 @@ SECRET_KEY=fixme #SWAGGER_UI=False # to enable swagger UI console (for test only) -#TEMP_DIR=gettempdir() # trash dir for temp files being cleaned regularly -TEMP_DIR=/data/tmp +#TEMP_DIR=/data/tmp +TEMP_DIR=gettempdir() # trash dir for temp files being cleaned regularly #TESTING=False @@ -154,8 +154,7 @@ CLOSED_ACCOUNT_EXPIRATION=1 # GLOBAL_STORAGE 1024 * 1024 * 1024 GLOBAL_STORAGE=10737418240 -# GLOBAL_READ False -GLOBAL_READ=1 +# GLOBAL_READ False - Everyone will be "guest", you need to share projects with them explicitly # GLOBAL_WRITE False diff --git a/LICENSES/CLA-signed-list.md b/LICENSES/CLA-signed-list.md index 86c63e49..4974025b 100644 --- a/LICENSES/CLA-signed-list.md +++ b/LICENSES/CLA-signed-list.md @@ -2,7 +2,7 @@ Please add your GitHub username and date to the lists below to sign that: A/ You have read and agree to the individual CLA: https://merginmaps.com/licenses/individual-cla -* `your_name_here` +* `alhirzel`, 20th December 2023 B/ I have read and agree with entity CLA for my company: https://merginmaps.com/licenses/entity-cla diff --git a/README.md b/README.md index 8e108e6e..1d17701e 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,12 @@ + + + + -

- - - - - Mergin Maps logo - - -

- -

- Store and track changes to your geo-data
- -

+ -[![Code Layout](https://github.com/MerginMaps/mergin/actions/workflows/code_style.yml/badge.svg)](https://github.com/MerginMaps/mergin/actions/workflows/code_style.yml) -[![Auto Tests](https://github.com/MerginMaps/mergin/actions/workflows/auto_tests.yml/badge.svg)](https://github.com/MerginMaps/mergin/actions/workflows/auto_tests.yml) +[![Code Layout](https://github.com/MerginMaps/server/actions/workflows/code_style.yml/badge.svg)](https://github.com/MerginMaps/server/actions/workflows/code_style.yml) +[![Auto Tests](https://github.com/MerginMaps/server/actions/workflows/auto_tests.yml/badge.svg)](https://github.com/MerginMaps/server/actions/workflows/auto_tests.yml) [![Coverage Status](https://coveralls.io/repos/github/MerginMaps/mergin/badge.svg)](https://coveralls.io/github/MerginMaps/mergin) ## About @@ -36,7 +27,7 @@ The platform is especially useful when you need: - **No coding required.** Everything can be set up with no knowledge of programming. Mergin Maps organises all data in projects. A project in Mergin Maps is a directory containing various data files - GeoPackages, -QGIS project files, documents, pictures and more. As soon as a project is uploaded to Mergin Maps, it can be easily accessed directly from the web, from QGIS or from iOS/Android via our [mobile app](https://merginmaps.com/start-for-free). +QGIS project files, documents, pictures and more. As soon as a project is uploaded to Mergin Maps, it can be easily accessed directly from the web, from QGIS or from iOS/Android via our [mobile app](https://merginmaps.com/). You are currently browsing repository for Mergin Maps web server and web client. Our mobile app, QGIS plugin and integrations have standalone GitHub repositories, you can [find them here](https://github.com/MerginMaps). @@ -77,8 +68,8 @@ You are currently browsing repository for Mergin Maps web server and web client. ## Features - 🌍 **Store data** - GeoPackages, QGIS project files, GeoTIFFs, pictures or any other data easily -- 📱 **Mobile devices** - Great for working on field surveys, thanks to our mobile app based on QGIS, for [iOS and Android](https://github.com/lutraconsulting/input) -- 🌟 **QGIS integration** - [Mergin Maps plugin](https://github.com/lutraconsulting/qgis-mergin-plugin) is available to help with project setup and seamless syncing within QGIS +- 📱 **Mobile devices** - Great for working on field surveys, thanks to our mobile app based on QGIS, for [iOS and Android](https://github.com/merginmaps/input) +- 🌟 **QGIS integration** - [Mergin Maps plugin](https://github.com/merginmaps/qgis-mergin-plugin) is available to help with project setup and seamless syncing within QGIS - 👥 **Multi-user editing** - Changes to vector/attribute data from multiple users are automatically merged - 📖 **Data versioning** - Keeping history of all changes, allowing to go back if needed - 🔌 **Offline editing** - Clients do not need to be online all the time - only when syncing changes @@ -86,10 +77,10 @@ You are currently browsing repository for Mergin Maps web server and web client. - 🏰 **Permission system** - Decide who can read, write or manage projects - 🌈 **Web interface** - Simple user interface to view and manage projects - ⚡️ **Fast** - Efficient sync protocol transfering data between clients and server -- 🧑‍💻 **Developer friendly** - Mergin Maps is open platform. CLI tools and client libraries are available for [Python](https://github.com/lutraconsulting/mergin-py-client) and [C++](https://github.com/lutraconsulting/mergin-cpp-client) -- :camera: **Sync images** - Supporting sync of photos with common cloud storage using [mergin-media-sync](https://github.com/lutraconsulting/mergin-media-sync) tool -- 💽 **Sync with database** - Supporting two-way sync of data with PostGIS using [mergin-db-sync](https://github.com/lutraconsulting/mergin-db-sync) tool -- 👷‍♀️ **Work packages** - Split main database to smaller chunks for teams using [mergin-work-packages](https://github.com/lutraconsulting/mergin-work-packages) tool +- 🧑‍💻 **Developer friendly** - Mergin Maps is open platform. CLI tools and client libraries are available for [Python](https://github.com/MerginMaps/python-api-client) and [C++](https://github.com/MerginMaps/cpp-api-client) +- :camera: **Sync images** - Supporting sync of photos with common cloud storage using [mergin-media-sync](https://github.com/MerginMaps/media-sync) tool +- 💽 **Sync with database** - Supporting two-way sync of data with PostGIS using [mergin-db-sync](https://github.com/MerginMaps/db-sync) tool +- 👷‍♀️ **Work packages** - Split main database to smaller chunks for teams using [mergin-work-packages](https://github.com/MerginMaps/work-packages) tool Mergin Maps offers a unique combination of features that other tools do not provide out of the box: @@ -134,14 +125,14 @@ Contributions are welcome! More information for developers can be found in the dedicated [development](development.md) page. Client side modules: -- [Python](https://github.com/lutraconsulting/mergin-py-client) client library + CLI -- [C++](https://github.com/lutraconsulting/mergin-cpp-client) client library + CLI +- [Python](https://github.com/MerginMaps/python-api-client) client library + CLI +- [C++](https://github.com/MerginMaps/cpp-api-client) client library + CLI More related tools: -- [mergin-db-sync](https://github.com/lutraconsulting/mergin-db-sync) - set up two-way sync between Mergin Maps and PostGIS database -- [mergin-work-packages](https://github.com/lutraconsulting/mergin-work-packages) - split data for teams to work packages +- [mergin-db-sync](https://github.com/MerginMaps/db-sync) - set up two-way sync between Mergin Maps and PostGIS database +- [mergin-work-packages](https://github.com/MerginMaps/work-packages) - split data for teams to work packages -Learn more about [geodiff](https://github.com/lutraconsulting/geodiff) - the low-level library providing seamless merging of changes from multiple sources. +Learn more about [geodiff](https://github.com/merginmaps/geodiff) - the low-level library providing seamless merging of changes from multiple sources. ## License diff --git a/doc/mm_logo_bgnd_neg.png b/doc/mm_logo_bgnd_neg.png deleted file mode 100644 index 6db4b8be..00000000 Binary files a/doc/mm_logo_bgnd_neg.png and /dev/null differ diff --git a/doc/mm_logo_bgnd_pos.jpg b/doc/mm_logo_bgnd_pos.jpg deleted file mode 100644 index 81626382..00000000 Binary files a/doc/mm_logo_bgnd_pos.jpg and /dev/null differ diff --git a/docker-compose.yml b/docker-compose.yml index 42a6e38a..a1f0ffb3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,7 +21,7 @@ services: networks: - merginmaps server: - image: lutraconsulting/merginmaps-backend:2023.2.0 + image: lutraconsulting/merginmaps-backend:2023.6.1 container_name: merginmaps-server restart: always user: 901:999 @@ -35,7 +35,7 @@ services: networks: - merginmaps web: - image: lutraconsulting/merginmaps-frontend:2023.2.0 + image: lutraconsulting/merginmaps-frontend:2023.6.1 container_name: merginmaps-web restart: always depends_on: @@ -52,6 +52,6 @@ services: - "8080:80" volumes: - ./projects:/data # map data dir to host - - ${PWD}/nginx.conf:/etc/nginx/conf.d/default.conf + - ./nginx.conf:/etc/nginx/conf.d/default.conf networks: - merginmaps diff --git a/server/mergin/sync/models.py b/server/mergin/sync/models.py index 4a8395ca..7c1a81f7 100644 --- a/server/mergin/sync/models.py +++ b/server/mergin/sync/models.py @@ -36,7 +36,7 @@ class Project(db.Model): ) updated = db.Column(db.DateTime, onupdate=datetime.utcnow) # metadata for project files (see also FileInfoSchema) - files = db.Column(JSONB, default=[]) + files = db.deferred(db.Column(JSONB, default=[])) tags = db.Column(ARRAY(String), server_default="{}") disk_usage = db.Column(BIGINT, nullable=False, default=0) latest_version = db.Column(db.String, index=True) diff --git a/server/mergin/sync/public_api_controller.py b/server/mergin/sync/public_api_controller.py index 9255b1d4..26b31232 100644 --- a/server/mergin/sync/public_api_controller.py +++ b/server/mergin/sync/public_api_controller.py @@ -311,26 +311,41 @@ def download_project_file( :rtype: file """ project = require_project(namespace, project_name, ProjectPermissions.Read) - files = _project_version_files(project, version) - file_path = None + if diff and not version: + abort(400, f"Changeset must be requested for particular file version") + + lookup_version = version or project.latest_version + sql = text( + """ + SELECT + expanded.files ->> 'location' AS location, + (expanded.files ->> 'diff')::jsonb ->> 'location' as diff_location + FROM + ( + SELECT jsonb_array_elements(pv.files::jsonb) AS files + FROM project_version pv + WHERE pv.name = :version AND project_id = :project_id + ) AS expanded + WHERE + expanded.files @> :json; + """ + ) + params = { + "version": lookup_version, + "project_id": project.id, + "json": '{"path": "' + file + '"}', + } + result = db.session.execute(sql, params).fetchone() + if not result: + abort(404, f"File {file} not found") + if diff and version: # get specific version of geodiff file modified in requested version - file_obj = next( - (f for f in files if f["location"] == os.path.join(version, file)), None - ) - if not file_obj: - abort(404, file) - if "diff" not in file_obj: + if not result["diff_location"]: abort(404, f"No diff in particular file {file} version") - file_path = file_obj["diff"]["location"] - elif diff: - abort(400, f"Changeset must be requested for particular file version") + file_path = result["diff_location"] else: - # get latest version of file - file_path = next((f["location"] for f in files if f["path"] == file), None) - - if not file_path: - abort(404, file) + file_path = result["location"] if version and not diff: project.storage.restore_versioned_file(file, version) diff --git a/server/mergin/version.py b/server/mergin/version.py index b131a2ad..c73d8283 100644 --- a/server/mergin/version.py +++ b/server/mergin/version.py @@ -4,4 +4,4 @@ def get_version(): - return "2023.3.0" + return "2023.6.1" diff --git a/server/setup.py b/server/setup.py index 0776d696..78e68823 100644 --- a/server/setup.py +++ b/server/setup.py @@ -6,7 +6,7 @@ setup( name="mergin", - version="2023.3.0", + version="2023.6.1", url="https://github.com/MerginMaps/mergin", license="AGPL-3.0-only", author="Lutra Consulting Limited",