Merge pull request 'release/1.13.0' from release/1.13.0 into master
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/document-server-integration/pulls/60
2
.github/workflows/artifact-csharp-mvc.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
rsync -av --exclude='deploy' ./ ./deploy/'DotNet (Csharp MVC) Example'
|
||||
rm -rf ./deploy/'DotNet (Csharp MVC) Example'/assets/.git
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: DotNet.Csharp.MVC.Example
|
||||
path: ${{ github.workspace }}/web/documentserver-example/csharp-mvc/deploy
|
||||
2
.github/workflows/artifact-csharp.yml
vendored
@ -24,7 +24,7 @@ jobs:
|
||||
rsync -av --exclude='deploy' ./ ./deploy/'DotNet (Csharp) Example'
|
||||
rm -rf ./deploy/'DotNet (Csharp) Example'/assets/.git
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: DotNet.Csharp.Example
|
||||
path: ${{ github.workspace }}/web/documentserver-example/csharp/deploy
|
||||
2
.github/workflows/artifact-java.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
rm -rf ./deploy/'Java Example'/src/main/resources/assets/document-formats/.git
|
||||
rm -rf ./deploy/'Java Example'/src/main/resources/assets/document-templates/.git
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Java.Example
|
||||
path: ${{ github.workspace }}/web/documentserver-example/java/deploy
|
||||
2
.github/workflows/artifact-node.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
rm -rf ./deploy/'Node.js Example'/public/assets/document-formats/.git
|
||||
rm -rf ./deploy/'Node.js Example'/public/assets/document-templates/.git
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Node.js.Example
|
||||
path: ${{ github.workspace }}/web/documentserver-example/nodejs/deploy
|
||||
2
.github/workflows/artifact-php.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
rm -rf ./deploy/'PHP Example'/assets/document-formats/.git
|
||||
rm -rf ./deploy/'PHP Example'/assets/document-templates/.git
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: PHP.Example
|
||||
path: ${{ github.workspace }}/web/documentserver-example/php/deploy
|
||||
2
.github/workflows/artifact-python.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
rm -rf ./deploy/'Python Example'/assets/document-formats/.git
|
||||
rm -rf ./deploy/'Python Example'/assets/document-templates/.git
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Python.Example
|
||||
path: ${{ github.workspace }}/web/documentserver-example/python/deploy
|
||||
2
.github/workflows/artifact-ruby.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
rm -rf ./deploy/'Ruby Example'/public/assets/document-formats/.git
|
||||
rm -rf ./deploy/'Ruby Example'/public/assets/document-templates/.git
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Ruby.Example
|
||||
path: ${{ github.workspace }}/web/documentserver-example/ruby/deploy
|
||||
2
.github/workflows/artifact-spring.yml
vendored
@ -26,7 +26,7 @@ jobs:
|
||||
rm -rf ./deploy/'Java Spring Example'/src/main/resources/assets/document-formats/.git
|
||||
rm -rf ./deploy/'Java Spring Example'/src/main/resources/assets/document-templates/.git
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Java.Spring.Example
|
||||
path: ${{ github.workspace }}/web/documentserver-example/java-spring/deploy
|
||||
2
.github/workflows/lint-php.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
||||
working-directory: ./web/documentserver-example/php
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
|
||||
24
.github/workflows/release.yml
vendored
@ -63,6 +63,14 @@ jobs:
|
||||
rsync -av --exclude='PHP Example' ./ ./'PHP Example'
|
||||
rm -rf ./'PHP Example'/assets/document-formats/.git
|
||||
rm -rf ./'PHP Example'/assets/document-templates/.git
|
||||
- name: Build PHP Laravel Artifact
|
||||
run: |
|
||||
cd ${{ github.workspace }}
|
||||
cd ./web/documentserver-example/php-laravel
|
||||
mkdir -p ./'PHP Laravel Example'
|
||||
rsync -av --exclude='PHP Laravel Example' ./ ./'PHP Laravel Example'
|
||||
rm -rf ./'PHP Laravel Example'/public/assets/document-formats/.git
|
||||
rm -rf ./'PHP Laravel Example'/public/assets/document-templates/.git
|
||||
- name: Build Python Artifact
|
||||
run: |
|
||||
cd ${{ github.workspace }}
|
||||
@ -87,6 +95,14 @@ jobs:
|
||||
rsync -av --exclude='Java Spring Example' ./ ./'Java Spring Example'
|
||||
rm -rf ./'Java Spring Example'/src/main/resources/assets/document-formats/.git
|
||||
rm -rf ./'Java Spring Example'/src/main/resources/assets/document-templates/.git
|
||||
- name: Build Go Artifact
|
||||
run: |
|
||||
cd ${{ github.workspace }}
|
||||
cd ./web/documentserver-example/go
|
||||
mkdir -p .'Go Example'
|
||||
rsync -av --exclude='Go Example' ./ ./'Go Example'
|
||||
rm -rf ./'Go Example'/static/assets/document-formats/.git
|
||||
rm -rf ./'Go Example'/static/assets/document-templates/.git
|
||||
- name: Pack Artifacts
|
||||
run: |
|
||||
cd ${{ github.workspace }}/web/documentserver-example/csharp-mvc
|
||||
@ -99,12 +115,16 @@ jobs:
|
||||
zip -r Node.js.Example.zip ./'Node.js Example'
|
||||
cd ${{ github.workspace }}/web/documentserver-example/php
|
||||
zip -r PHP.Example.zip ./'PHP Example'
|
||||
cd ${{ github.workspace }}/web/documentserver-example/php-laravel
|
||||
zip -r PHP.Laravel.Example.zip ./'PHP Laravel Example'
|
||||
cd ${{ github.workspace }}/web/documentserver-example/python
|
||||
zip -r Python.Example.zip ./'Python Example'
|
||||
cd ${{ github.workspace }}/web/documentserver-example/ruby
|
||||
zip -r Ruby.Example.zip ./'Ruby Example'
|
||||
cd ${{ github.workspace }}/web/documentserver-example/java-spring
|
||||
zip -r Java.Spring.Example.zip ./'Java Spring Example'
|
||||
cd ${{ github.workspace }}/web/documentserver-example/go
|
||||
zip -r Go.Example.zip ./'Go Example'
|
||||
- name: Create Release
|
||||
uses: ncipollo/release-action@v1
|
||||
id: create_release
|
||||
@ -116,8 +136,10 @@ jobs:
|
||||
${{ github.workspace }}/web/documentserver-example/java/Java.Example.zip,
|
||||
${{ github.workspace }}/web/documentserver-example/nodejs/Node.js.Example.zip,
|
||||
${{ github.workspace }}/web/documentserver-example/php/PHP.Example.zip,
|
||||
${{ github.workspace }}/web/documentserver-example/php-laravel/PHP.Laravel.Example.zip,
|
||||
${{ github.workspace }}/web/documentserver-example/python/Python.Example.zip,
|
||||
${{ github.workspace }}/web/documentserver-example/ruby/Ruby.Example.zip,
|
||||
${{ github.workspace }}/web/documentserver-example/java-spring/Java.Spring.Example.zip
|
||||
${{ github.workspace }}/web/documentserver-example/java-spring/Java.Spring.Example.zip,
|
||||
${{ github.workspace }}/web/documentserver-example/go/Go.Example.zip
|
||||
"
|
||||
tag: v${{ steps.info.outputs.version }}
|
||||
15
.gitmodules
vendored
@ -19,7 +19,6 @@
|
||||
[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
|
||||
[submodule "web/documentserver-example/python/assets/document-templates"]
|
||||
path = web/documentserver-example/python/assets/document-templates
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
@ -36,18 +35,22 @@
|
||||
path = web/documentserver-example/java-spring/src/main/resources/assets/document-templates
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
branch = main/default
|
||||
[submodule "web/documentserver-example/go/static/assets/document-templates"]
|
||||
path = web/documentserver-example/go/static/assets/document-templates
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
branch = main/default
|
||||
[submodule "web/documentserver-example/go/static/assets/document-formats"]
|
||||
path = web/documentserver-example/go/static/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
[submodule "web/documentserver-example/python/assets/document-formats"]
|
||||
path = web/documentserver-example/python/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
branch = master
|
||||
[submodule "web/documentserver-example/ruby/assets/document-formats"]
|
||||
path = web/documentserver-example/ruby/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
branch = master
|
||||
[submodule "web/documentserver-example/java/src/main/resources/assets/document-formats"]
|
||||
path = web/documentserver-example/java/src/main/resources/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
branch = master
|
||||
[submodule "web/documentserver-example/csharp/assets/document-templates"]
|
||||
path = web/documentserver-example/csharp/assets/document-templates
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
@ -55,3 +58,7 @@
|
||||
[submodule "web/documentserver-example/csharp/assets/document-formats"]
|
||||
path = web/documentserver-example/csharp/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
[submodule "web/documentserver-example/php-laravel/public/assets/document-templates"]
|
||||
path = web/documentserver-example/php-laravel/public/assets/document-templates
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
branch = main/default
|
||||
|
||||
@ -82,6 +82,37 @@ License: MICROSOFT .NET LIBRARY LICENSE
|
||||
License File: WebGrease.license
|
||||
|
||||
|
||||
web/documentserver-example/go
|
||||
|
||||
fx - An application framework for Go that makes dependency injection easy. (https://github.com/uber-go/fx).
|
||||
License: MIT
|
||||
License File: fx.license
|
||||
|
||||
golang-jwt - A go implementation of JSON Web Tokens. (https://github.com/golang-jwt/jwt).
|
||||
License: MIT
|
||||
License File: golang-jwt.license
|
||||
|
||||
gorilla/mux - Package gorilla/mux implements a request router and dispatcher for matching incoming requests to their respective handler. (https://github.com/gorilla/mux).
|
||||
License: BSD-3-Clause License
|
||||
License File: mux.license
|
||||
|
||||
mapstructure - Go library for decoding generic map values into native Go structures and vice versa. (https://github.com/mitchellh/mapstructure)
|
||||
License: MIT
|
||||
License File: mapstructure.license
|
||||
|
||||
schema - Package gorilla/schema fills a struct with form values. (https://github.com/gorilla/schema)
|
||||
License: BSD-3-Clause License
|
||||
License File: schema.license
|
||||
|
||||
viper - Viper is a complete configuration solution for Go applications including 12-Factor apps. It is designed to work within an application, and can handle all types of configuration needs and formats. (https://github.com/spf13/viper).
|
||||
License: MIT
|
||||
License File: viper.license
|
||||
|
||||
zap - Blazing fast, structured, leveled logging in Go. (https://github.com/uber-go/zap).
|
||||
License: MIT
|
||||
License File: zap.license
|
||||
|
||||
|
||||
web/documentserver-example/java
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
@ -330,6 +361,41 @@ License: MIT
|
||||
License File: serializer.license
|
||||
|
||||
|
||||
web/documentserver-example/php-laravel
|
||||
|
||||
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 - 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
|
||||
|
||||
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 - PHP package for JWT (https://github.com/firebase/php-jwt/blob/main/LICENSE)
|
||||
License: BSD-3-Clause
|
||||
License File: jwt.license
|
||||
|
||||
Laravel - Laravel is a web application framework with expressive, elegant syntax. We’ve already laid the foundation for your next big idea — freeing you to create without sweating the small things. (https://github.com/laravel/framework/blob/master/LICENSE.md)
|
||||
License - MIT
|
||||
License File - laravel.license
|
||||
|
||||
|
||||
web/documentserver-example/python
|
||||
|
||||
django-stubs - PEP-484 stubs for Django. (https://github.com/typeddjango/django-stubs/blob/master/LICENSE.md)
|
||||
|
||||
35
CHANGELOG.md
@ -1,5 +1,37 @@
|
||||
# Change Log
|
||||
|
||||
## 1.13.0
|
||||
- nodejs: rename in wopi
|
||||
- nodejs: using faviconUrl from WOPI discovery
|
||||
- nodejs: wopi proof key verification
|
||||
- golang: new integration example
|
||||
- golang: upload files to the server
|
||||
- golang: create blank files and files with sample content
|
||||
- golang: edit uploaded files in onlyoffice editor
|
||||
- golang: delete files on the server
|
||||
- golang: show files history
|
||||
- php-laravel: new integration example
|
||||
- php-laravel: upload files to the server
|
||||
- php-laravel: create blank files and files with sample content
|
||||
- php-laravel: edit uploaded files in onlyoffice editor
|
||||
- php-laravel: delete files on the server
|
||||
- php-laravel: create, edit, and submit pdf forms
|
||||
- php-laravel: show forgotten files on a seperate page
|
||||
- php-laravel: fetch files
|
||||
- php-laravel: integrate sdk
|
||||
- jwt token lifetime from config
|
||||
- onUserActionRequired
|
||||
- support pages, numbers, key formats
|
||||
- support hwp, hwpx formats
|
||||
- restore by url
|
||||
- refresh config
|
||||
- on uploading xml convert to supported type only
|
||||
- converting function on index page
|
||||
- editing by default
|
||||
- change reference source
|
||||
- filename in editor page title
|
||||
- close editor
|
||||
|
||||
## 1.12.0
|
||||
- nodejs: refresh config
|
||||
- nodejs: support pages, numbers, key formats
|
||||
@ -39,8 +71,7 @@
|
||||
- nodejs: pdf, djvu, xps, oxps as pdf documentType
|
||||
- nodejs: filling pdf
|
||||
- version number to page meta
|
||||
- ar skin languages
|
||||
- sr-Latn-RS skin languages
|
||||
- ar, sr-Latn-RS skin languages
|
||||
- getting history via api
|
||||
- using a repo with a list of formats
|
||||
- convert after uploading only tagged formats
|
||||
|
||||
@ -5,15 +5,17 @@ Do NOT use these integration examples on your own server without proper code mod
|
||||
In case you enabled any of the test examples, disable it before going for production.
|
||||
|
||||
These examples show the way to integrate [ONLYOFFICE Docs][2] into your own website or application using one of the programming languages.
|
||||
The package contains examples written in .Net (C# MVC), .Net (C#), Java, Java Spring, Node.js, PHP, Python and Ruby.
|
||||
The package contains examples written in .Net (C# MVC), .Net (C#), Go, Java, Java Spring, Node.js, PHP, PHP (Laravel), Python and Ruby.
|
||||
|
||||
You should change `http://documentserver` to your server address in these files:
|
||||
* [.Net (C# MVC)](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/csharp-mvc) - `web/documentserver-example/csharp-mvc/web.appsettings.config`
|
||||
* [.Net (C#)](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/csharp) - `web/documentserver-example/csharp/settings.config`
|
||||
* [Go](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/go) - `web\documentserver-example\go\config\configuration.json`
|
||||
* [Java](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/java) - `web/documentserver-example/java/src/main/resources/settings.properties`
|
||||
* [Java Spring](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/java-spring) - `web/documentserver-example/java-spring/src/main/resources/application.properties`
|
||||
* [Node.js](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/nodejs) - `web/documentserver-example/nodejs/config/default.json`
|
||||
* [PHP](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/php) - `web/documentserver-example/php/src/configuration/ConfigurationManager.php`
|
||||
* [PHP (Laravel)](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/php-laravel) - `web/documentserver-example/php-laravel/.env.example`
|
||||
* [Python](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/python) - `web/documentserver-example/python/src/configuration/configuration.py`
|
||||
* [Ruby](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/ruby) - `web/documentserver-example/ruby/app/configuration/configuration.rb`
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
.center {
|
||||
width: auto;
|
||||
}
|
||||
@ -128,7 +146,7 @@ header a {
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 592px) and (min-width: 320px) {
|
||||
@media (max-width: 592px) {
|
||||
.center, .table-main {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,4 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.4285 13C14.4102 13 14 13 14 13.5V15H6C5.44772 15 5 15.4477 5 16V17C5 17.5523 5.44771 18 6 18H14V19.5C14 20 14.3816 20 14.4285 20C14.6359 20 15.0099 19.9113 15.2172 19.7363L18.6207 17.0833C19.1264 16.6566 19.1264 16.3434 18.6207 15.9167L15.2172 13.2637C15.0099 13.0887 14.6359 13 14.4285 13Z" fill="#444444"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.5715 4C9.58984 4 10 4 10 4.50002V6H18C18.5523 6 19 6.44772 19 7V8C19 8.55228 18.5523 9 18 9H10V10.5C10 11 9.61841 11 9.57151 11C9.36409 11 8.99012 10.9113 8.78279 10.7363L5.37934 8.08333C4.87356 7.65662 4.87356 7.34338 5.37934 6.91667L8.78279 4.26366C8.99012 4.08874 9.36409 4 9.5715 4Z" fill="#444444"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 821 B |
|
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 4.2 KiB |
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -42,10 +42,14 @@
|
||||
}
|
||||
|
||||
.tableHeaderCellViewers {
|
||||
width: 29%;
|
||||
width: 18%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.tableHeaderCellAction {
|
||||
width: 23%;
|
||||
}
|
||||
|
||||
.tableHeaderCellDownload {
|
||||
width: 21%;
|
||||
padding-right: 18px;
|
||||
@ -220,7 +224,7 @@
|
||||
}
|
||||
|
||||
.tableHeaderCellFileName {
|
||||
width: 16%;
|
||||
width: 9%;
|
||||
}
|
||||
|
||||
.tableHeaderCellEditors {
|
||||
@ -229,7 +233,12 @@
|
||||
|
||||
.tableHeaderCellViewers {
|
||||
text-align: right;
|
||||
width: 37%;
|
||||
width: 9%;
|
||||
}
|
||||
|
||||
.tableHeaderCellAction{
|
||||
width: 11%;
|
||||
padding-right: 82px;
|
||||
}
|
||||
|
||||
.tableHeaderCellDownload {
|
||||
@ -244,19 +253,24 @@
|
||||
}
|
||||
|
||||
.tableHeaderCellEditors {
|
||||
width: 26%;
|
||||
width: 15%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.tableHeaderCellFileName {
|
||||
width: 17%;
|
||||
width: 28%;
|
||||
}
|
||||
|
||||
.tableHeaderCellViewers {
|
||||
width: 27%;
|
||||
width: 6%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.tableHeaderCellAction{
|
||||
width: 18%;
|
||||
padding-right: 54px;
|
||||
}
|
||||
|
||||
.tableHeaderCellDownload {
|
||||
padding-right: 18px;
|
||||
width: 20%;
|
||||
@ -277,12 +291,17 @@
|
||||
|
||||
.tableRow td:first-child {
|
||||
flex-grow: 0;
|
||||
width: 15%;
|
||||
width: 25%;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.contentCells-icon {
|
||||
width: 3%;
|
||||
}
|
||||
|
||||
.firstContentCellViewers {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 890px) and (min-width: 769px ) {
|
||||
@ -290,7 +309,7 @@
|
||||
width: 20%;
|
||||
}
|
||||
.contentCells-shift {
|
||||
padding-right: 28px;
|
||||
padding-right: 27px;
|
||||
}
|
||||
|
||||
.main-panel {
|
||||
@ -323,11 +342,16 @@
|
||||
|
||||
.tableHeaderCellEditors {
|
||||
text-align: left;
|
||||
width: 31%;
|
||||
width: 1%;
|
||||
}
|
||||
|
||||
.tableHeaderCellViewers {
|
||||
width: 18%;
|
||||
width: 19%;
|
||||
}
|
||||
|
||||
.tableHeaderCellAction {
|
||||
width: 19%;
|
||||
padding-right: 45px;
|
||||
}
|
||||
}
|
||||
|
||||
@ -429,8 +453,8 @@
|
||||
|
||||
.downloadContentCellShift {
|
||||
max-width: 7%;
|
||||
margin-right: -11px;
|
||||
margin-left: auto;
|
||||
margin-right: 24px;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.contentCells-icon {
|
||||
@ -438,13 +462,13 @@
|
||||
}
|
||||
|
||||
.tableRow td:last-child {
|
||||
width: 12%;
|
||||
padding-right: 40px;
|
||||
width: 7%;
|
||||
padding-right: 0px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.contentCells-shift {
|
||||
padding-right: 35px;
|
||||
padding-right: 0px;
|
||||
}
|
||||
|
||||
.downloadContentCellShift:after {
|
||||
@ -530,6 +554,15 @@
|
||||
height: 56px;
|
||||
margin-bottom: 24px !important;
|
||||
}
|
||||
.button.hoar{
|
||||
width: 18%;
|
||||
height: 27px;
|
||||
margin-bottom: 7px !important;
|
||||
}
|
||||
.button.converting{
|
||||
width: 126px;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 560px) and (min-width: 510px) {
|
||||
@ -538,7 +571,7 @@
|
||||
}
|
||||
|
||||
.downloadContentCellShift {
|
||||
padding-right: 45px;
|
||||
padding-right: 16px;
|
||||
max-width: 4%;
|
||||
}
|
||||
}
|
||||
@ -558,7 +591,7 @@
|
||||
|
||||
.downloadContentCellShift {
|
||||
max-width: 6%;
|
||||
padding-right: 37px;
|
||||
padding-right: 6px;
|
||||
}
|
||||
|
||||
.firstContentCellShift {
|
||||
@ -584,12 +617,12 @@
|
||||
|
||||
.downloadContentCellShift {
|
||||
max-width: 3%;
|
||||
padding-right: 37px;
|
||||
padding-right: 0px;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.firstContentCellShift {
|
||||
margin-left: 1px;
|
||||
margin-left: 2px;
|
||||
flex-basis: 14%;
|
||||
}
|
||||
|
||||
@ -606,7 +639,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 420px) and (min-width: 320px) {
|
||||
@media (max-width: 420px) {
|
||||
.tableRow,
|
||||
menu.links {
|
||||
width: 25%;
|
||||
@ -619,7 +652,7 @@
|
||||
|
||||
.downloadContentCellShift {
|
||||
max-width: 4%;
|
||||
margin-right: -18px;
|
||||
margin-right: 18px;
|
||||
margin-left: -1px;
|
||||
}
|
||||
|
||||
@ -628,7 +661,7 @@
|
||||
}
|
||||
|
||||
.contentCells-icon{
|
||||
width: 10%;
|
||||
width: 12%;
|
||||
}
|
||||
footer table td {
|
||||
margin: 0;
|
||||
@ -682,7 +715,7 @@
|
||||
max-width: 45%;
|
||||
}
|
||||
}
|
||||
@media (max-width: 600px) and (min-width: 320px) {
|
||||
@media (max-width: 600px) {
|
||||
.main-panel{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@ -709,7 +742,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 592px) and (min-width: 320px) {
|
||||
@media (max-width: 592px) {
|
||||
body.menu-open {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -238,6 +238,52 @@ label .checkbox {
|
||||
color: #FF6F3D;
|
||||
}
|
||||
|
||||
.button.converting {
|
||||
margin-top: -20px;
|
||||
padding: 16px 16px;
|
||||
}
|
||||
|
||||
.button.converting.wide {
|
||||
padding: 16px 29px;
|
||||
}
|
||||
|
||||
.button.hoar {
|
||||
background: #EFEFEF;
|
||||
border: 1px solid #EFEFEF;
|
||||
margin-right: 7px;
|
||||
margin-bottom: 7px;
|
||||
width: 13%;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.button.hoar.disable {
|
||||
opacity: 30%;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.button.hoar:not(.disable):hover {
|
||||
background: #FF6F3D;
|
||||
border: 1px solid #FF6F3D;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.button.hoar.orange {
|
||||
background: #FF6F3D;
|
||||
border: 1px solid #FF6F3D;
|
||||
color: #FFFFFF;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.button.hoar.orange.disable {
|
||||
background: #444444;
|
||||
border: 1px solid #444444;
|
||||
color: #FFFFFF;
|
||||
cursor: default;
|
||||
opacity: 100%;
|
||||
}
|
||||
|
||||
.button.file-type {
|
||||
font-size: 11px;
|
||||
color: #FFFFFF;
|
||||
@ -380,6 +426,32 @@ label .checkbox {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#convertingProgress {
|
||||
color: #333333;
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
margin: 30px 35px;
|
||||
}
|
||||
|
||||
#convertingProgress .convertFileName{
|
||||
background-position: left center;
|
||||
background-repeat: no-repeat;
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
line-height: 160%;
|
||||
overflow: hidden;
|
||||
padding-left: 28px;
|
||||
margin-bottom: 16px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#convertingProgress .describeUpload {
|
||||
line-height: 150%;
|
||||
letter-spacing: -0.02em;
|
||||
padding: 16px 0;
|
||||
}
|
||||
|
||||
.error-message {
|
||||
background: url("images/error.svg") no-repeat scroll 4px 10px;
|
||||
color: #CB0000;
|
||||
@ -401,6 +473,10 @@ label .checkbox {
|
||||
padding-left: 35px;
|
||||
}
|
||||
|
||||
.waiting {
|
||||
opacity: 30%;
|
||||
}
|
||||
|
||||
.current {
|
||||
background-image: url("images/loader16.gif");
|
||||
}
|
||||
@ -413,6 +489,12 @@ label .checkbox {
|
||||
background-image: url("images/notdone.svg");
|
||||
}
|
||||
|
||||
.convertPercent {
|
||||
color: #FF6F3D;
|
||||
font-weight: 700;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.step-descr {
|
||||
display: block;
|
||||
margin-left: 35px;
|
||||
@ -420,6 +502,10 @@ label .checkbox {
|
||||
line-height: 188%;
|
||||
}
|
||||
|
||||
.step-descr.disable {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.progress-descr {
|
||||
letter-spacing: -0.02em;
|
||||
line-height: 150%;
|
||||
@ -521,21 +607,25 @@ footer table tr td:first-child {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.convertFileName.word,
|
||||
.stored-edit.word,
|
||||
.uploadFileName.word {
|
||||
background-image: url("images/icon_docx.svg");
|
||||
}
|
||||
|
||||
.convertFileName.cell,
|
||||
.stored-edit.cell,
|
||||
.uploadFileName.cell {
|
||||
background-image: url("images/icon_xlsx.svg");
|
||||
}
|
||||
|
||||
.convertFileName.slide,
|
||||
.stored-edit.slide,
|
||||
.uploadFileName.slide {
|
||||
background-image: url("images/icon_pptx.svg");
|
||||
}
|
||||
|
||||
.convertFileName.pdf,
|
||||
.stored-edit.pdf,
|
||||
.uploadFileName.pdf {
|
||||
background-image: url("images/icon_pdf.svg");
|
||||
@ -592,6 +682,11 @@ footer table tr td:first-child {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.convertTable {
|
||||
margin-top: 10px;
|
||||
margin-left: 35px;
|
||||
}
|
||||
|
||||
.tableRow {
|
||||
background: transparent;
|
||||
-moz-transition: all 0.2s ease-in-out;
|
||||
@ -638,6 +733,12 @@ footer table tr td:first-child {
|
||||
width: 11%;
|
||||
}
|
||||
|
||||
.tableHeaderCellAction{
|
||||
width: 13%;
|
||||
text-align: right;
|
||||
padding-right: 88px;
|
||||
}
|
||||
|
||||
.tableHeaderCellDownload {
|
||||
width: 13%;
|
||||
text-align: right;
|
||||
@ -662,7 +763,7 @@ footer table tr td:first-child {
|
||||
}
|
||||
|
||||
.contentCells-shift {
|
||||
padding-right: 44px;
|
||||
padding-right: 43px;
|
||||
}
|
||||
|
||||
.contentCells-icon {
|
||||
@ -726,7 +827,7 @@ footer table tr td:first-child {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.icon-delete {
|
||||
.icon-action {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@ -805,6 +906,13 @@ html {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.typeButtonsRow {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tableRow td:first-child {
|
||||
display: flex;
|
||||
@ -813,11 +921,11 @@ html {
|
||||
}
|
||||
|
||||
.tableHeaderCellFileName {
|
||||
width: 30%;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.tableHeaderCellEditors {
|
||||
width: 28%;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.tableHeaderCellViewers {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -217,7 +217,9 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
var directoryInfo = new DirectoryInfo(directory);
|
||||
|
||||
// take files from the root directory
|
||||
List<FileInfo> storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly).ToList();
|
||||
List<FileInfo> storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly)
|
||||
.OrderByDescending(f => f.LastWriteTimeUtc)
|
||||
.ToList();
|
||||
|
||||
return storedFiles;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -83,7 +83,8 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
bool isAsync,
|
||||
out Dictionary<string, string> convertedDocumentData,
|
||||
string filePass = null,
|
||||
string lang = null)
|
||||
string lang = null,
|
||||
string fileName = null)
|
||||
{
|
||||
convertedDocumentData = new Dictionary<string, string>();
|
||||
|
||||
@ -91,7 +92,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
fromExtension = string.IsNullOrEmpty(fromExtension) ? Path.GetExtension(documentUri).ToLower() : fromExtension;
|
||||
|
||||
// check if the file name parameter is defined; if not, get random uuid for this file
|
||||
var title = Path.GetFileName(documentUri);
|
||||
var title = string.IsNullOrEmpty(fileName) ? Path.GetFileName(documentUri) : fileName;
|
||||
title = string.IsNullOrEmpty(title) ? Guid.NewGuid().ToString() : title;
|
||||
|
||||
// get document key
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -20,6 +20,7 @@ using JWT;
|
||||
using JWT.Algorithms;
|
||||
using JWT.Builder;
|
||||
using JWT.Serializers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Configuration;
|
||||
|
||||
@ -30,17 +31,25 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
private static readonly string Secret;
|
||||
public static readonly bool Enabled;
|
||||
public static readonly bool SignatureUseForRequest;
|
||||
public static readonly int ExpiresIn;
|
||||
|
||||
static JwtManager()
|
||||
{
|
||||
Secret = WebConfigurationManager.AppSettings["files.docservice.secret"] ?? ""; // get token secret from the config parameters
|
||||
Enabled = !string.IsNullOrEmpty(Secret); // check if the token is enabled
|
||||
ExpiresIn = int.Parse(WebConfigurationManager.AppSettings["files.docservice.token.expires-in"]);
|
||||
SignatureUseForRequest = bool.Parse(WebConfigurationManager.AppSettings["files.docservice.token.useforrequest"]);
|
||||
}
|
||||
|
||||
// encode a payload object into a token using a secret key
|
||||
public static string Encode(IDictionary<string, object> payload)
|
||||
{
|
||||
var now = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
var expires = now + ExpiresIn * 60;
|
||||
|
||||
payload["iat"] = now;
|
||||
payload["exp"] = expires;
|
||||
|
||||
var encoder = new JwtEncoder(new HMACSHA256Algorithm(),
|
||||
new JsonNetSerializer(),
|
||||
new JwtBase64UrlEncoder());
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -78,7 +78,8 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
"Can't view chat",
|
||||
"Can't protect file",
|
||||
"View file without collaboration",
|
||||
"Can’t submit forms"
|
||||
"Can’t submit forms",
|
||||
"Can’t refresh outdated file"
|
||||
};
|
||||
|
||||
private static List<User> users = new List<User>() {
|
||||
@ -95,7 +96,8 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
descr_user_1,
|
||||
true,
|
||||
true,
|
||||
new Goback(null, false)
|
||||
new Goback(null, false),
|
||||
new Close(null, false)
|
||||
),
|
||||
new User(
|
||||
"uid-2",
|
||||
@ -115,7 +117,8 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
descr_user_2,
|
||||
false,
|
||||
true,
|
||||
new Goback("Go to Documents", null)
|
||||
new Goback("Go to Documents", null),
|
||||
new Close(null, true)
|
||||
),
|
||||
new User(
|
||||
"uid-3",
|
||||
@ -135,7 +138,8 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
descr_user_3,
|
||||
false,
|
||||
false,
|
||||
null
|
||||
null,
|
||||
new Close(null, true)
|
||||
),
|
||||
new User(
|
||||
"uid-0",
|
||||
@ -150,6 +154,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
descr_user_0,
|
||||
false,
|
||||
false,
|
||||
null,
|
||||
null
|
||||
)
|
||||
};
|
||||
@ -242,8 +247,9 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
public bool avatar;
|
||||
|
||||
public Goback goback;
|
||||
public Close close;
|
||||
|
||||
public User(string id, string name, string email, string group, List<string> reviewGroups, Dictionary<string, object> commentGroups, List<string> userInfoGroups, bool? favorite, List<string> deniedPermissions, List<string> descriptions, bool templates, bool avatar, Goback goback)
|
||||
public User(string id, string name, string email, string group, List<string> reviewGroups, Dictionary<string, object> commentGroups, List<string> userInfoGroups, bool? favorite, List<string> deniedPermissions, List<string> descriptions, bool templates, bool avatar, Goback goback, Close close)
|
||||
{
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
@ -258,6 +264,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
this.userInfoGroups = userInfoGroups;
|
||||
this.avatar = avatar;
|
||||
this.goback = goback;
|
||||
this.close = close;
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,4 +281,18 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
this.blank = blank;
|
||||
}
|
||||
}
|
||||
|
||||
public class Close
|
||||
{
|
||||
public string text;
|
||||
public bool visible;
|
||||
|
||||
public Close(){}
|
||||
|
||||
public Close(string text, bool visible)
|
||||
{
|
||||
this.text = text;
|
||||
this.visible = visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -77,15 +77,14 @@ namespace OnlineEditorsExampleMVC.Models
|
||||
var jss = new JavaScriptSerializer();
|
||||
|
||||
var ext = Path.GetExtension(FileName).ToLower(); // get file extension
|
||||
var canFill = DocManagerHelper.FillFormExts.Contains(ext);
|
||||
var editorsMode = Mode ?? (canFill ? "fillForms" : "edit"); // get editor mode
|
||||
var editorsMode = Mode ?? "edit"; // get editor mode
|
||||
|
||||
var canEdit = DocManagerHelper.EditedExts.Contains(ext); // check if the file with such an extension can be edited
|
||||
|
||||
var id = request.Cookies.GetOrDefault("uid", null);
|
||||
var user = Users.getUser(id); // get the user
|
||||
|
||||
if ((!canEdit && editorsMode.Equals("edit") || editorsMode.Equals("fillForms")) && canFill) {
|
||||
if ((!canEdit && editorsMode.Equals("edit") || editorsMode.Equals("fillForms")) && DocManagerHelper.FillFormExts.Contains(ext)) {
|
||||
editorsMode = "fillForms";
|
||||
canEdit = true;
|
||||
}
|
||||
@ -221,6 +220,13 @@ namespace OnlineEditorsExampleMVC.Models
|
||||
{ "text", user.goback.text },
|
||||
{ "blank", user.goback.blank }
|
||||
} : new Dictionary<string, object>{}
|
||||
},
|
||||
{
|
||||
"close", user.close != null ? new Dictionary<string, object>
|
||||
{
|
||||
{ "text", user.close.text },
|
||||
{ "visible", user.close. visible }
|
||||
} : new Dictionary<string, object>{}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -31,6 +31,7 @@ namespace OnlineEditorsExampleMVC.Models
|
||||
{
|
||||
public enum FileType
|
||||
{
|
||||
Null,
|
||||
Word,
|
||||
Cell,
|
||||
Slide,
|
||||
@ -47,7 +48,7 @@ namespace OnlineEditorsExampleMVC.Models
|
||||
if (FormatManager.SpreadsheetExtensions().Contains(ext)) return FileType.Cell; // cell type for spreadsheet extensions
|
||||
if (FormatManager.PresentationExtensions().Contains(ext)) return FileType.Slide; // slide type for presentation extensions
|
||||
|
||||
return FileType.Word; // the default type is word
|
||||
return FileType.Null; // the default type is word
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -7,7 +7,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Ascensio System SIA")]
|
||||
[assembly: AssemblyProduct("OnlineEditorsExampleMVC")]
|
||||
[assembly: AssemblyCopyright("Ascensio System SIA 2024")]
|
||||
[assembly: AssemblyCopyright("Ascensio System SIA 2025")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
function deleteFile(event) {
|
||||
let filename = event.currentTarget.getAttribute("data");
|
||||
filename = encodeURIComponent(filename);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -154,6 +154,16 @@ if (typeof jQuery != "undefined") {
|
||||
return;
|
||||
} else {
|
||||
if (response.error.includes("Error conversion output format")) {
|
||||
let format = formatManager.findByExtension(fileName.split(".").pop());
|
||||
if (!format.convert.includes("docx")) {
|
||||
jq(".document").addClass("invisible")
|
||||
}
|
||||
if (!format.convert.includes("xlsx")) {
|
||||
jq(".spreadsheet").addClass("invisible")
|
||||
}
|
||||
if (!format.convert.includes("pptx")) {
|
||||
jq(".presentation").addClass("invisible")
|
||||
}
|
||||
jq("#select-file-type").removeClass("invisible");
|
||||
jq("#step2").removeClass("current");
|
||||
jq("#hiddenFileName").attr("placeholder", filePass);
|
||||
@ -294,6 +304,132 @@ if (typeof jQuery != "undefined") {
|
||||
jq("#embeddedView").attr("src", url);
|
||||
});
|
||||
|
||||
jq(document).on("click", "#beginEditConverted:not(.disable)", function () {
|
||||
var fileId = encodeURIComponent(jq('#hiddenFileName').attr("data"));
|
||||
var url = UrlEditor + "?fileName=" + fileId;
|
||||
window.open(url, "_blank");
|
||||
jq('#hiddenFileName').val("");
|
||||
jq.unblockUI();
|
||||
document.location.reload();
|
||||
});
|
||||
|
||||
jq(document).on("click", "#beginViewConverted:not(.disable)", function () {
|
||||
var fileId = encodeURIComponent(jq('#hiddenFileName').attr("data"));
|
||||
var url = UrlEditor + "?editorsMode=view&fileName=" + fileId;
|
||||
window.open(url, "_blank");
|
||||
jq('#hiddenFileName').val("");
|
||||
jq.unblockUI();
|
||||
document.location.reload();
|
||||
});
|
||||
|
||||
jq(document).on("click", "#downloadConverted:not(.disable)", function () {
|
||||
var fileId = jq('#hiddenFileName').attr("data");
|
||||
if (jq("#downloadConverted").attr("data") == "fromConverter") window.location.assign(fileId);
|
||||
else window.open("webeditor.ashx?type=download&fileName=" + encodeURIComponent(fileId), "_blank");
|
||||
});
|
||||
|
||||
jq(document).on("click", ".convert-file", function () {
|
||||
const currentElement = jq(this);
|
||||
var fileName = currentElement.attr("data");
|
||||
var type = currentElement.attr("data-type");
|
||||
|
||||
jq.blockUI({
|
||||
theme: true,
|
||||
title: "Converting file" + "<div class=\"dialog-close\"></div>",
|
||||
message: jq("#convertingProgress"),
|
||||
overlayCSS: { "background-color": "#aaa" },
|
||||
themedCSS: { width: "539px", top: "20%", left: "50%", marginLeft: "-269px" }
|
||||
});
|
||||
|
||||
jq("#convertFileName").text(decodeURIComponent(fileName));
|
||||
jq("#convertFileName").removeClass("word slide cell");
|
||||
jq("#convertFileName").addClass(type);
|
||||
jq("#convTypes").empty();
|
||||
|
||||
let format = formatManager.findByExtension(fileName.split('.').pop());
|
||||
if (format) {
|
||||
format.convert.forEach(ext => {
|
||||
jq("#convTypes").append(jq(`<td name="convertingTypeButton" id="wordTo${ext}" class="button hoar" data="${ext}">${ext}</td>`));
|
||||
});
|
||||
}
|
||||
|
||||
jq("#hiddenFileName").val(fileName);
|
||||
jq("#convertStep1").addClass("done");
|
||||
jq("#convertStep2").addClass("waiting");
|
||||
});
|
||||
|
||||
jq(document).on("click", "td[name='convertingTypeButton']:not(.disable, .orange)", function () {
|
||||
const currentElement = jq(this);
|
||||
let id = currentElement[0].id;
|
||||
let fileExt = jq(`#${id}`).attr("data");
|
||||
jq(`#${id}`).addClass("orange");
|
||||
jq("td[name='convertingTypeButton']").addClass("disable");
|
||||
jq("#convertStep2").removeClass("waiting").removeClass("done").addClass("current");
|
||||
jq("#convertStep2").text('2. File conversion');
|
||||
jq("#convert-descr").removeClass("disable");
|
||||
jq("#convertPercent").text("0 %");
|
||||
jq("#hiddenFileName").attr("placeholder",fileExt);
|
||||
jq("#downloadConverted").addClass("disable");
|
||||
jq("#beginEditConverted").addClass("disable");
|
||||
jq("#beginViewConverted").addClass("disable");
|
||||
mustReload = true;
|
||||
|
||||
convertFile();
|
||||
});
|
||||
|
||||
function convertFile (filePass) {
|
||||
let fileName = decodeURIComponent(jq("#hiddenFileName").val());
|
||||
let fileExt = jq("#hiddenFileName").attr("placeholder");
|
||||
|
||||
filePass = filePass ? filePass : null;
|
||||
if (timer != null) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
timer = setTimeout(function () {
|
||||
jq.ajax({
|
||||
async: true,
|
||||
contentType: "text/xml",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: JSON.stringify({filename: fileName, filePass: filePass, lang: language, fileExt: fileExt, keepOriginal: true}),
|
||||
url: UrlConverter,
|
||||
complete: function (data) {
|
||||
try {
|
||||
var response = jq.parseJSON(data.responseText);
|
||||
} catch (e) {
|
||||
response = { error: e };
|
||||
}
|
||||
if (!response.filename && !response.step && response.error) {
|
||||
jq("#convertStep2").removeClass("current").addClass("error");
|
||||
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
|
||||
jq("#convert-error").removeClass("hidden");
|
||||
jq("#convert-error").text(`${response.error}`);
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
return;
|
||||
}
|
||||
if (response.step != undefined && response.step != 100) {
|
||||
jq("#convertPercent").text(`${response.step} %`);
|
||||
convertFile();
|
||||
} else {
|
||||
jq("#convertPercent").text(`${response.step} %`);
|
||||
jq("#convertStep2").removeClass("current").addClass("done");
|
||||
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
|
||||
jq("#downloadConverted").removeClass("disable");
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
if (response.error !== "FileTypeIsNotSupported") {
|
||||
jq("#beginEditConverted").removeClass("disable");
|
||||
jq("#beginViewConverted").removeClass("disable");
|
||||
jq("#downloadConverted").attr("data","fromStorage");
|
||||
} else {
|
||||
jq("#downloadConverted").attr("data","fromConverter");
|
||||
}
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
jq(document).on("click", "#cancelEdit, .dialog-close", function () {
|
||||
jq('#hiddenFileName').val("");
|
||||
jq("#embeddedView").attr("src", "");
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<!--
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -62,8 +62,8 @@
|
||||
|
||||
// the document is modified
|
||||
var onDocumentStateChange = function (event) {
|
||||
var title = document.title.replace(/\*$/g, "");
|
||||
document.title = title + (event.data ? "*" : "");
|
||||
var title = document.title.replace(/^\*/g, "");
|
||||
document.title = (event.data ? "*" : "") + title;
|
||||
};
|
||||
|
||||
// the user is trying to switch the document from the viewing into the editing mode
|
||||
@ -106,6 +106,15 @@
|
||||
docEditor.setActionLink(replaceActionLink(location.href, linkParam)); // set the link to the document which contains a bookmark
|
||||
};
|
||||
|
||||
var onRequestClose = function () { // close editor
|
||||
docEditor.destroyEditor();
|
||||
innerAlert("Document editor closed successfully");
|
||||
};
|
||||
|
||||
var onUserActionRequired = function () {
|
||||
console.log("User action required");
|
||||
};
|
||||
|
||||
// the meta information of the document is changed via the meta command
|
||||
var onMetaChange = function (event) {
|
||||
if (event.data.favorite !== undefined) {
|
||||
@ -182,6 +191,18 @@
|
||||
}
|
||||
};
|
||||
|
||||
var onRequestRefreshFile = function(event) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "webeditor.ashx?type=config&fileName=" + encodeURIComponent(config.document.title) +
|
||||
"&directUrl=" + !!config.document.directUrl +
|
||||
"&permissions=" + encodeURIComponent(JSON.stringify(config.document.permissions)));
|
||||
xhr.send();
|
||||
xhr.onload = function () {
|
||||
innerAlert(xhr.responseText);
|
||||
docEditor.refreshFile(JSON.parse(xhr.responseText));
|
||||
};
|
||||
};
|
||||
|
||||
var onRequestOpen = function (event) { // user open external data source
|
||||
innerAlert("onRequestOpen");
|
||||
var windowName = event.data.windowName;
|
||||
@ -218,6 +239,52 @@
|
||||
}
|
||||
};
|
||||
|
||||
var onRequestReferenceSource = function (event) {
|
||||
innerAlert("onRequestReferenceSource");
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "webeditor.ashx?type=files");
|
||||
xhr.setRequestHeader("Content-Type", "application/json");
|
||||
xhr.send();
|
||||
xhr.onload = function () {
|
||||
if (xhr.status === 200) {
|
||||
innerAlert(JSON.parse(xhr.responseText));
|
||||
let fileList = JSON.parse(xhr.responseText);
|
||||
let firstXlsxName;
|
||||
let file;
|
||||
for (file of fileList) {
|
||||
if (file["title"]) {
|
||||
if (getFileExt(file["title"]) === "xlsx")
|
||||
{
|
||||
firstXlsxName = file["title"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (firstXlsxName) {
|
||||
let data = {
|
||||
directUrl : !!config.document.directUrl,
|
||||
path : firstXlsxName
|
||||
};
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "webeditor.ashx?type=reference");
|
||||
xhr.setRequestHeader("Content-Type", "application/json");
|
||||
xhr.send(JSON.stringify(data));
|
||||
xhr.onload = function () {
|
||||
if (xhr.status === 200) {
|
||||
docEditor.setReferenceSource(JSON.parse(xhr.responseText));
|
||||
} else {
|
||||
innerAlert("/reference - bad status");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
innerAlert("No *.xlsx files");
|
||||
}
|
||||
} else {
|
||||
innerAlert("/files - bad status");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var onRequestHistory = function () {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "webeditor.ashx?type=gethistory&filename=<%= Model.FileName %>");
|
||||
@ -245,9 +312,11 @@
|
||||
var onRequestRestore = function (event) {
|
||||
var fileName = "<%= Model.FileName %>";
|
||||
var version = event.data.version;
|
||||
var url = event.data.url;
|
||||
var data = {
|
||||
fileName: fileName,
|
||||
version: version
|
||||
version: version,
|
||||
url: url
|
||||
};
|
||||
|
||||
let xhr = new XMLHttpRequest();
|
||||
@ -309,6 +378,7 @@
|
||||
config.events = {
|
||||
'onAppReady': onAppReady,
|
||||
'onDocumentStateChange': onDocumentStateChange,
|
||||
'onUserActionRequired': onUserActionRequired,
|
||||
'onError': onError,
|
||||
'onOutdatedVersion': onOutdatedVersion,
|
||||
"onMakeActionLink": onMakeActionLink,
|
||||
@ -319,6 +389,8 @@
|
||||
};
|
||||
|
||||
if (config.editorConfig.user.id) {
|
||||
config.events['onRequestRefreshFile'] = onRequestRefreshFile;
|
||||
config.events['onRequestClose'] = onRequestClose;
|
||||
// the user is trying to show the document version history
|
||||
config.events['onRequestHistory'] = onRequestHistory;
|
||||
// the user is trying to click the specific document version in the document version history
|
||||
@ -346,12 +418,20 @@
|
||||
// prevent switch the document from the viewing into the editing mode for anonymous users
|
||||
config.events['onRequestEditRights'] = onRequestEditRights;
|
||||
config.events['onRequestOpen'] = onRequestOpen;
|
||||
config.events['onRequestReferenceSource'] = onRequestReferenceSource;
|
||||
}
|
||||
|
||||
var сonnectEditor = function () {
|
||||
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
|
||||
};
|
||||
|
||||
const getFileExt = function (fileName) {
|
||||
if (fileName.indexOf(".")) {
|
||||
return fileName.split('.').reverse()[0];
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
if (window.addEventListener) {
|
||||
window.addEventListener("load", сonnectEditor);
|
||||
} else if (window.attachEvent) {
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<meta name="server-version" content=<%= DocManagerHelper.GetVersion() %> />
|
||||
<!--
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
<meta name="server-version" content=<%= DocManagerHelper.GetVersion() %> />
|
||||
<!--
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -192,8 +192,7 @@
|
||||
<td class="tableHeaderCell tableHeaderCellFileName">Filename</td>
|
||||
<td class="tableHeaderCell tableHeaderCellEditors contentCells-shift">Editors</td>
|
||||
<td class="tableHeaderCell tableHeaderCellViewers">Viewers</td>
|
||||
<td class="tableHeaderCell tableHeaderCellDownload">Download</td>
|
||||
<td class="tableHeaderCell tableHeaderCellRemove">Remove</td>
|
||||
<td class="tableHeaderCell tableHeaderCellAction">Action</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
@ -301,14 +300,22 @@
|
||||
<img src="content/images/embeded.svg" alt="Open in embedded mode" title="Open in embedded mode"/>
|
||||
</a>
|
||||
</td>
|
||||
<td class="contentCells contentCells-icon contentCells-shift downloadContentCellShift">
|
||||
<% if (docType != null ) { %>
|
||||
<td class="contentCells contentCells-icon">
|
||||
<a class="convert-file" data="<%= storedFile.Name %>" data-type="<%= docType %>">
|
||||
<img class="icon-action" src="content/images/convert.svg" alt="Convert" title="Convert" /></a>
|
||||
</td>
|
||||
<% } else { %>
|
||||
<td class="contentCells contentCells-icon downloadContentCellShift"></td>
|
||||
<% } %>
|
||||
<td class="contentCells contentCells-icon downloadContentCellShift">
|
||||
<a href="webeditor.ashx?type=download&fileName=<%= HttpUtility.UrlEncode(storedFile.Name) %>">
|
||||
<img class="icon-download" src="content/images/download.svg" alt="Download" title="Download" />
|
||||
</a>
|
||||
</td>
|
||||
<td class="contentCells contentCells-icon contentCells-shift">
|
||||
<a class="delete-file" data-filename="<%= storedFile.Name %>">
|
||||
<img class="icon-delete" src="content/images/delete.svg" alt="Delete" title="Delete" />
|
||||
<img class="icon-action" src="content/images/delete.svg" alt="Delete" title="Delete" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@ -377,6 +384,32 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="convertingProgress">
|
||||
<div id="convertingSteps">
|
||||
<span id="convertFileName" class="convertFileName"></span>
|
||||
<span id="convertStep1" class="step">1. Select a format file to convert</span>
|
||||
<span class="step-descr">The converting speed depends on file size and additional elements it contains.</span>
|
||||
<table cellspacing="0" cellpadding="0" width="100%" class="convertTable">
|
||||
<tbody>
|
||||
<tr class="typeButtonsRow" id="convTypes"></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br />
|
||||
<span id="convertStep2" class="step">2. File conversion</span>
|
||||
<span class="step-descr disable" id="convert-descr">The file is converted <div class="convertPercent" id="convertPercent">0 %</div></span>
|
||||
<span class="step-error hidden" id="convert-error"></span>
|
||||
<div class="describeUpload">Note the speed of all operations depends on your connection quality and server location.</div>
|
||||
<input type="hidden" name="hiddenFileName" id="hiddenFileName" />
|
||||
</div>
|
||||
<br />
|
||||
<div class="buttonsMobile">
|
||||
<div id="downloadConverted" class="button converting orange disable">DOWNLOAD</div>
|
||||
<div id="beginViewConverted" class="button converting wide gray disable">VIEW</div>
|
||||
<div id="beginEditConverted" class="button converting wide gray disable">EDIT</div>
|
||||
<div id="cancelEdit" class="button converting gray">CANCEL</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span id="loadScripts" data-docs="<%= WebConfigurationManager.AppSettings["files.docservice.url.site"] + WebConfigurationManager.AppSettings["files.docservice.url.preloader"] %>"></span>
|
||||
|
||||
<footer>
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<!--
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -93,6 +93,9 @@ namespace OnlineEditorsExampleMVC
|
||||
case "formats":
|
||||
Formats(context);
|
||||
break;
|
||||
case "config":
|
||||
Config(context);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -254,8 +257,15 @@ namespace OnlineEditorsExampleMVC
|
||||
conversionExtension = fileExt.ToString();
|
||||
}
|
||||
|
||||
object keepOriginal;
|
||||
bool removeOriginal = true;
|
||||
if (body.TryGetValue("keepOriginal", out keepOriginal) && !String.IsNullOrEmpty(keepOriginal.ToString()))
|
||||
{
|
||||
removeOriginal = keepOriginal.ToString().ToLower() != "true";
|
||||
}
|
||||
|
||||
// check if the file with such an extension can be converted
|
||||
if (DocManagerHelper.ConvertExts.Contains("." + extension))
|
||||
if (DocManagerHelper.ConvertExts.Contains("." + extension) || conversionExtension != "ooxml")
|
||||
{
|
||||
// generate document key
|
||||
var key = ServiceConverter.GenerateRevisionId(fileUri);
|
||||
@ -270,7 +280,7 @@ namespace OnlineEditorsExampleMVC
|
||||
|
||||
// get the url and file type of the converted file
|
||||
Dictionary<string, string> newFileData;
|
||||
var result = ServiceConverter.GetConvertedData(downloadUri.ToString(), extension, conversionExtension, key, true, out newFileData, filePass, lang);
|
||||
var result = ServiceConverter.GetConvertedData(downloadUri.ToString(), extension, conversionExtension, key, true, out newFileData, filePass, lang, fileName);
|
||||
if (result != 100)
|
||||
{
|
||||
context.Response.Write("{ \"step\" : \"" + result + "\", \"filename\" : \"" + fileName + "\"}");
|
||||
@ -278,9 +288,14 @@ namespace OnlineEditorsExampleMVC
|
||||
}
|
||||
|
||||
var newFileUri = newFileData["fileUrl"];
|
||||
var newFileType = "." + newFileData["fileType"];
|
||||
var newFileType = newFileData["fileType"];
|
||||
if (!FormatManager.All().Any(f => f.Name == newFileType && f.Type != FileUtility.FileType.Null))
|
||||
{
|
||||
context.Response.Write("{\"step\": \"" + result + "\", \"filename\": \"" + newFileUri + "\", \"error\": \"FileTypeIsNotSupported\"}");
|
||||
return;
|
||||
}
|
||||
// get a file name of an internal file extension with an index if the file with such a name already exists
|
||||
var correctName = DocManagerHelper.GetCorrectName(Path.GetFileNameWithoutExtension(fileName) + newFileType);
|
||||
var correctName = DocManagerHelper.GetCorrectName(Path.GetFileNameWithoutExtension(fileName) + "." + newFileType);
|
||||
|
||||
var req = (HttpWebRequest)WebRequest.Create(newFileUri);
|
||||
|
||||
@ -302,11 +317,14 @@ namespace OnlineEditorsExampleMVC
|
||||
}
|
||||
}
|
||||
|
||||
Remove(fileName); // remove the original file and its history if it exists
|
||||
if (removeOriginal) Remove(fileName); // remove the original file and its history if it exists
|
||||
fileName = correctName; // create meta information about the converted file with user id and name specified
|
||||
var id = context.Request.Cookies.GetOrDefault("uid", null);
|
||||
var user = Users.getUser(id);
|
||||
DocManagerHelper.CreateMeta(fileName, user.id, user.name);
|
||||
|
||||
context.Response.Write("{ \"filename\" : \"" + fileName + "\", \"step\": \"" + result + "\" }");
|
||||
return;
|
||||
}
|
||||
|
||||
var documentType = FileUtility.GetFileType(fileName).ToString().ToLower();
|
||||
@ -687,6 +705,7 @@ namespace OnlineEditorsExampleMVC
|
||||
|
||||
var fileName = (string)body["fileName"];
|
||||
var version = (int)body["version"];
|
||||
var url = body.ContainsKey("url") ? (string)body["url"] : null;
|
||||
|
||||
var key = ServiceConverter.GenerateRevisionId(DocManagerHelper.CurUserHostAddress()
|
||||
+ "/" + fileName + "/"
|
||||
@ -708,9 +727,19 @@ namespace OnlineEditorsExampleMVC
|
||||
{
|
||||
File.Copy(changesPath, Path.Combine(currentVersionDir, "changes.json"));
|
||||
}
|
||||
|
||||
if (url != null)
|
||||
{
|
||||
var req = (HttpWebRequest)WebRequest.Create(url);
|
||||
req.Method = "GET";
|
||||
var stream = req.GetResponse().GetResponseStream();
|
||||
var memoryStream = new MemoryStream();
|
||||
stream.CopyTo(memoryStream);
|
||||
File.WriteAllBytes(DocManagerHelper.StoragePath(fileName, null), memoryStream.ToArray());
|
||||
}
|
||||
else
|
||||
{
|
||||
File.Copy(Path.Combine(verDir, "prev" + ext), DocManagerHelper.StoragePath(fileName, null), true);
|
||||
|
||||
}
|
||||
var fileInfo = new FileInfo(DocManagerHelper.StoragePath(fileName, null));
|
||||
fileInfo.LastWriteTimeUtc = DateTime.UtcNow;
|
||||
|
||||
@ -961,7 +990,7 @@ namespace OnlineEditorsExampleMVC
|
||||
var changes = jss.Deserialize<Dictionary<string, object>>(File.ReadAllText(changesPath));
|
||||
var changesArray = (ArrayList)changes["changes"];
|
||||
var change = changesArray.Count > 0
|
||||
? (Dictionary<string, object>)changesArray[0]
|
||||
? (Dictionary<string, object>)changesArray[changesArray.Count - 1]
|
||||
: new Dictionary<string, object>();
|
||||
|
||||
// write information about changes to the object
|
||||
@ -1000,6 +1029,74 @@ namespace OnlineEditorsExampleMVC
|
||||
}
|
||||
}
|
||||
|
||||
private static void Config(HttpContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
var fileName = context.Request.QueryString.Get("fileName");
|
||||
var directUrl = context.Request.QueryString.Get("directUrl").ToLower() == "true";
|
||||
var permissions = context.Request.QueryString.Get("permissions") != null
|
||||
? context.Request.QueryString.Get("permissions")
|
||||
: "{}";
|
||||
|
||||
if (string.IsNullOrEmpty(fileName) || !File.Exists(DocManagerHelper.StoragePath(fileName)))
|
||||
{
|
||||
context.Response.Write("{ \"error\": \"File is not exist\"}");
|
||||
return;
|
||||
}
|
||||
|
||||
var id = context.Request.Cookies.GetOrDefault("uid", null);
|
||||
var user = Users.getUser(id);
|
||||
|
||||
var jss = new JavaScriptSerializer();
|
||||
|
||||
var config = new Dictionary<string, object>
|
||||
{
|
||||
{
|
||||
"document", new Dictionary<string, object>
|
||||
{
|
||||
{"key", ServiceConverter.GenerateRevisionId(DocManagerHelper.CurUserHostAddress() + "/" + fileName
|
||||
+ "/"+ File.GetLastWriteTime(DocManagerHelper.StoragePath(fileName, null)).GetHashCode())},
|
||||
{"title", fileName},
|
||||
{"url", DocManagerHelper.GetDownloadUrl(fileName)},
|
||||
{"permissions", jss.Deserialize<Dictionary<string, object>>(permissions)},
|
||||
{"directUrl", directUrl ? DocManagerHelper.GetDownloadUrl(fileName, false) : null},
|
||||
{
|
||||
"referenceData", new Dictionary<string, object>
|
||||
{
|
||||
{"fileKey", !user.id.Equals("uid-0") ?
|
||||
jss.Serialize(new Dictionary<string, object>{
|
||||
{"fileName", fileName},
|
||||
{"userAddress", HttpUtility.UrlEncode(DocManagerHelper.CurUserHostAddress(HttpContext.Current.Request.UserHostAddress))}
|
||||
}) : null },
|
||||
{"instanceId", DocManagerHelper.GetServerUrl(false)}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"editorConfig", new Dictionary<string, object>
|
||||
{
|
||||
{"callbackUrl", DocManagerHelper.GetCallback(fileName)},
|
||||
{"mode", "edit"}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (JwtManager.Enabled)
|
||||
{
|
||||
var token = JwtManager.Encode(config);
|
||||
config.Add("token", token);
|
||||
}
|
||||
|
||||
context.Response.Write(jss.Serialize(config));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
context.Response.Write("{ \"error\": \"" + e.Message + "\"}");
|
||||
}
|
||||
}
|
||||
|
||||
// delete a forgotten file from the document server
|
||||
private static void RemoveForgotten(HttpContext context)
|
||||
{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<appSettings>
|
||||
<clear />
|
||||
<add key="version" value="1.12.0"/>
|
||||
<add key="version" value="1.13.0"/>
|
||||
|
||||
<add key="filesize-max" value="52428800"/>
|
||||
<add key="storage-path" value=""/>
|
||||
@ -13,6 +13,7 @@
|
||||
<add key="files.docservice.header" value="Authorization" />
|
||||
|
||||
<add key="files.docservice.token.useforrequest" value="true" />
|
||||
<add key="files.docservice.token.expires-in" value="5"/>
|
||||
|
||||
<add key="files.docservice.verify-peer-off" value="true"/>
|
||||
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
.center {
|
||||
width: auto;
|
||||
}
|
||||
@ -128,7 +146,7 @@ header a {
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 592px) and (min-width: 320px) {
|
||||
@media (max-width: 592px) {
|
||||
.center, .table-main {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,4 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.4285 13C14.4102 13 14 13 14 13.5V15H6C5.44772 15 5 15.4477 5 16V17C5 17.5523 5.44771 18 6 18H14V19.5C14 20 14.3816 20 14.4285 20C14.6359 20 15.0099 19.9113 15.2172 19.7363L18.6207 17.0833C19.1264 16.6566 19.1264 16.3434 18.6207 15.9167L15.2172 13.2637C15.0099 13.0887 14.6359 13 14.4285 13Z" fill="#444444"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.5715 4C9.58984 4 10 4 10 4.50002V6H18C18.5523 6 19 6.44772 19 7V8C19 8.55228 18.5523 9 18 9H10V10.5C10 11 9.61841 11 9.57151 11C9.36409 11 8.99012 10.9113 8.78279 10.7363L5.37934 8.08333C4.87356 7.65662 4.87356 7.34338 5.37934 6.91667L8.78279 4.26366C8.99012 4.08874 9.36409 4 9.5715 4Z" fill="#444444"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 821 B |
|
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 4.2 KiB |
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -42,10 +42,14 @@
|
||||
}
|
||||
|
||||
.tableHeaderCellViewers {
|
||||
width: 29%;
|
||||
width: 18%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.tableHeaderCellAction {
|
||||
width: 23%;
|
||||
}
|
||||
|
||||
.tableHeaderCellDownload {
|
||||
width: 21%;
|
||||
padding-right: 18px;
|
||||
@ -220,7 +224,7 @@
|
||||
}
|
||||
|
||||
.tableHeaderCellFileName {
|
||||
width: 16%;
|
||||
width: 9%;
|
||||
}
|
||||
|
||||
.tableHeaderCellEditors {
|
||||
@ -229,7 +233,12 @@
|
||||
|
||||
.tableHeaderCellViewers {
|
||||
text-align: right;
|
||||
width: 37%;
|
||||
width: 9%;
|
||||
}
|
||||
|
||||
.tableHeaderCellAction{
|
||||
width: 11%;
|
||||
padding-right: 82px;
|
||||
}
|
||||
|
||||
.tableHeaderCellDownload {
|
||||
@ -244,19 +253,24 @@
|
||||
}
|
||||
|
||||
.tableHeaderCellEditors {
|
||||
width: 26%;
|
||||
width: 15%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.tableHeaderCellFileName {
|
||||
width: 17%;
|
||||
width: 28%;
|
||||
}
|
||||
|
||||
.tableHeaderCellViewers {
|
||||
width: 27%;
|
||||
width: 6%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.tableHeaderCellAction{
|
||||
width: 18%;
|
||||
padding-right: 54px;
|
||||
}
|
||||
|
||||
.tableHeaderCellDownload {
|
||||
padding-right: 18px;
|
||||
width: 20%;
|
||||
@ -277,12 +291,17 @@
|
||||
|
||||
.tableRow td:first-child {
|
||||
flex-grow: 0;
|
||||
width: 15%;
|
||||
width: 25%;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.contentCells-icon {
|
||||
width: 3%;
|
||||
}
|
||||
|
||||
.firstContentCellViewers {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 890px) and (min-width: 769px ) {
|
||||
@ -290,7 +309,7 @@
|
||||
width: 20%;
|
||||
}
|
||||
.contentCells-shift {
|
||||
padding-right: 28px;
|
||||
padding-right: 27px;
|
||||
}
|
||||
|
||||
.main-panel {
|
||||
@ -323,11 +342,16 @@
|
||||
|
||||
.tableHeaderCellEditors {
|
||||
text-align: left;
|
||||
width: 31%;
|
||||
width: 1%;
|
||||
}
|
||||
|
||||
.tableHeaderCellViewers {
|
||||
width: 18%;
|
||||
width: 19%;
|
||||
}
|
||||
|
||||
.tableHeaderCellAction {
|
||||
width: 19%;
|
||||
padding-right: 45px;
|
||||
}
|
||||
}
|
||||
|
||||
@ -429,8 +453,8 @@
|
||||
|
||||
.downloadContentCellShift {
|
||||
max-width: 7%;
|
||||
margin-right: -11px;
|
||||
margin-left: auto;
|
||||
margin-right: 24px;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.contentCells-icon {
|
||||
@ -438,13 +462,13 @@
|
||||
}
|
||||
|
||||
.tableRow td:last-child {
|
||||
width: 12%;
|
||||
padding-right: 40px;
|
||||
width: 7%;
|
||||
padding-right: 0px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.contentCells-shift {
|
||||
padding-right: 35px;
|
||||
padding-right: 0px;
|
||||
}
|
||||
|
||||
.downloadContentCellShift:after {
|
||||
@ -530,6 +554,15 @@
|
||||
height: 56px;
|
||||
margin-bottom: 24px !important;
|
||||
}
|
||||
.button.hoar{
|
||||
width: 18%;
|
||||
height: 27px;
|
||||
margin-bottom: 7px !important;
|
||||
}
|
||||
.button.converting{
|
||||
width: 126px;
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 560px) and (min-width: 510px) {
|
||||
@ -538,7 +571,7 @@
|
||||
}
|
||||
|
||||
.downloadContentCellShift {
|
||||
padding-right: 45px;
|
||||
padding-right: 16px;
|
||||
max-width: 4%;
|
||||
}
|
||||
}
|
||||
@ -558,7 +591,7 @@
|
||||
|
||||
.downloadContentCellShift {
|
||||
max-width: 6%;
|
||||
padding-right: 37px;
|
||||
padding-right: 6px;
|
||||
}
|
||||
|
||||
.firstContentCellShift {
|
||||
@ -584,12 +617,12 @@
|
||||
|
||||
.downloadContentCellShift {
|
||||
max-width: 3%;
|
||||
padding-right: 37px;
|
||||
padding-right: 0px;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.firstContentCellShift {
|
||||
margin-left: 1px;
|
||||
margin-left: 2px;
|
||||
flex-basis: 14%;
|
||||
}
|
||||
|
||||
@ -606,7 +639,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 420px) and (min-width: 320px) {
|
||||
@media (max-width: 420px) {
|
||||
.tableRow,
|
||||
menu.links {
|
||||
width: 25%;
|
||||
@ -619,7 +652,7 @@
|
||||
|
||||
.downloadContentCellShift {
|
||||
max-width: 4%;
|
||||
margin-right: -18px;
|
||||
margin-right: 18px;
|
||||
margin-left: -1px;
|
||||
}
|
||||
|
||||
@ -628,7 +661,7 @@
|
||||
}
|
||||
|
||||
.contentCells-icon{
|
||||
width: 10%;
|
||||
width: 12%;
|
||||
}
|
||||
footer table td {
|
||||
margin: 0;
|
||||
@ -682,7 +715,7 @@
|
||||
max-width: 45%;
|
||||
}
|
||||
}
|
||||
@media (max-width: 600px) and (min-width: 320px) {
|
||||
@media (max-width: 600px) {
|
||||
.main-panel{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@ -709,7 +742,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 592px) and (min-width: 320px) {
|
||||
@media (max-width: 592px) {
|
||||
body.menu-open {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -238,6 +238,52 @@ label .checkbox {
|
||||
color: #FF6F3D;
|
||||
}
|
||||
|
||||
.button.converting {
|
||||
margin-top: -20px;
|
||||
padding: 16px 16px;
|
||||
}
|
||||
|
||||
.button.converting.wide {
|
||||
padding: 16px 29px;
|
||||
}
|
||||
|
||||
.button.hoar {
|
||||
background: #EFEFEF;
|
||||
border: 1px solid #EFEFEF;
|
||||
margin-right: 7px;
|
||||
margin-bottom: 7px;
|
||||
width: 13%;
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.button.hoar.disable {
|
||||
opacity: 30%;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.button.hoar:not(.disable):hover {
|
||||
background: #FF6F3D;
|
||||
border: 1px solid #FF6F3D;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.button.hoar.orange {
|
||||
background: #FF6F3D;
|
||||
border: 1px solid #FF6F3D;
|
||||
color: #FFFFFF;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.button.hoar.orange.disable {
|
||||
background: #444444;
|
||||
border: 1px solid #444444;
|
||||
color: #FFFFFF;
|
||||
cursor: default;
|
||||
opacity: 100%;
|
||||
}
|
||||
|
||||
.button.file-type {
|
||||
font-size: 11px;
|
||||
color: #FFFFFF;
|
||||
@ -380,6 +426,32 @@ label .checkbox {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#convertingProgress {
|
||||
color: #333333;
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
margin: 30px 35px;
|
||||
}
|
||||
|
||||
#convertingProgress .convertFileName{
|
||||
background-position: left center;
|
||||
background-repeat: no-repeat;
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
line-height: 160%;
|
||||
overflow: hidden;
|
||||
padding-left: 28px;
|
||||
margin-bottom: 16px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#convertingProgress .describeUpload {
|
||||
line-height: 150%;
|
||||
letter-spacing: -0.02em;
|
||||
padding: 16px 0;
|
||||
}
|
||||
|
||||
.error-message {
|
||||
background: url("images/error.svg") no-repeat scroll 4px 10px;
|
||||
color: #CB0000;
|
||||
@ -401,6 +473,10 @@ label .checkbox {
|
||||
padding-left: 35px;
|
||||
}
|
||||
|
||||
.waiting {
|
||||
opacity: 30%;
|
||||
}
|
||||
|
||||
.current {
|
||||
background-image: url("images/loader16.gif");
|
||||
}
|
||||
@ -413,6 +489,12 @@ label .checkbox {
|
||||
background-image: url("images/notdone.svg");
|
||||
}
|
||||
|
||||
.convertPercent {
|
||||
color: #FF6F3D;
|
||||
font-weight: 700;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.step-descr {
|
||||
display: block;
|
||||
margin-left: 35px;
|
||||
@ -420,6 +502,10 @@ label .checkbox {
|
||||
line-height: 188%;
|
||||
}
|
||||
|
||||
.step-descr.disable {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.progress-descr {
|
||||
letter-spacing: -0.02em;
|
||||
line-height: 150%;
|
||||
@ -525,21 +611,25 @@ footer a:hover {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.convertFileName.word,
|
||||
.stored-edit.word,
|
||||
.uploadFileName.word {
|
||||
background-image: url("images/icon_docx.svg");
|
||||
}
|
||||
|
||||
.convertFileName.cell,
|
||||
.stored-edit.cell,
|
||||
.uploadFileName.cell {
|
||||
background-image: url("images/icon_xlsx.svg");
|
||||
}
|
||||
|
||||
.convertFileName.slide,
|
||||
.stored-edit.slide,
|
||||
.uploadFileName.slide {
|
||||
background-image: url("images/icon_pptx.svg");
|
||||
}
|
||||
|
||||
.convertFileName.pdf,
|
||||
.stored-edit.pdf,
|
||||
.uploadFileName.pdf {
|
||||
background-image: url("images/icon_pdf.svg");
|
||||
@ -596,6 +686,11 @@ footer a:hover {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.convertTable {
|
||||
margin-top: 10px;
|
||||
margin-left: 35px;
|
||||
}
|
||||
|
||||
.tableRow {
|
||||
background: transparent;
|
||||
-moz-transition: all 0.2s ease-in-out;
|
||||
@ -642,6 +737,12 @@ footer a:hover {
|
||||
width: 11%;
|
||||
}
|
||||
|
||||
.tableHeaderCellAction{
|
||||
width: 13%;
|
||||
text-align: right;
|
||||
padding-right: 88px;
|
||||
}
|
||||
|
||||
.tableHeaderCellDownload {
|
||||
width: 13%;
|
||||
text-align: right;
|
||||
@ -666,7 +767,7 @@ footer a:hover {
|
||||
}
|
||||
|
||||
.contentCells-shift {
|
||||
padding-right: 44px;
|
||||
padding-right: 43px;
|
||||
}
|
||||
|
||||
.contentCells-icon {
|
||||
@ -730,7 +831,7 @@ footer a:hover {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.icon-delete {
|
||||
.icon-action {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@ -809,6 +910,13 @@ html {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.typeButtonsRow {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
flex-direction: row;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tableRow td:first-child {
|
||||
display: flex;
|
||||
@ -817,11 +925,11 @@ html {
|
||||
}
|
||||
|
||||
.tableHeaderCellFileName {
|
||||
width: 30%;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.tableHeaderCellEditors {
|
||||
width: 28%;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
.tableHeaderCellViewers {
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
<title>ONLYOFFICE</title>
|
||||
<!--
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -194,8 +194,7 @@
|
||||
<td class="tableHeaderCell tableHeaderCellFileName">Filename</td>
|
||||
<td class="tableHeaderCell tableHeaderCellEditors contentCells-shift">Editors</td>
|
||||
<td class="tableHeaderCell tableHeaderCellViewers">Viewers</td>
|
||||
<td class="tableHeaderCell tableHeaderCellDownload">Download</td>
|
||||
<td class="tableHeaderCell tableHeaderCellRemove">Remove</td>
|
||||
<td class="tableHeaderCell tableHeaderCellAction">Action</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
@ -303,14 +302,22 @@
|
||||
<img src="app_themes/images/embeded.svg" alt="Open in embedded mode" title="Open in embedded mode"/>
|
||||
</a>
|
||||
</td>
|
||||
<td class="contentCells contentCells-icon contentCells-shift downloadContentCellShift">
|
||||
<% if (docType != null ) { %>
|
||||
<td class="contentCells contentCells-icon">
|
||||
<a class="convert-file" data="<%= storedFile.Name %>" data-type="<%= docType %>">
|
||||
<img class="icon-action" src="app_themes/images/convert.svg" alt="Convert" title="Convert" /></a>
|
||||
</td>
|
||||
<% } else { %>
|
||||
<td class="contentCells contentCells-icon downloadContentCellShift"></td>
|
||||
<% } %>
|
||||
<td class="contentCells contentCells-icon downloadContentCellShift">
|
||||
<a href="webeditor.ashx?type=download&fileName=<%= HttpUtility.UrlEncode(storedFile.Name) %>">
|
||||
<img class="icon-download" src="app_themes/images/download.svg" alt="Download" title="Download" />
|
||||
</a>
|
||||
</td>
|
||||
<td class="contentCells contentCells-icon contentCells-shift">
|
||||
<a class="delete-file" data-filename="<%= storedFile.Name %>">
|
||||
<img class="icon-delete" src="app_themes/images/delete.svg" alt="Delete" title="Delete" />
|
||||
<img class="icon-action" src="app_themes/images/delete.svg" alt="Delete" title="Delete" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@ -379,6 +386,32 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="convertingProgress">
|
||||
<div id="convertingSteps">
|
||||
<span id="convertFileName" class="convertFileName"></span>
|
||||
<span id="convertStep1" class="step">1. Select a format file to convert</span>
|
||||
<span class="step-descr">The converting speed depends on file size and additional elements it contains.</span>
|
||||
<table cellspacing="0" cellpadding="0" width="100%" class="convertTable">
|
||||
<tbody>
|
||||
<tr class="typeButtonsRow" id="convTypes"></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br />
|
||||
<span id="convertStep2" class="step">2. File conversion</span>
|
||||
<span class="step-descr disable" id="convert-descr">The file is converted <div class="convertPercent" id="convertPercent">0 %</div></span>
|
||||
<span class="step-error hidden" id="convert-error"></span>
|
||||
<div class="describeUpload">Note the speed of all operations depends on your connection quality and server location.</div>
|
||||
<input type="hidden" name="hiddenFileName" id="hiddenFileName" />
|
||||
</div>
|
||||
<br />
|
||||
<div class="buttonsMobile">
|
||||
<div id="downloadConverted" class="button converting orange disable">DOWNLOAD</div>
|
||||
<div id="beginViewConverted" class="button converting wide gray disable">VIEW</div>
|
||||
<div id="beginEditConverted" class="button converting wide gray disable">EDIT</div>
|
||||
<div id="cancelEdit" class="button converting gray">CANCEL</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<span id="loadScripts" data-docs="<%= UrlPreloadScripts %>"></span>
|
||||
|
||||
<footer>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -447,8 +447,15 @@ namespace OnlineEditorsExample
|
||||
conversionExtension = fileExt.ToString();
|
||||
}
|
||||
|
||||
object keepOriginal;
|
||||
bool removeOriginal = true;
|
||||
if (body.TryGetValue("keepOriginal", out keepOriginal) && !String.IsNullOrEmpty(keepOriginal.ToString()))
|
||||
{
|
||||
removeOriginal = keepOriginal.ToString().ToLower() != "true";
|
||||
}
|
||||
|
||||
// check if the file with such an extension can be converted
|
||||
if (ConvertExts.Contains("." + extension))
|
||||
if (ConvertExts.Contains("." + extension) || conversionExtension != "ooxml")
|
||||
{
|
||||
// generate document key
|
||||
var key = ServiceConverter.GenerateRevisionId(FileUri(_fileName, true));
|
||||
@ -462,16 +469,20 @@ namespace OnlineEditorsExample
|
||||
|
||||
// get the url and file type of the converted file
|
||||
Dictionary<string, string> newFileData;
|
||||
var result = ServiceConverter.GetConvertedData(fileUrl.ToString() , extension, conversionExtension, key, true, out newFileData, filePass, lang);
|
||||
var result = ServiceConverter.GetConvertedData(fileUrl.ToString() , extension, conversionExtension, key, true, out newFileData, filePass, lang, _fileName);
|
||||
if (result != 100)
|
||||
{
|
||||
return "{ \"step\" : \"" + result + "\", \"filename\" : \"" + _fileName + "\"}";
|
||||
}
|
||||
|
||||
var newFileUri = newFileData["fileUrl"];
|
||||
var newFileType = "." + newFileData["fileType"];
|
||||
var newFileType = newFileData["fileType"];
|
||||
if (!FormatManager.All().Any(f => f.Name == newFileType && f.Type != ""))
|
||||
{
|
||||
return "{\"step\": \"" + result + "\", \"filename\": \"" + newFileUri + "\", \"error\": \"FileTypeIsNotSupported\"}";
|
||||
}
|
||||
// get a file name of an internal file extension with an index if the file with such a name already exists
|
||||
var fileName = GetCorrectName(Path.GetFileNameWithoutExtension(_fileName) + newFileType);
|
||||
var fileName = GetCorrectName(Path.GetFileNameWithoutExtension(_fileName) + "." + newFileType);
|
||||
|
||||
var req = (HttpWebRequest)WebRequest.Create(newFileUri);
|
||||
|
||||
@ -493,17 +504,21 @@ namespace OnlineEditorsExample
|
||||
}
|
||||
}
|
||||
|
||||
if (removeOriginal)
|
||||
{
|
||||
// remove the original file and its history if it exists
|
||||
var storagePath = StoragePath(_fileName, null);
|
||||
var histDir = HistoryDir(storagePath);
|
||||
File.Delete(storagePath);
|
||||
if (Directory.Exists(histDir)) Directory.Delete(histDir, true);
|
||||
|
||||
}
|
||||
// create meta information about the converted file with user id and name specified
|
||||
_fileName = fileName;
|
||||
var id = context.Request.Cookies.GetOrDefault("uid", null);
|
||||
var user = Users.getUser(id); // get the user
|
||||
DocEditor.CreateMeta(_fileName, user.id, user.name, null);
|
||||
|
||||
return "{\"step\": \"" + result + "\", \"filename\": \"" + _fileName + "\"}";
|
||||
}
|
||||
|
||||
return "{ \"filename\" : \"" + _fileName + "\"}";
|
||||
@ -547,7 +562,10 @@ namespace OnlineEditorsExample
|
||||
var directoryInfo = new DirectoryInfo(directory); // read the user host directory contents
|
||||
|
||||
// get the list of stored files from the host directory
|
||||
List<FileInfo> storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly).ToList();
|
||||
var storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly).ToList();
|
||||
|
||||
storedFiles.Sort((a, b) => b.LastWriteTimeUtc.CompareTo(a.LastWriteTimeUtc)); // sort files by the modification date
|
||||
|
||||
return storedFiles;
|
||||
}
|
||||
|
||||
|
||||
@ -12,10 +12,10 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<link rel="icon" href="<%= "app_themes/images/" + DocumentType + ".ico" %>" type="image/x-icon" />
|
||||
<title>ONLYOFFICE</title>
|
||||
<title><%= FileName + " - ONLYOFFICE" %></title>
|
||||
<!--
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -80,8 +80,8 @@
|
||||
|
||||
// the document is modified
|
||||
var onDocumentStateChange = function (event) {
|
||||
var title = document.title.replace(/\*$/g, "");
|
||||
document.title = title + (event.data ? "*" : "");
|
||||
var title = document.title.replace(/^\*/g, "");
|
||||
document.title = (event.data ? "*" : "") + title;
|
||||
};
|
||||
|
||||
// the user is trying to switch the document from the viewing into the editing mode
|
||||
@ -124,6 +124,15 @@
|
||||
docEditor.setActionLink(replaceActionLink(location.href, linkParam)); // set the link to the document which contains a bookmark
|
||||
};
|
||||
|
||||
var onRequestClose = function () { // close editor
|
||||
docEditor.destroyEditor();
|
||||
innerAlert("Document editor closed successfully");
|
||||
};
|
||||
|
||||
var onUserActionRequired = function () {
|
||||
console.log("User action required");
|
||||
};
|
||||
|
||||
// the meta information of the document is changed via the meta command
|
||||
var onMetaChange = function (event) {
|
||||
if (event.data.favorite !== undefined) {
|
||||
@ -194,6 +203,18 @@
|
||||
}
|
||||
};
|
||||
|
||||
var onRequestRefreshFile = function(event) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "webeditor.ashx?type=config&fileName=" + encodeURIComponent(config.document.title) +
|
||||
"&directUrl=" + !!config.document.directUrl +
|
||||
"&permissions=" + encodeURIComponent(JSON.stringify(config.document.permissions)));
|
||||
xhr.send();
|
||||
xhr.onload = function () {
|
||||
innerAlert(xhr.responseText);
|
||||
docEditor.refreshFile(JSON.parse(xhr.responseText));
|
||||
};
|
||||
};
|
||||
|
||||
var onRequestOpen = function (event) { // user open external data source
|
||||
innerAlert("onRequestOpen");
|
||||
var windowName = event.data.windowName;
|
||||
@ -233,6 +254,52 @@
|
||||
}
|
||||
};
|
||||
|
||||
var onRequestReferenceSource = function (event) {
|
||||
innerAlert("onRequestReferenceSource");
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "webeditor.ashx?type=files");
|
||||
xhr.setRequestHeader("Content-Type", "application/json");
|
||||
xhr.send();
|
||||
xhr.onload = function () {
|
||||
if (xhr.status === 200) {
|
||||
innerAlert(JSON.parse(xhr.responseText));
|
||||
let fileList = JSON.parse(xhr.responseText);
|
||||
let firstXlsxName;
|
||||
let file;
|
||||
for (file of fileList) {
|
||||
if (file["title"]) {
|
||||
if (getFileExt(file["title"]) === "xlsx")
|
||||
{
|
||||
firstXlsxName = file["title"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (firstXlsxName) {
|
||||
let data = {
|
||||
directUrl : !!config.document.directUrl,
|
||||
path : firstXlsxName
|
||||
};
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "webeditor.ashx?type=reference");
|
||||
xhr.setRequestHeader("Content-Type", "application/json");
|
||||
xhr.send(JSON.stringify(data));
|
||||
xhr.onload = function () {
|
||||
if (xhr.status === 200) {
|
||||
docEditor.setReferenceSource(JSON.parse(xhr.responseText));
|
||||
} else {
|
||||
innerAlert("/reference - bad status");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
innerAlert("No *.xlsx files");
|
||||
}
|
||||
} else {
|
||||
innerAlert("/files - bad status");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var onRequestUsers = function (event) {
|
||||
if (event && event.data){
|
||||
var c = event.data.c;
|
||||
@ -276,6 +343,7 @@
|
||||
config.events = {
|
||||
'onAppReady': onAppReady,
|
||||
'onDocumentStateChange': onDocumentStateChange,
|
||||
'onUserActionRequired': onUserActionRequired,
|
||||
'onError': onError,
|
||||
'onOutdatedVersion': onOutdatedVersion,
|
||||
'onMakeActionLink': onMakeActionLink,
|
||||
@ -286,7 +354,8 @@
|
||||
};
|
||||
|
||||
if (config.editorConfig.user.id) {
|
||||
|
||||
config.events['onRequestRefreshFile'] = onRequestRefreshFile;
|
||||
config.events['onRequestClose'] = onRequestClose;
|
||||
config.events['onRequestHistory'] = function (event) { // the user is trying to show the document version history
|
||||
|
||||
let xhr = new XMLHttpRequest();
|
||||
@ -317,9 +386,11 @@
|
||||
config.events['onRequestRestore'] = function (event) {
|
||||
var fileName = "<%= FileName %>";
|
||||
var version = event.data.version;
|
||||
var url = event.data.url;
|
||||
var data = {
|
||||
fileName: fileName,
|
||||
version: version
|
||||
version: version,
|
||||
url: url
|
||||
};
|
||||
|
||||
let xhr = new XMLHttpRequest();
|
||||
@ -347,12 +418,20 @@
|
||||
// prevent switch the document from the viewing into the editing mode for anonymous users
|
||||
config.events['onRequestEditRights'] = onRequestEditRights;
|
||||
config.events['onRequestOpen'] = onRequestOpen;
|
||||
config.events['onRequestReferenceSource'] = onRequestReferenceSource;
|
||||
}
|
||||
|
||||
var сonnectEditor = function () {
|
||||
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
|
||||
};
|
||||
|
||||
const getFileExt = function (fileName) {
|
||||
if (fileName.indexOf(".")) {
|
||||
return fileName.split('.').reverse()[0];
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
if (window.addEventListener) {
|
||||
window.addEventListener("load", сonnectEditor);
|
||||
} else if (window.attachEvent) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -140,9 +140,8 @@ namespace OnlineEditorsExample
|
||||
|
||||
// get file extension
|
||||
var ext = Path.GetExtension(FileName).ToLower();
|
||||
var canFill = _Default.FillFormsExts.Contains(ext);
|
||||
// get editor mode or set the default one (edit)
|
||||
var editorsMode = Request.GetOrDefault("editorsMode", canFill ? "fillForms" : "edit");
|
||||
var editorsMode = Request.GetOrDefault("editorsMode", "edit");
|
||||
|
||||
var canEdit = _Default.EditedExts.Contains(ext); // check if this file can be edited
|
||||
var editorsType = Request.GetOrDefault("editorsType", "desktop");
|
||||
@ -150,7 +149,7 @@ namespace OnlineEditorsExample
|
||||
var id = Request.Cookies.GetOrDefault("uid", null);
|
||||
var user = Users.getUser(id); // get the user
|
||||
|
||||
if ((!canEdit && editorsMode.Equals("edit") || editorsMode.Equals("fillForms")) && canFill) {
|
||||
if ((!canEdit && editorsMode.Equals("edit") || editorsMode.Equals("fillForms")) && _Default.FillFormsExts.Contains(ext)) {
|
||||
editorsMode = "fillForms";
|
||||
canEdit = true;
|
||||
}
|
||||
@ -288,6 +287,13 @@ namespace OnlineEditorsExample
|
||||
{ "text", user.goback.text },
|
||||
{ "blank", user.goback.blank }
|
||||
} : new Dictionary<string, object>{}
|
||||
},
|
||||
{
|
||||
"close", user.close != null ? new Dictionary<string, object>
|
||||
{
|
||||
{ "visible", user.close.visible },
|
||||
{ "text", user.close.text }
|
||||
} : new Dictionary<string, object>{}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -85,7 +85,8 @@ namespace ASC.Api.DocumentConverter
|
||||
bool isAsync,
|
||||
out Dictionary<string, string> convertedDocumentData,
|
||||
string filePass = null,
|
||||
string lang = null)
|
||||
string lang = null,
|
||||
string filename = null)
|
||||
{
|
||||
convertedDocumentData = new Dictionary<string, string>();
|
||||
|
||||
@ -93,7 +94,7 @@ namespace ASC.Api.DocumentConverter
|
||||
fromExtension = string.IsNullOrEmpty(fromExtension) ? Path.GetExtension(documentUri).ToLower() : fromExtension;
|
||||
|
||||
// check if the file name parameter is defined; if not, get random uuid for this file
|
||||
var title = Path.GetFileName(documentUri);
|
||||
var title = string.IsNullOrEmpty(filename) ? Path.GetFileName(documentUri) : filename;
|
||||
title = string.IsNullOrEmpty(title) ? Guid.NewGuid().ToString() : title;
|
||||
|
||||
// get document key
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
<title>ONLYOFFICE</title>
|
||||
<!--
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -20,6 +20,7 @@ using JWT;
|
||||
using JWT.Algorithms;
|
||||
using JWT.Builder;
|
||||
using JWT.Serializers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Configuration;
|
||||
|
||||
@ -28,6 +29,7 @@ namespace OnlineEditorsExample
|
||||
public static class JwtManager
|
||||
{
|
||||
private static readonly string Secret;
|
||||
private static readonly int ExpiresIn;
|
||||
public static readonly bool Enabled;
|
||||
public static readonly bool SignatureUseForRequest;
|
||||
|
||||
@ -35,12 +37,19 @@ namespace OnlineEditorsExample
|
||||
{
|
||||
Secret = WebConfigurationManager.AppSettings["files.docservice.secret"] ?? ""; // get token secret from the config parameters
|
||||
Enabled = !string.IsNullOrEmpty(Secret); // check if the token is enabled
|
||||
ExpiresIn = int.Parse(WebConfigurationManager.AppSettings["files.docservice.token.expires-in"]);
|
||||
SignatureUseForRequest = bool.Parse(WebConfigurationManager.AppSettings["files.docservice.token.useforrequest"]);
|
||||
}
|
||||
|
||||
// encode a payload object into a token using a secret key
|
||||
public static string Encode(IDictionary<string, object> payload)
|
||||
{
|
||||
var now = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
var expires = now + ExpiresIn * 60;
|
||||
|
||||
payload["iat"] = now;
|
||||
payload["exp"] = expires;
|
||||
|
||||
var encoder = new JwtEncoder(new HMACSHA256Algorithm(),
|
||||
new JsonNetSerializer(),
|
||||
new JwtBase64UrlEncoder());
|
||||
|
||||
@ -7,7 +7,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Ascensio System SIA")]
|
||||
[assembly: AssemblyProduct("OnlineEditorsExample")]
|
||||
[assembly: AssemblyCopyright("Ascensio System SIA 2024")]
|
||||
[assembly: AssemblyCopyright("Ascensio System SIA 2025")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -77,7 +77,8 @@ namespace OnlineEditorsExample
|
||||
"Can't view chat",
|
||||
"Can't protect file",
|
||||
"View file without collaboration",
|
||||
"Can’t submit forms"
|
||||
"Can’t submit forms",
|
||||
"Can’t refresh outdated file"
|
||||
};
|
||||
|
||||
private static List<User> users = new List<User>() {
|
||||
@ -94,7 +95,8 @@ namespace OnlineEditorsExample
|
||||
descr_user_1,
|
||||
true,
|
||||
true,
|
||||
new Goback(null, false)
|
||||
new Goback(null, false),
|
||||
new Close(null, false)
|
||||
),
|
||||
new User(
|
||||
"uid-2",
|
||||
@ -114,7 +116,8 @@ namespace OnlineEditorsExample
|
||||
descr_user_2,
|
||||
false,
|
||||
true,
|
||||
new Goback("Go to Documents",null)
|
||||
new Goback("Go to Documents",null),
|
||||
new Close(null, true)
|
||||
),
|
||||
new User(
|
||||
"uid-3",
|
||||
@ -134,7 +137,8 @@ namespace OnlineEditorsExample
|
||||
descr_user_3,
|
||||
false,
|
||||
false,
|
||||
null
|
||||
null,
|
||||
new Close(null, true)
|
||||
),
|
||||
new User(
|
||||
"uid-0",
|
||||
@ -149,6 +153,7 @@ namespace OnlineEditorsExample
|
||||
descr_user_0,
|
||||
false,
|
||||
false,
|
||||
null,
|
||||
null
|
||||
)
|
||||
};
|
||||
@ -242,8 +247,9 @@ namespace OnlineEditorsExample
|
||||
public List<string> userInfoGroups;
|
||||
public bool avatar;
|
||||
public Goback goback;
|
||||
public Close close;
|
||||
|
||||
public User(string id, string name, string email, string group, List<string> reviewGroups, Dictionary<string, object> commentGroups, List<string> userInfoGroups, bool? favorite, List<string> deniedPermissions, List<string> descriptions, bool templates, bool avatar, Goback goback)
|
||||
public User(string id, string name, string email, string group, List<string> reviewGroups, Dictionary<string, object> commentGroups, List<string> userInfoGroups, bool? favorite, List<string> deniedPermissions, List<string> descriptions, bool templates, bool avatar, Goback goback, Close close)
|
||||
{
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
@ -258,6 +264,7 @@ namespace OnlineEditorsExample
|
||||
this.userInfoGroups = userInfoGroups;
|
||||
this.avatar = avatar;
|
||||
this.goback = goback;
|
||||
this.close = close;
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,4 +281,18 @@ namespace OnlineEditorsExample
|
||||
this.blank = blank;
|
||||
}
|
||||
}
|
||||
|
||||
public class Close
|
||||
{
|
||||
public string text;
|
||||
public bool visible;
|
||||
|
||||
public Close(){}
|
||||
|
||||
public Close(string text, bool visible)
|
||||
{
|
||||
this.text = text;
|
||||
this.visible = visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -93,6 +93,9 @@ namespace OnlineEditorsExample
|
||||
case "formats":
|
||||
Formats(context);
|
||||
break;
|
||||
case "config":
|
||||
Config(context);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -486,6 +489,7 @@ namespace OnlineEditorsExample
|
||||
|
||||
var fileName = (string)body["fileName"];
|
||||
var version = (int)body["version"];
|
||||
var url = body.ContainsKey("url") ? (string)body["url"] : null;
|
||||
|
||||
var lastVersionUri = _Default.FileUri(fileName, true);
|
||||
var key = ServiceConverter.GenerateRevisionId(_Default.CurUserHostAddress(null)
|
||||
@ -509,7 +513,19 @@ namespace OnlineEditorsExample
|
||||
File.Copy(changesPath, Path.Combine(currentVersionDir, "changes.json"));
|
||||
}
|
||||
|
||||
if (url != null)
|
||||
{
|
||||
var req = (HttpWebRequest)WebRequest.Create(url);
|
||||
req.Method = "GET";
|
||||
var stream = req.GetResponse().GetResponseStream();
|
||||
var memoryStream = new MemoryStream();
|
||||
stream.CopyTo(memoryStream);
|
||||
File.WriteAllBytes(_Default.StoragePath(fileName, null), memoryStream.ToArray());
|
||||
}
|
||||
else
|
||||
{
|
||||
File.Copy(Path.Combine(verDir, "prev" + ext), _Default.StoragePath(fileName, null), true);
|
||||
}
|
||||
|
||||
var fileInfo = new FileInfo(_Default.StoragePath(fileName, null));
|
||||
fileInfo.LastWriteTimeUtc = DateTime.UtcNow;
|
||||
@ -762,7 +778,7 @@ namespace OnlineEditorsExample
|
||||
var changes = jss.Deserialize<Dictionary<string, object>>(File.ReadAllText(changesPath));
|
||||
var changesArray = (ArrayList)changes["changes"];
|
||||
var change = changesArray.Count > 0
|
||||
? (Dictionary<string, object>)changesArray[0]
|
||||
? (Dictionary<string, object>)changesArray[changesArray.Count - 1]
|
||||
: new Dictionary<string, object>();
|
||||
|
||||
// write information about changes to the object
|
||||
@ -815,6 +831,83 @@ namespace OnlineEditorsExample
|
||||
}
|
||||
}
|
||||
|
||||
private static void Config(HttpContext context) {
|
||||
try
|
||||
{
|
||||
var fileName = context.Request.QueryString.Get("fileName");
|
||||
var directUrl = context.Request.QueryString.Get("directUrl").ToLower() == "true";
|
||||
var permissions = context.Request.QueryString.Get("permissions") != null
|
||||
? context.Request.QueryString.Get("permissions")
|
||||
: "{}";
|
||||
var userAdress = HttpUtility.UrlEncode(_Default.CurUserHostAddress(HttpContext.Current.Request.UserHostAddress));
|
||||
|
||||
if (string.IsNullOrEmpty(fileName) || !File.Exists(_Default.StoragePath(fileName, userAdress)))
|
||||
{
|
||||
context.Response.Write("{ \"error\": \"File is not exist\"}");
|
||||
return;
|
||||
}
|
||||
|
||||
var id = context.Request.Cookies.GetOrDefault("uid", null);
|
||||
var user = Users.getUser(id);
|
||||
var callbackUrl = new UriBuilder(_Default.GetServerUrl(true));
|
||||
callbackUrl.Path = HttpRuntime.AppDomainAppVirtualPath
|
||||
+ (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/")
|
||||
+ "webeditor.ashx";
|
||||
callbackUrl.Query = "type=track" + "&fileName="
|
||||
+ HttpUtility.UrlEncode(fileName)
|
||||
+ "&userAddress=" + HttpUtility.UrlEncode(_Default.CurUserHostAddress(HttpContext.Current.Request.UserHostAddress));
|
||||
var callback = callbackUrl.ToString();
|
||||
|
||||
var jss = new JavaScriptSerializer();
|
||||
|
||||
var config = new Dictionary<string, object>
|
||||
{
|
||||
{
|
||||
"document", new Dictionary<string, object>
|
||||
{
|
||||
{"key", ServiceConverter.GenerateRevisionId(_Default.CurUserHostAddress(null)
|
||||
+ "/" + Path.GetFileName(_Default.FileUri(fileName, true))
|
||||
+ "/" + File.GetLastWriteTime(_Default.StoragePath(fileName, null)).GetHashCode())},
|
||||
{"title", fileName},
|
||||
{"url", DocEditor.getDownloadUrl(fileName)},
|
||||
{"permissions", JsonConvert.DeserializeObject<Dictionary<string, object>>(permissions)},
|
||||
{"directUrl", directUrl ? DocEditor.getDownloadUrl(fileName, false) : null},
|
||||
{
|
||||
"referenceData", new Dictionary<string, object>
|
||||
{
|
||||
{"fileKey", !user.id.Equals("uid-0") ?
|
||||
jss.Serialize(new Dictionary<string, object>{
|
||||
{"fileName", fileName},
|
||||
{"userAddress", userAdress}
|
||||
}) : null },
|
||||
{"instanceId", _Default.GetServerUrl(false)}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"editorConfig", new Dictionary<string, object>
|
||||
{
|
||||
{"callbackUrl", callback},
|
||||
{"mode", "edit"}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (JwtManager.Enabled)
|
||||
{
|
||||
var token = JwtManager.Encode(config);
|
||||
config.Add("token", token);
|
||||
}
|
||||
|
||||
context.Response.Write(jss.Serialize(config));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
context.Response.Write("{ \"error\": \"" + e.Message + "\"}");
|
||||
}
|
||||
}
|
||||
|
||||
// delete a forgotten file from the document server
|
||||
private static void RemoveForgotten(HttpContext context)
|
||||
{
|
||||
|
||||
@ -1,3 +1,21 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
function deleteFile(event) {
|
||||
let filename = event.currentTarget.getAttribute("data");
|
||||
filename = encodeURIComponent(filename);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -154,6 +154,16 @@ if (typeof jQuery != "undefined") {
|
||||
return;
|
||||
} else {
|
||||
if (response.error.includes("Error conversion output format")) {
|
||||
let format = formatManager.findByExtension(fileName.split(".").pop());
|
||||
if (!format.convert.includes("docx")) {
|
||||
jq(".document").addClass("invisible")
|
||||
}
|
||||
if (!format.convert.includes("xlsx")) {
|
||||
jq(".spreadsheet").addClass("invisible")
|
||||
}
|
||||
if (!format.convert.includes("pptx")) {
|
||||
jq(".presentation").addClass("invisible")
|
||||
}
|
||||
jq("#select-file-type").removeClass("invisible");
|
||||
jq("#step2").removeClass("current");
|
||||
jq("#hiddenFileName").attr("placeholder", filePass);
|
||||
@ -294,6 +304,132 @@ if (typeof jQuery != "undefined") {
|
||||
jq("#embeddedView").attr("src", url);
|
||||
});
|
||||
|
||||
jq(document).on("click", "#beginEditConverted:not(.disable)", function () {
|
||||
var fileId = encodeURIComponent(jq('#hiddenFileName').attr("data"));
|
||||
var url = "doceditor.aspx?fileID=" + fileId;
|
||||
window.open(url, "_blank");
|
||||
jq('#hiddenFileName').val("");
|
||||
jq.unblockUI();
|
||||
document.location.reload();
|
||||
});
|
||||
|
||||
jq(document).on("click", "#beginViewConverted:not(.disable)", function () {
|
||||
var fileId = encodeURIComponent(jq('#hiddenFileName').attr("data"));
|
||||
var url = "doceditor.aspx?editorsMode=view&fileID=" + fileId;
|
||||
window.open(url, "_blank");
|
||||
jq('#hiddenFileName').val("");
|
||||
jq.unblockUI();
|
||||
document.location.reload();
|
||||
});
|
||||
|
||||
jq(document).on("click", "#downloadConverted:not(.disable)", function () {
|
||||
var fileId = jq('#hiddenFileName').attr("data");
|
||||
if (jq("#downloadConverted").attr("data") == "fromConverter") window.location.assign(fileId);
|
||||
else window.open("webeditor.ashx?type=download&fileName=" + encodeURIComponent(fileId), "_blank");
|
||||
});
|
||||
|
||||
jq(document).on("click", ".convert-file", function () {
|
||||
const currentElement = jq(this);
|
||||
var fileName = currentElement.attr("data");
|
||||
var type = currentElement.attr("data-type");
|
||||
|
||||
jq.blockUI({
|
||||
theme: true,
|
||||
title: "Converting file" + "<div class=\"dialog-close\"></div>",
|
||||
message: jq("#convertingProgress"),
|
||||
overlayCSS: { "background-color": "#aaa" },
|
||||
themedCSS: { width: "539px", top: "20%", left: "50%", marginLeft: "-269px" }
|
||||
});
|
||||
|
||||
jq("#convertFileName").text(decodeURIComponent(fileName));
|
||||
jq("#convertFileName").removeClass("word slide cell");
|
||||
jq("#convertFileName").addClass(type);
|
||||
jq("#convTypes").empty();
|
||||
|
||||
let format = formatManager.findByExtension(fileName.split('.').pop());
|
||||
if (format) {
|
||||
format.convert.forEach(ext => {
|
||||
jq("#convTypes").append(jq(`<td name="convertingTypeButton" id="wordTo${ext}" class="button hoar" data="${ext}">${ext}</td>`));
|
||||
});
|
||||
}
|
||||
|
||||
jq("#hiddenFileName").val(fileName);
|
||||
jq("#convertStep1").addClass("done");
|
||||
jq("#convertStep2").addClass("waiting");
|
||||
});
|
||||
|
||||
jq(document).on("click", "td[name='convertingTypeButton']:not(.disable, .orange)", function () {
|
||||
const currentElement = jq(this);
|
||||
let id = currentElement[0].id;
|
||||
let fileExt = jq(`#${id}`).attr("data");
|
||||
jq(`#${id}`).addClass("orange");
|
||||
jq("td[name='convertingTypeButton']").addClass("disable");
|
||||
jq("#convertStep2").removeClass("waiting").removeClass("done").addClass("current");
|
||||
jq("#convertStep2").text('2. File conversion');
|
||||
jq("#convert-descr").removeClass("disable");
|
||||
jq("#convertPercent").text("0 %");
|
||||
jq("#hiddenFileName").attr("placeholder",fileExt);
|
||||
jq("#downloadConverted").addClass("disable");
|
||||
jq("#beginEditConverted").addClass("disable");
|
||||
jq("#beginViewConverted").addClass("disable");
|
||||
mustReload = true;
|
||||
|
||||
convertFile();
|
||||
});
|
||||
|
||||
function convertFile (filePass) {
|
||||
let fileName = decodeURIComponent(jq("#hiddenFileName").val());
|
||||
let fileExt = jq("#hiddenFileName").attr("placeholder");
|
||||
|
||||
filePass = filePass ? filePass : null;
|
||||
if (timer != null) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
timer = setTimeout(function () {
|
||||
jq.ajax({
|
||||
async: true,
|
||||
contentType: "text/xml",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: JSON.stringify({filename: fileName, filePass: filePass, lang: language, fileExt: fileExt, keepOriginal: true}),
|
||||
url: "webeditor.ashx?type=convert",
|
||||
complete: function (data) {
|
||||
try {
|
||||
var response = jq.parseJSON(data.responseText);
|
||||
} catch (e) {
|
||||
response = { error: e };
|
||||
}
|
||||
if (!response.filename && !response.step && response.error) {
|
||||
jq("#convertStep2").removeClass("current").addClass("error");
|
||||
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
|
||||
jq("#convert-error").removeClass("hidden");
|
||||
jq("#convert-error").text(`${response.error}`);
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
return;
|
||||
}
|
||||
if (response.step != undefined && response.step != 100) {
|
||||
jq("#convertPercent").text(`${response.step} %`);
|
||||
convertFile();
|
||||
} else {
|
||||
jq("#convertPercent").text(`${response.step} %`);
|
||||
jq("#convertStep2").removeClass("current").addClass("done");
|
||||
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
|
||||
jq("#downloadConverted").removeClass("disable");
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
if (response.error !== "FileTypeIsNotSupported") {
|
||||
jq("#beginEditConverted").removeClass("disable");
|
||||
jq("#beginViewConverted").removeClass("disable");
|
||||
jq("#downloadConverted").attr("data","fromStorage");
|
||||
} else {
|
||||
jq("#downloadConverted").attr("data","fromConverter");
|
||||
}
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
jq(document).on("click", "#cancelEdit, .dialog-close", function () {
|
||||
jq('#hiddenFileName').val("");
|
||||
jq("#embeddedView").attr("src", "");
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<appSettings>
|
||||
<clear />
|
||||
<add key="version" value="1.12.0"/>
|
||||
<add key="version" value="1.13.0"/>
|
||||
|
||||
<add key="filesize-max" value="52428800"/>
|
||||
<add key="storage-path" value=""/>
|
||||
@ -14,6 +14,7 @@
|
||||
<add key="files.docservice.verify-peer-off" value="true"/>
|
||||
|
||||
<add key="files.docservice.token.useforrequest" value="true" />
|
||||
<add key="files.docservice.token.expires-in" value="5"/>
|
||||
|
||||
<add key="files.docservice.languages" value="en:English|sq-AL:Albanian (Albania)|ar:Arabic|hy:Armenian|az:Azerbaijani|eu:Basque|be:Belarusian|bg:Bulgarian|ca:Catalan|zh:Chinese (Simplified)|zh-TW:Chinese (Traditional)|cs:Czech|da:Danish|nl:Dutch|en-GB:English (United Kingdom)|fi:Finnish|fr:French|gl:Galego|de:German|el:Greek|he-IL:Hebrew (Israel)|hu:Hungarian|id:Indonesian|it:Italian|ja:Japanese|ko:Korean|lo:Lao|lv:Latvian|ms:Malay (Malaysia)|no:Norwegian|pl:Polish|pt:Portuguese (Brazil)|pt-PT:Portuguese (Portugal)|ro:Romanian|ru:Russian|sr-Cyrl-RS:Serbian (Cyrillic)|sr-Latn-RS:Serbian (Latin)|si:Sinhala (Sri Lanka)|sk:Slovak|sl:Slovenian|es:Spanish|sv:Swedish|tr:Turkish|uk:Ukrainian|vi:Vietnamese|aa-AA: Test Language"/>
|
||||
|
||||
|
||||
14
web/documentserver-example/go/.editorconfig
Normal file
@ -0,0 +1,14 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.go]
|
||||
indent_style = tab
|
||||
|
||||
[*.{js, ts, json, html}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
2
web/documentserver-example/go/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
filestore
|
||||
assets/*
|
||||
47
web/documentserver-example/go/.golangci.yml
Normal file
@ -0,0 +1,47 @@
|
||||
linters:
|
||||
enable-all: true
|
||||
disable:
|
||||
- cyclop
|
||||
- depguard
|
||||
- dogsled
|
||||
- durationcheck
|
||||
- err113
|
||||
- errchkjson
|
||||
- execinquery
|
||||
- exhaustruct
|
||||
- exportloopref
|
||||
- funlen
|
||||
- gochecknoglobals
|
||||
- gocognit
|
||||
- goconst
|
||||
- godox
|
||||
- gofumpt
|
||||
- gomnd
|
||||
- gosec
|
||||
- interfacebloat
|
||||
- ireturn
|
||||
- mirror
|
||||
- mnd
|
||||
- musttag
|
||||
- nestif
|
||||
- nlreturn
|
||||
- noctx
|
||||
- nolintlint
|
||||
- nonamedreturns
|
||||
- perfsprint
|
||||
- prealloc
|
||||
- revive
|
||||
- varnamelen
|
||||
- wrapcheck
|
||||
- wsl
|
||||
|
||||
linters-settings:
|
||||
errcheck:
|
||||
exclude-functions:
|
||||
- (net/http.ResponseWriter).Write
|
||||
lll:
|
||||
line-length: 120
|
||||
gofmt:
|
||||
simplify: false
|
||||
stylecheck:
|
||||
checks: ["all", "-ST1016", "-ST1003"]
|
||||
29
web/documentserver-example/go/3rd-Party.license
Normal file
@ -0,0 +1,29 @@
|
||||
ONLYOFFICE Applications example uses code from the following 3rd party projects:
|
||||
|
||||
fx - An application framework for Go that makes dependency injection easy. (https://github.com/uber-go/fx).
|
||||
License: MIT
|
||||
License File: fx.license
|
||||
|
||||
golang-jwt - A go implementation of JSON Web Tokens. (https://github.com/golang-jwt/jwt).
|
||||
License: MIT
|
||||
License File: golang-jwt.license
|
||||
|
||||
gorilla/mux - Package gorilla/mux implements a request router and dispatcher for matching incoming requests to their respective handler. (https://github.com/gorilla/mux).
|
||||
License: BSD-3-Clause License
|
||||
License File: mux.license
|
||||
|
||||
mapstructure - Go library for decoding generic map values into native Go structures and vice versa. (https://github.com/mitchellh/mapstructure)
|
||||
License: MIT
|
||||
License File: mapstructure.license
|
||||
|
||||
schema - Package gorilla/schema fills a struct with form values. (https://github.com/gorilla/schema)
|
||||
License: BSD-3-Clause License
|
||||
License File: schema.license
|
||||
|
||||
viper - Viper is a complete configuration solution for Go applications including 12-Factor apps. It is designed to work within an application, and can handle all types of configuration needs and formats. (https://github.com/spf13/viper).
|
||||
License: MIT
|
||||
License File: viper.license
|
||||
|
||||
zap - Blazing fast, structured, leveled logging in Go. (https://github.com/uber-go/zap).
|
||||
License: MIT
|
||||
License File: zap.license
|
||||
201
web/documentserver-example/go/LICENSE
Normal file
@ -0,0 +1,201 @@
|
||||
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 [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
||||
81
web/documentserver-example/go/README.md
Normal file
@ -0,0 +1,81 @@
|
||||
## Overview
|
||||
|
||||
This example will help you integrate ONLYOFFICE Docs into your web application written in Go.
|
||||
|
||||
It is aimed at testing the editors. Please, do not use it for production without proper modifications.
|
||||
## Installation
|
||||
|
||||
### Step 1. Install ONLYOFFICE Docs
|
||||
|
||||
Download and install ONLYOFFICE Docs (packaged as Document Server).
|
||||
|
||||
See the detailed guide to learn how to install Document Server [for Windows](https://helpcenter.onlyoffice.com/installation/docs-developer-install-windows.aspx).
|
||||
|
||||
### Step 2. Download the Go code for the editors integration
|
||||
|
||||
Download the [Go example](https://api.onlyoffice.com/editors/demopreview) from our site.
|
||||
|
||||
To connect the editors to your website, specify the path to the editors installation, server protocol, address and port in the *configuration.env* file:
|
||||
|
||||
```
|
||||
SERVER_ADDRESS=http(s)://address (optional)
|
||||
SERVER_PORT=port
|
||||
|
||||
DOC_SERVER_HOST=http://documentserver/
|
||||
|
||||
JWT_IS_ENABLED=flag
|
||||
JWT_SECRET=secret
|
||||
JWT_HEADER=Authorization
|
||||
```
|
||||
|
||||
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed.
|
||||
**address** is the address of the server, **port** is the server port.
|
||||
|
||||
If you want to experiment with the editor configuration, modify the [parameters](https://api.onlyoffice.com/editors/advanced) it the *templates/editor.html* file.
|
||||
|
||||
### Step 3. Install the prerequisites
|
||||
To run the Go example code, install the Go compiler:
|
||||
|
||||
* Go (download from [The Go lang website](https://golang.org/);
|
||||
|
||||
### Step 4. Set environment variables
|
||||
|
||||
Having installed the compiler, update golang env variables:
|
||||
|
||||
```
|
||||
export GOPATH=$HOME/go
|
||||
export PATH=$PATH:$GOPATH/bin
|
||||
export PATH=$PATH:/usr/local/go/bin
|
||||
```
|
||||
|
||||
### Step 5. Configure JWT
|
||||
|
||||
Open the *config/configuration.json* file and enable JWT:
|
||||
|
||||
```
|
||||
{
|
||||
"JWT_IS_ENABLED" : true,
|
||||
}
|
||||
```
|
||||
|
||||
Also, [specify the same secret key](https://helpcenter.onlyoffice.com/installation/docs-configure-jwt.aspx) as used in your Document Server:
|
||||
|
||||
```
|
||||
{
|
||||
"JWT_SECRET" : "secret",
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Step 6. Start the application
|
||||
|
||||
1. Go to the project root.
|
||||
2. Run:
|
||||
```
|
||||
go run main.go
|
||||
```
|
||||
3. In your browser go to **server.address** and **server.port**:
|
||||
|
||||
### 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.
|
||||
73
web/documentserver-example/go/config/configuration.json
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
"VERSION": "1.13.0",
|
||||
|
||||
"SERVER_ADDRESS" : "",
|
||||
"SERVER_PORT" : 3000,
|
||||
|
||||
"DOC_SERVER_HOST" : "http://documentserver/",
|
||||
"DOC_SERVER_CONVERTER_URL" : "converter",
|
||||
"DOC_SERVER_API_URL" : "web-apps/apps/api/documents/api.js",
|
||||
"DOC_SERVER_PRELOADER_URL" : "web-apps/apps/api/documents/cache-scripts.html",
|
||||
"DOC_SERVER_COMMAND_URL" : "command",
|
||||
|
||||
"JWT_IS_ENABLED" : false,
|
||||
"JWT_EXPIRES_IN" : 5,
|
||||
"JWT_SECRET" : "secret",
|
||||
"JWT_HEADER" : "Authorization",
|
||||
|
||||
"STORAGE_PATH" : "filestore",
|
||||
|
||||
"LOGGER_DEBUG" : true,
|
||||
"FORGOTTEN_ENABLED": true,
|
||||
|
||||
"PLUGINS" : "{\"pluginsData\":[]}",
|
||||
|
||||
"LANGUAGES": {
|
||||
"en": "English",
|
||||
"sq-AL": "Albanian (Albania)",
|
||||
"ar": "Arabic",
|
||||
"hy": "Armenian",
|
||||
"az": "Azerbaijani",
|
||||
"eu": "Basque",
|
||||
"be": "Belarusian",
|
||||
"bg": "Bulgarian",
|
||||
"ca": "Catalan",
|
||||
"zh": "Chinese (Simplified)",
|
||||
"zh-TW": "Chinese (Traditional)",
|
||||
"cs": "Czech",
|
||||
"da": "Danish",
|
||||
"nl": "Dutch",
|
||||
"en-GB": "English (United Kingdom)",
|
||||
"fi": "Finnish",
|
||||
"fr": "French",
|
||||
"gl": "Galego",
|
||||
"de": "German",
|
||||
"el": "Greek",
|
||||
"he-IL": "Hebrew (Israel)",
|
||||
"hu": "Hungarian",
|
||||
"id": "Indonesian",
|
||||
"it": "Italian",
|
||||
"ja": "Japanese",
|
||||
"ko": "Korean",
|
||||
"lo": "Lao",
|
||||
"lv": "Latvian",
|
||||
"ms": "Malay (Malaysia)",
|
||||
"no": "Norwegian",
|
||||
"pl": "Polish",
|
||||
"pt": "Portuguese (Brazil)",
|
||||
"pt-PT": "Portuguese (Portugal)",
|
||||
"ro": "Romanian",
|
||||
"ru": "Russian",
|
||||
"sr-Cyrl-RS": "Serbian (Cyrillic)",
|
||||
"sr-Latn-RS": "Serbian (Latin)",
|
||||
"si": "Sinhala (Sri Lanka)",
|
||||
"sk": "Slovak",
|
||||
"sl": "Slovenian",
|
||||
"es": "Spanish",
|
||||
"sv": "Swedish",
|
||||
"tr": "Turkish",
|
||||
"uk": "Ukrainian",
|
||||
"vi": "Vietnamese",
|
||||
"aa-AA": "Test Language"
|
||||
}
|
||||
}
|
||||
32
web/documentserver-example/go/config/models.go
Normal file
@ -0,0 +1,32 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
package config
|
||||
|
||||
type Extensions struct {
|
||||
Viewed []string `json:"viewed"`
|
||||
Edited []string `json:"edited"`
|
||||
Converted []string `json:"converted"`
|
||||
Filled []string `json:"filled"`
|
||||
}
|
||||
|
||||
type ExtensionTypes struct {
|
||||
Spreadsheet []string `json:"spreadsheet"`
|
||||
Presentation []string `json:"presentation"`
|
||||
Document []string `json:"document"`
|
||||
Pdf []string `json:"pdf"`
|
||||
}
|
||||
107
web/documentserver-example/go/config/module.go
Normal file
@ -0,0 +1,107 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
package config
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/ONLYOFFICE/document-server-integration/utils"
|
||||
"github.com/spf13/viper"
|
||||
"go.uber.org/fx"
|
||||
)
|
||||
|
||||
type ApplicationConfig struct {
|
||||
Version string `mapstructure:"VERSION"`
|
||||
ServerAddress string `mapstructure:"SERVER_ADDRESS"`
|
||||
ServerPort string `mapstructure:"SERVER_PORT"`
|
||||
DocumentServerHost string `mapstructure:"DOC_SERVER_HOST"`
|
||||
DocumentServerConverter string `mapstructure:"DOC_SERVER_CONVERTER_URL"`
|
||||
DocumentServerApi string `mapstructure:"DOC_SERVER_API_URL"`
|
||||
DocumentServerPreloader string `mapstructure:"DOC_SERVER_PRELOADER_URL"`
|
||||
DocumentServerCommandUrl string `mapstructure:"DOC_SERVER_COMMAND_URL"`
|
||||
JwtEnabled bool `mapstructure:"JWT_IS_ENABLED"`
|
||||
JwtExpiresIn time.Duration `mapstructure:"JWT_EXPIRES_IN"`
|
||||
JwtHeader string `mapstructure:"JWT_HEADER"`
|
||||
JwtSecret string `mapstructure:"JWT_SECRET"`
|
||||
StoragePath string `mapstructure:"STORAGE_PATH"`
|
||||
Plugins string `mapstructure:"PLUGINS"`
|
||||
LoggerDebug bool `mapstructure:"LOGGER_DEBUG"`
|
||||
ForgottenEnabled bool `mapstructure:"FORGOTTEN_ENABLED"`
|
||||
Languages map[string]string `mapstructure:"LANGUAGES"`
|
||||
}
|
||||
|
||||
type SpecificationConfig struct {
|
||||
Extensions Extensions `mapstructure:"extensions"`
|
||||
ExtensionTypes ExtensionTypes `mapstructure:"extension_types"`
|
||||
}
|
||||
|
||||
func NewConfiguration() (app_config ApplicationConfig, err error) {
|
||||
_, b, _, _ := runtime.Caller(0)
|
||||
basepath := filepath.Dir(b)
|
||||
|
||||
viper.AddConfigPath(basepath)
|
||||
viper.SetConfigName("configuration")
|
||||
viper.SetConfigType("json")
|
||||
|
||||
viper.AutomaticEnv()
|
||||
err = viper.ReadInConfig()
|
||||
|
||||
if err != nil {
|
||||
return ApplicationConfig{}, err
|
||||
}
|
||||
|
||||
err = viper.Unmarshal(&app_config)
|
||||
|
||||
if err != nil {
|
||||
return ApplicationConfig{}, err
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func NewSpecification() (specification SpecificationConfig, err error) {
|
||||
fm, err := utils.NewFormatManager()
|
||||
if err != nil {
|
||||
return SpecificationConfig{}, err
|
||||
}
|
||||
|
||||
exts := Extensions{
|
||||
fm.GetViewedExtensions(),
|
||||
fm.GetEditedExtensions(),
|
||||
fm.GetConvertedExtensions(),
|
||||
fm.GetFilledExtensions(),
|
||||
}
|
||||
extTypes := ExtensionTypes{
|
||||
fm.GetSpreadsheetExtensions(),
|
||||
fm.GetPresentationExtensions(),
|
||||
fm.GetDocumentExtensions(),
|
||||
fm.GetPdfExtensions(),
|
||||
}
|
||||
specification = SpecificationConfig{
|
||||
exts,
|
||||
extTypes,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var ConfigurationModule = fx.Options(
|
||||
fx.Provide(NewConfiguration),
|
||||
fx.Provide(NewSpecification),
|
||||
)
|
||||
34
web/documentserver-example/go/go.mod
Normal file
@ -0,0 +1,34 @@
|
||||
module github.com/ONLYOFFICE/document-server-integration
|
||||
|
||||
go 1.21
|
||||
|
||||
require (
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible
|
||||
github.com/gorilla/mux v1.8.1
|
||||
github.com/gorilla/schema v1.4.1
|
||||
github.com/mitchellh/mapstructure v1.5.0
|
||||
github.com/spf13/viper v1.19.0
|
||||
go.uber.org/fx v1.22.2
|
||||
go.uber.org/zap v1.27.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
||||
github.com/sagikazarmark/locafero v0.4.0 // indirect
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
github.com/spf13/afero v1.11.0 // indirect
|
||||
github.com/spf13/cast v1.6.0 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
go.uber.org/dig v1.18.0 // indirect
|
||||
go.uber.org/multierr v1.10.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
|
||||
golang.org/x/sys v0.18.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
82
web/documentserver-example/go/go.sum
Normal file
@ -0,0 +1,82 @@
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
|
||||
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
|
||||
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
|
||||
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
|
||||
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
|
||||
github.com/gorilla/schema v1.4.1 h1:jUg5hUjCSDZpNGLuXQOgIWGdlgrIdYvgQ0wZtdK1M3E=
|
||||
github.com/gorilla/schema v1.4.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
|
||||
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
|
||||
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
|
||||
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
|
||||
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
|
||||
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
|
||||
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
|
||||
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
|
||||
github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
|
||||
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
|
||||
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
|
||||
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
|
||||
go.uber.org/dig v1.18.0 h1:imUL1UiY0Mg4bqbFfsRQO5G4CGRBec/ZujWTvSVp3pw=
|
||||
go.uber.org/dig v1.18.0/go.mod h1:Us0rSJiThwCv2GteUN0Q7OKvU7n5J4dxZ9JKUXozFdE=
|
||||
go.uber.org/fx v1.22.2 h1:iPW+OPxv0G8w75OemJ1RAnTUrF55zOJlXlo1TbJ0Buw=
|
||||
go.uber.org/fx v1.22.2/go.mod h1:o/D9n+2mLP6v1EG+qsdT1O8wKopYAsqZasju97SDFCU=
|
||||
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
|
||||
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
|
||||
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
|
||||
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
|
||||
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
|
||||
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
|
||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
|
||||
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
29
web/documentserver-example/go/licenses/3rd-Party.license
Normal file
@ -0,0 +1,29 @@
|
||||
ONLYOFFICE Applications example uses code from the following 3rd party projects:
|
||||
|
||||
fx - An application framework for Go that makes dependency injection easy. (https://github.com/uber-go/fx).
|
||||
License: MIT
|
||||
License File: fx.license
|
||||
|
||||
golang-jwt - A go implementation of JSON Web Tokens. (https://github.com/golang-jwt/jwt).
|
||||
License: MIT
|
||||
License File: golang-jwt.license
|
||||
|
||||
gorilla/mux - Package gorilla/mux implements a request router and dispatcher for matching incoming requests to their respective handler. (https://github.com/gorilla/mux).
|
||||
License: BSD-3-Clause License
|
||||
License File: mux.license
|
||||
|
||||
mapstructure - Go library for decoding generic map values into native Go structures and vice versa. (https://github.com/mitchellh/mapstructure)
|
||||
License: MIT
|
||||
License File: mapstructure.license
|
||||
|
||||
schema - Package gorilla/schema fills a struct with form values. (https://github.com/gorilla/schema)
|
||||
License: BSD-3-Clause License
|
||||
License File: schema.license
|
||||
|
||||
viper - Viper is a complete configuration solution for Go applications including 12-Factor apps. It is designed to work within an application, and can handle all types of configuration needs and formats. (https://github.com/spf13/viper).
|
||||
License: MIT
|
||||
License File: viper.license
|
||||
|
||||
zap - Blazing fast, structured, leveled logging in Go. (https://github.com/uber-go/zap).
|
||||
License: MIT
|
||||
License File: zap.license
|
||||
19
web/documentserver-example/go/licenses/fx.license
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2016-2018 Uber Technologies, 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.
|
||||
@ -0,0 +1,9 @@
|
||||
Copyright (c) 2012 Dave Grijalva
|
||||
Copyright (c) 2021 golang-jwt maintainers
|
||||
|
||||
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.
|
||||
|
||||
21
web/documentserver-example/go/licenses/mapstructure.license
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Mitchell Hashimoto
|
||||
|
||||
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.
|
||||
27
web/documentserver-example/go/licenses/mux.license
Normal file
@ -0,0 +1,27 @@
|
||||
Copyright (c) 2012-2018 The Gorilla Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
27
web/documentserver-example/go/licenses/schema.license
Normal file
@ -0,0 +1,27 @@
|
||||
Copyright (c) 2023 The Gorilla Authors. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
21
web/documentserver-example/go/licenses/viper.license
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Steve Francia
|
||||
|
||||
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.
|
||||
19
web/documentserver-example/go/licenses/zap.license
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2016-2017 Uber Technologies, 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.
|
||||
47
web/documentserver-example/go/main.go
Normal file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/ONLYOFFICE/document-server-integration/config"
|
||||
"github.com/ONLYOFFICE/document-server-integration/server"
|
||||
"github.com/ONLYOFFICE/document-server-integration/server/api"
|
||||
defaultApi "github.com/ONLYOFFICE/document-server-integration/server/api/default"
|
||||
bootstrapper "github.com/ONLYOFFICE/document-server-integration/server/config"
|
||||
"github.com/ONLYOFFICE/document-server-integration/server/handlers"
|
||||
dhandlers "github.com/ONLYOFFICE/document-server-integration/server/handlers/default"
|
||||
"github.com/ONLYOFFICE/document-server-integration/server/log"
|
||||
"github.com/ONLYOFFICE/document-server-integration/server/managers"
|
||||
dmanagers "github.com/ONLYOFFICE/document-server-integration/server/managers/default"
|
||||
"go.uber.org/fx"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fx.New(
|
||||
fx.Provide(api.New),
|
||||
fx.Provide(managers.New),
|
||||
fx.Provide(handlers.New),
|
||||
fx.Provide(server.New),
|
||||
fx.Invoke(bootstrapper.Initialize),
|
||||
config.ConfigurationModule,
|
||||
log.LoggingModule,
|
||||
dhandlers.DefaultHandlersModule,
|
||||
dmanagers.DefaultManagersModule,
|
||||
defaultApi.DefaultServerEndpointsHandlerModule,
|
||||
).Run()
|
||||
}
|
||||