Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/develop' into feature/ed…
Browse files Browse the repository at this point in the history
…itors-availability-check

# Conflicts:
#	CHANGELOG.md
#	l10n/ru.js
#	l10n/ru.json
  • Loading branch information
LinneyS committed Jul 11, 2023
2 parents 310c43a + 7fc1354 commit 5cdc5eb
Show file tree
Hide file tree
Showing 25 changed files with 710 additions and 31 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/lint-php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Lint

on:
push:
pull_request:
branches: [master]

permissions:
contents: read

jobs:
php-lint:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [ "8.0", "8.1", "8.2" ]
name: php-lint
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up php ${{ matrix.php-versions }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: none
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Lint
run: |
cd ${{ github.workspace }}
find . -name \\*.php -not -path './lib/composer/*' -not -path './build/stubs/*' -print0 | xargs -0 -n1 php -l
26 changes: 26 additions & 0 deletions .github/workflows/lint-phpcs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint

on:
push:
pull_request:
branches: [master]

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
name: php-cs
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
coverage: none
tools: composer, cs2pr, phpcs
- name: Run phpcs
run: |
phpcs --standard=PSR2 --extensions=php,module,inc,install --ignore=node_modules,bower_components,vendor,3rdparty,Migration --warning-severity=0 ./
17 changes: 14 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@

## Added
- jwt header setting
- Paste Special to add a link between files
- Basque translation
- Link to docs cloud
- background job for checking editors availability

## 7.7.0
## Changed
- anonymous without configuring file protection, chat and without the possibility of mentioning
- fileType to history data
- change page title when editing a file

## 7.8.0
## Added
- disable plugins setting
- document protection setting
Expand All @@ -14,23 +22,26 @@
## Changed
- fix thumbnails for version files
- fix notification length
- compatible with Nextcloud 26
- additional check availability for group and external files when mention

## 7.5.8
## 7.6.8
## Changed
- fix download permission

## 7.5.6
## 7.6.6
## Added
- Dutch translation
- Chinese (Traditional, Taiwan), Basque (Spain) empty file templates

## Changed
- compatible with Nextcloud 25
- generate preview by default
- fix editing with federated share
- fix opening file in new tab
- fix watermark for shared file by link
- fix update application
- Nextcloud v24 is no longer supported

## 7.5.4
## Changed
Expand Down
4 changes: 2 additions & 2 deletions 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 Nextcloud 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>apache</licence>
<author mail="[email protected]" homepage="https://www.onlyoffice.com/">Ascensio System SIA</author>
<version>7.7.0</version>
<version>7.8.0</version>
<namespace>Onlyoffice</namespace>
<types>
<prevent_group_restriction/>
Expand All @@ -30,7 +30,7 @@
<screenshot>https://raw.githubusercontent.com/ONLYOFFICE/onlyoffice-nextcloud/master/screenshots/open.png</screenshot>
<screenshot>https://raw.githubusercontent.com/ONLYOFFICE/onlyoffice-nextcloud/master/screenshots/open_form.png</screenshot>
<dependencies>
<nextcloud min-version="24" max-version="24"/>
<nextcloud min-version="25" max-version="26"/>
</dependencies>
<settings>
<admin>OCA\Onlyoffice\AdminSettings</admin>
Expand Down
1 change: 1 addition & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
["name" => "editor#public_page", "url" => "/s/{shareToken}", "verb" => "GET"],
["name" => "editor#users", "url" => "/ajax/users", "verb" => "GET"],
["name" => "editor#mention", "url" => "/ajax/mention", "verb" => "POST"],
["name" => "editor#reference", "url" => "/ajax/reference", "verb" => "POST"],
["name" => "editor#create", "url" => "/ajax/new", "verb" => "POST"],
["name" => "editor#convert", "url" => "/ajax/convert", "verb" => "POST"],
["name" => "editor#save", "url" => "/ajax/save", "verb" => "POST"],
Expand Down
9 changes: 9 additions & 0 deletions controller/editorapicontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok
"permissions" => [],
"title" => $fileName,
"url" => $fileUrl,
"referenceData" => [
"fileKey" => $file->getId(),
"instanceId" => $this->config->GetSystemValue("instanceid", true),
],
],
"documentType" => $format["type"],
"editorConfig" => [
Expand Down Expand Up @@ -424,6 +428,11 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok
}
$params["document"]["permissions"]["protect"] = $canProtect;

if (!isset($userId)) {
$params["document"]["permissions"]["chat"] = false;
$params["document"]["permissions"]["protect"] = false;
}

$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
73 changes: 73 additions & 0 deletions controller/editorcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,75 @@ public function mention($fileId, $anchor, $comment, $emails) {
return ["message" => $this->trans->t("Notification sent successfully")];
}

/**
* Reference data
*
* @param array $referenceData - reference data
* @param string $path - file path
*
* @return array
*
* @NoAdminRequired
* @PublicPage
*/
public function reference($referenceData, $path = null) {
$this->logger->debug("reference: " . json_encode($referenceData) . " $path", ["app" => $this->appName]);

if (!$this->config->isUserAllowedToUse()) {
return ["error" => $this->trans->t("Not permitted")];
}

$user = $this->userSession->getUser();
if (empty($user)) {
return ["error" => $this->trans->t("Not permitted")];
}

$userId = $user->getUID();

$file = null;
$fileId = (integer)($referenceData["fileKey"] ?? 0);
if (!empty($fileId)
&& $referenceData["instanceId"] === $this->config->GetSystemValue("instanceid", true)) {
list ($file, $error, $share) = $this->getFile($userId, $fileId);
}

$userFolder = $this->root->getUserFolder($userId);
if ($file === null
&& $path !== null
&& $userFolder->nodeExists($path)) {
$node = $userFolder->get($path);
if ($node instanceof File
&& $node->isReadable()) {
$file = $node;
}
}

if ($file === null) {
$this->logger->error("Reference not found: $fileId $path", ["app" => $this->appName]);
return ["error" => $this->trans->t("File not found")];
}

$fileName = $file->getName();
$ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));

$response = [
"fileType" => $ext,
"path" => $userFolder->getRelativePath($file->getPath()),
"referenceData" => [
"fileKey" => $file->getId(),
"instanceId" => $this->config->GetSystemValue("instanceid", true),
],
"url" => $this->getUrl($file, $user),
];

if (!empty($this->config->GetDocumentServerSecret())) {
$token = \Firebase\JWT\JWT::encode($response, $this->config->GetDocumentServerSecret());
$response["token"] = $token;
}

return $response;
}

/**
* Conversion file to Office Open XML format
*
Expand Down Expand Up @@ -896,8 +965,11 @@ public function version($fileId, $version) {
$fileUrl = $this->getUrl($file, $user, null, $version);
}
$key = DocumentService::GenerateRevisionId($key);
$fileName = $file->getName();
$ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));

$result = [
"fileType" => $ext,
"url" => $fileUrl,
"version" => $version,
"key" => $key
Expand All @@ -917,6 +989,7 @@ public function version($fileId, $version) {
$prevVersionUrl = $this->getUrl($file, $user, null, $version - 1);

$result["previous"] = [
"fileType" => $ext,
"key" => $prevVersionKey,
"url" => $prevVersionUrl
];
Expand Down
4 changes: 3 additions & 1 deletion controller/settingscontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ public function index() {
"tagsEnabled" => \OC::$server->getAppManager()->isEnabledForUser("systemtags"),
"reviewDisplay" => $this->config->GetCustomizationReviewDisplay(),
"theme" => $this->config->GetCustomizationTheme(),
"templates" => $this->GetGlobalTemplates()
"templates" => $this->GetGlobalTemplates(),
"linkToDocs" => $this->config->GetLinkToDocs()
];
return new TemplateResponse($this->appName, "settings", $data, "blank");
}
Expand All @@ -146,6 +147,7 @@ public function index() {
* @param string $storageUrl - Nextcloud address available from document server
* @param bool $verifyPeerOff - parameter verification setting
* @param string $secret - secret key for signature
* @param string $jwtHeader - jwt header
* @param bool $demo - use demo server
*
* @return array
Expand Down
4 changes: 2 additions & 2 deletions controller/sharingapicontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class SharingApiController extends OCSController {
*
* @var AppConfig
*/
private $config;
private $appConfig;

/**
* Share manager
Expand All @@ -104,7 +104,7 @@ class SharingApiController extends OCSController {
* @param IUserSession $userSession - current user session
* @param IUserManager $userManager - user manager
* @param IManager $shareManager - Share manager
* @param AppConfig $config - application configuration
* @param AppConfig $appConfig - application configuration
*/
public function __construct($AppName,
IRequest $request,
Expand Down
22 changes: 17 additions & 5 deletions css/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,25 @@
min-height: calc(100% - 50px);
}

#body-public #content.app-public {
height: 100%;
}

#body-public footer {
display: none;
}

#app > iframe {
position: absolute;
position: fixed;
vertical-align: top;
left: 0px;
height: calc(100vh - 58px);
margin-top: -50px;
}

#content.app-onlyoffice #app > iframe {
height: calc(100vh - 50px);
margin-top: 0px;
}

.onlyoffice-inviewer > iframe {
height: 100vh !important;
}

.AscDesktopEditor #body-user #header {
Expand All @@ -40,4 +48,8 @@
.AscDesktopEditor #body-user #content {
min-height: 100%;
padding-top: 0;
margin-top: 0px;
}
.AscDesktopEditor #app > iframe {
height: 100% !important;
}
30 changes: 19 additions & 11 deletions css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,32 @@
}

/* onlyoffice-inline */
body.onlyoffice-inline {
overscroll-behavior-y: none;
overflow: hidden;
}
body.onlyoffice-inline #app-navigation,
body.onlyoffice-inline .searchbox,
body.onlyoffice-inline #app-content #controls,
body.onlyoffice-inline #filestable {
#body-user.onlyoffice-inline #app-navigation,
#body-user.onlyoffice-inline #app-navigation-vue,
#body-user.onlyoffice-inline .searchbox,
#body-user.onlyoffice-inline #app-content .files-controls,
#body-user.onlyoffice-inline #app-content-vue .files-controls,
#body-user.onlyoffice-inline .files-filestable {
display: none;
}
body.onlyoffice-inline #app-navigation-toggle {
#body-user.onlyoffice-inline #app-navigation-toggle {
display: none !important;
}
body.onlyoffice-inline #content #app-content {
#body-public.onlyoffice-inline #content #app-content,
#body-user.onlyoffice-inline #content #app-content {
margin-left: 0;
position: relative;
overflow: hidden;
overscroll-behavior-y: none;
}
#body-public.onlyoffice-inline footer {
display: none !important;
}

#onlyofficeFrame {
background-color: #fff;
width: 100%;
height: calc(100vh - 50px);
height: 100vh;
display: block;
position: absolute;
top: 0;
Expand All @@ -74,6 +80,8 @@ body.onlyoffice-inline #content #app-content {
}
.AscDesktopEditor #body-user #content {
padding-top: 0;
margin-top: 0px;
height: 100%;
}
.AscDesktopEditor #body-user #app-navigation,
.AscDesktopEditor #body-user #controls,
Expand Down
Loading

0 comments on commit 5cdc5eb

Please sign in to comment.