Compare commits

...

104 Commits

Author SHA1 Message Date
5209ea55c0 Document Editors (#40) 2017-11-13 17:54:09 +03:00
fb1715eebc Document Editors (#39)
* Document Editors

* Update OnlineEditorsExampleJS.html
2017-10-31 19:05:29 +03:00
d0bbc736af Merge pull request #37 from ONLYOFFICE/ShockwaveNN-patch-1
Add info about changing http://documentserver
2017-10-20 16:22:58 +03:00
5115995fb9 Update Readme.md 2017-10-20 14:46:33 +03:00
682ed58528 Add info about chaning http://documentserver 2017-10-20 14:37:44 +03:00
2114b23900 Merge pull request #36 from ONLYOFFICE/fix/do-not-use-doc.onlyoffice.com
Do not use https://doc.onlyoffice.com as example
2017-10-20 14:30:12 +03:00
207f896e25 Do not use https://doc.onlyoffice.com as example
It has JWT enabled and will not work without secret keys.
Users should setup their own http://documentserver
2017-10-20 14:26:57 +03:00
983c8829fa editors: permisions modifyFilter 2017-10-19 16:15:39 +03:00
02afb13601 Merge 2017-10-13 14:44:54 +03:00
494bc6b6a4 csharp: remove storage service 2017-10-09 17:39:51 +03:00
72db6178ac java: remove storage service 2017-10-09 17:35:12 +03:00
5c1d925d42 nodejs: remove storage service 2017-10-09 17:33:30 +03:00
fd4dfea7d7 php: remove storage service 2017-10-09 17:31:49 +03:00
ebd309dabc ruby: remove storage service 2017-10-09 17:29:09 +03:00
f376c50fd9 try convert once 2017-10-09 17:16:24 +03:00
6088e7d685 ruby: gemfile up 2017-10-09 17:01:43 +03:00
d143e3c80d ruby: json response 2017-10-09 16:24:09 +03:00
56d6388603 ruby: change track event 2017-10-09 15:47:21 +03:00
54993942bf java: json response 2017-10-06 16:06:41 +03:00
f2301ecbbf java: fix opening editor 2017-10-06 16:06:01 +03:00
f09f62103c java: formatting 2017-10-06 16:05:44 +03:00
75c1cc0c83 v5.0.1 2017-10-05 14:46:28 +03:00
e1e3357748 nodejs: json response 2017-09-28 18:40:18 +03:00
449020a9a4 php: json response 2017-09-28 18:18:23 +03:00
22f2f0f922 mvc: json response 2017-09-28 17:55:01 +03:00
1aa7e73d79 csharp: json response 2017-09-28 17:47:54 +03:00
6eaa290557 Merge branch 'hotfix/v5.0.1' into develop 2017-09-26 14:14:40 +03:00
ed8df66513 support OpenDocument Flat Document file type 2017-09-26 14:11:18 +03:00
16d942a487 support OpenDocument Flat Document file type 2017-09-26 13:24:34 +03:00
5c6d9ec008 v5.0.0 2017-09-19 17:04:59 +03:00
8e7f7c20e4 nodejs: fix opening history without changes 2017-09-14 16:07:53 +03:00
b3f7e9861f Merge remote-tracking branch 'remotes/origin/release/v5.0.0' into develop
# Conflicts:
#	web/documentserver-example/nodejs/config/default.json
#	web/documentserver-example/nodejs/helpers/fileUtility.js
2017-09-07 15:58:30 +03:00
797696ceea Merge branch 'feature/m-formats' into develop 2017-09-07 15:54:54 +03:00
af30096d71 Fix editable formats list 2017-09-07 15:54:14 +03:00
8a7193a645 support template formats 2017-09-07 15:52:47 +03:00
84f5be3556 change viewed formats list 2017-09-07 15:47:47 +03:00
cff90de454 nodejs: edit link only for editable format 2017-09-07 13:51:33 +03:00
18b7bdb401 support convertation -m formats to -x 2017-09-07 12:28:46 +03:00
75155b4c54 Fix Bug 35704 - commenting in review mode 2017-09-06 11:19:11 +03:00
4c3bc0e7ef convert docm,dot,dotm,dotx,xlsm,xlt,xltm,xltx,pot,potm,potx,ppsm,pptm to OOX format 2017-09-06 11:09:29 +03:00
908affc61c Fix Bug 35704 - commenting in review mode 2017-08-28 17:17:45 +03:00
c5b227d278 remove preselected lang value (Bug 35603) 2017-08-28 16:08:32 +03:00
364d24dda2 Added new formats. 2017-08-18 16:37:03 +03:00
74537582d7 support -m formats 2017-08-04 17:39:02 +03:00
8057ef7cbc nodejs: siteUrl 2017-08-03 19:18:47 +03:00
8bab3ecbc6 nodejs: web-apps-pro for development 2017-08-03 16:33:29 +03:00
7e2a12c836 java: delete using javafx.util.Pair 2017-07-31 16:41:47 +03:00
f4ed512fd0 Fix Bug 35281 - reload files list after closing upload dialog by Close button 2017-07-07 17:27:59 +03:00
e729b21dad Merge tag 'v4.4.1' into develop
v4.4.1
2017-07-05 11:49:04 +03:00
26dec26f78 Merge branch 'release/v4.4.1' 2017-07-05 11:48:53 +03:00
c456b697e1 Merge pull request #31 from ONLYOFFICE/develop
Develop
2017-06-28 18:40:04 +03:00
a17b419791 nodejs: comment only mode 2017-06-28 18:09:17 +03:00
25e0d5692f nodejs: additional parameter for review mode 2017-06-28 17:36:47 +03:00
e8559cf67c nodejs: fix review mode 2017-06-28 17:36:17 +03:00
2882366ed6 Update Readme.md 2017-06-28 17:27:09 +03:00
30829683ed Merge pull request #30 from ONLYOFFICE/fix/pptx-sample-lang
Update `new.pptx` files
2017-06-27 14:02:44 +03:00
0988e10500 Update new.pptx files
Old files were set with Russian language as default lang
for spellchecker.
Updated files were made by Denis Spitsyn.
2017-06-27 13:51:31 +03:00
af7dcbb700 corrected license type to MIT 2017-06-26 18:04:43 +03:00
ba1358c116 Copyright 2017-06-26 16:29:01 +03:00
0325c421bf java: revert some changes 2017-06-23 13:29:41 +03:00
9ee88881bf php: encoding 2017-06-23 11:41:06 +03:00
5d5ef36b48 mvc: include dependencies 2017-06-23 11:40:21 +03:00
6d4cf2089e Merge pull request #29 from ONLYOFFICE/feature/java
Feature/java
2017-06-23 11:38:52 +03:00
e7f492242f java: processing empty parameters 2017-06-13 19:11:08 +03:00
022acfb9cd Merge tag 'v4.3.5' into develop
v4.3.5 v4.3.5
2017-06-05 16:49:44 +03:00
66c19c1b89 qBBBBBBBBBAAAAAMerge branch 'hotfix/v4.3.5' 2017-06-05 16:49:28 +03:00
a32be5a464 java: ignore 2017-06-02 17:46:34 +03:00
f7a83caa64 java: URLEncoder.encode(string) is deprecated 2017-06-02 17:46:34 +03:00
899116b114 java: response from callback "error:0" 2017-06-02 17:46:24 +03:00
7d5d444108 java: closing scanner 2017-06-02 17:45:51 +03:00
bd3cb77bb6 java: project file 2017-06-02 17:14:54 +03:00
5e14e4d04f java: Fixed unused code 2017-06-02 17:14:31 +03:00
bbd8305ad9 nodejs: error when save deleted file 2017-05-18 19:53:56 +03:00
c5b6b7ab1b nodejs: use the date when creating the key 2017-05-18 19:53:23 +03:00
c854249add Merge pull request #27 from ONLYOFFICE/feature/nssm-startup
fixed crash on windows 2008r2
2017-05-16 13:10:59 +03:00
837b56b20f fixed crash on windows 2008r2 2017-05-15 16:36:58 +03:00
80b081883e Fix Bug 34711 - css iPhone4s 2017-04-27 15:46:19 +03:00
7c71d42975 Fix download link for custom EXAMPLE_URL (Issue #24) 2017-04-25 19:28:43 +03:00
a52d5cb3be Fix Bug 33758 - replacing address for document server (exampleUrl) 2017-04-25 18:30:39 +03:00
a9d261a0ad Fix Bug 34620 - resize on mobile 2017-04-25 17:55:45 +03:00
5dea4c77a9 Fix Bug 34739 - encode ' 2017-04-25 17:42:51 +03:00
8eb017b092 nodejs: plugins new format 2017-04-25 17:08:04 +03:00
dd346a380e Merge tag 'v4.3.2' into develop
v4.3.2 v4.3.2
2017-04-17 14:59:31 +03:00
61497a8da7 Merge branch 'hotfix/v4.3.2' 2017-04-17 14:59:29 +03:00
34d568bdbc Fix goback button 2017-04-06 18:42:18 +03:00
905084dc52 Fix goback button 2017-04-06 17:22:13 +03:00
e00b662660 Merge tag 'v4.3.0' into develop
v4.3.0
2017-04-03 12:58:54 +03:00
5ded3f6135 Merge branch 'release/v4.3.0' 2017-04-03 12:58:44 +03:00
a096e96b29 Fix Bug 34518 - "Uncaught SyntaxError: Unexpected token }" 2017-03-27 14:31:58 +03:00
b452a171d1 nodejs: append dependencies 2017-03-21 10:40:03 +03:00
282ea78799 Merge pull request #22 from ONLYOFFICE/feature/forcesave
Feature/forcesave
2017-03-16 15:58:38 +03:00
4824373678 nodejs: forcesave configuration for new sсheme editing 2017-03-16 15:57:07 +03:00
df8a575d75 ignore vscode 2017-03-16 15:54:40 +03:00
e023ec3bb7 nodejs: download forcesaved file, delete forcesaved file after saving 2017-03-16 14:53:12 +03:00
535ba03cdf nodejs: download file via handler 2017-03-16 14:36:34 +03:00
f5d416e371 nodejs: forcesave to history directory 2017-03-16 14:03:22 +03:00
931e05a175 nodejs: jwt for historyData 2017-03-15 17:54:04 +03:00
293919bb6e nodejs: new arguments in setHistoryData 2017-03-15 17:46:34 +03:00
35c4dd6a95 Disabled jwt 2017-03-03 17:34:24 +03:00
32aff45d7d Merge pull request #21 from ONLYOFFICE/feature/token
Feature/token
2017-03-03 16:54:38 +03:00
1b73970ebc node: jwt 2017-03-03 16:48:45 +03:00
c014250479 node: moved config in a separate file 2017-03-02 19:38:24 +03:00
b1e216da88 node: upload request without file 2017-03-02 18:52:20 +03:00
257bf005eb Removed plugins form config 2017-02-28 15:57:08 +03:00
113 changed files with 2144 additions and 2364 deletions

5
.gitignore vendored
View File

@ -4,8 +4,9 @@
*.user
/build/deploy
/build/*.log
/web/documentserver-example/csharp-mvc/packages
/web/documentserver-example/nodejs/node_modules
/web/documentserver-example/nodejs/public/files
/web/documentserver-example/nodejs/config/local.json
**/.idea
**/.vscode/
**/.idea
/web/documentserver-example/java/target/

View File

@ -1,9 +1,17 @@
[![License](https://img.shields.io/badge/License-MIT-green.svg?style=flat)](http://www.gnu.org/licenses/agpl-3.0.ru.html) ![Release](https://img.shields.io/badge/Release-v4.1.2-blue.svg?style=flat)
[![License](https://img.shields.io/badge/License-MIT-green.svg?style=flat)](https://opensource.org/licenses/MIT) ![Release](https://img.shields.io/badge/Release-v4.1.2-blue.svg?style=flat)
## Document Server integration example
These examples show the way to integrate [ONLYOFFICE Document Server][2] into your own website or application using one of the programming languages. The package contains examples written in .Net (C# MVC), .Net (C#), Java, Node.js, PHP and Ruby.
These examples show the way to integrate [ONLYOFFICE Document Server][2] into your own website or application using one of the programming languages. The package contains examples written in .Net (C# MVC), .Net (C#), Java, Node.js, PHP and Ruby.
You should change `http://documentserver` to your server address in these files:
* .Net (C# MVC) - `web/documentserver-example/csharp-mvc/web.appsettings.config`
* .Net (C#) - `web/documentserver-example/csharp/settings.config`
* Java - `web/documentserver-example/java/src/main/resources/settings.properties`
* Node.js - `web/documentserver-example/nodejs/config/default.json`
* PHP - `web/documentserver-example/php/config.php`
* Ruby - `web/documentserver-example/ruby/config/application.rb`
More information on how to use these examples can be found here: [http://api.onlyoffice.com/editors/demopreview](http://api.onlyoffice.com/editors/demopreview "http://api.onlyoffice.com/editors/demopreview")

View File

@ -14,12 +14,12 @@
<Target Name="Build">
<ItemGroup>
<ZipFilesCSharp Include="$(DirCSharp)**" Exclude="$(DirCSharp)obj\**;" />
<ZipFilesCSharp Include="$(DirCSharp)**" Exclude="$(DirCSharp)obj\**" />
</ItemGroup>
<Zip Files="@(ZipFilesCSharp)" WorkingDirectory="$(DirCSharp)" ZipFileName="$(To).Net (C#) Example.zip" />
<ItemGroup>
<ZipFilesMVC Include="$(DirMvc)**" Exclude="$(DirMvc)obj\**;$(DirMvc)packages\**;" />
<ZipFilesMVC Include="$(DirMvc)**" Exclude="$(DirMvc)obj\**" />
</ItemGroup>
<Zip Files="@(ZipFilesMVC)" WorkingDirectory="$(DirMvc)" ZipFileName="$(To).Net (C# MVC) Example.zip" />

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>

View File

@ -1,144 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir>
<!-- Enable the restore command to run before builds -->
<RestorePackages Condition=" '$(RestorePackages)' == '' ">false</RestorePackages>
<!-- Property that enables building a package from a project -->
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
<!-- Determines if package restore consent is required to restore packages -->
<RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
<!-- Download NuGet.exe if it does not already exist -->
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">false</DownloadNuGetExe>
</PropertyGroup>
<ItemGroup Condition=" '$(PackageSources)' == '' ">
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
<!--
<PackageSource Include="https://www.nuget.org/api/v2/" />
<PackageSource Include="https://my-nuget-source/nuget/" />
-->
</ItemGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
<!-- Windows specific commands -->
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
</PropertyGroup>
<PropertyGroup>
<PackagesProjectConfig Condition=" '$(OS)' == 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config</PackagesProjectConfig>
<PackagesProjectConfig Condition=" '$(OS)' != 'Windows_NT'">$(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config</PackagesProjectConfig>
</PropertyGroup>
<PropertyGroup>
<PackagesConfig Condition="Exists('$(MSBuildProjectDirectory)\packages.config')">$(MSBuildProjectDirectory)\packages.config</PackagesConfig>
<PackagesConfig Condition="Exists('$(PackagesProjectConfig)')">$(PackagesProjectConfig)</PackagesConfig>
</PropertyGroup>
<PropertyGroup>
<!-- NuGet command -->
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 "$(NuGetExePath)"</NuGetCommand>
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
<!-- Commands -->
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
<!-- We need to ensure packages are restored prior to assembly resolve -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
RestorePackages;
$(BuildDependsOn);
</BuildDependsOn>
<!-- Make the build depend on restore packages -->
<BuildDependsOn Condition="$(BuildPackage) == 'true'">
$(BuildDependsOn);
BuildPackage;
</BuildDependsOn>
</PropertyGroup>
<Target Name="CheckPrerequisites">
<!-- Raise an error if we're unable to locate nuget.exe -->
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
<!--
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
This effectively acts as a lock that makes sure that the download operation will only happen once and all
parallel builds will have to wait for it to complete.
-->
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
</Target>
<Target Name="_DownloadNuGet">
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
</Target>
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(RestoreCommand)"
Condition="'$(OS)' != 'Windows_NT' And Exists('$(PackagesConfig)')" />
<Exec Command="$(RestoreCommand)"
LogStandardErrorAsError="true"
Condition="'$(OS)' == 'Windows_NT' And Exists('$(PackagesConfig)')" />
</Target>
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites">
<Exec Command="$(BuildCommand)"
Condition=" '$(OS)' != 'Windows_NT' " />
<Exec Command="$(BuildCommand)"
LogStandardErrorAsError="true"
Condition=" '$(OS)' == 'Windows_NT' " />
</Target>
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<OutputFilename ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Net" />
<Using Namespace="Microsoft.Build.Framework" />
<Using Namespace="Microsoft.Build.Utilities" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
OutputFilename = Path.GetFullPath(OutputFilename);
Log.LogMessage("Downloading latest version of NuGet.exe...");
WebClient webClient = new WebClient();
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
return true;
}
catch (Exception ex) {
Log.LogErrorFromException(ex);
return false;
}
]]>
</Code>
</Task>
</UsingTask>
</Project>

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
@ -28,10 +29,8 @@ using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Configuration;
using System.Xml;
using System.Xml.Linq;
using System.Web.Helpers;
namespace OnlineEditorsExampleMVC.Helpers
{
@ -46,7 +45,6 @@ namespace OnlineEditorsExampleMVC.Helpers
static ServiceConverter()
{
DocumentConverterUrl = WebConfigurationManager.AppSettings["files.docservice.url.converter"] ?? "";
DocumentStorageUrl = WebConfigurationManager.AppSettings["files.docservice.url.storage"] ?? "";
Int32.TryParse(WebConfigurationManager.AppSettings["files.docservice.timeout"], out ConvertTimeout);
ConvertTimeout = ConvertTimeout > 0 ? ConvertTimeout : 120000;
@ -64,21 +62,6 @@ namespace OnlineEditorsExampleMVC.Helpers
/// </summary>
private static readonly string DocumentConverterUrl;
/// <summary>
/// Url to the service of storage
/// </summary>
private static readonly string DocumentStorageUrl;
/// <summary>
/// The parameters for the query conversion
/// </summary>
private const string ConvertParams = "?url={0}&outputtype={1}&filetype={2}&title={3}&key={4}";
/// <summary>
/// Number of tries request conversion
/// </summary>
private const int MaxTry = 3;
#endregion
#region public method
@ -107,74 +90,51 @@ namespace OnlineEditorsExampleMVC.Helpers
out string convertedDocumentUri)
{
convertedDocumentUri = string.Empty;
var responceFromConvertService =
SendRequestToConvertService(documentUri, fromExtension, toExtension, documentRevisionId, isAsync)
.Root;
var errorElement = responceFromConvertService.Element("Error");
if (errorElement != null)
ProcessConvertServiceResponceError(Convert.ToInt32(errorElement.Value));
fromExtension = string.IsNullOrEmpty(fromExtension) ? Path.GetExtension(documentUri) : fromExtension;
var isEndConvert = Convert.ToBoolean(responceFromConvertService.Element("EndConvert").Value);
var percent = Convert.ToInt32(responceFromConvertService.Element("Percent").Value);
var title = Path.GetFileName(documentUri);
title = string.IsNullOrEmpty(title) ? Guid.NewGuid().ToString() : title;
if (isEndConvert)
{
convertedDocumentUri = responceFromConvertService.Element("FileUrl").Value;
percent = 100;
}
else
{
percent = percent >= 100 ? 99 : percent;
}
documentRevisionId = string.IsNullOrEmpty(documentRevisionId)
? documentUri
: documentRevisionId;
documentRevisionId = GenerateRevisionId(documentRevisionId);
return percent;
}
/// <summary>
/// Placing the document in the storage service
/// </summary>
/// <param name="fileStream">Stream of document</param>
/// <param name="contentLength">Length of stream</param>
/// <param name="contentType">Mime type</param>
/// <param name="documentRevisionId">Key for caching on service, whose used in editor</param>
/// <returns>Uri to document in the storage</returns>
public static string GetExternalUri(
Stream fileStream,
long contentLength,
string contentType,
string documentRevisionId)
{
var urlDocumentService = DocumentStorageUrl + ConvertParams;
var urlTostorage = String.Format(urlDocumentService,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
documentRevisionId);
var request = (HttpWebRequest)WebRequest.Create(urlTostorage);
var request = (HttpWebRequest)WebRequest.Create(DocumentConverterUrl);
request.Method = "POST";
request.ContentType = contentType;
request.ContentLength = contentLength;
request.ContentType = "application/json";
request.Accept = "application/json";
request.Timeout = ConvertTimeout;
const int bufferSize = 2048;
var buffer = new byte[bufferSize];
int readed;
while ((readed = fileStream.Read(buffer, 0, bufferSize)) > 0)
var bodyString = string.Format("{{\"async\": {0},\"filetype\": \"{1}\",\"key\": \"{2}\",\"outputtype\": \"{3}\",\"title\": \"{4}\",\"url\": \"{5}\"}}",
isAsync.ToString().ToLower(),
fromExtension.Trim('.'),
documentRevisionId,
toExtension.Trim('.'),
title,
documentUri);
var bytes = Encoding.UTF8.GetBytes(bodyString);
request.ContentLength = bytes.Length;
using (var requestStream = request.GetRequestStream())
{
request.GetRequestStream().Write(buffer, 0, readed);
requestStream.Write(bytes, 0, bytes.Length);
}
string dataResponse;
using (var response = request.GetResponse())
using (var stream = response.GetResponseStream())
{
if (stream == null) throw new WebException("Could not get an answer");
var xDocumentResponse = XDocument.Load(new XmlTextReader(stream));
string externalUri;
GetResponseUri(xDocumentResponse, out externalUri);
return externalUri;
if (stream == null) throw new Exception("Response is null");
using (var reader = new StreamReader(stream))
{
dataResponse = reader.ReadToEnd();
}
}
return GetResponseUri(dataResponse, out convertedDocumentUri);
}
/// <summary>
@ -194,77 +154,44 @@ namespace OnlineEditorsExampleMVC.Helpers
#region private method
/// <summary>
/// Request for conversion to a service
/// Processing document received from the editing service
/// </summary>
/// <param name="documentUri">Uri for the document to convert</param>
/// <param name="fromExtension">Document extension</param>
/// <param name="toExtension">Extension to which to convert</param>
/// <param name="documentRevisionId">Key for caching on service</param>
/// <param name="isAsync">Perform conversions asynchronously</param>
/// <returns>Xml document request result of conversion</returns>
private static XDocument SendRequestToConvertService(string documentUri, string fromExtension, string toExtension, string documentRevisionId, bool isAsync)
/// <param name="jsonDocumentResponse">The resulting json from editing service</param>
/// <param name="responseUri">Uri to the converted document</param>
/// <returns>The percentage of completion of conversion</returns>
private static int GetResponseUri(string jsonDocumentResponse, out string responseUri)
{
fromExtension = string.IsNullOrEmpty(fromExtension) ? Path.GetExtension(documentUri) : fromExtension;
if (string.IsNullOrEmpty(jsonDocumentResponse)) throw new ArgumentException("Invalid param", "jsonDocumentResponse");
var title = Path.GetFileName(documentUri);
title = string.IsNullOrEmpty(title) ? Guid.NewGuid().ToString() : title;
var responseFromService = Json.Decode(jsonDocumentResponse);
if (jsonDocumentResponse == null) throw new WebException("Invalid answer format");
documentRevisionId = string.IsNullOrEmpty(documentRevisionId)
? documentUri
: documentRevisionId;
documentRevisionId = GenerateRevisionId(documentRevisionId);
var errorElement = responseFromService.error;
if (errorElement != null) ProcessResponseError(Convert.ToInt32(errorElement));
var req = (HttpWebRequest)WebRequest.Create(DocumentConverterUrl);
req.Method = "POST";
req.ContentType = "text/json";
req.Timeout = ConvertTimeout;
var isEndConvert = responseFromService.endConvert;
var bodyString = string.Format("{{\"async\": {0},\"filetype\": \"{1}\",\"key\": \"{2}\",\"outputtype\": \"{3}\",\"title\": \"{4}\",\"url\": \"{5}\"}}",
isAsync.ToString().ToLower(),
fromExtension.Trim('.'),
documentRevisionId,
toExtension.Trim('.'),
title,
documentUri);
var bytes = Encoding.UTF8.GetBytes(bodyString);
req.ContentLength = bytes.Length;
using (var requestStream = req.GetRequestStream())
int resultPercent;
responseUri = string.Empty;
if (isEndConvert)
{
requestStream.Write(bytes, 0, bytes.Length);
responseUri = responseFromService.fileUrl;
resultPercent = 100;
}
else
{
resultPercent = responseFromService.percent;
if (resultPercent >= 100) resultPercent = 99;
}
Stream stream = null;
var countTry = 0;
while (countTry < MaxTry)
{
try
{
countTry++;
stream = req.GetResponse().GetResponseStream();
break;
}
catch (WebException ex)
{
if (ex.Status != WebExceptionStatus.Timeout)
{
throw new HttpException((int) HttpStatusCode.BadRequest, "Bad Request", ex);
}
}
}
if (countTry == MaxTry)
{
throw new WebException("Timeout", WebExceptionStatus.Timeout);
}
return XDocument.Load(new XmlTextReader(stream));
return resultPercent;
}
/// <summary>
/// Generate an error code table
/// </summary>
/// <param name="errorCode">Error code</param>
private static void ProcessConvertServiceResponceError(int errorCode)
private static void ProcessResponseError(int errorCode)
{
var errorMessage = string.Empty;
const string errorMessageTemplate = "Error occurred in the ConvertService.ashx: {0}";
@ -314,45 +241,6 @@ namespace OnlineEditorsExampleMVC.Helpers
throw new Exception(errorMessage);
}
/// <summary>
/// Processing document received from the editing service
/// </summary>
/// <param name="xDocumentResponse">The resulting xml from editing service</param>
/// <param name="responseUri">Uri to the converted document</param>
/// <returns>The percentage of completion of conversion</returns>
private static int GetResponseUri(XDocument xDocumentResponse, out string responseUri)
{
var responceFromConvertService = xDocumentResponse.Root;
if (responceFromConvertService == null) throw new WebException("Invalid answer format");
var errorElement = responceFromConvertService.Element("Error");
if (errorElement != null) ProcessConvertServiceResponceError(Convert.ToInt32(errorElement.Value));
var endConvert = responceFromConvertService.Element("EndConvert");
if (endConvert == null) throw new WebException("Invalid answer format");
var isEndConvert = Convert.ToBoolean(endConvert.Value);
var resultPercent = 0;
responseUri = string.Empty;
if (isEndConvert)
{
var fileUrl = responceFromConvertService.Element("FileUrl");
if (fileUrl == null) throw new WebException("Invalid answer format");
responseUri = fileUrl.Value;
resultPercent = 100;
}
else
{
var percent = responceFromConvertService.Element("Percent");
if (percent != null)
resultPercent = Convert.ToInt32(percent.Value);
resultPercent = resultPercent >= 100 ? 99 : resultPercent;
}
return resultPercent;
}
#endregion
}
}

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
@ -50,22 +51,26 @@ namespace OnlineEditorsExampleMVC.Models
public static readonly List<string> ExtsDocument = new List<string>
{
".docx", ".doc", ".odt", ".rtf", ".txt",
".html", ".htm", ".mht", ".pdf", ".djvu",
".fb2", ".epub", ".xps"
".doc", ".docx", ".docm",
".dot", ".dotx", ".dotm",
".odt", ".fodt", ".rtf", ".txt",
".html", ".htm", ".mht",
".pdf", ".djvu", ".fb2", ".epub", ".xps"
};
public static readonly List<string> ExtsSpreadsheet = new List<string>
{
".xls", ".xlsx",
".ods", ".csv"
".xls", ".xlsx", ".xlsm",
".xlt", ".xltx", ".xltm",
".ods", ".fods", ".csv"
};
public static readonly List<string> ExtsPresentation = new List<string>
{
".pps", ".ppsx",
".ppt", ".pptx",
".odp"
".pps", ".ppsx", ".ppsm",
".ppt", ".pptx", ".pptm",
".pot", ".potx", ".potm",
".odp", ".fodp"
};
}
}

View File

@ -20,8 +20,6 @@
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">.\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -51,69 +49,80 @@
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="EntityFramework">
<HintPath>packages\EntityFramework.5.0.0\lib\net45\EntityFramework.dll</HintPath>
<Private>True</Private>
<HintPath>bin\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.Infrastructure">
<Private>True</Private>
<HintPath>packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
<HintPath>bin\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Web.Mvc.FixedDisplayModes">
<Private>True</Private>
<HintPath>packages\Microsoft.AspNet.Mvc.FixedDisplayModes.1.0.0\lib\net40\Microsoft.Web.Mvc.FixedDisplayModes.dll</HintPath>
<HintPath>bin\Microsoft.Web.Mvc.FixedDisplayModes.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
<HintPath>bin\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http">
</Reference>
<Reference Include="System.Net.Http.Formatting">
<HintPath>packages\Microsoft.AspNet.WebApi.Client.5.2.0\lib\net45\System.Net.Http.Formatting.dll</HintPath>
<Private>True</Private>
<HintPath>bin\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest">
</Reference>
<Reference Include="System.Web.Http">
<HintPath>packages\Microsoft.AspNet.WebApi.Core.5.2.0\lib\net45\System.Web.Http.dll</HintPath>
<Private>True</Private>
<HintPath>bin\System.Web.Http.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.WebHost">
<HintPath>packages\Microsoft.AspNet.WebApi.WebHost.5.2.0\lib\net45\System.Web.Http.WebHost.dll</HintPath>
<Private>True</Private>
<HintPath>bin\System.Web.Http.WebHost.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc">
<HintPath>packages\Microsoft.AspNet.Mvc.5.2.0\lib\net45\System.Web.Mvc.dll</HintPath>
<Private>True</Private>
<HintPath>bin\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Optimization">
<HintPath>packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
<Private>True</Private>
<HintPath>bin\System.Web.Optimization.dll</HintPath>
</Reference>
<Reference Include="System.Web.Providers">
<HintPath>packages\Microsoft.AspNet.Providers.Core.1.2\lib\net40\System.Web.Providers.dll</HintPath>
<Private>True</Private>
<HintPath>bin\System.Web.Providers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor">
<HintPath>packages\Microsoft.AspNet.Razor.3.2.0\lib\net45\System.Web.Razor.dll</HintPath>
<Private>True</Private>
<HintPath>bin\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.Helpers">
<HintPath>packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.Helpers.dll</HintPath>
<Private>True</Private>
<HintPath>bin\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages">
<HintPath>packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.WebPages.dll</HintPath>
<Private>True</Private>
<HintPath>bin\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment">
<HintPath>packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
<Private>True</Private>
<HintPath>bin\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor">
<HintPath>packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
<Private>True</Private>
<HintPath>bin\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="WebGrease">
<Private>True</Private>
<HintPath>packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath>
<HintPath>bin\WebGrease.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@ -170,8 +179,7 @@
<Content Include="licenses\Microsoft.Web.Infrastructure.license" />
<Content Include="licenses\Newtonsoft.Json.license" />
<Content Include="licenses\WebGrease.license" />
<None Include="packages.config" />
<None Include="web.appsettings.config" />
<Content Include="web.appsettings.config" />
<Content Include="WebEditor.ashx" />
</ItemGroup>
<ItemGroup>
@ -205,13 +213,6 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*-->

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*-->
@ -46,10 +47,10 @@
<body>
<div class="top-panel"></div>
<div class="main-panel">
<span class="portal-name">ONLYOFFICE Online Editors</span>
<span class="portal-name">ONLYOFFICE Document Editors</span>
<br />
<br />
<span class="portal-descr">Get started with a demo-sample of ONLYOFFICE Online Editors, the first html5-based editors. You may upload your own documents for testing using the "Choose file" button and selecting the necessary files on your PC.</span>
<span class="portal-descr">Get started with a demo-sample of ONLYOFFICE Document Editors, the first html5-based editors. You may upload your own documents for testing using the "Choose file" button and selecting the necessary files on your PC.</span>
<div class="file-upload button gray">
<span>Choose file</span>

View File

@ -31,11 +31,11 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
<bindingRedirect oldVersion="1.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
<bindingRedirect oldVersion="1.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
<bindingRedirect oldVersion="1.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />
</dependentAssembly>
</assemblyBinding>
</runtime>

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -1,16 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="5.0.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc" version="5.2.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc.FixedDisplayModes" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="3.2.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" />
<package id="Microsoft.AspNet.Providers.Core" version="1.2.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="3.2.0" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
<package id="WebGrease" version="1.5.2" targetFramework="net45" />
</packages>

View File

@ -9,13 +9,12 @@
<add key="filesize-max" value="5242880"/>
<add key="files.docservice.viewed-docs" value=".ppt|.pps|.odp|.pdf|.djvu|.epub|.xps"/>
<add key="files.docservice.edited-docs" value=".docx|.doc|.odt|.xlsx|.xls|.ods|.csv|.pptx|.ppsx|.rtf|.txt|.mht|.html|.htm"/>
<add key="files.docservice.convert-docs" value=".doc|.odt|.xls|.ods|.ppt|.pps|.odp|.rtf|.mht|.html|.htm|.epub"/>
<add key="files.docservice.viewed-docs" value=".pdf|.djvu|.xps"/>
<add key="files.docservice.edited-docs" value=".docx|.xlsx|.csv|.pptx|.ppsx|.txt"/>
<add key="files.docservice.convert-docs" value=".docm|.dotx|.dotm|.dot|.doc|.odt|.fodt|.xlsm|.xltx|.xltm|.xlt|.xls|.ods|.fods|.pptm|.ppt|.ppsm|.pps|.potx|.potm|.pot|.odp|.fodp|.rtf|.mht|.html|.htm|.epub"/>
<add key="files.docservice.timeout" value="120000" />
<add key="files.docservice.url.storage" value="https://doc.onlyoffice.com/FileUploader.ashx"/>
<add key="files.docservice.url.converter" value="https://doc.onlyoffice.com/ConvertService.ashx"/>
<add key="files.docservice.url.api" value="https://doc.onlyoffice.com/web-apps/apps/api/documents/api.js"/>
<add key="files.docservice.url.preloader" value="https://doc.onlyoffice.com/web-apps/apps/api/documents/cache-scripts.html"/>
<add key="files.docservice.url.converter" value="http://documentserver/ConvertService.ashx"/>
<add key="files.docservice.url.api" value="http://documentserver/web-apps/apps/api/documents/api.js"/>
<add key="files.docservice.url.preloader" value="http://documentserver/web-apps/apps/api/documents/cache-scripts.html"/>
</appSettings>

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -43,10 +43,10 @@
<div class="top-panel"></div>
<div class="main-panel">
<span class="portal-name">ONLYOFFICE Online Editors</span>
<span class="portal-name">ONLYOFFICE Document Editors</span>
<br />
<br />
<span class="portal-descr">Get started with a demo-sample of ONLYOFFICE Online Editors, the first html5-based editors. You may upload your own documents for testing using the "Choose file" button and selecting the necessary files on your PC.</span>
<span class="portal-descr">Get started with a demo-sample of ONLYOFFICE Document Editors, the first html5-based editors. You may upload your own documents for testing using the "Choose file" button and selecting the necessary files on your PC.</span>
<div class="file-upload button gray">
<span>Choose file</span>
@ -99,7 +99,7 @@
if (examples.Any())
{ %>
<br />
Download the code for the sample of ONLYOFFICE Online Editors to find out the details.
Download the code for the sample of ONLYOFFICE Document Editors to find out the details.
<br />
<br />
<% foreach (var example in examples)

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
@ -41,22 +42,26 @@ namespace OnlineEditorsExample
{
public static readonly List<string> ExtsSpreadsheet = new List<string>
{
".xls", ".xlsx",
".ods", ".csv"
".xls", ".xlsx", ".xlsm",
".xlt", ".xltx", ".xltm",
".ods", ".fods", ".csv"
};
public static readonly List<string> ExtsPresentation = new List<string>
{
".pps", ".ppsx",
".ppt", ".pptx",
".odp"
".pps", ".ppsx", ".ppsm",
".ppt", ".pptx", ".pptm",
".pot", ".potx", ".potm",
".odp", ".fodp"
};
public static readonly List<string> ExtsDocument = new List<string>
{
".docx", ".doc", ".odt", ".rtf", ".txt",
".html", ".htm", ".mht", ".pdf", ".djvu",
".fb2", ".epub", ".xps"
".doc", ".docx", ".docm",
".dot", ".dotx", ".dotm",
".odt", ".fodt", ".rtf", ".txt",
".html", ".htm", ".mht",
".pdf", ".djvu", ".fb2", ".epub", ".xps"
};
public static string GetInternalExtension(string extension)

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,37 +2,36 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
using System.Text;
using OnlineEditorsExample;
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Configuration;
using System.Xml;
using System.Xml.Linq;
using System.Web.Helpers;
using OnlineEditorsExample;
namespace ASC.Api.DocumentConverter
{
@ -47,7 +46,6 @@ namespace ASC.Api.DocumentConverter
static ServiceConverter()
{
DocumentConverterUrl = WebConfigurationManager.AppSettings["files.docservice.url.converter"] ?? "";
DocumentStorageUrl = WebConfigurationManager.AppSettings["files.docservice.url.storage"] ?? "";
Int32.TryParse(WebConfigurationManager.AppSettings["files.docservice.timeout"], out ConvertTimeout);
ConvertTimeout = ConvertTimeout > 0 ? ConvertTimeout : 120000;
@ -65,21 +63,6 @@ namespace ASC.Api.DocumentConverter
/// </summary>
private static readonly string DocumentConverterUrl;
/// <summary>
/// Url to the service of storage
/// </summary>
private static readonly string DocumentStorageUrl;
/// <summary>
/// The parameters for the query conversion
/// </summary>
private const string ConvertParams = "?url={0}&outputtype={1}&filetype={2}&title={3}&key={4}";
/// <summary>
/// Number of tries request conversion
/// </summary>
private const int MaxTry = 3;
#endregion
#region public method
@ -108,63 +91,36 @@ namespace ASC.Api.DocumentConverter
out string convertedDocumentUri)
{
convertedDocumentUri = string.Empty;
var responceFromConvertService =
SendRequestToConvertService(documentUri, fromExtension, toExtension, documentRevisionId, isAsync)
.Root;
var errorElement = responceFromConvertService.Element("Error");
if (errorElement != null)
ProcessConvertServiceResponceError(Convert.ToInt32(errorElement.Value));
fromExtension = string.IsNullOrEmpty(fromExtension) ? Path.GetExtension(documentUri) : fromExtension;
var isEndConvert = Convert.ToBoolean(responceFromConvertService.Element("EndConvert").Value);
var percent = Convert.ToInt32(responceFromConvertService.Element("Percent").Value);
var title = Path.GetFileName(documentUri);
title = string.IsNullOrEmpty(title) ? Guid.NewGuid().ToString() : title;
if (isEndConvert)
{
convertedDocumentUri = responceFromConvertService.Element("FileUrl").Value;
percent = 100;
}
else
{
percent = percent >= 100 ? 99 : percent;
}
documentRevisionId = string.IsNullOrEmpty(documentRevisionId)
? documentUri
: documentRevisionId;
documentRevisionId = GenerateRevisionId(documentRevisionId);
return percent;
}
/// <summary>
/// Placing the document in the storage service
/// </summary>
/// <param name="fileStream">Stream of document</param>
/// <param name="contentLength">Length of stream</param>
/// <param name="contentType">Mime type</param>
/// <param name="documentRevisionId">Key for caching on service, whose used in editor</param>
/// <returns>Uri to document in the storage</returns>
public static string GetExternalUri(
Stream fileStream,
long contentLength,
string contentType,
string documentRevisionId)
{
var urlDocumentService = DocumentStorageUrl + ConvertParams;
var urlTostorage = String.Format(urlDocumentService,
string.Empty,
string.Empty,
string.Empty,
string.Empty,
documentRevisionId);
var request = (HttpWebRequest)WebRequest.Create(urlTostorage);
var request = (HttpWebRequest)WebRequest.Create(DocumentConverterUrl);
request.Method = "POST";
request.ContentType = contentType;
request.ContentLength = contentLength;
request.ContentType = "application/json";
request.Accept = "application/json";
request.Timeout = ConvertTimeout;
const int bufferSize = 2048;
var buffer = new byte[bufferSize];
int readed;
while ((readed = fileStream.Read(buffer, 0, bufferSize)) > 0)
var bodyString = string.Format("{{\"async\": {0},\"filetype\": \"{1}\",\"key\": \"{2}\",\"outputtype\": \"{3}\",\"title\": \"{4}\",\"url\": \"{5}\"}}",
isAsync.ToString().ToLower(),
fromExtension.Trim('.'),
documentRevisionId,
toExtension.Trim('.'),
title,
documentUri);
var bytes = Encoding.UTF8.GetBytes(bodyString);
request.ContentLength = bytes.Length;
using (var requestStream = request.GetRequestStream())
{
request.GetRequestStream().Write(buffer, 0, readed);
requestStream.Write(bytes, 0, bytes.Length);
}
// hack. http://ubuntuforums.org/showthread.php?t=1841740
@ -173,15 +129,19 @@ namespace ASC.Api.DocumentConverter
ServicePointManager.ServerCertificateValidationCallback += (s, ce, ca, p) => true;
}
string dataResponse;
using (var response = request.GetResponse())
using (var stream = response.GetResponseStream())
{
if (stream == null) throw new WebException("Could not get an answer");
var xDocumentResponse = XDocument.Load(new XmlTextReader(stream));
string externalUri;
GetResponseUri(xDocumentResponse, out externalUri);
return externalUri;
if (stream == null) throw new Exception("Response is null");
using (var reader = new StreamReader(stream))
{
dataResponse = reader.ReadToEnd();
}
}
return GetResponseUri(dataResponse, out convertedDocumentUri);
}
/// <summary>
@ -199,85 +159,46 @@ namespace ASC.Api.DocumentConverter
#endregion
#region private method
/// <summary>
/// Request for conversion to a service
/// Processing document received from the editing service
/// </summary>
/// <param name="documentUri">Uri for the document to convert</param>
/// <param name="fromExtension">Document extension</param>
/// <param name="toExtension">Extension to which to convert</param>
/// <param name="documentRevisionId">Key for caching on service</param>
/// <param name="isAsync">Perform conversions asynchronously</param>
/// <returns>Xml document request result of conversion</returns>
private static XDocument SendRequestToConvertService(string documentUri, string fromExtension, string toExtension, string documentRevisionId, bool isAsync)
/// <param name="jsonDocumentResponse">The resulting json from editing service</param>
/// <param name="responseUri">Uri to the converted document</param>
/// <returns>The percentage of completion of conversion</returns>
private static int GetResponseUri(string jsonDocumentResponse, out string responseUri)
{
fromExtension = string.IsNullOrEmpty(fromExtension) ? Path.GetExtension(documentUri) : fromExtension;
if (string.IsNullOrEmpty(jsonDocumentResponse)) throw new ArgumentException("Invalid param", "jsonDocumentResponse");
var title = Path.GetFileName(documentUri);
title = string.IsNullOrEmpty(title) ? Guid.NewGuid().ToString() : title;
var responseFromService = Json.Decode(jsonDocumentResponse);
if (jsonDocumentResponse == null) throw new WebException("Invalid answer format");
documentRevisionId = string.IsNullOrEmpty(documentRevisionId)
? documentUri
: documentRevisionId;
documentRevisionId = GenerateRevisionId(documentRevisionId);
var errorElement = responseFromService.error;
if (errorElement != null) ProcessResponseError(Convert.ToInt32(errorElement));
var req = (HttpWebRequest)WebRequest.Create(DocumentConverterUrl);
req.Method = "POST";
req.ContentType = "text/json";
req.Timeout = ConvertTimeout;
var isEndConvert = responseFromService.endConvert;
var bodyString = string.Format("{{\"async\": {0},\"filetype\": \"{1}\",\"key\": \"{2}\",\"outputtype\": \"{3}\",\"title\": \"{4}\",\"url\": \"{5}\"}}",
isAsync.ToString().ToLower(),
fromExtension.Trim('.'),
documentRevisionId,
toExtension.Trim('.'),
title,
documentUri);
var bytes = Encoding.UTF8.GetBytes(bodyString);
req.ContentLength = bytes.Length;
using (var requestStream = req.GetRequestStream())
int resultPercent;
responseUri = string.Empty;
if (isEndConvert)
{
requestStream.Write(bytes, 0, bytes.Length);
responseUri = responseFromService.fileUrl;
resultPercent = 100;
}
else
{
resultPercent = responseFromService.percent;
if (resultPercent >= 100) resultPercent = 99;
}
var countTry = 0;
Stream stream = null;
// hack. http://ubuntuforums.org/showthread.php?t=1841740
if (_Default.IsMono)
{
ServicePointManager.ServerCertificateValidationCallback += (s, ce, ca, p) => true;
}
while (countTry < MaxTry)
{
try
{
countTry++;
stream = req.GetResponse().GetResponseStream();
break;
}
catch (WebException ex)
{
if (ex.Status != WebExceptionStatus.Timeout)
{
throw new HttpException((int) HttpStatusCode.BadRequest, "Bad Request", ex);
}
}
}
if (countTry == MaxTry)
{
throw new WebException("Timeout", WebExceptionStatus.Timeout);
}
return XDocument.Load(new XmlTextReader(stream));
return resultPercent;
}
/// <summary>
/// Generate an error code table
/// </summary>
/// <param name="errorCode">Error code</param>
private static void ProcessConvertServiceResponceError(int errorCode)
private static void ProcessResponseError(int errorCode)
{
var errorMessage = string.Empty;
const string errorMessageTemplate = "Error occurred in the ConvertService.ashx: {0}";
@ -327,45 +248,6 @@ namespace ASC.Api.DocumentConverter
throw new Exception(errorMessage);
}
/// <summary>
/// Processing document received from the editing service
/// </summary>
/// <param name="xDocumentResponse">The resulting xml from editing service</param>
/// <param name="responseUri">Uri to the converted document</param>
/// <returns>The percentage of completion of conversion</returns>
private static int GetResponseUri(XDocument xDocumentResponse, out string responseUri)
{
var responceFromConvertService = xDocumentResponse.Root;
if (responceFromConvertService == null) throw new WebException("Invalid answer format");
var errorElement = responceFromConvertService.Element("Error");
if (errorElement != null) ProcessConvertServiceResponceError(Convert.ToInt32(errorElement.Value));
var endConvert = responceFromConvertService.Element("EndConvert");
if (endConvert == null) throw new WebException("Invalid answer format");
var isEndConvert = Convert.ToBoolean(endConvert.Value);
var resultPercent = 0;
responseUri = string.Empty;
if (isEndConvert)
{
var fileUrl = responceFromConvertService.Element("FileUrl");
if (fileUrl == null) throw new WebException("Invalid answer format");
responseUri = fileUrl.Value;
resultPercent = 100;
}
else
{
var percent = responceFromConvertService.Element("Percent");
if (percent != null)
resultPercent = Convert.ToInt32(percent.Value);
resultPercent = resultPercent >= 100 ? 99 : resultPercent;
}
return resultPercent;
}
#endregion
}
}

View File

@ -44,12 +44,12 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Web.Helpers" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Content Include="App_Themes\images\file_docx.png" />

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -5,13 +5,12 @@
<add key="filesize-max" value="5242880"/>
<add key="storage-path" value=""/>
<add key="files.docservice.viewed-docs" value=".ppt|.pps|.odp|.pdf|.djvu|.epub|.xps"/>
<add key="files.docservice.edited-docs" value=".docx|.doc|.odt|.xlsx|.xls|.ods|.csv|.pptx|.ppsx|.rtf|.txt|.mht|.html|.htm"/>
<add key="files.docservice.convert-docs" value=".doc|.odt|.xls|.ods|.ppt|.pps|.odp|.rtf|.mht|.html|.htm|.epub"/>
<add key="files.docservice.viewed-docs" value=".pdf|.djvu|.xps"/>
<add key="files.docservice.edited-docs" value=".docx|.xlsx|.csv|.pptx|.ppsx|.txt"/>
<add key="files.docservice.convert-docs" value=".docm|.dotx|.dotm|.dot|.doc|.odt|.fodt|.xlsm|.xltx|.xltm|.xlt|.xls|.ods|.fods|.pptm|.ppt|.ppsm|.pps|.potx|.potm|.pot|.odp|.fodp|.rtf|.mht|.html|.htm|.epub"/>
<add key="files.docservice.timeout" value="120000" />
<add key="files.docservice.url.storage" value="https://doc.onlyoffice.com/FileUploader.ashx"/>
<add key="files.docservice.url.converter" value="https://doc.onlyoffice.com/ConvertService.ashx"/>
<add key="files.docservice.url.api" value="https://doc.onlyoffice.com/web-apps/apps/api/documents/api.js"/>
<add key="files.docservice.url.preloader" value="https://doc.onlyoffice.com/web-apps/apps/api/documents/cache-scripts.html"/>
<add key="files.docservice.url.converter" value="http://documentserver/ConvertService.ashx"/>
<add key="files.docservice.url.api" value="http://documentserver/web-apps/apps/api/documents/api.js"/>
<add key="files.docservice.url.preloader" value="http://documentserver/web-apps/apps/api/documents/cache-scripts.html"/>
</appSettings>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>OnlineEditorsExampleJava</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
@ -38,20 +39,27 @@ import entities.FileModel;
@WebServlet(name = "EditorServlet", urlPatterns = {"/EditorServlet"})
public class EditorServlet extends HttpServlet {
public class EditorServlet extends HttpServlet
{
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
String mode = request.getParameter("mode");
String fileExt = request.getParameter("fileExt");
String fileName = request.getParameter("fileName");
DocumentManager.Init(request, response);
if(fileExt != null)
String fileName = "";
if (request.getParameterMap().containsKey("fileName"))
{
fileName = request.getParameter("fileName");
}
String fileExt = null;
if (request.getParameterMap().containsKey("fileExt"))
{
fileExt = request.getParameter("fileExt");
}
if (fileExt != null)
{
try
{
DocumentManager.Init(request, response);
fileName = DocumentManager.CreateDemo(fileExt);
}
catch (Exception ex)
@ -60,6 +68,11 @@ public class EditorServlet extends HttpServlet {
}
}
String mode = "";
if (request.getParameterMap().containsKey("mode"))
{
mode = request.getParameter("mode");
}
Boolean desktopMode = !"embedded".equals(mode);
FileModel file = new FileModel();
@ -74,17 +87,20 @@ public class EditorServlet extends HttpServlet {
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
processRequest(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
processRequest(request, response);
}
@Override
public String getServletInfo() {
return "Short description";
public String getServletInfo()
{
return "Editor page";
}
}

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
@ -37,61 +38,62 @@ import javax.net.ssl.X509TrustManager;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
public class GlobalServletContextListener implements ServletContextListener{
@Override
public void contextDestroyed(ServletContextEvent arg0) {
System.out.println("ServletContextListener destroyed");
}
public class GlobalServletContextListener implements ServletContextListener
{
@Override
public void contextDestroyed(ServletContextEvent arg0)
{
System.out.println("ServletContextListener destroyed");
}
@Override
public void contextInitialized(ServletContextEvent arg0) {
TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
@Override
public java.security.cert.X509Certificate[] getAcceptedIssuers()
{
return null;
}
@Override
public void checkClientTrusted(X509Certificate[] certs, String authType)
{
}
@Override
public void checkServerTrusted(X509Certificate[] certs, String authType)
{
}
}
};
SSLContext sc;
try
@Override
public void contextInitialized(ServletContextEvent arg0)
{
TrustManager[] trustAllCerts = new TrustManager[]
{
new X509TrustManager()
{
sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
}
catch (NoSuchAlgorithmException | KeyManagementException ex)
{
}
HostnameVerifier allHostsValid = new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
public java.security.cert.X509Certificate[] getAcceptedIssuers()
{
return null;
}
};
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
@Override
public void checkClientTrusted(X509Certificate[] certs, String authType)
{
}
System.out.println("ServletContextListener started");
}
@Override
public void checkServerTrusted(X509Certificate[] certs, String authType)
{
}
}
};
SSLContext sc;
try
{
sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
}
catch (NoSuchAlgorithmException | KeyManagementException ex)
{
}
HostnameVerifier allHostsValid = new HostnameVerifier()
{
@Override
public boolean verify(String hostname, SSLSession session)
{
return true;
}
};
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
System.out.println("ServletContextListener started");
}
}

View File

@ -2,27 +2,29 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
package controllers;
import helpers.DocumentManager;
@ -34,7 +36,6 @@ import java.io.InputStream;
import java.io.PrintWriter;
import java.net.URL;
import java.util.Scanner;
import javafx.util.Pair;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
@ -49,10 +50,10 @@ import org.json.simple.parser.JSONParser;
@WebServlet(name = "IndexServlet", urlPatterns = {"/IndexServlet"})
@MultipartConfig
public class IndexServlet extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
public class IndexServlet extends HttpServlet
{
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
String action = request.getParameter("type");
if(action == null)
@ -64,7 +65,8 @@ public class IndexServlet extends HttpServlet {
DocumentManager.Init(request, response);
PrintWriter writer = response.getWriter();
switch (action.toLowerCase()) {
switch (action.toLowerCase())
{
case "upload":
Upload(request, response, writer);
break;
@ -75,11 +77,11 @@ public class IndexServlet extends HttpServlet {
Track(request, response, writer);
break;
}
}
private static void Upload(HttpServletRequest request, HttpServletResponse response, PrintWriter writer) {
private static void Upload(HttpServletRequest request, HttpServletResponse response, PrintWriter writer)
{
response.setContentType("text/plain");
try
@ -87,20 +89,24 @@ public class IndexServlet extends HttpServlet {
Part httpPostedFile = request.getPart("file");
String fileName = "";
for (String content : httpPostedFile.getHeader("content-disposition").split(";")) {
if (content.trim().startsWith("filename")) {
for (String content : httpPostedFile.getHeader("content-disposition").split(";"))
{
if (content.trim().startsWith("filename"))
{
fileName = content.substring(content.indexOf('=') + 1).trim().replace("\"", "");
}
}
long curSize = httpPostedFile.getSize();
if (DocumentManager.GetMaxFileSize() < curSize || curSize <= 0) {
if (DocumentManager.GetMaxFileSize() < curSize || curSize <= 0)
{
writer.write("{ \"error\": \"File size is incorrect\"}");
return;
}
String curExt = FileUtility.GetFileExtension(fileName);
if (!DocumentManager.GetFileExts().contains(curExt)) {
if (!DocumentManager.GetFileExts().contains(curExt))
{
writer.write("{ \"error\": \"File type is not supported\"}");
return;
}
@ -112,10 +118,12 @@ public class IndexServlet extends HttpServlet {
File file = new File(fileStoragePath);
try (FileOutputStream out = new FileOutputStream(file)) {
try (FileOutputStream out = new FileOutputStream(file))
{
int read;
final byte[] bytes = new byte[1024];
while ((read = fileStream.read(bytes)) != -1) {
while ((read = fileStream.read(bytes)) != -1)
{
out.write(bytes, 0, read);
}
@ -147,14 +155,11 @@ public class IndexServlet extends HttpServlet {
{
String key = ServiceConverter.GenerateRevisionId(fileUri);
Pair<Integer, String> res = ServiceConverter.GetConvertedUri(fileUri, fileExt, internalFileExt, key, true);
String newFileUri = ServiceConverter.GetConvertedUri(fileUri, fileExt, internalFileExt, key, true);
int result = res.getKey();
String newFileUri = res.getValue();
if (result != 100)
if (newFileUri == "")
{
writer.write("{ \"step\" : \"" + result + "\", \"filename\" : \"" + fileName + "\"}");
writer.write("{ \"step\" : \"0\", \"filename\" : \"" + fileName + "\"}");
return;
}
@ -164,15 +169,18 @@ public class IndexServlet extends HttpServlet {
java.net.HttpURLConnection connection = (java.net.HttpURLConnection) url.openConnection();
InputStream stream = connection.getInputStream();
if (stream == null) {
if (stream == null)
{
throw new Exception("Stream is null");
}
File convertedFile = new File(DocumentManager.StoragePath(correctName, null));
try (FileOutputStream out = new FileOutputStream(convertedFile)) {
try (FileOutputStream out = new FileOutputStream(convertedFile))
{
int read;
final byte[] bytes = new byte[1024];
while ((read = stream.read(bytes)) != -1) {
while ((read = stream.read(bytes)) != -1)
{
out.write(bytes, 0, read);
}
@ -197,7 +205,8 @@ public class IndexServlet extends HttpServlet {
}
}
private static void Track(HttpServletRequest request, HttpServletResponse response, PrintWriter writer) {
private static void Track(HttpServletRequest request, HttpServletResponse response, PrintWriter writer)
{
String userAddress = request.getParameter("userAddress");
String fileName = request.getParameter("fileName");
@ -206,8 +215,10 @@ public class IndexServlet extends HttpServlet {
try
{
Scanner scanner = new Scanner(request.getInputStream()).useDelimiter("\\A");
Scanner scanner = new Scanner(request.getInputStream());
scanner.useDelimiter("\\A");
body = scanner.hasNext() ? scanner.next() : "";
scanner.close();
}
catch (Exception ex)
{
@ -237,26 +248,29 @@ public class IndexServlet extends HttpServlet {
long status = (long) jsonObj.get("status");
int saved = 0;
if(status == 2 || status == 3)//MustSave, Corrupted
{
String downloadUri = (String) jsonObj.get("url");
int saved = 1;
try
{
URL url = new URL(downloadUri);
java.net.HttpURLConnection connection = (java.net.HttpURLConnection) url.openConnection();
InputStream stream = connection.getInputStream();
if (stream == null) {
if (stream == null)
{
throw new Exception("Stream is null");
}
File savedFile = new File(storagePath);
try (FileOutputStream out = new FileOutputStream(savedFile)) {
try (FileOutputStream out = new FileOutputStream(savedFile))
{
int read;
final byte[] bytes = new byte[1024];
while ((read = stream.read(bytes)) != -1) {
while ((read = stream.read(bytes)) != -1)
{
out.write(bytes, 0, read);
}
@ -268,28 +282,29 @@ public class IndexServlet extends HttpServlet {
}
catch (Exception ex)
{
saved = 0;
saved = 1;
}
}
writer.write("{\"error\":0}");
writer.write("{\"error\":" + saved + "}");
}
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
processRequest(request, response);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
processRequest(request, response);
}
@Override
public String getServletInfo() {
return "Short description";
public String getServletInfo()
{
return "Handler";
}
}

View File

@ -1,3 +1,29 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
package entities;

View File

@ -1,7 +1,34 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
package entities;
public enum FileType {
public enum FileType
{
Text,
Spreadsheet,
Presentation

View File

@ -1,11 +1,37 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
package helpers;
import java.io.InputStream;
import java.util.Properties;
public class ConfigManager {
public class ConfigManager
{
private static Properties properties;
static
@ -27,7 +53,8 @@ public class ConfigManager {
}
}
public static String GetProperty(String name){
public static String GetProperty(String name)
{
if(properties == null)
return "";

View File

@ -1,19 +1,40 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
package helpers;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javafx.util.Pair;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import entities.FileType;
@ -22,13 +43,10 @@ import entities.FileType;
public class DocumentManager
{
private static HttpServletRequest request;
private static HttpServletResponse response;
private static final String ExternalIPCacheKey = "ExternalIPCacheKey";
public static void Init(HttpServletRequest req, HttpServletResponse resp){
public static void Init(HttpServletRequest req, HttpServletResponse resp)
{
request = req;
response = resp;
}
public static long GetMaxFileSize()
@ -39,7 +57,7 @@ public class DocumentManager
{
size = Long.parseLong(ConfigManager.GetProperty("filesize-max"));
}
catch(Exception ex)
catch (Exception ex)
{
size = 0;
}
@ -84,7 +102,7 @@ public class DocumentManager
{
userAddress = InetAddress.getLocalHost().getHostAddress();
}
catch(Exception ex)
catch (Exception ex)
{
userAddress = "";
}
@ -140,25 +158,20 @@ public class DocumentManager
{
String demoName = "sample." + fileExt;
String fileName = GetCorrectName(demoName);
try
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(demoName);
File file = new File(StoragePath(fileName, null));
try (FileOutputStream out = new FileOutputStream(file))
{
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(demoName);
File file = new File(StoragePath(fileName, null));
try (FileOutputStream out = new FileOutputStream(file)) {
int read;
final byte[] bytes = new byte[1024];
while ((read = stream.read(bytes)) != -1) {
out.write(bytes, 0, read);
}
out.flush();
int read;
final byte[] bytes = new byte[1024];
while ((read = stream.read(bytes)) != -1)
{
out.write(bytes, 0, read);
}
}
catch(Exception ex)
{
throw ex;
out.flush();
}
return fileName;
@ -172,28 +185,35 @@ public class DocumentManager
String storagePath = ConfigManager.GetProperty("storage-folder");
String hostAddress = CurUserHostAddress(null);
String filePath = serverPath + "/" + storagePath + "/" + hostAddress + "/" + URLEncoder.encode(fileName);
String filePath = serverPath + "/" + storagePath + "/" + hostAddress + "/" + URLEncoder.encode(fileName, java.nio.charset.StandardCharsets.UTF_8.toString());
return filePath;
}
catch(Exception ex)
catch (UnsupportedEncodingException e)
{
throw ex;
throw new AssertionError("UTF-8 is unknown");
}
}
public static String GetServerUrl()
{
return serverPath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort();
return request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort();
}
public static String GetCallback(String fileName)
{
String serverPath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
String hostAddress = CurUserHostAddress(null);
String query = "?type=track&fileName=" + URLEncoder.encode(fileName) + "&userAddress=" + URLEncoder.encode(hostAddress);
try
{
String query = "?type=track&fileName=" + URLEncoder.encode(fileName, java.nio.charset.StandardCharsets.UTF_8.toString()) + "&userAddress=" + URLEncoder.encode(hostAddress, java.nio.charset.StandardCharsets.UTF_8.toString());
return serverPath + "/IndexServlet" + query;
return serverPath + "/IndexServlet" + query;
}
catch (UnsupportedEncodingException e)
{
throw new AssertionError("UTF-8 is unknown");
}
}
public static String GetInternalExtension(FileType fileType)

View File

@ -1,3 +1,29 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
package helpers;
@ -11,14 +37,14 @@ import java.util.Map;
public class FileUtility
{
static {}
public static FileType GetFileType(String fileName)
{
String ext = GetFileExtension(fileName).toLowerCase();
if (ExtsDocument.contains(ext))
return FileType.Text;
if (ExtsSpreadsheet.contains(ext))
return FileType.Spreadsheet;
@ -30,26 +56,33 @@ public class FileUtility
public static List<String> ExtsDocument = Arrays.asList
(
".docx", ".doc", ".odt", ".rtf", ".txt",
".html", ".htm", ".mht", ".pdf", ".djvu",
".fb2", ".epub", ".xps"
".doc", ".docx", ".docm",
".dot", ".dotx", ".dotm",
".odt", ".fodt", ".rtf", ".txt",
".html", ".htm", ".mht",
".pdf", ".djvu", ".fb2", ".epub", ".xps"
);
public static List<String> ExtsSpreadsheet = Arrays.asList
(
".xls", ".xlsx", ".ods", ".csv"
".xls", ".xlsx", ".xlsm",
".xlt", ".xltx", ".xltm",
".ods", ".fods", ".csv"
);
public static List<String> ExtsPresentation = Arrays.asList
(
".pps", ".ppsx", ".ppt", ".pptx",".odp"
".pps", ".ppsx", ".ppsm",
".ppt", ".pptx", ".pptm",
".pot", ".potx", ".potm",
".odp", ".fodp"
);
public static String GetFileName (String url)
{
if(url == null) return null;
//for external file url
String tempstorage = ConfigManager.GetProperty("files.docservice.url.tempstorage");
if(!tempstorage.isEmpty() && url.startsWith(tempstorage))
@ -61,7 +94,7 @@ public class FileUtility
String fileName = url.substring(url.lastIndexOf('/')+1, url.length());
return fileName;
}
public static String GetFileNameWithoutExtension (String url)
{
String fileName = GetFileName(url);

View File

@ -1,3 +1,28 @@
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
package helpers;
@ -7,31 +32,21 @@ import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.URL;
import java.net.URLEncoder;
import java.text.MessageFormat;
import java.util.Date;
import java.util.UUID;
import java.util.concurrent.TimeoutException;
import javafx.util.Pair;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
public class ServiceConverter
{
private static int ConvertTimeout = 120000;
private static final String DocumentConverterUrl = ConfigManager.GetProperty("files.docservice.url.converter");
private static final String DocumentStorageUrl = ConfigManager.GetProperty("files.docservice.url.storage");
private static final MessageFormat ConvertParams = new MessageFormat("?url={0}&outputtype={1}&filetype={2}&title={3}&key={4}");
private static final int MaxTry = 3;
static
{
@ -48,124 +63,25 @@ public class ServiceConverter
}
}
public static Pair<Integer, String> GetConvertedUri(String documentUri, String fromExtension, String toExtension, String documentRevisionId, Boolean isAsync) throws Exception
{
String convertedDocumentUri = null;
String xml = SendRequestToConvertService(documentUri, fromExtension, toExtension, documentRevisionId, isAsync);
Document document = ConvertStringToXmlDocument(xml);
Element responceFromConvertService = document.getDocumentElement();
if (responceFromConvertService == null)
throw new Exception("Invalid answer format");
NodeList errorElement = responceFromConvertService.getElementsByTagName("Error");
if (errorElement != null && errorElement.getLength() > 0)
ProcessConvertServiceResponceError(Integer.parseInt(errorElement.item(0).getTextContent()));
NodeList endConvertNode = responceFromConvertService.getElementsByTagName("EndConvert");
if (endConvertNode == null || endConvertNode.getLength() == 0)
throw new Exception("EndConvert node is null");
Boolean isEndConvert = Boolean.parseBoolean(endConvertNode.item(0).getTextContent());
NodeList percentNode = responceFromConvertService.getElementsByTagName("Percent");
if (percentNode == null || percentNode.getLength() == 0)
throw new Exception("Percent node is null");
Integer percent = Integer.parseInt(percentNode.item(0).getTextContent());
if (isEndConvert)
{
NodeList fileUrlNode = responceFromConvertService.getElementsByTagName("FileUrl");
if (fileUrlNode == null || fileUrlNode.getLength() == 0)
throw new Exception("FileUrl node is null");
convertedDocumentUri = fileUrlNode.item(0).getTextContent();
percent = 100;
}
else
{
percent = percent >= 100 ? 99 : percent;
}
return new Pair<>(percent, convertedDocumentUri);
}
public static String GetExternalUri(InputStream fileStream, long contentLength, String contentType, String documentRevisionId) throws IOException, Exception
{
Object[] args = {"", "", "", "", documentRevisionId};
String urlTostorage = DocumentStorageUrl + ConvertParams.format(args);
URL url = new URL(urlTostorage);
java.net.HttpURLConnection connection = (java.net.HttpURLConnection) url.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setInstanceFollowRedirects(false);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", contentType == null ? "application/octet-stream" : contentType);
connection.setRequestProperty("charset", "utf-8");
connection.setRequestProperty("Content-Length", Long.toString(contentLength));
connection.setUseCaches (false);
try (DataOutputStream dataOutputStream = new DataOutputStream(connection.getOutputStream())) {
int read;
final byte[] bytes = new byte[1024];
while ((read = fileStream.read(bytes)) != -1) {
dataOutputStream.write(bytes, 0, read);
}
dataOutputStream.flush();
}
InputStream stream = connection.getInputStream();
if (stream == null)
{
throw new Exception("Could not get an answer");
}
String xml = ConvertStreamToString(stream);
connection.disconnect();
Pair <Integer, String> res = GetResponseUri(xml);
return res.getValue();
}
public static String GenerateRevisionId(String expectedKey)
{
if (expectedKey.length() > 20)
expectedKey = Integer.toString(expectedKey.hashCode());
String key = expectedKey.replace("[^0-9-.a-zA-Z_=]", "_");
return key.substring(0, Math.min(key.length(), 20));
}
private static String SendRequestToConvertService(String documentUri, String fromExtension, String toExtension, String documentRevisionId, Boolean isAsync) throws Exception
public static String GetConvertedUri(String documentUri, String fromExtension, String toExtension, String documentRevisionId, Boolean isAsync) throws Exception
{
fromExtension = fromExtension == null || fromExtension.isEmpty() ? FileUtility.GetFileExtension(documentUri) : fromExtension;
String title = FileUtility.GetFileName(documentUri);
title = title == null || title.isEmpty() ? UUID.randomUUID().toString() : title;
documentRevisionId = documentRevisionId == null || documentRevisionId.isEmpty() ? documentUri : documentRevisionId;
documentRevisionId = GenerateRevisionId(documentRevisionId);
Object[] args = {
URLEncoder.encode(documentUri),
URLEncoder.encode(documentUri, java.nio.charset.StandardCharsets.UTF_8.toString()),
toExtension.replace(".", ""),
fromExtension.replace(".", ""),
title,
documentRevisionId
};
String urlToConverter = DocumentConverterUrl + ConvertParams.format(args);
if (isAsync)
@ -173,38 +89,29 @@ public class ServiceConverter
URL url = new URL(urlToConverter);
java.net.HttpURLConnection connection = (java.net.HttpURLConnection) url.openConnection();
connection.setRequestProperty("Accept", "application/json");
connection.setConnectTimeout(ConvertTimeout);
InputStream stream = null;
int countTry = 0;
while (countTry < MaxTry)
{
try
{
countTry++;
stream = connection.getInputStream();
break;
}
catch (Exception ex)
{
if(!(ex instanceof TimeoutException))
throw new Exception("Bad Request");
}
}
if (countTry == MaxTry)
{
throw new Exception("Timeout");
}
InputStream stream = connection.getInputStream();
if (stream == null)
throw new Exception("Could not get an answer");
String xml = ConvertStreamToString(stream);
String jsonString = ConvertStreamToString(stream);
connection.disconnect();
return xml;
return GetResponseUri(jsonString);
}
public static String GenerateRevisionId(String expectedKey)
{
if (expectedKey.length() > 20)
expectedKey = Integer.toString(expectedKey.hashCode());
String key = expectedKey.replace("[^0-9-.a-zA-Z_=]", "_");
return key.substring(0, Math.min(key.length(), 20));
}
private static void ProcessConvertServiceResponceError(int errorCode) throws Exception
@ -248,46 +155,31 @@ public class ServiceConverter
throw new Exception(errorMessage);
}
private static Pair<Integer, String> GetResponseUri(String xml) throws Exception
private static String GetResponseUri(String jsonString) throws Exception
{
Document document = ConvertStringToXmlDocument(xml);
Element responceFromConvertService = document.getDocumentElement();
if (responceFromConvertService == null)
throw new Exception("Invalid answer format");
JSONObject jsonObj = ConvertStringToJSON(jsonString);
NodeList errorElement = responceFromConvertService.getElementsByTagName("Error");
if (errorElement != null && errorElement.getLength() > 0)
ProcessConvertServiceResponceError(Integer.parseInt(errorElement.item(0).getTextContent()));
String error = (String) jsonObj.get("error");
if (error != null && error != "")
ProcessConvertServiceResponceError(Integer.parseInt(error));
NodeList endConvert = responceFromConvertService.getElementsByTagName("EndConvert");
if (endConvert == null || endConvert.getLength() == 0)
throw new Exception("Invalid answer format");
Boolean isEndConvert = Boolean.parseBoolean(endConvert.item(0).getTextContent());
Boolean isEndConvert = (Boolean) jsonObj.get("endConvert");
int resultPercent = 0;
Long resultPercent = 0l;
String responseUri = null;
if (isEndConvert)
{
NodeList fileUrl = responceFromConvertService.getElementsByTagName("FileUrl");
if (fileUrl == null || endConvert.getLength() == 0)
throw new Exception("Invalid answer format");
resultPercent = 100;
responseUri = fileUrl.item(0).getTextContent();
resultPercent = 100l;
responseUri = (String) jsonObj.get("fileUrl");
}
else
{
NodeList percent = responceFromConvertService.getElementsByTagName("Percent");
if (percent != null && percent.getLength() > 0)
resultPercent = Integer.parseInt(percent.item(0).getTextContent());
resultPercent = resultPercent >= 100 ? 99 : resultPercent;
resultPercent = (Long) jsonObj.get("percent");
resultPercent = resultPercent >= 100l ? 99l : resultPercent;
}
return new Pair<>(resultPercent, responseUri);
return resultPercent >= 100l ? responseUri : "";
}
private static String ConvertStreamToString(InputStream stream) throws IOException
@ -297,24 +189,23 @@ public class ServiceConverter
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String line = bufferedReader.readLine();
while(line != null) {
while(line != null)
{
stringBuilder.append(line);
line =bufferedReader.readLine();
line = bufferedReader.readLine();
}
String result = stringBuilder.toString();
return result;
}
private static Document ConvertStringToXmlDocument(String xml) throws IOException, ParserConfigurationException, SAXException
private static JSONObject ConvertStringToJSON(String jsonString) throws ParseException
{
DocumentBuilderFactory documentBuildFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder doccumentBuilder = documentBuildFactory.newDocumentBuilder();
InputStream inputStream = new ByteArrayInputStream(xml.getBytes("utf-8"));
InputSource inputSource = new InputSource(inputStream);
Document document = doccumentBuilder.parse(inputSource);
return document;
JSONParser parser = new JSONParser();
Object obj = parser.parse(jsonString);
JSONObject jsonObj = (JSONObject) obj;
return jsonObj;
}
}

View File

@ -1,13 +1,12 @@
filesize-max=5242880
storage-folder=app_data
files.docservice.viewed-docs=.ppt|.pps|.odp|.pdf|.djvu|.epub|.xps
files.docservice.edited-docs=.docx|.doc|.odt|.xlsx|.xls|.ods|.csv|.pptx|.ppsx|.rtf|.txt|.mht|.html|.htm
files.docservice.convert-docs=.doc|.odt|.xls|.ods|.ppt|.pps|.odp|.rtf|.mht|.html|.htm|.epub
files.docservice.viewed-docs=.pdf|.djvu|.xps
files.docservice.edited-docs=.docx|.xlsx|.csv|.pptx|.ppsx|.txt
files.docservice.convert-docs=.docm|.dotx|.dotm|.dot|.doc|.odt|.fodt|.xlsm|.xltx|.xltm|.xlt|.xls|.ods|.fods|.pptm|.ppt|.ppsm|.pps|.potx|.potm|.pot|.odp|.fodp|.rtf|.mht|.html|.htm|.epub
files.docservice.timeout=120000
files.docservice.url.storage=https://doc.onlyoffice.com/FileUploader.ashx
files.docservice.url.converter=https://doc.onlyoffice.com/ConvertService.ashx
files.docservice.url.tempstorage=https://doc.onlyoffice.com/ResourceService.ashx
files.docservice.url.api=https://doc.onlyoffice.com/web-apps/apps/api/documents/api.js
files.docservice.url.preloader=https://doc.onlyoffice.com/web-apps/apps/api/documents/cache-scripts.html
files.docservice.url.converter=http://documentserver/ConvertService.ashx
files.docservice.url.tempstorage=http://documentserver/ResourceService.ashx
files.docservice.url.api=http://documentserver/web-apps/apps/api/documents/api.js
files.docservice.url.preloader=http://documentserver/web-apps/apps/api/documents/cache-scripts.html

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*-->
@ -39,6 +40,7 @@
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="css/editor.css" />
<% DocumentManager.Init(request, response); %>
<% FileModel Model = (FileModel)request.getAttribute("file"); %>
<script type="text/javascript" src="${docserviceApiUrl}"></script>

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*-->
@ -43,10 +44,10 @@
<div class="top-panel"></div>
<div class="main-panel">
<span class="portal-name">ONLYOFFICE Online Editors</span>
<span class="portal-name">ONLYOFFICE Document Editors</span>
<br />
<br />
<span class="portal-descr">Get started with a demo-sample of ONLYOFFICE Online Editors, the first html5-based editors. You may upload your own documents for testing using the "Choose file" button and selecting the necessary files on your PC.</span>
<span class="portal-descr">Get started with a demo-sample of ONLYOFFICE Document Editors, the first html5-based editors. You may upload your own documents for testing using the "Choose file" button and selecting the necessary files on your PC.</span>
<div class="file-upload button gray">
<span>Choose file</span>

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*-->
@ -31,8 +32,8 @@
<link href="stylesheet.css" type="text/css" rel="stylesheet">
<!--Change the address on installed ONLYOFFICE Online Editors-->
<script id="scriptApi" type="text/javascript" src="https://doc.onlyoffice.com/web-apps/apps/api/documents/api.js"></script>
<!--Change the address on installed ONLYOFFICE Document Editors-->
<script id="scriptApi" type="text/javascript" src="http://documentserver/web-apps/apps/api/documents/api.js"></script>
<script type="text/javascript" src="init.js"></script>
@ -42,10 +43,10 @@
<div id="page">
<div class="top-panel"></div>
<div id="mainPanel" class="main-panel">
<span class="portal-name">ONLYOFFICE Online Editors</span>
<span class="portal-name">ONLYOFFICE Document Editors</span>
<br />
<br />
<span class="portal-descr">Get started with a demo-sample of ONLYOFFICE Online Editors, the first html5-based editors. You may enter url your own document for testing.</span>
<span class="portal-descr">Get started with a demo-sample of ONLYOFFICE Document Editors, the first html5-based editors. You may enter url your own document for testing.</span>
<textarea id="documentUrl" class="document-url">http://onlyo.co/1x5REbq?demo.docx</textarea>
<br />
<br />

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
@ -72,8 +73,8 @@ function key(k) {
};
var getDocumentType = function (ext) {
if (".docx.doc.odt.rtf.txt.html.htm.mht.pdf.djvu.fb2.epub.xps".indexOf(ext) != -1) return "text";
if (".xls.xlsx.ods.csv".indexOf(ext) != -1) return "spreadsheet";
if (".pps.ppsx.ppt.pptx.odp".indexOf(ext) != -1) return "presentation";
if (".doc.docx.docm.dot.dotx.dotm.odt.fodt.rtf.txt.html.htm.mht.pdf.djvu.fb2.epub.xps".indexOf(ext) != -1) return "text";
if (".xls.xlsx.xlsm.xlt.xltx.xltm.ods.fods.csv".indexOf(ext) != -1) return "spreadsheet";
if (".pps.ppsx.ppsm.ppt.pptx.pptm.pot.potx.potm.odp.fodp".indexOf(ext) != -1) return "presentation";
return null;
};

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
@ -30,14 +31,20 @@ const bodyParser = require("body-parser");
const fileSystem = require("fs");
const formidable = require("formidable");
const syncRequest = require("sync-request");
const jwt = require('jsonwebtoken');
const config = require('config');
const configServer = config.get('server');
const mime = require("mime");
const docManager = require("./helpers/docManager");
const documentService = require("./helpers/documentService");
const fileUtility = require("./helpers/fileUtility");
const siteUrl = configServer.get('siteUrl');
const fileChoiceUrl = configServer.has('fileChoiceUrl') ? configServer.get('fileChoiceUrl') : "";
const plugins = config.get('plugins');
const cfgSignatureEnable = configServer.get('token.enable');
const cfgSignatureUseForRequest = configServer.get('token.useforrequest');
const cfgSignatureSecretExpiresIn = configServer.get('token.expiresIn');
const cfgSignatureSecret = configServer.get('token.secret');
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
@ -110,6 +117,26 @@ app.get("/", function (req, res) {
}
});
app.get("/download", function(req, res) {
docManager.init(__dirname, req, res);
var fileName = fileUtility.getFileName(req.query.fileName);
var userAddress = docManager.curUserHostAddress();
var path = docManager.forcesavePath(fileName, userAddress, false);
if (path == "") {
path = docManager.storagePath(fileName, userAddress);
}
res.setHeader("Content-Length", fileSystem.statSync(path).size);
res.setHeader("Content-Type", mime.lookup(path));
res.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
var filestream = fileSystem.createReadStream(path);
filestream.pipe(res);
});
app.post("/upload", function (req, res) {
docManager.init(__dirname, req, res);
@ -135,6 +162,13 @@ app.post("/upload", function (req, res) {
const file = files.uploadedFile;
if (file == undefined) {
res.writeHead(200, { "Content-Type": "text/plain" });
res.write("{ \"error\": \"Uploaded file not found\"}");
res.end();
return;
}
file.name = docManager.getCorrectName(file.name);
if (configServer.get('maxFileSize') < file.size || file.size <= 0) {
@ -289,7 +323,7 @@ app.post("/track", function (req, res) {
var processTrack = function (response, body, fileName, userAddress) {
var processSave = function (downloadUri, body, fileName, userAddress, resp, newVersion) {
var processSave = function (downloadUri, body, fileName, userAddress, resp) {
var curExt = fileUtility.getFileExtension(fileName);
var downloadExt = fileUtility.getFileExtension(downloadUri);
@ -297,8 +331,8 @@ app.post("/track", function (req, res) {
var key = documentService.generateRevisionId(downloadUri);
try {
documentService.getConvertedUriSync(downloadUri, downloadExt, curExt, key, function(dUri){
processSave(dUri, body, fileName, userAddress, resp, newVersion)
documentService.getConvertedUriSync(downloadUri, downloadExt, curExt, key, function (dUri) {
processSave(dUri, body, fileName, userAddress, resp)
});
return;
} catch (ex) {
@ -311,7 +345,7 @@ app.post("/track", function (req, res) {
var path = docManager.storagePath(fileName, userAddress);
if (newVersion) {
if (docManager.existsSync(path)) {
var historyPath = docManager.historyPath(fileName, userAddress);
if (historyPath == "") {
historyPath = docManager.historyPath(fileName, userAddress, true);
@ -341,10 +375,52 @@ app.post("/track", function (req, res) {
var path_prev = docManager.prevFilePath(fileName, userAddress, version);
fileSystem.writeFileSync(path_prev, fileSystem.readFileSync(path));
var file = syncRequest("GET", downloadUri);
fileSystem.writeFileSync(path, file.getBody());
var forcesavePath = docManager.forcesavePath(fileName, userAddress, false);
if (forcesavePath != "") {
fileSystem.unlinkSync(forcesavePath);
}
}
} catch (ex) {
console.log(ex);
}
response.write("{\"error\":0}");
response.end();
};
var processForceSave = function (downloadUri, body, fileName, userAddress, resp) {
var curExt = fileUtility.getFileExtension(fileName);
var downloadExt = fileUtility.getFileExtension(downloadUri);
if (downloadExt != curExt) {
var key = documentService.generateRevisionId(downloadUri);
try {
documentService.getConvertedUriSync(downloadUri, downloadExt, curExt, key, function (dUri) {
processForceSave(dUri, body, fileName, userAddress, resp)
});
return;
} catch (ex) {
console.log(ex);
fileName = docManager.getCorrectName(fileUtility.getFileName(fileName, true) + downloadExt, userAddress)
}
}
try {
var path = docManager.storagePath(fileName, userAddress);
var forcesavePath = docManager.forcesavePath(fileName, userAddress, false);
if (forcesavePath == "") {
forcesavePath = docManager.forcesavePath(fileName, userAddress, true);
}
var file = syncRequest("GET", downloadUri);
fileSystem.writeFileSync(path, file.getBody());
fileSystem.writeFileSync(forcesavePath, file.getBody());
} catch (ex) {
console.log(ex);
}
@ -366,10 +442,11 @@ app.post("/track", function (req, res) {
}
}
} else if (body.status == 2 || body.status == 3 //MustSave, Corrupted
|| body.status == 6 || body.status == 7) { //MustForceSave, CorruptedForceSave
var newVersion = (body.status == 2 || body.status == 3);
processSave(body.url, body, fileName, userAddress, response, newVersion);
} else if (body.status == 2 || body.status == 3) { //MustSave, Corrupted
processSave(body.url, body, fileName, userAddress, response);
return;
} else if (body.status == 6 || body.status == 7) { //MustForceSave, CorruptedForceSave
processForceSave(body.url, body, fileName, userAddress, response);
return;
}
@ -388,6 +465,29 @@ app.post("/track", function (req, res) {
});
};
//checkjwt
if (cfgSignatureEnable && cfgSignatureUseForRequest) {
var checkJwtHeaderRes = documentService.checkJwtHeader(req);
if (checkJwtHeaderRes) {
if (checkJwtHeaderRes.payload) {
body = checkJwtHeaderRes.payload;
}
if (checkJwtHeaderRes.query) {
if (checkJwtHeaderRes.query.useraddress) {
userAddress = checkJwtHeaderRes.query.useraddress;
}
if (checkJwtHeaderRes.query.filename) {
fileName = fileUtility.getFileName(checkJwtHeaderRes.query.filename);
}
}
processTrack(res, body, fileName, userAddress);
} else {
res.write("{\"error\":1}");
res.end();
}
return;
}
if (req.body.hasOwnProperty("status")) {
processTrack(res, req.body, fileName, userAddress);
} else {
@ -402,8 +502,7 @@ app.get("/editor", function (req, res) {
var fileExt = req.query.fileExt;
var history = [];
var prevUrl = [];
var diff = [];
var historyData = [];
var lang = docManager.getLang();
var userid = req.query.userid ? req.query.userid : "uid-1";
var name = req.query.name ? req.query.name : "Jonn Smith";
@ -417,10 +516,10 @@ app.get("/editor", function (req, res) {
}
var userAddress = docManager.curUserHostAddress();
fileName = fileUtility.getFileName(req.query.fileName);
var fileName = fileUtility.getFileName(req.query.fileName);
var key = docManager.getKey(fileName);
var url = docManager.getFileUri(fileName);
var mode = req.query.mode || "edit"; //mode: view/edit
var mode = req.query.mode || "edit"; //mode: view/edit/review/comment/embedded
var type = req.query.type || ""; //type: embedded/mobile/desktop
if (type == "") {
type = new RegExp(configServer.get("mobileRegEx"), "i").test(req.get('User-Agent')) ? "mobile" : "desktop";
@ -431,33 +530,56 @@ app.get("/editor", function (req, res) {
var countVersion = 1;
var historyPath = docManager.historyPath(fileName, userAddress);
changes = null;
var changes = null;
var keyVersion = key;
if (historyPath != '') {
countVersion = docManager.countVersion(historyPath) + 1;
var prevPath = docManager.getlocalFileUri(fileName, 1) + "/prev" + fileUtility.getFileExtension(fileName);
var diffPath = null;
for (var i = 1; i < countVersion; i++) {
var keyPath = docManager.keyPath(fileName, userAddress, i);
var keyVersion = "" + fileSystem.readFileSync(keyPath);
for (var i = 1; i <= countVersion; i++) {
if (i < countVersion) {
var keyPath = docManager.keyPath(fileName, userAddress, i);
keyVersion = "" + fileSystem.readFileSync(keyPath);
} else {
keyVersion = key;
}
history.push(docManager.getHistory(fileName, changes, keyVersion, i));
prevUrl.push(prevPath);
prevPath = docManager.getlocalFileUri(fileName, i) + "/prev" + fileUtility.getFileExtension(fileName);
var historyD = {
version: i,
key: keyVersion,
url: i == countVersion ? url : (docManager.getlocalFileUri(fileName, i, true) + "/prev" + fileUtility.getFileExtension(fileName)),
};
diff.push(diffPath);
diffPath = docManager.getlocalFileUri(fileName, i) + "/diff.zip";
if (i > 1 && docManager.existsSync(docManager.diffPath(fileName, userAddress, i-1))) {
historyD.previous = {
key: historyData[i-2].key,
url: historyData[i-2].url,
};
historyD.changesUrl = docManager.getlocalFileUri(fileName, i-1) + "/diff.zip";
}
var changesFile = docManager.changesPath(fileName, userAddress, i);
var changes = docManager.getChanges(changesFile);
historyData.push(historyD);
if (i < countVersion) {
var changesFile = docManager.changesPath(fileName, userAddress, i);
changes = docManager.getChanges(changesFile);
}
}
prevUrl.push(prevPath);
diff.push(diffPath);
} else {
prevUrl.push(url);
history.push(docManager.getHistory(fileName, changes, keyVersion, countVersion));
historyData.push({
version: countVersion,
key: key,
url: url
});
}
if (cfgSignatureEnable) {
for (var i = 0; i < historyData.length; i++) {
historyData[i].token = jwt.sign(historyData[i], cfgSignatureSecret, {expiresIn: cfgSignatureSecretExpiresIn});
}
}
history.push(docManager.getHistory(fileName, changes, key, countVersion));
var argss = {
apiUrl: siteUrl + configServer.get('apiUrl'),
@ -465,32 +587,45 @@ app.get("/editor", function (req, res) {
name: fileName,
ext: fileUtility.getFileExtension(fileName, true),
uri: url,
version: countVersion
version: countVersion,
created: new Date().toDateString()
},
editor: {
type: type,
documentType: fileUtility.getFileType(fileName),
key: key,
token: "",
callbackUrl: docManager.getCallback(fileName),
isEdit: canEdit && mode != "review",
isEdit: canEdit && (mode == "edit" || mode == "filter"),
review: mode == "edit" || mode == "review",
comment: mode != "view" && mode != "embedded",
modifyFilter: mode != "filter",
mode: canEdit && mode != "view" ? "edit" : "view",
canBackToFolder: type != "embedded",
getServerUrl: docManager.getServerUrl(),
backUrl: docManager.getServerUrl(),
curUserHostAddress: docManager.curUserHostAddress(),
lang: lang,
userid: userid,
name: name,
fileChoiceUrl: fileChoiceUrl,
plugins: plugins
plugins: JSON.stringify(plugins)
},
history: history,
setHistoryData: {
url: prevUrl,
changesUrl: diff
}
historyData: historyData
};
res.render("editor", argss);
if (cfgSignatureEnable) {
app.render('config', argss, function(err, html){
if (err) {
console.log(err);
} else {
argss.editor.token = jwt.sign(JSON.parse("{"+html+"}"), cfgSignatureSecret, {expiresIn: cfgSignatureSecretExpiresIn});
}
res.render("editor", argss);
});
} else {
res.render("editor", argss);
}
}
catch (ex) {
console.log(ex);

View File

@ -12,16 +12,16 @@
},
"server": {
"port": 3000,
"siteUrl": "https://doc.onlyoffice.com/",
"siteUrl": "http://documentserver/",
"commandUrl": "coauthoring/CommandService.ashx",
"storageUrl": "FileUploader.ashx",
"converterUrl": "ConvertService.ashx",
"tempStorageUrl": "ResourceService.ashx",
"apiUrl": "web-apps/apps/api/documents/api.js",
"preloaderUrl": "web-apps/apps/api/documents/cache-scripts.html",
"viewedDocs": [".ppt", ".pps", ".odp", ".pdf", ".djvu", ".epub", ".xps"],
"editedDocs": [".docx", ".doc", ".odt", ".xlsx", ".xls", ".ods", ".csv", ".pptx", ".ppsx", ".rtf", ".txt", ".mht", ".html", ".htm"],
"convertedDocs": [".doc", ".odt", ".xls", ".ods", ".ppt", ".pps", ".odp", ".rtf", ".mht", ".html", ".htm", ".epub"],
"exampleUrl": null,
"viewedDocs": [".pdf", ".djvu", ".xps"],
"editedDocs": [".docx", ".xlsx", ".csv", ".pptx", ".ppsx", ".txt"],
"convertedDocs": [".docm", ".doc", ".dotx", ".dotm", ".dot", ".odt", ".fodt", ".xlsm", ".xls", ".xltx", ".xltm", ".xlt", ".ods", ".fods", ".pptm", ".ppt", ".ppsm", ".pps", ".potx", ".potm", ".pot", ".odp", ".fodp", ".rtf", ".mht", ".html", ".htm", ".epub"],
"storageFolder": "files",
"maxFileSize": 1073741824,
"mobileRegEx": "android|avantgo|playbook|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino",
@ -30,18 +30,18 @@
"name": "/public",
"path": "public"
}
]
],
"token": {
"enable": false,
"useforrequest": true,
"algorithmRequest": "HS256",
"authorizationHeader": "Authorization",
"authorizationHeaderPrefix": "Bearer ",
"secret": "secret",
"expiresIn": "5m"
}
},
"plugins": {
"url": "",
"pluginsData": [
"../../../../sdkjs-plugins/helloworld/config.json",
"../../../../sdkjs-plugins/chess/config.json",
"../../../../sdkjs-plugins/speech/config.json",
"../../../../sdkjs-plugins/youtube/config.json",
"../../../../sdkjs-plugins/cbr/config.json",
"../../../../sdkjs-plugins/ocr/config.json",
"../../../../sdkjs-plugins/clipart/config.json"
]
"pluginsData": []
}
}
}

View File

@ -1,6 +1,8 @@
{
"server": {
"port": 3000,
"siteUrl": "http://127.0.0.1:8080/"
"siteUrl": "http://127.0.0.1:8080/",
"apiUrl": "web-apps-pro/apps/api/documents/api.js",
"preloaderUrl": "web-apps-pro/apps/api/documents/cache-scripts.html"
}
}

View File

@ -1,25 +1,8 @@
{
"server": {
"port": 80,
"siteUrl": "http://127.0.0.1:8001/"
},
"plugins": {
"pluginsData": [
"../../../../sdkjs-plugins/helloworld/config.json",
"../../../../sdkjs-plugins/chess/config.json",
"../../../../sdkjs-plugins/glavred/config.json",
"../../../../sdkjs-plugins/speech/config.json",
"../../../../sdkjs-plugins/youtube/config.json",
"../../../../sdkjs-plugins/cbr/config.json",
"../../../../sdkjs-plugins/num2word/config.json",
"../../../../sdkjs-plugins/ocr/config.json",
"../../../../sdkjs-plugins/yandextranslaterus/config.json",
"../../../../sdkjs-plugins/clipart/config.json",
"../../../../sdkjs-plugins/translate/config.json",
"../../../../sdkjs-plugins/templates/config.json",
"../../../../sdkjs-plugins/telegram/config.json",
"../../../../sdkjs-plugins/invoices/config.json"
],
"UIpluginsData": []
"siteUrl": "http://127.0.0.1:8001/",
"apiUrl": "web-apps-pro/apps/api/documents/api.js",
"preloaderUrl": "web-apps-pro/apps/api/documents/cache-scripts.html"
}
}

View File

@ -2,8 +2,5 @@
"server": {
"siteUrl": "/",
"maxFileSize": 104857600
},
"plugins": {
"url": "/sdkjs-plugins/"
}
}

View File

@ -7,15 +7,7 @@
"name": "/public",
"path": "public",
"options": {"maxAge": "7d"}
},
{
"name": "/sdkjs-plugins",
"path": "sdkjs-plugins",
"options": {"maxAge": "7d"}
}
]
},
"plugins": {
"url": "/sdkjs-plugins/"
}
}

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
@ -32,12 +33,6 @@ const guidManager = require("./guidManager");
const configServer = require('config').get('server');
const storageFolder = configServer.get('storageFolder');
const os = require("os");
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
let docManager = {};
@ -79,30 +74,30 @@ docManager.getLang = function () {
docManager.getCustomParams = function () {
let params = "";
const userid = docManager.req.query.userid;
const userid = docManager.req.query.userid;
params += (userid ? "&userid=" + userid : "");
const name = docManager.req.query.name;
const name = docManager.req.query.name;
params += (name ? "&name=" + name : "");
const lang = docManager.req.query.lang;
const lang = docManager.req.query.lang;
params += (lang ? "&lang=" + docManager.getLang() : "");
const fileName = docManager.req.query.fileName;
const fileName = docManager.req.query.fileName;
params += (fileName ? "&fileName=" + fileName : "");
const mode = docManager.req.query.mode;
const mode = docManager.req.query.mode;
params += (mode ? "&mode=" + mode : "");
const type = docManager.req.query.type;
const type = docManager.req.query.type;
params += (type ? "&type=" + type : "");
return params;
};
docManager.getCorrectName = function (fileName, userAddress) {
const baseName = fileUtility.getFileName(fileName, true);
const ext = fileUtility.getFileExtension(fileName);
const baseName = fileUtility.getFileName(fileName, true);
const ext = fileUtility.getFileExtension(fileName);
let name = baseName + ext;
let index = 1;
@ -125,14 +120,14 @@ docManager.createDemo = function (demoName, userid, username) {
};
docManager.saveFileData = function (fileName, userid, username) {
const userAddress = docManager.curUserHostAddress();
const date_create = fileSystem.statSync(docManager.storagePath(fileName)).mtime;
const minutes = (date_create.getMinutes() < 10 ? '0' : '') + date_create.getMinutes().toString();
const month = (date_create.getMonth() < 10 ? '0' : '') + (parseInt(date_create.getMonth().toString()) + 1);
const sec = (date_create.getSeconds() < 10 ? '0' : '') + date_create.getSeconds().toString();
const date_format = date_create.getFullYear() + "-" + month + "-" + date_create.getDate() + " " + date_create.getHours() + ":" + minutes + ":" + sec;
const userAddress = docManager.curUserHostAddress();
const date_create = fileSystem.statSync(docManager.storagePath(fileName)).mtime;
const minutes = (date_create.getMinutes() < 10 ? '0' : '') + date_create.getMinutes().toString();
const month = (date_create.getMonth() < 10 ? '0' : '') + (parseInt(date_create.getMonth().toString()) + 1);
const sec = (date_create.getSeconds() < 10 ? '0' : '') + date_create.getSeconds().toString();
const date_format = date_create.getFullYear() + "-" + month + "-" + date_create.getDate() + " " + date_create.getHours() + ":" + minutes + ":" + sec;
const file_info = docManager.historyPath(fileName, userAddress, true);
const file_info = docManager.historyPath(fileName, userAddress, true);
this.createDirectory(file_info);
fileSystem.writeFileSync(path.join(file_info, fileName + ".txt"), date_format + "," + userid + "," + username);
@ -148,28 +143,28 @@ docManager.getFileData = function (fileName, userAddress) {
};
docManager.getFileUri = function (fileName) {
return docManager.getlocalFileUri(fileName);
return docManager.getlocalFileUri(fileName, 0, true);
};
docManager.getlocalFileUri = function (fileName, version) {
const serverPath = docManager.getServerUrl();
const storagePath = storageFolder.length ? storageFolder + "/" : "";
const hostAddress = docManager.curUserHostAddress();
const url = serverPath + "/" + storagePath + hostAddress + "/" + encodeURIComponent(fileName);
docManager.getlocalFileUri = function (fileName, version, forDocumentServer) {
const serverPath = docManager.getServerUrl(forDocumentServer);
const storagePath = storageFolder.length ? storageFolder + "/" : "";
const hostAddress = docManager.curUserHostAddress();
const url = serverPath + "/" + storagePath + hostAddress + "/" + encodeURIComponent(fileName);
if (!version) {
return url;
}
return url + "-history/" + version;
};
docManager.getServerUrl = function () {
return docManager.getProtocol() + "://" + docManager.req.get("host");
docManager.getServerUrl = function (forDocumentServer) {
return (forDocumentServer && !!configServer.get("exampleUrl")) ? configServer.get("exampleUrl") : (docManager.getProtocol() + "://" + docManager.req.get("host"));
};
docManager.getCallback = function (fileName) {
const server = docManager.getServerUrl();
const hostAddress = docManager.curUserHostAddress();
const handler = "/track?filename=" + encodeURIComponent(fileName) + "&useraddress=" + encodeURIComponent(hostAddress);
const server = docManager.getServerUrl(true);
const hostAddress = docManager.curUserHostAddress();
const handler = "/track?filename=" + encodeURIComponent(fileName) + "&useraddress=" + encodeURIComponent(hostAddress);
return server + handler;
};
@ -181,6 +176,23 @@ docManager.storagePath = function (fileName, userAddress) {
return path.join(directory, fileName);
};
docManager.forcesavePath = function (fileName, userAddress, create) {
let directory = path.join(docManager.dir, "public", storageFolder, docManager.curUserHostAddress(userAddress));
if (!this.existsSync(directory)) {
return "";
}
directory = path.join(directory, fileName + "-history");
if (!create && !this.existsSync(directory)) {
return "";
}
this.createDirectory(directory);
directory = path.join(directory, fileName);
if (!create && !this.existsSync(directory)) {
return "";
}
return directory;
};
docManager.historyPath = function (fileName, userAddress, create) {
let directory = path.join(docManager.dir, "public", storageFolder, docManager.curUserHostAddress(userAddress));
if (!this.existsSync(directory)) {
@ -194,7 +206,7 @@ docManager.historyPath = function (fileName, userAddress, create) {
};
docManager.versionPath = function (fileName, userAddress, version) {
const historyPath = docManager.historyPath(fileName, userAddress, true);
const historyPath = docManager.historyPath(fileName, userAddress, true);
return path.join(historyPath, "" + version);
};
@ -219,21 +231,21 @@ docManager.changesUser = function (fileName, userAddress, version) {
};
docManager.getStoredFiles = function () {
const directory = path.join(docManager.dir, "public", storageFolder, docManager.curUserHostAddress());
const directory = path.join(docManager.dir, "public", storageFolder, docManager.curUserHostAddress());
this.createDirectory(directory);
const result = [];
const storedFiles = fileSystem.readdirSync(directory);
const result = [];
const storedFiles = fileSystem.readdirSync(directory);
for (let i = 0; i < storedFiles.length; i++) {
const stats = fileSystem.lstatSync(path.join(directory, storedFiles[i]));
const stats = fileSystem.lstatSync(path.join(directory, storedFiles[i]));
if (!stats.isDirectory()) {
const time = stats.mtime.getTime();
const item = {
const time = stats.mtime.getTime();
const item = {
time: time,
name: storedFiles[i],
url: docManager.getlocalFileUri(storedFiles[i]),
documentType: fileUtility.getFileType(storedFiles[i])
documentType: fileUtility.getFileType(storedFiles[i]),
canEdit: configServer.get("editedDocs").indexOf(fileUtility.getFileExtension(storedFiles[i])) != -1
};
if (!result.length) {
@ -281,16 +293,16 @@ docManager.getInternalExtension = function (fileType) {
};
docManager.getKey = function (fileName) {
const userAddress = docManager.curUserHostAddress();
const userAddress = docManager.curUserHostAddress();
let key = userAddress + docManager.getlocalFileUri(fileName);
let historyPath = docManager.historyPath(fileName, userAddress);
let historyPath = docManager.historyPath(fileName, userAddress);
if (historyPath != ""){
key += docManager.countVersion(historyPath);
}
historyPath = docManager.historyPath(fileName, userAddress, true);
const stat = fileSystem.statSync(historyPath);
let storagePath = docManager.storagePath(fileName, userAddress);
const stat = fileSystem.statSync(storagePath);
key += stat.mtime.toString();
return documentService.generateRevisionId(key);
@ -302,7 +314,10 @@ docManager.getDate = function (date) {
};
docManager.getChanges = function (fileName) {
return JSON.parse(fileSystem.readFileSync(fileName));
if (this.existsSync(fileName)) {
return JSON.parse(fileSystem.readFileSync(fileName));
}
return null;
};
docManager.countVersion = function(directory) {
@ -327,8 +342,8 @@ docManager.getHistory = function (fileName, content, keyVersion, version) {
const userAddress = docManager.curUserHostAddress();
const username = content ? (oldVersion ? contentJson.username : contentJson.user.name) : (docManager.getFileData(fileName, userAddress))[2];
const userid = content ? (oldVersion ? contentJson.userid : contentJson.user.id) : (docManager.getFileData(fileName, userAddress))[1];
const created = content ? (oldVersion ? contentJson.date : contentJson.created) : (docManager.getFileData(fileName, userAddress))[0];
const userid = content ? (oldVersion ? contentJson.userid : contentJson.user.id) : (docManager.getFileData(fileName, userAddress))[1];
const created = content ? (oldVersion ? contentJson.date : contentJson.created) : (docManager.getFileData(fileName, userAddress))[0];
const res = (content && !oldVersion) ? content : {changes: content};
res.key = keyVersion;
res.version = version;
@ -342,20 +357,20 @@ docManager.getHistory = function (fileName, content, keyVersion, version) {
};
docManager.cleanFolderRecursive = function (folder, me) {
if (fileSystem.existsSync(folder)) {
const files = fileSystem.readdirSync(folder);
files.forEach((file) => {
const curPath = path.join(folder, file);
if (fileSystem.lstatSync(curPath).isDirectory()) {
this.cleanFolderRecursive(curPath, true);
} else {
fileSystem.unlinkSync(curPath);
}
});
if (me) {
fileSystem.rmdirSync(folder);
}
}
if (fileSystem.existsSync(folder)) {
const files = fileSystem.readdirSync(folder);
files.forEach((file) => {
const curPath = path.join(folder, file);
if (fileSystem.lstatSync(curPath).isDirectory()) {
this.cleanFolderRecursive(curPath, true);
} else {
fileSystem.unlinkSync(curPath);
}
});
if (me) {
fileSystem.rmdirSync(folder);
}
}
};
module.exports = docManager;

View File

@ -2,34 +2,44 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
var path = require("path");
var urlModule = require("url");
var urllib = require("urllib");
var xml2js = require("xml2js");
var jwt = require("jsonwebtoken");
var jwa = require("jwa");
var fileUtility = require("./fileUtility");
var guidManager = require("./guidManager");
var configServer = require('config').get('server');
var siteUrl = configServer.get('siteUrl');
var cfgSignatureEnable = configServer.get('token.enable');
var cfgSignatureUseForRequest = configServer.get('token.useforrequest');
var cfgSignatureAuthorizationHeader = configServer.get('token.authorizationHeader');
var cfgSignatureAuthorizationHeaderPrefix = configServer.get('token.authorizationHeaderPrefix');
var cfgSignatureSecretExpiresIn = configServer.get('token.expiresIn');
var cfgSignatureSecret = configServer.get('token.secret');
var cfgSignatureSecretAlgorithmRequest = configServer.get('token.algorithmRequest');
var documentService = {};
@ -64,42 +74,25 @@ documentService.getConvertedUri = function (documentUri, fromExtension, toExtens
key: documentRevisionId
};
urllib.request(siteUrl + configServer.get('converterUrl'),
var uri = siteUrl + configServer.get('converterUrl');
var headers = {
'Content-Type': 'application/json',
"Accept": "application/json"
};
if (cfgSignatureEnable && cfgSignatureUseForRequest) {
headers[cfgSignatureAuthorizationHeader] = cfgSignatureAuthorizationHeaderPrefix + this.fillJwtByUrl(uri, params);
}
urllib.request(uri,
{
method: "POST",
headers: {
'Content-Type': 'application/json'
},
headers: headers,
data: params
},
callback);
};
documentService.getExternalUri = function (fileStream, contentLength, contentType, documentRevisionId, callback) {
documentRevisionId = documentService.generateRevisionId(documentRevisionId);
var urlTostorage = siteUrl + configServer.get('storageUrl') + "?key=" + documentRevisionId;
urllib.request(urlTostorage,
{
method: "POST",
headers: {
"Content-Type": contentType == null ? "application/octet-stream" : contentType,
"Content-Length": contentLength.toString(),
"charset": "utf-8"
},
data: fileStream
},
function (err, data) {
if (err) {
callback();
return;
}
var res = documentService.getResponseUri(data);
callback(res.value);
});
};
documentService.generateRevisionId = function (expectedKey) {
if (expectedKey.length > 20) {
expectedKey = expectedKey.hashCode().toString();
@ -116,10 +109,10 @@ documentService.processConvertServiceResponceError = function (errorCode) {
switch (errorCode) {
case -20:
errorMessage = errorMessageTemplate + "vkey deciphering error";
errorMessage = errorMessageTemplate + "Error encrypt signature";
break;
case -8:
errorMessage = errorMessageTemplate + "Error document VKey";
errorMessage = errorMessageTemplate + "Error document signature";
break;
case -7:
errorMessage = errorMessageTemplate + "Error document request";
@ -152,33 +145,22 @@ documentService.processConvertServiceResponceError = function (errorCode) {
throw { message: errorMessage };
};
documentService.getResponseUri = function (xml) {
var json = documentService.convertXmlStringToJson(xml);
documentService.getResponseUri = function (json) {
var fileResult = JSON.parse(json);
if (!json.FileResult)
throw { message: "FileResult node is null" };
if (fileResult.error)
documentService.processConvertServiceResponceError(parseInt(fileResult.error));
var fileResult = json.FileResult;
var isEndConvert = fileResult.endConvert
if (fileResult.Error)
documentService.processConvertServiceResponceError(parseInt(fileResult.Error[0]));
if (!fileResult.EndConvert)
throw { message: "EndConvert node is null" };
var isEndConvert = fileResult.EndConvert[0].toLowerCase() === "true";
if (!fileResult.Percent)
throw { message: "Percent node is null" };
var percent = parseInt(fileResult.Percent[0]);
var percent = parseInt(fileResult.percent);
var uri = null;
if (isEndConvert) {
if (!fileResult.FileUrl)
throw { message: "FileUrl node is null" };
if (!fileResult.fileUrl)
throw { message: "FileUrl is null" };
uri = fileResult.FileUrl[0];
uri = fileResult.fileUrl;
percent = 100;
} else {
percent = percent >= 100 ? 99 : percent;
@ -190,16 +172,6 @@ documentService.getResponseUri = function (xml) {
};
};
documentService.convertXmlStringToJson = function (xml) {
var res;
xml2js.parseString(xml, function (err, result) {
res = result;
});
return res;
};
documentService.commandRequest = function (method, documentRevisionId, callback) {
documentRevisionId = documentService.generateRevisionId(documentRevisionId);
var params = {
@ -207,15 +179,43 @@ documentService.commandRequest = function (method, documentRevisionId, callback)
key: documentRevisionId
};
urllib.request(siteUrl + configServer.get('commandUrl'),
var uri = siteUrl + configServer.get('commandUrl');
var headers = {
'Content-Type': 'application/json'
};
if (cfgSignatureEnable && cfgSignatureUseForRequest) {
headers[cfgSignatureAuthorizationHeader] = cfgSignatureAuthorizationHeaderPrefix + this.fillJwtByUrl(uri, params);
}
urllib.request(uri,
{
method: "POST",
headers: {
'Content-Type': 'application/json'
},
headers: headers,
data: params
},
callback);
};
documentService.checkJwtHeader = function (req) {
var decoded = null;
var authorization = req.get(cfgSignatureAuthorizationHeader);
if (authorization && authorization.startsWith(cfgSignatureAuthorizationHeaderPrefix)) {
var token = authorization.substring(cfgSignatureAuthorizationHeaderPrefix.length);
try {
decoded = jwt.verify(token, cfgSignatureSecret);
} catch (err) {
console.log('checkJwtHeader error: name = ' + err.name + ' message = ' + err.message + ' token = ' + token)
}
}
return decoded;
}
documentService.fillJwtByUrl = function (uri, opt_dataObject, opt_iss, opt_payloadhash) {
var parseObject = urlModule.parse(uri, true);
var payload = {query: parseObject.query, payload: opt_dataObject, payloadhash: opt_payloadhash};
var options = {algorithm: cfgSignatureSecretAlgorithmRequest, expiresIn: cfgSignatureSecretExpiresIn, issuer: opt_iss};
return jwt.sign(payload, cfgSignatureSecret, options);
}
module.exports = documentService;

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
@ -76,11 +77,11 @@ fileUtility.fileType = {
presentation: "presentation"
}
fileUtility.documentExts = [".docx", ".doc", ".odt", ".rtf", ".txt", ".html", ".htm", ".mht", ".pdf", ".djvu", ".fb2", ".epub", ".xps"];
fileUtility.documentExts = [".doc", ".docx", ".docm", ".dot", ".dotx", ".dotm", ".odt", ".fodt", ".rtf", ".txt", ".html", ".htm", ".mht", ".pdf", ".djvu", ".fb2", ".epub", ".xps"];
fileUtility.spreadsheetExts = [".xls", ".xlsx", ".ods", ".csv"];
fileUtility.spreadsheetExts = [".xls", ".xlsx", ".xlsm", ".xlt", ".xltx", ".xltm", ".ods", ".fods", ".csv"];
fileUtility.presentationExts = [".pps", ".ppsx", ".ppt", ".pptx", ".odp"];
fileUtility.presentationExts = [".pps", ".ppsx", ".ppsm", ".ppt", ".pptx", ".pptm", ".pot", ".potx", ".potm", ".odp", ".fodp"];
function getUrlParams(url) {
try {

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -20,11 +20,13 @@
"ejs": "~2.5.1",
"express": "^4.14.1",
"formidable": "^1.1.1",
"jsonwebtoken": "^7.1.9",
"jwa": "^1.1.4",
"log4js": "^0.6.38",
"mime": "^1.3.4",
"serve-favicon": "~2.3.0",
"sync-request": "^4.0.1",
"urllib": "^2.20.0",
"xml2js": "~0.4.17"
"urllib": "^2.20.0"
},
"license": "MIT",
"repository": {

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

After

Width:  |  Height:  |  Size: 145 B

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
@ -34,6 +35,8 @@ if (typeof jQuery != "undefined") {
userid = getUrlVars()["userid"];
language = getUrlVars()["lang"];
mustReload = false;
if ("" != language && undefined != language)
jq("#language").val(language);
else
@ -99,6 +102,7 @@ if (typeof jQuery != "undefined") {
}
jq("#hiddenFileName").val(response.filename);
mustReload = true;
jq("#step1").addClass("done").removeClass("current");
jq("#step2").addClass("current");
@ -240,6 +244,9 @@ if (typeof jQuery != "undefined") {
jq('#hiddenFileName').val("");
jq("#embeddedView").attr("src", "");
jq.unblockUI();
if (mustReload) {
document.location.reload();
}
});
jq(document).on("click", ".delete-file", function () {

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
@ -116,6 +117,7 @@ label .checkbox {
background-image: url("../images/file_pptx.png");
}
.create-sample {
display: inline-block;
margin-left: 75px;
}
.button, .button:visited, .button:hover, .button:active {

View File

@ -0,0 +1,49 @@
"width": "100%",
"height": "100%",
"type": "<%- editor.type %>",
"documentType": "<%- editor.documentType %>",
"token": "<%- editor.token %>",
"document": {
"title": "<%- file.name %>",
"url": "<%- file.uri %>",
"fileType": "<%- file.ext %>",
"key": "<%- editor.key %>",
"info": {
"author": "Me",
"created": "<%- file.created %>"
},
"permissions": {
"comment": <%- editor.comment %>,
"download": true,
"edit": <%- editor.isEdit %>,
"modifyFilter": <%- editor.modifyFilter %>,
"review": <%- editor.review %>
}
},
"editorConfig": {
"mode": "<%- editor.mode %>",
"lang": "<%- editor.lang %>",
"callbackUrl": "<%- editor.callbackUrl %>",
"user": {
"id": "<%- editor.userid %>",
"name": "<%- editor.name %>"
},
"embedded": {
"saveUrl": "<%- file.uri %>",
"embedUrl": "<%- file.uri %>",
"shareUrl": "<%- file.uri %>",
"toolbarDocked": "top"
},
"customization": {
"about": true,
"chat": true,
"comments": true,
"feedback": true,
"forcesave": false,
"goback": {
"url": "<%- editor.backUrl %>"
}
},
"fileChoiceUrl": "<%- editor.fileChoiceUrl %>",
"plugins": <%- editor.plugins %>
}

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*-->
@ -44,8 +45,6 @@
<script type="text/javascript" language="javascript">
var docEditor;
var fileName = "<%= file.name %>";
var fileType = "<%= file.ext %>";
var innerAlert = function (message) {
if (console && console.log)
@ -70,21 +69,16 @@
docEditor.refreshHistory(
{
currentVersion: "<%= file.version %>",
currentVersion: "<%- file.version %>",
history: historyObj
});
};
var onRequestHistoryData = function (data) {
var version = data.data;
var url_arr = "<%= setHistoryData.url %>".split(",");
var changesUrl_arr = "<%= setHistoryData.changesUrl %>".split(",");
var historyData = <%- JSON.stringify(historyData) %> || null;
docEditor.setHistoryData({
version: version,
url: url_arr[version - 1] != "" ? url_arr[version - 1] : null,
changesUrl: changesUrl_arr[version - 1] != "" ? changesUrl_arr[version - 1] : null
});
docEditor.setHistoryData(historyData[version-1]);
};
var onRequestHistoryClose = function (event){
@ -102,53 +96,7 @@
var connectEditor = function () {
docEditor = new DocsAPI.DocEditor("iframeEditor",
{
width: "100%",
height: "100%",
type: "<%= editor.type %>",
documentType: "<%= editor.documentType %>",
document: {
title: fileName,
url: "<%= file.uri %>",
fileType: fileType,
key: "<%= editor.key %>",
info: {
author: "Me",
created: new Date().toDateString()
},
permissions: {
download: true,
edit: "<%= editor.isEdit %>" == "true",
review: true,
}
},
editorConfig: {
mode: "<%= editor.mode %>",
lang: "<%= editor.lang %>",
callbackUrl: "<%- editor.callbackUrl %>",
user: {
id: "<%= editor.userid %>",
name: "<%= editor.name %>",
},
embedded: {
saveUrl: "<%= file.uri %>",
embedUrl: "<%= file.uri %>",
shareUrl: "<%= file.uri %>",
toolbarDocked: "top"
},
customization: {
about: true,
chat: true,
comments: true,
feedback: true,
goback: {
url: "<%= editor.getServerUrl %>"
}
},
fileChoiceUrl: "<%= editor.fileChoiceUrl %>",
plugins: <%- JSON.stringify(editor.plugins) %>
},
docEditor = new DocsAPI.DocEditor("iframeEditor", {<% include config %>,
events: {
"onReady": onReady,
"onDocumentStateChange": onDocumentStateChange,
@ -160,12 +108,25 @@
"onOutdatedVersion": onOutdatedVersion,
}
});
fixSize();
};
var fixSize = function () {
var wrapEl = document.getElementsByClassName("form");
if (wrapEl.length) {
wrapEl[0].style.height = screen.availHeight + "px";
window.scrollTo(0, -1);
wrapEl[0].style.height = window.innerHeight + "px";
}
};
if (window.addEventListener) {
window.addEventListener("load", connectEditor);
window.addEventListener("resize", fixSize);
} else if (window.attachEvent) {
window.attachEvent("onload", connectEditor);
window.attachEvent("onresize", fixSize);
}
</script>

View File

@ -1,25 +1,26 @@
<!--*
*
* (c) Copyright Ascensio System Limited 2010-2017
* (c) Copyright Ascensio System Limited 2010-
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*-->
@ -30,7 +31,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width" />
<title>ONLYOFFICE Integration Edition</title>
<title>ONLYOFFICE Document Editors</title>
<link href="images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Open+Sans:900,800,700,600,500,400,300&subset=latin,cyrillic-ext,cyrillic,latin-ext" />
<link rel="stylesheet" type="text/css" href="stylesheets/stylesheet.css" />
@ -43,10 +44,10 @@
</a>
</header>
<div class="main-panel">
<span class="portal-name">ONLYOFFICE Integration Edition Welcome!</span>
<span class="portal-name">ONLYOFFICE Document Editors Welcome!</span>
<br />
<br />
<span class="portal-descr">Get started with a demo-sample of ONLYOFFICE Integration Edition, the first html5-based editors. You may upload your own documents for testing using the "Upload file" button and selecting the necessary files on your PC.</span>
<span class="portal-descr">Get started with a demo-sample of ONLYOFFICE Document Editors, the first html5-based editors. You may upload your own documents for testing using the "Upload file" button and selecting the necessary files on your PC.</span>
<table class="user-block-table" cellspacing="0" cellpadding="0">
<tr>
<td valign="middle" width="30%">
@ -62,7 +63,7 @@
<tr>
<td valign="middle" width="30%">
<select class="select-user" id="language">
<option value="en" selected>English</option>
<option value="en">English</option>
<option value="de">Deutsch</option>
<option value="es">Espanol</option>
<option value="fr">Francais</option>
@ -129,7 +130,7 @@
<thead>
<tr class="tableHeader">
<td class="tableHeaderCell tableHeaderCellFileName">Filename</td>
<td colspan="3" class="tableHeaderCell contentCells-shift">Editors</td>
<td colspan="4" class="tableHeaderCell contentCells-shift">Editors</td>
<td colspan="3" class="tableHeaderCell">Viewers</td>
</tr>
</thead>
@ -138,12 +139,13 @@
<tr class="tableRow" title="<%=storedFiles[i].name%>">
<td class="contentCells">
<a class="stored-edit <%= storedFiles[i].documentType %>" href="editor?fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
<span title="<%= storedFiles[i].url %>"><%= storedFiles[i].name %></span></a>
<a href="<%= storedFiles[i].url %>">
<span title="<%= storedFiles[i].name %>"><%= storedFiles[i].name %></span></a>
<a href="download?fileName=<%= encodeURIComponent(storedFiles[i].name) %>">
<img class="icon-download" src="images/download-24.png" alt="Download" title="Download" /></a>
<a class="delete-file" data="<%= encodeURIComponent(storedFiles[i].name) %>">
<img class="icon-delete" src="images/delete-24.png" alt="Delete" title="Delete" /></a>
</td>
<% if (storedFiles[i].canEdit) { %>
<td class="contentCells contentCells-icon">
<a href="editor?type=desktop&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
<img src="images/desktop-24.png" alt="Open in editor for full size screens" title="Open in editor for full size screens" /></a>
@ -152,12 +154,24 @@
<a href="editor?type=mobile&mode=edit&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
<img src="images/mobile-24.png" alt="Open in editor for mobile devices" title="Open in editor for mobile devices" /></a>
</td>
<td class="contentCells contentCells-shift contentCells-icon">
<td class="contentCells contentCells-icon">
<% if (storedFiles[i].documentType == "text") { %>
<a href="editor?type=desktop&mode=review&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
<img src="images/review-24.png" alt="Open in editor for review" title="Open in editor for review" /></a>
<% } else if (storedFiles[i].documentType == "spreadsheet") { %>
<a href="editor?type=desktop&mode=filter&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
<img src="images/filter-24.png" alt="Open in editor without access to change the filter" title="Open in editor without access to change the filter" /></a>
<% } %>
</td>
<td class="contentCells contentCells-shift contentCells-icon">
<% if (storedFiles[i].documentType == "text") { %>
<a href="editor?type=desktop&mode=comment&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
<img src="images/comment-24.png" alt="Open in editor for comment" title="Open in editor for comment" /></a>
<% } %>
</td>
<% } else { %>
<td class="contentCells contentCells-shift contentCells-icon" colspan="4"></td>
<% } %>
<td class="contentCells contentCells-icon">
<a href="editor?type=desktop&mode=view&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
<img src="images/desktop-24.png" alt="Open in viewer for full size screens" title="Open in viewer for full size screens" /></a>
@ -183,7 +197,7 @@
<div class="help-block">
<span>Want to learn the magic?</span>
<br />
Explore ONLYOFFICE Integration Edition <a href="http://api.onlyoffice.com/editors/howitworks" target="_blank">API Documentation.</a>
Explore ONLYOFFICE Document Editors <a href="http://api.onlyoffice.com/editors/howitworks" target="_blank">API Documentation.</a>
</div>
<br />
<br />

View File

@ -1,3 +1,31 @@
<?php
/*
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
?>
<?php
require( dirname(__FILE__) . '/config.php' );

View File

@ -3,24 +3,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 <20> 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 <20> 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
?>
@ -34,7 +35,7 @@ function sendlog($msg, $logFileName) {
file_put_contents($logFileName, $msg . PHP_EOL, FILE_APPEND);
}
function guid(){
function guid() {
if (function_exists('com_create_guid')) {
return com_create_guid();
} else {
@ -232,7 +233,6 @@ function getStoredFiles() {
$dat = filemtime($directory . DIRECTORY_SEPARATOR . $fileName);
$result[$dat] = (object) array(
"name" => $fileName,
"url" => FileUri($fileName),
"documentType" => getDocumentType($fileName)
);
}

View File

@ -6,36 +6,36 @@ $GLOBALS['ALONE'] = FALSE;
$GLOBALS['MODE'] = "";
$GLOBALS['DOC_SERV_VIEWD'] = array(".ppt",".pps",".odp",".pdf",".djvu",".epub",".xps");
$GLOBALS['DOC_SERV_EDITED'] = array(".docx",".doc",".odt",".xlsx",".xls",".ods",".csv",".pptx",".ppsx",".rtf",".txt",".mht",".html",".htm");
$GLOBALS['DOC_SERV_CONVERT'] = array(".doc",".odt",".xls",".ods",".ppt",".pps",".odp",".rtf",".mht",".html",".htm",".epub");
$GLOBALS['DOC_SERV_VIEWD'] = array(".pdf", ".djvu", ".xps");
$GLOBALS['DOC_SERV_EDITED'] = array(".docx", ".xlsx", ".csv", ".pptx", ".ppsx", ".txt");
$GLOBALS['DOC_SERV_CONVERT'] = array(".docm", ".doc", ".dotx", ".dotm", ".dot", ".odt", ".fodt", ".xlsm", ".xls", ".xltx", ".xltm", ".xlt", ".ods", ".fods", ".pptm", ".ppt", ".ppsm", ".pps", ".potx", ".potm", ".pot", ".odp", ".fodp", ".rtf", ".mht", ".html", ".htm", ".epub");
$GLOBALS['DOC_SERV_TIMEOUT'] = "120000";
$GLOBALS['DOC_SERV_STORAGE_URL'] = "https://doc.onlyoffice.com/FileUploader.ashx";
$GLOBALS['DOC_SERV_CONVERTER_URL'] = "https://doc.onlyoffice.com/ConvertService.ashx";
$GLOBALS['DOC_SERV_API_URL'] = "https://doc.onlyoffice.com/web-apps/apps/api/documents/api.js";
$GLOBALS['DOC_SERV_CONVERTER_URL'] = "http://documentserver/ConvertService.ashx";
$GLOBALS['DOC_SERV_API_URL'] = "http://documentserver/web-apps/apps/api/documents/api.js";
$GLOBALS['DOC_SERV_PRELOADER_URL'] = "https://doc.onlyoffice.com/web-apps/apps/api/documents/cache-scripts.html";
$GLOBALS['DOC_SERV_PRELOADER_URL'] = "http://documentserver/web-apps/apps/api/documents/cache-scripts.html";
$GLOBALS['EXAMPLE_URL'] = "";
$GLOBALS['MOBILE_REGEX'] = "android|avantgo|playbook|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino";
$GLOBALS['ExtsSpreadsheet'] = array(".xls", ".xlsx",
".ods", ".csv");
$GLOBALS['ExtsSpreadsheet'] = array(".xls", ".xlsx", ".xlsm",
".xlt", ".xltx", ".xltm",
".ods", ".fods", ".csv");
$GLOBALS['ExtsPresentation'] = array(".pps", ".ppsx",
".ppt", ".pptx",
".odp");
$GLOBALS['ExtsPresentation'] = array(".pps", ".ppsx", ".ppsm",
".ppt", ".pptx", ".pptm",
".pot", ".potx", ".potm",
".odp", ".fodp");
$GLOBALS['ExtsDocument'] = array(".docx", ".doc", ".odt", ".rtf", ".txt",
".html", ".htm", ".mht", ".pdf", ".djvu",
".fb2", ".epub", ".xps");
if ( !defined('ServiceConverterMaxTry') )
define( 'ServiceConverterMaxTry', 3);
$GLOBALS['ExtsDocument'] = array(".doc", ".docx", ".docm",
".dot", ".dotx", ".dotm",
".odt", ".fodt", ".rtf", ".txt",
".html", ".htm", ".mht",
".pdf", ".djvu", ".fb2", ".epub", ".xps");
?>

View File

@ -2,24 +2,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/

View File

@ -3,24 +3,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
?>

View File

@ -3,24 +3,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 <20> 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 <20> 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
?>
@ -30,56 +31,6 @@
require_once( dirname(__FILE__) . '/config.php' );
function GetExternalFileUri($local_uri) {
$externalUri = '';
try
{
$documentRevisionId = GenerateRevisionId($local_uri);
if (($fileContents = file_get_contents(str_replace(" ","%20", $local_uri)))===FALSE){
throw new Exception("Bad Request");
} else {
$contentType = mime_content_type($local_uri);
$urlToService = generateUrlToStorage('', '', '', '', $documentRevisionId);
$opts = array('http' => array(
'method' => 'POST',
'header' => "User-Agent: " . $_SERVER['HTTP_USER_AGENT'] . "\r\n" .
"Content-Type: " . $contentType . "\r\n" .
"Content-Length: " . strlen($fileContents) . "\r\n",
'content' => $fileContents,
'timeout' => $GLOBALS['DOC_SERV_TIMEOUT']
)
);
if (substr($urlToService, 0, strlen("https")) === "https") {
$opts['ssl'] = array( 'verify_peer' => FALSE );
}
$context = stream_context_create($opts);
if (($response_data = file_get_contents($urlToService, FALSE, $context))===FALSE){
throw new Exception ("Could not get an answer");
} else {
sendlog("GetExternalUri response_data:" . PHP_EOL . $response_data, "logs/common.log");
GetResponseUri($response_data, $externalUri);
}
sendlog("GetExternalFileUri. externalUri = " . $externalUri, "logs/common.log");
return $externalUri . "";
}
}
catch (Exception $e)
{
sendlog("GetExternalFileUri Exception: " . $e->getMessage(), "logs/common.log");
}
return $local_uri;
}
function DoUpload($fileUri) {
$_fileName = GetCorrectName($fileUri);
@ -100,18 +51,6 @@ function DoUpload($fileUri) {
}
function generateUrlToStorage($document_uri, $from_extension, $to_extension, $title, $document_revision_id) {
return $GLOBALS['DOC_SERV_STORAGE_URL'] . "?" . http_build_query(
array(
"url" => $document_uri,
"outputtype" => trim($to_extension,'.'),
"filetype" => trim($from_extension, '.'),
"title" => $title,
"key" => $document_revision_id));
}
/**
* Generate an error code table
*
@ -184,7 +123,7 @@ function GenerateRevisionId($expected_key) {
* @param string $document_revision_id Key for caching on service
* @param bool $is_async Perform conversions asynchronously
*
* @return Xml document request result of conversion
* @return Document request result of conversion
*/
function SendRequestToConvertService($document_uri, $from_extension, $to_extension, $document_revision_id, $is_async) {
if (empty($from_extension))
@ -217,13 +156,11 @@ function SendRequestToConvertService($document_uri, $from_extension, $to_extensi
)
);
$response_xml_data;
$countTry = 0;
$opts = array('http' => array(
'method' => 'POST',
'timeout' => $GLOBALS['DOC_SERV_TIMEOUT'],
'header'=> "Content-type: application/json\r\n",
'header'=> "Content-type: application/json\r\n" .
"Accept: application/json\r\n",
'content' => $data
)
);
@ -233,30 +170,7 @@ function SendRequestToConvertService($document_uri, $from_extension, $to_extensi
}
$context = stream_context_create($opts);
while ($countTry < ServiceConverterMaxTry)
{
$countTry = $countTry + 1;
$response_xml_data = file_get_contents($urlToConverter, FALSE, $context);
if ($response_xml_data !== false){ break; }
}
if ($countTry == ServiceConverterMaxTry)
{
throw new Exception ("Bad Request or timeout error");
}
libxml_use_internal_errors(true);
if (!function_exists('simplexml_load_file')){
throw new Exception("Server can't read xml");
}
$response_data = simplexml_load_string($response_xml_data);
if (!$response_data) {
$exc = "Bad Response. Errors: ";
foreach(libxml_get_errors() as $error) {
$exc = $exc . "\t" . $error->message;
}
throw new Exception ($exc);
}
$response_data = file_get_contents($urlToConverter, FALSE, $context);
return $response_data;
}
@ -303,39 +217,28 @@ function GetConvertedUri($document_uri, $from_extension, $to_extension, $documen
/**
* Processing document received from the editing service.
*
* @param string $x_document_response The resulting xml from editing service
* @param string $document_response The result from editing service
* @param string $response_uri Uri to the converted document
*
* @return The percentage of completion of conversion
*/
function GetResponseUri($x_document_response, &$response_uri) {
function GetResponseUri($document_response, &$response_uri) {
$response_uri = "";
$resultPercent = 0;
libxml_use_internal_errors(true);
if (!function_exists('simplexml_load_file')){
throw new Exception("Server can't read xml");
}
$data = simplexml_load_string($x_document_response);
if (!$data) {
$errs = "Invalid answer format. Errors: ";
foreach(libxml_get_errors() as $error) {
$errs = $errs . '\t' . $error->message;
}
throw new Exception ($errs);
if (!$document_response) {
$errs = "Invalid answer format";
}
$errorElement = $data->Error;
if ($errorElement != NULL && $errorElement != "") ProcessConvServResponceError($data->Error);
$errorElement = $document_response->Error;
if ($errorElement != NULL && $errorElement != "") ProcessConvServResponceError($document_response->Error);
$endConvert = $data->EndConvert;
$endConvert = $document_response->EndConvert;
if ($endConvert != NULL && $endConvert == "") throw new Exception("Invalid answer format");
if ($endConvert != NULL && strtolower($endConvert) == true)
{
$fileUrl = $data->FileUrl;
$fileUrl = $document_response->FileUrl;
if ($fileUrl == NULL || $fileUrl == "") throw new Exception("Invalid answer format");
$response_uri = $fileUrl;
@ -343,7 +246,7 @@ function GetResponseUri($x_document_response, &$response_uri) {
}
else
{
$percent = $data->Percent;
$percent = $document_response->Percent;
if ($percent != NULL && $percent != "")
$resultPercent = $percent;

View File

@ -3,24 +3,25 @@
*
* (c) Copyright Ascensio System Limited 2010-2017
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
* The MIT License (MIT)
*
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
?>
@ -38,7 +39,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ONLYOFFICE Integration Edition</title>
<title>ONLYOFFICE Document Editors</title>
<link rel="icon" href="./favicon.ico" type="image/x-icon" />
@ -73,10 +74,10 @@
</a>
</header>
<div class="main-panel">
<span class="portal-name">ONLYOFFICE Integration Edition Welcome!</span>
<span class="portal-name">ONLYOFFICE Document Editors Welcome!</span>
<br />
<br />
<span class="portal-descr">Get started with a demo-sample of ONLYOFFICE Integration Edition, the first html5-based editors. You may upload your own documents for testing using the "Upload file" button and selecting the necessary files on your PC.</span>
<span class="portal-descr">Get started with a demo-sample of ONLYOFFICE Document Editors, the first html5-based editors. You may upload your own documents for testing using the "Upload file" button and selecting the necessary files on your PC.</span>
<table class="user-block-table" cellspacing="0" cellpadding="0">
<tr>
@ -176,7 +177,7 @@
echo ' <a class="stored-edit '.$storeFile->documentType.'" href="doceditor.php?fileID='.urlencode($storeFile->name).'&user='.$user.'" target="_blank">';
echo ' <span title="'.$storeFile->name.'">'.$storeFile->name.'</span>';
echo ' </a>';
echo ' <a href="'.$storeFile->url.'">';
echo ' <a href="webeditor-ajax.php?type=download&filename='.$storeFile->name.'">';
echo ' <img class="icon-download" src="css/images/download-24.png" alt="Download" title="Download" /></a>';
echo ' </a>';
echo ' <a class="delete-file" data="'.$storeFile->name.'">';
@ -230,7 +231,7 @@
<div class="help-block">
<span>Want to learn the magic?</span>
<br />
Explore ONLYOFFICE Integration Edition <a href="http://api.onlyoffice.com/editors/howitworks" target="_blank">API Documentation.</a>
Explore ONLYOFFICE Document Editors <a href="http://api.onlyoffice.com/editors/howitworks" target="_blank">API Documentation.</a>
</div>
<br />
<br />

Some files were not shown because too many files have changed in this diff Show More