diff --git a/.gitmodules b/.gitmodules index 2cc27d1d1..a79868ce0 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,7 @@ [submodule "web/documentserver-example/nodejs/public/assets/document-templates"] path = web/documentserver-example/nodejs/public/assets/document-templates url = https://github.com/Euro-Office/document-templates - branch = main/default + branch = main [submodule "web/documentserver-example/nodejs/public/assets/document-formats"] path = web/documentserver-example/nodejs/public/assets/document-formats url = https://github.com/Euro-Office/document-formats @@ -11,37 +11,37 @@ [submodule "web/documentserver-example/csharp-mvc/assets/document-templates"] path = web/documentserver-example/csharp-mvc/assets/document-templates url = https://github.com/Euro-Office/document-templates - branch = main/default + branch = main [submodule "web/documentserver-example/csharp-mvc/assets/document-formats"] path = web/documentserver-example/csharp-mvc/assets/document-formats url = https://github.com/Euro-Office/document-formats [submodule "web/documentserver-example/php/assets/document-templates"] path = web/documentserver-example/php/assets/document-templates url = https://github.com/Euro-Office/document-templates - branch = main/default + branch = main [submodule "web/documentserver-example/php/assets/document-formats"] path = web/documentserver-example/php/assets/document-formats url = https://github.com/Euro-Office/document-formats [submodule "web/documentserver-example/python/assets/document-templates"] path = web/documentserver-example/python/assets/document-templates url = https://github.com/Euro-Office/document-templates - branch = main/default + branch = main [submodule "web/documentserver-example/java/src/main/resources/assets/document-templates"] path = web/documentserver-example/java/src/main/resources/assets/document-templates url = https://github.com/Euro-Office/document-templates - branch = main/default + branch = main [submodule "web/documentserver-example/ruby/assets/document-templates"] path = web/documentserver-example/ruby/assets/document-templates url = https://github.com/Euro-Office/document-templates - branch = main/default + branch = main [submodule "web/documentserver-example/java-spring/src/main/resources/assets/document-templates"] path = web/documentserver-example/java-spring/src/main/resources/assets/document-templates url = https://github.com/Euro-Office/document-templates - branch = main/default + branch = main [submodule "web/documentserver-example/go/static/assets/document-templates"] path = web/documentserver-example/go/static/assets/document-templates url = https://github.com/Euro-Office/document-templates - branch = main/default + branch = main [submodule "web/documentserver-example/go/static/assets/document-formats"] path = web/documentserver-example/go/static/assets/document-formats url = https://github.com/Euro-Office/document-formats @@ -57,11 +57,11 @@ [submodule "web/documentserver-example/csharp/assets/document-templates"] path = web/documentserver-example/csharp/assets/document-templates url = https://github.com/Euro-Office/document-templates - branch = main/default + branch = main [submodule "web/documentserver-example/csharp/assets/document-formats"] path = web/documentserver-example/csharp/assets/document-formats url = https://github.com/Euro-Office/document-formats [submodule "web/documentserver-example/php-laravel/public/assets/document-templates"] path = web/documentserver-example/php-laravel/public/assets/document-templates url = https://github.com/Euro-Office/document-templates - branch = main/default + branch = main diff --git a/Readme.md b/Readme.md index 788cb18b0..89d9f2d9d 100644 --- a/Readme.md +++ b/Readme.md @@ -20,6 +20,62 @@ You should change `http://documentserver` to your server address in these files: * [Ruby](https://github.com/Euro-Office/document-server-integration/tree/main/web/documentserver-example/ruby) - `web/documentserver-example/ruby/app/configuration/configuration.rb` +## Quick Start — minimal Docker test environment + +The repository ships a `docker-compose.yml` that starts a self-contained +Euro-Office DocumentServer with the Node.js integration example enabled +automatically. No extra configuration or manual service start is required. + +**Prerequisites:** Docker with the Compose plugin (v2). + +**1. Start the container:** + +```bash +docker compose up -d +``` + +**2. Wait until the server is ready** — monitor the logs: + +```bash +docker logs -f eo-documentserver +``` + +The server is ready when you see: + +``` +INFO success: docservice entered RUNNING state +``` + +**3. Open the example in your browser:** + +``` +http://localhost:8080/example/ +``` + +To open a specific file type directly in the editor: + +``` +http://localhost:8080/example/editor?fileExt=docx&userid=uid-1&lang=en&directUrl=false +``` + +| Parameter | Description | +|-----------|-------------| +| `fileExt` | Extension of the new blank document (`docx`, `xlsx`, `pptx`) | +| `userid` | Any user identifier (e.g. `uid-1`) | +| `lang` | UI language — exact locale (`en-US`) or two-letter code with `default` fallback (`en`) | +| `directUrl` | Set `true` to pass the file URL directly to the browser | + +**Stop and remove the container:** + +```bash +docker compose down +``` + +> **Security note:** The compose file sets `JWT_SECRET=secret`. This is +> intentionally insecure and is only suitable for local development and +> testing. Never expose this setup to a public network. + + ## API methods for test examples The methods described below are available for all of the test examples. diff --git a/docker-compose.yml b/docker-compose.yml index 39ad330fb..b98f526d3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,19 +28,11 @@ # INFO success: docservice entered RUNNING state # # ----------------------------------------------------------------------------- -# Start the example application -# ----------------------------------------------------------------------------- -# -# The example Node.js application is not started automatically. -# After the container is running, start it manually with: -# -# docker exec -it eo-documentserver supervisorctl start ds-example -# -# ----------------------------------------------------------------------------- # Access the example # ----------------------------------------------------------------------------- # -# Open the example in your browser: +# The example Node.js application starts automatically (EXAMPLE_ENABLED=true). +# Open the example in your browser once the container is running: # # http://localhost:8080/example/ # @@ -50,7 +42,10 @@ name: minimal-documentserver-test services: documentserver: - image: euro-office/documentserver:latest + image: ghcr.io/euro-office/documentserver:latest + environment: + EXAMPLE_ENABLED: "true" + JWT_SECRET: "secret" container_name: eo-documentserver ports: - "8080:80" \ No newline at end of file diff --git a/web/documentserver-example/csharp-mvc/assets/document-formats b/web/documentserver-example/csharp-mvc/assets/document-formats index 7d7576a3f..469958280 160000 --- a/web/documentserver-example/csharp-mvc/assets/document-formats +++ b/web/documentserver-example/csharp-mvc/assets/document-formats @@ -1 +1 @@ -Subproject commit 7d7576a3fe2337c30f4c9b40fae70a69dc68ba08 +Subproject commit 46995828084d4460112efec579499809f418ca6e diff --git a/web/documentserver-example/csharp-mvc/assets/document-templates b/web/documentserver-example/csharp-mvc/assets/document-templates index d600e9b07..d697ab3d7 160000 --- a/web/documentserver-example/csharp-mvc/assets/document-templates +++ b/web/documentserver-example/csharp-mvc/assets/document-templates @@ -1 +1 @@ -Subproject commit d600e9b0728213e775d122fcbf30f4491b8cdfe5 +Subproject commit d697ab3d75dbec104e4a99f47852398752cb2ace diff --git a/web/documentserver-example/csharp/assets/document-formats b/web/documentserver-example/csharp/assets/document-formats index 7d7576a3f..469958280 160000 --- a/web/documentserver-example/csharp/assets/document-formats +++ b/web/documentserver-example/csharp/assets/document-formats @@ -1 +1 @@ -Subproject commit 7d7576a3fe2337c30f4c9b40fae70a69dc68ba08 +Subproject commit 46995828084d4460112efec579499809f418ca6e diff --git a/web/documentserver-example/csharp/assets/document-templates b/web/documentserver-example/csharp/assets/document-templates index d600e9b07..d697ab3d7 160000 --- a/web/documentserver-example/csharp/assets/document-templates +++ b/web/documentserver-example/csharp/assets/document-templates @@ -1 +1 @@ -Subproject commit d600e9b0728213e775d122fcbf30f4491b8cdfe5 +Subproject commit d697ab3d75dbec104e4a99f47852398752cb2ace diff --git a/web/documentserver-example/go/static/assets/document-formats b/web/documentserver-example/go/static/assets/document-formats index 7d7576a3f..469958280 160000 --- a/web/documentserver-example/go/static/assets/document-formats +++ b/web/documentserver-example/go/static/assets/document-formats @@ -1 +1 @@ -Subproject commit 7d7576a3fe2337c30f4c9b40fae70a69dc68ba08 +Subproject commit 46995828084d4460112efec579499809f418ca6e diff --git a/web/documentserver-example/go/static/assets/document-templates b/web/documentserver-example/go/static/assets/document-templates index d600e9b07..d697ab3d7 160000 --- a/web/documentserver-example/go/static/assets/document-templates +++ b/web/documentserver-example/go/static/assets/document-templates @@ -1 +1 @@ -Subproject commit d600e9b0728213e775d122fcbf30f4491b8cdfe5 +Subproject commit d697ab3d75dbec104e4a99f47852398752cb2ace diff --git a/web/documentserver-example/java-spring/src/main/resources/assets/document-templates b/web/documentserver-example/java-spring/src/main/resources/assets/document-templates index d600e9b07..d697ab3d7 160000 --- a/web/documentserver-example/java-spring/src/main/resources/assets/document-templates +++ b/web/documentserver-example/java-spring/src/main/resources/assets/document-templates @@ -1 +1 @@ -Subproject commit d600e9b0728213e775d122fcbf30f4491b8cdfe5 +Subproject commit d697ab3d75dbec104e4a99f47852398752cb2ace diff --git a/web/documentserver-example/java/src/main/resources/assets/document-formats b/web/documentserver-example/java/src/main/resources/assets/document-formats index 7d7576a3f..469958280 160000 --- a/web/documentserver-example/java/src/main/resources/assets/document-formats +++ b/web/documentserver-example/java/src/main/resources/assets/document-formats @@ -1 +1 @@ -Subproject commit 7d7576a3fe2337c30f4c9b40fae70a69dc68ba08 +Subproject commit 46995828084d4460112efec579499809f418ca6e diff --git a/web/documentserver-example/java/src/main/resources/assets/document-templates b/web/documentserver-example/java/src/main/resources/assets/document-templates index d600e9b07..d697ab3d7 160000 --- a/web/documentserver-example/java/src/main/resources/assets/document-templates +++ b/web/documentserver-example/java/src/main/resources/assets/document-templates @@ -1 +1 @@ -Subproject commit d600e9b0728213e775d122fcbf30f4491b8cdfe5 +Subproject commit d697ab3d75dbec104e4a99f47852398752cb2ace diff --git a/web/documentserver-example/nodejs/helpers/docManager.js b/web/documentserver-example/nodejs/helpers/docManager.js index 5298eda6a..c5e5628cd 100644 --- a/web/documentserver-example/nodejs/helpers/docManager.js +++ b/web/documentserver-example/nodejs/helpers/docManager.js @@ -139,8 +139,17 @@ DocManager.prototype.createDemo = function createDemo(isSample, fileExt, userid, const fileName = this.getCorrectName(demoName); // get the correct file name if such a name already exists // copy sample document of a necessary extension to the storage path - this.copyFile(path.join(__dirname, '..', 'public', 'assets', 'document-templates', isSample - ? 'sample' : 'new', demoName), this.storagePath(fileName)); + let templatePath; + if (isSample) { + templatePath = path.join(__dirname, '..', 'public', 'assets', 'document-templates', 'sample', demoName); + } else { + // templates are organised by locale subdirectory (e.g. new/en-US/new.docx); fall back to new/default/ + const lang = this.getLang(); + const langPath = path.join(__dirname, '..', 'public', 'assets', 'document-templates', 'new', lang, demoName); + const defaultPath = path.join(__dirname, '..', 'public', 'assets', 'document-templates', 'new', 'default', demoName); + templatePath = this.existsSync(langPath) ? langPath : defaultPath; + } + this.copyFile(templatePath, this.storagePath(fileName)); this.saveFileData(fileName, userid, username); // save file data to the file diff --git a/web/documentserver-example/nodejs/public/assets/document-formats b/web/documentserver-example/nodejs/public/assets/document-formats index 7d7576a3f..469958280 160000 --- a/web/documentserver-example/nodejs/public/assets/document-formats +++ b/web/documentserver-example/nodejs/public/assets/document-formats @@ -1 +1 @@ -Subproject commit 7d7576a3fe2337c30f4c9b40fae70a69dc68ba08 +Subproject commit 46995828084d4460112efec579499809f418ca6e diff --git a/web/documentserver-example/nodejs/public/assets/document-templates b/web/documentserver-example/nodejs/public/assets/document-templates index d600e9b07..d697ab3d7 160000 --- a/web/documentserver-example/nodejs/public/assets/document-templates +++ b/web/documentserver-example/nodejs/public/assets/document-templates @@ -1 +1 @@ -Subproject commit d600e9b0728213e775d122fcbf30f4491b8cdfe5 +Subproject commit d697ab3d75dbec104e4a99f47852398752cb2ace diff --git a/web/documentserver-example/php-laravel/public/assets/document-templates b/web/documentserver-example/php-laravel/public/assets/document-templates index d600e9b07..d697ab3d7 160000 --- a/web/documentserver-example/php-laravel/public/assets/document-templates +++ b/web/documentserver-example/php-laravel/public/assets/document-templates @@ -1 +1 @@ -Subproject commit d600e9b0728213e775d122fcbf30f4491b8cdfe5 +Subproject commit d697ab3d75dbec104e4a99f47852398752cb2ace diff --git a/web/documentserver-example/php/assets/document-formats b/web/documentserver-example/php/assets/document-formats index 7d7576a3f..469958280 160000 --- a/web/documentserver-example/php/assets/document-formats +++ b/web/documentserver-example/php/assets/document-formats @@ -1 +1 @@ -Subproject commit 7d7576a3fe2337c30f4c9b40fae70a69dc68ba08 +Subproject commit 46995828084d4460112efec579499809f418ca6e diff --git a/web/documentserver-example/php/assets/document-templates b/web/documentserver-example/php/assets/document-templates index d600e9b07..d697ab3d7 160000 --- a/web/documentserver-example/php/assets/document-templates +++ b/web/documentserver-example/php/assets/document-templates @@ -1 +1 @@ -Subproject commit d600e9b0728213e775d122fcbf30f4491b8cdfe5 +Subproject commit d697ab3d75dbec104e4a99f47852398752cb2ace diff --git a/web/documentserver-example/python/assets/document-formats b/web/documentserver-example/python/assets/document-formats index 7d7576a3f..469958280 160000 --- a/web/documentserver-example/python/assets/document-formats +++ b/web/documentserver-example/python/assets/document-formats @@ -1 +1 @@ -Subproject commit 7d7576a3fe2337c30f4c9b40fae70a69dc68ba08 +Subproject commit 46995828084d4460112efec579499809f418ca6e diff --git a/web/documentserver-example/python/assets/document-templates b/web/documentserver-example/python/assets/document-templates index d600e9b07..d697ab3d7 160000 --- a/web/documentserver-example/python/assets/document-templates +++ b/web/documentserver-example/python/assets/document-templates @@ -1 +1 @@ -Subproject commit d600e9b0728213e775d122fcbf30f4491b8cdfe5 +Subproject commit d697ab3d75dbec104e4a99f47852398752cb2ace diff --git a/web/documentserver-example/ruby/assets/document-formats b/web/documentserver-example/ruby/assets/document-formats index 7d7576a3f..469958280 160000 --- a/web/documentserver-example/ruby/assets/document-formats +++ b/web/documentserver-example/ruby/assets/document-formats @@ -1 +1 @@ -Subproject commit 7d7576a3fe2337c30f4c9b40fae70a69dc68ba08 +Subproject commit 46995828084d4460112efec579499809f418ca6e diff --git a/web/documentserver-example/ruby/assets/document-templates b/web/documentserver-example/ruby/assets/document-templates index d600e9b07..d697ab3d7 160000 --- a/web/documentserver-example/ruby/assets/document-templates +++ b/web/documentserver-example/ruby/assets/document-templates @@ -1 +1 @@ -Subproject commit d600e9b0728213e775d122fcbf30f4491b8cdfe5 +Subproject commit d697ab3d75dbec104e4a99f47852398752cb2ace