mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
ruby: Style/HashSyntax correct
This commit is contained in:
@ -1,24 +1,24 @@
|
|||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
gem 'byebug', '~> 11.1', :groups => %i[development test]
|
gem 'byebug', '~> 11.1', groups: %i[development test]
|
||||||
gem 'coffee-rails', '~> 5.0'
|
gem 'coffee-rails', '~> 5.0'
|
||||||
gem 'dalli', '~> 3.2', :group => :development
|
gem 'dalli', '~> 3.2', group: :development
|
||||||
gem 'jbuilder', '~> 2.11'
|
gem 'jbuilder', '~> 2.11'
|
||||||
gem 'jquery-rails', '~> 4.5'
|
gem 'jquery-rails', '~> 4.5'
|
||||||
gem 'jwt', '~> 2.7'
|
gem 'jwt', '~> 2.7'
|
||||||
gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '01f92d86d15d85cfd0f20dabd025dcbd36a8a60f'
|
gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '01f92d86d15d85cfd0f20dabd025dcbd36a8a60f'
|
||||||
gem 'rack-cors', '~> 2.0'
|
gem 'rack-cors', '~> 2.0'
|
||||||
gem 'rails', '~> 7.0.8'
|
gem 'rails', '~> 7.0.8'
|
||||||
gem 'rubocop', '~> 1.52', :group => :development
|
gem 'rubocop', '~> 1.52', group: :development
|
||||||
gem 'sass-rails', '~> 6.0'
|
gem 'sass-rails', '~> 6.0'
|
||||||
gem 'sdoc', '~> 2.6', :group => :doc
|
gem 'sdoc', '~> 2.6', group: :doc
|
||||||
gem 'sorbet-runtime', '~> 0.5.10871'
|
gem 'sorbet-runtime', '~> 0.5.10871'
|
||||||
gem 'test-unit', '~> 3.6', :groups => %i[development test]
|
gem 'test-unit', '~> 3.6', groups: %i[development test]
|
||||||
gem 'turbolinks', '~> 5.2'
|
gem 'turbolinks', '~> 5.2'
|
||||||
gem 'tzinfo-data', '~> 1.2023'
|
gem 'tzinfo-data', '~> 1.2023'
|
||||||
gem 'uglifier', '~> 4.2'
|
gem 'uglifier', '~> 4.2'
|
||||||
gem 'uuid', '~> 2.3'
|
gem 'uuid', '~> 2.3'
|
||||||
gem 'web-console', '~> 4.2', :groups => %i[development test]
|
gem 'web-console', '~> 4.2', groups: %i[development test]
|
||||||
gem 'webrick', '~> 1.8'
|
gem 'webrick', '~> 1.8'
|
||||||
|
|
||||||
# Unfortunately, Sorbet only supports Darwin and Linux-based systems.
|
# Unfortunately, Sorbet only supports Darwin and Linux-based systems.
|
||||||
@ -28,6 +28,6 @@ gem 'webrick', '~> 1.8'
|
|||||||
# https://github.com/sorbet/sorbet/issues/4011
|
# https://github.com/sorbet/sorbet/issues/4011
|
||||||
# https://github.com/sorbet/sorbet/issues/4119
|
# https://github.com/sorbet/sorbet/issues/4119
|
||||||
install_if -> { RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /x86_64/ } do
|
install_if -> { RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /x86_64/ } do
|
||||||
gem 'sorbet', '~> 0.5.10871', :group => :development
|
gem 'sorbet', '~> 0.5.10871', group: :development
|
||||||
gem 'tapioca', '~> 0.11.6', :group => :development
|
gem 'tapioca', '~> 0.11.6', group: :development
|
||||||
end
|
end
|
||||||
|
|||||||
@ -31,7 +31,7 @@ class HomeController < ApplicationController
|
|||||||
def editor
|
def editor
|
||||||
DocumentHelper.init(request.remote_ip, request.base_url)
|
DocumentHelper.init(request.remote_ip, request.base_url)
|
||||||
user = Users.get_user(params[:userId])
|
user = Users.get_user(params[:userId])
|
||||||
@file = FileModel.new(:file_name => File.basename(params[:fileName]), :mode => params[:editorsMode], :type => params[:editorsType], :user_ip => request.remote_ip, :lang => cookies[:ulang], :user => user, :action_data => params[:actionLink], :direct_url => params[:directUrl])
|
@file = FileModel.new(file_name: File.basename(params[:fileName]), mode: params[:editorsMode], type: params[:editorsType], user_ip: request.remote_ip, lang: cookies[:ulang], user:, action_data: params[:actionLink], direct_url: params[:directUrl])
|
||||||
end
|
end
|
||||||
|
|
||||||
# creating a sample document
|
# creating a sample document
|
||||||
@ -39,7 +39,7 @@ class HomeController < ApplicationController
|
|||||||
DocumentHelper.init(request.remote_ip, request.base_url)
|
DocumentHelper.init(request.remote_ip, request.base_url)
|
||||||
user = Users.get_user(params[:userId])
|
user = Users.get_user(params[:userId])
|
||||||
file_name = DocumentHelper.create_demo(params[:fileExt], params[:sample], user)
|
file_name = DocumentHelper.create_demo(params[:fileExt], params[:sample], user)
|
||||||
redirect_to :controller => 'home', :action => 'editor', :fileName => file_name, :userId => user.id
|
redirect_to controller: 'home', action: 'editor', fileName: file_name, userId: user.id
|
||||||
end
|
end
|
||||||
|
|
||||||
# uploading a file
|
# uploading a file
|
||||||
@ -154,11 +154,11 @@ class HomeController < ApplicationController
|
|||||||
hdr.slice!(0, 'Bearer '.length)
|
hdr.slice!(0, 'Bearer '.length)
|
||||||
token = JwtHelper.decode(hdr)
|
token = JwtHelper.decode(hdr)
|
||||||
if !token || token.eql?('')
|
if !token || token.eql?('')
|
||||||
render plain: 'JWT validation failed', :status => 403
|
render plain: 'JWT validation failed', status: 403
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
render plain: 'JWT validation failed', :status => 403
|
render plain: 'JWT validation failed', status: 403
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -171,7 +171,7 @@ class HomeController < ApplicationController
|
|||||||
response.headers['Content-Type'] = MimeMagic.by_path(file_path).eql?(nil) ? nil : MimeMagic.by_path(file_path).type
|
response.headers['Content-Type'] = MimeMagic.by_path(file_path).eql?(nil) ? nil : MimeMagic.by_path(file_path).type
|
||||||
response.headers['Content-Disposition'] = "attachment;filename*=UTF-8''#{ERB::Util.url_encode(file)}"
|
response.headers['Content-Disposition'] = "attachment;filename*=UTF-8''#{ERB::Util.url_encode(file)}"
|
||||||
|
|
||||||
send_file file_path, :x_sendfile => true
|
send_file file_path, x_sendfile: true
|
||||||
rescue StandardError => ex
|
rescue StandardError => ex
|
||||||
render plain: '{ "error": "File not found"}'
|
render plain: '{ "error": "File not found"}'
|
||||||
|
|
||||||
@ -254,7 +254,7 @@ class HomeController < ApplicationController
|
|||||||
response.headers['Content-Type'] = MimeMagic.by_path(csvPath).type
|
response.headers['Content-Type'] = MimeMagic.by_path(csvPath).type
|
||||||
response.headers['Content-Disposition'] = "attachment;filename*=UTF-8''#{ERB::Util.url_encode(file_name)}"
|
response.headers['Content-Disposition'] = "attachment;filename*=UTF-8''#{ERB::Util.url_encode(file_name)}"
|
||||||
|
|
||||||
send_file csvPath, :x_sendfile => true
|
send_file csvPath, x_sendfile: true
|
||||||
end
|
end
|
||||||
|
|
||||||
# downloading a file
|
# downloading a file
|
||||||
@ -272,7 +272,7 @@ class HomeController < ApplicationController
|
|||||||
token = JwtHelper.decode(hdr)
|
token = JwtHelper.decode(hdr)
|
||||||
end
|
end
|
||||||
if !token || token.eql?('')
|
if !token || token.eql?('')
|
||||||
render plain: 'JWT validation failed', :status => 403
|
render plain: 'JWT validation failed', status: 403
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -287,7 +287,7 @@ class HomeController < ApplicationController
|
|||||||
response.headers['Content-Type'] = MimeMagic.by_path(file_path).eql?(nil) ? nil : MimeMagic.by_path(file_path).type
|
response.headers['Content-Type'] = MimeMagic.by_path(file_path).eql?(nil) ? nil : MimeMagic.by_path(file_path).type
|
||||||
response.headers['Content-Disposition'] = "attachment;filename*=UTF-8''#{ERB::Util.url_encode(file_name)}"
|
response.headers['Content-Disposition'] = "attachment;filename*=UTF-8''#{ERB::Util.url_encode(file_name)}"
|
||||||
|
|
||||||
send_file file_path, :x_sendfile => true
|
send_file file_path, x_sendfile: true
|
||||||
rescue StandardError => ex
|
rescue StandardError => ex
|
||||||
render plain: '{ "error": "File not found"}'
|
render plain: '{ "error": "File not found"}'
|
||||||
|
|
||||||
@ -347,7 +347,7 @@ class HomeController < ApplicationController
|
|||||||
newfilename += orig_ext if orig_ext != cur_ext
|
newfilename += orig_ext if orig_ext != cur_ext
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
:title => newfilename
|
title: newfilename
|
||||||
}
|
}
|
||||||
|
|
||||||
json_data = TrackHelper.command_request('meta', dockey, meta)
|
json_data = TrackHelper.command_request('meta', dockey, meta)
|
||||||
@ -400,16 +400,16 @@ class HomeController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
:fileType => File.extname(fileName).downcase.delete('.'),
|
fileType: File.extname(fileName).downcase.delete('.'),
|
||||||
:key => ServiceConverter.generate_revision_id("#{"#{DocumentHelper.cur_user_host_address(nil)}/#{fileName}"}.#{File.mtime(DocumentHelper.storage_path(fileName, nil))}"),
|
key: ServiceConverter.generate_revision_id("#{"#{DocumentHelper.cur_user_host_address(nil)}/#{fileName}"}.#{File.mtime(DocumentHelper.storage_path(fileName, nil))}"),
|
||||||
:url => DocumentHelper.get_download_url(fileName),
|
url: DocumentHelper.get_download_url(fileName),
|
||||||
:directUrl => body['directUrl'] ? DocumentHelper.get_download_url(fileName, false) : nil,
|
directUrl: body['directUrl'] ? DocumentHelper.get_download_url(fileName, false) : nil,
|
||||||
:referenceData => {
|
referenceData: {
|
||||||
:instanceId => DocumentHelper.get_server_url(false),
|
instanceId: DocumentHelper.get_server_url(false),
|
||||||
:fileKey => { :fileName => fileName, :userAddress => DocumentHelper.cur_user_host_address(nil) }.to_json
|
fileKey: { fileName:, userAddress: DocumentHelper.cur_user_host_address(nil) }.to_json
|
||||||
},
|
},
|
||||||
:path => fileName,
|
path: fileName,
|
||||||
:link => "#{DocumentHelper.get_server_url(false)}/editor?fileName=#{fileName}"
|
link: "#{DocumentHelper.get_server_url(false)}/editor?fileName=#{fileName}"
|
||||||
}
|
}
|
||||||
|
|
||||||
data['token'] = JwtHelper.encode(data) if JwtHelper.is_enabled
|
data['token'] = JwtHelper.encode(data) if JwtHelper.is_enabled
|
||||||
|
|||||||
@ -179,9 +179,9 @@ class DocumentHelper
|
|||||||
|
|
||||||
# write user name, user uid and the creation time to the json object
|
# write user name, user uid and the creation time to the json object
|
||||||
json = {
|
json = {
|
||||||
:created => Time.now.to_formatted_s(:db),
|
created: Time.now.to_formatted_s(:db),
|
||||||
:uid => uid,
|
uid:,
|
||||||
:uname => uname
|
uname:
|
||||||
}
|
}
|
||||||
|
|
||||||
# write file meta information to the createdInfo.json file
|
# write file meta information to the createdInfo.json file
|
||||||
|
|||||||
@ -97,87 +97,87 @@ class FileModel
|
|||||||
templatesImageUrl = DocumentHelper.get_template_image_url(document_type) # templates image url in the "From Template" section
|
templatesImageUrl = DocumentHelper.get_template_image_url(document_type) # templates image url in the "From Template" section
|
||||||
templates = [
|
templates = [
|
||||||
{
|
{
|
||||||
:image => '',
|
image: '',
|
||||||
:title => 'Blank',
|
title: 'Blank',
|
||||||
:url => create_url
|
url: create_url
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:image => templatesImageUrl,
|
image: templatesImageUrl,
|
||||||
:title => 'With sample content',
|
title: 'With sample content',
|
||||||
:url => "#{create_url}&sample=true"
|
url: "#{create_url}&sample=true"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
:type => type,
|
type:,
|
||||||
:documentType => document_type,
|
documentType: document_type,
|
||||||
:document => {
|
document: {
|
||||||
:title => @file_name,
|
title: @file_name,
|
||||||
:url => download_url,
|
url: download_url,
|
||||||
:directUrl => is_enable_direct_url ? download_url(false) : '',
|
directUrl: is_enable_direct_url ? download_url(false) : '',
|
||||||
:fileType => file_ext.delete('.'),
|
fileType: file_ext.delete('.'),
|
||||||
:key => key,
|
key:,
|
||||||
:info => {
|
info: {
|
||||||
:owner => 'Me',
|
owner: 'Me',
|
||||||
:uploaded => Time.now.to_s,
|
uploaded: Time.now.to_s,
|
||||||
:favorite => @user.favorite
|
favorite: @user.favorite
|
||||||
},
|
},
|
||||||
:permissions => { # the permission for the document to be edited and downloaded or not
|
permissions: { # the permission for the document to be edited and downloaded or not
|
||||||
:comment => !editorsmode.eql?('view') && !editorsmode.eql?('fillForms') && !editorsmode.eql?('embedded') && !editorsmode.eql?('blockcontent'),
|
comment: !editorsmode.eql?('view') && !editorsmode.eql?('fillForms') && !editorsmode.eql?('embedded') && !editorsmode.eql?('blockcontent'),
|
||||||
:copy => !@user.deniedPermissions.include?('copy'),
|
copy: !@user.deniedPermissions.include?('copy'),
|
||||||
:download => !@user.deniedPermissions.include?('download'),
|
download: !@user.deniedPermissions.include?('download'),
|
||||||
:edit => canEdit && (editorsmode.eql?('edit') || editorsmode.eql?('view') || editorsmode.eql?('filter') || editorsmode.eql?('blockcontent')),
|
edit: canEdit && (editorsmode.eql?('edit') || editorsmode.eql?('view') || editorsmode.eql?('filter') || editorsmode.eql?('blockcontent')),
|
||||||
:print => !@user.deniedPermissions.include?('print'),
|
print: !@user.deniedPermissions.include?('print'),
|
||||||
:fillForms => !editorsmode.eql?('view') && !editorsmode.eql?('comment') && !editorsmode.eql?('embedded') && !editorsmode.eql?('blockcontent'),
|
fillForms: !editorsmode.eql?('view') && !editorsmode.eql?('comment') && !editorsmode.eql?('embedded') && !editorsmode.eql?('blockcontent'),
|
||||||
:modifyFilter => !editorsmode.eql?('filter'),
|
modifyFilter: !editorsmode.eql?('filter'),
|
||||||
:modifyContentControl => !editorsmode.eql?('blockcontent'),
|
modifyContentControl: !editorsmode.eql?('blockcontent'),
|
||||||
:review => canEdit && (editorsmode.eql?('edit') || editorsmode.eql?('review')),
|
review: canEdit && (editorsmode.eql?('edit') || editorsmode.eql?('review')),
|
||||||
:chat => !@user.id.eql?('uid-0'),
|
chat: !@user.id.eql?('uid-0'),
|
||||||
:reviewGroups => @user.reviewGroups,
|
reviewGroups: @user.reviewGroups,
|
||||||
:commentGroups => @user.commentGroups,
|
commentGroups: @user.commentGroups,
|
||||||
:userInfoGroups => @user.userInfoGroups,
|
userInfoGroups: @user.userInfoGroups,
|
||||||
:protect => !@user.deniedPermissions.include?('protect')
|
protect: !@user.deniedPermissions.include?('protect')
|
||||||
},
|
},
|
||||||
:referenceData => {
|
referenceData: {
|
||||||
:instanceId => DocumentHelper.get_server_url(false),
|
instanceId: DocumentHelper.get_server_url(false),
|
||||||
:fileKey => !@user.id.eql?('uid-0') ? { :fileName => @file_name, :userAddress => DocumentHelper.cur_user_host_address(nil) }.to_json : nil
|
fileKey: !@user.id.eql?('uid-0') ? { fileName: @file_name, userAddress: DocumentHelper.cur_user_host_address(nil) }.to_json : nil
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
:editorConfig => {
|
editorConfig: {
|
||||||
:actionLink => @action_data ? JSON.parse(@action_data) : nil,
|
actionLink: @action_data ? JSON.parse(@action_data) : nil,
|
||||||
:mode => mode,
|
mode:,
|
||||||
:lang => @lang || 'en',
|
lang: @lang || 'en',
|
||||||
:callbackUrl => callback_url, # absolute URL to the document storage service
|
callbackUrl: callback_url, # absolute URL to the document storage service
|
||||||
:coEditing => if editorsmode.eql?('view') && @user.id.eql?('uid-0')
|
coEditing: if editorsmode.eql?('view') && @user.id.eql?('uid-0')
|
||||||
{
|
{
|
||||||
:mode => 'strict',
|
mode: 'strict',
|
||||||
:change => false
|
change: false
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
nil
|
nil
|
||||||
end,
|
end,
|
||||||
:createUrl => !@user.id.eql?('uid-0') ? create_url : nil,
|
createUrl: !@user.id.eql?('uid-0') ? create_url : nil,
|
||||||
:templates => @user.templates ? templates : nil,
|
templates: @user.templates ? templates : nil,
|
||||||
:user => { # the user currently viewing or editing the document
|
user: { # the user currently viewing or editing the document
|
||||||
:id => !@user.id.eql?('uid-0') ? @user.id : nil,
|
id: !@user.id.eql?('uid-0') ? @user.id : nil,
|
||||||
:name => @user.name,
|
name: @user.name,
|
||||||
:group => @user.group,
|
group: @user.group,
|
||||||
:image => @user.avatar ? "#{DocumentHelper.get_server_url(true)}/assets/#{@user.id}.png" : nil
|
image: @user.avatar ? "#{DocumentHelper.get_server_url(true)}/assets/#{@user.id}.png" : nil
|
||||||
},
|
},
|
||||||
:embedded => { # the parameters for the embedded document type
|
embedded: { # the parameters for the embedded document type
|
||||||
:saveUrl => download_url(false), # the absolute URL that will allow the document to be saved onto the user personal computer
|
saveUrl: download_url(false), # the absolute URL that will allow the document to be saved onto the user personal computer
|
||||||
:embedUrl => download_url(false), # the absolute URL to the document serving as a source file for the document embedded into the web page
|
embedUrl: download_url(false), # the absolute URL to the document serving as a source file for the document embedded into the web page
|
||||||
:shareUrl => download_url(false), # the absolute URL that will allow other users to share this document
|
shareUrl: download_url(false), # the absolute URL that will allow other users to share this document
|
||||||
:toolbarDocked => 'top' # the place for the embedded viewer toolbar (top or bottom)
|
toolbarDocked: 'top' # the place for the embedded viewer toolbar (top or bottom)
|
||||||
},
|
},
|
||||||
:customization => { # the parameters for the editor interface
|
customization: { # the parameters for the editor interface
|
||||||
:about => true, # the About section display
|
about: true, # the About section display
|
||||||
:comments => true,
|
comments: true,
|
||||||
:feedback => true, # the Feedback & Support menu button display
|
feedback: true, # the Feedback & Support menu button display
|
||||||
:forcesave => false, # adding the request for the forced file saving to the callback handler
|
forcesave: false, # adding the request for the forced file saving to the callback handler
|
||||||
:submitForm => submitForm, # the Submit form button state
|
submitForm:, # the Submit form button state
|
||||||
:goback => {
|
goback: {
|
||||||
:url => DocumentHelper.get_server_url(false)
|
url: DocumentHelper.get_server_url(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -226,8 +226,8 @@ class FileModel
|
|||||||
# write information about changes to the object
|
# write information about changes to the object
|
||||||
obj['created'] = cr_info['created']
|
obj['created'] = cr_info['created']
|
||||||
obj['user'] = {
|
obj['user'] = {
|
||||||
:id => cr_info['uid'],
|
id: cr_info['uid'],
|
||||||
:name => cr_info['uname']
|
name: cr_info['uname']
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -260,16 +260,16 @@ class FileModel
|
|||||||
# write key and url information about previous file version with optional direct url
|
# write key and url information about previous file version with optional direct url
|
||||||
dataObj['previous'] = if is_enable_direct_url == true
|
dataObj['previous'] = if is_enable_direct_url == true
|
||||||
{ # write key and url information about previous file version with optional direct url
|
{ # write key and url information about previous file version with optional direct url
|
||||||
:fileType => prev['fileType'],
|
fileType: prev['fileType'],
|
||||||
:key => prev['key'],
|
key: prev['key'],
|
||||||
:url => prev['url'],
|
url: prev['url'],
|
||||||
:directUrl => prev['directUrl']
|
directUrl: prev['directUrl']
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
:fileType => prev['fileType'],
|
fileType: prev['fileType'],
|
||||||
:key => prev['key'],
|
key: prev['key'],
|
||||||
:url => prev['url']
|
url: prev['url']
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -286,11 +286,11 @@ class FileModel
|
|||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
:hist => { # write history information about the current file version to the hist
|
hist: { # write history information about the current file version to the hist
|
||||||
:currentVersion => cur_ver,
|
currentVersion: cur_ver,
|
||||||
:history => hist
|
history: hist
|
||||||
},
|
},
|
||||||
:histData => histData
|
histData:
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -304,14 +304,14 @@ class FileModel
|
|||||||
# direct url to the image
|
# direct url to the image
|
||||||
insert_image = if is_enable_direct_url == true
|
insert_image = if is_enable_direct_url == true
|
||||||
{
|
{
|
||||||
:fileType => 'png', # image file type
|
fileType: 'png', # image file type
|
||||||
:url => "#{DocumentHelper.get_server_url(true)}/assets/logo.png", # server url to the image
|
url: "#{DocumentHelper.get_server_url(true)}/assets/logo.png", # server url to the image
|
||||||
:directUrl => "#{DocumentHelper.get_server_url(false)}/assets/logo.png" # direct url to the image
|
directUrl: "#{DocumentHelper.get_server_url(false)}/assets/logo.png" # direct url to the image
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
:fileType => 'png', # image file type
|
fileType: 'png', # image file type
|
||||||
:url => "#{DocumentHelper.get_server_url(true)}/assets/logo.png" # server url to the image
|
url: "#{DocumentHelper.get_server_url(true)}/assets/logo.png" # server url to the image
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -329,14 +329,14 @@ class FileModel
|
|||||||
# direct url to the compared file
|
# direct url to the compared file
|
||||||
compare_file = if is_enable_direct_url == true
|
compare_file = if is_enable_direct_url == true
|
||||||
{
|
{
|
||||||
:fileType => 'docx', # file type
|
fileType: 'docx', # file type
|
||||||
:url => "#{DocumentHelper.get_server_url(true)}/asset?fileName=sample.docx", # server url to the compared file
|
url: "#{DocumentHelper.get_server_url(true)}/asset?fileName=sample.docx", # server url to the compared file
|
||||||
:directUrl => "#{DocumentHelper.get_server_url(false)}/asset?fileName=sample.docx" # direct url to the compared file
|
directUrl: "#{DocumentHelper.get_server_url(false)}/asset?fileName=sample.docx" # direct url to the compared file
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
:fileType => 'docx', # file type
|
fileType: 'docx', # file type
|
||||||
:url => "#{DocumentHelper.get_server_url(true)}/asset?fileName=sample.docx" # server url to the compared file
|
url: "#{DocumentHelper.get_server_url(true)}/asset?fileName=sample.docx" # server url to the compared file
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -354,14 +354,14 @@ class FileModel
|
|||||||
# direct url to the mail merge recipients file
|
# direct url to the mail merge recipients file
|
||||||
dataSpreadsheet = if is_enable_direct_url == true
|
dataSpreadsheet = if is_enable_direct_url == true
|
||||||
{
|
{
|
||||||
:fileType => 'csv', # file type
|
fileType: 'csv', # file type
|
||||||
:url => "#{DocumentHelper.get_server_url(true)}/csv", # server url to the mail merge recipients file
|
url: "#{DocumentHelper.get_server_url(true)}/csv", # server url to the mail merge recipients file
|
||||||
:directUrl => "#{DocumentHelper.get_server_url(false)}/csv" # direct url to the mail merge recipients file
|
directUrl: "#{DocumentHelper.get_server_url(false)}/csv" # direct url to the mail merge recipients file
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
:fileType => 'csv', # file type
|
fileType: 'csv', # file type
|
||||||
:url => "#{DocumentHelper.get_server_url(true)}/csv" # server url to the mail merge recipients file
|
url: "#{DocumentHelper.get_server_url(true)}/csv" # server url to the mail merge recipients file
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -40,14 +40,14 @@ class ServiceConverter
|
|||||||
document_revision_id = generate_revision_id(document_revision_id)
|
document_revision_id = generate_revision_id(document_revision_id)
|
||||||
|
|
||||||
payload = { # write all the conversion parameters to the payload
|
payload = { # write all the conversion parameters to the payload
|
||||||
:async => is_async ? true : false,
|
async: is_async ? true : false,
|
||||||
:url => document_uri,
|
url: document_uri,
|
||||||
:outputtype => to_ext.delete('.'),
|
outputtype: to_ext.delete('.'),
|
||||||
:filetype => from_ext.delete('.'),
|
filetype: from_ext.delete('.'),
|
||||||
:title => title,
|
title:,
|
||||||
:key => document_revision_id,
|
key: document_revision_id,
|
||||||
:password => file_pass,
|
password: file_pass,
|
||||||
:region => lang
|
region: lang
|
||||||
}
|
}
|
||||||
|
|
||||||
data = nil
|
data = nil
|
||||||
@ -66,7 +66,7 @@ class ServiceConverter
|
|||||||
if JwtHelper.is_enabled && JwtHelper.use_for_request # if the signature is enabled
|
if JwtHelper.is_enabled && JwtHelper.use_for_request # if the signature is enabled
|
||||||
payload['token'] = JwtHelper.encode(payload) # get token and save it to the payload
|
payload['token'] = JwtHelper.encode(payload) # get token and save it to the payload
|
||||||
jwtHeader = ServiceConverter.config_manager.jwt_header; # get signature authorization header
|
jwtHeader = ServiceConverter.config_manager.jwt_header; # get signature authorization header
|
||||||
req.add_field(jwtHeader, "Bearer #{JwtHelper.encode({ :payload => payload })}") # set it to the request with the Bearer prefix
|
req.add_field(jwtHeader, "Bearer #{JwtHelper.encode({ payload: })}") # set it to the request with the Bearer prefix
|
||||||
end
|
end
|
||||||
|
|
||||||
req.body = payload.to_json
|
req.body = payload.to_json
|
||||||
|
|||||||
@ -234,11 +234,11 @@ class TrackHelper
|
|||||||
def command_request(method, key, meta = nil)
|
def command_request(method, key, meta = nil)
|
||||||
# create a payload object with the method and key
|
# create a payload object with the method and key
|
||||||
payload = {
|
payload = {
|
||||||
:c => method,
|
c: method,
|
||||||
:key => key
|
key:
|
||||||
}
|
}
|
||||||
|
|
||||||
payload.merge!({ :meta => meta }) if !meta.nil?
|
payload.merge!({ meta: }) if !meta.nil?
|
||||||
|
|
||||||
data = nil
|
data = nil
|
||||||
begin
|
begin
|
||||||
@ -253,7 +253,7 @@ class TrackHelper
|
|||||||
if JwtHelper.is_enabled && JwtHelper.use_for_request # if the signature is enabled
|
if JwtHelper.is_enabled && JwtHelper.use_for_request # if the signature is enabled
|
||||||
payload['token'] = JwtHelper.encode(payload) # get token and save it to the payload
|
payload['token'] = JwtHelper.encode(payload) # get token and save it to the payload
|
||||||
jwtHeader = TrackHelper.config_manager.jwt_header; # get signature authorization header
|
jwtHeader = TrackHelper.config_manager.jwt_header; # get signature authorization header
|
||||||
req.add_field(jwtHeader, "Bearer #{JwtHelper.encode({ :payload => payload })}") # set it to the request with the Bearer prefix
|
req.add_field(jwtHeader, "Bearer #{JwtHelper.encode({ payload: })}") # set it to the request with the Bearer prefix
|
||||||
end
|
end
|
||||||
|
|
||||||
req.body = payload.to_json # convert the payload object into the json format
|
req.body = payload.to_json # convert the payload object into the json format
|
||||||
|
|||||||
@ -90,17 +90,17 @@ class Users
|
|||||||
nil, [], @@descr_user_1, true, true),
|
nil, [], @@descr_user_1, true, true),
|
||||||
User.new('uid-2', 'Mark Pottato', 'pottato@example.com',
|
User.new('uid-2', 'Mark Pottato', 'pottato@example.com',
|
||||||
'group-2', ['group-2', ''], {
|
'group-2', ['group-2', ''], {
|
||||||
:view => '',
|
view: '',
|
||||||
:edit => ['group-2', ''],
|
edit: ['group-2', ''],
|
||||||
:remove => ['group-2']
|
remove: ['group-2']
|
||||||
},
|
},
|
||||||
['group-2', ''],
|
['group-2', ''],
|
||||||
true, [], @@descr_user_2, false, true),
|
true, [], @@descr_user_2, false, true),
|
||||||
User.new('uid-3', 'Hamish Mitchell', nil,
|
User.new('uid-3', 'Hamish Mitchell', nil,
|
||||||
'group-3', ['group-2'], {
|
'group-3', ['group-2'], {
|
||||||
:view => %w[group-3 group-2],
|
view: %w[group-3 group-2],
|
||||||
:edit => ['group-2'],
|
edit: ['group-2'],
|
||||||
:remove => []
|
remove: []
|
||||||
},
|
},
|
||||||
['group-2'],
|
['group-2'],
|
||||||
false, %w[copy download print], @@descr_user_3, false, false),
|
false, %w[copy download print], @@descr_user_3, false, false),
|
||||||
@ -126,7 +126,7 @@ class Users
|
|||||||
def get_users_for_mentions(id)
|
def get_users_for_mentions(id)
|
||||||
usersData = []
|
usersData = []
|
||||||
@@users.each do |user|
|
@@users.each do |user|
|
||||||
usersData.push({ :name => user.name, :email => user.email }) if !user.id.eql?(id) && !user.name.nil? && !user.email.nil?
|
usersData.push({ name: user.name, email: user.email }) if !user.id.eql?(id) && !user.name.nil? && !user.email.nil?
|
||||||
end
|
end
|
||||||
usersData
|
usersData
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user