Compare commits
20 Commits
v9.0.4.47
...
v99.99.99.
| Author | SHA1 | Date | |
|---|---|---|---|
| ed0a70f071 | |||
| dadba2a81f | |||
| fe56ec24b5 | |||
| 6a11ac4ced | |||
| 5169b1dc97 | |||
| dabb51bf8a | |||
| f15f48eba5 | |||
| 12753dee19 | |||
| 598e914452 | |||
| 099a53b24b | |||
| d01263917c | |||
| 0f3c40e0b1 | |||
| bf2f32b7cb | |||
| 534eedfae1 | |||
| 77775754b6 | |||
| bfebc197af | |||
| a3d7b159da | |||
| f12cb242ea | |||
| 8a5f37da3f | |||
| 5c9fe8f8f5 |
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@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
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@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
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@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
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@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
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@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
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@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
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@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
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@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Java.Spring.Example
|
||||
path: ${{ github.workspace }}/web/documentserver-example/java-spring/deploy
|
||||
27
.github/workflows/create-tag.yml
vendored
@ -1,27 +0,0 @@
|
||||
name: Create Tag
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
paths-ignore:
|
||||
- '.github/**'
|
||||
- '**/AUTHORS.md'
|
||||
- '**/LICENSE'
|
||||
- '**/README.md'
|
||||
|
||||
jobs:
|
||||
create-tag:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Get Info
|
||||
run: |
|
||||
echo "version=$(grep -Eo '[0-9]+(\.[0-9]+)+' CHANGELOG.md | head -n 1)" >> $GITHUB_OUTPUT
|
||||
id: info
|
||||
- name: Create Tag
|
||||
run: |
|
||||
git config user.name "$GITHUB_ACTOR"
|
||||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
||||
git tag -a 'v${{ steps.info.outputs.version }}' -m 'Release/v${{ steps.info.outputs.version }}'
|
||||
git push origin 'v${{ steps.info.outputs.version }}'
|
||||
3
.github/workflows/release.yml
vendored
@ -2,8 +2,7 @@ name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
branches: [master]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
8
.gitmodules
vendored
@ -5,6 +5,7 @@
|
||||
[submodule "web/documentserver-example/nodejs/public/assets/document-formats"]
|
||||
path = web/documentserver-example/nodejs/public/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
branch = feature/diagram
|
||||
[submodule "web/documentserver-example/csharp-mvc/assets/document-templates"]
|
||||
path = web/documentserver-example/csharp-mvc/assets/document-templates
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
@ -12,6 +13,7 @@
|
||||
[submodule "web/documentserver-example/csharp-mvc/assets/document-formats"]
|
||||
path = web/documentserver-example/csharp-mvc/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
branch = feature/diagram
|
||||
[submodule "web/documentserver-example/php/assets/document-templates"]
|
||||
path = web/documentserver-example/php/assets/document-templates
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
@ -19,6 +21,7 @@
|
||||
[submodule "web/documentserver-example/php/assets/document-formats"]
|
||||
path = web/documentserver-example/php/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
branch = feature/diagram
|
||||
[submodule "web/documentserver-example/python/assets/document-templates"]
|
||||
path = web/documentserver-example/python/assets/document-templates
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
@ -42,15 +45,19 @@
|
||||
[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
|
||||
branch = feature/diagram
|
||||
[submodule "web/documentserver-example/python/assets/document-formats"]
|
||||
path = web/documentserver-example/python/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
branch = feature/diagram
|
||||
[submodule "web/documentserver-example/ruby/assets/document-formats"]
|
||||
path = web/documentserver-example/ruby/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
branch = feature/diagram
|
||||
[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 = feature/diagram
|
||||
[submodule "web/documentserver-example/csharp/assets/document-templates"]
|
||||
path = web/documentserver-example/csharp/assets/document-templates
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
@ -58,6 +65,7 @@
|
||||
[submodule "web/documentserver-example/csharp/assets/document-formats"]
|
||||
path = web/documentserver-example/csharp/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
branch = feature/diagram
|
||||
[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
|
||||
|
||||
@ -361,41 +361,6 @@ 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)
|
||||
|
||||
14
CHANGELOG.md
@ -1,21 +1,10 @@
|
||||
# Change Log
|
||||
|
||||
## 1.14.0
|
||||
- nodejs: set users by parts
|
||||
- nodejs: preload frame moved from uploading popap
|
||||
- nodejs: view odg, md
|
||||
- nodejs: edit xlsb
|
||||
- nodejs: support vsdx in diagram editor
|
||||
- nodejs: fix wopi verification
|
||||
- nodejs: user role
|
||||
- nodejs: start filling
|
||||
- ur skin language
|
||||
- change preload.html address
|
||||
- support vsdx in diagram editor
|
||||
|
||||
## 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
|
||||
@ -31,7 +20,6 @@
|
||||
- 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
|
||||
|
||||
@ -5,7 +5,7 @@ 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#), Go, Java, Java Spring, Node.js, PHP, PHP (Laravel), Python and Ruby.
|
||||
The package contains examples written in .Net (C# MVC), .Net (C#), Java, Java Spring, Node.js, PHP, 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`
|
||||
@ -15,7 +15,6 @@ You should change `http://documentserver` to your server address in these files:
|
||||
* [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`
|
||||
|
||||
|
||||
BIN
web/documentserver-example/csharp-mvc/Content/images/diagram.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,6 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13.5 3.707V15a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V1A.5.5 0 0 1 3 .5h7.293z" fill="#fff" stroke="#BBB"/>
|
||||
<path d="M9.5 1v2.7c0 .28 0 .42.055.527a.5.5 0 0 0 .218.218c.107.055.247.055.527.055H13" stroke="#BBB"/>
|
||||
<path d="M5 8h6v1H5zm0 1h1v1H5zm5 0h1v1h-1zM7 6h2v2H7z" fill="#5951BB"/>
|
||||
<path stroke="#5951BB" d="M4.5 10.5h2v2h-2zm5 0h2v2h-2z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 469 B |
@ -631,6 +631,11 @@ footer table tr td:first-child {
|
||||
background-image: url("images/icon_pdf.svg");
|
||||
}
|
||||
|
||||
.stored-edit.diagram,
|
||||
.uploadFileName.diagram {
|
||||
background-image: url("images/icon_vsdx.svg");
|
||||
}
|
||||
|
||||
.stored-edit span {
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
|
||||
@ -217,9 +217,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
var directoryInfo = new DirectoryInfo(directory);
|
||||
|
||||
// take files from the root directory
|
||||
List<FileInfo> storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly)
|
||||
.OrderByDescending(f => f.LastWriteTimeUtc)
|
||||
.ToList();
|
||||
List<FileInfo> storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly).ToList();
|
||||
|
||||
return storedFiles;
|
||||
}
|
||||
|
||||
@ -83,8 +83,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
bool isAsync,
|
||||
out Dictionary<string, string> convertedDocumentData,
|
||||
string filePass = null,
|
||||
string lang = null,
|
||||
string fileName = null)
|
||||
string lang = null)
|
||||
{
|
||||
convertedDocumentData = new Dictionary<string, string>();
|
||||
|
||||
@ -92,7 +91,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 = string.IsNullOrEmpty(fileName) ? Path.GetFileName(documentUri) : fileName;
|
||||
var title = Path.GetFileName(documentUri);
|
||||
title = string.IsNullOrEmpty(title) ? Guid.NewGuid().ToString() : title;
|
||||
|
||||
// get document key
|
||||
|
||||
@ -20,7 +20,6 @@ using JWT;
|
||||
using JWT.Algorithms;
|
||||
using JWT.Builder;
|
||||
using JWT.Serializers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Configuration;
|
||||
|
||||
@ -31,25 +30,17 @@ 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());
|
||||
|
||||
@ -35,7 +35,8 @@ namespace OnlineEditorsExampleMVC.Models
|
||||
Word,
|
||||
Cell,
|
||||
Slide,
|
||||
Pdf
|
||||
Pdf,
|
||||
Diagram
|
||||
}
|
||||
|
||||
// get file type
|
||||
@ -47,6 +48,7 @@ namespace OnlineEditorsExampleMVC.Models
|
||||
if (FormatManager.DocumentExtensions().Contains(ext)) return FileType.Word; // word type for document extensions
|
||||
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
|
||||
if (FormatManager.DiagramExtensions().Contains(ext)) return FileType.Diagram; // diagram type for diagram extensions
|
||||
|
||||
return FileType.Null; // the default type is word
|
||||
}
|
||||
@ -202,6 +204,20 @@ namespace OnlineEditorsExampleMVC.Models
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public static List<string> DiagramExtensions()
|
||||
{
|
||||
return Diagrams()
|
||||
.Select(format => format.Extension())
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public static List<Format> Diagrams()
|
||||
{
|
||||
return All()
|
||||
.Where(format => format.Type == FileType.Diagram)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public static List<string> AllExtensions()
|
||||
{
|
||||
return All()
|
||||
|
||||
@ -415,12 +415,14 @@ if (typeof jQuery != "undefined") {
|
||||
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("#hiddenFileName").attr("data",response.filename);
|
||||
jq("#beginEditConverted").removeClass("disable");
|
||||
jq("#beginViewConverted").removeClass("disable");
|
||||
jq("#downloadConverted").attr("data","fromStorage");
|
||||
} else {
|
||||
let newFilename = fileName.split('.').slice(0,-1).join('.')
|
||||
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
|
||||
jq("#downloadConverted").attr("data","fromConverter");
|
||||
}
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
|
||||
@ -280,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, fileName);
|
||||
var result = ServiceConverter.GetConvertedData(downloadUri.ToString(), extension, conversionExtension, key, true, out newFileData, filePass, lang);
|
||||
if (result != 100)
|
||||
{
|
||||
context.Response.Write("{ \"step\" : \"" + result + "\", \"filename\" : \"" + fileName + "\"}");
|
||||
@ -990,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[changesArray.Count - 1]
|
||||
? (Dictionary<string, object>)changesArray[0]
|
||||
: new Dictionary<string, object>();
|
||||
|
||||
// write information about changes to the object
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<appSettings>
|
||||
<clear />
|
||||
<add key="version" value="1.14.0"/>
|
||||
<add key="version" value="1.13.0"/>
|
||||
|
||||
<add key="filesize-max" value="52428800"/>
|
||||
<add key="storage-path" value=""/>
|
||||
@ -13,17 +13,16 @@
|
||||
<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"/>
|
||||
|
||||
<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|ur:Urdu|vi:Vietnamese|aa-AA:Test Language"/>
|
||||
<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"/>
|
||||
|
||||
<add key="files.docservice.url.site" value="http://documentserver/"/>
|
||||
|
||||
<add key="files.docservice.url.converter" value="converter"/>
|
||||
<add key="files.docservice.url.api" value="web-apps/apps/api/documents/api.js"/>
|
||||
<add key="files.docservice.url.preloader" value="web-apps/apps/api/documents/preload.html"/>
|
||||
<add key="files.docservice.url.preloader" value="web-apps/apps/api/documents/cache-scripts.html"/>
|
||||
<add key="files.docservice.url.command" value="command"/>
|
||||
|
||||
<add key="files.docservice.url.example" value=""/>
|
||||
|
||||
BIN
web/documentserver-example/csharp/App_Themes/images/diagram.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,6 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13.5 3.707V15a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V1A.5.5 0 0 1 3 .5h7.293z" fill="#fff" stroke="#BBB"/>
|
||||
<path d="M9.5 1v2.7c0 .28 0 .42.055.527a.5.5 0 0 0 .218.218c.107.055.247.055.527.055H13" stroke="#BBB"/>
|
||||
<path d="M5 8h6v1H5zm0 1h1v1H5zm5 0h1v1h-1zM7 6h2v2H7z" fill="#5951BB"/>
|
||||
<path stroke="#5951BB" d="M4.5 10.5h2v2h-2zm5 0h2v2h-2z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 469 B |
@ -635,6 +635,11 @@ footer a:hover {
|
||||
background-image: url("images/icon_pdf.svg");
|
||||
}
|
||||
|
||||
.stored-edit.diagram,
|
||||
.uploadFileName.diagram {
|
||||
background-image: url("images/icon_vsdx.svg");
|
||||
}
|
||||
|
||||
.stored-edit span {
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
|
||||
@ -254,6 +254,7 @@ namespace OnlineEditorsExample
|
||||
if (FormatManager.DocumentExtensions().Contains(ext)) return "word"; // word for text document extensions
|
||||
if (FormatManager.SpreadsheetExtensions().Contains(ext)) return "cell"; // cell for spreadsheet extensions
|
||||
if (FormatManager.PresentationExtensions().Contains(ext)) return "slide"; // slide for presentation extensions
|
||||
if (FormatManager.DiagramExtensions().Contains(ext)) return "diagram"; // diagram for diagram extensions
|
||||
|
||||
return "word"; // the default document type is word
|
||||
}
|
||||
@ -469,7 +470,7 @@ 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, _fileName);
|
||||
var result = ServiceConverter.GetConvertedData(fileUrl.ToString() , extension, conversionExtension, key, true, out newFileData, filePass, lang);
|
||||
if (result != 100)
|
||||
{
|
||||
return "{ \"step\" : \"" + result + "\", \"filename\" : \"" + _fileName + "\"}";
|
||||
@ -562,10 +563,7 @@ namespace OnlineEditorsExample
|
||||
var directoryInfo = new DirectoryInfo(directory); // read the user host directory contents
|
||||
|
||||
// get the list of stored files from the host directory
|
||||
var storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly).ToList();
|
||||
|
||||
storedFiles.Sort((a, b) => b.LastWriteTimeUtc.CompareTo(a.LastWriteTimeUtc)); // sort files by the modification date
|
||||
|
||||
List<FileInfo> storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly).ToList();
|
||||
return storedFiles;
|
||||
}
|
||||
|
||||
|
||||
@ -85,8 +85,7 @@ namespace ASC.Api.DocumentConverter
|
||||
bool isAsync,
|
||||
out Dictionary<string, string> convertedDocumentData,
|
||||
string filePass = null,
|
||||
string lang = null,
|
||||
string filename = null)
|
||||
string lang = null)
|
||||
{
|
||||
convertedDocumentData = new Dictionary<string, string>();
|
||||
|
||||
@ -94,7 +93,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 = string.IsNullOrEmpty(filename) ? Path.GetFileName(documentUri) : filename;
|
||||
var title = Path.GetFileName(documentUri);
|
||||
title = string.IsNullOrEmpty(title) ? Guid.NewGuid().ToString() : title;
|
||||
|
||||
// get document key
|
||||
|
||||
@ -164,6 +164,20 @@ namespace OnlineEditorsExample
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public static List<string> DiagramExtensions()
|
||||
{
|
||||
return Diagrams()
|
||||
.Select(format => format.Extension())
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public static List<Format> Diagrams()
|
||||
{
|
||||
return All()
|
||||
.Where(format => format.Type == "diagram")
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public static List<string> AllExtensions()
|
||||
{
|
||||
return All()
|
||||
|
||||
@ -20,7 +20,6 @@ using JWT;
|
||||
using JWT.Algorithms;
|
||||
using JWT.Builder;
|
||||
using JWT.Serializers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Configuration;
|
||||
|
||||
@ -29,7 +28,6 @@ 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;
|
||||
|
||||
@ -37,19 +35,12 @@ 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());
|
||||
|
||||
@ -778,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[changesArray.Count - 1]
|
||||
? (Dictionary<string, object>)changesArray[0]
|
||||
: new Dictionary<string, object>();
|
||||
|
||||
// write information about changes to the object
|
||||
|
||||
@ -415,12 +415,14 @@ if (typeof jQuery != "undefined") {
|
||||
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("#hiddenFileName").attr("data",response.filename);
|
||||
jq("#beginEditConverted").removeClass("disable");
|
||||
jq("#beginViewConverted").removeClass("disable");
|
||||
jq("#downloadConverted").attr("data","fromStorage");
|
||||
} else {
|
||||
let newFilename = fileName.split('.').slice(0,-1).join('.')
|
||||
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
|
||||
jq("#downloadConverted").attr("data","fromConverter");
|
||||
}
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<appSettings>
|
||||
<clear />
|
||||
<add key="version" value="1.14.0"/>
|
||||
<add key="version" value="1.13.0"/>
|
||||
|
||||
<add key="filesize-max" value="52428800"/>
|
||||
<add key="storage-path" value=""/>
|
||||
@ -14,15 +14,14 @@
|
||||
<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|ur:Urdu|vi:Vietnamese|aa-AA: Test Language"/>
|
||||
<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"/>
|
||||
|
||||
<add key="files.docservice.url.site" value="http://documentserver/"/>
|
||||
|
||||
<add key="files.docservice.url.converter" value="converter"/>
|
||||
<add key="files.docservice.url.api" value="web-apps/apps/api/documents/api.js"/>
|
||||
<add key="files.docservice.url.preloader" value="web-apps/apps/api/documents/preload.html"/>
|
||||
<add key="files.docservice.url.preloader" value="web-apps/apps/api/documents/cache-scripts.html"/>
|
||||
<add key="files.docservice.url.command" value="command"/>
|
||||
|
||||
<add key="files.docservice.url.example" value=""/>
|
||||
|
||||
@ -4,7 +4,6 @@ linters:
|
||||
- cyclop
|
||||
- depguard
|
||||
- dogsled
|
||||
- durationcheck
|
||||
- err113
|
||||
- errchkjson
|
||||
- execinquery
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"VERSION": "1.14.0",
|
||||
"VERSION": "1.13.0",
|
||||
|
||||
"SERVER_ADDRESS" : "",
|
||||
"SERVER_PORT" : 3000,
|
||||
@ -7,11 +7,10 @@
|
||||
"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/preload.html",
|
||||
"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",
|
||||
|
||||
@ -67,7 +66,6 @@
|
||||
"sv": "Swedish",
|
||||
"tr": "Turkish",
|
||||
"uk": "Ukrainian",
|
||||
"ur": "Urdu",
|
||||
"vi": "Vietnamese",
|
||||
"aa-AA": "Test Language"
|
||||
}
|
||||
|
||||
@ -29,4 +29,5 @@ type ExtensionTypes struct {
|
||||
Presentation []string `json:"presentation"`
|
||||
Document []string `json:"document"`
|
||||
Pdf []string `json:"pdf"`
|
||||
Diagram []string `json:"diagram"`
|
||||
}
|
||||
|
||||
@ -20,7 +20,6 @@ package config
|
||||
import (
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/ONLYOFFICE/document-server-integration/utils"
|
||||
"github.com/spf13/viper"
|
||||
@ -37,7 +36,6 @@ type ApplicationConfig struct {
|
||||
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"`
|
||||
@ -93,6 +91,7 @@ func NewSpecification() (specification SpecificationConfig, err error) {
|
||||
fm.GetPresentationExtensions(),
|
||||
fm.GetDocumentExtensions(),
|
||||
fm.GetPdfExtensions(),
|
||||
fm.GetDiagramExtensions(),
|
||||
}
|
||||
specification = SpecificationConfig{
|
||||
exts,
|
||||
|
||||
@ -22,12 +22,10 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/ONLYOFFICE/document-server-integration/server/managers"
|
||||
"github.com/ONLYOFFICE/document-server-integration/server/models"
|
||||
"github.com/ONLYOFFICE/document-server-integration/server/shared"
|
||||
"github.com/golang-jwt/jwt"
|
||||
)
|
||||
|
||||
func (srv *DefaultServerEndpointsHandler) Config(w http.ResponseWriter, r *http.Request) {
|
||||
@ -73,10 +71,6 @@ func (srv *DefaultServerEndpointsHandler) Config(w http.ResponseWriter, r *http.
|
||||
),
|
||||
Mode: "edit",
|
||||
},
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
ExpiresAt: time.Now().Add(time.Minute * srv.config.JwtExpiresIn).Unix(),
|
||||
IssuedAt: time.Now().Unix(),
|
||||
},
|
||||
}
|
||||
|
||||
secret := strings.TrimSpace(srv.config.JwtSecret)
|
||||
|
||||
@ -79,7 +79,7 @@ func (srv *DefaultServerEndpointsHandler) Convert(w http.ResponseWriter, r *http
|
||||
return
|
||||
}
|
||||
|
||||
newUrl, newExt, err := srv.ConversionManager.GetConverterUri(fileUrl, fileExt, toExt, key, true, filename)
|
||||
newUrl, newExt, err := srv.ConversionManager.GetConverterUri(fileUrl, fileExt, toExt, key, true)
|
||||
if err != nil {
|
||||
response.Error = err.Error()
|
||||
srv.logger.Errorf("File conversion error: %s", err.Error())
|
||||
|
||||
@ -96,10 +96,6 @@ func (srv *DefaultServerEndpointsHandler) Create(w http.ResponseWriter, r *http.
|
||||
srv.logger.Errorf("meta creation error: %s", err.Error())
|
||||
}
|
||||
|
||||
res := map[string]interface{}{
|
||||
"file": correctName,
|
||||
}
|
||||
shared.SendResponse(w, res)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@ -23,13 +23,11 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/ONLYOFFICE/document-server-integration/server/managers"
|
||||
"github.com/ONLYOFFICE/document-server-integration/server/models"
|
||||
"github.com/ONLYOFFICE/document-server-integration/server/shared"
|
||||
"github.com/ONLYOFFICE/document-server-integration/utils"
|
||||
"github.com/golang-jwt/jwt"
|
||||
)
|
||||
|
||||
func (srv *DefaultServerEndpointsHandler) Reference(w http.ResponseWriter, r *http.Request) {
|
||||
@ -45,11 +43,15 @@ func (srv *DefaultServerEndpointsHandler) Reference(w http.ResponseWriter, r *ht
|
||||
|
||||
var fileKey map[string]string
|
||||
err := json.Unmarshal([]byte(body.ReferenceData.FileKey), &fileKey)
|
||||
if err == nil {
|
||||
path, _ := srv.GenerateFilePath(fileKey["fileName"])
|
||||
if body.ReferenceData.InstanceId == remoteAddr && srv.PathExists(path) {
|
||||
fileName = fileKey["fileName"]
|
||||
}
|
||||
if err != nil {
|
||||
srv.logger.Error("FileKey decoding error")
|
||||
shared.SendDocumentServerRespose(w, true)
|
||||
return
|
||||
}
|
||||
|
||||
path, _ := srv.GenerateFilePath(fileKey["fileName"])
|
||||
if body.ReferenceData.InstanceId == remoteAddr && srv.PathExists(path) {
|
||||
fileName = fileKey["fileName"]
|
||||
}
|
||||
|
||||
if fileName == "" && body.Link != "" {
|
||||
@ -97,10 +99,6 @@ func (srv *DefaultServerEndpointsHandler) Reference(w http.ResponseWriter, r *ht
|
||||
},
|
||||
Link: remoteAddr + "/editor?filename=" + url.QueryEscape(fileName),
|
||||
Path: fileName,
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
ExpiresAt: time.Now().Add(time.Minute * srv.config.JwtExpiresIn).Unix(),
|
||||
IssuedAt: time.Now().Unix(),
|
||||
},
|
||||
}
|
||||
|
||||
secret := strings.TrimSpace(srv.config.JwtSecret)
|
||||
|
||||
@ -44,7 +44,7 @@ func (srv *DefaultServerEndpointsHandler) Upload(w http.ResponseWriter, r *http.
|
||||
srv.logger.Debug("A new upload call")
|
||||
if !srv.DocumentManager.IsDocumentConvertable(handler.Filename) {
|
||||
srv.logger.Errorf("File %s is not supported", handler.Filename)
|
||||
shared.SendResponse(w, map[string]string{"error": "File type is not supported"})
|
||||
shared.SendCustomErrorResponse(w, "File type is not supported")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ type ConversionManager interface {
|
||||
GetInternalExtension(fileType string) string
|
||||
IsCanConvert(ext string) bool
|
||||
IsCanFill(ext string) bool
|
||||
GetConverterUri(docUri, fromExt, toExt, docKey string, isAsync bool, title string) (string, string, error)
|
||||
GetConverterUri(docUri, fromExt, toExt, docKey string, isAsync bool) (string, string, error)
|
||||
}
|
||||
|
||||
type CommandManager interface {
|
||||
|
||||
@ -23,7 +23,6 @@ import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/ONLYOFFICE/document-server-integration/config"
|
||||
"github.com/ONLYOFFICE/document-server-integration/server/managers"
|
||||
@ -60,10 +59,6 @@ func (cm DefaultCommandManager) CommandRequest(method string, docKey string, met
|
||||
payload := CommandPayload{
|
||||
C: method,
|
||||
Key: docKey,
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
ExpiresAt: time.Now().Add(time.Minute * cm.config.JwtExpiresIn).Unix(),
|
||||
IssuedAt: time.Now().Unix(),
|
||||
},
|
||||
}
|
||||
if meta != nil {
|
||||
payload.Meta = meta
|
||||
@ -73,7 +68,7 @@ func (cm DefaultCommandManager) CommandRequest(method string, docKey string, met
|
||||
var headerToken string
|
||||
secret := strings.TrimSpace(cm.config.JwtSecret)
|
||||
if secret != "" && cm.config.JwtEnabled {
|
||||
headerPayload := fillJwtByUrl(uri, payload, cm.config)
|
||||
headerPayload := fillJwtByUrl(uri, payload)
|
||||
headerToken, err = cm.JwtManager.JwtSign(headerPayload, []byte(secret))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -108,7 +103,7 @@ func (cm DefaultCommandManager) CommandRequest(method string, docKey string, met
|
||||
return response, nil
|
||||
}
|
||||
|
||||
func fillJwtByUrl(uri string, payload CommandPayload, config config.ApplicationConfig) CommandRequestHeaderPayload {
|
||||
func fillJwtByUrl(uri string, payload CommandPayload) CommandRequestHeaderPayload {
|
||||
urlObj, _ := url.Parse(uri)
|
||||
query, _ := url.ParseQuery(urlObj.RawQuery)
|
||||
queryMap := make(map[string]string)
|
||||
@ -119,9 +114,5 @@ func fillJwtByUrl(uri string, payload CommandPayload, config config.ApplicationC
|
||||
return CommandRequestHeaderPayload{
|
||||
Query: queryMap,
|
||||
Payload: payload,
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
ExpiresAt: time.Now().Add(time.Minute * config.JwtExpiresIn).Unix(),
|
||||
IssuedAt: time.Now().Unix(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,13 +24,11 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/ONLYOFFICE/document-server-integration/config"
|
||||
"github.com/ONLYOFFICE/document-server-integration/server/managers"
|
||||
"github.com/ONLYOFFICE/document-server-integration/server/shared"
|
||||
"github.com/ONLYOFFICE/document-server-integration/utils"
|
||||
"github.com/golang-jwt/jwt"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
@ -68,6 +66,9 @@ func (cm DefaultConversionManager) GetFileType(filename string) string {
|
||||
if utils.IsInList(ext, exts.Presentation) {
|
||||
return shared.ONLYOFFICE_PRESENTATION
|
||||
}
|
||||
if utils.IsInList(ext, exts.Diagram) {
|
||||
return shared.ONLYOFFICE_DIAGRAM
|
||||
}
|
||||
|
||||
return shared.ONLYOFFICE_DOCUMENT
|
||||
}
|
||||
@ -99,7 +100,6 @@ func (cm DefaultConversionManager) GetConverterUri(
|
||||
toExt string,
|
||||
docKey string,
|
||||
isAsync bool,
|
||||
title string,
|
||||
) (string, string, error) {
|
||||
if fromExt == "" {
|
||||
fromExt = utils.GetFileExt(docUri, true)
|
||||
@ -109,13 +109,9 @@ func (cm DefaultConversionManager) GetConverterUri(
|
||||
DocUrl: docUri,
|
||||
OutputType: strings.ReplaceAll(toExt, ".", ""),
|
||||
FileType: fromExt,
|
||||
Title: title,
|
||||
Title: utils.GetFileName(docUri),
|
||||
Key: docKey,
|
||||
Async: isAsync,
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
ExpiresAt: time.Now().Add(time.Minute * cm.config.JwtExpiresIn).Unix(),
|
||||
IssuedAt: time.Now().Unix(),
|
||||
},
|
||||
}
|
||||
|
||||
var headerToken string
|
||||
@ -123,13 +119,7 @@ func (cm DefaultConversionManager) GetConverterUri(
|
||||
|
||||
secret := strings.TrimSpace(cm.config.JwtSecret)
|
||||
if secret != "" && cm.config.JwtEnabled {
|
||||
headerPayload := managers.ConvertRequestHeaderPayload{
|
||||
Payload: payload,
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
ExpiresAt: time.Now().Add(time.Minute * cm.config.JwtExpiresIn).Unix(),
|
||||
IssuedAt: time.Now().Unix(),
|
||||
},
|
||||
}
|
||||
headerPayload := managers.ConvertRequestHeaderPayload{Payload: payload}
|
||||
headerToken, err = cm.JwtManager.JwtSign(headerPayload, []byte(secret))
|
||||
if err != nil {
|
||||
return "", "", err
|
||||
|
||||
@ -28,7 +28,6 @@ import (
|
||||
"github.com/ONLYOFFICE/document-server-integration/server/managers"
|
||||
"github.com/ONLYOFFICE/document-server-integration/server/models"
|
||||
"github.com/ONLYOFFICE/document-server-integration/utils"
|
||||
"github.com/golang-jwt/jwt"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
@ -153,7 +152,7 @@ func (dm DefaultDocumentManager) BuildDocumentConfig(
|
||||
return nil, err
|
||||
}
|
||||
|
||||
config := &models.Config{
|
||||
config := models.Config{
|
||||
Type: parameters.Type,
|
||||
DocumentType: dm.ConversionManager.GetFileType(parameters.Filename),
|
||||
Document: models.Document{
|
||||
@ -224,10 +223,6 @@ func (dm DefaultDocumentManager) BuildDocumentConfig(
|
||||
},
|
||||
},
|
||||
},
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
ExpiresAt: time.Now().Add(time.Minute * dm.config.JwtExpiresIn).Unix(),
|
||||
IssuedAt: time.Now().Unix(),
|
||||
},
|
||||
}
|
||||
|
||||
secret := strings.TrimSpace(dm.config.JwtSecret)
|
||||
@ -236,7 +231,7 @@ func (dm DefaultDocumentManager) BuildDocumentConfig(
|
||||
config.Token = token
|
||||
}
|
||||
|
||||
return config, nil
|
||||
return &config, nil
|
||||
}
|
||||
|
||||
func (dm DefaultDocumentManager) IsDocumentConvertable(filename string) bool {
|
||||
|
||||
@ -23,14 +23,12 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
"github.com/ONLYOFFICE/document-server-integration/config"
|
||||
"github.com/ONLYOFFICE/document-server-integration/server/managers"
|
||||
"github.com/ONLYOFFICE/document-server-integration/server/models"
|
||||
"github.com/ONLYOFFICE/document-server-integration/server/shared"
|
||||
"github.com/ONLYOFFICE/document-server-integration/utils"
|
||||
"github.com/golang-jwt/jwt"
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
@ -197,10 +195,6 @@ func (hm DefaultHistoryManager) fetchNextHistoryEntry(
|
||||
Key: key,
|
||||
Url: url,
|
||||
Version: version,
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
ExpiresAt: time.Now().Add(time.Minute * hm.config.JwtExpiresIn).Unix(),
|
||||
IssuedAt: time.Now().Unix(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -267,10 +261,6 @@ func (hm DefaultHistoryManager) GetHistory(
|
||||
Url: hm.StorageManager.GeneratePublicFileUri(filename, remoteAddress, managers.FileMeta{}),
|
||||
Version: version,
|
||||
ChangesUrl: changesUrl,
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
ExpiresAt: time.Now().Add(time.Minute * hm.config.JwtExpiresIn).Unix(),
|
||||
IssuedAt: time.Now().Unix(),
|
||||
},
|
||||
}
|
||||
|
||||
rhist.History = append(rhist.History, models.History{
|
||||
|
||||
@ -94,7 +94,7 @@ func (sm DefaultStorageManager) GetStoredFiles(remoteAddress string) ([]models.D
|
||||
}
|
||||
|
||||
sort.Slice(files, func(i, j int) bool {
|
||||
return !files[i].ModTime().Before(files[j].ModTime())
|
||||
return files[i].ModTime().Before(files[j].ModTime())
|
||||
})
|
||||
|
||||
for _, v := range files {
|
||||
|
||||
@ -86,9 +86,7 @@ func NewDefaultUserManager(logger *zap.SugaredLogger) managers.UserManager {
|
||||
Goback: map[string]interface{}{
|
||||
"text": "Go to Documents",
|
||||
},
|
||||
Close: map[string]interface{}{
|
||||
"visible": true,
|
||||
},
|
||||
Close: nil,
|
||||
},
|
||||
{
|
||||
Id: "uid-3",
|
||||
@ -108,9 +106,7 @@ func NewDefaultUserManager(logger *zap.SugaredLogger) managers.UserManager {
|
||||
Templates: false,
|
||||
Avatar: false,
|
||||
Goback: nil,
|
||||
Close: map[string]interface{}{
|
||||
"visible": true,
|
||||
},
|
||||
Close: nil,
|
||||
},
|
||||
}
|
||||
return &DefaultUserManager{
|
||||
|
||||
@ -20,10 +20,10 @@ package models
|
||||
import "github.com/golang-jwt/jwt"
|
||||
|
||||
type Config struct {
|
||||
Type string `json:"type"`
|
||||
Document Document `json:"document"`
|
||||
DocumentType string `json:"documentType"`
|
||||
EditorConfig EditorConfig `json:"editorConfig"`
|
||||
Token string `json:"token,omitempty"`
|
||||
jwt.StandardClaims
|
||||
Type string `json:"type"`
|
||||
Document Document `json:"document"`
|
||||
DocumentType string `json:"documentType"`
|
||||
EditorConfig EditorConfig `json:"editorConfig"`
|
||||
Token string `json:"token,omitempty"`
|
||||
jwt.StandardClaims `json:"-"`
|
||||
}
|
||||
|
||||
@ -25,12 +25,12 @@ type ReferenceData struct {
|
||||
}
|
||||
|
||||
type Reference struct {
|
||||
ReferenceData ReferenceData `json:"referenceData"`
|
||||
Link string `json:"link"`
|
||||
Path string `json:"path"`
|
||||
FileType string `json:"fileType"`
|
||||
Key string `json:"key"`
|
||||
Url string `json:"url"`
|
||||
Token string `json:"token,omitempty"`
|
||||
jwt.StandardClaims
|
||||
ReferenceData ReferenceData `json:"referenceData"`
|
||||
Link string `json:"link"`
|
||||
Path string `json:"path"`
|
||||
FileType string `json:"fileType"`
|
||||
Key string `json:"key"`
|
||||
Url string `json:"url"`
|
||||
Token string `json:"token,omitempty"`
|
||||
jwt.StandardClaims `json:"-"`
|
||||
}
|
||||
|
||||
@ -22,5 +22,6 @@ const (
|
||||
ONLYOFFICE_SPREADSHEET = "cell"
|
||||
ONLYOFFICE_PRESENTATION = "slide"
|
||||
ONLYOFFICE_PDF = "pdf"
|
||||
ONLYOFFICE_DIAGRAM = "diagram"
|
||||
ONLYOFFICE_HISTORY_POSTFIX = "-hist"
|
||||
)
|
||||
|
||||
BIN
web/documentserver-example/go/static/images/diagram.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,6 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13.5 3.707V15a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V1A.5.5 0 0 1 3 .5h7.293z" fill="#fff" stroke="#BBB"/>
|
||||
<path d="M9.5 1v2.7c0 .28 0 .42.055.527a.5.5 0 0 0 .218.218c.107.055.247.055.527.055H13" stroke="#BBB"/>
|
||||
<path d="M5 8h6v1H5zm0 1h1v1H5zm5 0h1v1h-1zM7 6h2v2H7z" fill="#5951BB"/>
|
||||
<path stroke="#5951BB" d="M4.5 10.5h2v2h-2zm5 0h2v2h-2z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 469 B |
@ -16,6 +16,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
var directUrl;
|
||||
var formatManager;
|
||||
|
||||
window.onload = function () {
|
||||
@ -41,8 +42,19 @@ window.onload = function () {
|
||||
if (typeof jQuery !== "undefined") {
|
||||
jq = jQuery.noConflict();
|
||||
|
||||
directUrl = getUrlVars()["directUrl"] == "true";
|
||||
|
||||
mustReload = false;
|
||||
|
||||
if (directUrl)
|
||||
jq("#directUrl").prop("checked", directUrl);
|
||||
else
|
||||
directUrl = jq("#directUrl").prop("checked");
|
||||
|
||||
jq("#directUrl").change(function() {
|
||||
window.location = "?directUrl=" + jq(this).prop("checked");
|
||||
});
|
||||
|
||||
jq(function () {
|
||||
jq("#fileupload").fileupload({
|
||||
dataType: "json",
|
||||
@ -265,7 +277,7 @@ if (typeof jQuery !== "undefined") {
|
||||
|
||||
jq(document).on("click", "#beginEdit:not(.disable)", function () {
|
||||
var fileId = encodeURIComponent(jq("#hiddenFileName").val());
|
||||
var url = UrlEditor + "?mode=edit&fileName=" + fileId;
|
||||
var url = UrlEditor + "?mode=edit&fileName=" + fileId+ "&directUrl=" + directUrl;
|
||||
window.open(url, "_blank");
|
||||
jq("#hiddenFileName").val("");
|
||||
jq.unblockUI();
|
||||
@ -274,7 +286,7 @@ if (typeof jQuery !== "undefined") {
|
||||
|
||||
jq(document).on("click", "#beginView:not(.disable)", function () {
|
||||
var fileId = encodeURIComponent(jq("#hiddenFileName").val());
|
||||
var url = UrlEditor + "?mode=view&fileName=" + fileId;
|
||||
var url = UrlEditor + "?mode=view&fileName=" + fileId+ "&directUrl=" + directUrl;
|
||||
window.open(url, "_blank");
|
||||
jq("#hiddenFileName").val("");
|
||||
jq.unblockUI();
|
||||
@ -283,7 +295,7 @@ if (typeof jQuery !== "undefined") {
|
||||
|
||||
jq(document).on("click", "#beginEmbedded:not(.disable)", function () {
|
||||
var fileId = encodeURIComponent(jq("#hiddenFileName").val());
|
||||
var url = UrlEditor + "?type=embedded&mode=embedded&fileName=" + fileId;
|
||||
var url = UrlEditor + "?type=embedded&mode=embedded&fileName=" + fileId + "&directUrl=" + directUrl;
|
||||
|
||||
jq("#mainProgress").addClass("embedded");
|
||||
jq("#beginEmbedded").addClass("disable");
|
||||
@ -402,12 +414,14 @@ if (typeof jQuery !== "undefined") {
|
||||
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("#hiddenFileName").attr("data",response.filename);
|
||||
jq("#beginEditConverted").removeClass("disable");
|
||||
jq("#beginViewConverted").removeClass("disable");
|
||||
jq("#downloadConverted").attr("data","fromStorage");
|
||||
} else {
|
||||
let newFilename = fileName.split('.').slice(0,-1).join('.')
|
||||
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
|
||||
jq("#downloadConverted").attr("data","fromConverter");
|
||||
}
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
|
||||
@ -632,6 +632,11 @@ footer table tr td:first-child {
|
||||
background-image: url("../images/icon_pdf.svg");
|
||||
}
|
||||
|
||||
.stored-edit.diagram,
|
||||
.uploadFileName.diagram {
|
||||
background-image: url("../images/icon_vsdx.svg");
|
||||
}
|
||||
|
||||
.stored-edit span {
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
|
||||
@ -48,6 +48,7 @@ type FormatManager interface {
|
||||
GetSpreadsheetExtensions() []string
|
||||
GetPresentationExtensions() []string
|
||||
GetPdfExtensions() []string
|
||||
GetDiagramExtensions() []string
|
||||
}
|
||||
|
||||
func NewFormatManager() (FormatManager, error) {
|
||||
@ -141,10 +142,19 @@ func (fm DefaultFormatManager) GetPresentationExtensions() (slide []string) {
|
||||
return
|
||||
}
|
||||
|
||||
func (fm DefaultFormatManager) GetPdfExtensions() (slide []string) {
|
||||
func (fm DefaultFormatManager) GetPdfExtensions() (pdf []string) {
|
||||
for _, f := range fm.formats {
|
||||
if f.FormatType == "pdf" {
|
||||
slide = append(slide, f.Name)
|
||||
pdf = append(pdf, f.Name)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (fm DefaultFormatManager) GetDiagramExtensions() (diagram []string) {
|
||||
for _, f := range fm.formats {
|
||||
if f.FormatType == "diagram" {
|
||||
diagram = append(diagram, f.Name)
|
||||
}
|
||||
}
|
||||
return
|
||||
|
||||
@ -84,7 +84,7 @@
|
||||
<dependency>
|
||||
<groupId>com.onlyoffice</groupId>
|
||||
<artifactId>docs-integration-sdk</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<version>1.4.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents.core5</groupId>
|
||||
|
||||
@ -256,7 +256,6 @@ public class FileController {
|
||||
.outputtype(conversionExtension)
|
||||
.region(lang)
|
||||
.async(true)
|
||||
.title(fileName)
|
||||
.build();
|
||||
|
||||
ConvertResponse convertResponse = convertService.processConvert(convertRequest, fileName);
|
||||
|
||||
@ -123,10 +123,7 @@ public class DefaultHistoryManager implements HistoryManager {
|
||||
History changes = objectMapper.readValue(changesSteam, History.class);
|
||||
|
||||
List<Object> historyChanges = changes.getChanges();
|
||||
Map<String, Object> historyChange = objectMapper.convertValue(
|
||||
historyChanges.get(historyChanges.size() - 1),
|
||||
Map.class
|
||||
);
|
||||
Map<String, Object> historyChange = objectMapper.convertValue(historyChanges.get(0), Map.class);
|
||||
|
||||
// write information about changes to the object
|
||||
version.setChanges(changes.getChanges());
|
||||
|
||||
@ -46,8 +46,6 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@ -319,9 +317,7 @@ public class LocalFileStorage implements FileStorageMutator, FileStoragePathBuil
|
||||
// get a collection of all the stored files
|
||||
public File[] getStoredFiles() {
|
||||
File file = new File(getStorageLocation());
|
||||
File[] files = file.listFiles(pathname -> pathname.isFile());
|
||||
Arrays.sort(files, Comparator.comparingLong(File::lastModified).reversed());
|
||||
return files;
|
||||
return file.listFiles(pathname -> pathname.isFile());
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
server.version=1.14.0
|
||||
server.version=1.13.0
|
||||
|
||||
server.address=
|
||||
server.port=4000
|
||||
@ -15,7 +15,7 @@ files.docservice.history.postfix=-hist
|
||||
files.docservice.url.example=
|
||||
|
||||
|
||||
files.docservice.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|ur:Urdu|vi:Vietnamese|aa-AA:Test Language
|
||||
files.docservice.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
|
||||
|
||||
docservice.url=http://documentserver/
|
||||
docservice.ignoreSSLCertificate=false
|
||||
@ -23,7 +23,6 @@ docservice.lossyEdit=epub, fb2, html, odt, ott, rtf, txt, csv, ods, ots, odp, ot
|
||||
|
||||
docservice.security.key=
|
||||
docservice.security.header=
|
||||
docservice.security.tokenValidityInMinutes=5
|
||||
|
||||
spring.datasource.url=jdbc:h2:mem:usersdb
|
||||
spring.datasource.driverClassName=org.h2.Driver
|
||||
|
||||
@ -274,7 +274,6 @@ if (typeof jQuery !== "undefined") {
|
||||
window.open(url, "_blank");
|
||||
jq("#hiddenFileName").val("");
|
||||
jq.unblockUI();
|
||||
document.location.reload();
|
||||
});
|
||||
|
||||
jq(document).on("click", "#beginView:not(.disable)", function () {
|
||||
@ -283,7 +282,6 @@ if (typeof jQuery !== "undefined") {
|
||||
window.open(url, "_blank");
|
||||
jq("#hiddenFileName").val("");
|
||||
jq.unblockUI();
|
||||
document.location.reload();
|
||||
});
|
||||
|
||||
jq(document).on("click", "#beginEmbedded:not(.disable)", function () {
|
||||
@ -407,12 +405,14 @@ if (typeof jQuery !== "undefined") {
|
||||
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("#hiddenFileName").attr("data",response.filename);
|
||||
jq("#beginEditConverted").removeClass("disable");
|
||||
jq("#beginViewConverted").removeClass("disable");
|
||||
jq("#downloadConverted").attr("data","fromStorage");
|
||||
} else {
|
||||
let newFilename = fileName.split('.').slice(0,-1).join('.')
|
||||
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
|
||||
jq("#downloadConverted").attr("data","fromConverter");
|
||||
}
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
|
||||
@ -303,7 +303,7 @@ public class IndexServlet extends HttpServlet {
|
||||
|
||||
// get the url and file type to the converted file
|
||||
Map<String, String> newFileData = ServiceConverter
|
||||
.getConvertedData(fileUri, fileExt, conversionExtension, key, filePass, true, lang, fileName);
|
||||
.getConvertedData(fileUri, fileExt, conversionExtension, key, filePass, true, lang);
|
||||
String newFileUri = newFileData.get("fileUrl");
|
||||
String newFileType = newFileData.get("fileType");
|
||||
|
||||
@ -960,8 +960,7 @@ public class IndexServlet extends HttpServlet {
|
||||
JSONObject changes = (JSONObject) parser.parse(
|
||||
DocumentManager.readFileToEnd(new File(DocumentManager
|
||||
.versionDir(histDir, i - 1) + File.separator + "changes.json")));
|
||||
JSONObject change = (JSONObject) ((JSONArray) changes.get("changes"))
|
||||
.get(((JSONArray) changes.get("changes")).size() - 1);
|
||||
JSONObject change = (JSONObject) ((JSONArray) changes.get("changes")).get(0);
|
||||
|
||||
// write information about changes to the object
|
||||
obj.put("changes", !change.isEmpty() ? changes.get("changes") : null);
|
||||
|
||||
@ -33,5 +33,8 @@ public enum FileType {
|
||||
SLIDE,
|
||||
@JsonProperty("pdf")
|
||||
@SerializedName("pdf")
|
||||
PDF
|
||||
PDF,
|
||||
@JsonProperty("diagram")
|
||||
@SerializedName("diagram")
|
||||
DIAGRAM
|
||||
}
|
||||
|
||||
@ -47,10 +47,8 @@ import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@ -292,17 +290,12 @@ public final class DocumentManager {
|
||||
String directory = filesRootPath(userAddress);
|
||||
|
||||
File file = new File(directory);
|
||||
|
||||
File[] files = file.listFiles(new FileFilter() { // take only files from the root directory
|
||||
return file.listFiles(new FileFilter() { // take only files from the root directory
|
||||
@Override
|
||||
public boolean accept(final File pathname) {
|
||||
return pathname.isFile();
|
||||
}
|
||||
});
|
||||
|
||||
Arrays.sort(files, Comparator.comparingLong(File::lastModified).reversed());
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
// create demo document
|
||||
@ -550,7 +543,6 @@ public final class DocumentManager {
|
||||
for (String key : payloadClaims.keySet()) { // run through all the keys from the payload
|
||||
jwt.addClaim(key, payloadClaims.get(key)); // and write each claim to the jwt
|
||||
}
|
||||
jwt.setExpiration(ZonedDateTime.now().plusMinutes(getTokenExpiration()));
|
||||
return JWT.getEncoder().encode(jwt, signer); // sign and encode the JWT to a JSON string representation
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
@ -587,11 +579,6 @@ public final class DocumentManager {
|
||||
return ConfigManager.getProperty("files.docservice.secret");
|
||||
}
|
||||
|
||||
// get token expiration time in minutes from the config parameters
|
||||
public static Integer getTokenExpiration() {
|
||||
return Integer.parseInt(ConfigManager.getProperty("files.docservice.token-expiration"));
|
||||
}
|
||||
|
||||
// get config request jwt
|
||||
public static String getTokenUseForRequest() {
|
||||
return ConfigManager.getProperty("files.docservice.token-use-for-request");
|
||||
|
||||
@ -140,13 +140,13 @@ public final class ServiceConverter {
|
||||
public static Map<String, String> getConvertedData(final String documentUri, final String fromExtension,
|
||||
final String toExtension, final String documentRevisionId,
|
||||
final String filePass, final Boolean isAsync,
|
||||
final String lang, final String filename) throws Exception {
|
||||
final String lang) throws Exception {
|
||||
// check if the fromExtension parameter is defined; if not, get it from the document url
|
||||
String fromExt = fromExtension == null || fromExtension.isEmpty()
|
||||
? FileUtility.getFileExtension(documentUri) : fromExtension;
|
||||
|
||||
// check if the file name parameter is defined; if not, get random uuid for this file
|
||||
String title = filename == null || filename.isEmpty() ? FileUtility.getFileName(documentUri) : filename;
|
||||
String title = FileUtility.getFileName(documentUri);
|
||||
title = title == null || title.isEmpty() ? UUID.randomUUID().toString() : title;
|
||||
|
||||
String documentRevId = documentRevisionId == null || documentRevisionId.isEmpty()
|
||||
|
||||
@ -158,7 +158,7 @@ public final class TrackManager {
|
||||
String newFileUri = ServiceConverter
|
||||
.getConvertedData(downloadUri, downloadExt, curExt,
|
||||
ServiceConverter.generateRevisionId(downloadUri),
|
||||
null, false, null, null).get("fileUrl"); // convert file and get url to a new file
|
||||
null, false, null).get("fileUrl"); // convert file and get url to a new file
|
||||
if (newFileUri.isEmpty()) {
|
||||
|
||||
// get the correct file name if it already exists
|
||||
@ -250,7 +250,7 @@ public final class TrackManager {
|
||||
String newFileUri = ServiceConverter
|
||||
.getConvertedData(downloadUri, downloadExt, curExt,
|
||||
ServiceConverter.generateRevisionId(downloadUri), null,
|
||||
false, null, null).get("fileUrl"); // convert file and get url to a new file
|
||||
false, null).get("fileUrl"); // convert file and get url to a new file
|
||||
if (newFileUri.isEmpty()) {
|
||||
newFileName = true;
|
||||
} else {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
version=1.14.0
|
||||
version=1.13.0
|
||||
|
||||
filesize-max=5242880
|
||||
storage-folder=app_data
|
||||
@ -11,14 +11,13 @@ files.docservice.url.site=http://documentserver/
|
||||
files.docservice.url.converter=converter
|
||||
files.docservice.url.command=command
|
||||
files.docservice.url.api=web-apps/apps/api/documents/api.js
|
||||
files.docservice.url.preloader=web-apps/apps/api/documents/preload.html
|
||||
files.docservice.url.preloader=web-apps/apps/api/documents/cache-scripts.html
|
||||
files.docservice.url.example=
|
||||
|
||||
files.docservice.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|ur:Urdu|vi:Vietnamese|aa-AA:Test Language
|
||||
files.docservice.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
|
||||
|
||||
files.docservice.secret=
|
||||
files.docservice.header=Authorization
|
||||
files.docservice.token-use-for-request=TRUE
|
||||
files.docservice.token-expiration=5
|
||||
|
||||
files.docservice.verify-peer-off=TRUE
|
||||
|
||||
|
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,6 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13.5 3.707V15a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V1A.5.5 0 0 1 3 .5h7.293z" fill="#fff" stroke="#BBB"/>
|
||||
<path d="M9.5 1v2.7c0 .28 0 .42.055.527a.5.5 0 0 0 .218.218c.107.055.247.055.527.055H13" stroke="#BBB"/>
|
||||
<path d="M5 8h6v1H5zm0 1h1v1H5zm5 0h1v1h-1zM7 6h2v2H7z" fill="#5951BB"/>
|
||||
<path stroke="#5951BB" d="M4.5 10.5h2v2h-2zm5 0h2v2h-2z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 469 B |
@ -634,6 +634,11 @@ footer table tr td:first-child {
|
||||
background-image: url("img/icon_pdf.svg");
|
||||
}
|
||||
|
||||
.stored-edit.diagram,
|
||||
.uploadFileName.diagram {
|
||||
background-image: url("img/icon_vsdx.svg");
|
||||
}
|
||||
|
||||
.stored-edit span {
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
|
||||
@ -281,7 +281,6 @@ if (typeof jQuery !== "undefined") {
|
||||
window.open(url, "_blank");
|
||||
jq("#hiddenFileName").val("");
|
||||
jq.unblockUI();
|
||||
document.location.reload();
|
||||
});
|
||||
|
||||
jq(document).on("click", "#beginView:not(.disable)", function () {
|
||||
@ -290,7 +289,6 @@ if (typeof jQuery !== "undefined") {
|
||||
window.open(url, "_blank");
|
||||
jq("#hiddenFileName").val("");
|
||||
jq.unblockUI();
|
||||
document.location.reload();
|
||||
});
|
||||
|
||||
jq(document).on("click", "#beginEmbedded:not(.disable)", function () {
|
||||
@ -414,12 +412,14 @@ if (typeof jQuery !== "undefined") {
|
||||
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("#hiddenFileName").attr("data",response.filename);
|
||||
jq("#beginEditConverted").removeClass("disable");
|
||||
jq("#beginViewConverted").removeClass("disable");
|
||||
jq("#downloadConverted").attr("data","fromStorage");
|
||||
} else {
|
||||
let newFilename = fileName.split('.').slice(0,-1).join('.')
|
||||
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
|
||||
jq("#downloadConverted").attr("data","fromConverter");
|
||||
}
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
|
||||
@ -500,7 +500,7 @@ app.post('/convert', (req, res) => { // define a handler for converting files
|
||||
|
||||
key = documentService.generateRevisionId(key); // get document key
|
||||
// get the url to the converted file
|
||||
documentService.getConvertedUri(fileUri, fileExt, convExt, key, true, callback, filePass, lang, fileName);
|
||||
documentService.getConvertedUri(fileUri, fileExt, convExt, key, true, callback, filePass, lang);
|
||||
} else {
|
||||
// if the file with such an extension can't be converted, write the origin file to the result object
|
||||
writeResult(fileName, null, null);
|
||||
@ -1139,7 +1139,6 @@ app.get('/editor', (req, res) => { // define a handler for editing document
|
||||
const { reviewGroups } = user;
|
||||
const { commentGroups } = user;
|
||||
const { userInfoGroups } = user;
|
||||
const userRoles = user.roles;
|
||||
|
||||
const usersInfo = [];
|
||||
const usersForProtect = [];
|
||||
@ -1181,7 +1180,7 @@ app.get('/editor', (req, res) => { // define a handler for editing document
|
||||
|
||||
let submitForm = false;
|
||||
if (mode !== 'view') {
|
||||
submitForm = user.canSubmitForm;
|
||||
submitForm = userid === 'uid-1';
|
||||
}
|
||||
|
||||
if (user.goback != null) {
|
||||
@ -1227,7 +1226,6 @@ app.get('/editor', (req, res) => { // define a handler for editing document
|
||||
userImage: user.avatar ? `${req.DocManager.getServerUrl()}/images/${user.id}.png` : null,
|
||||
name,
|
||||
userGroup,
|
||||
userRoles,
|
||||
reviewGroups: JSON.stringify(reviewGroups),
|
||||
commentGroups: JSON.stringify(commentGroups),
|
||||
userInfoGroups: JSON.stringify(userInfoGroups),
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "1.14.0",
|
||||
"version": "1.13.0",
|
||||
"log": {
|
||||
"appenders": [
|
||||
{
|
||||
@ -20,7 +20,7 @@
|
||||
"commandUrl": "command",
|
||||
"converterUrl": "converter",
|
||||
"apiUrl": "web-apps/apps/api/documents/api.js",
|
||||
"preloaderUrl": "web-apps/apps/api/documents/preload.html",
|
||||
"preloaderUrl": "web-apps/apps/api/documents/cache-scripts.html",
|
||||
"exampleUrl": null,
|
||||
"storageFolder": "./files",
|
||||
"storagePath": "/files",
|
||||
@ -83,7 +83,6 @@
|
||||
"sv": "Swedish",
|
||||
"tr": "Turkish",
|
||||
"uk": "Ukrainian",
|
||||
"ur": "Urdu",
|
||||
"vi": "Vietnamese",
|
||||
"aa-AA": "Test Language"
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
{
|
||||
"server": {
|
||||
"port": 3000,
|
||||
"siteUrl": "http://127.0.0.1:8000/"
|
||||
"siteUrl": "http://127.0.0.1:8000/",
|
||||
"apiUrl": "web-apps/apps/api/documents/api.js",
|
||||
"preloaderUrl": "web-apps/apps/api/documents/cache-scripts.html"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
{
|
||||
"server": {
|
||||
"port": 3000,
|
||||
"siteUrl": "http://127.0.0.1:8000/"
|
||||
"siteUrl": "http://127.0.0.1:8000/",
|
||||
"apiUrl": "web-apps/apps/api/documents/api.js",
|
||||
"preloaderUrl": "web-apps/apps/api/documents/cache-scripts.html"
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
{
|
||||
"server": {
|
||||
"port": 80,
|
||||
"siteUrl": "http://127.0.0.1:8000/"
|
||||
"siteUrl": "http://127.0.0.1:8000/",
|
||||
"apiUrl": "web-apps/apps/api/documents/api.js",
|
||||
"preloaderUrl": "web-apps/apps/api/documents/cache-scripts.html"
|
||||
}
|
||||
}
|
||||
@ -533,8 +533,7 @@ DocManager.prototype.getHistory = function getHistory(fileName, content, keyVers
|
||||
let createdFromJson = null;
|
||||
if (fileContent) { // if content is defined
|
||||
if (fileContent.changes && fileContent.changes.length) { // and there are some modifications in the content
|
||||
// write these modifications to the json content
|
||||
contentJson = fileContent.changes[fileContent.changes.length - 1];
|
||||
[contentJson] = fileContent.changes; // write these modifications to the json content
|
||||
} else if (fileContent.length) {
|
||||
[contentJson] = fileContent; // otherwise, write original content to the json content
|
||||
oldVersion = true; // and note that this is an old version
|
||||
|
||||
@ -60,13 +60,12 @@ documentService.getConvertedUri = function getConvertedUri(
|
||||
callback,
|
||||
filePass = null,
|
||||
lang = null,
|
||||
filename = null,
|
||||
) {
|
||||
// get the current document extension
|
||||
const fromExt = fromExtension || fileUtility.getFileExtension(documentUri, false, true);
|
||||
|
||||
// get the current document name or uuid
|
||||
const title = filename || fileUtility.getFileNameFromUrl(documentUri) || guidManager.newGuid();
|
||||
const title = fileUtility.getFileNameFromUrl(documentUri) || guidManager.newGuid();
|
||||
|
||||
// generate the document key value
|
||||
const revisionId = documentService.generateRevisionId(documentRevisionId || documentUri);
|
||||
|
||||
@ -32,8 +32,6 @@ class User {
|
||||
avatar,
|
||||
goback,
|
||||
close,
|
||||
canSubmitForm,
|
||||
roles,
|
||||
) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
@ -49,8 +47,6 @@ class User {
|
||||
this.avatar = avatar;
|
||||
this.goback = goback;
|
||||
this.close = close;
|
||||
this.canSubmitForm = canSubmitForm;
|
||||
this.roles = roles;
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,8 +60,6 @@ const descrUser1 = [
|
||||
'Can see the information about all users',
|
||||
'Can submit forms',
|
||||
'Has an avatar',
|
||||
'Has no roles',
|
||||
'Can start filling',
|
||||
];
|
||||
|
||||
const descrUser2 = [
|
||||
@ -75,10 +69,8 @@ const descrUser2 = [
|
||||
'This file is marked as favorite',
|
||||
'Can create new files from the editor',
|
||||
'Can see the information about users from Group2 and users who don’t belong to any group',
|
||||
'Can submit forms',
|
||||
'Can’t submit forms',
|
||||
'Has an avatar',
|
||||
'Has role "Anyone"',
|
||||
'Can start filling',
|
||||
];
|
||||
|
||||
const descrUser3 = [
|
||||
@ -94,8 +86,6 @@ const descrUser3 = [
|
||||
'Can’t submit forms',
|
||||
'Can’t close history',
|
||||
'Can’t restore the file version',
|
||||
'Has role "role"',
|
||||
'Can start filling',
|
||||
];
|
||||
|
||||
const descrUser0 = [
|
||||
@ -113,8 +103,6 @@ const descrUser0 = [
|
||||
'View file without collaboration',
|
||||
'Can’t submit forms',
|
||||
'Can’t refresh outdated file',
|
||||
'Has empty role',
|
||||
'Can’t start filling',
|
||||
];
|
||||
|
||||
const users = [
|
||||
@ -133,8 +121,6 @@ const users = [
|
||||
true,
|
||||
{ blank: false },
|
||||
{ visible: false },
|
||||
true,
|
||||
null,
|
||||
),
|
||||
new User(
|
||||
'uid-2',
|
||||
@ -155,8 +141,6 @@ const users = [
|
||||
true,
|
||||
{ text: 'Go to Documents' },
|
||||
{},
|
||||
true,
|
||||
['Anyone'],
|
||||
),
|
||||
new User(
|
||||
'uid-3',
|
||||
@ -177,10 +161,8 @@ const users = [
|
||||
false,
|
||||
null,
|
||||
{},
|
||||
false,
|
||||
['role'],
|
||||
),
|
||||
new User('uid-0', null, null, null, null, {}, [], null, ['protect'], descrUser0, false, false, null, null, false, []),
|
||||
new User('uid-0', null, null, null, null, {}, [], null, ['protect'], descrUser0, false, false, null, null),
|
||||
];
|
||||
|
||||
// get a list of all the users
|
||||
|
||||
@ -57,10 +57,6 @@ const requestHeaders = Object.freeze({
|
||||
LockFailureReason: 'X-WOPI-LockFailureReason',
|
||||
LockedByOtherInterface: 'X-WOPI-LockedByOtherInterface',
|
||||
|
||||
Proof: 'X-WOPI-Proof',
|
||||
ProofOld: 'X-WOPI-ProofOld',
|
||||
Timestamp: 'X-WOPI-Timestamp',
|
||||
|
||||
FileConversion: 'X-WOPI-FileConversion',
|
||||
|
||||
FileName: 'X-WOPI-RequestedName',
|
||||
|
||||
@ -16,45 +16,4 @@
|
||||
*
|
||||
*/
|
||||
|
||||
const wopiValidator = require('@mercadoeletronico/wopi-proof-validator');
|
||||
const DocManager = require('../docManager');
|
||||
const reqConsts = require('./request');
|
||||
const utils = require('./utils');
|
||||
|
||||
exports.isValidToken = async (req, res, next) => {
|
||||
try {
|
||||
req.DocManager = new DocManager(req, res);
|
||||
const proofKey = await utils.getProofKey(req.DocManager);
|
||||
if (!proofKey) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
|
||||
const isValid = wopiValidator.check(
|
||||
{
|
||||
url: `${req.DocManager.getServerPath()}${req.originalUrl || req.url}`,
|
||||
accessToken: req.query.access_token,
|
||||
timestamp: req.headers[reqConsts.requestHeaders.Timestamp.toLowerCase()],
|
||||
},
|
||||
{
|
||||
proof: req.headers[reqConsts.requestHeaders.Proof.toLowerCase()],
|
||||
proofold: req.headers[reqConsts.requestHeaders.ProofOld.toLowerCase()],
|
||||
},
|
||||
{
|
||||
modulus: proofKey.modulus,
|
||||
exponent: proofKey.exponent,
|
||||
oldmodulus: proofKey.oldmodulus,
|
||||
oldexponent: proofKey.oldexponent,
|
||||
},
|
||||
);
|
||||
if (isValid) {
|
||||
next();
|
||||
} else {
|
||||
console.warn('Proof key verification failed');
|
||||
res.status(500).send('Not verified');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
res.status(500).send(`Verification error: ${error.message}`);
|
||||
}
|
||||
};
|
||||
exports.isValidToken = (req, res, next) => next();
|
||||
|
||||
@ -37,7 +37,6 @@ const requestDiscovery = async function requestDiscovery(DocManager) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const uri = absSiteUrl + configServer.get('wopi.discovery');
|
||||
const actions = [];
|
||||
let proofKey = null;
|
||||
|
||||
// parse url to allow request by relative url after
|
||||
// https://github.com/node-modules/urllib/pull/321/commits/514de1924bf17a38a6c2db2a22a6bc3494c0a959
|
||||
@ -78,47 +77,33 @@ const requestDiscovery = async function requestDiscovery(DocManager) {
|
||||
});
|
||||
});
|
||||
});
|
||||
proofKey = discovery['wopi-discovery']['proof-key'];
|
||||
}
|
||||
}
|
||||
resolve({ actions, proofKey });
|
||||
resolve(actions);
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
const getDiscovery = async function getDiscovery(DocManager) {
|
||||
let discovery = {};
|
||||
// get the wopi discovery information
|
||||
const getDiscoveryInfo = async function getDiscoveryInfo(DocManager) {
|
||||
let actions = [];
|
||||
|
||||
if (cache) return cache;
|
||||
|
||||
try {
|
||||
discovery = await requestDiscovery(DocManager);
|
||||
actions = await requestDiscovery(DocManager);
|
||||
} catch (e) {
|
||||
return discovery;
|
||||
return actions;
|
||||
}
|
||||
|
||||
cache = discovery;
|
||||
cache = actions;
|
||||
setTimeout(() => {
|
||||
cache = null;
|
||||
return cache;
|
||||
}, 1000 * 60 * 60); // 1 hour
|
||||
|
||||
return discovery;
|
||||
};
|
||||
|
||||
// get the wopi discovery actions information
|
||||
const getDiscoveryInfo = async function getDiscoveryInfo(DocManager) {
|
||||
const discovery = await getDiscovery(DocManager);
|
||||
|
||||
return discovery.actions;
|
||||
};
|
||||
|
||||
// get the wopi discovery proof key
|
||||
const getProofKey = async function getProofKey(DocManager) {
|
||||
const discovery = await getDiscovery(DocManager);
|
||||
|
||||
return discovery.proofKey;
|
||||
return actions;
|
||||
};
|
||||
|
||||
// get actions of the specified extension
|
||||
@ -191,6 +176,5 @@ exports.getEditNewText = getEditNewText;
|
||||
exports.getDiscoveryInfo = getDiscoveryInfo;
|
||||
exports.getAction = getAction;
|
||||
exports.getActions = getActions;
|
||||
exports.getProofKey = getProofKey;
|
||||
exports.getActionUrl = getActionUrl;
|
||||
exports.getDefaultAction = getDefaultAction;
|
||||
|
||||
@ -32,7 +32,7 @@ const getCustomWopiParams = function getCustomWopiParams(query) {
|
||||
let actionParams = '';
|
||||
|
||||
const { userid } = query; // user id
|
||||
tokenParams += (userid ? `-userid=${userid}` : '');
|
||||
tokenParams += (userid ? `&userid=${userid}` : '');
|
||||
|
||||
const { lang } = query; // language
|
||||
actionParams += (lang ? `&ui=${lang}` : '');
|
||||
|
||||
93
web/documentserver-example/nodejs/package-lock.json
generated
@ -9,7 +9,6 @@
|
||||
"version": "1.6.0",
|
||||
"license": "Apache",
|
||||
"dependencies": {
|
||||
"@mercadoeletronico/wopi-proof-validator": "^1.0.2",
|
||||
"body-parser": "^1.20.3",
|
||||
"config": "^3.3.12",
|
||||
"debug": "^4.3.4",
|
||||
@ -133,18 +132,6 @@
|
||||
"integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@mercadoeletronico/wopi-proof-validator": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@mercadoeletronico/wopi-proof-validator/-/wopi-proof-validator-1.0.2.tgz",
|
||||
"integrity": "sha512-ywaC2b/wBWhVSC1E8E2E5KgFg+irsr/WtgkgeiopxNbV56OZdLupaVd7aT/lOb1vppJ55TG+w4kaPFVh1tLn9A==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"cross-env": "^6.0.3",
|
||||
"debug": "^4.1.1",
|
||||
"int64-buffer": "^0.99.1007",
|
||||
"rsa-pem-from-mod-exp": "^0.8.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@nodelib/fs.scandir": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||
@ -632,26 +619,11 @@
|
||||
"resolved": "https://registry.npmjs.org/copy-to/-/copy-to-2.0.1.tgz",
|
||||
"integrity": "sha512-3DdaFaU/Zf1AnpLiFDeNCD4TOWe3Zl2RZaTzUvWiIk5ERzcCodOE20Vqq4fzCbNoHURFHT4/us/Lfq+S2zyY4w=="
|
||||
},
|
||||
"node_modules/cross-env": {
|
||||
"version": "6.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-6.0.3.tgz",
|
||||
"integrity": "sha512-+KqxF6LCvfhWvADcDPqo64yVIB31gv/jQulX2NGzKS/g3GEVz6/pt4wjHFtFWsHMddebWD/sDthJemzM4MaAag==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cross-spawn": "^7.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"cross-env": "src/bin/cross-env.js",
|
||||
"cross-env-shell": "src/bin/cross-env-shell.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/cross-spawn": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"path-key": "^3.1.0",
|
||||
@ -1888,15 +1860,6 @@
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"node_modules/int64-buffer": {
|
||||
"version": "0.99.1007",
|
||||
"resolved": "https://registry.npmjs.org/int64-buffer/-/int64-buffer-0.99.1007.tgz",
|
||||
"integrity": "sha512-XDBEu44oSTqlvCSiOZ/0FoUkpWu/vwjJLGSKDabNISPQNZ5wub1FodGHBljRsrR0IXRPq7SslshZYMuA55CgTQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 4.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/internal-slot": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz",
|
||||
@ -2161,7 +2124,8 @@
|
||||
"node_modules/isexe": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
|
||||
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/jake": {
|
||||
"version": "10.8.7",
|
||||
@ -2742,6 +2706,7 @@
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
|
||||
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
@ -2941,12 +2906,6 @@
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/rsa-pem-from-mod-exp": {
|
||||
"version": "0.8.6",
|
||||
"resolved": "https://registry.npmjs.org/rsa-pem-from-mod-exp/-/rsa-pem-from-mod-exp-0.8.6.tgz",
|
||||
"integrity": "sha512-c5ouQkOvGHF1qomUUDJGFcXsomeSO2gbEs6hVhMAtlkE1CuaZase/WzoaKFG/EZQuNmq6pw/EMCeEnDvOgCJYQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/run-parallel": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
|
||||
@ -3164,6 +3123,7 @@
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"shebang-regex": "^3.0.0"
|
||||
},
|
||||
@ -3175,6 +3135,7 @@
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
|
||||
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
@ -3624,6 +3585,7 @@
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"isexe": "^2.0.0"
|
||||
},
|
||||
@ -3771,17 +3733,6 @@
|
||||
"integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==",
|
||||
"dev": true
|
||||
},
|
||||
"@mercadoeletronico/wopi-proof-validator": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@mercadoeletronico/wopi-proof-validator/-/wopi-proof-validator-1.0.2.tgz",
|
||||
"integrity": "sha512-ywaC2b/wBWhVSC1E8E2E5KgFg+irsr/WtgkgeiopxNbV56OZdLupaVd7aT/lOb1vppJ55TG+w4kaPFVh1tLn9A==",
|
||||
"requires": {
|
||||
"cross-env": "^6.0.3",
|
||||
"debug": "^4.1.1",
|
||||
"int64-buffer": "^0.99.1007",
|
||||
"rsa-pem-from-mod-exp": "^0.8.4"
|
||||
}
|
||||
},
|
||||
"@nodelib/fs.scandir": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||
@ -4140,18 +4091,11 @@
|
||||
"resolved": "https://registry.npmjs.org/copy-to/-/copy-to-2.0.1.tgz",
|
||||
"integrity": "sha512-3DdaFaU/Zf1AnpLiFDeNCD4TOWe3Zl2RZaTzUvWiIk5ERzcCodOE20Vqq4fzCbNoHURFHT4/us/Lfq+S2zyY4w=="
|
||||
},
|
||||
"cross-env": {
|
||||
"version": "6.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-6.0.3.tgz",
|
||||
"integrity": "sha512-+KqxF6LCvfhWvADcDPqo64yVIB31gv/jQulX2NGzKS/g3GEVz6/pt4wjHFtFWsHMddebWD/sDthJemzM4MaAag==",
|
||||
"requires": {
|
||||
"cross-spawn": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"cross-spawn": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"path-key": "^3.1.0",
|
||||
"shebang-command": "^2.0.0",
|
||||
@ -5089,11 +5033,6 @@
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"int64-buffer": {
|
||||
"version": "0.99.1007",
|
||||
"resolved": "https://registry.npmjs.org/int64-buffer/-/int64-buffer-0.99.1007.tgz",
|
||||
"integrity": "sha512-XDBEu44oSTqlvCSiOZ/0FoUkpWu/vwjJLGSKDabNISPQNZ5wub1FodGHBljRsrR0IXRPq7SslshZYMuA55CgTQ=="
|
||||
},
|
||||
"internal-slot": {
|
||||
"version": "1.0.7",
|
||||
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz",
|
||||
@ -5268,7 +5207,8 @@
|
||||
"isexe": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="
|
||||
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
|
||||
"dev": true
|
||||
},
|
||||
"jake": {
|
||||
"version": "10.8.7",
|
||||
@ -5706,7 +5646,8 @@
|
||||
"path-key": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
|
||||
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="
|
||||
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
|
||||
"dev": true
|
||||
},
|
||||
"path-parse": {
|
||||
"version": "1.0.7",
|
||||
@ -5839,11 +5780,6 @@
|
||||
"glob": "^7.1.3"
|
||||
}
|
||||
},
|
||||
"rsa-pem-from-mod-exp": {
|
||||
"version": "0.8.6",
|
||||
"resolved": "https://registry.npmjs.org/rsa-pem-from-mod-exp/-/rsa-pem-from-mod-exp-0.8.6.tgz",
|
||||
"integrity": "sha512-c5ouQkOvGHF1qomUUDJGFcXsomeSO2gbEs6hVhMAtlkE1CuaZase/WzoaKFG/EZQuNmq6pw/EMCeEnDvOgCJYQ=="
|
||||
},
|
||||
"run-parallel": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
|
||||
@ -6011,6 +5947,7 @@
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"shebang-regex": "^3.0.0"
|
||||
}
|
||||
@ -6018,7 +5955,8 @@
|
||||
"shebang-regex": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
|
||||
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="
|
||||
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
|
||||
"dev": true
|
||||
},
|
||||
"side-channel": {
|
||||
"version": "1.0.4",
|
||||
@ -6346,6 +6284,7 @@
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"isexe": "^2.0.0"
|
||||
}
|
||||
|
||||
@ -14,7 +14,6 @@
|
||||
"url": "https://github.com/ONLYOFFICE/document-server-integration/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mercadoeletronico/wopi-proof-validator": "^1.0.2",
|
||||
"body-parser": "^1.20.3",
|
||||
"config": "^3.3.12",
|
||||
"debug": "^4.3.4",
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
var language;
|
||||
var userid;
|
||||
var directUrl;
|
||||
var formatManager = new FormatManager();
|
||||
var formatManager;
|
||||
|
||||
window.onload = function () {
|
||||
fetch('formats')
|
||||
@ -38,12 +38,7 @@ window.onload = function () {
|
||||
});
|
||||
formatManager = new FormatManager(formats);
|
||||
}
|
||||
});
|
||||
|
||||
var urlScripts = jq("#loadScripts").attr("data-docs");
|
||||
var frame = '<iframe id="iframeScripts" width=1 height=1 style="position: absolute; visibility: hidden;" ></iframe>';
|
||||
jq("#loadScripts").html(frame);
|
||||
jq("#loadScripts iframe").attr("src", urlScripts);
|
||||
})
|
||||
}
|
||||
|
||||
if (typeof jQuery != "undefined") {
|
||||
@ -144,7 +139,7 @@ if (typeof jQuery != "undefined") {
|
||||
|
||||
if (!formatManager.isAutoConvertible(posExt)) {
|
||||
jq("#step2").addClass("done").removeClass("current");
|
||||
onuploaded();
|
||||
loadScripts();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -204,14 +199,35 @@ if (typeof jQuery != "undefined") {
|
||||
checkConvert(filePass, fileType);
|
||||
} else {
|
||||
jq("#step2").addClass("done").removeClass("current");
|
||||
onuploaded();
|
||||
loadScripts();
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
var onuploaded = function () {
|
||||
var loadScripts = function () {
|
||||
if (!jq("#mainProgress").is(":visible")) {
|
||||
return;
|
||||
}
|
||||
jq("#step3").addClass("current");
|
||||
|
||||
if (jq("#loadScripts").is(":empty")) {
|
||||
var urlScripts = jq("#loadScripts").attr("data-docs");
|
||||
var frame = '<iframe id="iframeScripts" width=1 height=1 style="position: absolute; visibility: hidden;" ></iframe>';
|
||||
jq("#loadScripts").html(frame);
|
||||
document.getElementById("iframeScripts").onload = onloadScripts;
|
||||
jq("#loadScripts iframe").attr("src", urlScripts);
|
||||
} else {
|
||||
onloadScripts();
|
||||
}
|
||||
};
|
||||
|
||||
var onloadScripts = function () {
|
||||
if (!jq("#mainProgress").is(":visible")) {
|
||||
return;
|
||||
}
|
||||
jq("#step3").addClass("done").removeClass("current");
|
||||
jq("#beginView, #beginEmbedded").removeClass("disable");
|
||||
|
||||
var fileName = jq("#hiddenFileName").val();
|
||||
@ -260,7 +276,7 @@ if (typeof jQuery != "undefined") {
|
||||
|
||||
jq(document).on("click", "#skipPass", function () {
|
||||
jq("#blockPassword").hide();
|
||||
onuploaded();
|
||||
loadScripts();
|
||||
});
|
||||
|
||||
jq(document).on("click", "#beginEdit:not(.disable)", function () {
|
||||
@ -438,12 +454,14 @@ if (typeof jQuery != "undefined") {
|
||||
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("#hiddenFileName").attr("data",response.filename);
|
||||
jq("#beginEditConverted").removeClass("disable");
|
||||
jq("#beginViewConverted").removeClass("disable");
|
||||
jq("#downloadConverted").attr("data","fromStorage");
|
||||
} else {
|
||||
let newFilename = fileName.split('.').slice(0,-1).join('.')
|
||||
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
|
||||
jq("#downloadConverted").attr("data","fromConverter");
|
||||
}
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
|
||||
@ -60,8 +60,7 @@
|
||||
"group": "<%- editor.userGroup %>",
|
||||
"id": "<%- editor.userid %>",
|
||||
"image": "<%- editor.userImage %>",
|
||||
"name": "<%- editor.name %>",
|
||||
"roles": <%- JSON.stringify(editor.userRoles) %>
|
||||
"name": "<%- editor.name %>"
|
||||
}
|
||||
},
|
||||
"height": "100%",
|
||||
|
||||
@ -225,33 +225,10 @@
|
||||
users = <%- JSON.stringify(usersForMentions) %>;
|
||||
}
|
||||
|
||||
if ((c === "protect" || c === "mention") && users && event.data.count) {
|
||||
let from = event.data.from;
|
||||
let count = event.data.count;
|
||||
let search = event.data.search;
|
||||
if (from != 0) users = [];
|
||||
var resultCount = 234;
|
||||
for (var i = Math.max(users.length, from); i < Math.min(from + count, resultCount); i++){
|
||||
users.push({
|
||||
email: "test@test.test" + (i + 1),
|
||||
id: "id" + (i + 1),
|
||||
name: "test_" + search + (i + 1)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var result = {
|
||||
docEditor.setUsers({
|
||||
"c": c,
|
||||
"users": users,
|
||||
};
|
||||
if (resultCount) {
|
||||
// support v9.0
|
||||
result.total = 1 + (!event.data.count || users.length < event.data.count ? 0 : (event.data.from + event.data.count));
|
||||
// since v9.0.1
|
||||
result.isPaginated = true;
|
||||
}
|
||||
|
||||
docEditor.setUsers(result);
|
||||
});
|
||||
};
|
||||
|
||||
var onRequestSendNotify = function(event) { // the user is mentioned in a comment
|
||||
@ -391,18 +368,6 @@
|
||||
};
|
||||
};
|
||||
|
||||
var onRequestStartFilling = function(event) {
|
||||
var data = event.data;
|
||||
var submit = confirm("Start filling?\n" + JSON.stringify(data));
|
||||
if (submit) {
|
||||
docEditor.startFilling(true);
|
||||
}
|
||||
};
|
||||
|
||||
var onStartFilling = function(event) {
|
||||
innerAlert("The form is ready to fill out.");
|
||||
};
|
||||
|
||||
var onDocumentReady = function(){
|
||||
fixSize();
|
||||
};
|
||||
@ -437,8 +402,6 @@
|
||||
config.events.onRequestReferenceData = onRequestReferenceData;
|
||||
config.events.onRequestReferenceSource = onRequestReferenceSource;
|
||||
config.events.onRequestRefreshFile = onRequestRefreshFile;
|
||||
config.events.onRequestStartFilling = onRequestStartFilling;
|
||||
config.events.onStartFilling = onStartFilling;
|
||||
if (<%- JSON.stringify(editor.userid) %> != "uid-3") {
|
||||
config.events.onRequestHistoryClose = onRequestHistoryClose;
|
||||
config.events.onRequestRestore = onRequestRestore;
|
||||
|
||||
@ -322,7 +322,10 @@
|
||||
<span class="errorPass"></span>
|
||||
<br />
|
||||
</div>
|
||||
<span id="step3" class="step">3. Loading editor scripts.</span>
|
||||
<span class="step-descr">They are loaded only once, they will be cached on your computer.</span>
|
||||
<input type="hidden" name="hiddenFileName" id="hiddenFileName" />
|
||||
<br />
|
||||
<span class="progress-descr">Note the speed of all operations depends on your connection quality and server location.</span>
|
||||
<br />
|
||||
<div class="error-message">
|
||||
|
||||
@ -235,7 +235,11 @@
|
||||
<span class="errorPass"></span>
|
||||
<br />
|
||||
</div>
|
||||
<span id="step3" class="step">3. Loading editor scripts.</span>
|
||||
<span class="step-descr">They are loaded only once, they will be cached on your computer.</span>
|
||||
<input type="hidden" name="hiddenFileName" id="hiddenFileName" />
|
||||
<br />
|
||||
<br />
|
||||
<span class="progress-descr">Note the speed of all operations depends on your connection quality and server location.</span>
|
||||
<br />
|
||||
<br />
|
||||
|
||||
@ -16,7 +16,7 @@ DOCUMENT_STORAGE_DISPLAY_FORGOTTEN_PAGE=false
|
||||
|
||||
## DOCUMENT SERVER ENV VARIABLES
|
||||
|
||||
DOCUMENT_SERVER_VERSION=1.14.0
|
||||
DOCUMENT_SERVER_VERSION=1.13.0
|
||||
|
||||
DOCUMENT_SERVER_PUBLIC_URL=http://localhost:8080
|
||||
DOCUMENT_SERVER_PRIVATE_URL=http://proxy:8080
|
||||
@ -24,13 +24,12 @@ DOCUMENT_SERVER_PRIVATE_URL=http://proxy:8080
|
||||
DOCUMENT_SERVER_API_PATH=web-apps/apps/api/documents/api.js
|
||||
DOCUMENT_SERVER_COMMAND_PATH=command
|
||||
DOCUMENT_SERVER_CONVERTER_PATH=converter
|
||||
DOCUMENT_SERVER_PRELOADER_PATH=web-apps/apps/api/documents/preload.html
|
||||
DOCUMENT_SERVER_PRELOADER_PATH=web-apps/apps/api/documents/cache-scripts.html
|
||||
|
||||
DOCUMENT_SERVER_JWT_HEADER=Authorization
|
||||
DOCUMENT_SERVER_JWT_ALGORITHM=HS256
|
||||
DOCUMENT_SERVER_JWT_USE_FOR_REQUEST=true
|
||||
DOCUMENT_SERVER_JWT_SECRET=secret
|
||||
DOCUMENT_SERVER_JWT_EXPIRATION=5
|
||||
|
||||
DOCUMENT_SERVER_CONVERSION_TIMEOUT=120000
|
||||
|
||||
|
||||
@ -90,11 +90,11 @@ class ReferenceController extends Controller
|
||||
'instanceId' => $storagePublicUrl,
|
||||
],
|
||||
'path' => $filename,
|
||||
'link' => $request->getScheme().'://'.$request->getHost().'/editor?fileID='.$filename,
|
||||
'link' => "$storagePublicUrl/editor?fileID=$filename",
|
||||
];
|
||||
|
||||
if ($settings->getSetting('jwt.enabled')) {
|
||||
$data['token'] = $jwt->jwtEncode($data, $settings->getSetting('jwt.secret'), $settings->getSetting('jwt.expiration'));
|
||||
$data['token'] = $jwt->encode($data, $settings->getSetting('jwt.secret'));
|
||||
}
|
||||
|
||||
return response()->json($data);
|
||||
|
||||