Skip to content

Commit

Permalink
Merge pull request #414 from ONLYOFFICE/develop
Browse files Browse the repository at this point in the history
Release/7.8.1
  • Loading branch information
LinneyS committed Mar 20, 2023
2 parents 1081e26 + 1ecb417 commit 62db166
Show file tree
Hide file tree
Showing 64 changed files with 575 additions and 96 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

## 7.8.1
## Added
- disable plugins setting
- document protection setting
- jwt leeway setting
- Danish translation

## Changed
- fix notification length
- additional check availability for external files when mention

## 7.6.7
## Added
- Dutch translation
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,20 @@ If the server with the ownCloud installed does not have an Internet access, or i
```

2. Get the ownCloud ONLYOFFICE integration app.

There are several ways to do that:

a. Download the latest signed version from the official store for [ownCloud](https://marketplace.owncloud.com/apps/onlyoffice).

b. Or you can download the latest signed version from the application [release page](https://github.com/ONLYOFFICE/onlyoffice-owncloud/releases) on GitHub.

c. Or you can clone the application source code and compile it yourself:

```bash
git clone https://github.com/ONLYOFFICE/onlyoffice-owncloud.git onlyoffice
cd onlyoffice
git submodule update --init --recursive
```

> ownCloud does not work with unsigned applications giving an alert, so you will need to use either option **a** or **b** to get the application.
ownCloud does not work with unsigned applications giving an alert, so you will need to use either option **a** or **b** to get the application.

3. Change the owner to update the application right from ownCloud web interface:

Expand Down
2 changes: 1 addition & 1 deletion appinfo/app.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
5 changes: 4 additions & 1 deletion appinfo/application.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -91,6 +91,9 @@ function () {
require_once __DIR__ . "/../3rdparty/jwt/SignatureInvalidException.php";
require_once __DIR__ . "/../3rdparty/jwt/JWT.php";

// Set the leeway for the JWT library in case the system clock is a second off
\Firebase\JWT\JWT::$leeway = $this->appConfig->GetJwtLeeway();

$container = $this->getContainer();

$detector = $container->query(IMimeTypeDetector::class);
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>7.6.7</version>
<version>7.8.1</version>
<namespace>Onlyoffice</namespace>
<types>
<filesystem/>
Expand Down
2 changes: 1 addition & 1 deletion appinfo/routes.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion controller/callbackcontroller.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
12 changes: 11 additions & 1 deletion controller/editorapicontroller.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -386,6 +386,12 @@ public function config($fileId, $filePath = null, $shareToken = null, $version =
$ownerId = $owner->getUID();
}

$canProtect = true;
if ($this->config->GetProtection() === "owner") {
$canProtect = $ownerId === $userId;
}
$params["document"]["permissions"]["protect"] = $canProtect;

$hashCallback = $this->crypt->GetHash(["userId" => $userId, "ownerId" => $ownerId, "fileId" => $file->getId(), "filePath" => $filePath, "shareToken" => $shareToken, "action" => "track"]);
$callback = $this->urlGenerator->linkToRouteAbsolute($this->appName . ".callback.track", ["doc" => $hashCallback]);

Expand Down Expand Up @@ -703,6 +709,10 @@ private function setCustomization($params) {
$params["editorConfig"]["customization"]["macros"] = false;
}

//default is true
if($this->config->GetCustomizationPlugins() === false) {
$params["editorConfig"]["customization"]["plugins"] = false;
}

/* from system config */

Expand Down
28 changes: 26 additions & 2 deletions controller/editorcontroller.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -457,6 +457,19 @@ public function mention($fileId, $anchor, $comment, $emails) {
return ["error" => $this->trans->t("Failed to send notification")];
}

foreach ($emails as $email) {
$substrToDelete = "+" . $email . " ";
$comment = str_replace($substrToDelete, "", $comment);
}

//Length from ownCloud:
//https://github.com/owncloud/core/blob/master/lib/private/Notification/Notification.php#L181
$maxLen = 64;
if (strlen($comment) > $maxLen) {
$ending = "...";
$comment = substr($comment, 0, ($maxLen - strlen($ending))) . $ending;
}

$notificationManager = \OC::$server->getNotificationManager();
$notification = $notificationManager->createNotification();
$notification->setApp($this->appName)
Expand All @@ -481,7 +494,18 @@ public function mention($fileId, $anchor, $comment, $emails) {

foreach ($recipientIds as $recipientId) {
$recipient = $this->userManager->get($recipientId);
if (!in_array($recipient, $accessList)) {
$isAvailable = in_array($recipient, $accessList);

if (!$isAvailable
&& $file->getFileInfo()->getMountPoint() instanceof \OCA\Files_External\Config\ExternalMountPoint) {

$recipientFolder = $this->root->getUserFolder($recipientId);
$recipientFile = $recipientFolder->getById($file->getId());

$isAvailable = !empty($recipientFile);
}

if (!$isAvailable) {
if (!$canShare) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion controller/federationcontroller.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion controller/settingsapicontroller.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
13 changes: 11 additions & 2 deletions controller/settingscontroller.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -116,6 +116,7 @@ public function index() {
"sameTab" => $this->config->GetSameTab(),
"preview" => $this->config->GetPreview(),
"versionHistory" => $this->config->GetVersionHistory(),
"protection" => $this->config->GetProtection(),
"encryption" => $this->config->checkEncryptionModule(),
"limitGroups" => $this->config->GetLimitGroups(),
"chat" => $this->config->GetCustomizationChat(),
Expand All @@ -125,6 +126,7 @@ public function index() {
"help" => $this->config->GetCustomizationHelp(),
"toolbarNoTabs" => $this->config->GetCustomizationToolbarNoTabs(),
"successful" => $this->config->SettingsAreSuccessful(),
"plugins" => $this->config->GetCustomizationPlugins(),
"macros" => $this->config->GetCustomizationMacros(),
"reviewDisplay" => $this->config->GetCustomizationReviewDisplay(),
"theme" => $this->config->GetCustomizationTheme(),
Expand Down Expand Up @@ -247,13 +249,20 @@ public function SaveCommon($defFormats,
/**
* Save security settings
*
* @param bool $plugins - enable plugins
* @param bool $macros - run document macros
* @param string $protection - protection
*
* @return array
*/
public function SaveSecurity($macros) {
public function SaveSecurity($plugins,
$macros,
$protection
) {

$this->config->SetCustomizationPlugins($plugins);
$this->config->SetCustomizationMacros($macros);
$this->config->SetProtection($protection);

return [
];
Expand Down
2 changes: 1 addition & 1 deletion controller/templatecontroller.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion controller/webassetcontroller.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion css/editor.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
4 changes: 2 additions & 2 deletions css/main.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -37,7 +37,7 @@
}

/* onlyoffice-inline */
body.onlyoffice-inline {
body.onlyoffice-inline #content-wrapper {
overscroll-behavior-y: none;
overflow: hidden;
}
Expand Down
2 changes: 1 addition & 1 deletion css/settings.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion css/template.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion js/desktop.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion js/editor.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion js/listener.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
16 changes: 10 additions & 6 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2022
* (c) Copyright Ascensio System SIA 2023
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -109,19 +109,23 @@
winEditor.location.href = url;
} else if (!OCA.Onlyoffice.setting.sameTab || OCA.Onlyoffice.mobile || OCA.Onlyoffice.Desktop) {
winEditor = window.open(url, "_blank");
} else if ($("#isPublic").val() === "1" && !$("#filestable").length) {
} else if ($("#isPublic").val() === "1" && $("#mimetype").val() !== "httpd/unix-directory") {
location.href = url;
} else {
var $iframe = $("<iframe id=\"onlyofficeFrame\" nonce=\"" + btoa(OC.requestToken) + "\" scrolling=\"no\" allowfullscreen src=\"" + url + "&inframe=true\" />");
var scrollTop = 0;
if ($("#app-content").length) {
$("#app-content").append($iframe);

var scrollTop = $("#app-content").scrollTop();
$("#onlyofficeFrame").css("top", scrollTop);
scrollTop = $("#app-content").scrollTop();
} else {
$("#preview").append($iframe);

scrollTop = $("#content-wrapper").scrollTop();
}

$("#onlyofficeFrame").css("top", scrollTop);

$("body").addClass("onlyoffice-inline");
OC.Apps.hideAppSidebar();

Expand Down Expand Up @@ -493,7 +497,7 @@
OCA.Onlyoffice.bindVersionClick = function () {
OCA.Onlyoffice.unbindVersionClick();
$(document).on("click.onlyoffice-version", "#versionsTabView .downloadVersion", function() {
var ext = $("#app-sidebar .fileName h3").text().split(".").pop();
var ext = OCA.Onlyoffice.GetFileExtension($("#app-sidebar .fileName h3").text());
if (!OCA.Onlyoffice.setting.formats[ext]
|| !OCA.Onlyoffice.setting.formats[ext].def) {
return true;
Expand Down Expand Up @@ -522,7 +526,7 @@
}

var initPage = function () {
if ($("#isPublic").val() === "1" && !$("#filestable").length) {
if ($("#isPublic").val() === "1" && $("#mimetype").val() !== "httpd/unix-directory") {
var fileName = $("#filename").val();
var extension = OCA.Onlyoffice.GetFileExtension(fileName);

Expand Down
Loading

0 comments on commit 62db166

Please sign in to comment.