mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
Compare commits
150 Commits
v7.4.1.13
...
v99.99.99.
| Author | SHA1 | Date | |
|---|---|---|---|
| ad94016a85 | |||
| 75b22614cf | |||
| 6cb15697ab | |||
| 39bab74422 | |||
| 665ab6a77d | |||
| 5663227c55 | |||
| 42ac89e5e5 | |||
| c95499536d | |||
| 5659756c07 | |||
| 038b3b3049 | |||
| 6b555c4d0d | |||
| 44d49bed62 | |||
| 517b130db6 | |||
| 0ff435b9bd | |||
| 56bc372140 | |||
| 4679804774 | |||
| d03f74087c | |||
| 68390aa26c | |||
| 744e5203cb | |||
| 7df7af3f47 | |||
| bf40cd1249 | |||
| f3cb5adb22 | |||
| c8d44199c2 | |||
| 12bcc0009b | |||
| be1ea81f82 | |||
| 668df46ec3 | |||
| 43905695e0 | |||
| 4a49becea1 | |||
| c91d3a24b9 | |||
| d6a4984b84 | |||
| f1dae06746 | |||
| 3cf3bcf2c8 | |||
| aa6e19ebaa | |||
| d7034c72c9 | |||
| c0437b152f | |||
| b72b2c6619 | |||
| c516631360 | |||
| 5cc8d7c094 | |||
| 5f4764060c | |||
| 44832008a8 | |||
| d86e737493 | |||
| 07a1e3101b | |||
| 1ebfe49916 | |||
| b1d6f8d652 | |||
| 8f0edf90e6 | |||
| 7c77389550 | |||
| 637731a4d7 | |||
| 6fc98a025b | |||
| f123cbcce3 | |||
| 11f166525e | |||
| 68db498dfd | |||
| f914afcc53 | |||
| 8dcf75f3fb | |||
| 3d9e091882 | |||
| a9ca4b3272 | |||
| 35798a7916 | |||
| f7000b51a7 | |||
| 66faaab294 | |||
| 7be2a5a507 | |||
| 8cf26de5e2 | |||
| f2a11a5894 | |||
| c6043d4428 | |||
| c37ba28ad3 | |||
| 53f810fc54 | |||
| a55875ae1e | |||
| 707a634823 | |||
| b511fa872a | |||
| 4a2e7d9a9e | |||
| e4d5de2c0e | |||
| 50dca2e2c0 | |||
| 893303c27f | |||
| b543392c62 | |||
| adf52c756e | |||
| 693cc5a951 | |||
| ff9ba7fbf1 | |||
| c2b87959a2 | |||
| 18ee7776ef | |||
| c99efda67a | |||
| d65f970255 | |||
| f5442a8a89 | |||
| e347ea36ce | |||
| f0651dabf0 | |||
| ccf85c1c0f | |||
| 6ea35bf55c | |||
| f6afde346a | |||
| ce4074bcce | |||
| 5697b58aa2 | |||
| d5e6301211 | |||
| 9048082cb7 | |||
| 56e46466b2 | |||
| fa9731ab57 | |||
| c2ba46ce85 | |||
| 4c5780f1d6 | |||
| 0419611a62 | |||
| bcc1011ddd | |||
| 91a4fe1e52 | |||
| 21fed8a81e | |||
| f2fc63c24f | |||
| 521608fa15 | |||
| e16ad4e53d | |||
| 7205e383c8 | |||
| 9bf317b3e0 | |||
| ac668a41c5 | |||
| 606f4255dc | |||
| 22a64dd932 | |||
| dd3255779f | |||
| 89c7e63ab8 | |||
| 447c604fe9 | |||
| dff9602852 | |||
| f4d7915dd6 | |||
| 01204d544e | |||
| a06aa8c8b3 | |||
| 7977427038 | |||
| 0b8d0ed10a | |||
| efec141039 | |||
| 6736555ff3 | |||
| d94fe30a3e | |||
| 3079320534 | |||
| 4f3af51e54 | |||
| d19c81c944 | |||
| bc3cbbbb82 | |||
| 8ee3ddc925 | |||
| 173c05dbf3 | |||
| b13c548c4d | |||
| ef8237adfd | |||
| c80379da31 | |||
| a54c43c0c2 | |||
| 5e524aa148 | |||
| e84ee9e01b | |||
| 27ceb1e6c6 | |||
| 508b0d913c | |||
| 5999b070dc | |||
| 3ed13f3975 | |||
| 1789f7c9fd | |||
| a05ea11dd7 | |||
| c6dd46a004 | |||
| bf04979c31 | |||
| e9274b7303 | |||
| 03022c5b45 | |||
| ce4ccdd5b0 | |||
| 07eba65458 | |||
| 072b082240 | |||
| c664bc4ee9 | |||
| f113d7eeb1 | |||
| 9409bf0785 | |||
| d51e724130 | |||
| 9489b4dcde | |||
| d9c139a42b | |||
| 534f1d8284 | |||
| f177af8791 |
24
.gitmodules
vendored
24
.gitmodules
vendored
@ -1,15 +1,7 @@
|
||||
[submodule "web/documentserver-example/nodejs/public/assets"]
|
||||
path = web/documentserver-example/nodejs/public/assets
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
branch = main/en
|
||||
[submodule "web/documentserver-example/java/src/main/resources/assets"]
|
||||
path = web/documentserver-example/java/src/main/resources/assets
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
branch = main/en
|
||||
[submodule "web/documentserver-example/php/assets"]
|
||||
path = web/documentserver-example/php/assets
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
branch = main/en
|
||||
[submodule "web/documentserver-example/python/assets"]
|
||||
path = web/documentserver-example/python/assets
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
@ -30,3 +22,19 @@
|
||||
path = web/documentserver-example/java-spring/src/main/resources/assets
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
branch = main/en
|
||||
[submodule "web/documentserver-example/nodejs/public/assets/document-templates"]
|
||||
path = web/documentserver-example/nodejs/public/assets/document-templates
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
branch = main/en
|
||||
[submodule "web/documentserver-example/nodejs/public/assets/document-formats"]
|
||||
path = web/documentserver-example/nodejs/public/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
branch = master
|
||||
[submodule "web/documentserver-example/php/assets/document-templates"]
|
||||
path = web/documentserver-example/php/assets/document-templates
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
branch = main/en
|
||||
[submodule "web/documentserver-example/php/assets/document-formats"]
|
||||
path = web/documentserver-example/php/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
branch = master
|
||||
|
||||
@ -3,10 +3,6 @@ Document Server integration example uses code from the following 3rd party proje
|
||||
|
||||
web/documentserver-example/csharp
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -19,14 +15,26 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.UI.license
|
||||
|
||||
JWT - JWT (JSON Web Token) Implementation for .NET (Public Domain) (https://github.com/jwt-dotnet/jwt/)
|
||||
License: MIT
|
||||
License File: JWT.license
|
||||
|
||||
Newtonsoft.Json - Json.NET is a popular high-performance JSON framework for .NET (https://github.com/JamesNK/Newtonsoft.Json)
|
||||
License: MIT
|
||||
License File: Newtonsoft.Json.license
|
||||
|
||||
|
||||
web/documentserver-example/csharp-mvc
|
||||
|
||||
@ -34,10 +42,6 @@ Entity Framework - Entity Framework is an object-relational mapper that enables
|
||||
License: MICROSOFT SOFTWARE SUPPLEMENTAL TERMS, MICROSOFT SOFTWARE LICENSE TERMS
|
||||
License File: EntityFramework.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -50,19 +54,27 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.UI.license
|
||||
|
||||
JWT - JWT (JSON Web Token) Implementation for .NET (Public Domain) (https://github.com/jwt-dotnet/jwt/)
|
||||
License: MIT
|
||||
License File: JWT.license
|
||||
|
||||
Microsoft.Web.Infrastructure - This package contains the Microsoft.Web.Infrastructure assembly that lets you dynamically register HTTP modules at run time. (https://www.microsoft.com/web/webpi/eula/aspnetmvc3update-eula.htm)
|
||||
License: MS-EULA License
|
||||
License File: Microsoft.Web.Infrastructure.license
|
||||
|
||||
Newtonsoft.Json - Json.NET is a popular high-performance JSON framework for .NET (https://licenses.nuget.org/MIT)
|
||||
Newtonsoft.Json - Json.NET is a popular high-performance JSON framework for .NET (https://github.com/JamesNK/Newtonsoft.Json)
|
||||
License: MIT
|
||||
License File: Newtonsoft.Json.license
|
||||
|
||||
@ -73,10 +85,6 @@ License File: WebGrease.license
|
||||
|
||||
web/documentserver-example/java
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -89,9 +97,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
@ -104,9 +116,17 @@ License File: prime-jwt.license
|
||||
|
||||
web/documentserver-example/java-spring
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
Gson - Gson is a Java library that can be used to convert Java Objects into their JSON representation. (https://github.com/google/gson/blob/master/LICENSE)
|
||||
License: Apache 2.0
|
||||
License File: gson.license
|
||||
|
||||
H2 Database Engine - This software contains unmodified binary redistributions for H2 database engine. H2 is a relational DBMS that can be embedded in java applications. (https://h2database.com/html/license.html)
|
||||
License: MPL 2.0 or EPL 1.0
|
||||
License File: h2database.license
|
||||
|
||||
Jackson Databind - General-purpose data-binding functionality and tree-model for Jackson Data Processor. (https://github.com/FasterXML/jackson-databind/blob/master/LICENSE)
|
||||
License: Apache 2.0
|
||||
License File: jackson-databind.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
@ -120,14 +140,30 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.UI.license
|
||||
|
||||
JSON.simple - JSON.simple is a simple Java toolkit for JSON. You can use JSON.simple to encode or decode JSON text. (https://github.com/fangyidong/json-simple/blob/master/LICENSE.txt)
|
||||
License: Apache 2.0
|
||||
License File: JSON.simple.license
|
||||
|
||||
Project Lombok - Project Lombok is a java library that automatically plugs into your editor and build tools. (https://mvnrepository.com/artifact/org.projectlombok/lombok).
|
||||
License: MIT
|
||||
License File lombok.license
|
||||
|
||||
ModelMapper - ModelMapper is an intelligent object mapping library that automatically maps objects to each other. (https://github.com/modelmapper/modelmapper)
|
||||
License: Apache 2.0
|
||||
License File modelmapper.license
|
||||
|
||||
Prime JWT - is intended to be fast and easy to use. Prime JWT has a single external dependency on Jackson. (https://github.com/ws-apps/prime-jwt/blob/master/LICENSE)
|
||||
License: Apache 2.0
|
||||
License File: prime-jwt.license
|
||||
@ -148,22 +184,6 @@ Spring Data JPA - Persist data in SQL stores with Java Persistence API using Spr
|
||||
License: Apache 2.0
|
||||
License File: spring-data-jpa.license
|
||||
|
||||
H2 Database Engine - This software contains unmodified binary redistributions for H2 database engine. H2 is a relational DBMS that can be embedded in java applications. (https://h2database.com/html/license.html)
|
||||
License: MPL 2.0 or EPL 1.0
|
||||
License File: h2database.license
|
||||
|
||||
JSON.simple - JSON.simple is a simple Java toolkit for JSON. You can use JSON.simple to encode or decode JSON text. (https://github.com/fangyidong/json-simple/blob/master/LICENSE.txt)
|
||||
License: Apache 2.0
|
||||
License File: JSON.simple.license
|
||||
|
||||
Gson - Gson is a Java library that can be used to convert Java Objects into their JSON representation. (https://github.com/google/gson/blob/master/LICENSE)
|
||||
License: Apache 2.0
|
||||
License File: gson.license
|
||||
|
||||
Jackson Databind - General-purpose data-binding functionality and tree-model for Jackson Data Processor. (https://github.com/FasterXML/jackson-databind/blob/master/LICENSE)
|
||||
License: Apache 2.0
|
||||
License File: jackson-databind.license
|
||||
|
||||
|
||||
web/documentserver-example/nodejs
|
||||
|
||||
@ -199,10 +219,6 @@ he - a robust HTML entity encoder/decoder written in JavaScript. (htt
|
||||
License: MIT
|
||||
License File: he.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -215,9 +231,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
@ -248,11 +268,8 @@ License: MIT
|
||||
License File: urllib.license
|
||||
|
||||
|
||||
web/documentserver-example/php
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
web/documentserver-example/php
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
@ -266,9 +283,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
@ -289,10 +310,6 @@ Django - Django is a high-level Python web framework that encourages rapi
|
||||
License: BSD-3-Clause
|
||||
License File: Django.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -305,52 +322,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.UI.license
|
||||
|
||||
PyJWT - A Python implementation of RFC 7519. (https://github.com/jpadilla/pyjwt/blob/master/LICENSE)
|
||||
License: MIT
|
||||
License File: PyJWT.license
|
||||
|
||||
python-magic - python-magic is a Python interface to the libmagic file type identification library. (https://github.com/ahupp/python-magic/blob/master/LICENSE)
|
||||
License: MIT
|
||||
License File: python-magic.license
|
||||
|
||||
requests - Requests allows you to send HTTP/1.1 requests extremely easily. There’s no need to manually add query strings to your URLs, or to form-encode your PUT & POST data — but nowadays, just use the json method! (https://github.com/psf/requests/blob/main/LICENSE)
|
||||
License: Apache 2.0
|
||||
License File: requests.license
|
||||
|
||||
|
||||
web/documentserver-example/python
|
||||
|
||||
Django - Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. Thanks for checking it out. (https://github.com/django/django/blob/main/LICENSE)
|
||||
License: BSD-3-Clause
|
||||
License File: Django.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
|
||||
jQuery.FileUpload - File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads. (https://github.com/blueimp/jQuery-File-Upload/blob/master/LICENSE.txt)
|
||||
License: MIT
|
||||
License File: jQuery.FileUpload.license
|
||||
|
||||
jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https://github.com/blueimp/jQuery-File-Upload/blob/master/LICENSE.txt)
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
@ -379,14 +357,14 @@ coffee-rails - CoffeeScript adapter for the Rails asset pipeline. (https://gith
|
||||
License: MIT
|
||||
License File: coffee-rails.license
|
||||
|
||||
dalli - High performance memcached client for Ruby. (https://github.com/petergoldstein/dalli/blob/v3.2.0/LICENSE)
|
||||
License: MIT
|
||||
License File: dalli.license
|
||||
|
||||
jbuilder - Create JSON structures via a Builder-style DSL (https://github.com/rails/jbuilder/blob/master/MIT-LICENSE)
|
||||
License: MIT
|
||||
License File: jbuilder.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -399,9 +377,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
@ -411,10 +393,18 @@ jquery-rails - This gem provides jQuery and the jQuery-ujs driver for your Rail
|
||||
License: MIT
|
||||
License File: jquery-rails.license
|
||||
|
||||
mimemagic - А library to detect the mime type of a file by extension or by content. (https://github.com/mimemagicrb/mimemagic/blob/master/LICENSE)
|
||||
License: MIT
|
||||
License File: mimemagic.license
|
||||
|
||||
rails - Rails is a web-application framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern. (https://github.com/rails/rails/blob/v6.0.3.2/MIT-LICENSE)
|
||||
License: MIT
|
||||
License File: rails.license
|
||||
|
||||
rubocop - A Ruby static code analyzer and formatter, based on the community Ruby style guide. (https://github.com/rubocop/rubocop/blob/v1.52.0/LICENSE.txt)
|
||||
License: MIT
|
||||
License File: rubocop.license
|
||||
|
||||
sass-rails - This gem provides official integration for Ruby on Rails projects with the Sass stylesheet language. (https://github.com/rails/sass-rails/blob/master/MIT-LICENSE)
|
||||
License: MIT
|
||||
License File: sass-rails.license
|
||||
@ -423,10 +413,18 @@ sdoc - rdoc generator html with javascript search index. (https://githu
|
||||
License: MIT
|
||||
License File: sdoc.license
|
||||
|
||||
sorbet - A fast, powerful type checker designed for Ruby. (https://github.com/sorbet/sorbet/blob/0.5.10871.20230607144259-d9000e2ba/LICENSE)
|
||||
License: Apache License 2.0
|
||||
License File: sorbet.license
|
||||
|
||||
sqlite3 - This module allows Ruby programs to interface with the SQLite3 database engine (www.sqlite.org). (https://github.com/sparklemotion/sqlite3-ruby/blob/master/LICENSE)
|
||||
License: BSD-3-Clause
|
||||
License File: sqlite3.license
|
||||
|
||||
tapioca - The swiss army knife of RBI generation. (https://github.com/Shopify/tapioca/blob/v0.11.6/LICENSE.txt)
|
||||
License: MIT
|
||||
License File: tapioca.license
|
||||
|
||||
turbolinks - Rails engine for Turbolinks 5 support (https://github.com/turbolinks/turbolinks-rails/blob/master/LICENSE)
|
||||
License: MIT
|
||||
License File: turbolinks.license
|
||||
|
||||
@ -1,5 +1,11 @@
|
||||
# Change Log
|
||||
|
||||
- php: using a repo with a list of formats
|
||||
- nodejs: using a repo with a list of formats
|
||||
- nodejs: delete file without reloading the page
|
||||
- nodejs: getting history by a separate request
|
||||
- nodejs: restore from history
|
||||
|
||||
## 1.6.0
|
||||
- nodejs: setUsers for region protection
|
||||
- si skin languages
|
||||
|
||||
@ -4,10 +4,6 @@ Entity Framework - Entity Framework is an object-relational mapper that enables
|
||||
License: MICROSOFT SOFTWARE SUPPLEMENTAL TERMS, MICROSOFT SOFTWARE LICENSE TERMS
|
||||
License File: EntityFramework.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -20,9 +16,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
|
||||
@ -4,10 +4,6 @@ Entity Framework - Entity Framework is an object-relational mapper that enables
|
||||
License: MICROSOFT SOFTWARE SUPPLEMENTAL TERMS, MICROSOFT SOFTWARE LICENSE TERMS
|
||||
License File: EntityFramework.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -20,9 +16,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
ONLYOFFICE Applications example uses code from the following 3rd party projects:
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -16,9 +12,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
ONLYOFFICE Applications example uses code from the following 3rd party projects:
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -16,9 +12,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
|
||||
@ -1,8 +1,17 @@
|
||||
ONLYOFFICE Applications example uses code from the following 3rd party projects:
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
Gson - Gson is a Java library that can be used to convert Java Objects into their JSON representation. (https://github.com/google/gson/blob/master/LICENSE)
|
||||
License: Apache 2.0
|
||||
License File: gson.license
|
||||
|
||||
H2 Database Engine - This software contains unmodified binary redistributions for H2 database engine. H2 is a relational DBMS that can be embedded in java applications. (https://h2database.com/html/license.html)
|
||||
License: MPL 2.0 or EPL 1.0
|
||||
License File: h2database.license
|
||||
|
||||
Jackson Databind - General-purpose data-binding functionality and tree-model for Jackson Data Processor. (https://github.com/FasterXML/jackson-databind/blob/master/LICENSE)
|
||||
License: Apache 2.0
|
||||
License File: jackson-databind.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
@ -16,14 +25,30 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.UI.license
|
||||
|
||||
JSON.simple - JSON.simple is a simple Java toolkit for JSON. You can use JSON.simple to encode or decode JSON text. (https://github.com/fangyidong/json-simple/blob/master/LICENSE.txt)
|
||||
License: Apache 2.0
|
||||
License File: JSON.simple.license
|
||||
|
||||
Project Lombok - Project Lombok is a java library that automatically plugs into your editor and build tools. (https://mvnrepository.com/artifact/org.projectlombok/lombok).
|
||||
License: MIT
|
||||
License File lombok.license
|
||||
|
||||
ModelMapper - ModelMapper is an intelligent object mapping library that automatically maps objects to each other. (https://github.com/modelmapper/modelmapper)
|
||||
License: Apache 2.0
|
||||
License File modelmapper.license
|
||||
|
||||
Prime JWT - is intended to be fast and easy to use. Prime JWT has a single external dependency on Jackson. (https://github.com/ws-apps/prime-jwt/blob/master/LICENSE)
|
||||
License: Apache 2.0
|
||||
License File: prime-jwt.license
|
||||
@ -43,27 +68,3 @@ License File: spring-boot.license
|
||||
Spring Data JPA - Persist data in SQL stores with Java Persistence API using Spring Data and Hibernate. (https://github.com/spring-projects/spring-data-jpa/blob/main/LICENSE.txt)
|
||||
License: Apache 2.0
|
||||
License File: spring-data-jpa.license
|
||||
|
||||
H2 Database Engine - This software contains unmodified binary redistributions for H2 database engine. H2 is a relational DBMS that can be embedded in java applications. (https://h2database.com/html/license.html)
|
||||
License: MPL 2.0 or EPL 1.0
|
||||
License File: h2database.license
|
||||
|
||||
JSON.simple - JSON.simple is a simple Java toolkit for JSON. You can use JSON.simple to encode or decode JSON text. (https://github.com/fangyidong/json-simple/blob/master/LICENSE.txt)
|
||||
License: Apache 2.0
|
||||
License File: JSON.simple.license
|
||||
|
||||
Gson - Gson is a Java library that can be used to convert Java Objects into their JSON representation. (https://github.com/google/gson/blob/master/LICENSE)
|
||||
License: Apache 2.0
|
||||
License File: gson.license
|
||||
|
||||
Jackson Databind - General-purpose data-binding functionality and tree-model for Jackson Data Processor. (https://github.com/FasterXML/jackson-databind/blob/master/LICENSE)
|
||||
License: Apache 2.0
|
||||
License File: jackson-databind.license
|
||||
|
||||
ModelMapper - ModelMapper is an intelligent object mapping library that automatically maps objects to each other. (https://github.com/modelmapper/modelmapper)
|
||||
License: Apache 2.0
|
||||
License File modelmapper.license
|
||||
|
||||
Project Lombok - Project Lombok is a java library that automatically plugs into your editor and build tools. (https://mvnrepository.com/artifact/org.projectlombok/lombok).
|
||||
License: MIT
|
||||
License File lombok.license
|
||||
|
||||
@ -1,8 +1,17 @@
|
||||
ONLYOFFICE Applications example uses code from the following 3rd party projects:
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
Gson - Gson is a Java library that can be used to convert Java Objects into their JSON representation. (https://github.com/google/gson/blob/master/LICENSE)
|
||||
License: Apache 2.0
|
||||
License File: gson.license
|
||||
|
||||
H2 Database Engine - This software contains unmodified binary redistributions for H2 database engine. H2 is a relational DBMS that can be embedded in java applications. (https://h2database.com/html/license.html)
|
||||
License: MPL 2.0 or EPL 1.0
|
||||
License File: h2database.license
|
||||
|
||||
Jackson Databind - General-purpose data-binding functionality and tree-model for Jackson Data Processor. (https://github.com/FasterXML/jackson-databind/blob/master/LICENSE)
|
||||
License: Apache 2.0
|
||||
License File: jackson-databind.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
@ -16,14 +25,30 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.UI.license
|
||||
|
||||
JSON.simple - JSON.simple is a simple Java toolkit for JSON. You can use JSON.simple to encode or decode JSON text. (https://github.com/fangyidong/json-simple/blob/master/LICENSE.txt)
|
||||
License: Apache 2.0
|
||||
License File: JSON.simple.license
|
||||
|
||||
Project Lombok - Project Lombok is a java library that automatically plugs into your editor and build tools. (https://mvnrepository.com/artifact/org.projectlombok/lombok).
|
||||
License: MIT
|
||||
License File lombok.license
|
||||
|
||||
ModelMapper - ModelMapper is an intelligent object mapping library that automatically maps objects to each other. (https://github.com/modelmapper/modelmapper)
|
||||
License: Apache 2.0
|
||||
License File modelmapper.license
|
||||
|
||||
Prime JWT - is intended to be fast and easy to use. Prime JWT has a single external dependency on Jackson. (https://github.com/ws-apps/prime-jwt/blob/master/LICENSE)
|
||||
License: Apache 2.0
|
||||
License File: prime-jwt.license
|
||||
@ -43,19 +68,3 @@ License File: spring-boot.license
|
||||
Spring Data JPA - Persist data in SQL stores with Java Persistence API using Spring Data and Hibernate. (https://github.com/spring-projects/spring-data-jpa/blob/main/LICENSE.txt)
|
||||
License: Apache 2.0
|
||||
License File: spring-data-jpa.license
|
||||
|
||||
H2 Database Engine - This software contains unmodified binary redistributions for H2 database engine. H2 is a relational DBMS that can be embedded in java applications. (https://h2database.com/html/license.html)
|
||||
License: MPL 2.0 or EPL 1.0
|
||||
License File: h2database.license
|
||||
|
||||
JSON.simple - JSON.simple is a simple Java toolkit for JSON. You can use JSON.simple to encode or decode JSON text. (https://github.com/fangyidong/json-simple/blob/master/LICENSE.txt)
|
||||
License: Apache 2.0
|
||||
License File: JSON.simple.license
|
||||
|
||||
Gson - Gson is a Java library that can be used to convert Java Objects into their JSON representation. (https://github.com/google/gson/blob/master/LICENSE)
|
||||
License: Apache 2.0
|
||||
License File: gson.license
|
||||
|
||||
Jackson Databind - General-purpose data-binding functionality and tree-model for Jackson Data Processor. (https://github.com/FasterXML/jackson-databind/blob/master/LICENSE)
|
||||
License: Apache 2.0
|
||||
License File: jackson-databind.license
|
||||
@ -1,9 +1,5 @@
|
||||
ONLYOFFICE Applications example uses code from the following 3rd party projects:
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -16,9 +12,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
ONLYOFFICE Applications example uses code from the following 3rd party projects:
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -16,9 +12,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
|
||||
@ -11,5 +11,11 @@ module.exports = {
|
||||
ecmaVersion: 'latest',
|
||||
},
|
||||
rules: {
|
||||
'max-len': ['error', { code: 120 }],
|
||||
'no-console': 'off',
|
||||
'no-continue': 'off',
|
||||
'no-extend-native': ['error', { exceptions: ['String'] }],
|
||||
'no-plusplus': ['error', { allowForLoopAfterthoughts: true }],
|
||||
'no-prototype-builtins': 'off',
|
||||
},
|
||||
};
|
||||
|
||||
@ -32,10 +32,6 @@ he - a robust HTML entity encoder/decoder written in JavaScript. (htt
|
||||
License: MIT
|
||||
License File: he.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -48,9 +44,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -22,10 +22,6 @@
|
||||
"apiUrl": "web-apps/apps/api/documents/api.js",
|
||||
"preloaderUrl": "web-apps/apps/api/documents/cache-scripts.html",
|
||||
"exampleUrl": null,
|
||||
"viewedDocs": [".djvu", ".oxps", ".pdf", ".xps"],
|
||||
"editedDocs": [".csv", ".docm", ".docx", ".docxf", ".dotm", ".dotx", ".epub", ".fb2", ".html", ".odp", ".ods", ".odt", ".otp", ".ots", ".ott", ".potm", ".potx", ".ppsm", ".ppsx", ".pptm", ".pptx", ".rtf", ".txt", ".xlsm", ".xlsx", ".xltm", ".xltx"],
|
||||
"fillDocs": [".docx", ".oform"],
|
||||
"convertedDocs": [".doc", ".dot", ".dps", ".dpt", ".epub", ".et", ".ett", ".fb2", ".fodp", ".fods", ".fodt", ".htm", ".html", ".mht", ".mhtml", ".odp", ".ods", ".odt", ".otp", ".ots", ".ott", ".pot", ".pps", ".ppt", ".rtf", ".stw", ".sxc", ".sxi", ".sxw", ".wps", ".wpt", ".xls", ".xlsb", ".xlt", ".xml"],
|
||||
"storageFolder": "./files",
|
||||
"storagePath": "/files",
|
||||
"maxFileSize": 1073741824,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2023
|
||||
*
|
||||
@ -16,42 +16,43 @@
|
||||
*
|
||||
*/
|
||||
|
||||
var cache = {};
|
||||
let cache = {};
|
||||
|
||||
// write the key value and its creation time to the cache
|
||||
exports.put = function (key, value) {
|
||||
cache[key] = { value:value, time: new Date().getTime()};
|
||||
}
|
||||
exports.put = function put(key, value) {
|
||||
cache[key] = { value, time: new Date().getTime() };
|
||||
};
|
||||
|
||||
// check if the given key is in the cache
|
||||
exports.containsKey = function (key) {
|
||||
if (typeof cache[key] == "undefined"){
|
||||
return false;
|
||||
}
|
||||
exports.containsKey = function containsKey(key) {
|
||||
if (typeof cache[key] === 'undefined') {
|
||||
return false;
|
||||
}
|
||||
|
||||
var secondsCache = 30;
|
||||
const secondsCache = 30;
|
||||
|
||||
var t1 = new Date(cache[key].time + (1000 * secondsCache)); // get the creation time of the given key and add 30 seconds to it
|
||||
var t2 = new Date(); // get the current time
|
||||
if (t1 < t2 ){ // if the current time is greater
|
||||
delete cache[key]; // delete the given key from the cache
|
||||
return false;
|
||||
}
|
||||
// get the creation time of the given key and add 30 seconds to it
|
||||
const t1 = new Date(cache[key].time + (1000 * secondsCache));
|
||||
const t2 = new Date(); // get the current time
|
||||
if (t1 < t2) { // if the current time is greater
|
||||
delete cache[key]; // delete the given key from the cache
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
// get the given key from the cache
|
||||
exports.get = function (key) {
|
||||
return cache[key];
|
||||
}
|
||||
exports.get = function get(key) {
|
||||
return cache[key];
|
||||
};
|
||||
|
||||
// delete the given key from the cache
|
||||
exports.delete = function (key) {
|
||||
delete cache[key];
|
||||
}
|
||||
exports.delete = function deleteKey(key) {
|
||||
delete cache[key];
|
||||
};
|
||||
|
||||
// clear the cache
|
||||
exports.clear = function () {
|
||||
cache = {};
|
||||
}
|
||||
exports.clear = function clear() {
|
||||
cache = {};
|
||||
};
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2023
|
||||
@ -17,488 +16,596 @@
|
||||
*
|
||||
*/
|
||||
|
||||
const path = require("path");
|
||||
const fileSystem = require("fs");
|
||||
const fileUtility = require("./fileUtility");
|
||||
const documentService = require("./documentService");
|
||||
const path = require('path');
|
||||
const fileSystem = require('fs');
|
||||
const configServer = require('config').get('server');
|
||||
const storageConfigFolder = configServer.get("storageFolder");
|
||||
const fileUtility = require('./fileUtility');
|
||||
const documentService = require('./documentService');
|
||||
|
||||
function docManager(req, res) {
|
||||
this.req = req;
|
||||
this.res = res;
|
||||
}
|
||||
const storageConfigFolder = configServer.get('storageFolder');
|
||||
|
||||
const DocManager = function DocManager(req, res) {
|
||||
this.req = req;
|
||||
this.res = res;
|
||||
};
|
||||
|
||||
// check if the path exists or not
|
||||
docManager.prototype.existsSync = function(path) {
|
||||
let res = true;
|
||||
try {
|
||||
fileSystem.accessSync(path, fileSystem.F_OK); // synchronously test the user's permissions for the directory specified by path; the directory is visible to the calling process
|
||||
} catch (e) { // the response is set to false, if an error occurs
|
||||
res = false;
|
||||
}
|
||||
return res;
|
||||
DocManager.prototype.existsSync = function existsSync(directory) {
|
||||
let res = true;
|
||||
try {
|
||||
// synchronously test the user's permissions for the directory specified by path;
|
||||
// the directory is visible to the calling process
|
||||
fileSystem.accessSync(directory, fileSystem.F_OK);
|
||||
} catch (e) { // the response is set to false, if an error occurs
|
||||
res = false;
|
||||
}
|
||||
return res;
|
||||
};
|
||||
|
||||
// create a new directory if it doesn't exist
|
||||
docManager.prototype.createDirectory = function(path) {
|
||||
if (!this.existsSync(path)) {
|
||||
fileSystem.mkdirSync(path);
|
||||
}
|
||||
DocManager.prototype.createDirectory = function createDirectory(directory) {
|
||||
if (!this.existsSync(directory)) {
|
||||
fileSystem.mkdirSync(directory);
|
||||
}
|
||||
};
|
||||
|
||||
// get the language from the request
|
||||
docManager.prototype.getLang = function () {
|
||||
if (new RegExp("^[a-z]{2}(-[A-Z]{2})?$", "i").test(this.req.query.lang)) {
|
||||
return this.req.query.lang;
|
||||
} else { // the default language value is English
|
||||
return "en"
|
||||
}
|
||||
DocManager.prototype.getLang = function getLang() {
|
||||
if (/^[a-z]{2}(-[A-Z]{2})?$/i.test(this.req.query.lang)) {
|
||||
return this.req.query.lang;
|
||||
} // the default language value is English
|
||||
return 'en';
|
||||
};
|
||||
|
||||
// get customization parameters
|
||||
docManager.prototype.getCustomParams = function () {
|
||||
let params = "";
|
||||
DocManager.prototype.getCustomParams = function getCustomParams() {
|
||||
let params = '';
|
||||
|
||||
const userid = this.req.query.userid; // user id
|
||||
params += (userid ? "&userid=" + userid : "");
|
||||
const { userid } = this.req.query; // user id
|
||||
params += (userid ? `&userid=${userid}` : '');
|
||||
|
||||
const lang = this.req.query.lang; // language
|
||||
params += (lang ? "&lang=" + this.getLang() : "");
|
||||
const { lang } = this.req.query; // language
|
||||
params += (lang ? `&lang=${this.getLang()}` : '');
|
||||
|
||||
const directUrl = this.req.query.directUrl; // directUrl
|
||||
params += (directUrl ? "&directUrl=" + (directUrl == "true") : "");
|
||||
const { directUrl } = this.req.query; // directUrl
|
||||
params += (directUrl ? `&directUrl=${directUrl === 'true'}` : '');
|
||||
|
||||
const fileName = this.req.query.fileName; // file name
|
||||
params += (fileName ? "&fileName=" + fileName : "");
|
||||
const { fileName } = this.req.query; // file name
|
||||
params += (fileName ? `&fileName=${fileName}` : '');
|
||||
|
||||
const mode = this.req.query.mode; // mode: view/edit/review/comment/fillForms/embedded
|
||||
params += (mode ? "&mode=" + mode : "");
|
||||
const { mode } = this.req.query; // mode: view/edit/review/comment/fillForms/embedded
|
||||
params += (mode ? `&mode=${mode}` : '');
|
||||
|
||||
const type = this.req.query.type; // type: embedded/mobile/desktop
|
||||
params += (type ? "&type=" + type : "");
|
||||
const { type } = this.req.query; // type: embedded/mobile/desktop
|
||||
params += (type ? `&type=${type}` : '');
|
||||
|
||||
return params;
|
||||
return params;
|
||||
};
|
||||
|
||||
// get the correct file name if such a name already exists
|
||||
docManager.prototype.getCorrectName = function (fileName, userAddress) {
|
||||
const baseName = fileUtility.getFileName(fileName, true); // get file name from the url without extension
|
||||
const ext = fileUtility.getFileExtension(fileName); // get file extension from the url
|
||||
let name = baseName + ext; // get full file name
|
||||
let index = 1;
|
||||
DocManager.prototype.getCorrectName = function getCorrectName(fileName, userAddress) {
|
||||
const baseName = fileUtility.getFileName(fileName, true); // get file name from the url without extension
|
||||
const ext = fileUtility.getFileExtension(fileName); // get file extension from the url
|
||||
let name = baseName + ext; // get full file name
|
||||
let index = 1;
|
||||
|
||||
while (this.existsSync(this.storagePath(name, userAddress))) { // if the file with such a name already exists in this directory
|
||||
name = baseName + " (" + index + ")" + ext; // add an index after its base name
|
||||
index++;
|
||||
}
|
||||
// if the file with such a name already exists in this directory
|
||||
while (this.existsSync(this.storagePath(name, userAddress))) {
|
||||
name = `${baseName} (${index})${ext}`; // add an index after its base name
|
||||
index += 1;
|
||||
}
|
||||
|
||||
return name;
|
||||
return name;
|
||||
};
|
||||
|
||||
// processes a request editnew
|
||||
docManager.prototype.RequestEditnew = function (req, fileName, user) {
|
||||
if (req.params['id'] != fileName){ // processes a repeated request editnew
|
||||
this.fileRemove(req.params['id']);
|
||||
fileName = this.getCorrectName(req.params['id']);
|
||||
}
|
||||
this.fileSizeZero(fileName);
|
||||
this.saveFileData(fileName, user.id, user.name);
|
||||
DocManager.prototype.requestEditnew = function requestEditnew(req, fileName, user) {
|
||||
let correctName = fileName;
|
||||
if (req.params.id !== fileName) { // processes a repeated request editnew
|
||||
this.fileRemove(req.params.id);
|
||||
correctName = this.getCorrectName(req.params.id);
|
||||
}
|
||||
this.fileSizeZero(correctName);
|
||||
this.saveFileData(correctName, user.id, user.name);
|
||||
|
||||
return fileName;
|
||||
}
|
||||
return correctName;
|
||||
};
|
||||
|
||||
// delete a file with its history
|
||||
docManager.prototype.fileRemove = function (fileName) {
|
||||
const filePath = this.storagePath(fileName); // get the path to this file
|
||||
fileSystem.unlinkSync(filePath); // and delete it
|
||||
DocManager.prototype.fileRemove = function fileRemove(fileName) {
|
||||
const filePath = this.storagePath(fileName); // get the path to this file
|
||||
fileSystem.unlinkSync(filePath); // and delete it
|
||||
|
||||
const userAddress = this.curUserHostAddress();
|
||||
const historyPath = this.historyPath(fileName, userAddress, true);
|
||||
this.cleanFolderRecursive(historyPath, true); // clean all the files from the history folder
|
||||
}
|
||||
const userAddress = this.curUserHostAddress();
|
||||
const historyPath = this.historyPath(fileName, userAddress, true);
|
||||
this.cleanFolderRecursive(historyPath, true); // clean all the files from the history folder
|
||||
};
|
||||
|
||||
// create a zero-size file
|
||||
docManager.prototype.fileSizeZero = function (fileName) {
|
||||
var path = this.storagePath(fileName);
|
||||
var fh = fileSystem.openSync(path, 'w');
|
||||
fileSystem.closeSync(fh);
|
||||
}
|
||||
DocManager.prototype.fileSizeZero = function fileSizeZero(fileName) {
|
||||
const storagePath = this.storagePath(fileName);
|
||||
const fh = fileSystem.openSync(storagePath, 'w');
|
||||
fileSystem.closeSync(fh);
|
||||
};
|
||||
|
||||
// create demo document
|
||||
docManager.prototype.createDemo = function (isSample, fileExt, userid, username, wopi) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
DocManager.prototype.createDemo = function createDemo(isSample, fileExt, userid, username, wopi) {
|
||||
const demoName = `${isSample ? 'sample' : 'new'}.${fileExt}`;
|
||||
const fileName = this.getCorrectName(demoName); // get the correct file name if such a name already exists
|
||||
|
||||
const demoName = (isSample ? "sample" : "new") + "." + fileExt;
|
||||
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));
|
||||
|
||||
this.copyFile(path.join(__dirname, "..","public", "assets", isSample ? "sample" : "new", demoName), this.storagePath(fileName)); // copy sample document of a necessary extension to the storage path
|
||||
this.saveFileData(fileName, userid, username); // save file data to the file
|
||||
|
||||
this.saveFileData(fileName, userid, username); // save file data to the file
|
||||
|
||||
return fileName;
|
||||
return fileName;
|
||||
};
|
||||
|
||||
// save file data to the file
|
||||
docManager.prototype.saveFileData = function (fileName, userid, username, userAddress) {
|
||||
if (!userAddress) {
|
||||
userAddress = this.curUserHostAddress(); // get current user host address
|
||||
}
|
||||
// get full creation date of the document
|
||||
const date_create = fileSystem.statSync(this.storagePath(fileName, userAddress)).mtime;
|
||||
const minutes = (date_create.getMinutes() < 10 ? '0' : '') + date_create.getMinutes().toString();
|
||||
const month = (date_create.getMonth() < 10 ? '0' : '') + (parseInt(date_create.getMonth().toString()) + 1);
|
||||
const sec = (date_create.getSeconds() < 10 ? '0' : '') + date_create.getSeconds().toString();
|
||||
const date_format = date_create.getFullYear() + "-" + month + "-" + date_create.getDate() + " " + date_create.getHours() + ":" + minutes + ":" + sec;
|
||||
DocManager.prototype.saveFileData = function saveFileData(fileName, userid, username, userAddress) {
|
||||
let address = userAddress;
|
||||
if (!address) {
|
||||
address = this.curUserHostAddress(); // get current user host address
|
||||
}
|
||||
// get full creation date of the document
|
||||
const dateCreate = fileSystem.statSync(this.storagePath(fileName, address)).mtime;
|
||||
const minutes = (dateCreate.getMinutes() < 10 ? '0' : '') + dateCreate.getMinutes().toString();
|
||||
const month = (dateCreate.getMonth() < 10 ? '0' : '') + (parseInt(dateCreate.getMonth().toString(), 10) + 1);
|
||||
const sec = (dateCreate.getSeconds() < 10 ? '0' : '') + dateCreate.getSeconds().toString();
|
||||
const dateFormat = `${dateCreate.getFullYear()}-${month}-${dateCreate.getDate()}`
|
||||
+ `${dateCreate.getHours()}:${minutes}:${sec}`;
|
||||
|
||||
const file_info = this.historyPath(fileName, userAddress, true); // get file history information
|
||||
this.createDirectory(file_info); // create a new history directory if it doesn't exist
|
||||
const fileInfo = this.historyPath(fileName, address, true); // get file history information
|
||||
this.createDirectory(fileInfo); // create a new history directory if it doesn't exist
|
||||
|
||||
fileSystem.writeFileSync(path.join(file_info, fileName + ".txt"), date_format + "," + userid + "," + username); // write all the file information to a new txt file
|
||||
// write all the file information to a new txt file
|
||||
fileSystem.writeFileSync(path.join(fileInfo, `${fileName}.txt`), `${dateFormat},${userid},${username}`);
|
||||
};
|
||||
|
||||
// get file data
|
||||
docManager.prototype.getFileData = function (fileName, userAddress) {
|
||||
const history = path.join(this.historyPath(fileName, userAddress, true), fileName + ".txt"); // get the path to the file with file information
|
||||
if (!this.existsSync(history)) { // if such a file doesn't exist
|
||||
return ["2017-01-01", "uid-1", "John Smith"]; // return default information
|
||||
}
|
||||
DocManager.prototype.getFileData = function getFileData(fileName, userAddress) {
|
||||
// get the path to the file with file information
|
||||
const history = path.join(this.historyPath(fileName, userAddress, true), `${fileName}.txt`);
|
||||
if (!this.existsSync(history)) { // if such a file doesn't exist
|
||||
return ['2017-01-01', 'uid-1', 'John Smith']; // return default information
|
||||
}
|
||||
|
||||
return ((fileSystem.readFileSync(history)).toString()).split(",");
|
||||
return ((fileSystem.readFileSync(history)).toString())
|
||||
.split(',');
|
||||
};
|
||||
|
||||
// get server url
|
||||
docManager.prototype.getServerUrl = function (forDocumentServer) {
|
||||
return (forDocumentServer && !!configServer.get("exampleUrl")) ? configServer.get("exampleUrl") : this.getServerPath();
|
||||
DocManager.prototype.getServerUrl = function getServerUrl(forDocumentServer) {
|
||||
return (forDocumentServer && !!configServer.get('exampleUrl'))
|
||||
? configServer.get('exampleUrl') : this.getServerPath();
|
||||
};
|
||||
|
||||
// get server address from the request
|
||||
docManager.prototype.getServerPath = function () {
|
||||
return this.getServerHost() + (this.req.headers["x-forwarded-path"] || this.req.baseUrl);
|
||||
DocManager.prototype.getServerPath = function getServerPath() {
|
||||
return this.getServerHost() + (this.req.headers['x-forwarded-path'] || this.req.baseUrl);
|
||||
};
|
||||
|
||||
// get host address from the request
|
||||
docManager.prototype.getServerHost = function () {
|
||||
return this.getProtocol() + "://" + (this.req.headers["x-forwarded-host"] || this.req.headers["host"]) + (this.req.headers["x-forwarded-prefix"] || "");
|
||||
DocManager.prototype.getServerHost = function getServerHost() {
|
||||
return `${this.getProtocol()}://${this.req.headers['x-forwarded-host'] || this.req.headers.host}`
|
||||
+ `${this.req.headers['x-forwarded-prefix'] || ''}`;
|
||||
};
|
||||
|
||||
// get protocol from the request
|
||||
docManager.prototype.getProtocol = function () {
|
||||
return this.req.headers["x-forwarded-proto"] || this.req.protocol;
|
||||
DocManager.prototype.getProtocol = function getProtocol() {
|
||||
return this.req.headers['x-forwarded-proto'] || this.req.protocol;
|
||||
};
|
||||
|
||||
// get callback url
|
||||
docManager.prototype.getCallback = function (fileName) {
|
||||
const server = this.getServerUrl(true);
|
||||
const hostAddress = this.curUserHostAddress();
|
||||
const handler = "/track?filename=" + encodeURIComponent(fileName) + "&useraddress=" + encodeURIComponent(hostAddress); // get callback handler
|
||||
DocManager.prototype.getCallback = function getCallback(fileName) {
|
||||
const server = this.getServerUrl(true);
|
||||
const hostAddress = this.curUserHostAddress();
|
||||
// get callback handler
|
||||
const handler = `/track?filename=${encodeURIComponent(fileName)}&useraddress=${encodeURIComponent(hostAddress)}`;
|
||||
|
||||
return server + handler;
|
||||
return server + handler;
|
||||
};
|
||||
|
||||
// get url to the created file
|
||||
docManager.prototype.getCreateUrl = function (docType, userid, type, lang) {
|
||||
const server = this.getServerUrl();
|
||||
var ext = this.getInternalExtension(docType).replace(".", "");
|
||||
const handler = "/editor?fileExt=" + ext + "&userid=" + userid + "&type=" + type + "&lang=" + lang;
|
||||
DocManager.prototype.getCreateUrl = function getCreateUrl(docType, userid, type, lang) {
|
||||
const server = this.getServerUrl();
|
||||
const ext = this.getInternalExtension(docType).replace('.', '');
|
||||
const handler = `/editor?fileExt=${ext}&userid=${userid}&type=${type}&lang=${lang}`;
|
||||
|
||||
return server + handler;
|
||||
}
|
||||
|
||||
// get url to download a file
|
||||
docManager.prototype.getDownloadUrl = function (fileName, forDocumentServer) {
|
||||
const server = this.getServerUrl(forDocumentServer);
|
||||
var handler = "/download?fileName=" + encodeURIComponent(fileName);
|
||||
if (forDocumentServer) {
|
||||
const hostAddress = this.curUserHostAddress();
|
||||
handler += "&useraddress=" + encodeURIComponent(hostAddress);
|
||||
}
|
||||
|
||||
return server + handler;
|
||||
return server + handler;
|
||||
};
|
||||
|
||||
docManager.prototype.storageRootPath = function (userAddress) {
|
||||
return path.join(storageConfigFolder, this.curUserHostAddress(userAddress)); // get the path to the directory for the host address
|
||||
}
|
||||
// get url to download a file
|
||||
DocManager.prototype.getDownloadUrl = function getDownloadUrl(fileName, forDocumentServer) {
|
||||
const server = this.getServerUrl(forDocumentServer);
|
||||
let handler = `/download?fileName=${encodeURIComponent(fileName)}`;
|
||||
if (forDocumentServer) {
|
||||
const hostAddress = this.curUserHostAddress();
|
||||
handler += `&useraddress=${encodeURIComponent(hostAddress)}`;
|
||||
}
|
||||
|
||||
return server + handler;
|
||||
};
|
||||
|
||||
DocManager.prototype.storageRootPath = function storageRootPath(userAddress) {
|
||||
// get the path to the directory for the host address
|
||||
return path.join(storageConfigFolder, this.curUserHostAddress(userAddress));
|
||||
};
|
||||
|
||||
// get the storage path of the given file
|
||||
docManager.prototype.storagePath = function (fileName, userAddress) {
|
||||
fileName = fileUtility.getFileName(fileName); // get the file name with extension
|
||||
const directory = this.storageRootPath(userAddress);
|
||||
this.createDirectory(directory); // create a new directory if it doesn't exist
|
||||
return path.join(directory, fileName); // put the given file to this directory
|
||||
DocManager.prototype.storagePath = function storagePath(fileName, userAddress) {
|
||||
const fileNameExt = fileUtility.getFileName(fileName); // get the file name with extension
|
||||
const directory = this.storageRootPath(userAddress);
|
||||
this.createDirectory(directory); // create a new directory if it doesn't exist
|
||||
return path.join(directory, fileNameExt); // put the given file to this directory
|
||||
};
|
||||
|
||||
// get the path to the forcesaved file version
|
||||
docManager.prototype.forcesavePath = function (fileName, userAddress, create) {
|
||||
let directory = this.storageRootPath(userAddress);
|
||||
if (!this.existsSync(directory)) { // the directory with host address doesn't exist
|
||||
return "";
|
||||
}
|
||||
directory = path.join(directory, fileName + "-history"); // get the path to the history of the given file
|
||||
if (!create && !this.existsSync(directory)) { // the history directory doesn't exist and we are not supposed to create it
|
||||
return "";
|
||||
}
|
||||
this.createDirectory(directory); // create history directory if it doesn't exist
|
||||
directory = path.join(directory, fileName); // and get the path to the given file
|
||||
if (!create && !this.existsSync(directory)) {
|
||||
return "";
|
||||
}
|
||||
return directory;
|
||||
DocManager.prototype.forcesavePath = function forcesavePath(fileName, userAddress, create) {
|
||||
let directory = this.storageRootPath(userAddress);
|
||||
if (!this.existsSync(directory)) { // the directory with host address doesn't exist
|
||||
return '';
|
||||
}
|
||||
directory = path.join(directory, `${fileName}-history`); // get the path to the history of the given file
|
||||
// the history directory doesn't exist and we are not supposed to create it
|
||||
if (!create && !this.existsSync(directory)) {
|
||||
return '';
|
||||
}
|
||||
this.createDirectory(directory); // create history directory if it doesn't exist
|
||||
directory = path.join(directory, fileName); // and get the path to the given file
|
||||
if (!create && !this.existsSync(directory)) {
|
||||
return '';
|
||||
}
|
||||
return directory;
|
||||
};
|
||||
|
||||
// create the path to the file history
|
||||
docManager.prototype.historyPath = function (fileName, userAddress, create) {
|
||||
let directory = this.storageRootPath(userAddress);
|
||||
if (!this.existsSync(directory)) {
|
||||
return "";
|
||||
}
|
||||
directory = path.join(directory, fileName + "-history");
|
||||
if (!create && !this.existsSync(path.join(directory, "1"))) {
|
||||
return "";
|
||||
}
|
||||
return directory;
|
||||
DocManager.prototype.historyPath = function historyPath(fileName, userAddress, create) {
|
||||
let directory = this.storageRootPath(userAddress);
|
||||
if (!this.existsSync(directory)) {
|
||||
return '';
|
||||
}
|
||||
directory = path.join(directory, `${fileName}-history`);
|
||||
if (!create && !this.existsSync(path.join(directory, '1'))) {
|
||||
return '';
|
||||
}
|
||||
return directory;
|
||||
};
|
||||
|
||||
// get the path to the specified file version
|
||||
docManager.prototype.versionPath = function (fileName, userAddress, version) {
|
||||
const historyPath = this.historyPath(fileName, userAddress, true); // get the path to the history of a given file or create it if it doesn't exist
|
||||
return path.join(historyPath, "" + version);
|
||||
DocManager.prototype.versionPath = function versionPath(fileName, userAddress, version) {
|
||||
// get the path to the history of a given file or create it if it doesn't exist
|
||||
const historyPath = this.historyPath(fileName, userAddress, true);
|
||||
return path.join(historyPath, `${version}`);
|
||||
};
|
||||
|
||||
// get the path to the previous file version
|
||||
docManager.prototype.prevFilePath = function (fileName, userAddress, version) {
|
||||
return path.join(this.versionPath(fileName, userAddress, version), "prev" + fileUtility.getFileExtension(fileName));
|
||||
DocManager.prototype.prevFilePath = function prevFilePath(fileName, userAddress, version) {
|
||||
return path.join(this.versionPath(fileName, userAddress, version), `prev${fileUtility.getFileExtension(fileName)}`);
|
||||
};
|
||||
|
||||
// get the path to the file with document versions differences
|
||||
docManager.prototype.diffPath = function (fileName, userAddress, version) {
|
||||
return path.join(this.versionPath(fileName, userAddress, version), "diff.zip");
|
||||
DocManager.prototype.diffPath = function diffPath(fileName, userAddress, version) {
|
||||
return path.join(this.versionPath(fileName, userAddress, version), 'diff.zip');
|
||||
};
|
||||
|
||||
// get the path to the file with document changes
|
||||
docManager.prototype.changesPath = function (fileName, userAddress, version) {
|
||||
return path.join(this.versionPath(fileName, userAddress, version), "changes.txt");
|
||||
DocManager.prototype.changesPath = function changesPath(fileName, userAddress, version) {
|
||||
return path.join(this.versionPath(fileName, userAddress, version), 'changes.txt');
|
||||
};
|
||||
|
||||
// get the path to the file with key value in it
|
||||
docManager.prototype.keyPath = function (fileName, userAddress, version) {
|
||||
return path.join(this.versionPath(fileName, userAddress, version), "key.txt");
|
||||
DocManager.prototype.keyPath = function keyPath(fileName, userAddress, version) {
|
||||
return path.join(this.versionPath(fileName, userAddress, version), 'key.txt');
|
||||
};
|
||||
|
||||
// get the path to the file with the user information
|
||||
docManager.prototype.changesUser = function (fileName, userAddress, version) {
|
||||
return path.join(this.versionPath(fileName, userAddress, version), "user.txt");
|
||||
DocManager.prototype.changesUser = function changesUser(fileName, userAddress, version) {
|
||||
return path.join(this.versionPath(fileName, userAddress, version), 'user.txt');
|
||||
};
|
||||
|
||||
// get all the stored files
|
||||
docManager.prototype.getStoredFiles = function () {
|
||||
const userAddress = this.curUserHostAddress();
|
||||
const directory = this.storageRootPath(userAddress);
|
||||
this.createDirectory(directory);
|
||||
const result = [];
|
||||
const storedFiles = fileSystem.readdirSync(directory); // read the user host directory contents
|
||||
for (let i = 0; i < storedFiles.length; i++) { // run through all the elements from the folder
|
||||
const stats = fileSystem.lstatSync(path.join(directory, storedFiles[i])); // save element parameters
|
||||
DocManager.prototype.getStoredFiles = function getStoredFiles() {
|
||||
const userAddress = this.curUserHostAddress();
|
||||
const directory = this.storageRootPath(userAddress);
|
||||
this.createDirectory(directory);
|
||||
const result = [];
|
||||
const storedFiles = fileSystem.readdirSync(directory); // read the user host directory contents
|
||||
for (let i = 0; i < storedFiles.length; i++) { // run through all the elements from the folder
|
||||
const stats = fileSystem.lstatSync(path.join(directory, storedFiles[i])); // save element parameters
|
||||
|
||||
if (!stats.isDirectory()) { // if the element isn't a directory
|
||||
let historyPath = this.historyPath(storedFiles[i], userAddress); // get the path to the file history
|
||||
let version = 0;
|
||||
if (historyPath != "") { // if the history path exists
|
||||
version = this.countVersion(historyPath); // get the last file version
|
||||
}
|
||||
if (!stats.isDirectory()) { // if the element isn't a directory
|
||||
const historyPath = this.historyPath(storedFiles[i], userAddress); // get the path to the file history
|
||||
let version = 0;
|
||||
if (historyPath !== '') { // if the history path exists
|
||||
version = this.countVersion(historyPath); // get the last file version
|
||||
}
|
||||
|
||||
const time = stats.mtime.getTime(); // get the time of element modification
|
||||
const item = { // create an object with element data
|
||||
time: time,
|
||||
name: storedFiles[i],
|
||||
documentType: fileUtility.getFileType(storedFiles[i]),
|
||||
canEdit: configServer.get("editedDocs").indexOf(fileUtility.getFileExtension(storedFiles[i])) != -1,
|
||||
version: version+1
|
||||
};
|
||||
const time = stats.mtime.getTime(); // get the time of element modification
|
||||
const item = { // create an object with element data
|
||||
time,
|
||||
name: storedFiles[i],
|
||||
documentType: fileUtility.getFileType(storedFiles[i]),
|
||||
canEdit: fileUtility.getEditExtensions().indexOf(fileUtility.getFileExtension(storedFiles[i], true)) !== -1,
|
||||
version: version + 1,
|
||||
};
|
||||
|
||||
if (!result.length) { // if the result array is empty
|
||||
result.push(item); // push the item object to it
|
||||
} else {
|
||||
let j = 0;
|
||||
for (; j < result.length; j++) {
|
||||
if (time > result[j].time) { // otherwise, run through all the objects from the result array
|
||||
break;
|
||||
}
|
||||
}
|
||||
result.splice(j, 0, item); // and add new object in ascending order of time
|
||||
}
|
||||
if (!result.length) { // if the result array is empty
|
||||
result.push(item); // push the item object to it
|
||||
} else {
|
||||
let j = 0;
|
||||
for (; j < result.length; j++) {
|
||||
if (time > result[j].time) { // otherwise, run through all the objects from the result array
|
||||
break;
|
||||
}
|
||||
}
|
||||
result.splice(j, 0, item); // and add new object in ascending order of time
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
// get current user host address
|
||||
docManager.prototype.curUserHostAddress = function (userAddress) {
|
||||
if (!userAddress) // if user address isn't passed to the function
|
||||
userAddress = this.req.headers["x-forwarded-for"] || this.req.connection.remoteAddress; // take it from the header or use the remote address
|
||||
DocManager.prototype.curUserHostAddress = function curUserHostAddress(userAddress) {
|
||||
let address = userAddress;
|
||||
if (!address) { // if user address isn't passed to the function
|
||||
// take it from the header or use the remote address
|
||||
address = this.req.headers['x-forwarded-for'] || this.req.connection.remoteAddress;
|
||||
}
|
||||
|
||||
return userAddress.replace(new RegExp("[^0-9a-zA-Z.=]", "g"), "_");
|
||||
return address.replace(/[^0-9a-zA-Z.=]/g, '_');
|
||||
};
|
||||
|
||||
// copy file
|
||||
docManager.prototype.copyFile = function (exist, target) {
|
||||
fileSystem.writeFileSync(target, fileSystem.readFileSync(exist));
|
||||
DocManager.prototype.copyFile = function copyFile(exist, target) {
|
||||
fileSystem.writeFileSync(target, fileSystem.readFileSync(exist));
|
||||
};
|
||||
|
||||
// get an internal extension
|
||||
docManager.prototype.getInternalExtension = function (fileType) {
|
||||
if (fileType == fileUtility.fileType.word) // .docx for word type
|
||||
return ".docx";
|
||||
DocManager.prototype.getInternalExtension = function getInternalExtension(fileType) {
|
||||
if (fileType === fileUtility.fileType.word) { // .docx for word type
|
||||
return '.docx';
|
||||
}
|
||||
|
||||
if (fileType == fileUtility.fileType.cell) // .xlsx for cell type
|
||||
return ".xlsx";
|
||||
if (fileType === fileUtility.fileType.cell) { // .xlsx for cell type
|
||||
return '.xlsx';
|
||||
}
|
||||
|
||||
if (fileType == fileUtility.fileType.slide) // .pptx for slide type
|
||||
return ".pptx";
|
||||
if (fileType === fileUtility.fileType.slide) { // .pptx for slide type
|
||||
return '.pptx';
|
||||
}
|
||||
|
||||
return ".docx"; // the default value is .docx
|
||||
return '.docx'; // the default value is .docx
|
||||
};
|
||||
|
||||
// get the template image url
|
||||
docManager.prototype.getTemplateImageUrl = function (fileType) {
|
||||
let path = this.getServerUrl(true);
|
||||
if (fileType == fileUtility.fileType.word) // for word type
|
||||
return path + "/images/file_docx.svg";
|
||||
DocManager.prototype.getTemplateImageUrl = function getTemplateImageUrl(fileType) {
|
||||
const serverUrl = this.getServerUrl(true);
|
||||
if (fileType === fileUtility.fileType.word) { // for word type
|
||||
return `${serverUrl}/images/file_docx.svg`;
|
||||
}
|
||||
|
||||
if (fileType == fileUtility.fileType.cell) // for cell type
|
||||
return path + "/images/file_xlsx.svg";
|
||||
if (fileType === fileUtility.fileType.cell) { // for cell type
|
||||
return `${path}/images/file_xlsx.svg`;
|
||||
}
|
||||
|
||||
if (fileType == fileUtility.fileType.slide) // for slide type
|
||||
return path + "/images/file_pptx.svg";
|
||||
if (fileType === fileUtility.fileType.slide) { // for slide type
|
||||
return `${path}/images/file_pptx.svg`;
|
||||
}
|
||||
|
||||
return path + "/images/file_docx.svg"; // the default value
|
||||
}
|
||||
return `${path}/images/file_docx.svg`; // the default value
|
||||
};
|
||||
|
||||
// get document key
|
||||
docManager.prototype.getKey = function (fileName, userAddress) {
|
||||
userAddress = userAddress || this.curUserHostAddress();
|
||||
let key = userAddress + fileName; // get document key by adding local file url to the current user host address
|
||||
DocManager.prototype.getKey = function getKey(fileName, userAddress) {
|
||||
const address = userAddress || this.curUserHostAddress();
|
||||
let key = address + fileName; // get document key by adding local file url to the current user host address
|
||||
|
||||
let historyPath = this.historyPath(fileName, userAddress); // get the path to the file history
|
||||
if (historyPath != ""){ // if the path to the file history exists
|
||||
key += this.countVersion(historyPath); // add file version number to the document key
|
||||
}
|
||||
const historyPath = this.historyPath(fileName, address); // get the path to the file history
|
||||
if (historyPath !== '') { // if the path to the file history exists
|
||||
key += this.countVersion(historyPath); // add file version number to the document key
|
||||
}
|
||||
|
||||
let storagePath = this.storagePath(fileName, userAddress); // get the storage path to the given file
|
||||
const stat = fileSystem.statSync(storagePath); // get file information
|
||||
key += stat.mtime.getTime(); // and add creation time to the document key
|
||||
const storagePath = this.storagePath(fileName, address); // get the storage path to the given file
|
||||
const stat = fileSystem.statSync(storagePath); // get file information
|
||||
key += stat.mtime.getTime(); // and add creation time to the document key
|
||||
|
||||
return documentService.generateRevisionId(key); // generate the document key value
|
||||
return documentService.generateRevisionId(key); // generate the document key value
|
||||
};
|
||||
|
||||
// get current date
|
||||
docManager.prototype.getDate = function (date) {
|
||||
const minutes = (date.getMinutes() < 10 ? '0' : '') + date.getMinutes().toString();
|
||||
return date.getMonth() + "/" + date.getDate() + "/" + date.getFullYear() + " " + date.getHours() + ":" + minutes;
|
||||
DocManager.prototype.getDate = function getDate(date) {
|
||||
const minutes = (date.getMinutes() < 10 ? '0' : '') + date.getMinutes().toString();
|
||||
return `${date.getMonth()}/${date.getDate()}/${date.getFullYear()} ${date.getHours()}:${minutes}`;
|
||||
};
|
||||
|
||||
// get changes made in the file
|
||||
docManager.prototype.getChanges = function (fileName) {
|
||||
if (this.existsSync(fileName)) { // if the directory with such a file exists
|
||||
return JSON.parse(fileSystem.readFileSync(fileName)); // read this file and parse it
|
||||
}
|
||||
return null;
|
||||
DocManager.prototype.getChanges = function getChanges(fileName) {
|
||||
if (this.existsSync(fileName)) { // if the directory with such a file exists
|
||||
return JSON.parse(fileSystem.readFileSync(fileName)); // read this file and parse it
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
// get the last file version
|
||||
docManager.prototype.countVersion = function(directory) {
|
||||
let i = 0;
|
||||
while (this.existsSync(path.join(directory, '' + (i + 1)))) { // run through all the file versions
|
||||
i++; // and count them
|
||||
}
|
||||
return i;
|
||||
DocManager.prototype.countVersion = function countVersion(directory) {
|
||||
let i = 0;
|
||||
while (this.existsSync(path.join(directory, `${i + 1}`))) { // run through all the file versions
|
||||
i += 1; // and count them
|
||||
}
|
||||
return i;
|
||||
};
|
||||
|
||||
// get file history information
|
||||
docManager.prototype.getHistory = function (fileName, content, keyVersion, version) {
|
||||
let oldVersion = false;
|
||||
let contentJson = null;
|
||||
if (content) { // if content is defined
|
||||
if (content.changes && content.changes.length) { // and there are some modifications in the content
|
||||
contentJson = content.changes[0]; // write these modifications to the json content
|
||||
} else if (content.length){
|
||||
contentJson = content[0]; // otherwise, write original content to the json content
|
||||
oldVersion = true; // and note that this is an old version
|
||||
} else {
|
||||
content = false;
|
||||
}
|
||||
DocManager.prototype.getHistoryObject = function getHistoryObject(fileName, userAddr = null, userDirectUrl = null) {
|
||||
const userAddress = userAddr || this.curUserHostAddress();
|
||||
const historyPath = this.historyPath(fileName, userAddress);
|
||||
const key = this.getKey(fileName);
|
||||
const directUrl = this.getDownloadUrl(fileName);
|
||||
const fileExt = fileUtility.getFileExtension(fileName);
|
||||
const url = this.getDownloadUrl(fileName, true);
|
||||
const history = [];
|
||||
const historyData = [];
|
||||
let countVersion = 1;
|
||||
let changes = null;
|
||||
let keyVersion = key;
|
||||
|
||||
if (historyPath !== '') {
|
||||
countVersion = this.countVersion(historyPath) + 1; // get the number of file versions
|
||||
for (let i = 1; i <= countVersion; i++) { // get keys to all the file versions
|
||||
if (i < countVersion) {
|
||||
const keyPath = this.keyPath(fileName, userAddress, i);
|
||||
if (!fileSystem.existsSync(keyPath)) continue;
|
||||
keyVersion = `${fileSystem.readFileSync(keyPath)}`;
|
||||
} else {
|
||||
keyVersion = key;
|
||||
}
|
||||
// write all the file history information
|
||||
history.push(this.getHistory(fileName, changes, keyVersion, i));
|
||||
|
||||
const userUrl = i === countVersion ? directUrl : (`${this.getServerUrl(false)}/history?fileName=`
|
||||
+ `${encodeURIComponent(fileName)}&file=prev${fileExt}&ver=${i}`);
|
||||
const historyD = {
|
||||
fileType: fileExt.slice(1),
|
||||
version: i,
|
||||
key: keyVersion,
|
||||
url: i === countVersion ? url : (`${this.getServerUrl(true)}/history?fileName=`
|
||||
+ `${encodeURIComponent(fileName)}&file=prev${fileExt}&ver=${i}&useraddress=${userAddress}`),
|
||||
directUrl: !userDirectUrl ? null : userUrl,
|
||||
};
|
||||
|
||||
// check if the path to the file with document versions differences exists
|
||||
if (i > 1 && this.existsSync(this.diffPath(fileName, userAddress, i - 1))) {
|
||||
historyD.previous = { // write information about previous file version
|
||||
fileType: historyData[i - 2].fileType,
|
||||
key: historyData[i - 2].key,
|
||||
url: historyData[i - 2].url,
|
||||
directUrl: !userDirectUrl ? null : historyData[i - 2].directUrl,
|
||||
};
|
||||
const changesUrl = `${this.getServerUrl(true)}/history?fileName=`
|
||||
+ `${encodeURIComponent(fileName)}&file=diff.zip&ver=${i - 1}&useraddress=${userAddress}`;
|
||||
historyD.changesUrl = changesUrl; // get the path to the diff.zip file and write it to the history object
|
||||
}
|
||||
|
||||
historyData.push(historyD);
|
||||
|
||||
if (i < countVersion) {
|
||||
// get the path to the file with document changes
|
||||
const changesFile = this.changesPath(fileName, userAddress, i);
|
||||
changes = this.getChanges(changesFile); // get changes made in the file
|
||||
}
|
||||
}
|
||||
} else { // if history path is empty
|
||||
// write the history information about the last file version
|
||||
history.push(this.getHistory(fileName, changes, keyVersion, countVersion));
|
||||
historyData.push({
|
||||
fileType: fileExt.slice(1),
|
||||
version: countVersion,
|
||||
key,
|
||||
url,
|
||||
directUrl: !userDirectUrl ? null : directUrl,
|
||||
});
|
||||
}
|
||||
|
||||
const userAddress = this.curUserHostAddress();
|
||||
const username = content ? (oldVersion ? contentJson.username : contentJson.user.name) : (this.getFileData(fileName, userAddress))[2];
|
||||
const userid = content ? (oldVersion ? contentJson.userid : contentJson.user.id) : (this.getFileData(fileName, userAddress))[1];
|
||||
const created = content ? (oldVersion ? contentJson.date : contentJson.created) : (this.getFileData(fileName, userAddress))[0];
|
||||
const res = (content && !oldVersion) ? content : {changes: content};
|
||||
res.key = keyVersion; // write the information about the user, creation time, key and version to the result object
|
||||
res.version = version;
|
||||
res.created = created;
|
||||
res.user = {
|
||||
id: userid,
|
||||
name: username != "null" ? username : null
|
||||
};
|
||||
return { history, historyData, countVersion };
|
||||
};
|
||||
// get file history information
|
||||
DocManager.prototype.getHistory = function getHistory(fileName, content, keyVersion, version) {
|
||||
let oldVersion = false;
|
||||
let contentJson = null;
|
||||
let fileContent = content;
|
||||
let userNameFromJson = null;
|
||||
let userIdFromJson = null;
|
||||
let createdFromJson = null;
|
||||
if (fileContent) { // if content is defined
|
||||
if (fileContent.changes && fileContent.changes.length) { // and there are some modifications in the content
|
||||
[contentJson] = fileContent.changes; // write these modifications to the json content
|
||||
} else if (fileContent.length) {
|
||||
[contentJson] = fileContent; // otherwise, write original content to the json content
|
||||
oldVersion = true; // and note that this is an old version
|
||||
} else {
|
||||
fileContent = false;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
const userAddress = this.curUserHostAddress();
|
||||
|
||||
if (content && contentJson) {
|
||||
userNameFromJson = oldVersion ? contentJson.username : contentJson.user.name;
|
||||
userIdFromJson = oldVersion ? contentJson.userid : contentJson.user.userid;
|
||||
createdFromJson = oldVersion ? contentJson.date : contentJson.created;
|
||||
}
|
||||
|
||||
const username = userNameFromJson || (this.getFileData(fileName, userAddress))[2];
|
||||
const userid = userIdFromJson || (this.getFileData(fileName, userAddress))[1];
|
||||
const created = createdFromJson || (this.getFileData(fileName, userAddress))[0];
|
||||
const res = (fileContent && !oldVersion) ? fileContent : { changes: fileContent };
|
||||
res.key = keyVersion; // write the information about the user, creation time, key and version to the result object
|
||||
res.version = version;
|
||||
res.created = created;
|
||||
res.user = {
|
||||
id: userid,
|
||||
name: username !== 'null' ? username : null,
|
||||
};
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
// clean folder
|
||||
docManager.prototype.cleanFolderRecursive = function (folder, me) {
|
||||
if (fileSystem.existsSync(folder)) { // if the given folder exists
|
||||
const files = fileSystem.readdirSync(folder);
|
||||
files.forEach((file) => { // for each file from the folder
|
||||
const curPath = path.join(folder, file); // get its current path
|
||||
if (fileSystem.lstatSync(curPath).isDirectory()) {
|
||||
this.cleanFolderRecursive(curPath, true); // for each folder included in this one repeat the same procedure
|
||||
} else {
|
||||
fileSystem.unlinkSync(curPath); // remove the file
|
||||
}
|
||||
});
|
||||
if (me) {
|
||||
fileSystem.rmdirSync(folder);
|
||||
}
|
||||
DocManager.prototype.cleanFolderRecursive = function cleanFolderRecursive(folder, me) {
|
||||
if (fileSystem.existsSync(folder)) { // if the given folder exists
|
||||
const files = fileSystem.readdirSync(folder);
|
||||
files.forEach((file) => { // for each file from the folder
|
||||
const curPath = path.join(folder, file); // get its current path
|
||||
if (fileSystem.lstatSync(curPath).isDirectory()) {
|
||||
this.cleanFolderRecursive(curPath, true); // for each folder included in this one repeat the same procedure
|
||||
} else {
|
||||
fileSystem.unlinkSync(curPath); // remove the file
|
||||
}
|
||||
});
|
||||
if (me) {
|
||||
fileSystem.rmdirSync(folder);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// get files information
|
||||
docManager.prototype.getFilesInfo = function (fileId) {
|
||||
const userAddress = this.curUserHostAddress();
|
||||
const directory = this.storageRootPath(userAddress);
|
||||
const filesInDirectory = this.getStoredFiles(); // get all the stored files from the folder
|
||||
let responseArray = [];
|
||||
let responseObject;
|
||||
for (let currentFile = 0; currentFile < filesInDirectory.length; currentFile++) { // run through all the files from the directory
|
||||
const file = filesInDirectory[currentFile];
|
||||
const stats = fileSystem.lstatSync(path.join(directory, file.name)); // get file information
|
||||
const fileObject = { // write file parameters to the file object
|
||||
version: file.version,
|
||||
id: this.getKey(file.name),
|
||||
contentLength: `${(stats.size/1024).toFixed(2)} KB`,
|
||||
pureContentLength: stats.size,
|
||||
title: file.name,
|
||||
updated: stats.mtime
|
||||
};
|
||||
if (fileId !== undefined) { // if file id is defined
|
||||
if (this.getKey(file.name) == fileId) { // and it is equal to the document key value
|
||||
responseObject = fileObject; // response object will be equal to the file object
|
||||
break;
|
||||
}
|
||||
}
|
||||
else responseArray.push(fileObject); // otherwise, push file object to the response array
|
||||
DocManager.prototype.getFilesInfo = function getFilesInfo(fileId) {
|
||||
const userAddress = this.curUserHostAddress();
|
||||
const directory = this.storageRootPath(userAddress);
|
||||
const filesInDirectory = this.getStoredFiles(); // get all the stored files from the folder
|
||||
const responseArray = [];
|
||||
let responseObject;
|
||||
// run through all the files from the directory
|
||||
for (let currentFile = 0; currentFile < filesInDirectory.length; currentFile++) {
|
||||
const file = filesInDirectory[currentFile];
|
||||
const stats = fileSystem.lstatSync(path.join(directory, file.name)); // get file information
|
||||
const fileObject = { // write file parameters to the file object
|
||||
version: file.version,
|
||||
id: this.getKey(file.name),
|
||||
contentLength: `${(stats.size / 1024).toFixed(2)} KB`,
|
||||
pureContentLength: stats.size,
|
||||
title: file.name,
|
||||
updated: stats.mtime,
|
||||
};
|
||||
if (fileId !== undefined) {
|
||||
if (responseObject !== undefined) return responseObject;
|
||||
else return "File not found";
|
||||
}
|
||||
else return responseArray;
|
||||
if (fileId !== undefined) { // if file id is defined
|
||||
if (this.getKey(file.name) === fileId) { // and it is equal to the document key value
|
||||
responseObject = fileObject; // response object will be equal to the file object
|
||||
break;
|
||||
}
|
||||
} else responseArray.push(fileObject); // otherwise, push file object to the response array
|
||||
}
|
||||
if (fileId !== undefined) {
|
||||
if (responseObject !== undefined) return responseObject;
|
||||
return 'File not found';
|
||||
} return responseArray;
|
||||
};
|
||||
|
||||
docManager.prototype.getInstanceId = function () {
|
||||
return this.getServerUrl();
|
||||
DocManager.prototype.getInstanceId = function getInstanceId() {
|
||||
return this.getServerUrl();
|
||||
};
|
||||
|
||||
// save all the functions to the docManager module to export it later in other files
|
||||
module.exports = docManager;
|
||||
// save all the functions to the DocManager module to export it later in other files
|
||||
module.exports = DocManager;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2023
|
||||
*
|
||||
@ -17,229 +17,261 @@
|
||||
*/
|
||||
|
||||
// get all the necessary values and modules
|
||||
var urlModule = require("url");
|
||||
var urllib = require("urllib");
|
||||
var jwt = require("jsonwebtoken");
|
||||
var fileUtility = require("./fileUtility");
|
||||
var guidManager = require("./guidManager");
|
||||
var configServer = require('config').get('server');
|
||||
var siteUrl = configServer.get('siteUrl'); // the path to the editors installation
|
||||
var cfgSignatureEnable = configServer.get('token.enable');
|
||||
var cfgSignatureUseForRequest = configServer.get('token.useforrequest');
|
||||
var cfgSignatureAuthorizationHeader = configServer.get('token.authorizationHeader');
|
||||
var cfgSignatureAuthorizationHeaderPrefix = configServer.get('token.authorizationHeaderPrefix');
|
||||
var cfgSignatureSecretExpiresIn = configServer.get('token.expiresIn');
|
||||
var cfgSignatureSecret = configServer.get('token.secret');
|
||||
var cfgSignatureSecretAlgorithmRequest = configServer.get('token.algorithmRequest');
|
||||
const urlModule = require('url');
|
||||
const urllib = require('urllib');
|
||||
const jwt = require('jsonwebtoken');
|
||||
const configServer = require('config').get('server');
|
||||
const fileUtility = require('./fileUtility');
|
||||
const guidManager = require('./guidManager');
|
||||
|
||||
var documentService = {};
|
||||
const siteUrl = configServer.get('siteUrl'); // the path to the editors installation
|
||||
const cfgSignatureEnable = configServer.get('token.enable');
|
||||
const cfgSignatureUseForRequest = configServer.get('token.useforrequest');
|
||||
const cfgSignatureAuthorizationHeader = configServer.get('token.authorizationHeader');
|
||||
const cfgSignatureAuthorizationHeaderPrefix = configServer.get('token.authorizationHeaderPrefix');
|
||||
const cfgSignatureSecretExpiresIn = configServer.get('token.expiresIn');
|
||||
const cfgSignatureSecret = configServer.get('token.secret');
|
||||
const cfgSignatureSecretAlgorithmRequest = configServer.get('token.algorithmRequest');
|
||||
|
||||
const documentService = {};
|
||||
|
||||
documentService.userIp = null;
|
||||
|
||||
// get the url of the converted file (synchronous)
|
||||
documentService.getConvertedUriSync = function (documentUri, fromExtension, toExtension, documentRevisionId, callback) {
|
||||
documentService.getConvertedUri(documentUri, fromExtension, toExtension, documentRevisionId, false, function (err, data) {
|
||||
callback(err, data);
|
||||
});
|
||||
documentService.getConvertedUriSync = function getConvertedUriSync(
|
||||
documentUri,
|
||||
fromExtension,
|
||||
toExtension,
|
||||
documentRevisionId,
|
||||
callback,
|
||||
) {
|
||||
documentService.getConvertedUri(documentUri, fromExtension, toExtension, documentRevisionId, false, (err, data) => {
|
||||
callback(err, data);
|
||||
});
|
||||
};
|
||||
|
||||
// get the url of the converted file
|
||||
documentService.getConvertedUri = function (documentUri, fromExtension, toExtension, documentRevisionId, async, callback, filePass = null, lang = null) {
|
||||
fromExtension = fromExtension || fileUtility.getFileExtension(documentUri); // get the current document extension
|
||||
documentService.getConvertedUri = function getConvertedUri(
|
||||
documentUri,
|
||||
fromExtension,
|
||||
toExtension,
|
||||
documentRevisionId,
|
||||
async,
|
||||
callback,
|
||||
filePass = null,
|
||||
lang = null,
|
||||
) {
|
||||
const fromExt = fromExtension || fileUtility.getFileExtension(documentUri); // get the current document extension
|
||||
|
||||
var title = fileUtility.getFileName(documentUri) || guidManager.newGuid(); // get the current document name or uuid
|
||||
const title = fileUtility.getFileName(documentUri) || guidManager.newGuid(); // get the current document name or uuid
|
||||
|
||||
documentRevisionId = documentService.generateRevisionId(documentRevisionId || documentUri); // generate the document key value
|
||||
// generate the document key value
|
||||
const revisionId = documentService.generateRevisionId(documentRevisionId || documentUri);
|
||||
|
||||
var params = { // write all the conversion parameters to the params dictionary
|
||||
async: async,
|
||||
url: documentUri,
|
||||
outputtype: toExtension.replace(".", ""),
|
||||
filetype: fromExtension.replace(".", ""),
|
||||
title: title,
|
||||
key: documentRevisionId,
|
||||
password: filePass,
|
||||
region: lang,
|
||||
};
|
||||
const params = { // write all the conversion parameters to the params dictionary
|
||||
async,
|
||||
url: documentUri,
|
||||
outputtype: toExtension.replace('.', ''),
|
||||
filetype: fromExt.replace('.', ''),
|
||||
title,
|
||||
key: revisionId,
|
||||
password: filePass,
|
||||
region: lang,
|
||||
};
|
||||
|
||||
var uri = siteUrl + configServer.get('converterUrl'); // get the absolute converter url
|
||||
var headers = {
|
||||
'Content-Type': 'application/json',
|
||||
"Accept": "application/json"
|
||||
};
|
||||
const uri = siteUrl + configServer.get('converterUrl'); // get the absolute converter url
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
};
|
||||
|
||||
if (cfgSignatureEnable && cfgSignatureUseForRequest) { // if the signature is enabled and it can be used for request
|
||||
headers[cfgSignatureAuthorizationHeader] = cfgSignatureAuthorizationHeaderPrefix + this.fillJwtByUrl(uri, params); // write signature authorization header
|
||||
params.token = documentService.getToken(params); // get token and save it to the parameters
|
||||
}
|
||||
if (cfgSignatureEnable && cfgSignatureUseForRequest) { // if the signature is enabled and it can be used for request
|
||||
// write signature authorization header
|
||||
headers[cfgSignatureAuthorizationHeader] = cfgSignatureAuthorizationHeaderPrefix + this.fillJwtByUrl(uri, params);
|
||||
params.token = documentService.getToken(params); // get token and save it to the parameters
|
||||
}
|
||||
|
||||
//parse url to allow request by relative url after https://github.com/node-modules/urllib/pull/321/commits/514de1924bf17a38a6c2db2a22a6bc3494c0a959
|
||||
urllib.request(urlModule.parse(uri),
|
||||
{
|
||||
method: "POST",
|
||||
headers: headers,
|
||||
data: params
|
||||
},
|
||||
callback);
|
||||
// parse url to allow request by relative url after
|
||||
// https://github.com/node-modules/urllib/pull/321/commits/514de1924bf17a38a6c2db2a22a6bc3494c0a959
|
||||
urllib.request(
|
||||
urlModule.parse(uri),
|
||||
{
|
||||
method: 'POST',
|
||||
headers,
|
||||
data: params,
|
||||
},
|
||||
callback,
|
||||
);
|
||||
};
|
||||
|
||||
// generate the document key value
|
||||
documentService.generateRevisionId = function (expectedKey) {
|
||||
let maxKeyLength = 128; // the max key length is 128
|
||||
if (expectedKey.length > maxKeyLength) { // if the expected key length is greater than the max key length
|
||||
expectedKey = expectedKey.hashCode().toString(); // the expected key is hashed and a fixed length value is stored in the string format
|
||||
}
|
||||
documentService.generateRevisionId = function generateRevisionId(expectedKey) {
|
||||
const maxKeyLength = 128; // the max key length is 128
|
||||
let expKey = expectedKey;
|
||||
if (expKey.length > maxKeyLength) { // if the expected key length is greater than the max key length
|
||||
// the expected key is hashed and a fixed length value is stored in the string format
|
||||
expKey = expKey.hashCode().toString();
|
||||
}
|
||||
|
||||
var key = expectedKey.replace(new RegExp("[^0-9-.a-zA-Z_=]", "g"), "_");
|
||||
const key = expKey.replace(/[^0-9-.a-zA-Z_=]/g, '_');
|
||||
|
||||
return key.substring(0, Math.min(key.length, maxKeyLength)); // the resulting key is of the max key length or less
|
||||
return key.substring(0, Math.min(key.length, maxKeyLength)); // the resulting key is of the max key length or less
|
||||
};
|
||||
|
||||
// create an error message for the error code
|
||||
documentService.processConvertServiceResponceError = function (errorCode) {
|
||||
var errorMessage = "";
|
||||
var errorMessageTemplate = "Error occurred in the ConvertService: ";
|
||||
documentService.processConvertServiceResponceError = function processConvertServiceResponceError(errorCode) {
|
||||
let errorMessage = '';
|
||||
const errorMessageTemplate = 'Error occurred in the ConvertService: ';
|
||||
|
||||
// add the error message to the error message template depending on the error code
|
||||
switch (errorCode) {
|
||||
case -20:
|
||||
errorMessage = errorMessageTemplate + "Error encrypt signature";
|
||||
break;
|
||||
case -8:
|
||||
errorMessage = errorMessageTemplate + "Error document signature";
|
||||
break;
|
||||
case -7:
|
||||
errorMessage = errorMessageTemplate + "Error document request";
|
||||
break;
|
||||
case -6:
|
||||
errorMessage = errorMessageTemplate + "Error database";
|
||||
break;
|
||||
case -5:
|
||||
errorMessage = errorMessageTemplate + "Incorrect password";
|
||||
break;
|
||||
case -4:
|
||||
errorMessage = errorMessageTemplate + "Error download error";
|
||||
break;
|
||||
case -3:
|
||||
errorMessage = errorMessageTemplate + "Error convertation error";
|
||||
break;
|
||||
case -2:
|
||||
errorMessage = errorMessageTemplate + "Error convertation timeout";
|
||||
break;
|
||||
case -1:
|
||||
errorMessage = errorMessageTemplate + "Error convertation unknown";
|
||||
break;
|
||||
case 0: // if the error code is equal to 0, the error message is empty
|
||||
break;
|
||||
default:
|
||||
errorMessage = "ErrorCode = " + errorCode; // default value for the error message
|
||||
break;
|
||||
}
|
||||
// add the error message to the error message template depending on the error code
|
||||
switch (errorCode) {
|
||||
case -20:
|
||||
errorMessage = `${errorMessageTemplate}Error encrypt signature`;
|
||||
break;
|
||||
case -8:
|
||||
errorMessage = `${errorMessageTemplate}Error document signature`;
|
||||
break;
|
||||
case -7:
|
||||
errorMessage = `${errorMessageTemplate}Error document request`;
|
||||
break;
|
||||
case -6:
|
||||
errorMessage = `${errorMessageTemplate}Error database`;
|
||||
break;
|
||||
case -5:
|
||||
errorMessage = `${errorMessageTemplate}Incorrect password`;
|
||||
break;
|
||||
case -4:
|
||||
errorMessage = `${errorMessageTemplate}Error download error`;
|
||||
break;
|
||||
case -3:
|
||||
errorMessage = `${errorMessageTemplate}Error convertation error`;
|
||||
break;
|
||||
case -2:
|
||||
errorMessage = `${errorMessageTemplate}Error convertation timeout`;
|
||||
break;
|
||||
case -1:
|
||||
errorMessage = `${errorMessageTemplate}Error convertation unknown`;
|
||||
break;
|
||||
case 0: // if the error code is equal to 0, the error message is empty
|
||||
break;
|
||||
default:
|
||||
errorMessage = `ErrorCode = ${errorCode}`; // default value for the error message
|
||||
break;
|
||||
}
|
||||
|
||||
throw { message: errorMessage };
|
||||
throw new Error(errorMessage);
|
||||
};
|
||||
|
||||
// get the response url
|
||||
documentService.getResponseUri = function (json) {
|
||||
var fileResult = JSON.parse(json);
|
||||
documentService.getResponseUri = function getResponseUri(json) {
|
||||
const fileResult = JSON.parse(json);
|
||||
|
||||
if (fileResult.error) // if an error occurs
|
||||
documentService.processConvertServiceResponceError(parseInt(fileResult.error)); // get an error message
|
||||
if (fileResult.error) { // if an error occurs
|
||||
documentService.processConvertServiceResponceError(parseInt(fileResult.error, 10)); // get an error message
|
||||
}
|
||||
|
||||
var isEndConvert = fileResult.endConvert // check if the conversion is completed
|
||||
const isEndConvert = fileResult.endConvert; // check if the conversion is completed
|
||||
|
||||
var percent = parseInt(fileResult.percent); // get the conversion percentage
|
||||
var uri = null;
|
||||
var fileType = null;
|
||||
let percent = parseInt(fileResult.percent, 10); // get the conversion percentage
|
||||
let uri = null;
|
||||
let fileType = null;
|
||||
|
||||
if (isEndConvert) { // if the conversion is completed
|
||||
if (!fileResult.fileUrl) // and the file url doesn't exist
|
||||
throw { message: "FileUrl is null" }; // the file url is null
|
||||
|
||||
uri = fileResult.fileUrl; // otherwise, get the file url
|
||||
fileType = fileResult.fileType; // get the file type
|
||||
percent = 100;
|
||||
} else { // if the conversion isn't completed
|
||||
percent = percent >= 100 ? 99 : percent; // get the percentage value
|
||||
if (isEndConvert) { // if the conversion is completed
|
||||
if (!fileResult.fileUrl) { // and the file url doesn't exist
|
||||
throw new Error('FileUrl is null'); // the file url is null
|
||||
}
|
||||
|
||||
return {
|
||||
percent : percent,
|
||||
uri : uri,
|
||||
fileType : fileType
|
||||
};
|
||||
uri = fileResult.fileUrl; // otherwise, get the file url
|
||||
({ fileType } = fileResult); // get the file type
|
||||
percent = 100;
|
||||
} else { // if the conversion isn't completed
|
||||
percent = percent >= 100 ? 99 : percent; // get the percentage value
|
||||
}
|
||||
|
||||
return {
|
||||
percent,
|
||||
uri,
|
||||
fileType,
|
||||
};
|
||||
};
|
||||
|
||||
// create a command request
|
||||
documentService.commandRequest = function (method, documentRevisionId, meta = null, callback) {
|
||||
documentService.commandRequest = function commandRequest(method, documentRevisionId, callback, meta = null) {
|
||||
const revisionId = documentService.generateRevisionId(documentRevisionId); // generate the document key value
|
||||
const params = { // create a parameter object with command method and the document key value in it
|
||||
c: method,
|
||||
key: revisionId,
|
||||
};
|
||||
|
||||
documentRevisionId = documentService.generateRevisionId(documentRevisionId); // generate the document key value
|
||||
params = { // create a parameter object with command method and the document key value in it
|
||||
c: method,
|
||||
key: documentRevisionId
|
||||
};
|
||||
if (meta) {
|
||||
params.meta = meta;
|
||||
}
|
||||
|
||||
if (meta) {
|
||||
params.meta = meta;
|
||||
}
|
||||
const uri = siteUrl + configServer.get('commandUrl'); // get the absolute command url
|
||||
const headers = { // create a headers object
|
||||
'Content-Type': 'application/json',
|
||||
};
|
||||
if (cfgSignatureEnable && cfgSignatureUseForRequest) {
|
||||
headers[cfgSignatureAuthorizationHeader] = cfgSignatureAuthorizationHeaderPrefix + this.fillJwtByUrl(uri, params);
|
||||
params.token = documentService.getToken(params);
|
||||
}
|
||||
|
||||
var uri = siteUrl + configServer.get('commandUrl'); // get the absolute command url
|
||||
var headers = { // create a headers object
|
||||
'Content-Type': 'application/json'
|
||||
};
|
||||
if (cfgSignatureEnable && cfgSignatureUseForRequest) {
|
||||
headers[cfgSignatureAuthorizationHeader] = cfgSignatureAuthorizationHeaderPrefix + this.fillJwtByUrl(uri, params);
|
||||
params.token = documentService.getToken(params);
|
||||
}
|
||||
|
||||
//parse url to allow request by relative url after https://github.com/node-modules/urllib/pull/321/commits/514de1924bf17a38a6c2db2a22a6bc3494c0a959
|
||||
urllib.request(urlModule.parse(uri),
|
||||
{
|
||||
method: "POST",
|
||||
headers: headers,
|
||||
data: params
|
||||
},
|
||||
callback);
|
||||
// parse url to allow request by relative url after
|
||||
// https://github.com/node-modules/urllib/pull/321/commits/514de1924bf17a38a6c2db2a22a6bc3494c0a959
|
||||
urllib.request(
|
||||
urlModule.parse(uri),
|
||||
{
|
||||
method: 'POST',
|
||||
headers,
|
||||
data: params,
|
||||
},
|
||||
callback,
|
||||
);
|
||||
};
|
||||
|
||||
// check jwt token headers
|
||||
documentService.checkJwtHeader = function (req) {
|
||||
var decoded = null;
|
||||
var authorization = req.get(cfgSignatureAuthorizationHeader); // get signature authorization header from the request
|
||||
if (authorization && authorization.startsWith(cfgSignatureAuthorizationHeaderPrefix)) { // if authorization header exists and it starts with the authorization header prefix
|
||||
var token = authorization.substring(cfgSignatureAuthorizationHeaderPrefix.length); // the resulting token starts after the authorization header prefix
|
||||
documentService.checkJwtHeader = function checkJwtHeader(req) {
|
||||
let decoded = null;
|
||||
const authorization = req.get(cfgSignatureAuthorizationHeader); // get signature authorization header from the request
|
||||
// if authorization header exists and it starts with the authorization header prefix
|
||||
if (authorization && authorization.startsWith(cfgSignatureAuthorizationHeaderPrefix)) {
|
||||
// the resulting token starts after the authorization header prefix
|
||||
const token = authorization.substring(cfgSignatureAuthorizationHeaderPrefix.length);
|
||||
try {
|
||||
decoded = jwt.verify(token, cfgSignatureSecret); // verify signature on jwt token using signature secret
|
||||
decoded = jwt.verify(token, cfgSignatureSecret); // verify signature on jwt token using signature secret
|
||||
} catch (err) {
|
||||
console.log('checkJwtHeader error: name = ' + err.name + ' message = ' + err.message + ' token = ' + token) // print debug information to the console
|
||||
// print debug information to the console
|
||||
console.log(`checkJwtHeader error: name = ${err.name} message = ${err.message} token = ${token}`);
|
||||
}
|
||||
}
|
||||
return decoded;
|
||||
}
|
||||
};
|
||||
|
||||
// get jwt token using url information
|
||||
documentService.fillJwtByUrl = function (uri, opt_dataObject) {
|
||||
var parseObject = urlModule.parse(uri, true); // get parse object from the url
|
||||
var payload = {query: parseObject.query, payload: opt_dataObject}; // create payload object
|
||||
documentService.fillJwtByUrl = function fillJwtByUrl(uri, optDataObject) {
|
||||
const parseObject = urlModule.parse(uri, true); // get parse object from the url
|
||||
const payload = { query: parseObject.query, payload: optDataObject }; // create payload object
|
||||
|
||||
var options = {algorithm: cfgSignatureSecretAlgorithmRequest, expiresIn: cfgSignatureSecretExpiresIn};
|
||||
return jwt.sign(payload, cfgSignatureSecret, options); // sign token with given data using signature secret and options parameters
|
||||
}
|
||||
const options = { algorithm: cfgSignatureSecretAlgorithmRequest, expiresIn: cfgSignatureSecretExpiresIn };
|
||||
// sign token with given data using signature secret and options parameters
|
||||
return jwt.sign(payload, cfgSignatureSecret, options);
|
||||
};
|
||||
|
||||
// get token
|
||||
documentService.getToken = function (data) {
|
||||
var options = {algorithm: cfgSignatureSecretAlgorithmRequest, expiresIn: cfgSignatureSecretExpiresIn};
|
||||
return jwt.sign(data, cfgSignatureSecret, options); // sign token with given data using signature secret and options parameters
|
||||
documentService.getToken = function getToken(data) {
|
||||
const options = { algorithm: cfgSignatureSecretAlgorithmRequest, expiresIn: cfgSignatureSecretExpiresIn };
|
||||
// sign token with given data using signature secret and options parameters
|
||||
return jwt.sign(data, cfgSignatureSecret, options);
|
||||
};
|
||||
|
||||
// read and verify token
|
||||
documentService.readToken = function (token) {
|
||||
try {
|
||||
return jwt.verify(token, cfgSignatureSecret); // verify signature on jwt token using signature secret
|
||||
} catch (err) {
|
||||
console.log('checkJwtHeader error: name = ' + err.name + ' message = ' + err.message + ' token = ' + token)
|
||||
}
|
||||
return null;
|
||||
documentService.readToken = function readToken(token) {
|
||||
try {
|
||||
return jwt.verify(token, cfgSignatureSecret); // verify signature on jwt token using signature secret
|
||||
} catch (err) {
|
||||
console.log(`checkJwtHeader error: name = ${err.name} message = ${err.message} token = ${token}`);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
// save all the functions to the documentService module to export it later in other files
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2023
|
||||
*
|
||||
@ -16,79 +16,103 @@
|
||||
*
|
||||
*/
|
||||
|
||||
var fileUtility = {};
|
||||
const supportedFormats = require('../public/assets/document-formats/onlyoffice-docs-formats.json'); // eslint-disable-line
|
||||
|
||||
const fileUtility = {};
|
||||
|
||||
// get file name from the given url
|
||||
fileUtility.getFileName = function (url, withoutExtension) {
|
||||
if (!url) return "";
|
||||
fileUtility.getFileName = function getFileName(url, withoutExtension) {
|
||||
if (!url) return '';
|
||||
|
||||
var parts = url.split("\\");
|
||||
parts = parts.pop();
|
||||
parts = parts.split("/");
|
||||
var fileName = parts.pop(); // get the file name from the last part of the url
|
||||
fileName = fileName.split("?")[0];
|
||||
let parts = url.split('\\');
|
||||
parts = parts.pop();
|
||||
parts = parts.split('/');
|
||||
let fileName = parts.pop(); // get the file name from the last part of the url
|
||||
[fileName] = fileName.split('?');
|
||||
|
||||
// get file name without extension
|
||||
if (withoutExtension) {
|
||||
return fileName.substring(0, fileName.lastIndexOf("."));
|
||||
}
|
||||
// get file name without extension
|
||||
if (withoutExtension) {
|
||||
return fileName.substring(0, fileName.lastIndexOf('.'));
|
||||
}
|
||||
|
||||
return fileName;
|
||||
return fileName;
|
||||
};
|
||||
|
||||
// get file extension from the given url
|
||||
fileUtility.getFileExtension = function (url, withoutDot) {
|
||||
if (!url) return null;
|
||||
fileUtility.getFileExtension = function getFileExtension(url, withoutDot) {
|
||||
if (!url) return null;
|
||||
|
||||
var fileName = fileUtility.getFileName(url); // get file name from the given url
|
||||
const fileName = fileUtility.getFileName(url); // get file name from the given url
|
||||
|
||||
var parts = fileName.toLowerCase().split(".");
|
||||
const parts = fileName.toLowerCase().split('.');
|
||||
|
||||
return withoutDot ? parts.pop() : "." + parts.pop(); // get the extension from the file name with or without dot
|
||||
return withoutDot ? parts.pop() : `.${parts.pop()}`; // get the extension from the file name with or without dot
|
||||
};
|
||||
|
||||
// get file type from the given url
|
||||
fileUtility.getFileType = function (url) {
|
||||
var ext = fileUtility.getFileExtension(url); // get the file extension from the given url
|
||||
fileUtility.getFileType = function getFileType(url) {
|
||||
const ext = fileUtility.getFileExtension(url, true); // get the file extension from the given url
|
||||
|
||||
if (fileUtility.documentExts.indexOf(ext) != -1) return fileUtility.fileType.word; // word type for document extensions
|
||||
if (fileUtility.spreadsheetExts.indexOf(ext) != -1) return fileUtility.fileType.cell; // cell type for spreadsheet extensions
|
||||
if (fileUtility.presentationExts.indexOf(ext) != -1) return fileUtility.fileType.slide; // slide type for presentation extensions
|
||||
for (let i = 0; i < supportedFormats.length; i++) {
|
||||
if (supportedFormats[i].name === ext) return supportedFormats[i].type;
|
||||
}
|
||||
|
||||
return fileUtility.fileType.word; // the default file type is word
|
||||
}
|
||||
return fileUtility.fileType.word; // the default file type is word
|
||||
};
|
||||
|
||||
fileUtility.fileType = {
|
||||
word: "word",
|
||||
cell: "cell",
|
||||
slide: "slide"
|
||||
}
|
||||
word: 'word',
|
||||
cell: 'cell',
|
||||
slide: 'slide',
|
||||
};
|
||||
|
||||
// the document extension list
|
||||
fileUtility.documentExts = [".doc", ".docx", ".oform", ".docm", ".dot", ".dotx", ".dotm", ".odt", ".fodt", ".ott", ".rtf", ".txt", ".html", ".htm", ".mht", ".xml", ".pdf", ".djvu", ".fb2", ".epub", ".xps", ".oxps"];
|
||||
fileUtility.getSuppotredExtensions = function getSuppotredExtensions() {
|
||||
return supportedFormats.reduce((extensions, format) => [...extensions, format.name], []);
|
||||
};
|
||||
|
||||
// the spreadsheet extension list
|
||||
fileUtility.spreadsheetExts = [".xls", ".xlsx", ".xlsm", ".xlsb", ".xlt", ".xltx", ".xltm", ".ods", ".fods", ".ots", ".csv"];
|
||||
fileUtility.getViewExtensions = function getViewExtensions() {
|
||||
return supportedFormats.filter(
|
||||
(format) => format.actions.includes('view'),
|
||||
).reduce((extensions, format) => [...extensions, format.name], []);
|
||||
};
|
||||
|
||||
// the presentation extension list
|
||||
fileUtility.presentationExts = [".pps", ".ppsx", ".ppsm", ".ppt", ".pptx", ".pptm", ".pot", ".potx", ".potm", ".odp", ".fodp", ".otp"];
|
||||
fileUtility.getEditExtensions = function getEditExtensions() {
|
||||
return supportedFormats.filter(
|
||||
(format) => format.actions.includes('edit') || format.actions.includes('lossy-edit'),
|
||||
).reduce((extensions, format) => [...extensions, format.name], []);
|
||||
};
|
||||
|
||||
fileUtility.getFillExtensions = function getFillExtensions() {
|
||||
return supportedFormats.filter(
|
||||
(format) => format.actions.includes('fill'),
|
||||
).reduce((extensions, format) => [...extensions, format.name], []);
|
||||
};
|
||||
|
||||
fileUtility.getConvertExtensions = function getConvertExtensions() {
|
||||
return supportedFormats.filter(
|
||||
(format) => (format.type === 'word' && format.convert.includes('docx'))
|
||||
|| (format.type === 'cell' && format.convert.includes('xlsx'))
|
||||
|| (format.type === 'slide' && format.convert.includes('pptx')),
|
||||
).reduce((extensions, format) => [...extensions, format.name], []);
|
||||
};
|
||||
|
||||
// get url parameters
|
||||
function getUrlParams(url) {
|
||||
try {
|
||||
var query = url.split("?").pop(); // take all the parameters which are placed after ? sign in the file url
|
||||
var params = query.split("&"); // parameters are separated by & sign
|
||||
var map = {}; // write parameters and their values to the map dictionary
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
var parts = param.split("=");
|
||||
map[parts[0]] = parts[1];
|
||||
}
|
||||
return map;
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const getUrlParams = function getUrlParams(url) {
|
||||
try {
|
||||
const query = url.split('?').pop(); // take all the parameters which are placed after ? sign in the file url
|
||||
const params = query.split('&'); // parameters are separated by & sign
|
||||
const map = {}; // write parameters and their values to the map dictionary
|
||||
for (let i = 0; i < params.length; i++) {
|
||||
// eslint-disable-next-line no-undef
|
||||
const parts = param.split('=');
|
||||
[, map[parts[0]]] = parts;
|
||||
}
|
||||
catch (ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return map;
|
||||
} catch (ex) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
// save all the functions to the fileUtility module to export it later in other files
|
||||
module.exports = fileUtility;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/**
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2023
|
||||
*
|
||||
@ -17,11 +17,12 @@
|
||||
*/
|
||||
|
||||
// generate 16 octet
|
||||
var s4 = function () {
|
||||
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
||||
const s4 = function s4() {
|
||||
return Math.trunc((1 + Math.random()) * 0x10000).toString(16)
|
||||
.substring(1);
|
||||
};
|
||||
|
||||
// create uuid v4
|
||||
exports.newGuid = function () {
|
||||
return (s4() + s4() + "-" + s4() + "-" + s4() + "-" + s4() + "-" + s4() + s4() + s4());
|
||||
};
|
||||
exports.newGuid = function newGuid() {
|
||||
return (`${s4() + s4()}-${s4()}-${s4()}-${s4()}-${s4()}${s4()}${s4()}`);
|
||||
};
|
||||
|
||||
@ -16,80 +16,20 @@
|
||||
*
|
||||
*/
|
||||
|
||||
var descr_user_1 = [
|
||||
"File author by default",
|
||||
"Doesn’t belong to any group",
|
||||
"Can review all the changes",
|
||||
"Can perform all actions with comments",
|
||||
"The file favorite state is undefined",
|
||||
"Can create files from templates using data from the editor",
|
||||
"Can see the information about all users",
|
||||
//"Can submit forms"
|
||||
];
|
||||
|
||||
var descr_user_2 = [
|
||||
"Belongs to Group2",
|
||||
"Can review only his own changes or changes made by users with no group",
|
||||
"Can view comments, edit his own comments and comments left by users with no group. Can remove his own comments only",
|
||||
"This file is marked as favorite",
|
||||
"Can create new files from the editor",
|
||||
"Can see the information about users from Group2 and users who don’t belong to any group",
|
||||
//"Can’t submit forms"
|
||||
];
|
||||
|
||||
var descr_user_3 = [
|
||||
"Belongs to Group3",
|
||||
"Can review changes made by Group2 users",
|
||||
"Can view comments left by Group2 and Group3 users. Can edit comments left by the Group2 users",
|
||||
"This file isn’t marked as favorite",
|
||||
"Can’t copy data from the file to clipboard",
|
||||
"Can’t download the file",
|
||||
"Can’t print the file",
|
||||
"Can create new files from the editor",
|
||||
"Can see the information about Group2 users",
|
||||
//"Can’t submit forms"
|
||||
];
|
||||
|
||||
var descr_user_0 = [
|
||||
"The name is requested when the editor is opened",
|
||||
"Doesn’t belong to any group",
|
||||
"Can review all the changes",
|
||||
"Can perform all actions with comments",
|
||||
"The file favorite state is undefined",
|
||||
"Can't mention others in comments",
|
||||
"Can't create new files from the editor",
|
||||
"Can’t see anyone’s information",
|
||||
"Can't rename files from the editor",
|
||||
"Can't view chat",
|
||||
"Can't protect file",
|
||||
"View file without collaboration",
|
||||
//"Can’t submit forms"
|
||||
];
|
||||
|
||||
var users = [
|
||||
new User("uid-1", "John Smith", "smith@example.com",
|
||||
null, null, {}, null,
|
||||
null, [], descr_user_1, true),
|
||||
new User("uid-2", "Mark Pottato", "pottato@example.com",
|
||||
"group-2", ["group-2", ""], {
|
||||
view: "",
|
||||
edit: ["group-2", ""],
|
||||
remove: ["group-2"]
|
||||
}, ["group-2", ""],
|
||||
true, [], descr_user_2, false), // own and without group
|
||||
new User("uid-3", "Hamish Mitchell", null,
|
||||
"group-3", ["group-2"], {
|
||||
view: ["group-3", "group-2"],
|
||||
edit: ["group-2"],
|
||||
remove: []
|
||||
}, ["group-2"],
|
||||
false, ["copy", "download", "print"], descr_user_3, false), // other group only
|
||||
new User("uid-0", null, null,
|
||||
null, null, {}, [],
|
||||
null, ["protect"], descr_user_0, false),
|
||||
];
|
||||
|
||||
function User(id, name, email, group, reviewGroups, commentGroups, userInfoGroups, favorite, deniedPermissions, descriptions, templates) {
|
||||
class User {
|
||||
constructor(
|
||||
id,
|
||||
name,
|
||||
email,
|
||||
group,
|
||||
reviewGroups,
|
||||
commentGroups,
|
||||
userInfoGroups,
|
||||
favorite,
|
||||
deniedPermissions,
|
||||
descriptions,
|
||||
templates,
|
||||
) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.email = email;
|
||||
@ -101,51 +41,117 @@ function User(id, name, email, group, reviewGroups, commentGroups, userInfoGroup
|
||||
this.deniedPermissions = deniedPermissions;
|
||||
this.descriptions = descriptions;
|
||||
this.templates = templates;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const descrUser1 = [
|
||||
'File author by default',
|
||||
'Doesn’t belong to any group',
|
||||
'Can review all the changes',
|
||||
'Can perform all actions with comments',
|
||||
'The file favorite state is undefined',
|
||||
'Can create files from templates using data from the editor',
|
||||
'Can see the information about all users',
|
||||
// "Can submit forms"
|
||||
];
|
||||
|
||||
const descrUser2 = [
|
||||
'Belongs to Group2',
|
||||
'Can review only his own changes or changes made by users with no group',
|
||||
'Can view comments, edit his own comments and comments left by users with no group. Can remove his own comments only',
|
||||
'This file is marked as favorite',
|
||||
'Can create new files from the editor',
|
||||
'Can see the information about users from Group2 and users who don’t belong to any group',
|
||||
// "Can’t submit forms"
|
||||
];
|
||||
|
||||
const descrUser3 = [
|
||||
'Belongs to Group3',
|
||||
'Can review changes made by Group2 users',
|
||||
'Can view comments left by Group2 and Group3 users. Can edit comments left by the Group2 users',
|
||||
'This file isn’t marked as favorite',
|
||||
'Can’t copy data from the file to clipboard',
|
||||
'Can’t download the file',
|
||||
'Can’t print the file',
|
||||
'Can create new files from the editor',
|
||||
'Can see the information about Group2 users',
|
||||
// "Can’t submit forms"
|
||||
];
|
||||
|
||||
const descrUser0 = [
|
||||
'The name is requested when the editor is opened',
|
||||
'Doesn’t belong to any group',
|
||||
'Can review all the changes',
|
||||
'Can perform all actions with comments',
|
||||
'The file favorite state is undefined',
|
||||
'Can\'t mention others in comments',
|
||||
'Can\'t create new files from the editor',
|
||||
'Can’t see anyone’s information',
|
||||
'Can\'t rename files from the editor',
|
||||
'Can\'t view chat',
|
||||
'Can\'t protect file',
|
||||
'View file without collaboration',
|
||||
// "Can’t submit forms"
|
||||
];
|
||||
|
||||
const users = [
|
||||
new User('uid-1', 'John Smith', 'smith@example.com', null, null, {}, null, null, [], descrUser1, true),
|
||||
new User('uid-2', 'Mark Pottato', 'pottato@example.com', 'group-2', ['group-2', ''], {
|
||||
view: '',
|
||||
edit: ['group-2', ''],
|
||||
remove: ['group-2'],
|
||||
}, ['group-2', ''], true, [], descrUser2, false), // own and without group
|
||||
new User('uid-3', 'Hamish Mitchell', 'mitchell@example.com', 'group-3', ['group-2'], {
|
||||
view: ['group-3', 'group-2'],
|
||||
edit: ['group-2'],
|
||||
remove: [],
|
||||
}, ['group-2'], false, ['copy', 'download', 'print'], descrUser3, false), // other group only
|
||||
new User('uid-0', null, null, null, null, {}, [], null, ['protect'], descrUser0, false),
|
||||
];
|
||||
|
||||
// get a list of all the users
|
||||
users.getAllUsers = function () {
|
||||
return users;
|
||||
users.getAllUsers = function getAllUsers() {
|
||||
return users;
|
||||
};
|
||||
|
||||
// get a user by id specified
|
||||
users.getUser = function (id) {
|
||||
var result = null;
|
||||
this.forEach(user => {
|
||||
if (user.id == id) {
|
||||
result = user;
|
||||
}
|
||||
});
|
||||
return result ? result : this[0];
|
||||
users.getUser = function getUser(id) {
|
||||
let result = null;
|
||||
this.forEach((user) => {
|
||||
if (user.id === id) {
|
||||
result = user;
|
||||
}
|
||||
});
|
||||
return result || this[0];
|
||||
};
|
||||
|
||||
// get a list of users with their name and email for mentions
|
||||
users.getUsersForMentions = function (id) {
|
||||
var result = [];
|
||||
this.forEach(user => {
|
||||
if (user.id != id && user.name != null && user.email != null) {
|
||||
result.push({
|
||||
email: user.email,
|
||||
name: user.name
|
||||
});
|
||||
}
|
||||
});
|
||||
return result;
|
||||
users.getUsersForMentions = function getUsersForMentions(id) {
|
||||
const result = [];
|
||||
this.forEach((user) => {
|
||||
if (user.id !== id && user.name && user.email) {
|
||||
result.push({
|
||||
email: user.email,
|
||||
name: user.name,
|
||||
});
|
||||
}
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
// get a list of users with their name, id and email for protect
|
||||
users.getUsersForProtect = function (id) {
|
||||
var result = [];
|
||||
this.forEach(user => {
|
||||
if (user.id != id && user.name != null) {
|
||||
result.push({
|
||||
email: user.email,
|
||||
id: user.id,
|
||||
name: user.name
|
||||
});
|
||||
}
|
||||
});
|
||||
return result;
|
||||
users.getUsersForProtect = function getUsersForProtect(id) {
|
||||
const result = [];
|
||||
this.forEach((user) => {
|
||||
if (user.id !== id && user.name != null) {
|
||||
result.push({
|
||||
email: user.email,
|
||||
id: user.id,
|
||||
name: user.name,
|
||||
});
|
||||
}
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
module.exports = users;
|
||||
|
||||
@ -16,14 +16,343 @@
|
||||
*
|
||||
*/
|
||||
|
||||
const fileSystem = require('fs');
|
||||
const mime = require('mime');
|
||||
const path = require('path');
|
||||
const reqConsts = require('./request');
|
||||
const fileUtility = require("../fileUtility");
|
||||
const lockManager = require("./lockManager");
|
||||
const fileSystem = require("fs");
|
||||
const mime = require("mime");
|
||||
const path = require("path");
|
||||
const users = require("../users");
|
||||
const docManager = require("../docManager");
|
||||
const fileUtility = require('../fileUtility');
|
||||
const lockManager = require('./lockManager');
|
||||
const users = require('../users');
|
||||
const DocManager = require('../docManager');
|
||||
|
||||
// return lock mismatch
|
||||
const returnLockMismatch = function returnLockMismatch(res, lock, reason) {
|
||||
res.setHeader(reqConsts.requestHeaders.Lock, lock || ''); // set the X-WOPI-Lock header
|
||||
if (reason) { // if there is a reason for lock mismatch
|
||||
res.setHeader(reqConsts.requestHeaders.LockFailureReason, reason); // set it as the X-WOPI-LockFailureReason header
|
||||
}
|
||||
res.sendStatus(409); // conflict
|
||||
};
|
||||
|
||||
// lock file editing
|
||||
const lock = function lock(wopi, req, res, userHost) {
|
||||
const requestLock = req.headers[reqConsts.requestHeaders.Lock.toLowerCase()];
|
||||
|
||||
const userAddress = req.DocManager.curUserHostAddress(userHost); // get current user host address
|
||||
const filePath = req.DocManager.storagePath(wopi.id, userAddress); // get the storage path of the given file
|
||||
|
||||
if (!lockManager.hasLock(filePath)) {
|
||||
// file isn't locked => lock
|
||||
lockManager.lock(filePath, requestLock);
|
||||
res.sendStatus(200);
|
||||
} else if (lockManager.getLock(filePath) === requestLock) {
|
||||
// lock matches current lock => extend duration
|
||||
lockManager.lock(filePath, requestLock);
|
||||
res.sendStatus(200);
|
||||
} else {
|
||||
// file locked by someone else => return lock mismatch
|
||||
const locked = lockManager.getLock(filePath);
|
||||
returnLockMismatch(res, lock, `File already locked by ${locked}`);
|
||||
}
|
||||
};
|
||||
|
||||
const saveFileFromBody = function saveFileFromBody(req, filename, userAddress, isNewVersion, callback) {
|
||||
if (req.body) {
|
||||
const storagePath = req.DocManager.storagePath(filename, userAddress);
|
||||
let historyPath = req.DocManager.historyPath(filename, userAddress); // get the path to the file history
|
||||
if (historyPath === '') { // if it is empty
|
||||
historyPath = req.DocManager.historyPath(filename, userAddress, true); // create it
|
||||
req.DocManager.createDirectory(historyPath); // and create a new directory for the history
|
||||
}
|
||||
|
||||
let version = 0;
|
||||
if (isNewVersion) {
|
||||
const countVersion = req.DocManager.countVersion(historyPath); // get the last file version
|
||||
version = countVersion + 1; // get a number of a new file version
|
||||
// get the path to the specified file version
|
||||
const versionPath = req.DocManager.versionPath(filename, userAddress, version);
|
||||
req.DocManager.createDirectory(versionPath); // and create a new directory for the specified version
|
||||
|
||||
// get the path to the previous file version
|
||||
const pathPrev = path.join(versionPath, `prev${fileUtility.getFileExtension(filename)}`);
|
||||
fileSystem.renameSync(storagePath, pathPrev); // synchronously rename the given file as the previous file version
|
||||
}
|
||||
|
||||
const filestream = fileSystem.createWriteStream(storagePath);
|
||||
req.pipe(filestream);
|
||||
req.on('end', () => {
|
||||
filestream.close();
|
||||
callback(null, version);
|
||||
});
|
||||
} else {
|
||||
callback('empty body');
|
||||
}
|
||||
};
|
||||
|
||||
// return name that wopi-client can use as the value of X-WOPI-RelativeTarget in a future PutRelativeFile operation
|
||||
const returnValidRelativeTarget = function returnValidRelativeTarget(res, filename) {
|
||||
res.setHeader(reqConsts.requestHeaders.ValidRelativeTarget, filename); // set the X-WOPI-ValidRelativeTarget header
|
||||
res.sendStatus(409); // file with that name already exists
|
||||
};
|
||||
|
||||
// retrieve a lock on a file
|
||||
const getLock = function getLock(wopi, req, res, userHost) {
|
||||
const userAddress = req.DocManager.curUserHostAddress(userHost);
|
||||
const filePath = req.DocManager.storagePath(wopi.id, userAddress);
|
||||
|
||||
// get the lock of the specified file and set it as the X-WOPI-Lock header
|
||||
res.setHeader(reqConsts.requestHeaders.lock, lockManager.getLock(filePath));
|
||||
res.sendStatus(200);
|
||||
};
|
||||
|
||||
// refresh the lock on a file by resetting its automatic expiration timer to 30 minutes
|
||||
const refreshLock = function refreshLock(wopi, req, res, userHost) {
|
||||
const requestLock = req.headers[reqConsts.requestHeaders.Lock.toLowerCase()];
|
||||
|
||||
const userAddress = req.DocManager.curUserHostAddress(userHost);
|
||||
const filePath = req.DocManager.storagePath(wopi.id, userAddress);
|
||||
|
||||
if (!lockManager.hasLock(filePath)) {
|
||||
// file isn't locked => mismatch
|
||||
returnLockMismatch(res, '', 'File isn\'t locked');
|
||||
} else if (lockManager.getLock(filePath) === requestLock) {
|
||||
// lock matches current lock => extend duration
|
||||
lockManager.lock(filePath, requestLock);
|
||||
res.sendStatus(200);
|
||||
} else {
|
||||
// lock mismatch
|
||||
returnLockMismatch(res, lockManager.getLock(filePath), 'Lock mismatch');
|
||||
}
|
||||
};
|
||||
|
||||
// allow for file editing
|
||||
const unlock = function unlock(wopi, req, res, userHost) {
|
||||
const requestLock = req.headers[reqConsts.requestHeaders.Lock.toLowerCase()];
|
||||
|
||||
const userAddress = req.DocManager.curUserHostAddress(userHost);
|
||||
const filePath = req.DocManager.storagePath(wopi.id, userAddress);
|
||||
|
||||
if (!lockManager.hasLock(filePath)) {
|
||||
// file isn't locked => mismatch
|
||||
returnLockMismatch(res, '', 'File isn\'t locked');
|
||||
} else if (lockManager.getLock(filePath) === requestLock) {
|
||||
// lock matches current lock => unlock
|
||||
lockManager.unlock(filePath);
|
||||
res.sendStatus(200);
|
||||
} else {
|
||||
// lock mismatch
|
||||
returnLockMismatch(res, lockManager.getLock(filePath), 'Lock mismatch');
|
||||
}
|
||||
};
|
||||
|
||||
// allow for file editing, and then immediately take a new lock on the file
|
||||
const unlockAndRelock = function unlockAndRelock(wopi, req, res, userHost) {
|
||||
const requestLock = req.headers[reqConsts.requestHeaders.Lock.toLowerCase()];
|
||||
const oldLock = req.headers[reqConsts.requestHeaders.oldLock.toLowerCase()]; // get the X-WOPI-OldLock header
|
||||
|
||||
const userAddress = req.DocManager.curUserHostAddress(userHost);
|
||||
const filePath = req.DocManager.storagePath(wopi.id, userAddress);
|
||||
|
||||
if (!lockManager.hasLock(filePath)) {
|
||||
// file isn't locked => mismatch
|
||||
returnLockMismatch(res, '', 'File isn\'t locked');
|
||||
} else if (lockManager.getLock(filePath) === oldLock) {
|
||||
// lock matches current lock => lock with new key
|
||||
lockManager.lock(filePath, requestLock);
|
||||
res.sendStatus(200);
|
||||
} else {
|
||||
// lock mismatch
|
||||
returnLockMismatch(res, lockManager.getLock(filePath), 'Lock mismatch');
|
||||
}
|
||||
};
|
||||
|
||||
// request a message to retrieve a file
|
||||
const getFile = function getFile(wopi, req, res, userHost) {
|
||||
const userAddress = req.DocManager.curUserHostAddress(userHost);
|
||||
|
||||
const storagePath = req.DocManager.storagePath(wopi.id, userAddress);
|
||||
|
||||
res.setHeader('Content-Length', fileSystem.statSync(storagePath).size);
|
||||
res.setHeader('Content-Type', mime.getType(storagePath));
|
||||
|
||||
res.setHeader('Content-Disposition', `attachment; filename*=UTF-8''${encodeURIComponent(wopi.id)}`);
|
||||
|
||||
const filestream = fileSystem.createReadStream(storagePath); // open a file as a readable stream
|
||||
filestream.pipe(res); // retrieve data from file stream and output it to the response object
|
||||
};
|
||||
|
||||
// request a message to update a file
|
||||
const putFile = function putFile(wopi, req, res, userHost) {
|
||||
const requestLock = req.headers[reqConsts.requestHeaders.Lock.toLowerCase()];
|
||||
|
||||
const userAddress = req.DocManager.curUserHostAddress(userHost);
|
||||
const storagePath = req.DocManager.storagePath(wopi.id, userAddress);
|
||||
|
||||
if (!lockManager.hasLock(storagePath)) {
|
||||
// ToDo: if body length is 0 bytes => handle document creation
|
||||
|
||||
// file isn't locked => mismatch
|
||||
returnLockMismatch(res, '', 'File isn\'t locked');
|
||||
} else if (lockManager.getLock(storagePath) === requestLock) {
|
||||
// lock matches current lock => put file
|
||||
saveFileFromBody(req, wopi.id, userAddress, true, (err, version) => {
|
||||
if (!err) {
|
||||
res.setHeader(reqConsts.requestHeaders.ItemVersion, version); // set the X-WOPI-ItemVersion header
|
||||
}
|
||||
res.sendStatus(err ? 404 : 200);
|
||||
});
|
||||
} else {
|
||||
// lock mismatch
|
||||
returnLockMismatch(res, lockManager.getLock(storagePath), 'Lock mismatch');
|
||||
}
|
||||
};
|
||||
|
||||
const putRelativeFile = function putRelativeFile(wopi, req, res, userHost) {
|
||||
const userAddress = req.DocManager.curUserHostAddress(userHost);
|
||||
const storagePath = req.DocManager.storagePath(wopi.id, userAddress);
|
||||
|
||||
let filename = req.headers[reqConsts.requestHeaders.RelativeTarget.toLowerCase()]; // we cannot modify this filename
|
||||
if (filename) {
|
||||
if (req.DocManager.existsSync(storagePath)) { // check if already exists
|
||||
const overwrite = req.headers[reqConsts.requestHeaders.OverwriteRelativeTarget.toLowerCase()]; // overwrite header
|
||||
if (overwrite && overwrite === 'true') { // check if we can overwrite
|
||||
if (lockManager.hasLock(storagePath)) { // check if file locked
|
||||
// file is locked, cannot overwrite
|
||||
returnValidRelativeTarget(res, req.DocManager.getCorrectName(wopi.id, userAddress));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// file exists and overwrite header is false
|
||||
returnValidRelativeTarget(res, req.DocManager.getCorrectName(wopi.id, userAddress));
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
filename = req.headers[reqConsts.requestHeaders.SuggestedTarget.toLowerCase()]; // we can modify this filename
|
||||
|
||||
if (filename.startsWith('.')) { // check if extension
|
||||
filename = fileUtility.getFileName(wopi.id, true) + filename; // get original filename with new extension
|
||||
}
|
||||
|
||||
filename = req.DocManager.getCorrectName(filename, userAddress); // get correct filename if already exists
|
||||
}
|
||||
|
||||
const isConverted = req.headers[reqConsts.requestHeaders.FileConversion.toLowerCase()];
|
||||
console.log(`putRelativeFile after conversation: ${isConverted}`);
|
||||
|
||||
// if we got here, then we can save a file
|
||||
saveFileFromBody(req, filename, userAddress, false, (err) => {
|
||||
if (err) {
|
||||
res.sendStatus(404);
|
||||
return;
|
||||
}
|
||||
|
||||
const serverUrl = req.DocManager.getServerUrl(true);
|
||||
const fileActionUrl = `${serverUrl}/wopi-action/${filename}?action=`;
|
||||
|
||||
const fileInfo = {
|
||||
Name: filename,
|
||||
Url: `${serverUrl}/wopi/files/${filename}`,
|
||||
HostViewUrl: `${fileActionUrl}view`,
|
||||
HostEditNewUrl: `${fileActionUrl}editnew`,
|
||||
HostEditUrl: `${fileActionUrl}edit`,
|
||||
};
|
||||
res.status(200).send(fileInfo);
|
||||
});
|
||||
};
|
||||
|
||||
// return information about the file properties, access rights and editor settings
|
||||
const checkFileInfo = function checkFileInfo(wopi, req, res, userHost) {
|
||||
const userAddress = req.DocManager.curUserHostAddress(userHost);
|
||||
const version = req.DocManager.getKey(wopi.id, userAddress);
|
||||
|
||||
const storagePath = req.DocManager.storagePath(wopi.id, userAddress);
|
||||
// add wopi query
|
||||
const query = new URLSearchParams(wopi.accessToken);
|
||||
const user = users.getUser(query.get('userid'));
|
||||
|
||||
// create the file information object
|
||||
const fileInfo = {
|
||||
BaseFileName: wopi.id,
|
||||
OwnerId: req.DocManager.getFileData(wopi.id, userAddress)[1],
|
||||
Size: fileSystem.statSync(storagePath).size,
|
||||
UserId: user.id,
|
||||
UserFriendlyName: user.name,
|
||||
Version: version,
|
||||
UserCanWrite: true,
|
||||
SupportsGetLock: true,
|
||||
SupportsLocks: true,
|
||||
SupportsUpdate: true,
|
||||
};
|
||||
res.status(200).send(fileInfo);
|
||||
};
|
||||
|
||||
// parse wopi request
|
||||
const parseWopiRequest = function parseWopiRequest(req) {
|
||||
const wopiData = {
|
||||
requestType: reqConsts.requestType.None,
|
||||
accessToken: req.query.access_token,
|
||||
id: req.params.id,
|
||||
};
|
||||
|
||||
// get the request path
|
||||
const reqPath = req.path.substring('/wopi/'.length);
|
||||
|
||||
if (reqPath.startsWith('files')) { // if it starts with "files"
|
||||
if (reqPath.endsWith('/contents')) { // ends with "/contents"
|
||||
if (req.method === 'GET') { // and the request method is GET
|
||||
wopiData.requestType = reqConsts.requestType.GetFile; // then the request type is GetFile
|
||||
} else if (req.method === 'POST') { // if the request method is POST
|
||||
wopiData.requestType = reqConsts.requestType.PutFile; // then the request type is PutFile
|
||||
}
|
||||
} else if (req.method === 'GET') { // otherwise, if the request method is GET
|
||||
wopiData.requestType = reqConsts.requestType.CheckFileInfo; // the request type is CheckFileInfo
|
||||
} else if (req.method === 'POST') { // if the request method is POST
|
||||
// get the X-WOPI-Override header which determines the request type
|
||||
const wopiOverride = req.headers[reqConsts.requestHeaders.RequestType.toLowerCase()];
|
||||
switch (wopiOverride) {
|
||||
case 'LOCK': // if it is equal to LOCK
|
||||
// check if the request sends the X-WOPI-OldLock header
|
||||
if (req.headers[reqConsts.requestHeaders.OldLock.toLowerCase()]) {
|
||||
// if yes, then the request type is UnlockAndRelock
|
||||
wopiData.requestType = reqConsts.requestType.UnlockAndRelock;
|
||||
} else {
|
||||
wopiData.requestType = reqConsts.requestType.Lock; // otherwise, it is Lock
|
||||
}
|
||||
break;
|
||||
|
||||
case 'GET_LOCK': // if it is equal to GET_LOCK
|
||||
wopiData.requestType = reqConsts.requestType.GetLock; // the request type is GetLock
|
||||
break;
|
||||
|
||||
case 'REFRESH_LOCK': // if it is equal to REFRESH_LOCK
|
||||
wopiData.requestType = reqConsts.requestType.RefreshLock; // the request type is RefreshLock
|
||||
break;
|
||||
|
||||
case 'UNLOCK': // if it is equal to UNLOCK
|
||||
wopiData.requestType = reqConsts.requestType.Unlock; // the request type is Unlock
|
||||
break;
|
||||
|
||||
case 'PUT_RELATIVE': // if it is equal to PUT_RELATIVE
|
||||
// the request type is PutRelativeFile (creates a new file on the host based on the current file)
|
||||
wopiData.requestType = reqConsts.requestType.PutRelativeFile;
|
||||
break;
|
||||
|
||||
case 'RENAME_FILE': // if it is equal to RENAME_FILE
|
||||
wopiData.requestType = reqConsts.requestType.RenameFile; // the request type is RenameFile (renames a file)
|
||||
break;
|
||||
|
||||
case 'PUT_USER_INFO': // if it is equal to PUT_USER_INFO
|
||||
// the request type is PutUserInfo (stores some basic user information on the host)
|
||||
wopiData.requestType = reqConsts.requestType.PutUserInfo;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return wopiData;
|
||||
};
|
||||
|
||||
const actionMapping = {};
|
||||
actionMapping[reqConsts.requestType.GetFile] = getFile;
|
||||
@ -36,352 +365,33 @@ actionMapping[reqConsts.requestType.GetLock] = getLock;
|
||||
actionMapping[reqConsts.requestType.RefreshLock] = refreshLock;
|
||||
actionMapping[reqConsts.requestType.Unlock] = unlock;
|
||||
|
||||
// parse wopi request
|
||||
function parseWopiRequest(req) {
|
||||
let wopiData = {
|
||||
requestType: reqConsts.requestType.None,
|
||||
accessToken: req.query["access_token"],
|
||||
id: req.params['id']
|
||||
}
|
||||
|
||||
// get the request path
|
||||
let reqPath = req.path.substring("/wopi/".length)
|
||||
|
||||
if (reqPath.startsWith("files")) { // if it starts with "files"
|
||||
if (reqPath.endsWith("/contents")) { // ends with "/contents"
|
||||
if (req.method == "GET") { // and the request method is GET
|
||||
wopiData.requestType = reqConsts.requestType.GetFile; // then the request type is GetFile
|
||||
} else if (req.method == "POST") { // if the request method is POST
|
||||
wopiData.requestType = reqConsts.requestType.PutFile; // then the request type is PutFile
|
||||
}
|
||||
} else {
|
||||
if (req.method == "GET") { // otherwise, if the request method is GET
|
||||
wopiData.requestType = reqConsts.requestType.CheckFileInfo; // the request type is CheckFileInfo
|
||||
} else if (req.method == "POST") { // if the request method is POST
|
||||
let wopiOverride = req.headers[reqConsts.requestHeaders.RequestType.toLowerCase()]; // get the X-WOPI-Override header which determines the request type
|
||||
switch (wopiOverride) {
|
||||
case "LOCK": // if it is equal to LOCK
|
||||
if (req.headers[reqConsts.requestHeaders.OldLock.toLowerCase()]) { // check if the request sends the X-WOPI-OldLock header
|
||||
wopiData.requestType = reqConsts.requestType.UnlockAndRelock; // if yes, then the request type is UnlockAndRelock
|
||||
} else {
|
||||
wopiData.requestType = reqConsts.requestType.Lock; // otherwise, it is Lock
|
||||
}
|
||||
break;
|
||||
|
||||
case "GET_LOCK": // if it is equal to GET_LOCK
|
||||
wopiData.requestType = reqConsts.requestType.GetLock; // the request type is GetLock
|
||||
break;
|
||||
|
||||
case "REFRESH_LOCK": // if it is equal to REFRESH_LOCK
|
||||
wopiData.requestType = reqConsts.requestType.RefreshLock; // the request type is RefreshLock
|
||||
break;
|
||||
|
||||
case "UNLOCK": // if it is equal to UNLOCK
|
||||
wopiData.requestType = reqConsts.requestType.Unlock; // the request type is Unlock
|
||||
break;
|
||||
|
||||
case "PUT_RELATIVE": // if it is equal to PUT_RELATIVE
|
||||
wopiData.requestType = reqConsts.requestType.PutRelativeFile; // the request type is PutRelativeFile (creates a new file on the host based on the current file)
|
||||
break;
|
||||
|
||||
case "RENAME_FILE": // if it is equal to RENAME_FILE
|
||||
wopiData.requestType = reqConsts.requestType.RenameFile; // the request type is RenameFile (renames a file)
|
||||
break;
|
||||
|
||||
case "PUT_USER_INFO": // if it is equal to PUT_USER_INFO
|
||||
wopiData.requestType = reqConsts.requestType.PutUserInfo; // the request type is PutUserInfo (stores some basic user information on the host)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (reqPath.startsWith("folders")) {
|
||||
|
||||
}
|
||||
|
||||
return wopiData;
|
||||
}
|
||||
|
||||
// lock file editing
|
||||
function lock(wopi, req, res, userHost) {
|
||||
let requestLock = req.headers[reqConsts.requestHeaders.Lock.toLowerCase()];
|
||||
|
||||
let userAddress = req.docManager.curUserHostAddress(userHost); // get current user host address
|
||||
let filePath = req.docManager.storagePath(wopi.id, userAddress); // get the storage path of the given file
|
||||
|
||||
if (!lockManager.hasLock(filePath)) {
|
||||
// file isn't locked => lock
|
||||
lockManager.lock(filePath, requestLock);
|
||||
res.sendStatus(200);
|
||||
} else if (lockManager.getLock(filePath) == requestLock) {
|
||||
// lock matches current lock => extend duration
|
||||
lockManager.lock(filePath, requestLock);
|
||||
res.sendStatus(200);
|
||||
} else {
|
||||
// file locked by someone else => return lock mismatch
|
||||
let lock = lockManager.getLock(filePath);
|
||||
returnLockMismatch(res, lock, "File already locked by " + lock)
|
||||
}
|
||||
}
|
||||
|
||||
// retrieve a lock on a file
|
||||
function getLock(wopi, req, res, userHost) {
|
||||
let userAddress = req.docManager.curUserHostAddress(userHost);
|
||||
let filePath = req.docManager.storagePath(wopi.id, userAddress);
|
||||
|
||||
// get the lock of the specified file and set it as the X-WOPI-Lock header
|
||||
res.setHeader(reqConsts.requestHeaders.lock, lockManager.getLock(filePath));
|
||||
res.sendStatus(200);
|
||||
}
|
||||
|
||||
// refresh the lock on a file by resetting its automatic expiration timer to 30 minutes
|
||||
function refreshLock(wopi, req, res, userHost) {
|
||||
let requestLock = req.headers[reqConsts.requestHeaders.Lock.toLowerCase()];
|
||||
|
||||
let userAddress = req.docManager.curUserHostAddress(userHost);
|
||||
let filePath = req.docManager.storagePath(wopi.id, userAddress);
|
||||
|
||||
if (!lockManager.hasLock(filePath)) {
|
||||
// file isn't locked => mismatch
|
||||
returnLockMismatch(res, "", "File isn't locked");
|
||||
} else if (lockManager.getLock(filePath) == requestLock) {
|
||||
// lock matches current lock => extend duration
|
||||
lockManager.lock(filePath, requestLock);
|
||||
res.sendStatus(200);
|
||||
} else {
|
||||
// lock mismatch
|
||||
returnLockMismatch(res, lockManager.getLock(filePath), "Lock mismatch");
|
||||
}
|
||||
}
|
||||
|
||||
// allow for file editing
|
||||
function unlock(wopi, req, res, userHost) {
|
||||
let requestLock = req.headers[reqConsts.requestHeaders.Lock.toLowerCase()];
|
||||
|
||||
let userAddress = req.docManager.curUserHostAddress(userHost);
|
||||
let filePath = req.docManager.storagePath(wopi.id, userAddress);
|
||||
|
||||
if (!lockManager.hasLock(filePath)) {
|
||||
// file isn't locked => mismatch
|
||||
returnLockMismatch(res, "", "File isn't locked");
|
||||
} else if (lockManager.getLock(filePath) == requestLock) {
|
||||
// lock matches current lock => unlock
|
||||
lockManager.unlock(filePath);
|
||||
res.sendStatus(200);
|
||||
} else {
|
||||
// lock mismatch
|
||||
returnLockMismatch(res, lockManager.getLock(filePath), "Lock mismatch");
|
||||
}
|
||||
}
|
||||
|
||||
// allow for file editing, and then immediately take a new lock on the file
|
||||
function unlockAndRelock(wopi, req, res, userHost) {
|
||||
let requestLock = req.headers[reqConsts.requestHeaders.Lock.toLowerCase()];
|
||||
let oldLock = req.headers[reqConsts.requestHeaders.oldLock.toLowerCase()]; // get the X-WOPI-OldLock header
|
||||
|
||||
let userAddress = req.docManager.curUserHostAddress(userHost);
|
||||
let filePath = req.docManager.storagePath(wopi.id, userAddress);
|
||||
|
||||
if (!lockManager.hasLock(filePath)) {
|
||||
// file isn't locked => mismatch
|
||||
returnLockMismatch(res, "", "File isn't locked");
|
||||
} else if (lockManager.getLock(filePath) == oldLock) {
|
||||
// lock matches current lock => lock with new key
|
||||
lockManager.lock(filePath, requestLock);
|
||||
res.sendStatus(200);
|
||||
} else {
|
||||
// lock mismatch
|
||||
returnLockMismatch(res, lockManager.getLock(filePath), "Lock mismatch");
|
||||
}
|
||||
}
|
||||
|
||||
// request a message to retrieve a file
|
||||
function getFile(wopi, req, res, userHost) {
|
||||
let userAddress = req.docManager.curUserHostAddress(userHost);
|
||||
|
||||
let path = req.docManager.storagePath(wopi.id, userAddress);
|
||||
|
||||
res.setHeader("Content-Length", fileSystem.statSync(path).size);
|
||||
res.setHeader("Content-Type", mime.getType(path));
|
||||
|
||||
res.setHeader("Content-Disposition", "attachment; filename*=UTF-8\'\'" + encodeURIComponent(wopi.id));
|
||||
|
||||
let filestream = fileSystem.createReadStream(path); // open a file as a readable stream
|
||||
filestream.pipe(res); // retrieve data from file stream and output it to the response object
|
||||
}
|
||||
|
||||
// request a message to update a file
|
||||
function putFile(wopi, req, res, userHost) {
|
||||
let requestLock = req.headers[reqConsts.requestHeaders.Lock.toLowerCase()];
|
||||
|
||||
let userAddress = req.docManager.curUserHostAddress(userHost);
|
||||
let storagePath = req.docManager.storagePath(wopi.id, userAddress);
|
||||
|
||||
if (!lockManager.hasLock(storagePath)) {
|
||||
// ToDo: if body length is 0 bytes => handle document creation
|
||||
|
||||
// file isn't locked => mismatch
|
||||
returnLockMismatch(res, "", "File isn't locked");
|
||||
} else if (lockManager.getLock(storagePath) == requestLock) {
|
||||
// lock matches current lock => put file
|
||||
saveFileFromBody(req, wopi.id, userAddress, true, (err, version) => {
|
||||
if (!err) {
|
||||
res.setHeader(reqConsts.requestHeaders.ItemVersion, version); // set the X-WOPI-ItemVersion header
|
||||
}
|
||||
res.sendStatus(err ? 404 : 200);
|
||||
});
|
||||
} else {
|
||||
// lock mismatch
|
||||
returnLockMismatch(res, lockManager.getLock(storagePath), "Lock mismatch");
|
||||
}
|
||||
}
|
||||
|
||||
function putRelativeFile(wopi, req, res, userHost) {
|
||||
let userAddress = req.docManager.curUserHostAddress(userHost);
|
||||
let storagePath = req.docManager.storagePath(wopi.id, userAddress);
|
||||
|
||||
let filename = req.headers[reqConsts.requestHeaders.RelativeTarget.toLowerCase()]; // we cannot modify this filename
|
||||
if (filename) {
|
||||
if (req.docManager.existsSync(storagePath)) { // check if already exists
|
||||
let overwrite = req.headers[reqConsts.requestHeaders.OverwriteRelativeTarget.toLowerCase()]; // overwrite header
|
||||
if (overwrite && overwrite === "true") { // check if we can overwrite
|
||||
if (lockManager.hasLock(storagePath)) { // check if file locked
|
||||
returnValidRelativeTarget(res, req.docManager.getCorrectName(wopi.id, userAddress)); // file is locked, cannot overwrite
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
returnValidRelativeTarget(res, req.docManager.getCorrectName(wopi.id, userAddress)); // file exists and overwrite header is false
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
filename = req.headers[reqConsts.requestHeaders.SuggestedTarget.toLowerCase()]; // we can modify this filename
|
||||
|
||||
if (filename.startsWith(".")) { // check if extension
|
||||
filename = fileUtility.getFileName(wopi.id, true) + filename; // get original filename with new extension
|
||||
}
|
||||
|
||||
filename = req.docManager.getCorrectName(filename, userAddress); // get correct filename if already exists
|
||||
}
|
||||
|
||||
let isConverted = req.headers[reqConsts.requestHeaders.FileConversion.toLowerCase()];
|
||||
console.log("putRelativeFile after conversation: " + isConverted);
|
||||
|
||||
// if we got here, then we can save a file
|
||||
saveFileFromBody(req, filename, userAddress, false, (err) => {
|
||||
if (err) {
|
||||
res.sendStatus(404);
|
||||
return;
|
||||
}
|
||||
|
||||
let serverUrl = req.docManager.getServerUrl(true);
|
||||
let fileActionUrl = serverUrl + "/wopi-action/" + filename + "?action=";
|
||||
|
||||
let fileInfo = {
|
||||
"Name": filename,
|
||||
"Url": serverUrl + "/wopi/files/" + filename,
|
||||
"HostViewUrl": fileActionUrl + "view",
|
||||
"HostEditNewUrl": fileActionUrl + "editnew",
|
||||
"HostEditUrl": fileActionUrl + "edit",
|
||||
};
|
||||
res.status(200).send(fileInfo);
|
||||
});
|
||||
}
|
||||
|
||||
// return information about the file properties, access rights and editor settings
|
||||
function checkFileInfo(wopi, req, res, userHost) {
|
||||
let userAddress = req.docManager.curUserHostAddress(userHost);
|
||||
let version = req.docManager.getKey(wopi.id, userAddress);
|
||||
|
||||
let path = req.docManager.storagePath(wopi.id, userAddress);
|
||||
// add wopi query
|
||||
var query = new URLSearchParams(wopi.accessToken);
|
||||
let user = users.getUser(query.get("userid"));
|
||||
|
||||
// create the file information object
|
||||
let fileInfo = {
|
||||
"BaseFileName": wopi.id,
|
||||
"OwnerId": req.docManager.getFileData(wopi.id, userAddress)[1],
|
||||
"Size": fileSystem.statSync(path).size,
|
||||
"UserId": user.id,
|
||||
"UserFriendlyName": user.name,
|
||||
"Version": version,
|
||||
"UserCanWrite": true,
|
||||
"SupportsGetLock": true,
|
||||
"SupportsLocks": true,
|
||||
"SupportsUpdate": true,
|
||||
};
|
||||
res.status(200).send(fileInfo);
|
||||
}
|
||||
|
||||
function saveFileFromBody(req, filename, userAddress, isNewVersion, callback) {
|
||||
if (req.body) {
|
||||
var storagePath = req.docManager.storagePath(filename, userAddress);
|
||||
var historyPath = req.docManager.historyPath(filename, userAddress); // get the path to the file history
|
||||
if (historyPath == "") { // if it is empty
|
||||
historyPath = req.docManager.historyPath(filename, userAddress, true); // create it
|
||||
req.docManager.createDirectory(historyPath); // and create a new directory for the history
|
||||
}
|
||||
|
||||
var version = 0;
|
||||
if (isNewVersion) {
|
||||
var count_version = req.docManager.countVersion(historyPath); // get the last file version
|
||||
version = count_version + 1; // get a number of a new file version
|
||||
var versionPath = req.docManager.versionPath(filename, userAddress, version); // get the path to the specified file version
|
||||
req.docManager.createDirectory(versionPath); // and create a new directory for the specified version
|
||||
|
||||
var path_prev = path.join(versionPath, "prev" + fileUtility.getFileExtension(filename)); // get the path to the previous file version
|
||||
fileSystem.renameSync(storagePath, path_prev); // synchronously rename the given file as the previous file version
|
||||
}
|
||||
|
||||
let filestream = fileSystem.createWriteStream(storagePath);
|
||||
req.pipe(filestream);
|
||||
req.on('end', () => {
|
||||
filestream.close();
|
||||
callback(null, version);
|
||||
})
|
||||
} else {
|
||||
callback("empty body");
|
||||
}
|
||||
}
|
||||
|
||||
// return name that wopi-client can use as the value of X-WOPI-RelativeTarget in a future PutRelativeFile operation
|
||||
function returnValidRelativeTarget(res, filename) {
|
||||
res.setHeader(reqConsts.requestHeaders.ValidRelativeTarget, filename); // set the X-WOPI-ValidRelativeTarget header
|
||||
res.sendStatus(409); // file with that name already exists
|
||||
}
|
||||
|
||||
// return lock mismatch
|
||||
function returnLockMismatch(res, lock, reason) {
|
||||
res.setHeader(reqConsts.requestHeaders.Lock, lock || ""); // set the X-WOPI-Lock header
|
||||
if (reason) { // if there is a reason for lock mismatch
|
||||
res.setHeader(reqConsts.requestHeaders.LockFailureReason, reason); // set it as the X-WOPI-LockFailureReason header
|
||||
}
|
||||
res.sendStatus(409); // conflict
|
||||
}
|
||||
|
||||
exports.fileRequestHandler = (req, res) => {
|
||||
let userAddress = null;
|
||||
req.docManager = new docManager(req, res);
|
||||
if (req.params['id'].includes("@")) { // if there is the "@" sign in the id parameter
|
||||
let split = req.params['id'].split("@"); // split this parameter by "@"
|
||||
req.params['id'] = split[0]; // rewrite id with the first part of the split parameter
|
||||
userAddress = split[1]; // save the second part as the user address
|
||||
}
|
||||
let userAddress = null;
|
||||
req.DocManager = new DocManager(req, res);
|
||||
if (req.params.id.includes('@')) { // if there is the "@" sign in the id parameter
|
||||
const split = req.params.id.split('@'); // split this parameter by "@"
|
||||
[req.params.id] = split; // rewrite id with the first part of the split parameter
|
||||
[, userAddress] = split; // save the second part as the user address
|
||||
}
|
||||
|
||||
let wopiData = parseWopiRequest(req); // get the wopi data
|
||||
const wopiData = parseWopiRequest(req); // get the wopi data
|
||||
|
||||
// an error of the unknown request type
|
||||
if (wopiData.requestType == reqConsts.requestType.None) {
|
||||
res.status(500).send({ 'title': 'fileHandler', 'method': req.method, 'id': req.params['id'], 'error': "unknown" });
|
||||
return;
|
||||
}
|
||||
// an error of the unknown request type
|
||||
if (wopiData.requestType === reqConsts.requestType.None) {
|
||||
res.status(500).send({
|
||||
title: 'fileHandler', method: req.method, id: req.params.id, error: 'unknown',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// an error of the unsupported request type
|
||||
let action = actionMapping[wopiData.requestType];
|
||||
if (!action) {
|
||||
res.status(501).send({ 'title': 'fileHandler', 'method': req.method, 'id': req.params['id'], 'error': "unsupported" });
|
||||
return;
|
||||
}
|
||||
// an error of the unsupported request type
|
||||
const action = actionMapping[wopiData.requestType];
|
||||
if (!action) {
|
||||
res.status(501).send({
|
||||
title: 'fileHandler', method: req.method, id: req.params.id, error: 'unsupported',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
action(wopiData, req, res, userAddress);
|
||||
}
|
||||
action(wopiData, req, res, userAddress);
|
||||
};
|
||||
|
||||
@ -16,54 +16,54 @@
|
||||
*
|
||||
*/
|
||||
|
||||
var lockDict = {};
|
||||
const lockDict = {};
|
||||
|
||||
// get the lock object of the specified file
|
||||
function getLockObject(filePath) {
|
||||
return lockDict[filePath];
|
||||
}
|
||||
const getLockObject = function getLockObject(filePath) {
|
||||
return lockDict[filePath];
|
||||
};
|
||||
|
||||
// clear the lock timeout
|
||||
function clearLockTimeout(lockObject) {
|
||||
if (lockObject && lockObject.timeout) {
|
||||
clearTimeout(lockObject.timeout);
|
||||
}
|
||||
}
|
||||
const clearLockTimeout = function clearLockTimeout(lockObject) {
|
||||
if (lockObject && lockObject.timeout) {
|
||||
clearTimeout(lockObject.timeout);
|
||||
}
|
||||
};
|
||||
|
||||
// get the lock value of the specified file
|
||||
function getLockValue(filePath) {
|
||||
let lock = getLockObject(filePath); // get the lock object of the specified file
|
||||
if (lock) return lock.value; // if it exists, get the lock value from it
|
||||
return "";
|
||||
}
|
||||
const getLockValue = function getLockValue(filePath) {
|
||||
const lock = getLockObject(filePath); // get the lock object of the specified file
|
||||
if (lock) return lock.value; // if it exists, get the lock value from it
|
||||
return '';
|
||||
};
|
||||
|
||||
// check if the specified file path has lock or not
|
||||
function hasLock(filePath) {
|
||||
return !!getLockObject(filePath);
|
||||
}
|
||||
|
||||
// lock file editing
|
||||
function lock(filePath, lockValue) {
|
||||
let oldLock = getLockObject(filePath); // get the old lock of the specified file
|
||||
clearLockTimeout(oldLock); // clear its timeout
|
||||
|
||||
// create a new lock object
|
||||
lockDict[filePath] = {
|
||||
value: lockValue,
|
||||
timeout: setTimeout(unlock, 1000 * 60 * 30, filePath) // set lock for 30 minutes
|
||||
}
|
||||
}
|
||||
const hasLock = function hasLock(filePath) {
|
||||
return !!getLockObject(filePath);
|
||||
};
|
||||
|
||||
// allow for file editing
|
||||
function unlock(filePath) {
|
||||
let lock = getLockObject(filePath); // get the lock of the specified file
|
||||
clearLockTimeout(lock); // clear its timeout
|
||||
delete lockDict[filePath]; // delete the lock
|
||||
}
|
||||
const unlock = function unlock(filePath) {
|
||||
const lock = getLockObject(filePath); // get the lock of the specified file
|
||||
clearLockTimeout(lock); // clear its timeout
|
||||
delete lockDict[filePath]; // delete the lock
|
||||
};
|
||||
|
||||
// lock file editing
|
||||
const lock = function lock(filePath, lockValue) {
|
||||
const oldLock = getLockObject(filePath); // get the old lock of the specified file
|
||||
clearLockTimeout(oldLock); // clear its timeout
|
||||
|
||||
// create a new lock object
|
||||
lockDict[filePath] = {
|
||||
value: lockValue,
|
||||
timeout: setTimeout(unlock, 1000 * 60 * 30, filePath), // set lock for 30 minutes
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
hasLock: hasLock,
|
||||
getLock: getLockValue,
|
||||
lock: lock,
|
||||
unlock: unlock
|
||||
}
|
||||
hasLock,
|
||||
getLock: getLockValue,
|
||||
lock,
|
||||
unlock,
|
||||
};
|
||||
|
||||
@ -18,55 +18,55 @@
|
||||
|
||||
// request types
|
||||
const requestType = Object.freeze({
|
||||
"None": 0,
|
||||
None: 0,
|
||||
|
||||
"CheckFileInfo": 1,
|
||||
"PutRelativeFile": 2,
|
||||
CheckFileInfo: 1,
|
||||
PutRelativeFile: 2,
|
||||
|
||||
"Lock": 3,
|
||||
"GetLock": 4,
|
||||
"Unlock": 5,
|
||||
"RefreshLock": 6,
|
||||
"UnlockAndRelock": 7,
|
||||
Lock: 3,
|
||||
GetLock: 4,
|
||||
Unlock: 5,
|
||||
RefreshLock: 6,
|
||||
UnlockAndRelock: 7,
|
||||
|
||||
"ExecuteCobaltRequest": 8,
|
||||
ExecuteCobaltRequest: 8,
|
||||
|
||||
"DeleteFile": 9,
|
||||
"ReadSecureStore": 10,
|
||||
"GetRestrictedLink": 11,
|
||||
"RevokeRestrictedLink": 12,
|
||||
DeleteFile: 9,
|
||||
ReadSecureStore: 10,
|
||||
GetRestrictedLink: 11,
|
||||
RevokeRestrictedLink: 12,
|
||||
|
||||
"CheckFolderInfo": 13,
|
||||
CheckFolderInfo: 13,
|
||||
|
||||
"GetFile": 14,
|
||||
"PutFile": 16,
|
||||
GetFile: 14,
|
||||
PutFile: 16,
|
||||
|
||||
"EnumerateChildren": 16,
|
||||
EnumerateChildren: 16,
|
||||
|
||||
"RenameFile": 17,
|
||||
"PutUserInfo": 18,
|
||||
RenameFile: 17,
|
||||
PutUserInfo: 18,
|
||||
});
|
||||
|
||||
// request headers
|
||||
const requestHeaders = Object.freeze({
|
||||
"RequestType": "X-WOPI-Override",
|
||||
"ItemVersion": "X-WOPI-ItemVersion",
|
||||
RequestType: 'X-WOPI-Override',
|
||||
ItemVersion: 'X-WOPI-ItemVersion',
|
||||
|
||||
"Lock": "X-WOPI-Lock",
|
||||
"OldLock": "X-WOPI-OldLock",
|
||||
"LockFailureReason": "X-WOPI-LockFailureReason",
|
||||
"LockedByOtherInterface": "X-WOPI-LockedByOtherInterface",
|
||||
Lock: 'X-WOPI-Lock',
|
||||
OldLock: 'X-WOPI-OldLock',
|
||||
LockFailureReason: 'X-WOPI-LockFailureReason',
|
||||
LockedByOtherInterface: 'X-WOPI-LockedByOtherInterface',
|
||||
|
||||
"FileConversion": "X-WOPI-FileConversion",
|
||||
FileConversion: 'X-WOPI-FileConversion',
|
||||
|
||||
"SuggestedTarget": "X-WOPI-SuggestedTarget",
|
||||
"RelativeTarget": "X-WOPI-RelativeTarget",
|
||||
"OverwriteRelativeTarget": "X-WOPI-OverwriteRelativeTarget",
|
||||
SuggestedTarget: 'X-WOPI-SuggestedTarget',
|
||||
RelativeTarget: 'X-WOPI-RelativeTarget',
|
||||
OverwriteRelativeTarget: 'X-WOPI-OverwriteRelativeTarget',
|
||||
|
||||
"ValidRelativeTarget": "X-WOPI-ValidRelativeTarget",
|
||||
ValidRelativeTarget: 'X-WOPI-ValidRelativeTarget',
|
||||
});
|
||||
|
||||
module.exports = {
|
||||
requestType: requestType,
|
||||
requestHeaders: requestHeaders,
|
||||
}
|
||||
requestType,
|
||||
requestHeaders,
|
||||
};
|
||||
|
||||
@ -16,8 +16,4 @@
|
||||
*
|
||||
*/
|
||||
|
||||
exports.isValidToken = (req, res, next) => {
|
||||
if (true) {
|
||||
return next();
|
||||
}
|
||||
}
|
||||
exports.isValidToken = (req, res, next) => next();
|
||||
|
||||
@ -16,129 +16,139 @@
|
||||
*
|
||||
*/
|
||||
|
||||
const config = require("config");
|
||||
const configServer = config.get("server");
|
||||
var urlModule = require("url");
|
||||
var urllib = require("urllib");
|
||||
const xmlParser = require("fast-xml-parser");
|
||||
const he = require("he");
|
||||
const siteUrl = configServer.get("siteUrl"); // the path to the editors installation
|
||||
const config = require('config');
|
||||
const urlModule = require('url');
|
||||
const urllib = require('urllib');
|
||||
const xmlParser = require('fast-xml-parser');
|
||||
const he = require('he');
|
||||
|
||||
var cache = null;
|
||||
const configServer = config.get('server');
|
||||
const siteUrl = configServer.get('siteUrl'); // the path to the editors installation
|
||||
|
||||
async function initWopi(docManager) {
|
||||
let absSiteUrl = siteUrl;
|
||||
if (absSiteUrl.indexOf("/") === 0) {
|
||||
absSiteUrl = docManager.getServerHost() + siteUrl;
|
||||
}
|
||||
let cache = null;
|
||||
|
||||
// get the wopi discovery information
|
||||
await getDiscoveryInfo(absSiteUrl);
|
||||
}
|
||||
const requestDiscovery = async function requestDiscovery(url) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
return new Promise((resolve, reject) => {
|
||||
const actions = [];
|
||||
urllib.request(urlModule.parse(url + configServer.get('wopi.discovery')), { method: 'GET' }, (err, data) => {
|
||||
if (data) {
|
||||
// create the discovery XML file with the parameters from the response
|
||||
const discovery = xmlParser.parse(data.toString(), {
|
||||
attributeNamePrefix: '',
|
||||
ignoreAttributes: false,
|
||||
parseAttributeValue: true,
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
attrValueProcessor: (val, attrName) => he.decode(val, { isAttributeValue: true }),
|
||||
});
|
||||
if (discovery['wopi-discovery']) {
|
||||
discovery['wopi-discovery']['net-zone'].app.forEach((app) => {
|
||||
let appAction = app.action;
|
||||
if (!Array.isArray(appAction)) {
|
||||
appAction = [appAction];
|
||||
}
|
||||
appAction.forEach((action) => {
|
||||
actions.push({ // write all the parameters to the actions element
|
||||
app: app.name,
|
||||
favIconUrl: app.favIconUrl,
|
||||
checkLicense: app.checkLicense === 'true',
|
||||
name: action.name,
|
||||
ext: action.ext || '',
|
||||
progid: action.progid || '',
|
||||
isDefault: !!action.default,
|
||||
urlsrc: action.urlsrc,
|
||||
requires: action.requires || '',
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
resolve(actions);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// get the wopi discovery information
|
||||
async function getDiscoveryInfo(siteUrl) {
|
||||
let actions = [];
|
||||
const getDiscoveryInfo = async function getDiscoveryInfo(url) {
|
||||
let actions = [];
|
||||
|
||||
if (cache) return cache;
|
||||
|
||||
try {
|
||||
actions = await requestDiscovery(siteUrl);
|
||||
} catch (e) {
|
||||
return actions;
|
||||
}
|
||||
|
||||
cache = actions;
|
||||
setTimeout(() => cache = null, 1000 * 60 * 60); // 1 hour
|
||||
if (cache) return cache;
|
||||
|
||||
try {
|
||||
actions = await requestDiscovery(url);
|
||||
} catch (e) {
|
||||
return actions;
|
||||
}
|
||||
}
|
||||
|
||||
async function requestDiscovery(siteUrl) {
|
||||
return new Promise((resolve, reject) => {
|
||||
var actions = [];
|
||||
urllib.request(urlModule.parse(siteUrl + configServer.get("wopi.discovery")), {method: "GET"}, (err, data) => {
|
||||
if (data) {
|
||||
let discovery = xmlParser.parse(data.toString(), { // create the discovery XML file with the parameters from the response
|
||||
attributeNamePrefix: "",
|
||||
ignoreAttributes: false,
|
||||
parseAttributeValue: true,
|
||||
attrValueProcessor: (val, attrName) => he.decode(val, {isAttributeValue: true})
|
||||
});
|
||||
if (discovery["wopi-discovery"]) {
|
||||
for (let app of discovery["wopi-discovery"]["net-zone"].app) {
|
||||
if (!Array.isArray(app.action)) {
|
||||
app.action = [app.action];
|
||||
}
|
||||
for (let action of app.action) {
|
||||
actions.push({ // write all the parameters to the actions element
|
||||
app: app.name,
|
||||
favIconUrl: app.favIconUrl,
|
||||
checkLicense: app.checkLicense == 'true',
|
||||
name: action.name,
|
||||
ext: action.ext || "",
|
||||
progid: action.progid || "",
|
||||
isDefault: action.default ? true : false,
|
||||
urlsrc: action.urlsrc,
|
||||
requires: action.requires || ""
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
resolve(actions);
|
||||
});
|
||||
})
|
||||
}
|
||||
cache = actions;
|
||||
setTimeout(() => {
|
||||
cache = null;
|
||||
return cache;
|
||||
}, 1000 * 60 * 60); // 1 hour
|
||||
|
||||
return actions;
|
||||
};
|
||||
|
||||
const initWopi = async function initWopi(DocManager) {
|
||||
let absSiteUrl = siteUrl;
|
||||
if (absSiteUrl.indexOf('/') === 0) {
|
||||
absSiteUrl = DocManager.getServerHost() + siteUrl;
|
||||
}
|
||||
|
||||
// get the wopi discovery information
|
||||
await getDiscoveryInfo(absSiteUrl);
|
||||
};
|
||||
|
||||
// get actions of the specified extension
|
||||
async function getActions(ext) {
|
||||
let actions = await getDiscoveryInfo(); // get the wopi discovery information
|
||||
let filtered = [];
|
||||
const getActions = async function getActions(ext) {
|
||||
const actions = await getDiscoveryInfo(); // get the wopi discovery information
|
||||
const filtered = [];
|
||||
|
||||
for (let action of actions) { // and filter it by the specified extention
|
||||
if (action.ext == ext) {
|
||||
filtered.push(action);
|
||||
}
|
||||
actions.forEach((action) => { // and filter it by the specified extention
|
||||
if (action.ext === ext) {
|
||||
filtered.push(action);
|
||||
}
|
||||
});
|
||||
|
||||
return filtered;
|
||||
}
|
||||
return filtered;
|
||||
};
|
||||
|
||||
// get an action for the specified extension and name
|
||||
async function getAction(ext, name) {
|
||||
let actions = await getDiscoveryInfo();
|
||||
const getAction = async function getAction(ext, name) {
|
||||
const actions = await getDiscoveryInfo();
|
||||
let act = null;
|
||||
|
||||
for (let action of actions) {
|
||||
if (action.ext == ext && action.name == name) {
|
||||
return action;
|
||||
}
|
||||
actions.forEach((action) => {
|
||||
if (action.ext === ext && action.name === name) {
|
||||
act = action;
|
||||
}
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
return act;
|
||||
};
|
||||
|
||||
// get the default action for the specified extension
|
||||
async function getDefaultAction(ext) {
|
||||
let actions = await getDiscoveryInfo();
|
||||
const getDefaultAction = async function getDefaultAction(ext) {
|
||||
const actions = await getDiscoveryInfo();
|
||||
let act = null;
|
||||
|
||||
for (let action of actions) {
|
||||
if (action.ext == ext && action.isDefault) {
|
||||
return action;
|
||||
}
|
||||
actions.forEach((action) => {
|
||||
if (action.ext === ext && action.isDefault) {
|
||||
act = action;
|
||||
}
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
return act;
|
||||
};
|
||||
|
||||
// get the action url
|
||||
function getActionUrl(host, userAddress, action, filename) {
|
||||
return action.urlsrc.replace(/<.*&>/g, "") + "WOPISrc=" + host + "/wopi/files/" + filename + "@" + userAddress;
|
||||
}
|
||||
const getActionUrl = function getActionUrl(host, userAddress, action, filename) {
|
||||
return `${action.urlsrc.replace(/<.*&>/g, '')}WOPISrc=${host}/wopi/files/${filename}@${userAddress}`;
|
||||
};
|
||||
|
||||
exports.initWopi = initWopi;
|
||||
exports.getDiscoveryInfo = getDiscoveryInfo;
|
||||
exports.getAction = getAction;
|
||||
exports.getActions = getActions;
|
||||
exports.getActionUrl = getActionUrl;
|
||||
exports.getDefaultAction = getDefaultAction;
|
||||
exports.getDefaultAction = getDefaultAction;
|
||||
|
||||
@ -16,157 +16,160 @@
|
||||
*
|
||||
*/
|
||||
|
||||
const tokenValidator = require("./tokenValidator");
|
||||
const filesController = require("./filesController");
|
||||
const utils = require("./utils");
|
||||
const docManager = require("../docManager");
|
||||
const fileUtility = require("../fileUtility");
|
||||
const config = require('config');
|
||||
const tokenValidator = require('./tokenValidator');
|
||||
const filesController = require('./filesController');
|
||||
const utils = require('./utils');
|
||||
const DocManager = require('../docManager');
|
||||
const fileUtility = require('../fileUtility');
|
||||
const users = require('../users');
|
||||
|
||||
const configServer = config.get('server');
|
||||
const siteUrl = configServer.get("siteUrl"); // the path to the editors installation
|
||||
const users = require("../users");
|
||||
const siteUrl = configServer.get('siteUrl'); // the path to the editors installation
|
||||
|
||||
getCustomWopiParams = function (query) {
|
||||
let tokenParams = "";
|
||||
let actionParams = "";
|
||||
const getCustomWopiParams = function getCustomWopiParams(query) {
|
||||
let tokenParams = '';
|
||||
let actionParams = '';
|
||||
|
||||
const userid = query.userid; // user id
|
||||
tokenParams += (userid ? "&userid=" + userid : "");
|
||||
const { userid } = query; // user id
|
||||
tokenParams += (userid ? `&userid=${userid}` : '');
|
||||
|
||||
const lang = query.lang; // language
|
||||
actionParams += (lang ? "&ui=" + lang : "");
|
||||
const { lang } = query; // language
|
||||
actionParams += (lang ? `&ui=${lang}` : '');
|
||||
|
||||
return { "tokenParams": tokenParams, "actionParams": actionParams };
|
||||
return { tokenParams, actionParams };
|
||||
};
|
||||
|
||||
exports.registerRoutes = function(app) {
|
||||
exports.registerRoutes = function registerRoutes(app) {
|
||||
// define a handler for the default wopi page
|
||||
app.get('/wopi', async (req, res) => {
|
||||
req.DocManager = new DocManager(req, res);
|
||||
|
||||
// define a handler for the default wopi page
|
||||
app.get("/wopi", async function(req, res) {
|
||||
await utils.initWopi(req.DocManager);
|
||||
|
||||
req.docManager = new docManager(req, res);
|
||||
// get the wopi discovery information
|
||||
const actions = await utils.getDiscoveryInfo();
|
||||
const wopiEnable = actions.length !== 0;
|
||||
const docsExtEdit = []; // Supported extensions for WOPI
|
||||
|
||||
await utils.initWopi(req.docManager);
|
||||
|
||||
// get the wopi discovery information
|
||||
let actions = await utils.getDiscoveryInfo();
|
||||
let wopiEnable = actions.length != 0 ? true : false;
|
||||
let docsExtEdit = []; // Supported extensions for WOPI
|
||||
|
||||
actions.forEach(el => {
|
||||
if (el.name == "edit") docsExtEdit.push("."+el.ext);
|
||||
});
|
||||
|
||||
let editedExts = configServer.get('editedDocs').filter(i => docsExtEdit.includes(i)); // Checking supported extensions
|
||||
let fillExts = configServer.get("fillDocs").filter(i => docsExtEdit.includes(i));
|
||||
|
||||
try {
|
||||
// get all the stored files
|
||||
let files = req.docManager.getStoredFiles();
|
||||
|
||||
// run through all the files and write the corresponding information to each file
|
||||
for (var file of files) {
|
||||
let ext = fileUtility.getFileExtension(file.name, true); // get an extension of each file
|
||||
file.actions = await utils.getActions(ext); // get actions of the specified extension
|
||||
file.defaultAction = await utils.getDefaultAction(ext); // get the default action of the specified extension
|
||||
}
|
||||
|
||||
// render wopiIndex template with the parameters specified
|
||||
res.render("wopiIndex", {
|
||||
wopiEnable : wopiEnable,
|
||||
storedFiles: wopiEnable ? files : [],
|
||||
params: req.docManager.getCustomParams(),
|
||||
users: users,
|
||||
serverUrl: req.docManager.getServerUrl(),
|
||||
preloaderUrl: siteUrl + configServer.get('preloaderUrl'),
|
||||
convertExts: configServer.get('convertedDocs'),
|
||||
editedExts: editedExts,
|
||||
fillExts: fillExts,
|
||||
languages: configServer.get('languages'),
|
||||
});
|
||||
|
||||
} catch (ex) {
|
||||
console.log(ex); // display error message in the console
|
||||
res.status(500); // write status parameter to the response
|
||||
res.render("error", { message: "Server error" }); // render error template with the message parameter specified
|
||||
return;
|
||||
}
|
||||
});
|
||||
// define a handler for creating a new wopi editing session
|
||||
app.get("/wopi-new", function(req, res) {
|
||||
var fileExt = req.query.fileExt; // get the file extension from the request
|
||||
|
||||
req.docManager = new docManager(req, res);
|
||||
|
||||
if (fileExt != null) { // if the file extension exists
|
||||
var fileName = req.docManager.getCorrectName("new." + fileExt)
|
||||
var redirectPath = req.docManager.getServerUrl(true) + "/wopi-action/" + encodeURIComponent(fileName) + "?action=editnew" + req.docManager.getCustomParams(); // get the redirect path
|
||||
res.redirect(redirectPath);
|
||||
return;
|
||||
}
|
||||
});
|
||||
// define a handler for getting wopi action information by its id
|
||||
app.get("/wopi-action/:id", async function(req, res) {
|
||||
try {
|
||||
req.docManager = new docManager(req, res);
|
||||
|
||||
await utils.initWopi(req.docManager);
|
||||
|
||||
var fileName = req.docManager.getCorrectName(req.params['id'])
|
||||
var fileExt = fileUtility.getFileExtension(fileName, true); // get the file extension from the request
|
||||
var user = users.getUser(req.query.userid); // get a user by the id
|
||||
|
||||
// get an action for the specified extension and name
|
||||
let action = await utils.getAction(fileExt, req.query["action"]);
|
||||
|
||||
if (action != null && req.query["action"] == "editnew") {
|
||||
fileName = req.docManager.RequestEditnew(req, fileName, user);
|
||||
}
|
||||
|
||||
// render wopiAction template with the parameters specified
|
||||
res.render("wopiAction", {
|
||||
actionUrl: utils.getActionUrl(req.docManager.getServerUrl(true), req.docManager.curUserHostAddress(), action, req.params['id']),
|
||||
token: "test",
|
||||
tokenTtl: Date.now() + 1000 * 60 * 60 * 10,
|
||||
params: getCustomWopiParams(req.query),
|
||||
});
|
||||
|
||||
} catch (ex) {
|
||||
console.log(ex);
|
||||
res.status(500);
|
||||
res.render("error", { message: "Server error" });
|
||||
return;
|
||||
}
|
||||
actions.forEach((el) => {
|
||||
if (el.name === 'edit') docsExtEdit.push(`.${el.ext}`);
|
||||
});
|
||||
|
||||
// define a handler for getting file information by its id
|
||||
app.route('/wopi/files/:id')
|
||||
.all(tokenValidator.isValidToken)
|
||||
.get(filesController.fileRequestHandler)
|
||||
.post(filesController.fileRequestHandler);
|
||||
// Checking supported extensions
|
||||
const editedExts = fileUtility.getEditExtensions().filter((i) => docsExtEdit.includes(i));
|
||||
const fillExts = fileUtility.getFillExtensions().filter((i) => docsExtEdit.includes(i));
|
||||
|
||||
// define a handler for reading/writing the file contents
|
||||
app.route('/wopi/files/:id/contents')
|
||||
.all(tokenValidator.isValidToken)
|
||||
.get(filesController.fileRequestHandler)
|
||||
.post(filesController.fileRequestHandler);
|
||||
try {
|
||||
// get all the stored files
|
||||
const files = req.DocManager.getStoredFiles();
|
||||
|
||||
// define a handler for getting folder information by its id
|
||||
app.route('/wopi/folders/:id')
|
||||
.all(tokenValidator.isValidToken)
|
||||
.get(filesController.fileRequestHandler)
|
||||
.post(filesController.fileRequestHandler);
|
||||
// run through all the files and write the corresponding information to each file
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const file of files) {
|
||||
const ext = fileUtility.getFileExtension(file.name, true); // get an extension of each file
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
file.actions = await utils.getActions(ext); // get actions of the specified extension
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
file.defaultAction = await utils.getDefaultAction(ext);// get the default action of the specified extension
|
||||
}
|
||||
|
||||
// define a handler for reading/writing the folder contents
|
||||
app.route('/wopi/folders/:id/contents')
|
||||
.all(tokenValidator.isValidToken)
|
||||
.get(filesController.fileRequestHandler)
|
||||
.post(filesController.fileRequestHandler);
|
||||
// render wopiIndex template with the parameters specified
|
||||
res.render('wopiIndex', {
|
||||
wopiEnable,
|
||||
storedFiles: wopiEnable ? files : [],
|
||||
params: req.DocManager.getCustomParams(),
|
||||
users,
|
||||
preloaderUrl: siteUrl + configServer.get('preloaderUrl'),
|
||||
convertExts: fileUtility.getConvertExtensions(),
|
||||
editedExts,
|
||||
fillExts,
|
||||
languages: configServer.get('languages'),
|
||||
});
|
||||
} catch (ex) {
|
||||
console.log(ex); // display error message in the console
|
||||
res.status(500); // write status parameter to the response
|
||||
// render error template with the message parameter specified
|
||||
res.render('error', { message: 'Server error' });
|
||||
}
|
||||
});
|
||||
// define a handler for creating a new wopi editing session
|
||||
app.get('/wopi-new', (req, res) => {
|
||||
const { fileExt } = req.query; // get the file extension from the request
|
||||
|
||||
// define a handler for upload files
|
||||
app.route('/wopi/upload')
|
||||
.all(tokenValidator.isValidToken)
|
||||
.get(filesController.fileRequestHandler)
|
||||
.post(filesController.fileRequestHandler);
|
||||
req.DocManager = new DocManager(req, res);
|
||||
|
||||
if (fileExt) { // if the file extension exists
|
||||
const fileName = req.DocManager.getCorrectName(`new.${fileExt}`);
|
||||
const redirectPath = `${req.DocManager.getServerUrl(true)}/wopi-action/`
|
||||
+ `${encodeURIComponent(fileName)}?action=editnew${req.DocManager.getCustomParams()}`; // get the redirect path
|
||||
res.redirect(redirectPath);
|
||||
}
|
||||
});
|
||||
// define a handler for getting wopi action information by its id
|
||||
app.get('/wopi-action/:id', async (req, res) => {
|
||||
try {
|
||||
req.DocManager = new DocManager(req, res);
|
||||
|
||||
await utils.initWopi(req.DocManager);
|
||||
|
||||
let fileName = req.DocManager.getCorrectName(req.params.id);
|
||||
const fileExt = fileUtility.getFileExtension(fileName, true); // get the file extension from the request
|
||||
const user = users.getUser(req.query.userid); // get a user by the id
|
||||
|
||||
// get an action for the specified extension and name
|
||||
const action = await utils.getAction(fileExt, req.query.action);
|
||||
|
||||
if (action && req.query.action === 'editnew') {
|
||||
fileName = req.DocManager.requestEditnew(req, fileName, user);
|
||||
}
|
||||
|
||||
// render wopiAction template with the parameters specified
|
||||
res.render('wopiAction', {
|
||||
actionUrl: utils.getActionUrl(
|
||||
req.DocManager.getServerUrl(true),
|
||||
req.DocManager.curUserHostAddress(),
|
||||
action,
|
||||
req.params.id,
|
||||
),
|
||||
token: 'test',
|
||||
tokenTtl: Date.now() + 1000 * 60 * 60 * 10,
|
||||
params: getCustomWopiParams(req.query),
|
||||
});
|
||||
} catch (ex) {
|
||||
console.log(ex);
|
||||
res.status(500);
|
||||
res.render('error', { message: 'Server error' });
|
||||
}
|
||||
});
|
||||
|
||||
// define a handler for getting file information by its id
|
||||
app.route('/wopi/files/:id')
|
||||
.all(tokenValidator.isValidToken)
|
||||
.get(filesController.fileRequestHandler)
|
||||
.post(filesController.fileRequestHandler);
|
||||
|
||||
// define a handler for reading/writing the file contents
|
||||
app.route('/wopi/files/:id/contents')
|
||||
.all(tokenValidator.isValidToken)
|
||||
.get(filesController.fileRequestHandler)
|
||||
.post(filesController.fileRequestHandler);
|
||||
|
||||
// define a handler for getting folder information by its id
|
||||
app.route('/wopi/folders/:id')
|
||||
.all(tokenValidator.isValidToken)
|
||||
.get(filesController.fileRequestHandler)
|
||||
.post(filesController.fileRequestHandler);
|
||||
|
||||
// define a handler for reading/writing the folder contents
|
||||
app.route('/wopi/folders/:id/contents')
|
||||
.all(tokenValidator.isValidToken)
|
||||
.get(filesController.fileRequestHandler)
|
||||
.post(filesController.fileRequestHandler);
|
||||
|
||||
// define a handler for upload files
|
||||
app.route('/wopi/upload')
|
||||
.all(tokenValidator.isValidToken)
|
||||
.get(filesController.fileRequestHandler)
|
||||
.post(filesController.fileRequestHandler);
|
||||
};
|
||||
|
||||
@ -20,13 +20,17 @@ express - Fast, unopinionated, minimalist web framework for node. (https:/
|
||||
License: MIT
|
||||
License File: express.license
|
||||
|
||||
fast-xml-parser - Validate XML, Parse XML to JS/JSON and vice versa, or parse XML to Nimn rapidly without C/C++ based libraries and no callback. (https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/LICENSE)
|
||||
License: MIT
|
||||
License File: fast-xml-parser.license
|
||||
|
||||
formidable - A Node.js module for parsing form data, especially file uploads. (https://github.com/node-formidable/formidable/blob/master/LICENSE)
|
||||
License: MIT
|
||||
License File: formidable.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
he - a robust HTML entity encoder/decoder written in JavaScript. (https://github.com/mathiasbynens/he/blob/master/LICENSE-MIT.txt)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
License File: he.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
@ -40,9 +44,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
|
||||
Submodule web/documentserver-example/nodejs/public/assets/document-formats added at 6c4927a0d1
@ -34,30 +34,17 @@ if (typeof jQuery != "undefined") {
|
||||
else
|
||||
language = jq("#language").val();
|
||||
|
||||
|
||||
jq("#language").change(function() {
|
||||
window.location = "?lang=" + jq(this).val() + "&userid=" + userid + "&directUrl=" + directUrl;
|
||||
});
|
||||
|
||||
if ("" != userid && undefined != userid)
|
||||
jq("#user").val(userid);
|
||||
else
|
||||
userid = jq("#user").val();
|
||||
|
||||
jq("#user").change(function() {
|
||||
window.location = "?lang=" + language + "&userid=" + jq(this).val() + "&directUrl=" + directUrl;
|
||||
});
|
||||
|
||||
|
||||
if (directUrl)
|
||||
jq("#directUrl").prop("checked", directUrl);
|
||||
else
|
||||
directUrl = jq("#directUrl").prop("checked");
|
||||
|
||||
jq("#directUrl").change(function() {
|
||||
window.location = "?lang=" + language + "&userid=" + userid + "&directUrl=" + jq(this).prop("checked");
|
||||
});
|
||||
|
||||
|
||||
jq(function () {
|
||||
jq('#fileupload').fileupload({
|
||||
@ -111,7 +98,7 @@ if (typeof jQuery != "undefined") {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var timer = null;
|
||||
var checkConvert = function (filePass) {
|
||||
filePass = filePass ? filePass : null;
|
||||
@ -126,7 +113,7 @@ if (typeof jQuery != "undefined") {
|
||||
jq("#filePass").val("");
|
||||
|
||||
var fileName = jq("#hiddenFileName").val();
|
||||
var posExt = fileName.lastIndexOf('.');
|
||||
var posExt = fileName.lastIndexOf('.') + 1;
|
||||
posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : '';
|
||||
|
||||
if (ConverExtList.indexOf(posExt) == -1) {
|
||||
@ -207,7 +194,7 @@ if (typeof jQuery != "undefined") {
|
||||
jq("#beginView, #beginEmbedded").removeClass("disable");
|
||||
|
||||
var fileName = jq("#hiddenFileName").val();
|
||||
var posExt = fileName.lastIndexOf('.');
|
||||
var posExt = fileName.lastIndexOf('.') + 1;
|
||||
posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : '';
|
||||
|
||||
var checkEdited = EditedExtList.split(",").filter(function(ext) { return ext == posExt;});
|
||||
@ -230,6 +217,20 @@ if (typeof jQuery != "undefined") {
|
||||
}
|
||||
});
|
||||
|
||||
jq(document).on("click", ".action-link", function (e) {
|
||||
e.preventDefault();
|
||||
let url = this.href + collectParams(true);
|
||||
let target = null;
|
||||
|
||||
if (e.target.hasAttribute("target")) {
|
||||
target = e.target.getAttribute("target");
|
||||
} else if (e.target.parentNode.hasAttribute("target")) {
|
||||
target = e.target.parentNode.getAttribute("target");
|
||||
}
|
||||
|
||||
target !== null ? window.open(url, target) : window.location = url;
|
||||
});
|
||||
|
||||
jq(document).on("click", "#skipPass", function () {
|
||||
jq("#blockPassword").hide();
|
||||
loadScripts();
|
||||
@ -238,32 +239,32 @@ if (typeof jQuery != "undefined") {
|
||||
jq(document).on("click", "#beginEdit:not(.disable)", function () {
|
||||
var fileId = encodeURIComponent(jq('#hiddenFileName').val());
|
||||
if (UrlEditor == "wopi-action"){
|
||||
var url = UrlEditor + "/" + fileId + "?action=edit";
|
||||
var url = UrlEditor + "/" + fileId + "?action=edit" + collectParams(true);
|
||||
}else{
|
||||
var url = UrlEditor + "?fileName=" + fileId + "&lang=" + language + "&userid=" + userid + "&directUrl=" + directUrl;
|
||||
var url = UrlEditor + "?fileName=" + fileId + collectParams(true);
|
||||
}
|
||||
window.open(url, "_blank");
|
||||
jq('#hiddenFileName').val("");
|
||||
jq.unblockUI();
|
||||
document.location.reload(true);
|
||||
window.location = collectParams();
|
||||
});
|
||||
|
||||
jq(document).on("click", "#beginView:not(.disable)", function () {
|
||||
var fileId = encodeURIComponent(jq('#hiddenFileName').val());
|
||||
if (UrlEditor == "wopi-action"){
|
||||
var url = UrlEditor + "/" + fileId + "?action=view";
|
||||
var url = UrlEditor + "/" + fileId + "?action=view" + collectParams(true);
|
||||
}else{
|
||||
var url = UrlEditor + "?mode=view&fileName=" + fileId + "&lang=" + language + "&userid=" + userid + "&directUrl=" + directUrl;
|
||||
var url = UrlEditor + "?mode=view&fileName=" + fileId + collectParams(true);
|
||||
}
|
||||
window.open(url, "_blank");
|
||||
jq('#hiddenFileName').val("");
|
||||
jq.unblockUI();
|
||||
document.location.reload(true);
|
||||
window.location = collectParams();
|
||||
});
|
||||
|
||||
jq(document).on("click", "#beginEmbedded:not(.disable)", function () {
|
||||
var fileId = encodeURIComponent(jq('#hiddenFileName').val());
|
||||
var url = UrlEditor + "?type=embedded&fileName=" + fileId + "&lang=" + language + "&userid=" + userid + "&directUrl=" + directUrl;
|
||||
var url = UrlEditor + "?type=embedded&fileName=" + fileId + collectParams(true);
|
||||
|
||||
jq("#mainProgress").addClass("embedded");
|
||||
jq("#beginEmbedded").addClass("disable");
|
||||
@ -272,13 +273,13 @@ if (typeof jQuery != "undefined") {
|
||||
});
|
||||
|
||||
jq(document).on("click", ".reload-page", function () {
|
||||
setTimeout(function () { document.location.reload(true); }, 1000);
|
||||
setTimeout(function () { window.location = collectParams(); }, 1000);
|
||||
return true;
|
||||
});
|
||||
|
||||
jq(document).on("mouseup", ".reload-page", function (event) {
|
||||
if (event.which == 2) {
|
||||
setTimeout(function () { document.location.reload(true); }, 1000);
|
||||
setTimeout(function () { window.location = collectParams(); }, 1000);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
@ -288,12 +289,13 @@ if (typeof jQuery != "undefined") {
|
||||
jq("#embeddedView").remove();
|
||||
jq.unblockUI();
|
||||
if (mustReload) {
|
||||
document.location.reload(true);
|
||||
window.location = collectParams();
|
||||
}
|
||||
});
|
||||
|
||||
jq(document).on("click", ".delete-file", function () {
|
||||
var fileName = jq(this).attr("data");
|
||||
const currentElement = jq(this);
|
||||
var fileName = currentElement.attr("data");
|
||||
|
||||
var requestAddress = "file?filename=" + fileName;
|
||||
|
||||
@ -303,7 +305,16 @@ if (typeof jQuery != "undefined") {
|
||||
type: "delete",
|
||||
url: requestAddress,
|
||||
complete: function (data) {
|
||||
document.location.reload(true);
|
||||
if (JSON.parse(data.responseText).success) {
|
||||
const parentRow = currentElement.parents('tr')[0];
|
||||
if (parentRow) {
|
||||
jq(parentRow).remove();
|
||||
}
|
||||
const remainingRows = jq('tr.tableRow');
|
||||
if (remainingRows.length === 0) {
|
||||
window.location = collectParams();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -394,4 +405,32 @@ function getUrlVars() {
|
||||
vars[hash[0]] = hash[1];
|
||||
}
|
||||
return vars;
|
||||
};
|
||||
};
|
||||
|
||||
function collectParams(startParams) {
|
||||
let paramsObjects = Array.prototype.slice.call(document.getElementsByClassName('collectable'));
|
||||
let params = [];
|
||||
let startChar = startParams ? "&" : "?";
|
||||
paramsObjects.forEach( function (element) {
|
||||
if (element.name) {
|
||||
switch (element.type) {
|
||||
case "select-one":
|
||||
case "text":
|
||||
if (element.value) {
|
||||
params.push(element.name + "=" + element.value);
|
||||
}
|
||||
break;
|
||||
case "checkbox":
|
||||
params.push(element.name + "=" + element.checked);
|
||||
break;
|
||||
case "radio":
|
||||
if (element.checked) {
|
||||
params.push(element.name + "=" + element.value);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
});
|
||||
return startChar + params.join("&");
|
||||
}
|
||||
|
||||
@ -39,6 +39,7 @@
|
||||
|
||||
var docEditor;
|
||||
var config;
|
||||
let historyObject;
|
||||
|
||||
var innerAlert = function (message, inEditor) {
|
||||
if (console && console.log)
|
||||
@ -72,26 +73,72 @@
|
||||
};
|
||||
|
||||
var onRequestHistory = function (event) { // the user is trying to show the document version history
|
||||
var historyObj = <%- JSON.stringify(history) %> || null;
|
||||
|
||||
docEditor.refreshHistory( // show the document version history
|
||||
const fileName = "<%- file.name %>" || null;
|
||||
const directUrl = "<%- file.directUrl %>" || null;
|
||||
const data = {
|
||||
fileName: fileName,
|
||||
directUrl: directUrl
|
||||
};
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "historyObj");
|
||||
xhr.setRequestHeader("Content-Type", "application/json");
|
||||
xhr.send(JSON.stringify(data));
|
||||
xhr.onload = function () {
|
||||
historyObject = JSON.parse(xhr.responseText);
|
||||
docEditor.refreshHistory( // show the document version history
|
||||
{
|
||||
currentVersion: "<%- file.version %>",
|
||||
history: historyObj
|
||||
currentVersion: historyObject.countVersion,
|
||||
history: historyObject.history
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var onRequestHistoryData = function (data) { // the user is trying to click the specific document version in the document version history
|
||||
var version = data.data;
|
||||
var historyData = <%- JSON.stringify(historyData) %> || null;
|
||||
|
||||
docEditor.setHistoryData(historyData[version-1]); // send the link to the document for viewing the version history
|
||||
var onRequestHistoryData = function (event) { // the user is trying to click the specific document version in the document version history
|
||||
const version = event.data;
|
||||
docEditor.setHistoryData(historyObject.historyData[version-1]); // send the link to the document for viewing the version history
|
||||
};
|
||||
|
||||
var onRequestHistoryClose = function (event){ // the user is trying to go back to the document from viewing the document version history
|
||||
document.location.reload();
|
||||
};
|
||||
|
||||
var onRequestRestore = function (event) { // the user is trying to restore file version
|
||||
const version = event.data.version;
|
||||
const fileName = "<%- file.name %>" || null;
|
||||
const directUrl = "<%- file.directUrl %>" || null;
|
||||
const restoreData = {
|
||||
version: version,
|
||||
fileName: fileName,
|
||||
};
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("PUT", "restore");
|
||||
xhr.setRequestHeader('Content-Type', 'application/json');
|
||||
xhr.send(JSON.stringify(restoreData));
|
||||
xhr.onload = function () {
|
||||
const response = JSON.parse(xhr.responseText);
|
||||
if (response.success && !response.error) {
|
||||
const dataForHistory = {
|
||||
fileName: fileName,
|
||||
directUrl: directUrl
|
||||
};
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "historyObj");
|
||||
xhr.setRequestHeader("Content-Type", "application/json");
|
||||
xhr.send(JSON.stringify(dataForHistory));
|
||||
xhr.onload = function () {
|
||||
historyObject = JSON.parse(xhr.responseText);
|
||||
docEditor.refreshHistory( // show the document version history
|
||||
{
|
||||
currentVersion: historyObject.countVersion,
|
||||
history: historyObject.history
|
||||
});
|
||||
}
|
||||
} else {
|
||||
innerAlert(response.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var onError = function (event) { // an error or some other specific event occurs
|
||||
if (event)
|
||||
innerAlert(event.data);
|
||||
@ -235,6 +282,7 @@
|
||||
config.events.onRequestHistory = onRequestHistory;
|
||||
config.events.onRequestHistoryData = onRequestHistoryData;
|
||||
config.events.onRequestHistoryClose = onRequestHistoryClose;
|
||||
config.events.onRequestRestore = onRequestRestore;
|
||||
config.events.onRequestRename = onRequestRename;
|
||||
config.events.onRequestUsers = onRequestUsers;
|
||||
config.events.onRequestSendNotify = onRequestSendNotify;
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
<body>
|
||||
<header>
|
||||
<div class="center">
|
||||
<a href="">
|
||||
<a href="./">
|
||||
<img src ="images/logo.svg" alt="ONLYOFFICE" />
|
||||
</a>
|
||||
</div>
|
||||
@ -48,16 +48,16 @@
|
||||
<div class="create-panel clearFix">
|
||||
<ul class="try-editor-list clearFix">
|
||||
<li>
|
||||
<a class="try-editor word reload-page" target="_blank" href="editor?fileExt=docx<%= params %>" title="Create new document">Document</a>
|
||||
<a class="try-editor word reload-page action-link" target="_blank" href="editor?fileExt=docx" title="Create new document">Document</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="try-editor cell reload-page" target="_blank" href="editor?fileExt=xlsx<%= params %>" title="Create new spreadsheet">Spreadsheet</a>
|
||||
<a class="try-editor cell reload-page action-link" target="_blank" href="editor?fileExt=xlsx" title="Create new spreadsheet">Spreadsheet</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="try-editor slide reload-page" target="_blank" href="editor?fileExt=pptx<%= params %>" title="Create new presentation">Presentation</a>
|
||||
<a class="try-editor slide reload-page action-link" target="_blank" href="editor?fileExt=pptx" title="Create new presentation">Presentation</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="try-editor form reload-page" target="_blank" href="editor?fileExt=docxf<%= params %>" title="Create new form template">Form template</a>
|
||||
<a class="try-editor form reload-page action-link" target="_blank" href="editor?fileExt=docxf" title="Create new form template">Form template</a>
|
||||
</li>
|
||||
</ul>
|
||||
<label class="side-option">
|
||||
@ -67,7 +67,7 @@
|
||||
|
||||
<div class="upload-panel clearFix">
|
||||
<a class="file-upload">Upload file
|
||||
<input type="file" id="fileupload" name="uploadedFile" data-url="upload?<%= params %>" />
|
||||
<input type="file" id="fileupload" name="uploadedFile" data-url="upload" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@ -77,7 +77,7 @@
|
||||
<td valign="middle">
|
||||
<span class="select-user">Username</span>
|
||||
<img id="info" class="info" src="images/info.svg" />
|
||||
<select class="select-user" id="user">
|
||||
<select class="select-user collectable" name="userid" id="user">
|
||||
<% users.forEach(user => { %>
|
||||
<option value="<%= user.id %>"><%= user.name == null ? "Anonymous" : user.name %></option>
|
||||
<% }) %>
|
||||
@ -88,7 +88,7 @@
|
||||
<td valign="middle">
|
||||
<span class="select-user">Language</span>
|
||||
<img class="info info-tooltip" data-id="language" data-tooltip="Choose the language for ONLYOFFICE editors interface" src="images/info.svg" />
|
||||
<select class="select-user" id="language">
|
||||
<select class="select-user collectable" name="lang" id="language">
|
||||
<% Object.keys(languages).forEach(key => { %>
|
||||
<option value="<%= key %>"><%= languages[key] %></option>
|
||||
<% }) %>
|
||||
@ -98,7 +98,7 @@
|
||||
<tr>
|
||||
<td valign="middle">
|
||||
<label class="side-option">
|
||||
<input id="directUrl" type="checkbox" class="checkbox" />Try opening on client
|
||||
<input id="directUrl" type="checkbox" class="checkbox collectable" name="directUrl" />Try opening on client
|
||||
<img id="directUrlInfo" class="info info-tooltip" data-id="directUrlInfo" data-tooltip="Some files can be opened in the user's browser without connecting to the document server." src="images/info.svg" />
|
||||
</label>
|
||||
</td>
|
||||
@ -107,7 +107,7 @@
|
||||
</table>
|
||||
|
||||
<div class="links-panel links-panel-border clearFix">
|
||||
<a href="<%= serverUrl %>/wopi" class="">Go to WOPI page</a>
|
||||
<a href="wopi" class="">Go to WOPI page</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -154,33 +154,33 @@
|
||||
<% for (var i = 0; i < storedFiles.length; i++) { %>
|
||||
<tr class="tableRow" title="<%= storedFiles[i].name %> [<%= storedFiles[i].version %>]">
|
||||
<td class="contentCells">
|
||||
<a class="stored-edit <%= storedFiles[i].documentType %>" href="editor?fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
<a class="stored-edit <%= storedFiles[i].documentType %> action-link" href="editor?fileName=<%= encodeURIComponent(storedFiles[i].name) %>" target="_blank">
|
||||
<span><%= storedFiles[i].name %></span>
|
||||
</a>
|
||||
</td>
|
||||
<% if (storedFiles[i].canEdit) { %>
|
||||
<td class="contentCells contentCells-icon">
|
||||
<a href="editor?type=desktop&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
<a class="action-link" href="editor?type=desktop&fileName=<%= encodeURIComponent(storedFiles[i].name) %>" target="_blank">
|
||||
<img src="images/desktop.svg" alt="Open in editor for full size screens" title="Open in editor for full size screens" /></a>
|
||||
</td>
|
||||
<td class="contentCells contentCells-icon">
|
||||
<a href="editor?type=desktop&mode=comment&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
<a class="action-link" href="editor?type=desktop&mode=comment&fileName=<%= encodeURIComponent(storedFiles[i].name) %>" target="_blank">
|
||||
<img src="images/comment.svg" alt="Open in editor for comment" title="Open in editor for comment" /></a>
|
||||
</td>
|
||||
<% if (storedFiles[i].documentType == "word") { %>
|
||||
<td class="contentCells contentCells-icon">
|
||||
<a href="editor?type=desktop&mode=review&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
<a class="action-link" href="editor?type=desktop&mode=review&fileName=<%= encodeURIComponent(storedFiles[i].name) %>" target="_blank">
|
||||
<img src="images/review.svg" alt="Open in editor for review" title="Open in editor for review" /></a>
|
||||
</td>
|
||||
<% } else if (storedFiles[i].documentType == "cell") { %>
|
||||
<td class="contentCells contentCells-icon">
|
||||
<a href="editor?type=desktop&mode=filter&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
<a class="action-link" href="editor?type=desktop&mode=filter&fileName=<%= encodeURIComponent(storedFiles[i].name) %>" target="_blank">
|
||||
<img src="images/filter.svg" alt="Open in editor without access to change the filter" title="Open in editor without access to change the filter" /></a>
|
||||
</td>
|
||||
<% } %>
|
||||
<% if (storedFiles[i].documentType == "word") { %>
|
||||
<td class="contentCells contentCells-icon">
|
||||
<a href="editor?type=desktop&mode=blockcontent&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
<a class="action-link" href="editor?type=desktop&mode=blockcontent&fileName=<%= encodeURIComponent(storedFiles[i].name) %>" target="_blank">
|
||||
<img src="images/block-content.svg" alt="Open in editor without content control modification" title="Open in editor without content control modification" /></a>
|
||||
</td>
|
||||
<% } else { %>
|
||||
@ -189,44 +189,44 @@
|
||||
<% if (storedFiles[i].documentType !== "word" && storedFiles[i].documentType !== "cell") {%>
|
||||
<td class="contentCells contentCells-icon "></td>
|
||||
<% } %>
|
||||
<% if (fillExts.indexOf(storedFiles[i].name.substring(storedFiles[i].name.lastIndexOf('.')).trim().toLowerCase()) !== -1) { %>
|
||||
<% if (fillExts.indexOf(storedFiles[i].name.substring(storedFiles[i].name.lastIndexOf('.') + 1).trim().toLowerCase()) !== -1) { %>
|
||||
<td class="contentCells contentCells-icon">
|
||||
<a href="editor?type=desktop&mode=fillForms&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
<a class="action-link" href="editor?type=desktop&mode=fillForms&fileName=<%= encodeURIComponent(storedFiles[i].name) %>" target="_blank">
|
||||
<img src="images/fill-forms.svg" alt="Open in editor for filling in forms" title="Open in editor for filling in forms" /></a>
|
||||
</td>
|
||||
<% } else {%>
|
||||
<td class="contentCells contentCells-icon"></td>
|
||||
<%}%>
|
||||
<td class="contentCells contentCells-shift contentCells-icon firstContentCellShift">
|
||||
<a href="editor?type=mobile&mode=edit&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
<a class="action-link" href="editor?type=mobile&mode=edit&fileName=<%= encodeURIComponent(storedFiles[i].name) %>" target="_blank">
|
||||
<img src="images/mobile.svg" alt="Open in editor for mobile devices" title="Open in editor for mobile devices" /></a>
|
||||
</td>
|
||||
<% } else if (fillExts.indexOf(storedFiles[i].name.substring(storedFiles[i].name.lastIndexOf('.')).trim().toLowerCase()) !== -1) { %>
|
||||
<% } else if (fillExts.indexOf(storedFiles[i].name.substring(storedFiles[i].name.lastIndexOf('.') + 1).trim().toLowerCase()) !== -1) { %>
|
||||
<td class="contentCells contentCells-icon "></td>
|
||||
<td class="contentCells contentCells-icon "></td>
|
||||
<td class="contentCells contentCells-icon "></td>
|
||||
<td class="contentCells contentCells-icon "></td>
|
||||
<td class="contentCells contentCells-icon">
|
||||
<a href="editor?type=desktop&mode=fillForms&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
<a class="action-link" href="editor?type=desktop&mode=fillForms&fileName=<%= encodeURIComponent(storedFiles[i].name) %>" target="_blank">
|
||||
<img src="images/fill-forms.svg" alt="Open in editor for filling in forms" title="Open in editor for filling in forms" /></a>
|
||||
</td>
|
||||
<td class="contentCells contentCells-shift contentCells-icon firstContentCellShift">
|
||||
<a href="editor?type=mobile&mode=fillForms&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
<a class="action-link" href="editor?type=mobile&mode=fillForms&fileName=<%= encodeURIComponent(storedFiles[i].name) %>" target="_blank">
|
||||
<img src="images/mobile-fill-forms.svg" alt="Open in editor for filling in forms for mobile devices" title="Open in editor for filling in forms for mobile devices" /></a>
|
||||
</td>
|
||||
<% } else { %>
|
||||
<td class="contentCells contentCells-shift contentCells-icon contentCellsEmpty" colspan="6"></td>
|
||||
<% } %>
|
||||
<td class="contentCells contentCells-icon firstContentCellViewers">
|
||||
<a href="editor?type=desktop&mode=view&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
<a class="action-link" href="editor?type=desktop&mode=view&fileName=<%= encodeURIComponent(storedFiles[i].name) %>" target="_blank">
|
||||
<img src="images/desktop.svg" alt="Open in viewer for full size screens" title="Open in viewer for full size screens" /></a>
|
||||
</td>
|
||||
<td class="contentCells contentCells-icon">
|
||||
<a href="editor?type=mobile&mode=view&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
<a class="action-link" href="editor?type=mobile&mode=view&fileName=<%= encodeURIComponent(storedFiles[i].name) %>" target="_blank">
|
||||
<img src="images/mobile.svg" alt="Open in viewer for mobile devices" title="Open in viewer for mobile devices" /></a>
|
||||
</td>
|
||||
<td class="contentCells contentCells-icon contentCells-shift">
|
||||
<a href="editor?type=embedded&mode=embedded&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
<a class="action-link" href="editor?type=embedded&mode=embedded&fileName=<%= encodeURIComponent(storedFiles[i].name) %>" target="_blank">
|
||||
<img src="images/embeded.svg" alt="Open in embedded mode" title="Open in embedded mode" /></a>
|
||||
</td>
|
||||
<td class="contentCells contentCells-icon contentCells-shift downloadContentCellShift">
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
<body>
|
||||
<header>
|
||||
<div class="center">
|
||||
<a href="">
|
||||
<a href="wopi">
|
||||
<img src="images/logo.svg" alt="ONLYOFFICE" />
|
||||
</a>
|
||||
</div>
|
||||
@ -51,16 +51,16 @@
|
||||
<div class="create-panel clearFix">
|
||||
<ul class="try-editor-list clearFix">
|
||||
<li>
|
||||
<a class="try-editor word reload-page" target="_blank" href="<%= serverUrl %>/wopi-new?fileExt=docx<%= params %>" title="Create new document">Document</a>
|
||||
<a class="try-editor word reload-page action-link" target="_blank" href="wopi-new?fileExt=docx" title="Create new document">Document</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="try-editor cell reload-page" target="_blank" href="<%= serverUrl %>/wopi-new?fileExt=xlsx<%= params %>" title="Create new spreadsheet">Spreadsheet</a>
|
||||
<a class="try-editor cell reload-page action-link" target="_blank" href="wopi-new?fileExt=xlsx" title="Create new spreadsheet">Spreadsheet</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="try-editor slide reload-page" target="_blank" href="<%= serverUrl %>/wopi-new?fileExt=pptx<%= params %>" title="Create new presentation">Presentation</a>
|
||||
<a class="try-editor slide reload-page action-link" target="_blank" href="wopi-new?fileExt=pptx" title="Create new presentation">Presentation</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="try-editor form reload-page" target="_blank" href="<%= serverUrl %>/wopi-new?fileExt=docxf<%= params %>" title="Create new form template">Form template</a>
|
||||
<a class="try-editor form reload-page action-link" target="_blank" href="wopi-new?fileExt=docxf" title="Create new form template">Form template</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@ -68,7 +68,7 @@
|
||||
|
||||
<div class="upload-panel clearFix">
|
||||
<a class="file-upload">Upload file
|
||||
<input type="file" id="fileupload" name="uploadedFile" data-url="upload?<%= params %>" />
|
||||
<input type="file" id="fileupload" name="uploadedFile" data-url="upload" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@ -78,7 +78,7 @@
|
||||
<td valign="middle">
|
||||
<span class="select-user">Username</span>
|
||||
<img id="info" class="info" data-id="user" src="images/info.svg" />
|
||||
<select class="select-user" id="user">
|
||||
<select class="select-user collectable" name="userid" id="user">
|
||||
<% users.forEach(user => { %>
|
||||
<option value="<%= user.id %>"><%= user.name == null ? "Anonymous" : user.name %></option>
|
||||
<% }) %>
|
||||
@ -89,7 +89,7 @@
|
||||
<td valign="middle">
|
||||
<span class="select-user">Language</span>
|
||||
<img class="info info-tooltip" data-id="language" data-tooltip="Choose the language for ONLYOFFICE editors interface" src="images/info.svg" />
|
||||
<select class="select-user" id="language">
|
||||
<select class="select-user collectable" name="lang" id="language">
|
||||
<% Object.keys(languages).forEach(key => { %>
|
||||
<option value="<%= key %>"><%= languages[key] %></option>
|
||||
<% }) %>
|
||||
@ -100,7 +100,7 @@
|
||||
</table>
|
||||
|
||||
<div class="links-panel links-panel-border clearFix">
|
||||
<a href="<%= serverUrl %>/" class="">Go to Index page</a>
|
||||
<a href="./" class="">Go to Index page</a>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
@ -148,7 +148,7 @@
|
||||
<tr class="tableRow" title="<%= storedFiles[i].name %> [<%= storedFiles[i].version %>]">
|
||||
<td class="contentCells">
|
||||
<% if (storedFiles[i].defaultAction) { %>
|
||||
<a class="stored-edit <%= storedFiles[i].documentType %>" href="<%= serverUrl %>/wopi-action/<%= encodeURIComponent(storedFiles[i].name) %>?action=<%= storedFiles[i].defaultAction.name %><%= params %>" target="_blank">
|
||||
<a class="stored-edit <%= storedFiles[i].documentType %> action-link" href="wopi-action/<%= encodeURIComponent(storedFiles[i].name) %>?action=<%= storedFiles[i].defaultAction.name %>" target="_blank">
|
||||
<%} else { %>
|
||||
<a class="stored-edit <%= storedFiles[i].documentType %>" href="#">
|
||||
<% } %>
|
||||
@ -158,7 +158,7 @@
|
||||
<% if (storedFiles[i].actions && storedFiles[i].actions.length > 0) { %>
|
||||
<td class="contentCells contentCells-wopi contentCells-shift">
|
||||
<% for (var j = 0; j < storedFiles[i].actions.length; j++) { %>
|
||||
<a href="<%= serverUrl %>/wopi-action/<%= encodeURIComponent(storedFiles[i].name) %>?action=<%= storedFiles[i].actions[j].name %><%= params %>" target="_blank">
|
||||
<a class="action-link" href="wopi-action/<%= encodeURIComponent(storedFiles[i].name) %>?action=<%= storedFiles[i].actions[j].name %>" target="_blank">
|
||||
<img
|
||||
src="images/wopi-<%= storedFiles[i].actions[j].name %>.svg"
|
||||
alt="<%= storedFiles[i].actions[j].name %>" title="<%= storedFiles[i].actions[j].name %>" />
|
||||
@ -167,7 +167,7 @@
|
||||
</td>
|
||||
<% } %>
|
||||
<td class="contentCells contentCells-icon contentCells-shift downloadContentCells">
|
||||
<a href="<%= serverUrl %>/wopi/files/<%= encodeURIComponent(storedFiles[i].name) %>/contents">
|
||||
<a href="wopi/files/<%= encodeURIComponent(storedFiles[i].name) %>/contents">
|
||||
<img class="icon-download" src="images/download.svg" alt="Download" title="Download" /></a>
|
||||
</td>
|
||||
<td class="contentCells contentCells-icon contentCells-shift">
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
ONLYOFFICE Applications example uses code from the following 3rd party projects:
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -16,9 +12,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
|
||||
@ -34,6 +34,7 @@ You can use any web server capable of running PHP code to run the example. We wi
|
||||
* **IIS**: version 7 or later (refer to [Microsoft official website](https://www.iis.net/learn/application-frameworks/scenario-build-a-php-website-on-iis/configuring-step-1-install-iis-and-php) to learn how to install IIS);
|
||||
* **PHP** (download it from the [http://php.net](https://php.net/downloads.php) site);
|
||||
* **PHP Manager for IIS** (download it from the [Microsoft open source site](https://phpmanager.codeplex.com/releases/view/69115)).
|
||||
* **Composer** (download it from the [Composer official website](https://getcomposer.org/download/)).
|
||||
|
||||
### Step 4. IIS configuration
|
||||
|
||||
@ -78,7 +79,13 @@ You can use any web server capable of running PHP code to run the example. We wi
|
||||
|
||||
After IIS manager configuration is complete, everything is ready for running the PHP example.
|
||||
|
||||
### Step 5. Run your website with the editors
|
||||
### Step 5. Run *composer install*:
|
||||
|
||||
```
|
||||
php composer.phar install
|
||||
```
|
||||
|
||||
### Step 6. Run your website with the editors
|
||||
|
||||
1. Add your website in the IIS Manager.
|
||||
|
||||
@ -100,7 +107,7 @@ You can use any web server capable of running PHP code to run the example. We wi
|
||||
|
||||

|
||||
|
||||
### Step 6. Check accessibility
|
||||
### Step 7. Check accessibility
|
||||
|
||||
In case the example and Document Server are installed on different computers, make sure that your server with the example installed has access to the Document Server with the address which you specify instead of **documentserver** in the configuration files.
|
||||
|
||||
@ -124,8 +131,11 @@ See the detailed guide to learn how to [install Document Server for Linux](https
|
||||
|
||||
2. Install **Composer**:
|
||||
|
||||
To install composer globally, use the following command which will download and install Composer as a system-wide command named composer, under /usr/local/bin:
|
||||
|
||||
```
|
||||
instructions should be here
|
||||
curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
|
||||
sudo php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
|
||||
```
|
||||
|
||||
3. Download the archive with the PHP example and unpack the archive:
|
||||
|
||||
@ -95,15 +95,10 @@ function saveas()
|
||||
$title = $post["title"];
|
||||
$extension = mb_strtolower(pathinfo($title, PATHINFO_EXTENSION));
|
||||
$configManager = new ConfigManager();
|
||||
$allexts = array_merge(
|
||||
$configManager->getConfig("docServConvert"),
|
||||
$configManager->getConfig("docServEdited"),
|
||||
$configManager->getConfig("docServViewd"),
|
||||
$configManager->getConfig("docServFillforms")
|
||||
);
|
||||
$allexts = $configManager->getSuppotredExtensions();
|
||||
$filename = GetCorrectName($title);
|
||||
|
||||
if (!in_array("." . $extension, $allexts)) {
|
||||
if (!in_array($extension, $allexts)) {
|
||||
$result["error"] = "File type is not supported";
|
||||
return $result;
|
||||
}
|
||||
@ -156,7 +151,7 @@ function upload()
|
||||
// check if the file was uploaded using HTTP POST
|
||||
if (is_uploaded_file($tmp)) {
|
||||
$filesize = $_FILES['files']['size']; // get the file size
|
||||
$ext = mb_strtolower('.' . pathinfo($_FILES['files']['name'], PATHINFO_EXTENSION)); // get file extension
|
||||
$ext = mb_strtolower(pathinfo($_FILES['files']['name'], PATHINFO_EXTENSION)); // get file extension
|
||||
|
||||
// check if the file size is correct (it should be less than the max file size, but greater than 0)
|
||||
if ($filesize <= 0 || $filesize > $configManager->getConfig("fileSizeMax")) {
|
||||
@ -165,7 +160,7 @@ function upload()
|
||||
}
|
||||
|
||||
// check if the file extension is supported by the editor
|
||||
if (!in_array($ext, getFileExts())) {
|
||||
if (!in_array($ext, $configManager->getSuppotredExtensions())) {
|
||||
$result["error"] = 'File type is not supported'; // if not, then an error occurs
|
||||
return $result;
|
||||
}
|
||||
@ -256,7 +251,7 @@ function convert()
|
||||
$configManager = new ConfigManager();
|
||||
|
||||
// check if the file with such an extension can be converted
|
||||
if (in_array("." . $extension, $configManager->getConfig("docServConvert")) &&
|
||||
if (in_array($extension, $configManager->getConvertExtensions()) &&
|
||||
$internalExtension != "") {
|
||||
$fileUri = $post["fileUri"];
|
||||
if ($fileUri == null || $fileUri == "") {
|
||||
@ -369,7 +364,8 @@ function assets()
|
||||
{
|
||||
$fileName = basename($_GET["name"]);
|
||||
$filePath = dirname(__FILE__) .
|
||||
DIRECTORY_SEPARATOR . "assets" . DIRECTORY_SEPARATOR . "sample" . DIRECTORY_SEPARATOR . $fileName;
|
||||
DIRECTORY_SEPARATOR . "assets" . DIRECTORY_SEPARATOR . "document-templates"
|
||||
. DIRECTORY_SEPARATOR . "sample" . DIRECTORY_SEPARATOR . $fileName;
|
||||
downloadFile($filePath);
|
||||
}
|
||||
|
||||
@ -382,7 +378,8 @@ function csv()
|
||||
{
|
||||
$fileName = "csv.csv";
|
||||
$filePath = dirname(__FILE__) .
|
||||
DIRECTORY_SEPARATOR . "assets" . DIRECTORY_SEPARATOR . "sample" . DIRECTORY_SEPARATOR . $fileName;
|
||||
DIRECTORY_SEPARATOR . "assets" . DIRECTORY_SEPARATOR . "document-templates"
|
||||
. DIRECTORY_SEPARATOR . "sample" . DIRECTORY_SEPARATOR . $fileName;
|
||||
downloadFile($filePath);
|
||||
}
|
||||
|
||||
|
||||
Submodule web/documentserver-example/php/assets/document-formats added at 6c4927a0d1
@ -5,16 +5,6 @@
|
||||
"storagePath": "",
|
||||
"alone": false,
|
||||
|
||||
"docServFillforms": [".docx", ".oform"],
|
||||
"docServViewd": [".djvu", ".oxps", ".pdf", ".xps"],
|
||||
"docServEdited": [".csv", ".docm", ".docx", ".docxf", ".dotm", ".dotx", ".epub",
|
||||
".fb2", ".html", ".odp", ".ods", ".odt", ".otp", ".ots", ".ott", ".potm", ".potx",
|
||||
".ppsm", ".ppsx", ".pptm", ".pptx", ".rtf", ".txt", ".xlsm", ".xlsx", ".xltm", ".xltx"],
|
||||
"docServConvert": [".doc", ".dot", ".dps", ".dpt", ".epub",
|
||||
".et", ".ett", ".fb2", ".fodp", ".fods", ".fodt", ".htm", ".html",
|
||||
".mht", ".mhtml", ".odp", ".ods", ".odt", ".otp", ".ots", ".ott", ".pot",
|
||||
".pps", ".ppt", ".rtf", ".stw", ".sxc", ".sxi", ".sxw", ".wps", ".wpt", ".xls", ".xlsb", ".xlt", ".xml"],
|
||||
|
||||
"docServTimeout": "120000",
|
||||
"docServSiteUrl": "https://documentserver/",
|
||||
|
||||
@ -31,18 +21,6 @@
|
||||
|
||||
"exampleUrl": "",
|
||||
"mobileRegex": "android|avantgo|playbook|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino",
|
||||
"extsSpreadsheet": [".xls", ".xlsx", ".xlsm", ".xlsb",
|
||||
".xlt", ".xltx", ".xltm",
|
||||
".ods", ".fods", ".ots", ".csv"],
|
||||
"extsPresentation": [".pps", ".ppsx", ".ppsm",
|
||||
".ppt", ".pptx", ".pptm",
|
||||
".pot", ".potx", ".potm",
|
||||
".odp", ".fodp", ".otp"],
|
||||
"extsDocument": [".doc", ".docx", ".docm",
|
||||
".dot", ".dotx", ".dotm",
|
||||
".odt", ".fodt", ".ott", ".rtf", ".txt",
|
||||
".html", ".htm", ".mht", ".xml",
|
||||
".pdf", ".djvu", ".fb2", ".epub", ".xps", ".oxps", ".oform"],
|
||||
"languages": {
|
||||
"en": "English",
|
||||
"hy": "Armenian",
|
||||
|
||||
@ -130,18 +130,24 @@ function getCurUserHostAddress($userAddress = null)
|
||||
*/
|
||||
function getInternalExtension($filename)
|
||||
{
|
||||
$ext = mb_strtolower('.' . pathinfo($filename, PATHINFO_EXTENSION));
|
||||
$ext = mb_strtolower(pathinfo($filename, PATHINFO_EXTENSION));
|
||||
|
||||
$configManager = new ConfigManager();
|
||||
if (in_array($ext, $configManager->getConfig("extsDocument"))) {
|
||||
return ".docx";
|
||||
} // .docx for text document extensions
|
||||
if (in_array($ext, $configManager->getConfig("extsSpreadsheet"))) {
|
||||
return ".xlsx";
|
||||
} // .xlsx for spreadsheet extensions
|
||||
if (in_array($ext, $configManager->getConfig("extsPresentation"))) {
|
||||
return ".pptx";
|
||||
} // .pptx for presentation extensions
|
||||
|
||||
foreach ($configManager->getSuppotredFormats() as $format) {
|
||||
if ($format->name === $ext) {
|
||||
if ($format->type === "word") {
|
||||
return ".docx";
|
||||
}
|
||||
if ($format->type === "cell") {
|
||||
return ".xlsx";
|
||||
}
|
||||
if ($format->type === "slide") {
|
||||
return ".pptx";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -154,19 +160,24 @@ function getInternalExtension($filename)
|
||||
*/
|
||||
function getTemplateImageUrl($filename)
|
||||
{
|
||||
$ext = mb_strtolower('.' . pathinfo($filename, PATHINFO_EXTENSION));
|
||||
$ext = mb_strtolower(pathinfo($filename, PATHINFO_EXTENSION));
|
||||
$path = serverPath(true) . "/css/images/";
|
||||
|
||||
$configManager = new ConfigManager();
|
||||
if (in_array($ext, $configManager->getConfig("extsDocument"))) {
|
||||
return $path . "file_docx.svg";
|
||||
} // for text document extensions
|
||||
if (in_array($ext, $configManager->getConfig("extsSpreadsheet"))) {
|
||||
return $path . "file_xlsx.svg";
|
||||
} // for spreadsheet extensions
|
||||
if (in_array($ext, $configManager->getConfig("extsPresentation"))) {
|
||||
return $path . "file_pptx.svg";
|
||||
} // for presentation extensions
|
||||
foreach ($configManager->getSuppotredFormats() as $format) {
|
||||
if ($format->name === $ext) {
|
||||
if ($format->type === "word") {
|
||||
return $path . "file_docx.svg";
|
||||
}
|
||||
if ($format->type === "cell") {
|
||||
return $path . "file_xlsx.svg";
|
||||
}
|
||||
if ($format->type === "slide") {
|
||||
return $path . "file_pptx.svg";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $path . "file_docx.svg";
|
||||
}
|
||||
|
||||
@ -179,18 +190,15 @@ function getTemplateImageUrl($filename)
|
||||
*/
|
||||
function getDocumentType($filename)
|
||||
{
|
||||
$ext = mb_strtolower('.' . pathinfo($filename, PATHINFO_EXTENSION));
|
||||
$ext = mb_strtolower(pathinfo($filename, PATHINFO_EXTENSION));
|
||||
|
||||
$configManager = new ConfigManager();
|
||||
if (in_array($ext, $configManager->getConfig("extsDocument"))) {
|
||||
return "word";
|
||||
} // word for text document extensions
|
||||
if (in_array($ext, $configManager->getConfig("extsSpreadsheet"))) {
|
||||
return "cell";
|
||||
} // cell for spreadsheet extensions
|
||||
if (in_array($ext, $configManager->getConfig("extsPresentation"))) {
|
||||
return "slide";
|
||||
} // slide for presentation extensions
|
||||
foreach ($configManager->getSuppotredFormats() as $format) {
|
||||
if ($format->name === $ext) {
|
||||
return $format->type;
|
||||
}
|
||||
}
|
||||
|
||||
return "word";
|
||||
}
|
||||
|
||||
@ -400,13 +408,13 @@ function getStoredFiles()
|
||||
foreach ($cdir as $key => $fileName) { // run through all the file and folder names
|
||||
if (!in_array($fileName, [".", ".."])) {
|
||||
if (!is_dir($directory . DIRECTORY_SEPARATOR . $fileName)) { // if an element isn't a directory
|
||||
$ext = mb_strtolower('.' . pathinfo($fileName, PATHINFO_EXTENSION));
|
||||
$ext = mb_strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
|
||||
$dat = filemtime($directory . DIRECTORY_SEPARATOR . $fileName); // get the time of element modification
|
||||
$result[$dat] = (object) [ // and write the file to the result
|
||||
"name" => $fileName,
|
||||
"documentType" => getDocumentType($fileName),
|
||||
"canEdit" => in_array($ext, $configManager->getConfig("docServEdited")),
|
||||
"isFillFormDoc" => in_array($ext, $configManager->getConfig("docServFillforms")),
|
||||
"canEdit" => in_array($ext, $configManager->getEditExtensions()),
|
||||
"isFillFormDoc" => in_array($ext, $configManager->getFillExtensions()),
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -521,22 +529,6 @@ function getFileInfo($fileId)
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the supported file extensions
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getFileExts()
|
||||
{
|
||||
$configManager = new ConfigManager();
|
||||
return array_merge(
|
||||
$configManager->getConfig("docServViewd"),
|
||||
$configManager->getConfig("docServEdited"),
|
||||
$configManager->getConfig("docServConvert"),
|
||||
$configManager->getConfig("docServFillforms")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the correct file name if such a name already exists
|
||||
*
|
||||
@ -590,10 +582,11 @@ function getDocEditorKey($fileName)
|
||||
function doUpload($fileUri)
|
||||
{
|
||||
$_fileName = GetCorrectName($fileUri);
|
||||
$configManager = new ConfigManager();
|
||||
|
||||
// check if file extension is supported by the editor
|
||||
$ext = mb_strtolower('.' . pathinfo($_fileName, PATHINFO_EXTENSION));
|
||||
if (!in_array($ext, getFileExts())) {
|
||||
$ext = mb_strtolower(pathinfo($_fileName, PATHINFO_EXTENSION));
|
||||
if (!in_array($ext, $configManager->getSuppotredExtensions())) {
|
||||
throw new Exception("File type is not supported");
|
||||
}
|
||||
|
||||
|
||||
@ -21,10 +21,12 @@ namespace OnlineEditorsExamplePhp\Helpers;
|
||||
final class ConfigManager
|
||||
{
|
||||
private mixed $config;
|
||||
private mixed $configFormats;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->config = json_decode($this->getConfigurationJson());
|
||||
$this->configFormats = json_decode($this->getConfigurationFromatsJson());
|
||||
}
|
||||
|
||||
private function getConfigurationJson(): bool|string
|
||||
@ -32,6 +34,13 @@ final class ConfigManager
|
||||
return file_exists("./config.json") ? file_get_contents("./config.json") : false;
|
||||
}
|
||||
|
||||
private function getConfigurationFromatsJson(): bool|string
|
||||
{
|
||||
return file_exists("./assets/document-formats/onlyoffice-docs-formats.json")
|
||||
? file_get_contents("./assets/document-formats/onlyoffice-docs-formats.json")
|
||||
: false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $configName
|
||||
* @return mixed
|
||||
@ -43,4 +52,74 @@ final class ConfigManager
|
||||
}
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
public function getSuppotredFormats(): mixed
|
||||
{
|
||||
return $this->configFormats;
|
||||
}
|
||||
|
||||
public function getSuppotredExtensions(): mixed
|
||||
{
|
||||
return array_reduce(
|
||||
$this->configFormats,
|
||||
function ($extensions, $format) {
|
||||
$extensions[] = $format->name;
|
||||
return $extensions;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function getViewExtensions(): mixed
|
||||
{
|
||||
return array_reduce(
|
||||
$this->configFormats,
|
||||
function ($extensions, $format) {
|
||||
if (in_array("view", $format->actions)) {
|
||||
$extensions[] = $format->name;
|
||||
}
|
||||
return $extensions;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function getEditExtensions(): mixed
|
||||
{
|
||||
return array_reduce(
|
||||
$this->configFormats,
|
||||
function ($extensions, $format) {
|
||||
if (in_array("edit", $format->actions) || in_array("lossy-edit", $format->actions)) {
|
||||
$extensions[] = $format->name;
|
||||
}
|
||||
return $extensions;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function getFillExtensions(): mixed
|
||||
{
|
||||
return array_reduce(
|
||||
$this->configFormats,
|
||||
function ($extensions, $format) {
|
||||
if (in_array("fill", $format->actions)) {
|
||||
$extensions[] = $format->name;
|
||||
}
|
||||
return $extensions;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function getConvertExtensions(): mixed
|
||||
{
|
||||
return array_reduce(
|
||||
$this->configFormats,
|
||||
function ($extensions, $format) {
|
||||
if ($format->type === "word" && in_array("docx", $format->convert)
|
||||
|| $format->type === "cell" && in_array("xlsx", $format->convert)
|
||||
|| $format->type === "slide" && in_array("pptx", $format->convert)) {
|
||||
$extensions[] = $format->name;
|
||||
}
|
||||
return $extensions;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
ONLYOFFICE Applications example uses code from the following 3rd party projects:
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -16,9 +12,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
|
||||
@ -212,7 +212,7 @@
|
||||
<script type="text/javascript" src="js/jquery.dropdownToggle.js"></script>
|
||||
<script type="text/javascript" src="js/jscript.js"></script>
|
||||
<script type="text/javascript">
|
||||
var FillFormsExtList = '{docServFillforms}';
|
||||
var FillFormsExtList = '{fillFormsExtList}';
|
||||
var ConverExtList = '{converExtList}';
|
||||
var EditedExtList = '{editedExtList}';
|
||||
</script>
|
||||
|
||||
@ -72,12 +72,12 @@ final class DocEditorView extends View
|
||||
$docKey = getDocEditorKey($filename);
|
||||
$filetype = mb_strtolower(pathinfo($filename, PATHINFO_EXTENSION));
|
||||
|
||||
$ext = mb_strtolower('.' . pathinfo($filename, PATHINFO_EXTENSION));
|
||||
$ext = mb_strtolower(pathinfo($filename, PATHINFO_EXTENSION));
|
||||
$editorsMode = empty($request["action"]) ? "edit" : $request["action"]; // get the editors mode
|
||||
$canEdit = in_array($ext, $confgManager->getConfig("docServEdited")); // check if the file can be edited
|
||||
$canEdit = in_array($ext, $confgManager->getEditExtensions()); // check if the file can be edited
|
||||
if ((!$canEdit && $editorsMode == "edit"
|
||||
|| $editorsMode == "fillForms")
|
||||
&& in_array($ext, $confgManager->getConfig("docServFillforms"))
|
||||
&& in_array($ext, $confgManager->getFillExtensions())
|
||||
) {
|
||||
$editorsMode = "fillForms";
|
||||
$canEdit = true;
|
||||
|
||||
@ -41,9 +41,9 @@ final class IndexView extends View
|
||||
"editButton" => $this->getEditButton(),
|
||||
"dataDocs" => $this->getPreloaderUrl(),
|
||||
"date" => date("Y"),
|
||||
"fillFormsExtList" => implode(",", $configManager->getConfig("docServFillforms")),
|
||||
"converExtList" => implode(",", $configManager->getConfig("docServConvert")),
|
||||
"editedExtList" => implode(",", $configManager->getConfig("docServEdited")),
|
||||
"fillFormsExtList" => implode(",", $configManager->getFillExtensions()),
|
||||
"converExtList" => implode(",", $configManager->getConvertExtensions()),
|
||||
"editedExtList" => implode(",", $configManager->getEditExtensions()),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -4,10 +4,6 @@ Django - Django is a high-level Python web framework that encourages rapi
|
||||
License: BSD-3-Clause
|
||||
License File: Django.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -20,9 +16,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
|
||||
@ -4,10 +4,6 @@ Django - Django is a high-level Python web framework that encourages rapi
|
||||
License: BSD-3-Clause
|
||||
License File: Django.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -20,9 +16,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
|
||||
1
web/documentserver-example/ruby/.gitignore
vendored
Normal file
1
web/documentserver-example/ruby/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
sorbet
|
||||
1
web/documentserver-example/ruby/.ruby-version
Normal file
1
web/documentserver-example/ruby/.ruby-version
Normal file
@ -0,0 +1 @@
|
||||
3.2.2
|
||||
@ -8,14 +8,14 @@ coffee-rails - CoffeeScript adapter for the Rails asset pipeline. (https://gith
|
||||
License: MIT
|
||||
License File: coffee-rails.license
|
||||
|
||||
dalli - High performance memcached client for Ruby. (https://github.com/petergoldstein/dalli/blob/v3.2.0/LICENSE)
|
||||
License: MIT
|
||||
License File: dalli.license
|
||||
|
||||
jbuilder - Create JSON structures via a Builder-style DSL (https://github.com/rails/jbuilder/blob/master/MIT-LICENSE)
|
||||
License: MIT
|
||||
License File: jbuilder.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -28,9 +28,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
@ -48,6 +52,10 @@ rails - Rails is a web-application framework that includes everything ne
|
||||
License: MIT
|
||||
License File: rails.license
|
||||
|
||||
rubocop - A Ruby static code analyzer and formatter, based on the community Ruby style guide. (https://github.com/rubocop/rubocop/blob/v1.52.0/LICENSE.txt)
|
||||
License: MIT
|
||||
License File: rubocop.license
|
||||
|
||||
sass-rails - This gem provides official integration for Ruby on Rails projects with the Sass stylesheet language. (https://github.com/rails/sass-rails/blob/master/MIT-LICENSE)
|
||||
License: MIT
|
||||
License File: sass-rails.license
|
||||
@ -56,10 +64,18 @@ sdoc - rdoc generator html with javascript search index. (https://githu
|
||||
License: MIT
|
||||
License File: sdoc.license
|
||||
|
||||
sorbet - A fast, powerful type checker designed for Ruby. (https://github.com/sorbet/sorbet/blob/0.5.10871.20230607144259-d9000e2ba/LICENSE)
|
||||
License: Apache License 2.0
|
||||
License File: sorbet.license
|
||||
|
||||
sqlite3 - This module allows Ruby programs to interface with the SQLite3 database engine (www.sqlite.org). (https://github.com/sparklemotion/sqlite3-ruby/blob/master/LICENSE)
|
||||
License: BSD-3-Clause
|
||||
License File: sqlite3.license
|
||||
|
||||
tapioca - The swiss army knife of RBI generation. (https://github.com/Shopify/tapioca/blob/v0.11.6/LICENSE.txt)
|
||||
License: MIT
|
||||
License File: tapioca.license
|
||||
|
||||
turbolinks - Rails engine for Turbolinks 5 support (https://github.com/turbolinks/turbolinks-rails/blob/master/LICENSE)
|
||||
License: MIT
|
||||
License File: turbolinks.license
|
||||
|
||||
@ -1,52 +1,24 @@
|
||||
source 'https://rubygems.org'
|
||||
source "https://rubygems.org"
|
||||
|
||||
gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '01f92d86d15d85cfd0f20dabd025dcbd36a8a60f'
|
||||
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
||||
gem 'rails', '7.0.3.1'
|
||||
# Use sqlite3 as the database for Active Record
|
||||
gem 'sqlite3', '1.4.2'
|
||||
# Use SCSS for stylesheets
|
||||
gem 'sass-rails', '~> 6.0'
|
||||
# Use Uglifier as compressor for JavaScript assets
|
||||
gem 'uglifier', '>= 4.2.0'
|
||||
# Use CoffeeScript for .coffee assets and views
|
||||
gem 'coffee-rails', '~> 5.0.0'
|
||||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
||||
# gem 'therubyracer', platforms: :ruby
|
||||
|
||||
# Use jquery as the JavaScript library
|
||||
gem 'jquery-rails'
|
||||
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
||||
gem 'turbolinks'
|
||||
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
||||
gem 'jbuilder', '~> 2.11.5'
|
||||
# bundle exec rake doc:rails generates the API under doc/api.
|
||||
gem 'sdoc', '~> 2.4.0', group: :doc
|
||||
|
||||
gem "tzinfo-data"
|
||||
|
||||
# Use ActiveModel has_secure_password
|
||||
# gem 'bcrypt', '~> 3.1.7'
|
||||
|
||||
# Use Unicorn as the app server
|
||||
# gem 'unicorn'
|
||||
|
||||
# Use Capistrano for deployment
|
||||
# gem 'capistrano-rails', group: :development
|
||||
|
||||
group :development, :test do
|
||||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
||||
gem 'byebug'
|
||||
|
||||
# Access an IRB console on exception pages or by using <%= console %> in views
|
||||
gem 'web-console', '~> 4.2.0'
|
||||
end
|
||||
|
||||
gem 'uuid'
|
||||
|
||||
gem 'rack-cors'
|
||||
|
||||
gem 'webrick'
|
||||
|
||||
# A ruby implementation of the RFC 7519 OAuth JSON Web Token (JWT) standard.
|
||||
gem 'jwt', '~> 2.4.1'
|
||||
gem "byebug", "~> 11.1", :groups => [:development, :test]
|
||||
gem "coffee-rails", "~> 5.0"
|
||||
gem "dalli", "~> 3.2", :group => :development
|
||||
gem "jbuilder", "~> 2.11"
|
||||
gem "jquery-rails", "~> 4.5"
|
||||
gem "jwt", "~> 2.7"
|
||||
gem "mimemagic", github: "mimemagicrb/mimemagic", ref: "01f92d86d15d85cfd0f20dabd025dcbd36a8a60f"
|
||||
gem "rack-cors", "~> 2.0"
|
||||
gem "rails", "~> 7.0"
|
||||
gem "rubocop", "~> 1.52", :group => :development
|
||||
gem "sass-rails", "~> 6.0"
|
||||
gem "sdoc", "~> 2.6", :group => :doc
|
||||
gem "sorbet", "~> 0.5.10871", :group => :development
|
||||
gem "sorbet-runtime", "~> 0.5.10871"
|
||||
gem "sqlite3", "1.4.2"
|
||||
gem "tapioca", "~> 0.11.6", :group => :development
|
||||
gem "turbolinks", "~> 5.2"
|
||||
gem "tzinfo-data", "~> 1.2023"
|
||||
gem "uglifier", "~> 4.2"
|
||||
gem "uuid", "~> 2.3"
|
||||
gem "web-console", "~> 4.2", :groups => [:development, :test]
|
||||
gem "webrick", "~> 1.8"
|
||||
|
||||
@ -8,71 +8,72 @@ GIT
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (7.0.3.1)
|
||||
actionpack (= 7.0.3.1)
|
||||
activesupport (= 7.0.3.1)
|
||||
actioncable (7.0.5)
|
||||
actionpack (= 7.0.5)
|
||||
activesupport (= 7.0.5)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailbox (7.0.3.1)
|
||||
actionpack (= 7.0.3.1)
|
||||
activejob (= 7.0.3.1)
|
||||
activerecord (= 7.0.3.1)
|
||||
activestorage (= 7.0.3.1)
|
||||
activesupport (= 7.0.3.1)
|
||||
actionmailbox (7.0.5)
|
||||
actionpack (= 7.0.5)
|
||||
activejob (= 7.0.5)
|
||||
activerecord (= 7.0.5)
|
||||
activestorage (= 7.0.5)
|
||||
activesupport (= 7.0.5)
|
||||
mail (>= 2.7.1)
|
||||
net-imap
|
||||
net-pop
|
||||
net-smtp
|
||||
actionmailer (7.0.3.1)
|
||||
actionpack (= 7.0.3.1)
|
||||
actionview (= 7.0.3.1)
|
||||
activejob (= 7.0.3.1)
|
||||
activesupport (= 7.0.3.1)
|
||||
actionmailer (7.0.5)
|
||||
actionpack (= 7.0.5)
|
||||
actionview (= 7.0.5)
|
||||
activejob (= 7.0.5)
|
||||
activesupport (= 7.0.5)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
net-imap
|
||||
net-pop
|
||||
net-smtp
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (7.0.3.1)
|
||||
actionview (= 7.0.3.1)
|
||||
activesupport (= 7.0.3.1)
|
||||
rack (~> 2.0, >= 2.2.0)
|
||||
actionpack (7.0.5)
|
||||
actionview (= 7.0.5)
|
||||
activesupport (= 7.0.5)
|
||||
rack (~> 2.0, >= 2.2.4)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
||||
actiontext (7.0.3.1)
|
||||
actionpack (= 7.0.3.1)
|
||||
activerecord (= 7.0.3.1)
|
||||
activestorage (= 7.0.3.1)
|
||||
activesupport (= 7.0.3.1)
|
||||
actiontext (7.0.5)
|
||||
actionpack (= 7.0.5)
|
||||
activerecord (= 7.0.5)
|
||||
activestorage (= 7.0.5)
|
||||
activesupport (= 7.0.5)
|
||||
globalid (>= 0.6.0)
|
||||
nokogiri (>= 1.8.5)
|
||||
actionview (7.0.3.1)
|
||||
activesupport (= 7.0.3.1)
|
||||
actionview (7.0.5)
|
||||
activesupport (= 7.0.5)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
||||
activejob (7.0.3.1)
|
||||
activesupport (= 7.0.3.1)
|
||||
activejob (7.0.5)
|
||||
activesupport (= 7.0.5)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (7.0.3.1)
|
||||
activesupport (= 7.0.3.1)
|
||||
activerecord (7.0.3.1)
|
||||
activemodel (= 7.0.3.1)
|
||||
activesupport (= 7.0.3.1)
|
||||
activestorage (7.0.3.1)
|
||||
actionpack (= 7.0.3.1)
|
||||
activejob (= 7.0.3.1)
|
||||
activerecord (= 7.0.3.1)
|
||||
activesupport (= 7.0.3.1)
|
||||
activemodel (7.0.5)
|
||||
activesupport (= 7.0.5)
|
||||
activerecord (7.0.5)
|
||||
activemodel (= 7.0.5)
|
||||
activesupport (= 7.0.5)
|
||||
activestorage (7.0.5)
|
||||
actionpack (= 7.0.5)
|
||||
activejob (= 7.0.5)
|
||||
activerecord (= 7.0.5)
|
||||
activesupport (= 7.0.5)
|
||||
marcel (~> 1.0)
|
||||
mini_mime (>= 1.1.0)
|
||||
activesupport (7.0.3.1)
|
||||
activesupport (7.0.5)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
tzinfo (~> 2.0)
|
||||
ast (2.4.2)
|
||||
bindex (0.8.1)
|
||||
builder (3.2.4)
|
||||
byebug (11.1.3)
|
||||
@ -83,92 +84,121 @@ GEM
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.12.2)
|
||||
concurrent-ruby (1.1.10)
|
||||
concurrent-ruby (1.2.2)
|
||||
crass (1.0.6)
|
||||
digest (3.1.0)
|
||||
erubi (1.11.0)
|
||||
dalli (3.2.4)
|
||||
date (3.3.3)
|
||||
diff-lcs (1.5.0)
|
||||
erubi (1.12.0)
|
||||
execjs (2.8.1)
|
||||
ffi (1.15.5)
|
||||
ffi (1.15.5-x64-mingw-ucrt)
|
||||
globalid (1.0.1)
|
||||
globalid (1.1.0)
|
||||
activesupport (>= 5.0)
|
||||
i18n (1.12.0)
|
||||
i18n (1.14.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
jbuilder (2.11.5)
|
||||
actionview (>= 5.0.0)
|
||||
activesupport (>= 5.0.0)
|
||||
jquery-rails (4.5.0)
|
||||
jquery-rails (4.5.1)
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
jwt (2.4.1)
|
||||
loofah (2.19.1)
|
||||
json (2.6.3)
|
||||
jwt (2.7.0)
|
||||
loofah (2.21.3)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
nokogiri (>= 1.12.0)
|
||||
macaddr (1.7.2)
|
||||
systemu (~> 2.6.5)
|
||||
mail (2.7.1)
|
||||
mail (2.8.1)
|
||||
mini_mime (>= 0.1.1)
|
||||
net-imap
|
||||
net-pop
|
||||
net-smtp
|
||||
marcel (1.0.2)
|
||||
method_source (1.0.0)
|
||||
mini_mime (1.1.2)
|
||||
minitest (5.17.0)
|
||||
net-imap (0.2.3)
|
||||
digest
|
||||
minitest (5.18.0)
|
||||
net-imap (0.3.4)
|
||||
date
|
||||
net-protocol
|
||||
strscan
|
||||
net-pop (0.1.1)
|
||||
digest
|
||||
net-pop (0.1.2)
|
||||
net-protocol
|
||||
net-protocol (0.2.1)
|
||||
timeout
|
||||
net-protocol (0.1.3)
|
||||
timeout
|
||||
net-smtp (0.3.1)
|
||||
digest
|
||||
net-smtp (0.3.3)
|
||||
net-protocol
|
||||
timeout
|
||||
nio4r (2.5.8)
|
||||
nokogiri (1.13.10-x64-mingw-ucrt)
|
||||
netrc (0.11.0)
|
||||
nio4r (2.5.9)
|
||||
nokogiri (1.15.2-arm64-darwin)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.13.10-x86_64-linux)
|
||||
nokogiri (1.15.2-x64-mingw-ucrt)
|
||||
racc (~> 1.4)
|
||||
psych (4.0.5)
|
||||
nokogiri (1.15.2-x86_64-linux)
|
||||
racc (~> 1.4)
|
||||
parallel (1.23.0)
|
||||
parser (3.2.2.3)
|
||||
ast (~> 2.4.1)
|
||||
racc
|
||||
psych (5.1.0)
|
||||
stringio
|
||||
racc (1.6.1)
|
||||
rack (2.2.6.4)
|
||||
rack-cors (1.1.1)
|
||||
racc (1.7.0)
|
||||
rack (2.2.7)
|
||||
rack-cors (2.0.1)
|
||||
rack (>= 2.0.0)
|
||||
rack-test (2.0.2)
|
||||
rack-test (2.1.0)
|
||||
rack (>= 1.3)
|
||||
rails (7.0.3.1)
|
||||
actioncable (= 7.0.3.1)
|
||||
actionmailbox (= 7.0.3.1)
|
||||
actionmailer (= 7.0.3.1)
|
||||
actionpack (= 7.0.3.1)
|
||||
actiontext (= 7.0.3.1)
|
||||
actionview (= 7.0.3.1)
|
||||
activejob (= 7.0.3.1)
|
||||
activemodel (= 7.0.3.1)
|
||||
activerecord (= 7.0.3.1)
|
||||
activestorage (= 7.0.3.1)
|
||||
activesupport (= 7.0.3.1)
|
||||
rails (7.0.5)
|
||||
actioncable (= 7.0.5)
|
||||
actionmailbox (= 7.0.5)
|
||||
actionmailer (= 7.0.5)
|
||||
actionpack (= 7.0.5)
|
||||
actiontext (= 7.0.5)
|
||||
actionview (= 7.0.5)
|
||||
activejob (= 7.0.5)
|
||||
activemodel (= 7.0.5)
|
||||
activerecord (= 7.0.5)
|
||||
activestorage (= 7.0.5)
|
||||
activesupport (= 7.0.5)
|
||||
bundler (>= 1.15.0)
|
||||
railties (= 7.0.3.1)
|
||||
railties (= 7.0.5)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.4.4)
|
||||
loofah (~> 2.19, >= 2.19.1)
|
||||
railties (7.0.3.1)
|
||||
actionpack (= 7.0.3.1)
|
||||
activesupport (= 7.0.3.1)
|
||||
rails-html-sanitizer (1.6.0)
|
||||
loofah (~> 2.21)
|
||||
nokogiri (~> 1.14)
|
||||
railties (7.0.5)
|
||||
actionpack (= 7.0.5)
|
||||
activesupport (= 7.0.5)
|
||||
method_source
|
||||
rake (>= 12.2)
|
||||
thor (~> 1.0)
|
||||
zeitwerk (~> 2.5)
|
||||
rainbow (3.1.1)
|
||||
rake (13.0.6)
|
||||
rdoc (6.4.0)
|
||||
rbi (0.0.16)
|
||||
ast
|
||||
parser (>= 2.6.4.0)
|
||||
sorbet-runtime (>= 0.5.9204)
|
||||
unparser
|
||||
rdoc (6.5.0)
|
||||
psych (>= 4.0.0)
|
||||
regexp_parser (2.8.0)
|
||||
rexml (3.2.5)
|
||||
rubocop (1.52.0)
|
||||
json (~> 2.3)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 3.2.0.0)
|
||||
rainbow (>= 2.2.2, < 4.0)
|
||||
regexp_parser (>= 1.8, < 3.0)
|
||||
rexml (>= 3.2.5, < 4.0)
|
||||
rubocop-ast (>= 1.28.0, < 2.0)
|
||||
ruby-progressbar (~> 1.7)
|
||||
unicode-display_width (>= 2.4.0, < 3.0)
|
||||
rubocop-ast (1.29.0)
|
||||
parser (>= 3.2.1.0)
|
||||
ruby-progressbar (1.13.0)
|
||||
sass-rails (6.0.0)
|
||||
sassc-rails (~> 2.1, >= 2.1.1)
|
||||
sassc (2.4.0)
|
||||
@ -179,31 +209,55 @@ GEM
|
||||
sprockets (> 3.0)
|
||||
sprockets-rails
|
||||
tilt
|
||||
sdoc (2.4.0)
|
||||
sdoc (2.6.1)
|
||||
rdoc (>= 5.0)
|
||||
sprockets (4.1.1)
|
||||
sorbet (0.5.10871)
|
||||
sorbet-static (= 0.5.10871)
|
||||
sorbet-runtime (0.5.10871)
|
||||
sorbet-static (0.5.10871-universal-darwin-22)
|
||||
sorbet-static (0.5.10871-x86_64-linux)
|
||||
sorbet-static-and-runtime (0.5.10871)
|
||||
sorbet (= 0.5.10871)
|
||||
sorbet-runtime (= 0.5.10871)
|
||||
spoom (1.2.1)
|
||||
sorbet (>= 0.5.10187)
|
||||
sorbet-runtime (>= 0.5.9204)
|
||||
thor (>= 0.19.2)
|
||||
sprockets (4.2.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
rack (>= 2.2.4, < 4)
|
||||
sprockets-rails (3.4.2)
|
||||
actionpack (>= 5.2)
|
||||
activesupport (>= 5.2)
|
||||
sprockets (>= 3.0.0)
|
||||
sqlite3 (1.4.2)
|
||||
stringio (3.0.2)
|
||||
strscan (3.0.4)
|
||||
stringio (3.0.7)
|
||||
systemu (2.6.5)
|
||||
thor (1.2.1)
|
||||
tilt (2.0.11)
|
||||
timeout (0.3.0)
|
||||
tapioca (0.11.6)
|
||||
bundler (>= 2.2.25)
|
||||
netrc (>= 0.11.0)
|
||||
parallel (>= 1.21.0)
|
||||
rbi (~> 0.0.0, >= 0.0.16)
|
||||
sorbet-static-and-runtime (>= 0.5.10187)
|
||||
spoom (~> 1.2.0, >= 1.2.0)
|
||||
thor (>= 1.2.0)
|
||||
yard-sorbet
|
||||
thor (1.2.2)
|
||||
tilt (2.2.0)
|
||||
timeout (0.3.2)
|
||||
turbolinks (5.2.1)
|
||||
turbolinks-source (~> 5.2)
|
||||
turbolinks-source (5.2.0)
|
||||
tzinfo (2.0.5)
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
tzinfo-data (1.2022.4)
|
||||
tzinfo-data (1.2023.3)
|
||||
tzinfo (>= 1.0.0)
|
||||
uglifier (4.2.0)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
unicode-display_width (2.4.2)
|
||||
unparser (0.6.7)
|
||||
diff-lcs (~> 1.3)
|
||||
parser (>= 3.2.0)
|
||||
uuid (2.3.9)
|
||||
macaddr (~> 1.0)
|
||||
web-console (4.2.0)
|
||||
@ -211,34 +265,44 @@ GEM
|
||||
activemodel (>= 6.0.0)
|
||||
bindex (>= 0.4.0)
|
||||
railties (>= 6.0.0)
|
||||
webrick (1.7.0)
|
||||
webrick (1.8.1)
|
||||
websocket-driver (0.7.5)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.5)
|
||||
zeitwerk (2.6.0)
|
||||
yard (0.9.34)
|
||||
yard-sorbet (0.8.1)
|
||||
sorbet-runtime (>= 0.5)
|
||||
yard (>= 0.9)
|
||||
zeitwerk (2.6.8)
|
||||
|
||||
PLATFORMS
|
||||
arm64-darwin-22
|
||||
x64-mingw-ucrt
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
byebug
|
||||
coffee-rails (~> 5.0.0)
|
||||
jbuilder (~> 2.11.5)
|
||||
jquery-rails
|
||||
jwt (~> 2.4.1)
|
||||
byebug (~> 11.1)
|
||||
coffee-rails (~> 5.0)
|
||||
dalli (~> 3.2)
|
||||
jbuilder (~> 2.11)
|
||||
jquery-rails (~> 4.5)
|
||||
jwt (~> 2.7)
|
||||
mimemagic!
|
||||
rack-cors
|
||||
rails (= 7.0.3.1)
|
||||
rack-cors (~> 2.0)
|
||||
rails (~> 7.0)
|
||||
rubocop (~> 1.52)
|
||||
sass-rails (~> 6.0)
|
||||
sdoc (~> 2.4.0)
|
||||
sdoc (~> 2.6)
|
||||
sorbet (~> 0.5.10871)
|
||||
sorbet-runtime (~> 0.5.10871)
|
||||
sqlite3 (= 1.4.2)
|
||||
turbolinks
|
||||
tzinfo-data
|
||||
uglifier (>= 4.2.0)
|
||||
uuid
|
||||
web-console (~> 4.2.0)
|
||||
webrick
|
||||
tapioca (~> 0.11.6)
|
||||
turbolinks (~> 5.2)
|
||||
tzinfo-data (~> 1.2023)
|
||||
uglifier (~> 4.2)
|
||||
uuid (~> 2.3)
|
||||
web-console (~> 4.2)
|
||||
webrick (~> 1.8)
|
||||
|
||||
BUNDLED WITH
|
||||
2.3.7
|
||||
2.4.10
|
||||
|
||||
17
web/documentserver-example/ruby/Makefile
Normal file
17
web/documentserver-example/ruby/Makefile
Normal file
@ -0,0 +1,17 @@
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
.PHONY: help
|
||||
help: # Show help message for each of the Makefile recipes.
|
||||
@grep -E "^[a-z]+: #" $(MAKEFILE_LIST) | \
|
||||
sort | \
|
||||
awk 'BEGIN {FS = ": # "}; {printf "%s: %s\n", $$1, $$2}'
|
||||
|
||||
.PHONY: install
|
||||
install: # Install dependencies and initialize the project.
|
||||
@bundle install
|
||||
@bundle exec tapioca init
|
||||
|
||||
.PHONY: lint
|
||||
lint: # Lint the source code for style and check for types.
|
||||
@bundle exec rubocop
|
||||
@bundle exec srb tc
|
||||
@ -8,14 +8,14 @@ coffee-rails - CoffeeScript adapter for the Rails asset pipeline. (https://gith
|
||||
License: MIT
|
||||
License File: coffee-rails.license
|
||||
|
||||
dalli - High performance memcached client for Ruby. (https://github.com/petergoldstein/dalli/blob/v3.2.0/LICENSE)
|
||||
License: MIT
|
||||
License File: dalli.license
|
||||
|
||||
jbuilder - Create JSON structures via a Builder-style DSL (https://github.com/rails/jbuilder/blob/master/MIT-LICENSE)
|
||||
License: MIT
|
||||
License File: jbuilder.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
@ -28,9 +28,13 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
@ -48,6 +52,10 @@ rails - Rails is a web-application framework that includes everything ne
|
||||
License: MIT
|
||||
License File: rails.license
|
||||
|
||||
rubocop - A Ruby static code analyzer and formatter, based on the community Ruby style guide. (https://github.com/rubocop/rubocop/blob/v1.52.0/LICENSE.txt)
|
||||
License: MIT
|
||||
License File: rubocop.license
|
||||
|
||||
sass-rails - This gem provides official integration for Ruby on Rails projects with the Sass stylesheet language. (https://github.com/rails/sass-rails/blob/master/MIT-LICENSE)
|
||||
License: MIT
|
||||
License File: sass-rails.license
|
||||
@ -56,10 +64,18 @@ sdoc - rdoc generator html with javascript search index. (https://githu
|
||||
License: MIT
|
||||
License File: sdoc.license
|
||||
|
||||
sorbet - A fast, powerful type checker designed for Ruby. (https://github.com/sorbet/sorbet/blob/0.5.10871.20230607144259-d9000e2ba/LICENSE)
|
||||
License: Apache License 2.0
|
||||
License File: sorbet.license
|
||||
|
||||
sqlite3 - This module allows Ruby programs to interface with the SQLite3 database engine (www.sqlite.org). (https://github.com/sparklemotion/sqlite3-ruby/blob/master/LICENSE)
|
||||
License: BSD-3-Clause
|
||||
License File: sqlite3.license
|
||||
|
||||
tapioca - The swiss army knife of RBI generation. (https://github.com/Shopify/tapioca/blob/v0.11.6/LICENSE.txt)
|
||||
License: MIT
|
||||
License File: tapioca.license
|
||||
|
||||
turbolinks - Rails engine for Turbolinks 5 support (https://github.com/turbolinks/turbolinks-rails/blob/master/LICENSE)
|
||||
License: MIT
|
||||
License File: turbolinks.license
|
||||
|
||||
20
web/documentserver-example/ruby/licenses/dalli.license
Normal file
20
web/documentserver-example/ruby/licenses/dalli.license
Normal file
@ -0,0 +1,20 @@
|
||||
Copyright (c) Peter M. Goldstein, Mike Perham
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
20
web/documentserver-example/ruby/licenses/rubocop.license
Normal file
20
web/documentserver-example/ruby/licenses/rubocop.license
Normal file
@ -0,0 +1,20 @@
|
||||
Copyright (c) 2012-23 Bozhidar Batsov
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
202
web/documentserver-example/ruby/licenses/sorbet.license
Normal file
202
web/documentserver-example/ruby/licenses/sorbet.license
Normal file
@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2017-2021 Stripe Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
21
web/documentserver-example/ruby/licenses/tapioca.license
Normal file
21
web/documentserver-example/ruby/licenses/tapioca.license
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019-present, Shopify Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
Reference in New Issue
Block a user