Compare commits

...

20 Commits

Author SHA1 Message Date
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
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
10 changed files with 96 additions and 68 deletions

View File

@ -344,42 +344,44 @@ app.post("/track", function (req, res) {
var path = docManager.storagePath(fileName, userAddress);
var historyPath = docManager.historyPath(fileName, userAddress);
if (historyPath == "") {
historyPath = docManager.historyPath(fileName, userAddress, true);
docManager.createDirectory(historyPath);
}
if (docManager.existsSync(path)) {
var historyPath = docManager.historyPath(fileName, userAddress);
if (historyPath == "") {
historyPath = docManager.historyPath(fileName, userAddress, true);
docManager.createDirectory(historyPath);
}
var count_version = docManager.countVersion(historyPath);
version = count_version + 1;
versionPath = docManager.versionPath(fileName, userAddress, version);
docManager.createDirectory(versionPath);
var count_version = docManager.countVersion(historyPath);
version = count_version + 1;
versionPath = docManager.versionPath(fileName, userAddress, version);
docManager.createDirectory(versionPath);
var downloadZip = body.changesurl;
if (downloadZip) {
var path_changes = docManager.diffPath(fileName, userAddress, version);
var diffZip = syncRequest("GET", downloadZip);
fileSystem.writeFileSync(path_changes, diffZip.getBody());
}
var downloadZip = body.changesurl;
if (downloadZip) {
var path_changes = docManager.diffPath(fileName, userAddress, version);
var diffZip = syncRequest("GET", downloadZip);
fileSystem.writeFileSync(path_changes, diffZip.getBody());
}
var changeshistory = body.changeshistory || JSON.stringify(body.history);
if (changeshistory) {
var path_changes_json = docManager.changesPath(fileName, userAddress, version);
fileSystem.writeFileSync(path_changes_json, changeshistory);
}
var changeshistory = body.changeshistory || JSON.stringify(body.history);
if (changeshistory) {
var path_changes_json = docManager.changesPath(fileName, userAddress, version);
fileSystem.writeFileSync(path_changes_json, changeshistory);
}
var path_key = docManager.keyPath(fileName, userAddress, version);
fileSystem.writeFileSync(path_key, body.key);
var path_key = docManager.keyPath(fileName, userAddress, version);
fileSystem.writeFileSync(path_key, body.key);
var path_prev = docManager.prevFilePath(fileName, userAddress, version);
fileSystem.writeFileSync(path_prev, fileSystem.readFileSync(path));
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 file = syncRequest("GET", downloadUri);
fileSystem.writeFileSync(path, file.getBody());
var forcesavePath = docManager.forcesavePath(fileName, userAddress, false);
if (forcesavePath != "") {
fileSystem.unlinkSync(forcesavePath);
var forcesavePath = docManager.forcesavePath(fileName, userAddress, false);
if (forcesavePath != "") {
fileSystem.unlinkSync(forcesavePath);
}
}
} catch (ex) {
console.log(ex);
@ -545,7 +547,7 @@ app.get("/editor", function (req, res) {
var historyD = {
version: i,
key: keyVersion,
url: i == countVersion ? url : (docManager.getlocalFileUri(fileName, i) + "/prev" + fileUtility.getFileExtension(fileName)),
url: i == countVersion ? url : (docManager.getlocalFileUri(fileName, i, true) + "/prev" + fileUtility.getFileExtension(fileName)),
};
if (i > 1) {
historyD.previous = {
@ -595,7 +597,7 @@ app.get("/editor", function (req, res) {
isEdit: canEdit && mode != "review",
mode: canEdit && mode != "view" ? "edit" : "view",
canBackToFolder: type != "embedded",
getServerUrl: type == "embedded" ? null : "\"" + docManager.getServerUrl() + "\"",
backUrl: docManager.getServerUrl(),
curUserHostAddress: docManager.curUserHostAddress(),
lang: lang,
userid: userid,

View File

@ -19,6 +19,7 @@
"tempStorageUrl": "ResourceService.ashx",
"apiUrl": "web-apps/apps/api/documents/api.js",
"preloaderUrl": "web-apps/apps/api/documents/cache-scripts.html",
"exampleUrl": null,
"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"],
@ -42,7 +43,6 @@
}
},
"plugins": {
"url": "",
"pluginsData": []
}
}

View File

@ -32,12 +32,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 = {};
@ -148,11 +142,11 @@ 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();
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);
@ -162,12 +156,12 @@ docManager.getlocalFileUri = function (fileName, version) {
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 server = docManager.getServerUrl(true);
const hostAddress = docManager.curUserHostAddress();
const handler = "/track?filename=" + encodeURIComponent(fileName) + "&useraddress=" + encodeURIComponent(hostAddress);
@ -305,9 +299,9 @@ docManager.getKey = function (fileName) {
key += docManager.countVersion(historyPath);
}
/*historyPath = docManager.historyPath(fileName, userAddress, true);
const stat = fileSystem.statSync(historyPath);
key += stat.mtime.toString();*/
let storagePath = docManager.storagePath(fileName, userAddress);
const stat = fileSystem.statSync(storagePath);
key += stat.mtime.toString();
return documentService.generateRevisionId(key);
};

View File

@ -23,6 +23,7 @@
"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",

View File

@ -116,6 +116,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

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

View File

@ -68,7 +68,7 @@
docEditor.refreshHistory(
{
currentVersion: "<%= file.version %>",
currentVersion: "<%- file.version %>",
history: historyObj
});
};
@ -107,12 +107,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

@ -232,7 +232,6 @@ function getStoredFiles() {
$dat = filemtime($directory . DIRECTORY_SEPARATOR . $fileName);
$result[$dat] = (object) array(
"name" => $fileName,
"url" => FileUri($fileName),
"documentType" => getDocumentType($fileName)
);
}

View File

@ -176,7 +176,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.'">';

View File

@ -60,6 +60,9 @@ if (isset($_GET["type"]) && !empty($_GET["type"])) { //Checks if type value exis
$response_array = upload();
$response_array['status'] = isset($response_array['error']) ? 'error' : 'success';
die (json_encode($response_array));
case "download":
download();
exit;
case "convert":
$response_array = convert();
$response_array['status'] = 'success';
@ -124,6 +127,21 @@ function upload() {
return $result;
}
function download() {
$fileName = $_GET["filename"];
$filePath = getStoragePath($fileName);
if (!file_exists($filePath)) {
http_response_code(404);
return;
}
header("Content-Length: " . filesize($filePath));
header("Content-Type: " . mime_content_type($fileName));
header("Content-Disposition: attachment; filename=\"".basename($filePath)."\"");
readfile($filePath);
}
function track() {
sendlog("Track START", "logs/webedior-ajax.log");
sendlog("_GET params: " . serialize( $_GET ), "logs/webedior-ajax.log");