Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
IEQEFCR
halo
提交
d16a1f8d
H
halo
项目概览
IEQEFCR
/
halo
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
halo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d16a1f8d
编写于
5月 06, 2019
作者:
J
johnniang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove resolved TODO tasks
上级
5271be57
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
30 addition
and
117 deletion
+30
-117
src/main/java/run/halo/app/controller/admin/api/InstallController.java
.../run/halo/app/controller/admin/api/InstallController.java
+0
-1
src/main/java/run/halo/app/handler/file/QnYunFileHandler.java
...main/java/run/halo/app/handler/file/QnYunFileHandler.java
+0
-3
src/main/java/run/halo/app/handler/file/SmmsFileHandler.java
src/main/java/run/halo/app/handler/file/SmmsFileHandler.java
+8
-11
src/main/java/run/halo/app/handler/file/UpYunFileHandler.java
...main/java/run/halo/app/handler/file/UpYunFileHandler.java
+0
-1
src/main/java/run/halo/app/handler/theme/config/ThemeConfigResolvers.java
...n/halo/app/handler/theme/config/ThemeConfigResolvers.java
+0
-72
src/main/java/run/halo/app/handler/theme/config/impl/YamlThemeConfigResolverImpl.java
...andler/theme/config/impl/YamlThemeConfigResolverImpl.java
+0
-2
src/main/java/run/halo/app/listener/StartedListener.java
src/main/java/run/halo/app/listener/StartedListener.java
+0
-1
src/main/java/run/halo/app/model/freemarker/method/RecentCommentsMethod.java
...alo/app/model/freemarker/method/RecentCommentsMethod.java
+1
-0
src/main/java/run/halo/app/model/freemarker/method/RecentPostsMethod.java
...n/halo/app/model/freemarker/method/RecentPostsMethod.java
+1
-0
src/main/java/run/halo/app/service/impl/OptionServiceImpl.java
...ain/java/run/halo/app/service/impl/OptionServiceImpl.java
+14
-16
src/main/java/run/halo/app/service/impl/RecoveryServiceImpl.java
...n/java/run/halo/app/service/impl/RecoveryServiceImpl.java
+3
-4
src/main/java/run/halo/app/service/impl/ThemeServiceImpl.java
...main/java/run/halo/app/service/impl/ThemeServiceImpl.java
+2
-2
src/main/java/run/halo/app/utils/BeanUtils.java
src/main/java/run/halo/app/utils/BeanUtils.java
+0
-1
src/main/java/run/halo/app/utils/HaloUtils.java
src/main/java/run/halo/app/utils/HaloUtils.java
+0
-1
src/main/java/run/halo/app/utils/HttpClientUtils.java
src/main/java/run/halo/app/utils/HttpClientUtils.java
+0
-1
src/test/java/run/halo/app/handler/theme/YamlThemePropertyResolverTest.java
...halo/app/handler/theme/YamlThemePropertyResolverTest.java
+1
-1
未找到文件。
src/main/java/run/halo/app/controller/admin/api/InstallController.java
浏览文件 @
d16a1f8d
...
...
@@ -78,7 +78,6 @@ public class InstallController {
@ResponseBody
@CacheLock
public
BaseResponse
<
String
>
installBlog
(
@RequestBody
@Valid
InstallParam
installParam
)
{
// TODO Install blog.
// Check is installed
boolean
isInstalled
=
optionService
.
getByPropertyOrDefault
(
PrimaryProperties
.
IS_INSTALLED
,
Boolean
.
class
,
false
);
...
...
src/main/java/run/halo/app/handler/file/QnYunFileHandler.java
浏览文件 @
d16a1f8d
...
...
@@ -59,7 +59,6 @@ public class QnYunFileHandler implements FileHandler {
String
domain
=
optionService
.
getByPropertyOfNonNull
(
QnYunProperties
.
DOMAIN
).
toString
();
String
smallUrl
=
optionService
.
getByPropertyOrDefault
(
QnYunProperties
.
SMALL_URL
,
String
.
class
,
""
);
// TODO Consider to cache the configuration
// Create configuration
Configuration
configuration
=
new
Configuration
(
zone
);
...
...
@@ -88,7 +87,6 @@ public class QnYunFileHandler implements FileHandler {
// Get upload manager
UploadManager
uploadManager
=
new
UploadManager
(
configuration
,
fileRecorder
);
// Put the file
// TODO May need to set key manually
Response
response
=
uploadManager
.
put
(
file
.
getInputStream
(),
null
,
uploadToken
,
null
,
null
);
log
.
debug
(
"QnYun response: [{}]"
,
response
.
toString
());
...
...
@@ -136,7 +134,6 @@ public class QnYunFileHandler implements FileHandler {
String
secretKey
=
optionService
.
getByPropertyOfNonNull
(
QnYunProperties
.
SECRET_KEY
).
toString
();
String
bucket
=
optionService
.
getByPropertyOfNonNull
(
QnYunProperties
.
BUCKET
).
toString
();
// TODO Consider to cache the configuration
// Create configuration
Configuration
configuration
=
new
Configuration
(
zone
);
...
...
src/main/java/run/halo/app/handler/file/SmmsFileHandler.java
浏览文件 @
d16a1f8d
package
run.halo.app.handler.file
;
import
run.halo.app.exception.FileOperationException
;
import
run.halo.app.model.enums.AttachmentType
;
import
run.halo.app.model.support.UploadResult
;
import
run.halo.app.utils.FilenameUtils
;
import
run.halo.app.utils.HttpClientUtils
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.ToString
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.http.*
;
import
org.springframework.lang.N
onNull
;
import
org.springframework.lang.N
ullable
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.Assert
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.multipart.MultipartFile
;
import
run.halo.app.exception.FileOperationException
;
import
run.halo.app.model.enums.AttachmentType
;
import
run.halo.app.model.support.UploadResult
;
import
run.halo.app.utils.FilenameUtils
;
import
run.halo.app.utils.HttpClientUtils
;
import
java.io.IOException
;
import
java.util.Objects
;
...
...
@@ -89,7 +88,7 @@ public class SmmsFileHandler implements FileHandler {
// Check error
if
(!
isResponseSuccessfully
(
smmsResponse
))
{
log
.
error
(
"Smms response detail: [{}]"
,
smmsResponse
);
throw
new
FileOperationException
(
smmsResponse
.
getMsg
()).
setErrorData
(
smmsResponse
);
throw
new
FileOperationException
(
smmsResponse
==
null
?
"Smms response is null"
:
smmsResponse
.
getMsg
()).
setErrorData
(
smmsResponse
);
}
// Get response data
...
...
@@ -149,10 +148,8 @@ public class SmmsFileHandler implements FileHandler {
* @param smmsResponse smms response must not be null
* @return true if response successfully; false otherwise
*/
private
boolean
isResponseSuccessfully
(
@NonNull
SmmsResponse
smmsResponse
)
{
Assert
.
notNull
(
smmsResponse
,
"Smms response must not be null"
);
return
smmsResponse
.
getCode
().
equals
(
SUCCESS_CODE
);
private
boolean
isResponseSuccessfully
(
@Nullable
SmmsResponse
smmsResponse
)
{
return
smmsResponse
!=
null
&&
smmsResponse
.
getCode
().
equals
(
SUCCESS_CODE
);
}
@Data
...
...
src/main/java/run/halo/app/handler/file/UpYunFileHandler.java
浏览文件 @
d16a1f8d
...
...
@@ -51,7 +51,6 @@ public class UpYunFileHandler implements FileHandler {
UpYun
upYun
=
new
UpYun
(
ossBucket
,
ossOperator
,
ossPassword
);
upYun
.
setDebug
(
log
.
isDebugEnabled
());
upYun
.
setTimeout
(
60
);
// TODO Provide a property for choosing
upYun
.
setApiDomain
(
UpYun
.
ED_AUTO
);
try
{
...
...
src/main/java/run/halo/app/handler/theme/config/ThemeConfigResolvers.java
已删除
100644 → 0
浏览文件 @
5271be57
package
run.halo.app.handler.theme.config
;
import
org.springframework.lang.NonNull
;
import
org.springframework.lang.Nullable
;
import
org.springframework.stereotype.Component
;
import
run.halo.app.handler.theme.config.impl.YamlThemeConfigResolverImpl
;
import
run.halo.app.handler.theme.config.support.Group
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* Theme configuration resolver manager.
*
* @author johnniang
* @date 4/10/19
*/
@Component
public
class
ThemeConfigResolvers
{
private
final
Map
<
ConfigType
,
ThemeConfigResolver
>
resolverMap
=
new
ConcurrentHashMap
<>(
2
);
public
ThemeConfigResolvers
()
{
resolverMap
.
put
(
ConfigType
.
YAML
,
new
YamlThemeConfigResolverImpl
());
// TODO Add another theme config resolver
}
/**
* Config type enum.
*/
public
enum
ConfigType
{
YAML
,
PROPERTY
}
/**
* Resolves the content.
*
* @param content content must not be blank
* @param type config type
* @return a list of group
* @throws IOException throws when content conversion fails
*/
public
List
<
Group
>
resolve
(
@NonNull
String
content
,
@Nullable
ConfigType
type
)
throws
IOException
{
ThemeConfigResolver
resolver
=
getResolver
(
type
);
if
(
resolver
==
null
)
{
throw
new
UnsupportedOperationException
(
"Unsupported theme config type: "
+
type
);
}
return
resolver
.
resolve
(
content
);
}
/**
* Resolves the content.
*
* @param content content must not be blank
* @return a list of group
* @throws IOException throws when content conversion fails
*/
public
List
<
Group
>
resolve
(
String
content
)
throws
IOException
{
return
resolve
(
content
,
ConfigType
.
YAML
);
}
private
ThemeConfigResolver
getResolver
(
@Nullable
ConfigType
type
)
{
return
type
==
null
?
null
:
resolverMap
.
get
(
type
);
}
}
src/main/java/run/halo/app/handler/theme/config/impl/YamlThemeConfigResolverImpl.java
浏览文件 @
d16a1f8d
...
...
@@ -172,7 +172,6 @@ public class YamlThemeConfigResolverImpl implements ThemeConfigResolver {
// Build option
Option
option
=
new
Option
();
// TODO Convert the value type
option
.
setValue
(
optionMap
.
get
(
"value"
));
option
.
setLabel
(
optionMap
.
get
(
"label"
).
toString
());
...
...
@@ -192,7 +191,6 @@ public class YamlThemeConfigResolverImpl implements ThemeConfigResolver {
Option
option
=
new
Option
();
// TODO Convert the value type
option
.
setValue
(
key
);
option
.
setLabel
(
optionMap
.
get
(
"label"
).
toString
());
...
...
src/main/java/run/halo/app/listener/StartedListener.java
浏览文件 @
d16a1f8d
...
...
@@ -58,7 +58,6 @@ public class StartedListener implements ApplicationListener<ApplicationStartedEv
String
blogUrl
=
optionService
.
getBlogBaseUrl
();
log
.
info
(
"Halo started at {}"
,
blogUrl
);
// TODO admin may be changeable
log
.
info
(
"Halo admin started at {}/admin"
,
blogUrl
);
if
(!
haloProperties
.
isDocDisabled
())
{
log
.
debug
(
"Halo doc was enable at {}/swagger-ui.html"
,
blogUrl
);
...
...
src/main/java/run/halo/app/model/freemarker/method/RecentCommentsMethod.java
浏览文件 @
d16a1f8d
...
...
@@ -12,6 +12,7 @@ import java.util.List;
* @date : 2018/12/31
*/
@Component
@Deprecated
public
class
RecentCommentsMethod
implements
TemplateMethodModelEx
{
public
RecentCommentsMethod
(
Configuration
configuration
)
{
...
...
src/main/java/run/halo/app/model/freemarker/method/RecentPostsMethod.java
浏览文件 @
d16a1f8d
...
...
@@ -12,6 +12,7 @@ import java.util.List;
* @date : 2018/12/31
*/
@Component
@Deprecated
public
class
RecentPostsMethod
implements
TemplateMethodModelEx
{
public
RecentPostsMethod
(
Configuration
configuration
)
{
...
...
src/main/java/run/halo/app/service/impl/OptionServiceImpl.java
浏览文件 @
d16a1f8d
...
...
@@ -69,20 +69,20 @@ public class OptionServiceImpl extends AbstractCrudService<Option, Integer> impl
return
;
}
// TODO Consider cache options with map
Option
option
=
optionRepository
.
findByKey
(
key
)
.
map
(
anOption
->
{
log
.
debug
(
"Updating option key: [{}], value: from [{}] to [{}]"
,
key
,
anOption
.
getValue
(),
value
);
// Exist
anOption
.
setValue
(
value
);
return
anOption
;
}).
orElseGet
(()
->
{
log
.
debug
(
"Creating option key: [{}], value: [{}]"
,
key
,
value
);
// Not exist
Option
anOption
=
new
Option
();
anOption
.
setKey
(
key
);
anOption
.
setValue
(
value
);
return
anOption
;
});
Option
option
=
optionRepository
.
findByKey
(
key
)
.
map
(
anOption
->
{
log
.
debug
(
"Updating option key: [{}], value: from [{}] to [{}]"
,
key
,
anOption
.
getValue
(),
value
);
// Exist
anOption
.
setValue
(
value
);
return
anOption
;
}).
orElseGet
(()
->
{
log
.
debug
(
"Creating option key: [{}], value: [{}]"
,
key
,
value
);
// Not exist
Option
anOption
=
new
Option
();
anOption
.
setKey
(
key
);
anOption
.
setValue
(
value
);
return
anOption
;
});
// Save or update the options
Option
savedOption
=
optionRepository
.
save
(
option
);
...
...
@@ -96,7 +96,6 @@ public class OptionServiceImpl extends AbstractCrudService<Option, Integer> impl
return
;
}
// TODO Optimize the queries
options
.
forEach
(
this
::
save
);
publishOptionUpdatedEvent
();
...
...
@@ -108,7 +107,6 @@ public class OptionServiceImpl extends AbstractCrudService<Option, Integer> impl
return
;
}
// TODO Optimize the query
optionParams
.
forEach
(
optionParam
->
save
(
optionParam
.
getKey
(),
optionParam
.
getValue
()));
publishOptionUpdatedEvent
();
...
...
src/main/java/run/halo/app/service/impl/RecoveryServiceImpl.java
浏览文件 @
d16a1f8d
...
...
@@ -92,7 +92,6 @@ public class RecoveryServiceImpl implements RecoveryService {
@Override
@Async
public
void
migrateFromV0_4_3
(
MultipartFile
file
)
{
// TODO Async execution
// Get migration content
try
{
String
migrationContent
=
FileCopyUtils
.
copyToString
(
new
InputStreamReader
(
file
.
getInputStream
()));
...
...
@@ -192,10 +191,10 @@ public class RecoveryServiceImpl implements RecoveryService {
try
{
if
(
postType
.
equalsIgnoreCase
(
"post"
))
{
//
TODO
Handle post
// Handle post
result
.
add
(
handlePost
(
post
,
postMap
));
}
else
{
//
TODO
Handle page
// Handle page
result
.
add
(
handleSheet
(
post
,
postMap
));
}
}
catch
(
Exception
e
)
{
...
...
@@ -244,7 +243,7 @@ public class RecoveryServiceImpl implements RecoveryService {
Sheet
createdSheet
=
sheetService
.
createOrUpdateBy
(
sheet
);
Object
commentsObject
=
postMap
.
get
(
"comments"
);
//
TODO
Handle comments
// Handle comments
List
<
BaseComment
>
baseComments
=
handleComment
(
commentsObject
,
createdSheet
.
getId
());
List
<
SheetComment
>
sheetComments
=
baseComments
.
stream
()
...
...
src/main/java/run/halo/app/service/impl/ThemeServiceImpl.java
浏览文件 @
d16a1f8d
...
...
@@ -47,6 +47,8 @@ import java.util.zip.ZipInputStream;
import
static
run
.
halo
.
app
.
model
.
support
.
HaloConst
.
DEFAULT_THEME_ID
;
/**
* Theme service implementation.
*
* @author ryanwang
* @date : 2019/3/26
*/
...
...
@@ -250,8 +252,6 @@ public class ThemeServiceImpl implements ThemeService {
public
List
<
Group
>
fetchConfig
(
String
themeId
)
{
Assert
.
hasText
(
themeId
,
"Theme id must not be blank"
);
// TODO Cache the config
// Get theme property
ThemeProperty
themeProperty
=
getThemeOfNonNullBy
(
themeId
);
...
...
src/main/java/run/halo/app/utils/BeanUtils.java
浏览文件 @
d16a1f8d
...
...
@@ -43,7 +43,6 @@ public class BeanUtils {
// Init the instance
try
{
// New instance for the target class
// TODO Class.newInstance() is deprecated in Java 9
T
targetInstance
=
targetClass
.
newInstance
();
// Copy properties
org
.
springframework
.
beans
.
BeanUtils
.
copyProperties
(
source
,
targetInstance
,
getNullPropertyNames
(
source
));
...
...
src/main/java/run/halo/app/utils/HaloUtils.java
浏览文件 @
d16a1f8d
...
...
@@ -118,7 +118,6 @@ public class HaloUtils {
if
(!
StringUtils
.
isBlank
(
url
))
{
return
url
;
}
// TODO Consider to UUID
return
String
.
valueOf
(
System
.
currentTimeMillis
());
}
...
...
src/main/java/run/halo/app/utils/HttpClientUtils.java
浏览文件 @
d16a1f8d
...
...
@@ -40,7 +40,6 @@ public class HttpClientUtils {
*/
@NonNull
public
static
CloseableHttpClient
createHttpsClient
(
int
timeout
)
throws
KeyStoreException
,
NoSuchAlgorithmException
,
KeyManagementException
{
// TODO Set key store in production environment
SSLContext
sslContext
=
new
SSLContextBuilder
()
.
loadTrustMaterial
(
null
,
(
certificate
,
authType
)
->
true
)
.
build
();
...
...
src/
main/java/run/halo/app/handler/theme/config/impl
/YamlThemePropertyResolverTest.java
→
src/
test/java/run/halo/app/handler/theme
/YamlThemePropertyResolverTest.java
浏览文件 @
d16a1f8d
package
run.halo.app.handler.theme
.config.impl
;
package
run.halo.app.handler.theme
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.dataformat.yaml.YAMLFactory
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录