Merge branch 'develop'

This commit is contained in:
Paulo Gustavo Veiga 2022-03-14 00:08:58 -03:00
commit fe3a5f884b
20 changed files with 167 additions and 70 deletions

View File

@ -11,6 +11,7 @@ The following products must be installed:
* OpenJDK 11 or higher
* Maven 3.x or higher ([http://maven.apache.org/])
* npm 6 or higher ([https://www.npmjs.com/package/npm?activeTab=versions])
### Compiling

View File

@ -9,8 +9,8 @@ LABEL maintainer="Paulo Gustavo Veiga <pveiga@wisemapping.com>"
ARG WEBAPP_TARGET_DIR="/usr/local/tomcat/webapps/ROOT"
ARG DB_BASE_DIR="/var/lib/wisemapping"
# Defautl ENV configurations ...
ENV JAVA_OPTS="-XX:+PrintFlagsFinal -XX:InitialRAMPercentage=30 -XX:MaxRAMPercentage=80 -javaagent:/opt/newrelic/newrelic.jar"
# Default ENV configurations ...
ENV JAVA_OPTS="-XX:+PrintFlagsFinal -XX:InitialRAMPercentage=30 -XX:MaxRAMPercentage=80"
ENV database.base.url=${DB_BASE_DIR}
# Copy wisemapping distribution ...
@ -22,6 +22,15 @@ RUN rm /tmp/wisemapping.war
# Change logger to
RUN cp ${WEBAPP_TARGET_DIR}/WEB-INF/classes/log4j-stdout.properties ${WEBAPP_TARGET_DIR}/WEB-INF/classes/log4j.properties
# Add support for proxy
RUN sed -i 's|\
</Host>|\
<Valve className="org.apache.catalina.valves.RemoteIpValve" \
remoteIpHeader="X-Forwarded-For" \
protocolHeader="X-Forwarded-Proto"/>\
</Host>|' \
/usr/local/tomcat/conf/server.xml
# Copy default HSQL DB for testing ...
RUN mkdir -p ${DB_BASE_DIR}/db
COPY db/ ${DB_BASE_DIR}/db

View File

@ -4,7 +4,7 @@
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<properties>
<com.wisemapping.version>5.0.7</com.wisemapping.version>
<com.wisemapping.version>5.0.9</com.wisemapping.version>
<superpom.dir>${project.basedir}/wise-webapps</superpom.dir>
</properties>
@ -16,7 +16,7 @@
<groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId>
<name>WiseMapping Project</name>
<version>5.0.7</version>
<version>5.0.9</version>
<packaging>pom</packaging>
<licenses>

View File

@ -12,7 +12,7 @@
<groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId>
<relativePath>../pom.xml</relativePath>
<version>5.0.7</version>
<version>5.0.9</version>
</parent>
<build>
@ -29,11 +29,11 @@
<mkdir dir="target/wisemapping-mindplot"/>
<exec executable="npm" dir="target" failonerror="true">
<arg value="pack"/>
<arg value="@wisemapping/mindplot@5.0.7"/>
<arg value="@wisemapping/mindplot@5.0.9"/>
</exec>
<exec executable="tar" dir="target" failonerror="true">
<arg value="-xvzf"/>
<arg value="wisemapping-mindplot-5.0.7.tgz"/>
<arg value="wisemapping-mindplot-5.0.9.tgz"/>
<arg value="-C"/>
<arg value="wisemapping-mindplot"/>
</exec>
@ -42,11 +42,11 @@
<mkdir dir="target/wisemapping-webapp"/>
<exec executable="npm" dir="target" failonerror="true">
<arg value="pack"/>
<arg value="@wisemapping/webapp@5.0.7"/>
<arg value="@wisemapping/webapp@5.0.9"/>
</exec>
<exec executable="tar" dir="target" failonerror="true">
<arg value="-xvzf"/>
<arg value="wisemapping-webapp-5.0.7.tgz"/>
<arg value="wisemapping-webapp-5.0.9.tgz"/>
<arg value="-C"/>
<arg value="wisemapping-webapp"/>
</exec>

View File

@ -9,7 +9,7 @@
<groupId>org.wisemapping</groupId>
<artifactId>wisemapping</artifactId>
<relativePath>../pom.xml</relativePath>
<version>5.0.7</version>
<version>5.0.9</version>
</parent>
<properties>

View File

@ -37,15 +37,15 @@ public class InvalidMindmapException
}
static public InvalidMindmapException emptyMindmap() {
return new InvalidMindmapException(EMPTY_MINDMAP,"");
return new InvalidMindmapException(EMPTY_MINDMAP, "<empty string>");
}
static public InvalidMindmapException invalidFormat(@Nullable String xmlDoc) {
return new InvalidMindmapException(INVALID_MINDMAP_FORMAT,xmlDoc);
return new InvalidMindmapException(INVALID_MINDMAP_FORMAT, xmlDoc);
}
static public InvalidMindmapException tooBigMindnap() {
return new InvalidMindmapException(TOO_BIG_MINDMAP,"");
static public InvalidMindmapException tooBigMindnap(int numberOfTopics) {
return new InvalidMindmapException(TOO_BIG_MINDMAP, "<too-big " + numberOfTopics + ">");
}
@NotNull

View File

@ -6,7 +6,7 @@ import org.jetbrains.annotations.Nullable;
abstract public class MindmapUtils {
private static final int MAX_SUPPORTED_NODES = 500;
private static final int MAX_SUPPORTED_NODES = 4000;
public static void verifyMindmap(@Nullable String xmlDoc) throws InvalidMindmapException {
if (xmlDoc == null || xmlDoc.trim().isEmpty()) {
@ -20,8 +20,9 @@ abstract public class MindmapUtils {
}
// Validate that the number of nodes is not bigger 500 nodes.
if (xmlDoc.split("<topic").length > MAX_SUPPORTED_NODES) {
throw InvalidMindmapException.tooBigMindnap();
int numberOfTopics = xmlDoc.split("<topic").length;
if (numberOfTopics > MAX_SUPPORTED_NODES) {
throw InvalidMindmapException.tooBigMindnap(numberOfTopics);
}
}
}

View File

@ -542,7 +542,7 @@ public class MindmapController extends BaseController {
mindmap.setXmlStr(mapXml);
// Add new mindmap ...
final User user = Utils.getUser();
final User user = Utils.getUser(true);
mindmapService.addMindmap(mindmap, user);
// Return the new created map ...

View File

@ -19,6 +19,7 @@
package com.wisemapping.webmvc;
import com.wisemapping.exceptions.AccessDeniedSecurityException;
import com.wisemapping.exceptions.MapCouldNotFoundException;
import com.wisemapping.exceptions.MapNonPublicException;
import com.wisemapping.exceptions.WiseMappingException;
@ -52,7 +53,8 @@ public class MindmapController {
private MindmapService mindmapService;
@RequestMapping(value = "maps/{id}/print")
public String showPrintPage(@PathVariable int id, @NotNull Model model) throws MapCouldNotFoundException {
public String showPrintPage(@PathVariable int id, @NotNull Model model) throws MapCouldNotFoundException, AccessDeniedSecurityException {
final MindMapBean mindmap = findMindmapBean(id);
model.addAttribute("principal", Utils.getUser());
model.addAttribute("mindmap", mindmap);
@ -83,7 +85,6 @@ public class MindmapController {
if (!readOnlyMode) {
final LockManager lockManager = this.mindmapService.getLockManager();
if (lockManager.isLocked(mindmap) && !lockManager.isLockedBy(mindmap, collaborator)) {
readOnlyMode = true;
isLocked = true;
} else {
model.addAttribute("lockTimestamp", mindmap.getLastModificationTime().getTimeInMillis());
@ -97,7 +98,6 @@ public class MindmapController {
// Configure default locale for the editor ...
model.addAttribute("locale", locale.toString().toLowerCase());
model.addAttribute("principal", collaborator);
model.addAttribute("readOnlyMode", readOnlyMode);
model.addAttribute("memoryPersistence", false);
model.addAttribute("mindmapLocked", isLocked);
@ -129,7 +129,7 @@ public class MindmapController {
}
@RequestMapping(value = "maps/{id}/embed")
public ModelAndView showEmbeddedPage(@PathVariable int id, @RequestParam(required = false) Float zoom) throws MapCouldNotFoundException, MapNonPublicException {
public ModelAndView showEmbeddedPage(@PathVariable int id, @RequestParam(required = false) Float zoom) throws MapCouldNotFoundException, MapNonPublicException, AccessDeniedSecurityException {
if (!mindmapService.isMindmapPublic(id)) {
throw new MapNonPublicException("Map " + id + " is not public.");
}
@ -173,7 +173,12 @@ public class MindmapController {
}
@NotNull
private MindMapBean findMindmapBean(int mapId) throws MapCouldNotFoundException {
private MindMapBean findMindmapBean(int mapId) throws MapCouldNotFoundException, AccessDeniedSecurityException {
final User user = Utils.getUser();
if (!mindmapService.hasPermissions(user, mapId, CollaborationRole.VIEWER)) {
throw new AccessDeniedSecurityException("No enough permissions to open map with id" + mapId);
}
final Mindmap mindmap = findMindmap(mapId);
return new MindMapBean(mindmap, Utils.getUser());
}

View File

@ -1,31 +0,0 @@
/*
* Copyright [2015] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.webmvc;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class PublicPagesController {
@RequestMapping(value = "home")
public String home() {
return "homepage";
}
}

View File

@ -19,13 +19,10 @@
package com.wisemapping.webmvc;
import com.wisemapping.security.Utils;
import com.wisemapping.service.UserService;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

View File

@ -0,0 +1,58 @@
# Default English Support.
DESCRIPTION = Описание
SITE.TITLE = WiseMapping
FIELD_REQUIRED = Это поле обязательно для заполненияю
EMAIL_ALREADY_EXIST = Аккаунт с таким e-mail уже существует.
NO_VALID_EMAIL_ADDRESS = Некорректный адрес электронной почты.
PASSWORD_MISMATCH = Пароли не совпадают
CREATOR = Создатель
WELCOME = Добро пожаловать
SHARE = Поделиться
UNEXPECTED_ERROR = Что-то пошло не так.
MAP_TITLE_ALREADY_EXISTS = Карта с таким именем уже существует
LABEL_TITLE_ALREADY_EXISTS = Метка с таким именем уже существует
TUTORIAL.MULTIPLE_TEXT_STYLES = Разные стили текста
TUTORIAL.DIFFERENT_SHAPES = Разные Формы
TUTORIAL.FANCY_ICONS = Симпатичные Иконки
TUTORIAL.MOVE_WITH_ARROWS = Перемещение по карте стрелками
TUTORIAL.START_TYPING_TO_EDIT_TEXT = Начните печатать, чтобы отредактировать
TUTORIAL.CTRL_TO_ADD_CHILD = Ctrl/Meta+Enter чтобы добавить подтему
TUTORIAL.ENTER_TO_ADD_SIBLING = Enter чтобы добавить тему того же уровне
TUTORIAL.MORE_KEY_TIPS = А еще ?. Нажми на Shortcuts ниже
TUTORIAL.DOUBLE_CLICK_TO_ADD = Для создания темы - двойной клик по холсту
TUTORIAL.DRAG_AND_DROP_TO_POSITION = Темы и ветки можно перетаскивать
TUTORIAL.DOUBLE_CLICK_TO_EDIT_TEXT = Двойной клик - редактирование темы
TUTORIAL.ADD_NOTES = Добавление заметок
TUTORIAL.USER_THE_TOOLBAR = Панель инструметов
TUTORIAL.PUBLISH_YOUR_MAPS = Публикация своих майнд-карты
TUTORIAL.EMBED_IN_BLOGS = Возможность встроить в блог
TUTORIAL.INVITE_FRIEND = Пригласи друзей
TUTORIAL.SHARING = Доступ
TUTORIAL.EDITION_USING_MOUSE = Редактирование мышью
TUTORIAL.EDITION_USING_KEYBOARD = Редактирование с клавиатуры
TUTORIAL.ADD_LINKS_WEBPAGES = Добавление ссылок на веб-страницы
TUTORIAL.TOPIC_PROPERTIES = Свойства темы
TUTORIAL.HOW_TO_START = Как начать ?
TUTORIAL.FONT_COLOR = Цвет
TUTORIAL.FONT_STYLE = Стили
TUTORIAL.FONT_TYPE = Type
TUTORIAL.SAMPLE_NOTE = Это просто заметка\!.
CAPTCHA_LOADING_ERROR = ReCaptcha не загружается. Должен быть доступ к сервису Google ReCaptcha.
ACCESS_HAS_BEEN_REVOKED = Ваш доступ к карте был отозван. Обратитесь к владельцу.
MAP_CAN_NOT_BE_FOUND = Карта не найдена. Вероятно, она удалена.
LABEL_CAN_NOT_BE_FOUND = Метка не найдена. Вероятно, она удалена.
MINDMAP_TIMESTAMP_OUTDATED = Невозможно сохранить, карта была изменена ''{0}''. Обновите страницу и попробуйте еще раз.
MINDMAP_OUTDATED_BY_YOU = Невозможно сохранить - карта устарела. У вас открыто несколько вкладок браузера?. Обновите страницу и попробуйте еще раз.
MINDMAP_LOCKED = Карта редактируется {0} <{1}>. Карта открыта в режиме чтения.
MINDMAP_IS_LOCKED = Карта доступна только для просмотра.
# Confirmed
RESET_PASSWORD_INVALID_EMAIL = Указанный адрес не связан с аккаунтом пользователя. Укажите корректный адрес.
TRY_WELCOME = Здесь можно ознакомиться с возможностями нашего редактора майнд-карт на примерах и практике \!.
UNEXPECTED_ERROR_DETAILS = Что-то пошло не так при обработке запроса.
NO_ENOUGH_PERMISSIONS=Эта майнд-карта недоступна.
NO_ENOUGH_PERMISSIONS_DETAILS=У вас нет доступа к этой карте. Карта либо удалена, либо стала приватной.
CAPTCHA_TIMEOUT_OUT_DUPLICATE=Пожалуйста, обновите страницу и повторите попытку.
CAPTCHA_INVALID_INPUT_RESPONSE="Неверная CAPTCHA, обновите страницу и повторите попытку.
MINDMAP_EMPTY_ERROR=Карта не может быть пустой.
INVALID_MINDMAP_FORMAT=Недопустимый формат карты.
TOO_BIG_MINDMAP= Слишком большая карта - вы достигли лимита в 500 тем.

View File

@ -0,0 +1,58 @@
# Default English Support.
DESCRIPTION = 描述
SITE.TITLE = WiseMapping
FIELD_REQUIRED = 必填字段不能为空
EMAIL_ALREADY_EXIST = 已经有一个账号使用此电子邮件。
NO_VALID_EMAIL_ADDRESS = 无效的电子邮件地址
PASSWORD_MISMATCH = 您输入的密码不一致
CREATOR = 创建人
WELCOME = 欢迎
SHARE = 分享
UNEXPECTED_ERROR = 发生了意外错误。
MAP_TITLE_ALREADY_EXISTS = 你已经有同名脑图了
LABEL_TITLE_ALREADY_EXISTS = 你已经有一个同名的标签了
TUTORIAL.MULTIPLE_TEXT_STYLES = 多种文本样式
TUTORIAL.DIFFERENT_SHAPES = 不同形状
TUTORIAL.FANCY_ICONS = 炫酷图标
TUTORIAL.MOVE_WITH_ARROWS = 使用方向键在主题之间移动
TUTORIAL.START_TYPING_TO_EDIT_TEXT = 开始键入编辑文本
TUTORIAL.CTRL_TO_ADD_CHILD = 按Ctrl/Meta+Enter添加子主题
TUTORIAL.ENTER_TO_ADD_SIBLING = 按回车键添加并行主题
TUTORIAL.MORE_KEY_TIPS = 更多?点击上面的快捷方式
TUTORIAL.DOUBLE_CLICK_TO_ADD = 双击画布创建主题
TUTORIAL.DRAG_AND_DROP_TO_POSITION = 拖放主题位置
TUTORIAL.DOUBLE_CLICK_TO_EDIT_TEXT = 双击主题编辑文本
TUTORIAL.ADD_NOTES = 添加注释
TUTORIAL.USER_THE_TOOLBAR = 使用工具栏
TUTORIAL.PUBLISH_YOUR_MAPS = 发布你的思维导图
TUTORIAL.EMBED_IN_BLOGS = 嵌入博客
TUTORIAL.INVITE_FRIEND = 邀请朋友协作
TUTORIAL.SHARING = 分享
TUTORIAL.EDITION_USING_MOUSE = 使用鼠标编辑
TUTORIAL.EDITION_USING_KEYBOARD = 使用键盘编辑
TUTORIAL.ADD_LINKS_WEBPAGES = 添加网页链接
TUTORIAL.TOPIC_PROPERTIES = 主题属性
TUTORIAL.HOW_TO_START = 如何开始?
TUTORIAL.FONT_COLOR = 颜色
TUTORIAL.FONT_STYLE = 样式
TUTORIAL.FONT_TYPE = 类型
TUTORIAL.SAMPLE_NOTE = 这是一个简单的注释\!。
CAPTCHA_LOADING_ERROR = 无法加载ReCaptcha。您必须能够访问Google ReCaptcha服务。
ACCESS_HAS_BEEN_REVOKED = 您对该脑图的访问权限已被撤销。联系脑图所有人。
MAP_CAN_NOT_BE_FOUND = 找不到该脑图,应该是被删除了。
LABEL_CAN_NOT_BE_FOUND = 找不到该标签,应该是被删除了。
MINDMAP_TIMESTAMP_OUTDATED =无法保存您的更改,因为您的思维导图已被''{0}''修改。刷新页面,然后重试。
MINDMAP_OUTDATED_BY_YOU = 无法保存您的更改,因为脑图已经过期。您打开了多个页面吗?刷新页面,然后重试。
MINDMAP_LOCKED = 脑图正在被{0}<{1}>编辑。脑图以只读模式打开。
MINDMAP_IS_LOCKED = 脑图被锁定编辑。
# Confirmed
RESET_PASSWORD_INVALID_EMAIL = 提供的电子邮件不是有效的用户账号。请使用有效的电子邮件重试。
TRY_WELCOME = This edition space showcases some of the mindmap editor capabilities \!.此编辑区域展示了一些思维导图编辑器的功能\!。
UNEXPECTED_ERROR_DETAILS = 处理请求时遇到意外错误。
NO_ENOUGH_PERMISSIONS=无法打开思维导图。
NO_ENOUGH_PERMISSIONS_DETAILS=您没有足够的权限查看此脑图。此脑图已更改为私有或被删除。
CAPTCHA_TIMEOUT_OUT_DUPLICATE=请刷新页面,然后重试。
CAPTCHA_INVALID_INPUT_RESPONSE="输入无效,刷新页面后重试。
MINDMAP_EMPTY_ERROR=思维导图不能为空。
INVALID_MINDMAP_FORMAT=思维导图格式无效。
TOO_BIG_MINDMAP=你已经达到了一张思维导图中500个主题的限制。

View File

@ -94,7 +94,7 @@ admin.user = admin@wisemapping.org
# Site Homepage URL. This will be used as URL for homepage location.
site.homepage = c/home
site.homepage = c/login
# Font end static content can be deployed externally to the web app. Uncomment here and specify the url base location.
site.static.js.url = /static

View File

@ -2,7 +2,6 @@
<tiles-definitions>
<definition name="homepage" template="/jsp/homepage.jsp"/>
<definition name="mindmapEmbedded" template="/jsp/mindmapViewonly.jsp"/>
<definition name="mindmapEditor" template="/jsp/mindmapEditor.jsp"/>
<definition name="mindmapPrint" template="/jsp/mindmapViewonly.jsp"/>

View File

@ -19,8 +19,6 @@
<sec:http pattern="/js/**" security="none"/>
<sec:http pattern="/images/**" security="none"/>
<sec:http pattern="/c/home" security="none"/>
<sec:http pattern="/c/maps/*/embed" security="none"/>
<sec:http pattern="/c/maps/*/try" security="none"/>
<sec:http pattern="/c/maps/*/public" security="none"/>
@ -46,7 +44,7 @@
<sec:http use-expressions="true" pattern="/c/**/*">
<sec:csrf request-matcher-ref="requestMatcher"/>
<sec:intercept-url pattern="/c/login" access="hasRole('ANONYMOUS')"/>
<sec:intercept-url pattern="/c/login" access="permitAll"/>
<sec:intercept-url pattern="/c/registration" access="hasRole('ANONYMOUS')"/>
<sec:intercept-url pattern="/c/registration-success" access="hasRole('ANONYMOUS')"/>
<sec:intercept-url pattern="/c/forgot-password" access="hasRole('ANONYMOUS')"/>
@ -61,7 +59,9 @@
login-processing-url="/c/perform-login"/>
<!-- Expire in 28 days -->
<sec:remember-me token-validity-seconds="2419200" remember-me-parameter="remember-me"/>
<sec:remember-me token-validity-seconds="2419200"
remember-me-parameter="remember-me"
authentication-success-handler-ref="authenticationSuccessHandler"/>
<sec:logout logout-url="/c/logout" invalidate-session="true" logout-success-url="/c/login"/>
</sec:http>

View File

@ -1,7 +1,7 @@
/********************************************************************************/
/* Header & Toolbar Styles */
/********************************************************************************/
@import "../bootstrap/css/bootstrap.min.css";
@import "bootstrap.min.css";
body {
margin: 0;
font-family:Arial;

View File

@ -48,8 +48,8 @@
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="text/javascript" src="${requestScope['site.static.js.url']}/webapp/vendors.bundle.js"></script>
<script type="text/javascript" src="${requestScope['site.static.js.url']}/webapp/app.bundle.js"></script>
<script type="text/javascript" src="${requestScope['site.static.js.url']}/webapp/vendors.bundle.js" crossorigin="anonymous"></script>
<script type="text/javascript" src="${requestScope['site.static.js.url']}/webapp/app.bundle.js" crossorigin="anonymous"></script>
</body>

View File

@ -35,7 +35,7 @@
<span class="title"><spring:message code="DESCRIPTION"/>:</span><span>${mindmap.title}</span>
</div>
<script type="text/javascript" src="${requestScope['site.static.js.url']}/mindplot/loader.js"></script>
<script type="text/javascript" src="${requestScope['site.static.js.url']}/mindplot/loader.js" crossorigin="anonymous"></script>
<div id="floating-panel">
<div id="zoom-button">

View File

@ -32,8 +32,8 @@
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="text/javascript" src="${requestScope['site.static.js.url']}/webapp/vendors.bundle.js"></script>
<script type="text/javascript" src="${requestScope['site.static.js.url']}/webapp/app.bundle.js"></script>
<script type="text/javascript" src="${requestScope['site.static.js.url']}/webapp/vendors.bundle.js" crossorigin="anonymous"></script>
<script type="text/javascript" src="${requestScope['site.static.js.url']}/webapp/app.bundle.js" crossorigin="anonymous"></script>
</body>
</html>