mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-02-10 18:05:10 +08:00
nodejs: skip history without externalIp
This commit is contained in:
@ -399,42 +399,45 @@ app.get("/editor", function (req, res) {
|
||||
}
|
||||
|
||||
var userAddress = docManager.curUserHostAddress();
|
||||
var fileName = req.query.fileName;
|
||||
fileName = req.query.fileName;
|
||||
var key = docManager.getKey(fileName);
|
||||
var url = docManager.getFileUri(fileName);
|
||||
var mode = req.query.mode || "edit"; //mode: view/edit
|
||||
var type = req.query.type || "desktop"; //type: embedded/mobile/desktop
|
||||
var canEdit = configServer.get('editedDocs').indexOf(fileUtility.getFileExtension(fileName)) != -1;
|
||||
|
||||
var historyPath = docManager.historyPath(fileName, userAddress);
|
||||
var countVersion = 1;
|
||||
changes = null;
|
||||
|
||||
if (historyPath != '') {
|
||||
if (configServer.get('haveExternalIp')) {
|
||||
var historyPath = docManager.historyPath(fileName, userAddress);
|
||||
changes = null;
|
||||
|
||||
countVersion = docManager.countVersion(historyPath) + 1;
|
||||
var prev_path = docManager.getlocalFileUri(fileName, 1) + "/prev" + fileUtility.getFileExtension(fileName);
|
||||
var diff_path = null;
|
||||
for (var i = 1; i < countVersion; i++) {
|
||||
var keyPath = docManager.keyPath(fileName, userAddress, i);
|
||||
var keyVersion = "" + fileSystem.readFileSync(keyPath);
|
||||
history.push(docManager.getHistory(fileName, changes, keyVersion, i));
|
||||
if (historyPath != '') {
|
||||
|
||||
prevUrl.push(prev_path);
|
||||
prev_path = docManager.getlocalFileUri(fileName, i) + "/prev" + fileUtility.getFileExtension(fileName);
|
||||
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);
|
||||
history.push(docManager.getHistory(fileName, changes, keyVersion, i));
|
||||
|
||||
diff.push(diff_path);
|
||||
diff_path = docManager.getlocalFileUri(fileName, i) + "/diff.zip";
|
||||
prevUrl.push(prevPath);
|
||||
prevPath = docManager.getlocalFileUri(fileName, i) + "/prev" + fileUtility.getFileExtension(fileName);
|
||||
|
||||
var changesFile = docManager.changesPath(fileName, userAddress, i);
|
||||
var changes = docManager.getChanges(changesFile);
|
||||
diff.push(diffPath);
|
||||
diffPath = docManager.getlocalFileUri(fileName, i) + "/diff.zip";
|
||||
|
||||
var changesFile = docManager.changesPath(fileName, userAddress, i);
|
||||
var changes = docManager.getChanges(changesFile);
|
||||
}
|
||||
prevUrl.push(prevPath);
|
||||
diff.push(diffPath);
|
||||
} else {
|
||||
prevUrl.push(url);
|
||||
}
|
||||
prevUrl.push(prev_path);
|
||||
diff.push(diff_path);
|
||||
} else {
|
||||
prevUrl.push(url)
|
||||
history.push(docManager.getHistory(fileName, changes, key, countVersion));
|
||||
}
|
||||
history.push(docManager.getHistory(fileName, changes, key, countVersion));
|
||||
|
||||
var argss = {
|
||||
apiUrl: siteUrl + configServer.get('apiUrl'),
|
||||
@ -442,7 +445,7 @@ app.get("/editor", function (req, res) {
|
||||
name: fileName,
|
||||
ext: fileUtility.getFileExtension(fileName, true),
|
||||
uri: url,
|
||||
version: countVersion
|
||||
version: countVersion,
|
||||
},
|
||||
editor: {
|
||||
type: type,
|
||||
@ -457,17 +460,16 @@ app.get("/editor", function (req, res) {
|
||||
lang: lang,
|
||||
userid: userid,
|
||||
firstname: firstname,
|
||||
lastname: lastname
|
||||
lastname: lastname,
|
||||
},
|
||||
history: history,
|
||||
setHistoryData: {
|
||||
url: prevUrl || "", //из файла прочитать ссылки
|
||||
urlDiff: diff || ""
|
||||
}
|
||||
url: prevUrl,
|
||||
urlDiff: diff,
|
||||
},
|
||||
};
|
||||
|
||||
res.render("editor", argss);
|
||||
|
||||
}
|
||||
catch (ex) {
|
||||
res.status(500);
|
||||
|
||||
Reference in New Issue
Block a user