Skip to content

Commit

Permalink
Merge pull request #92 from ONLYOFFICE/develop
Browse files Browse the repository at this point in the history
Release/4.2.0
  • Loading branch information
LinneyS authored Mar 20, 2023
2 parents e2f5b1a + 4e7c6aa commit e35144c
Show file tree
Hide file tree
Showing 43 changed files with 917 additions and 636 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Get Info
run: |
echo "::set-output name=version::$(awk '/<version>/,/<\/version>/' pom.xml | head -n 1 | sed 's/^[[:space:]]*//g' | sed -n 's:.*<version>\(.*\)</version>.*:\1:p')"
echo "::set-output name=artifact::$(awk '/<artifactId>/,/<\/artifactId>/' pom.xml | head -n 1 | sed 's/^[[:space:]]*//g' | sed -n 's:.*<artifactId>\(.*\)</artifactId>.*:\1:p')"
echo "version=$(awk '/<version>/,/<\/version>/' pom.xml | head -n 1 | sed 's/^[[:space:]]*//g' | sed -n 's:.*<version>\(.*\)</version>.*:\1:p')" >> $GITHUB_OUTPUT
echo "artifact=$(awk '/<artifactId>/,/<\/artifactId>/' pom.xml | head -n 1 | sed 's/^[[:space:]]*//g' | sed -n 's:.*<artifactId>\(.*\)</artifactId>.*:\1:p')" >> $GITHUB_OUTPUT
id: info
- name: Install Java 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- name: Build Artifact
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
sudo apt install default-jre -y
sudo sh -c 'echo "deb https://packages.atlassian.com/debian/atlassian-sdk-deb/ stable contrib" >>/etc/apt/sources.list'
wget https://packages.atlassian.com/api/gpg/key/public
sudo apt-key add public
Expand All @@ -33,7 +37,7 @@ jobs:
cd ./target
mv ${{ steps.info.outputs.artifact }}-${{ steps.info.outputs.version }}.jar $cwd
- name: Upload Artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ${{ steps.info.outputs.artifact }}-${{ steps.info.outputs.version }}
path: ${{ steps.info.outputs.artifact }}-${{ steps.info.outputs.version }}.jar
33 changes: 12 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Get Info
run: |
echo "::set-output name=version::$(awk '/<version>/,/<\/version>/' pom.xml | head -n 1 | sed 's/^[[:space:]]*//g' | sed -n 's:.*<version>\(.*\)</version>.*:\1:p')"
echo "::set-output name=artifact::$(awk '/<artifactId>/,/<\/artifactId>/' pom.xml | head -n 1 | sed 's/^[[:space:]]*//g' | sed -n 's:.*<artifactId>\(.*\)</artifactId>.*:\1:p')"
echo "version=$(awk '/<version>/,/<\/version>/' pom.xml | head -n 1 | sed 's/^[[:space:]]*//g' | sed -n 's:.*<version>\(.*\)</version>.*:\1:p')" >> $GITHUB_OUTPUT
echo "artifact=$(awk '/<artifactId>/,/<\/artifactId>/' pom.xml | head -n 1 | sed 's/^[[:space:]]*//g' | sed -n 's:.*<artifactId>\(.*\)</artifactId>.*:\1:p')" >> $GITHUB_OUTPUT
id: info
- name: Install Java 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- name: Build Artifact
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
sudo apt install default-jre -y
sudo sh -c 'echo "deb https://packages.atlassian.com/debian/atlassian-sdk-deb/ stable contrib" >>/etc/apt/sources.list'
wget https://packages.atlassian.com/api/gpg/key/public
sudo apt-key add public
Expand All @@ -34,22 +38,9 @@ jobs:
run: |
awk '/## [0-9]/{p++} p; /## [0-9]/{if (p > 1) exit}' CHANGELOG.md | awk 'NR>2 {print last} {last=$0}' > RELEASE.md
- name: Create Release
uses: actions/create-release@v1
uses: ncipollo/release-action@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ steps.info.outputs.version }}
tag_name: ${{ steps.info.outputs.version }}
body_path: ./RELEASE.md
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.info.outputs.artifact }}-${{ steps.info.outputs.version }}.jar
asset_name: ${{ steps.info.outputs.artifact }}-${{ steps.info.outputs.version }}.jar
asset_content_type: application/java-archive
artifacts: "${{ steps.info.outputs.artifact }}-${{ steps.info.outputs.version }}.jar"
bodyFile: RELEASE.md
tag: v${{ steps.info.outputs.version }}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## 4.2.0
## Changed
- compatible with Confluence 8.1.1
- Confluence 6 is no longer supported
- fix editing in blog

## 4.1.0
## Added
- button ONLYOFFICE in confluence preview
Expand Down
40 changes: 35 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>onlyoffice</groupId>
<artifactId>onlyoffice-confluence-plugin</artifactId>
<version>4.1.0</version>
<version>4.2.0</version>

<organization>
<name>Ascensio System SIA</name>
Expand Down Expand Up @@ -178,12 +178,42 @@
</plugins>
</build>

<repositories>
<repository>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<id>atlassian-public</id>
<url>https://maven.atlassian.com/repository/public</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<id>atlassian-public</id>
<url>https://maven.atlassian.com/repository/public</url>
</pluginRepository>
</pluginRepositories>

<properties>
<confluence.version>7.0.3</confluence.version>
<confluence.data.version>7.0.3</confluence.data.version>
<confluence.version>8.0.1</confluence.version>
<confluence.data.version>8.0.1</confluence.data.version>
<amps.version>6.3.21</amps.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<atlassian.spring.scanner.version>2.1.0</atlassian.spring.scanner.version>
<atlassian.spring.scanner.version>2.2.3</atlassian.spring.scanner.version>
<!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
</properties>
Expand Down
19 changes: 8 additions & 11 deletions src/main/java/onlyoffice/AuthContext.java
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 All @@ -18,24 +18,21 @@

package onlyoffice;

import java.io.IOException;
import java.security.Principal;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.atlassian.confluence.util.GeneralUtil;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

import com.atlassian.confluence.util.GeneralUtil;

import javax.inject.Named;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.security.Principal;

@Named
public class AuthContext {
private final Logger log = LogManager.getLogger("onlyoffice.AuthContext");

public boolean checkUserAuthorisation(HttpServletRequest request, HttpServletResponse response)
public boolean checkUserAuthorisation(final HttpServletRequest request, final HttpServletResponse response)
throws IOException {
Principal principal = request.getUserPrincipal();
if (principal == null) {
Expand All @@ -49,7 +46,7 @@ public boolean checkUserAuthorisation(HttpServletRequest request, HttpServletRes
return true;
}

private String getLoginUrl(HttpServletRequest request) throws IOException {
private String getLoginUrl(final HttpServletRequest request) throws IOException {
StringBuilder stringBuilder = new StringBuilder(request.getContextPath());
String fullUrl = stringBuilder.append("/login.action?permissionViolation=true&os_destination=")
.append("plugins%2Fservlet%2Fonlyoffice%2Fdoceditor").append("?")
Expand Down
26 changes: 15 additions & 11 deletions src/main/java/onlyoffice/OnlyOfficeAPIServlet.java
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 @@ -44,15 +44,18 @@
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class OnlyOfficeAPIServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final Logger log = LogManager.getLogger("onlyoffice.OnlyOfficeAPIServlet");
private final Logger log = LogManager.getLogger("onlyoffice.OnlyOfficeAPIServlet");

private final JwtManager jwtManager;
private final DocumentManager documentManager;
Expand All @@ -63,9 +66,9 @@ public class OnlyOfficeAPIServlet extends HttpServlet {
private final ConfigurationManager configurationManager;

@Inject
public OnlyOfficeAPIServlet(JwtManager jwtManager, DocumentManager documentManager,
AttachmentUtil attachmentUtil, ParsingUtil parsingUtil, UrlManager urlManager,
ConfigurationManager configurationManager) {
public OnlyOfficeAPIServlet(final JwtManager jwtManager, final DocumentManager documentManager,
final AttachmentUtil attachmentUtil, final ParsingUtil parsingUtil,
final UrlManager urlManager, final ConfigurationManager configurationManager) {
this.jwtManager = jwtManager;
this.documentManager = documentManager;
this.attachmentUtil = attachmentUtil;
Expand All @@ -75,11 +78,11 @@ public OnlyOfficeAPIServlet(JwtManager jwtManager, DocumentManager documentManag
}

@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
public void doPost(final HttpServletRequest request, final HttpServletResponse response)
throws ServletException, IOException {
String type = request.getParameter("type");
if (type != null) {
switch (type.toLowerCase())
{
switch (type.toLowerCase()) {
case "save-as":
saveAs(request, response);
break;
Expand All @@ -96,7 +99,7 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
}
}

private void saveAs (HttpServletRequest request, HttpServletResponse response) throws IOException {
private void saveAs(final HttpServletRequest request, final HttpServletResponse response) throws IOException {
ConfluenceUser user = AuthenticatedUserThreadLocal.get();

if (user == null) {
Expand Down Expand Up @@ -155,7 +158,8 @@ private void saveAs (HttpServletRequest request, HttpServletResponse response) t
}
}

private void attachmentData (HttpServletRequest request, HttpServletResponse response) throws IOException {
private void attachmentData(final HttpServletRequest request, final HttpServletResponse response)
throws IOException {
ConfluenceUser user = AuthenticatedUserThreadLocal.get();

if (user == null) {
Expand Down
Loading

0 comments on commit e35144c

Please sign in to comment.