Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
街头小贩
Jforum2
提交
16076fa3
J
Jforum2
项目概览
街头小贩
/
Jforum2
通知
2
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
1
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
Jforum2
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
16076fa3
编写于
8月 31, 2020
作者:
街头小贩
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加/member/home/topic/**的CORS
上级
771c363b
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
12 addition
and
1 deletion
+12
-1
thrones/src/main/java/com/apobates/forum/thrones/ThronesFrontConfig.java
...n/java/com/apobates/forum/thrones/ThronesFrontConfig.java
+8
-0
thrones/src/main/java/com/apobates/forum/thrones/controller/TopicController.java
...om/apobates/forum/thrones/controller/TopicController.java
+1
-0
thrones/src/main/resources/global.properties
thrones/src/main/resources/global.properties
+3
-1
未找到文件。
thrones/src/main/java/com/apobates/forum/thrones/ThronesFrontConfig.java
浏览文件 @
16076fa3
...
...
@@ -27,6 +27,7 @@ import org.springframework.http.MediaType;
import
org.springframework.validation.Validator
;
import
org.springframework.validation.beanvalidation.LocalValidatorFactoryBean
;
import
org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer
;
import
org.springframework.web.servlet.config.annotation.CorsRegistry
;
import
org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer
;
import
org.springframework.web.servlet.config.annotation.EnableWebMvc
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
...
...
@@ -63,6 +64,8 @@ public class ThronesFrontConfig implements WebMvcConfigurer {
private
String
imageBucketDomain
;
@Value
(
"${img.bucket.upload.direct}"
)
private
String
imageBucketUploadDirect
;
@Value
(
"${site.origin.admin}"
)
private
String
adminDomain
;
//授权访问的拦截器
@Bean
...
...
@@ -163,6 +166,11 @@ public class ThronesFrontConfig implements WebMvcConfigurer {
lvfb
.
setValidationMessageSource
(
messageSource
());
return
lvfb
;
}
//To enable CORS for the whole application
@Override
public
void
addCorsMappings
(
CorsRegistry
registry
)
{
registry
.
addMapping
(
"/member/home/topic/**"
).
allowedMethods
(
"GET"
).
allowedOrigins
(
adminDomain
);
}
@Bean
public
MessageSource
messageSource
()
{
ResourceBundleMessageSource
messageSource
=
new
ResourceBundleMessageSource
();
...
...
thrones/src/main/java/com/apobates/forum/thrones/controller/TopicController.java
浏览文件 @
16076fa3
...
...
@@ -718,6 +718,7 @@ public class TopicController {
String
imagePath
=
"/static/img/default.poster.bg.jpg"
;
try
{
Album
album
=
albumService
.
get
(
topicObj
.
getAlbumId
()).
orElse
(
null
);
//不希望添加水印可以使用ForumEntityIcoDecorder解码封面地址
imagePath
=
new
UploadImagePathConvert
(
imageIOMeta
.
getImageBucketDomain
(),
imageIOMeta
.
getUploadImageDirectName
())
.
decode
(
album
.
getCoverLink
(),
ImageDirectoryEnum
.
DEFAT
,
scale
)
.
map
(
URL:
:
toString
)
...
...
thrones/src/main/resources/global.properties
浏览文件 @
16076fa3
...
...
@@ -12,7 +12,7 @@ web.validate.encode=UTF-8
# applicationContext-admin.xml
jdbc.driverClassName
=
com.mysql.cj.jdbc.Driver
# UTC has 8 hour
jdbc.url
=
jdbc:mysql://127.0.0.1:3306/
jforum
?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&useSSL=false&zeroDateTimeBehavior=convertToNull
jdbc.url
=
jdbc:mysql://127.0.0.1:3306/
discuz
?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8&useSSL=false&zeroDateTimeBehavior=convertToNull
jdbc.username
=
root
jdbc.password
=
root
jdbc.pool.init
=
1
...
...
@@ -21,6 +21,8 @@ jdbc.pool.maxActive=20
jdbc.pool.testSql
=
SELECT 'x'
# web.xml
site.domain
=
http://center.test.com
# To allowed Cross-Origin for individual MemberHomeController CTL
site.origin.admin
=
http://admin.test.com
site.defat.avtar
=
avatar
site.member.freeze
=
10
site.member.invite
=
false
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录