Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
MCMS
Commits
0635c9b0
Commit
0635c9b0
authored
Mar 02, 2022
by
msgroup
Committed by
mingsoft
Mar 02, 2022
Browse files
修复百度编辑器上传
parent
7ac7bcb2
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/net/mingsoft/basic/action/web/EditorAction.java
0 → 100755
View file @
0635c9b0
/**
* The MIT License (MIT)
* Copyright (c) 2012-2022 铭软科技(mingsoft.net)
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package
net.mingsoft.basic.action.web
;
import
cn.hutool.core.io.FileUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.mingsoft.ueditor.MsUeditorActionEnter
;
import
net.mingsoft.basic.util.BasicUtil
;
import
net.mingsoft.config.MSProperties
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Map
;
/**
* 临时修复:百度编辑器上传,会在下一版本合并
*
* @author 铭软开发团队
* @date 2019年7月16日
* 历史修订 2022-1-21 新增normalize(),
* editor()方法过滤非法上传路径
*/
@ApiIgnore
@Controller
(
"ueAction"
)
@RequestMapping
(
"/static/plugins/ueditor/{version}/jsp"
)
public
class
EditorAction
{
@ResponseBody
@RequestMapping
(
value
=
"editor"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
String
editor
(
HttpServletRequest
request
,
HttpServletResponse
response
,
String
jsonConfig
)
{
String
uploadFloderPath
=
MSProperties
.
upload
.
path
;
String
rootPath
=
BasicUtil
.
getRealPath
(
uploadFloderPath
);
jsonConfig
=
jsonConfig
.
replace
(
"{ms.upload}"
,
"/"
+
uploadFloderPath
);
//过滤非法上传路径
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
JSONObject
.
parse
(
jsonConfig
);
String
imagePathFormat
=
(
String
)
map
.
get
(
"imagePathFormat"
);
imagePathFormat
=
FileUtil
.
normalize
(
imagePathFormat
);
String
filePathFormat
=
(
String
)
map
.
get
(
"filePathFormat"
);
filePathFormat
=
FileUtil
.
normalize
(
filePathFormat
);
String
videoPathFormat
=
(
String
)
map
.
get
(
"videoPathFormat"
);
videoPathFormat
=
FileUtil
.
normalize
(
videoPathFormat
);
map
.
put
(
"imagePathFormat"
,
imagePathFormat
);
map
.
put
(
"filePathFormat"
,
filePathFormat
);
map
.
put
(
"videoPathFormat"
,
videoPathFormat
);
jsonConfig
=
JSONObject
.
toJSONString
(
map
);
MsUeditorActionEnter
actionEnter
=
new
MsUeditorActionEnter
(
request
,
rootPath
,
jsonConfig
,
BasicUtil
.
getRealPath
(
""
));
String
json
=
actionEnter
.
exec
();
Map
jsonMap
=
JSON
.
parseObject
(
json
,
Map
.
class
);
jsonMap
.
put
(
"url"
,
"/"
.
concat
(
uploadFloderPath
).
concat
(
jsonMap
.
get
(
"url"
)+
""
));
return
JSONObject
.
toJSONString
(
jsonMap
);
}
}
src/main/webapp/WEB-INF/manager/include/head-file.ftl
0 → 100644
View file @
0635c9b0
<
meta
charset="utf-8">
<!--浏览器小图标-->
<
link
rel="icon" href="/logo.ico" type="x-icon">
<
script
type="text/javascript" src="$
{
base
}
/static/plugins/vue/2.6.9/vue.min.js"></script>
<
script
src="$
{
base
}
/static/plugins/vue-i18n/8.18.2/vue-i18n.js"></script>
<!--
图标 -->
<
link
rel="stylesheet" type="text/css" href="$
{
base
}
/static/plugins/iconfont/1.0.0/iconfont.css" />
<
script
src="$
{
base
}
/static/plugins/iconfont/1.0.0/iconfont.js"></script>
<!--
引入样式 -->
<
link
rel="stylesheet" href="$
{
base
}
/static/plugins/element-ui/2.15.7/theme-chalk/index.min.css">
<!--
引入组件库 -->
<
script
src="$
{
base
}
/static/plugins/element-ui/2.15.7/index.min.js"></script>
<
script
src="$
{
base
}
/static/plugins/element-ui/2.15.7/local/en.min.js"></script>
<
script
src="$
{
base
}
/static/plugins/element-ui/2.15.7/local/zh-CN.min.js"></script>
<!--图片懒加载-->
<
script
src="$
{
base
}
/static/plugins/vue.lazyload/1.2.6/vue-lazyload.js"></script>
<!--网络请求框架-->
<
script
src="$
{
base
}
/static/plugins/axios/0.18.0/axios.min.js"></script>
<
script
src="$
{
base
}
/static/plugins/qs/6.6.0/qs.min.js"></script>
<!--金额转换-->
<
script
src="$
{
base
}
/static/plugins/accounting/0.4.1/accounting.js"></script>
<!--时间转换-->
<
script
src="$
{
base
}
/static/plugins/moment/2.24.0/moment.min.js"></script>
<!--铭飞-->
<
script
src="$
{
base
}
/static/plugins/ms/2.0/ms.umd.js"></script>
<
script
src="$
{
base
}
/static/plugins/ms/2.0/ms-el-form.umd.js"></script>
<
script
src="$
{
base
}
/static/plugins/vue-ueditor-wrap/vue-ueditor-wrap.min.js"></script>
<#--复制-->
<
script
src="$
{
base
}
/static/plugins/clipboard/clipboard.js"></script>
<#--
树形下拉-->
<
script
src="$
{
base
}
/static/plugins/tree-select/tree.js"></script>
<!--通用样式-->
<
link
rel="stylesheet" href="$
{
base
}
/static/css/app.css"/>
<#--主题-->
<
link
rel="stylesheet" href="$
{
base
}
/static/css/theme.css">
<![
if
IE]>
<
script
src="$
{
base
}
/static/plugins/babel-polyfill/7.8.3/polyfill.min.js"></script>
<![
endif
]>
<#--语言文件-->
<
script
src="$
{
base
}
/static/locale/lang/base/zh_CN.js"></script>
<
script
src="$
{
base
}
/static/locale/lang/base/en_US.js"></script>
<
script
src="$
{
base
}
/static/mdiy/index.js"></script>
<#--下拉框-->
<
script
src="$
{
base
}
/static/plugins/vue-treeselect/0.4.0/vue-treeselect.umd.min.js"></script>
<
link
rel="stylesheet" href="$
{
base
}
/static/plugins/vue-treeselect/0.4.0/vue-treeselect.min.css">
<#--代码预览-->
<
script
src="$
{
base
}
/static/plugins/clipboard/clipboard.js"></script>
<
script
src="$
{
base
}
/static/plugins/codemirror/5.48.4/codemirror.js"></script>
<
link
href="$
{
base
}
/static/plugins/codemirror/5.48.4/codemirror.css" rel="stylesheet">
<
script
src="$
{
base
}
/static/plugins/codemirror/5.48.4/mode/css/css.js"></script>
<
script
src="$
{
base
}
/static/plugins/vue-codemirror/vue-codemirror.js"></script>
<
script
src="$
{
base
}
/static/plugins/codemirror/5.48.4/addon/scroll/annotatescrollbar.js"></script>
<
script
src="$
{
base
}
/static/plugins/codemirror/5.48.4/mode/xml/xml.js"></script>
<
script
src="$
{
base
}
/static/plugins/codemirror/5.48.4/mode/javascript/javascript.js"></script>
<
script
>
ms.base = "$
{
base
}
";
ms.login = "$
{
managerPath
}
/login.do";
ms.manager = "$
{
managerPath
}
";
ms.web = ms.base;
//百度编辑器默认配置
ms.editorConfig=
{
imageScaleEnabled
:
true
,
autoHeightEnabled
:
true
,
autoFloatEnabled
:
false
,
scaleEnabled
:
true
,
compressSide
:
0
,
maxImageSideLength
:
1000
,
maximumWords
:
2000
,
initialFrameWidth
:
'
100
%'
,
initialFrameHeight
:
400
,
serverUrl
:
ms
.base
+
"/static/plugins/ueditor/1.4.3.3/jsp/editor.do?jsonConfig=%7BvideoUrlPrefix:
\'\'
,fileManagerListPath:
\'\'
,imageMaxSize:204800000,videoMaxSize:204800000,fileMaxSize:204800000,fileUrlPrefix:
\'\'
,imageUrlPrefix:
\'\'
,imagePathFormat:
\'
/${appId}/cms/content/editor/%7Btime%7D
\'
,filePathFormat:
\'
/${appId}/cms/content/editor/%7Btime%7D
\'
,videoPathFormat:
\'
/${appId}/cms/content/editor/%7Btime%7D
\'
%7D"
,
UEDITOR
_
HOME
_
URL
:
ms
.base
+
'/
static
/
plugins
/
ueditor
/
1.4
.
3.3
/'
}
//ms.base = "http://192.168.0.54:90/";
//ms.manager = "http://192.168.0.54:90/apis/ms/";
//ms.web = "http://192.168.0.54:90/apis/";
//图片懒加载
Vue.use(VueLazyload,
{
error
:
ms
.base
+
'/
static
/
images
/
error
.png
'
,
loading
:
ms
.base
+
'/
static
/
images
/
loading
.png
'
,
}
)
Vue.component('treeselect', VueTreeselect.Treeselect)
Vue.component('vue-ueditor-wrap', VueUeditorWrap);
</
script
>
<
style
>
.ms-admin-menu .is-active
{
border
:
0
px
!
important
;
}
.vue-treeselect__placeholder
,
.vue-treeselect__single-value
{
font-size
:
12
px
;
padding-top
:
-8
px
;
}
.vue-treeselect__control
{
height
:
28
px
;
}
.vue-treeselect__label
{
font-size
:
12
px
;
}
.vue-treeselect__menu-container
{
z-index
:
9999
!
important
;
}
</
style
>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment