Skip to content

Commit

Permalink
Merge pull request #338 from ONLYOFFICE/develop
Browse files Browse the repository at this point in the history
Release/6.3.1
  • Loading branch information
LinneyS authored Mar 9, 2021
2 parents b805d7f + 58e73f6 commit 416ccac
Show file tree
Hide file tree
Showing 38 changed files with 292 additions and 48 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Change Log

## 6.3.1
## Added
- viewing a locked file
- hide secret key in settings
- configuring version storage
- clearing history data

## Changed
- thumbnails for small files only
- history for federated share files is not stored

## 6.2.1
## Changed
- the ability to use forcesave for federated share files
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ODT, ODS, and ODP is also available for instant conversion. After you enable the

## Installing ONLYOFFICE Docs

You will need an instance of ONLYOFFICE Docs (Document Server) that is resolvable and connectable both from ownCloud and any end clients (version 4.2.7 and later are supported for use with the app). ONLYOFFICE Document Server must also be able to POST to ownCloud directly.
You will need an instance of ONLYOFFICE Docs (Document Server) that is resolvable and connectable both from ownCloud and any end clients. ONLYOFFICE Document Server must also be able to POST to ownCloud directly.

ONLYOFFICE Document Server and ownCloud can be installed either on different computers, or on the same machine. If you use one machine, set up a custom port for Document Server as by default both ONLYOFFICE Document Server and ownCloud work on port 80.

Expand Down
10 changes: 6 additions & 4 deletions appinfo/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,11 @@ function () {
$detector->registerType("otp", "application/vnd.oasis.opendocument.presentation-template");

$previewManager = $container->query(IPreview::class);
$previewManager->registerProvider(Preview::getMimeTypeRegex(), function() use ($container) {
return $container->query(Preview::class);
});
if ($this->appConfig->GetPreview()) {
$previewManager->registerProvider(Preview::getMimeTypeRegex(), function() use ($container) {
return $container->query(Preview::class);
});
}

$container->registerService("L10N", function ($c) {
return $c->query("ServerContainer")->getL10N($c->query("AppName"));
Expand Down Expand Up @@ -143,7 +145,7 @@ function () {
$this->crypt,
$c->query("IManager"),
$c->query("Session"),
$c->query("ClientService")
$c->query("LockManager")
);
});

Expand Down
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<description>ONLYOFFICE connector allows you to view, edit and collaborate on text documents, spreadsheets and presentations within ownCloud using ONLYOFFICE Docs. This will create a new Edit in ONLYOFFICE action within the document library for Office documents. This allows multiple users to co-author documents in real time from the familiar web interface and save the changes back to your file storage.</description>
<licence>apl2</licence>
<author>Ascensio System SIA</author>
<version>6.2.1</version>
<version>6.3.1</version>
<namespace>Onlyoffice</namespace>
<types>
<filesystem/>
Expand Down
1 change: 1 addition & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
["name" => "settings#save_address", "url" => "/ajax/settings/address", "verb" => "PUT"],
["name" => "settings#save_common", "url" => "/ajax/settings/common", "verb" => "PUT"],
["name" => "settings#get_settings", "url" => "/ajax/settings", "verb" => "GET"],
["name" => "settings#clear_history", "url" => "/ajax/settings/history", "verb" => "DELETE"],
],
"ocs" => [
["name" => "federation#key", "url" => "/api/v1/key", "verb" => "POST"],
Expand Down
24 changes: 15 additions & 9 deletions controller/callbackcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,15 @@ public function download($doc) {

if (isset($hashData->userId)) {
$userId = $hashData->userId;
\OC_User::setUserId($userId);

$user = $this->userManager->get($userId);
if (!empty($user)) {
\OC_User::setUserId($userId);
}

if ($this->config->checkEncryptionModule() === "master") {
\OC_User::setIncognitoMode(true);
} else {
$user = $this->userManager->get($userId);
if (!empty($user)) {
\OC_Util::setupFS($userId);
}
Expand Down Expand Up @@ -449,15 +452,17 @@ public function track($doc, $users, $key, $status, $url, $token, $history, $chan

// author of the latest changes
$userId = $this->parseUserId($users[0]);
\OC_User::setUserId($userId);

$user = $this->userManager->get($userId);
if (empty($user)) {
if (!empty($user)) {
\OC_User::setUserId($userId);
} else {
if (empty($shareToken)) {
$this->logger->debug("Track without token: $fileId status $status", ["app" => $this->appName]);
} else {
$this->logger->debug("Track $fileId by token for $userId", ["app" => $this->appName]);
$this->logger->error("Track without token: $fileId status $status", ["app" => $this->appName]);
return new JSONResponse(["message" => $this->trans->t("Access denied")], Http::STATUS_FORBIDDEN);
}

$this->logger->debug("Track $fileId by token for $userId", ["app" => $this->appName]);
}

// owner of file from the callback link
Expand Down Expand Up @@ -543,7 +548,8 @@ public function track($doc, $users, $key, $status, $url, $token, $history, $chan

if (!$isForcesave
&& !$prevIsForcesave
&& $this->versionManager->available) {
&& $this->versionManager->available
&& $this->config->GetVersionHistory()) {
$changes = null;
if (!empty($changesurl)) {
$changesurl = $this->config->ReplaceDocumentServerUrlToInternal($changesurl);
Expand All @@ -552,7 +558,7 @@ public function track($doc, $users, $key, $status, $url, $token, $history, $chan
FileVersions::saveHistory($file->getFileInfo(), $history, $changes, $prevVersion);
}

if (!empty($user)) {
if (!empty($user) && $this->config->GetVersionHistory()) {
FileVersions::saveAuthor($file->getFileInfo(), $user);
}

Expand Down
19 changes: 18 additions & 1 deletion controller/editorcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use OCP\Files\Folder;
use OCP\Files\ForbiddenException;
use OCP\Files\IRootFolder;
use OCP\Files\Storage\IPersistentLockingStorage;
use OCP\IL10N;
use OCP\ILogger;
use OCP\IRequest;
Expand All @@ -38,7 +39,6 @@
use OCP\Share\IManager;

use OCA\Files\Helper;
use OCA\Files_Sharing\External\Storage as SharingExternalStorage;

use OCA\Onlyoffice\AppConfig;
use OCA\Onlyoffice\Crypt;
Expand Down Expand Up @@ -904,9 +904,26 @@ public function config($fileId, $filePath = null, $shareToken = null, $version =
}
}

$isPersistentLock = false;
if ($version < 1
&& (\OC::$server->getConfig()->getAppValue("files", "enable_lock_file_action", "no") === "yes")
&& $fileStorage->instanceOfStorage(IPersistentLockingStorage::class)) {

$locks = $fileStorage->getLocks($file->getFileInfo()->getInternalPath(), false);
if (count($locks) > 0) {
$activeLock = $locks[0];
$lockOwner = explode(' ', trim($activeLock->getOwner()))[0];
if ($userId !== $lockOwner) {
$isPersistentLock = true;
$this->logger->debug("File $fileId is locked by $lockOwner", ["app" => $this->appName]);
}
}
}

$canEdit = isset($format["edit"]) && $format["edit"];
$editable = $version < 1
&& $file->isUpdateable()
&& !$isPersistentLock
&& (empty($shareToken) || ($share->getPermissions() & Constants::PERMISSION_UPDATE) === Constants::PERMISSION_UPDATE);
$params["document"]["permissions"]["edit"] = $editable;
if (($editable || $restrictedEditing) && $canEdit) {
Expand Down
18 changes: 18 additions & 0 deletions controller/settingscontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use OCA\Onlyoffice\AppConfig;
use OCA\Onlyoffice\Crypt;
use OCA\Onlyoffice\DocumentService;
use OCA\Onlyoffice\FileVersions;

/**
* Settings controller for the administration page
Expand Down Expand Up @@ -113,6 +114,7 @@ public function index() {
"formats" => $this->config->FormatsSetting(),
"sameTab" => $this->config->GetSameTab(),
"preview" => $this->config->GetPreview(),
"versionHistory" => $this->config->GetVersionHistory(),
"encryption" => ($this->config->checkEncryptionModule() === true),
"limitGroups" => $this->config->GetLimitGroups(),
"chat" => $this->config->GetCustomizationChat(),
Expand Down Expand Up @@ -190,6 +192,7 @@ public function SaveAddress($documentserver,
* @param array $editFormats - editable formats array
* @param bool $sameTab - open in the same tab
* @param bool $preview - generate preview files
* @param bool $versionHistory - keep version history
* @param array $limitGroups - list of groups
* @param bool $chat - display chat
* @param bool $compactHeader - display compact header
Expand All @@ -205,6 +208,7 @@ public function SaveCommon($defFormats,
$editFormats,
$sameTab,
$preview,
$versionHistory,
$limitGroups,
$chat,
$compactHeader,
Expand All @@ -219,6 +223,7 @@ public function SaveCommon($defFormats,
$this->config->SetEditableFormats($editFormats);
$this->config->SetSameTab($sameTab);
$this->config->SetPreview($preview);
$this->config->SetVersionHistory($versionHistory);
$this->config->SetLimitGroups($limitGroups);
$this->config->SetCustomizationChat($chat);
$this->config->SetCustomizationCompactHeader($compactHeader);
Expand All @@ -232,6 +237,19 @@ public function SaveCommon($defFormats,
];
}

/**
* Clear all version history
*
* @return array
*/
public function ClearHistory() {

FileVersions::clearHistory();

return [
];
}

/**
* Get app settings
*
Expand Down
4 changes: 4 additions & 0 deletions css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@
-moz-column-width: 140px;
-webkit-column-width: 140px;
}
#personal-show + label{
margin-top: -25px;
margin-left: 230px;
}
28 changes: 28 additions & 0 deletions js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@

var sameTab = $("#onlyofficeSameTab").is(":checked");
var preview = $("#onlyofficePreview").is(":checked");
var versionHistory = $("#onlyofficeVersionHistory").is(":checked");

var limitGroupsString = $("#onlyofficeGroups").prop("checked") ? $("#onlyofficeLimitGroups").val() : "";
var limitGroups = limitGroupsString ? limitGroupsString.split("|") : [];
Expand All @@ -144,6 +145,7 @@
editFormats: editFormats,
sameTab: sameTab,
preview: preview,
versionHistory: versionHistory,
limitGroups: limitGroups,
chat: chat,
compactHeader: compactHeader,
Expand Down Expand Up @@ -171,6 +173,32 @@
$("#onlyofficeAddrSave").click();
}
});

$("#onlyofficeSecret-show").click(function () {
if ($("#onlyofficeSecret").attr("type") == "password") {
$("#onlyofficeSecret").attr("type", "text");
} else {
$("#onlyofficeSecret").attr("type", "password");
}
});

$("#onlyofficeClearVersionHistory").click(function () {
$(".section-onlyoffice").addClass("icon-loading");

$.ajax({
method: "DELETE",
url: OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/settings/history"),
success: function onSuccess(response) {
$(".section-onlyoffice").removeClass("icon-loading");
if (response) {
var message = t(OCA.Onlyoffice.AppName, "All history successfully deleted");
OC.Notification.show(message, {
timeout: 3
});
}
}
});
});
});

})(jQuery, OC);
3 changes: 2 additions & 1 deletion l10n/bg_BG.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ OC.L10N.register(
"version": "версия",
"Disable certificate verification (insecure)": "Деактивиране на проверката на сертификата (несигурно)",
"Keep intermediate versions when editing": "Съхранявайте междинни версии при редактиране",
"Generate document preview": "Генериране на визуализация на документ"
"Use ONLYOFFICE to generate a document preview (it will take up disk space)": "Използвайте ONLYOFFICE, за да генерирате преглед на документа (ще заеме дисково пространство)",
"Keep metadata for each version once the document is edited (it will take up disk space)": "Запазете метаданните за всяка версия, щом документът бъде редактиран (ще заеме дисково пространство)"
},
"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);");
3 changes: 2 additions & 1 deletion l10n/bg_BG.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"version": "версия",
"Disable certificate verification (insecure)": "Деактивиране на проверката на сертификата (несигурно)",
"Keep intermediate versions when editing": "Съхранявайте междинни версии при редактиране",
"Generate document preview": "Генериране на визуализация на документ"
"Use ONLYOFFICE to generate a document preview (it will take up disk space)": "Използвайте ONLYOFFICE, за да генерирате преглед на документа (ще заеме дисково пространство)",
"Keep metadata for each version once the document is edited (it will take up disk space)": "Запазете метаданните за всяка версия, щом документът бъде редактиран (ще заеме дисково пространство)"
},"pluralForm" :"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"
}
4 changes: 3 additions & 1 deletion l10n/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ OC.L10N.register(
"version": "version",
"Disable certificate verification (insecure)": "Zertifikatsüberprüfung deaktivieren (unsicher)",
"Keep intermediate versions when editing": "Zwischenversionen bei der Bearbeitung aufbewahren",
"Generate document preview": "Dokumentvorschau generieren"
"Use ONLYOFFICE to generate a document preview (it will take up disk space)": "ONLYOFFICE verwenden, um eine Dokumentvorschau zu erstellen (Speicherplatz erforderlich)",
"Keep metadata for each version once the document is edited (it will take up disk space)": "Metadaten für jede Version beim Bearbeiten des Dokuments aufbewahren (Speicherplatz erforderlich)",
"All history successfully deleted": "Gesamtverlauf wurde erfolgreich gelöscht"
},
"nplurals=2; plural=(n != 1);");
4 changes: 3 additions & 1 deletion l10n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
"version": "version",
"Disable certificate verification (insecure)": "Zertifikatsüberprüfung deaktivieren (unsicher)",
"Keep intermediate versions when editing": "Zwischenversionen bei der Bearbeitung aufbewahren",
"Generate document preview": "Dokumentvorschau generieren"
"Use ONLYOFFICE to generate a document preview (it will take up disk space)": "ONLYOFFICE verwenden, um eine Dokumentvorschau zu erstellen (Speicherplatz erforderlich)",
"Keep metadata for each version once the document is edited (it will take up disk space)": "Metadaten für jede Version beim Bearbeiten des Dokuments aufbewahren (Speicherplatz erforderlich)",
"All history successfully deleted": "Gesamtverlauf wurde erfolgreich gelöscht"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
4 changes: 3 additions & 1 deletion l10n/de_DE.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ OC.L10N.register(
"version": "version",
"Disable certificate verification (insecure)": "Zertifikatsüberprüfung deaktivieren (unsicher)",
"Keep intermediate versions when editing": "Zwischenversionen bei der Bearbeitung aufbewahren",
"Generate document preview": "Dokumentvorschau generieren"
"Use ONLYOFFICE to generate a document preview (it will take up disk space)": "ONLYOFFICE verwenden, um eine Dokumentvorschau zu erstellen (Speicherplatz erforderlich)",
"Keep metadata for each version once the document is edited (it will take up disk space)": "Metadaten für jede Version beim Bearbeiten des Dokuments aufbewahren (Speicherplatz erforderlich)",
"All history successfully deleted": "Gesamtverlauf wurde erfolgreich gelöscht"
},
"nplurals=2; plural=(n != 1);");
4 changes: 3 additions & 1 deletion l10n/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
"version": "version",
"Disable certificate verification (insecure)": "Zertifikatsüberprüfung deaktivieren (unsicher)",
"Keep intermediate versions when editing": "Zwischenversionen bei der Bearbeitung aufbewahren",
"Generate document preview": "Dokumentvorschau generieren"
"Use ONLYOFFICE to generate a document preview (it will take up disk space)": "ONLYOFFICE verwenden, um eine Dokumentvorschau zu erstellen (Speicherplatz erforderlich)",
"Keep metadata for each version once the document is edited (it will take up disk space)": "Metadaten für jede Version beim Bearbeiten des Dokuments aufbewahren (Speicherplatz erforderlich)",
"All history successfully deleted": "Gesamtverlauf wurde erfolgreich gelöscht"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
4 changes: 3 additions & 1 deletion l10n/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ OC.L10N.register(
"version": "versión",
"Disable certificate verification (insecure)": "Desactivar la verificación de certificados (inseguro)",
"Keep intermediate versions when editing": "Mantener las versiones intermedias durante la edición",
"Generate document preview": "Generar la vista previa de documentos"
"Use ONLYOFFICE to generate a document preview (it will take up disk space)": "Usar ONLYOFFICE para generar una vista previa del documento (ocupará espacio en el disco)",
"Keep metadata for each version once the document is edited (it will take up disk space)": "Guardar los metadatos de cada versión al editar el documento (ocupará espacio en el disco)",
"All history successfully deleted": "Todo el historial se ha eliminado correctamente"
},
"nplurals=2; plural=(n != 1);");
4 changes: 3 additions & 1 deletion l10n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
"version": "versión",
"Disable certificate verification (insecure)": "Desactivar la verificación de certificados (inseguro)",
"Keep intermediate versions when editing": "Mantener las versiones intermedias durante la edición",
"Generate document preview": "Generar la vista previa de documentos"
"Use ONLYOFFICE to generate a document preview (it will take up disk space)": "Usar ONLYOFFICE para generar una vista previa del documento (ocupará espacio en el disco)",
"Keep metadata for each version once the document is edited (it will take up disk space)": "Guardar los metadatos de cada versión al editar el documento (ocupará espacio en el disco)",
"All history successfully deleted": "Todo el historial se ha eliminado correctamente"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
Loading

0 comments on commit 416ccac

Please sign in to comment.