From e7630f516d534a23546fd2023a4c72dc78b15536 Mon Sep 17 00:00:00 2001 From: sshakndr Date: Tue, 27 Feb 2024 16:47:26 +0700 Subject: [PATCH 01/12] build(ruby): updated gemfile.lock to 0 vulnerabilities --- web/documentserver-example/ruby/Gemfile.lock | 195 ++++++++++--------- 1 file changed, 98 insertions(+), 97 deletions(-) diff --git a/web/documentserver-example/ruby/Gemfile.lock b/web/documentserver-example/ruby/Gemfile.lock index 3dd38e9f..1e8f47e7 100644 --- a/web/documentserver-example/ruby/Gemfile.lock +++ b/web/documentserver-example/ruby/Gemfile.lock @@ -8,73 +8,73 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (7.0.8) - actionpack (= 7.0.8) - activesupport (= 7.0.8) + actioncable (7.0.8.1) + actionpack (= 7.0.8.1) + activesupport (= 7.0.8.1) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.8) - actionpack (= 7.0.8) - activejob (= 7.0.8) - activerecord (= 7.0.8) - activestorage (= 7.0.8) - activesupport (= 7.0.8) + actionmailbox (7.0.8.1) + actionpack (= 7.0.8.1) + activejob (= 7.0.8.1) + activerecord (= 7.0.8.1) + activestorage (= 7.0.8.1) + activesupport (= 7.0.8.1) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.8) - actionpack (= 7.0.8) - actionview (= 7.0.8) - activejob (= 7.0.8) - activesupport (= 7.0.8) + actionmailer (7.0.8.1) + actionpack (= 7.0.8.1) + actionview (= 7.0.8.1) + activejob (= 7.0.8.1) + activesupport (= 7.0.8.1) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.8) - actionview (= 7.0.8) - activesupport (= 7.0.8) + actionpack (7.0.8.1) + actionview (= 7.0.8.1) + activesupport (= 7.0.8.1) 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.8) - actionpack (= 7.0.8) - activerecord (= 7.0.8) - activestorage (= 7.0.8) - activesupport (= 7.0.8) + actiontext (7.0.8.1) + actionpack (= 7.0.8.1) + activerecord (= 7.0.8.1) + activestorage (= 7.0.8.1) + activesupport (= 7.0.8.1) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.8) - activesupport (= 7.0.8) + actionview (7.0.8.1) + activesupport (= 7.0.8.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.8) - activesupport (= 7.0.8) + activejob (7.0.8.1) + activesupport (= 7.0.8.1) globalid (>= 0.3.6) - activemodel (7.0.8) - activesupport (= 7.0.8) - activerecord (7.0.8) - activemodel (= 7.0.8) - activesupport (= 7.0.8) - activestorage (7.0.8) - actionpack (= 7.0.8) - activejob (= 7.0.8) - activerecord (= 7.0.8) - activesupport (= 7.0.8) + activemodel (7.0.8.1) + activesupport (= 7.0.8.1) + activerecord (7.0.8.1) + activemodel (= 7.0.8.1) + activesupport (= 7.0.8.1) + activestorage (7.0.8.1) + actionpack (= 7.0.8.1) + activejob (= 7.0.8.1) + activerecord (= 7.0.8.1) + activesupport (= 7.0.8.1) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.8) + activesupport (7.0.8.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) ast (2.4.2) - base64 (0.1.1) + base64 (0.2.0) bindex (0.8.1) builder (3.2.4) byebug (11.1.3) @@ -87,12 +87,12 @@ GEM coffee-script-source (1.12.2) concurrent-ruby (1.2.3) crass (1.0.6) - dalli (3.2.6) - date (3.3.3) + dalli (3.2.8) + date (3.3.4) erubi (1.12.0) execjs (2.9.1) - ffi (1.16.2) - ffi (1.16.2-x64-mingw-ucrt) + ffi (1.16.3) + ffi (1.16.3-x64-mingw-ucrt) globalid (1.2.1) activesupport (>= 6.1) i18n (1.14.1) @@ -104,8 +104,9 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (2.6.3) - jwt (2.7.1) + json (2.7.1) + jwt (2.8.0) + base64 language_server-protocol (3.17.0.3) loofah (2.22.0) crass (~> 1.0.2) @@ -121,30 +122,31 @@ GEM method_source (1.0.0) mini_mime (1.1.5) minitest (5.22.2) - net-imap (0.3.7) + net-imap (0.4.10) date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.2.1) + net-protocol (0.2.2) timeout - net-smtp (0.4.0) + net-smtp (0.4.0.1) net-protocol netrc (0.11.0) - nio4r (2.5.9) + nio4r (2.7.0) nokogiri (1.16.2-arm64-darwin) racc (~> 1.4) nokogiri (1.16.2-x64-mingw-ucrt) racc (~> 1.4) nokogiri (1.16.2-x86_64-linux) racc (~> 1.4) - parallel (1.23.0) - parser (3.2.2.3) + parallel (1.24.0) + parser (3.3.0.5) ast (~> 2.4.1) racc power_assert (2.0.3) prettier_print (1.2.1) - psych (5.1.0) + prism (0.24.0) + psych (5.1.2) stringio racc (1.7.3) rack (2.2.8.1) @@ -152,20 +154,20 @@ GEM rack (>= 2.0.0) rack-test (2.1.0) rack (>= 1.3) - rails (7.0.8) - actioncable (= 7.0.8) - actionmailbox (= 7.0.8) - actionmailer (= 7.0.8) - actionpack (= 7.0.8) - actiontext (= 7.0.8) - actionview (= 7.0.8) - activejob (= 7.0.8) - activemodel (= 7.0.8) - activerecord (= 7.0.8) - activestorage (= 7.0.8) - activesupport (= 7.0.8) + rails (7.0.8.1) + actioncable (= 7.0.8.1) + actionmailbox (= 7.0.8.1) + actionmailer (= 7.0.8.1) + actionpack (= 7.0.8.1) + actiontext (= 7.0.8.1) + actionview (= 7.0.8.1) + activejob (= 7.0.8.1) + activemodel (= 7.0.8.1) + activerecord (= 7.0.8.1) + activestorage (= 7.0.8.1) + activesupport (= 7.0.8.1) bundler (>= 1.15.0) - railties (= 7.0.8) + railties (= 7.0.8.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -173,40 +175,40 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.0.8) - actionpack (= 7.0.8) - activesupport (= 7.0.8) + railties (7.0.8.1) + actionpack (= 7.0.8.1) + activesupport (= 7.0.8.1) method_source rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) rainbow (3.1.1) - rake (13.0.6) - rbi (0.1.1) + rake (13.1.0) + rbi (0.1.9) + prism (>= 0.18.0, < 0.25) sorbet-runtime (>= 0.5.9204) - yarp (>= 0.11.0) - rdoc (6.5.0) + rdoc (6.6.2) psych (>= 4.0.0) - regexp_parser (2.8.1) + regexp_parser (2.9.0) rexml (3.2.6) - rubocop (1.56.3) - base64 (~> 0.1.1) + rubocop (1.60.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.2.3) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.29.0) + rubocop-ast (1.30.0) parser (>= 3.2.1.0) - rubocop-rails (2.22.1) + rubocop-rails (2.23.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (1.13.0) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) @@ -220,14 +222,14 @@ GEM tilt sdoc (2.6.1) rdoc (>= 5.0) - sorbet (0.5.11048) - sorbet-static (= 0.5.11048) - sorbet-runtime (0.5.11048) - sorbet-static (0.5.11048-universal-darwin) - sorbet-static (0.5.11048-x86_64-linux) - sorbet-static-and-runtime (0.5.11048) - sorbet (= 0.5.11048) - sorbet-runtime (= 0.5.11048) + sorbet (0.5.11274) + sorbet-static (= 0.5.11274) + sorbet-runtime (0.5.11274) + sorbet-static (0.5.11274-universal-darwin) + sorbet-static (0.5.11274-x86_64-linux) + sorbet-static-and-runtime (0.5.11274) + sorbet (= 0.5.11274) + sorbet-runtime (= 0.5.11274) spoom (1.2.4) erubi (>= 1.10.0) sorbet-static-and-runtime (>= 0.5.10187) @@ -240,34 +242,34 @@ GEM actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - stringio (3.0.8) + stringio (3.1.0) syntax_tree (6.2.0) prettier_print (>= 1.2.0) systemu (2.6.5) - tapioca (0.11.9) + tapioca (0.11.17) bundler (>= 2.2.25) netrc (>= 0.11.0) parallel (>= 1.21.0) - rbi (~> 0.1.0, >= 0.1.0) - sorbet-static-and-runtime (>= 0.5.10187) + rbi (>= 0.1.4, < 0.2) + sorbet-static-and-runtime (>= 0.5.10820) spoom (~> 1.2.0, >= 1.2.0) thor (>= 1.2.0) yard-sorbet - test-unit (3.6.1) + test-unit (3.6.2) power_assert - thor (1.2.2) + thor (1.3.1) tilt (2.3.0) - timeout (0.4.0) + timeout (0.4.1) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - tzinfo-data (1.2023.3) + tzinfo-data (1.2024.1) tzinfo (>= 1.0.0) uglifier (4.2.0) execjs (>= 0.3.0, < 3) - unicode-display_width (2.4.2) + unicode-display_width (2.5.0) uuid (2.3.9) macaddr (~> 1.0) web-console (4.2.1) @@ -283,8 +285,7 @@ GEM yard-sorbet (0.8.1) sorbet-runtime (>= 0.5) yard (>= 0.9) - yarp (0.12.0) - zeitwerk (2.6.12) + zeitwerk (2.6.13) PLATFORMS arm64-darwin-22 From 04c004acdb668367966c9d88a1524d65673acfe8 Mon Sep 17 00:00:00 2001 From: sshakndr Date: Tue, 13 Feb 2024 17:44:05 +0700 Subject: [PATCH 02/12] fix(php): nginx body size --- web/documentserver-example/php/proxy/nginx.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/web/documentserver-example/php/proxy/nginx.conf b/web/documentserver-example/php/proxy/nginx.conf index 5331c398..2e78ed10 100644 --- a/web/documentserver-example/php/proxy/nginx.conf +++ b/web/documentserver-example/php/proxy/nginx.conf @@ -6,6 +6,7 @@ events { http { include /etc/nginx/mime.types; + client_max_body_size 100M; server { listen 80; From 143c0a095f8c6748ad71c412a7586eaaed8d2b37 Mon Sep 17 00:00:00 2001 From: sshakndr Date: Tue, 13 Feb 2024 17:52:28 +0700 Subject: [PATCH 03/12] fix(python): nginx body size --- web/documentserver-example/python/proxy/nginx.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/web/documentserver-example/python/proxy/nginx.conf b/web/documentserver-example/python/proxy/nginx.conf index 8a99aaa3..d14f6392 100644 --- a/web/documentserver-example/python/proxy/nginx.conf +++ b/web/documentserver-example/python/proxy/nginx.conf @@ -6,6 +6,7 @@ events { http { include /etc/nginx/mime.types; + client_max_body_size 100M; server { listen 80; From 97b0cdd04274bad08ec4ceacb3f9cddc677c9417 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Mon, 11 Mar 2024 13:26:29 +0300 Subject: [PATCH 04/12] fix(ruby): nginx body size --- web/documentserver-example/ruby/proxy/nginx.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/web/documentserver-example/ruby/proxy/nginx.conf b/web/documentserver-example/ruby/proxy/nginx.conf index 8a99aaa3..d14f6392 100644 --- a/web/documentserver-example/ruby/proxy/nginx.conf +++ b/web/documentserver-example/ruby/proxy/nginx.conf @@ -6,6 +6,7 @@ events { http { include /etc/nginx/mime.types; + client_max_body_size 100M; server { listen 80; From 0174d2a465775a4e5b392385f0fbd5be92dcaeaf Mon Sep 17 00:00:00 2001 From: sshakndr Date: Mon, 11 Mar 2024 18:08:26 +0700 Subject: [PATCH 05/12] fix(ruby): resolved gem conflict. Fix Bug 66514 --- web/documentserver-example/ruby/Gemfile.lock | 33 +++++++++++--------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/web/documentserver-example/ruby/Gemfile.lock b/web/documentserver-example/ruby/Gemfile.lock index 292883dc..dfbd68fd 100644 --- a/web/documentserver-example/ruby/Gemfile.lock +++ b/web/documentserver-example/ruby/Gemfile.lock @@ -46,7 +46,7 @@ GEM activestorage (= 7.0.8) activesupport (= 7.0.8) globalid (>= 0.6.0) - nokogiri (>= 1.14.3) + nokogiri (>= 1.8.5) actionview (7.0.8) activesupport (= 7.0.8) builder (~> 3.1) @@ -85,7 +85,7 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.2.2) + concurrent-ruby (1.2.3) crass (1.0.6) dalli (3.2.6) date (3.3.3) @@ -95,7 +95,7 @@ GEM ffi (1.16.2-x64-mingw-ucrt) globalid (1.2.1) activesupport (>= 6.1) - i18n (1.14.1) + i18n (1.14.4) concurrent-ruby (~> 1.0) jbuilder (2.11.5) actionview (>= 5.0.0) @@ -107,9 +107,9 @@ GEM json (2.6.3) jwt (2.7.1) language_server-protocol (3.17.0.3) - loofah (2.21.3) + loofah (2.22.0) crass (~> 1.0.2) - nokogiri (>= 1.14.3) + nokogiri (>= 1.12.0) macaddr (1.7.2) systemu (~> 2.6.5) mail (2.8.1) @@ -117,10 +117,10 @@ GEM net-imap net-pop net-smtp - marcel (1.0.2) + marcel (1.0.4) method_source (1.0.0) mini_mime (1.1.5) - minitest (5.20.0) + minitest (5.22.2) net-imap (0.3.7) date net-protocol @@ -132,11 +132,11 @@ GEM net-protocol netrc (0.11.0) nio4r (2.5.9) - nokogiri (1.15.4-arm64-darwin) + nokogiri (1.16.2-arm64-darwin) racc (~> 1.4) - nokogiri (1.15.4-x64-mingw-ucrt) + nokogiri (1.16.2-x64-mingw-ucrt) racc (~> 1.4) - nokogiri (1.15.4-x86_64-linux) + nokogiri (1.16.2-x86_64-linux) racc (~> 1.4) parallel (1.23.0) parser (3.2.2.3) @@ -146,8 +146,8 @@ GEM prettier_print (1.2.1) psych (5.1.0) stringio - racc (1.7.1) - rack (2.2.8) + racc (1.7.3) + rack (2.2.8.1) rack-cors (2.0.1) rack (>= 2.0.0) rack-test (2.1.0) @@ -169,10 +169,10 @@ GEM rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest - nokogiri (>= 1.14.3) + nokogiri (>= 1.6) rails-html-sanitizer (1.6.0) loofah (~> 2.21) - nokogiri (~> 1.14.3) + nokogiri (~> 1.14) railties (7.0.8) actionpack (= 7.0.8) activesupport (= 7.0.8) @@ -203,6 +203,10 @@ GEM unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.29.0) parser (>= 3.2.1.0) + rubocop-rails (2.22.1) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.33.0, < 2.0) ruby-progressbar (1.13.0) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) @@ -298,6 +302,7 @@ DEPENDENCIES rack-cors (~> 2.0) rails (~> 7.0.8) rubocop (~> 1.52) + rubocop-rails (~> 2.20) sass-rails (~> 6.0) sdoc (~> 2.6) sorbet (~> 0.5.10871) From c6eff10be155926c4c4a923d63d476c1b31e502f Mon Sep 17 00:00:00 2001 From: sshakndr Date: Wed, 13 Mar 2024 17:36:06 +0700 Subject: [PATCH 06/12] fix(ruby): replacing file_url host in saveas. Fix Bug 66874 --- .../ruby/app/controllers/home_controller.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/documentserver-example/ruby/app/controllers/home_controller.rb b/web/documentserver-example/ruby/app/controllers/home_controller.rb index a9d11b2b..9982098a 100755 --- a/web/documentserver-example/ruby/app/controllers/home_controller.rb +++ b/web/documentserver-example/ruby/app/controllers/home_controller.rb @@ -342,7 +342,10 @@ class HomeController < ApplicationController # Save Copy as... def saveas body = JSON.parse(request.body.read) - file_url = body['url'] + file_url = body['url'].sub( + HomeController.config_manager.document_server_public_uri.to_s, + HomeController.config_manager.document_server_private_uri.to_s + ) title = body['title'] file_name = DocumentHelper.get_correct_name(title, nil) extension = File.extname(file_name).downcase @@ -377,7 +380,7 @@ class HomeController < ApplicationController render(plain: "{\"file\" : \"#{file_name}\"}") nil rescue StandardError => e - render(plain: "{\"error\":1, \"message\": \"#{e.message}\"}") + render(plain: JSON.generate({ error: 1, message: e.message })) nil end From 5bc7ffde736317b370459ef94ddfa2e865e0d328 Mon Sep 17 00:00:00 2001 From: sshakndr Date: Wed, 13 Mar 2024 18:27:58 +0700 Subject: [PATCH 07/12] fix(ruby): historyobj method. Fix Bug 66862 --- .../ruby/app/controllers/home_controller.rb | 2 +- .../ruby/app/models/file_model.rb | 33 +++++++++---------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/web/documentserver-example/ruby/app/controllers/home_controller.rb b/web/documentserver-example/ruby/app/controllers/home_controller.rb index a9d11b2b..b0be3e97 100755 --- a/web/documentserver-example/ruby/app/controllers/home_controller.rb +++ b/web/documentserver-example/ruby/app/controllers/home_controller.rb @@ -169,7 +169,7 @@ class HomeController < ApplicationController action_data: file_data['action_data'], direct_url: file_data['direct_url'] ) - history = file.get_history + history = file.history render(json: history) rescue StandardError render(json: '{ "error": "File not found"}') diff --git a/web/documentserver-example/ruby/app/models/file_model.rb b/web/documentserver-example/ruby/app/models/file_model.rb index 57e4a694..7a3b38fe 100755 --- a/web/documentserver-example/ruby/app/models/file_model.rb +++ b/web/documentserver-example/ruby/app/models/file_model.rb @@ -261,8 +261,7 @@ class FileModel data_obj['url'] = if i == cur_ver DocumentHelper.get_download_url( - file_name, - true + file_name ) else DocumentHelper.get_historypath_uri( @@ -303,22 +302,20 @@ class FileModel prev = hist_data[(i - 2).to_s] # get the history data from the previous file version # write key and url information about previous file version with optional direct url - data( - obj['previous'] = if enable_direct_url? == true - { # write key and url information about previous file version with optional directUrl - fileType: prev['fileType'], - key: prev['key'], - url: prev['url'], - directUrl: prev['directUrl'] - } - else - { - fileType: prev['fileType'], - key: prev['key'], - url: prev['url'] - } - end - ) + obj['previous'] = if enable_direct_url? == true + { # write key and url information about previous file version with optional directUrl + fileType: prev['fileType'], + key: prev['key'], + url: prev['url'], + directUrl: prev['directUrl'] + } + else + { + fileType: prev['fileType'], + key: prev['key'], + url: prev['url'] + } + end diff_path = [hist_dir, (i - 1).to_s, 'diff.zip'].join(File::SEPARATOR) if File.exist?(diff_path) From a63d8d42840a5b9401b4889646120350e22a0c5b Mon Sep 17 00:00:00 2001 From: sshakndr Date: Thu, 14 Mar 2024 16:30:22 +0700 Subject: [PATCH 08/12] fix(ruby): previous in history data --- web/documentserver-example/ruby/app/models/file_model.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/documentserver-example/ruby/app/models/file_model.rb b/web/documentserver-example/ruby/app/models/file_model.rb index 7a3b38fe..d4772bc3 100755 --- a/web/documentserver-example/ruby/app/models/file_model.rb +++ b/web/documentserver-example/ruby/app/models/file_model.rb @@ -302,7 +302,7 @@ class FileModel prev = hist_data[(i - 2).to_s] # get the history data from the previous file version # write key and url information about previous file version with optional direct url - obj['previous'] = if enable_direct_url? == true + data_obj['previous'] = if enable_direct_url? == true { # write key and url information about previous file version with optional directUrl fileType: prev['fileType'], key: prev['key'], From 66389fe69c8e6b97a55d5bf49f9c04d30a54e1e5 Mon Sep 17 00:00:00 2001 From: sshakndr Date: Thu, 14 Mar 2024 17:24:02 +0700 Subject: [PATCH 09/12] fix(ruby): conversion percent type validation. Fix Bug 66869 --- .../ruby/app/models/service_converter.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/documentserver-example/ruby/app/models/service_converter.rb b/web/documentserver-example/ruby/app/models/service_converter.rb index bdd49f60..8800c74d 100755 --- a/web/documentserver-example/ruby/app/models/service_converter.rb +++ b/web/documentserver-example/ruby/app/models/service_converter.rb @@ -165,7 +165,13 @@ class ServiceConverter percent_element = file_result['percent'] # get the percentage value - result_percent = Integer(percent_element, 10) unless percent_element.nil? + result_percent = unless percent_element.nil? + if percent_element.is_a?(String) + Integer(percent_element, 10) + else + Integer(percent_element) + end + end result_percent = 99 if result_percent >= 100 From 4b7ba35f833d6de8ca40193bb1b31d51b9644a19 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Fri, 15 Mar 2024 11:06:48 +0300 Subject: [PATCH 10/12] nodejs: send email and image for protect request --- web/documentserver-example/nodejs/app.js | 9 ++++++++- web/documentserver-example/nodejs/helpers/users.js | 5 +---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/web/documentserver-example/nodejs/app.js b/web/documentserver-example/nodejs/app.js index 1b2d754a..7be7b374 100755 --- a/web/documentserver-example/nodejs/app.js +++ b/web/documentserver-example/nodejs/app.js @@ -996,12 +996,19 @@ app.get('/editor', (req, res) => { // define a handler for editing document const { userInfoGroups } = user; const usersInfo = []; + const usersForProtect = []; if (user.id !== 'uid-0') { users.getAllUsers().forEach((userInfo) => { const u = userInfo; u.image = userInfo.avatar ? `${req.DocManager.getServerUrl()}/images/${userInfo.id}.png` : null; usersInfo.push(u); }, usersInfo); + + users.getUsersForProtect(user.id).forEach((userInfo) => { + const u = userInfo; + u.image = userInfo.avatar ? `${req.DocManager.getServerUrl()}/images/${userInfo.id}.png` : null; + usersForProtect.push(u); + }, usersForProtect); } fileExt = fileUtility.getFileExtension(fileName); @@ -1105,7 +1112,7 @@ app.get('/editor', (req, res) => { // define a handler for editing document directUrl: !userDirectUrl ? null : `${req.DocManager.getServerUrl()}/csv`, }, usersForMentions: user.id !== 'uid-0' ? users.getUsersForMentions(user.id) : null, - usersForProtect: user.id !== 'uid-0' ? users.getUsersForProtect(user.id) : null, + usersForProtect, usersInfo, }; diff --git a/web/documentserver-example/nodejs/helpers/users.js b/web/documentserver-example/nodejs/helpers/users.js index 0dd02a70..9c84574e 100644 --- a/web/documentserver-example/nodejs/helpers/users.js +++ b/web/documentserver-example/nodejs/helpers/users.js @@ -180,10 +180,7 @@ users.getUsersForProtect = function getUsersForProtect(id) { const result = []; this.forEach((user) => { if (user.id !== id && user.name != null) { - result.push({ - id: user.id, - name: user.name, - }); + result.push(user); } }); return result; From 6c09b3f62aa2df59df587239e470dabc557bf856 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Fri, 15 Mar 2024 11:18:15 +0300 Subject: [PATCH 11/12] nodejs: wopi formsubmit icon --- CHANGELOG.md | 1 + .../nodejs/public/images/wopi-formsubmit.svg | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 web/documentserver-example/nodejs/public/images/wopi-formsubmit.svg diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c5fcdd5..7c949dfc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Change Log +- nodejs: wopi formsubmit icon - php: handling conversion -9 error - nodejs: tabs menu - nodejs: delete all files diff --git a/web/documentserver-example/nodejs/public/images/wopi-formsubmit.svg b/web/documentserver-example/nodejs/public/images/wopi-formsubmit.svg new file mode 100644 index 00000000..8d58f94e --- /dev/null +++ b/web/documentserver-example/nodejs/public/images/wopi-formsubmit.svg @@ -0,0 +1,4 @@ + + + + From cee60a340a2d4d1b745dba9ff1b4557d0882f245 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Fri, 15 Mar 2024 12:55:59 +0300 Subject: [PATCH 12/12] nodejs: code alert 177 (e85cb5137bfe524c6283fb3640014e041d77c894) --- web/documentserver-example/nodejs/helpers/docManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/documentserver-example/nodejs/helpers/docManager.js b/web/documentserver-example/nodejs/helpers/docManager.js index e69dc2cb..39bdf8ed 100644 --- a/web/documentserver-example/nodejs/helpers/docManager.js +++ b/web/documentserver-example/nodejs/helpers/docManager.js @@ -51,7 +51,7 @@ DocManager.prototype.createDirectory = function createDirectory(directory) { // get the language from the request DocManager.prototype.getLang = function getLang() { - if (/^[a-z]{2}(-[A-z]{4})?(-[A-Z]{2})?$/.test(this.req.query.lang)) { + if (/^[a-z]{2}(-[a-zA-z]{4})?(-[A-Z]{2})?$/.test(this.req.query.lang)) { return this.req.query.lang; } // the default language value is English return 'en';