Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
git test
Halo
Commits
dba3a5b1
Commit
dba3a5b1
authored
7 years ago
by
RYAN0UP_
Browse files
Options
Download
Email Patches
Plain Diff
👽
日常完善文章系统
parent
fa41bbc4
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
pom.xml
+1
-1
pom.xml
src/main/java/cc/ryanc/halo/config/MvcConfiguration.java
+4
-1
src/main/java/cc/ryanc/halo/config/MvcConfiguration.java
src/main/java/cc/ryanc/halo/util/HaloUtil.java
+42
-3
src/main/java/cc/ryanc/halo/util/HaloUtil.java
src/main/java/cc/ryanc/halo/web/controller/admin/PostController.java
+2
-0
...va/cc/ryanc/halo/web/controller/admin/PostController.java
src/main/resources/application.yaml
+1
-1
src/main/resources/application.yaml
src/main/resources/static/js/app.js
+15
-0
src/main/resources/static/js/app.js
src/main/resources/static/js/login.js
+82
-0
src/main/resources/static/js/login.js
src/main/resources/templates/admin/admin_attachment.ftl
+4
-4
src/main/resources/templates/admin/admin_attachment.ftl
src/main/resources/templates/admin/admin_login.ftl
+1
-86
src/main/resources/templates/admin/admin_login.ftl
src/main/resources/templates/admin/admin_md-editor.ftl
+16
-2
src/main/resources/templates/admin/admin_md-editor.ftl
src/main/resources/templates/admin/admin_tag.ftl
+10
-5
src/main/resources/templates/admin/admin_tag.ftl
src/main/resources/templates/common/install.ftl
+91
-0
src/main/resources/templates/common/install.ftl
with
269 additions
and
103 deletions
+269
-103
pom.xml
+
1
-
1
View file @
dba3a5b1
...
...
@@ -83,7 +83,7 @@
<!-- druid数据源 -->
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid
</artifactId>
<artifactId>
druid
-spring-boot-starter
</artifactId>
<version>
${druid.version}
</version>
</dependency>
...
...
This diff is collapsed.
Click to expand it.
src/main/java/cc/ryanc/halo/config/MvcConfiguration.java
+
4
-
1
View file @
dba3a5b1
...
...
@@ -7,7 +7,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.PropertySource
;
import
org.springframework.web.servlet.config.annotation.*
;
import
org.springframework.web.servlet.config.annotation.EnableWebMvc
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
/**
* @author : RYAN0UP
...
...
This diff is collapsed.
Click to expand it.
src/main/java/cc/ryanc/halo/util/HaloUtil.java
+
42
-
3
View file @
dba3a5b1
...
...
@@ -3,6 +3,8 @@ package cc.ryanc.halo.util;
import
cc.ryanc.halo.model.domain.Post
;
import
cc.ryanc.halo.model.dto.HaloConst
;
import
cc.ryanc.halo.model.dto.Theme
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.sun.syndication.feed.rss.Channel
;
import
com.sun.syndication.feed.rss.Content
;
import
com.sun.syndication.feed.rss.Item
;
...
...
@@ -21,6 +23,9 @@ import javax.servlet.http.HttpServletRequest;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
import
java.io.*
;
import
java.net.URI
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.security.MessageDigest
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
...
...
@@ -370,9 +375,6 @@ public class HaloUtil {
return
md5
;
}
public
static
void
main
(
String
[]
args
){
System
.
out
.
println
(
getMD5
(
"123456"
));
}
/**
* 2进制转16进制
...
...
@@ -584,4 +586,41 @@ public class HaloUtil {
// System.out.println(StringUtils.substringBetween("title","\n","\n"));
// }
// }
/**
* 访问路径获取json数据
* @param url
* @return
*/
public
static
String
getHttpResponse
(
String
enterUrl
)
{
BufferedReader
in
=
null
;
StringBuffer
result
=
null
;
try
{
URI
uri
=
new
URI
(
enterUrl
);
URL
url
=
uri
.
toURL
();
URLConnection
connection
=
url
.
openConnection
();
connection
.
setRequestProperty
(
"Content-Type"
,
"application/x-www-form-urlencoded"
);
connection
.
setRequestProperty
(
"Charset"
,
"utf-8"
);
connection
.
connect
();
result
=
new
StringBuffer
();
in
=
new
BufferedReader
(
new
InputStreamReader
(
connection
.
getInputStream
()));
String
line
;
while
((
line
=
in
.
readLine
())
!=
null
)
{
result
.
append
(
line
);
}
return
result
.
toString
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
in
!=
null
)
{
in
.
close
();
}
}
catch
(
Exception
e2
)
{
e2
.
printStackTrace
();
}
}
return
null
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/cc/ryanc/halo/web/controller/admin/PostController.java
+
2
-
0
View file @
dba3a5b1
...
...
@@ -129,7 +129,9 @@ public class PostController extends BaseController{
public
String
newPost
(
Model
model
){
try
{
List
<
Category
>
categories
=
categoryService
.
findAllCategories
();
List
<
Tag
>
tags
=
tagService
.
findAllTags
();
model
.
addAttribute
(
"categories"
,
categories
);
model
.
addAttribute
(
"tags"
,
tags
);
model
.
addAttribute
(
"btnPush"
,
"发布"
);
//设置选项
model
.
addAttribute
(
"options"
,
HaloConst
.
OPTIONS
);
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/application.yaml
+
1
-
1
View file @
dba3a5b1
...
...
@@ -5,7 +5,7 @@ spring:
type
:
com.alibaba.druid.pool.DruidDataSource
# H2database 配置
driver-class-name
:
org.h2.Driver
url
:
jdbc:h2:file:~/halo/halo
_db
url
:
jdbc:h2:file:~/halo/halo
username
:
admin
password
:
123456
h2
:
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/static/js/app.js
+
15
-
0
View file @
dba3a5b1
...
...
@@ -18,4 +18,19 @@ function showMsg(text,icon,hideAfter) {
loader
:
true
,
loaderBg
:
'
#ffffff
'
});
}
/**
* 转义
* @param str str
* @returns {string}
*/
function
stringEncode
(
str
){
var
div
=
document
.
createElement
(
'
div
'
);
if
(
div
.
innerText
){
div
.
innerText
=
str
;
}
else
{
div
.
textContent
=
str
;
}
return
div
.
innerHTML
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/resources/static/js/login.js
0 → 100644
+
82
-
0
View file @
dba3a5b1
function
btn_login
()
{
$
(
'
#btn-login
'
).
button
(
'
loading
'
);
var
name
=
$
(
"
#login-name
"
).
val
();
var
pwd
=
$
(
"
#login-pwd
"
).
val
();
if
(
name
==
""
||
pwd
==
""
){
showMsg
(
"
请输入完整信息!
"
,
"
info
"
,
2000
);
$
(
'
#btn-login
'
).
button
(
'
reset
'
);
}
else
{
$
.
ajax
({
type
:
'
POST
'
,
url
:
'
/admin/getLogin
'
,
async
:
false
,
data
:{
'
loginName
'
:
name
,
'
loginPwd
'
:
pwd
},
success
:
function
(
status
)
{
if
(
status
==
"
true
"
){
$
.
toast
({
text
:
"
登录成功!
"
,
heading
:
'
提示
'
,
icon
:
'
success
'
,
showHideTransition
:
'
fade
'
,
allowToastClose
:
true
,
hideAfter
:
1000
,
stack
:
1
,
position
:
'
top-center
'
,
textAlign
:
'
left
'
,
loader
:
true
,
loaderBg
:
'
#ffffff
'
,
afterHidden
:
function
()
{
window
.
location
.
href
=
"
/admin
"
;
}
});
}
else
if
(
status
==
"
disable
"
){
$
(
'
.login-body
'
).
addClass
(
'
animate shake
'
);
$
.
toast
({
text
:
"
密码错误已达到5次,请10分钟后再试!
"
,
heading
:
'
提示
'
,
icon
:
'
error
'
,
showHideTransition
:
'
fade
'
,
allowToastClose
:
true
,
hideAfter
:
2000
,
stack
:
1
,
position
:
'
top-center
'
,
textAlign
:
'
left
'
,
loader
:
true
,
loaderBg
:
'
#ffffff
'
,
afterHidden
:
function
()
{
$
(
'
.login-body
'
).
removeClass
(
'
animate shake
'
);
}
});
$
(
'
#btn-login
'
).
button
(
'
reset
'
);
}
else
{
$
(
'
.login-body
'
).
addClass
(
'
animate shake
'
);
$
.
toast
({
text
:
"
用户名或者密码错误!
"
,
heading
:
'
提示
'
,
icon
:
'
error
'
,
showHideTransition
:
'
fade
'
,
allowToastClose
:
true
,
hideAfter
:
2000
,
stack
:
1
,
position
:
'
top-center
'
,
textAlign
:
'
left
'
,
loader
:
true
,
loaderBg
:
'
#ffffff
'
,
afterHidden
:
function
()
{
$
(
'
.login-body
'
).
removeClass
(
'
animate shake
'
);
}
});
$
(
'
#btn-login
'
).
button
(
'
reset
'
);
}
}
});
}
}
$
(
document
).
keydown
(
function
(
event
)
{
if
(
event
.
keyCode
==
13
){
btn_login
();
}
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/resources/templates/admin/admin_attachment.ftl
+
4
-
4
View file @
dba3a5b1
...
...
@@ -49,10 +49,10 @@
第$
{
attachments
.number
+
1
}
/$
{
attachments
.totalPages
}
页
</div>
<ul class="pagination no-margin pull-right">
<li><a class="btn btn-sm <#if !attachments.hasPrevious()>disabled</#if>" href="/admin/attachments" >首页</a> </li>
<li><a class="btn btn-sm <#if !attachments.hasPrevious()>disabled</#if>" href="/admin/attachments?page=$
{
attachments
.number-1
}
" >上页</a></li>
<li><a class="btn btn-sm <#if !attachments.hasNext()>disabled</#if>" href="/admin/attachments?page=$
{
attachments
.number
+
1
}
">下页</a></li>
<li><a class="btn btn-sm <#if !attachments.hasNext()>disabled</#if>" href="/admin/attachments?page=$
{
attachments
.totalPages-1
}
">尾页</a> </li>
<li><a
data-pjax="true"
class="btn btn-sm <#if !attachments.hasPrevious()>disabled</#if>" href="/admin/attachments" >首页</a> </li>
<li><a
data-pjax="true"
class="btn btn-sm <#if !attachments.hasPrevious()>disabled</#if>" href="/admin/attachments?page=$
{
attachments
.number-1
}
" >上页</a></li>
<li><a
data-pjax="true"
class="btn btn-sm <#if !attachments.hasNext()>disabled</#if>" href="/admin/attachments?page=$
{
attachments
.number
+
1
}
">下页</a></li>
<li><a
data-pjax="true"
class="btn btn-sm <#if !attachments.hasNext()>disabled</#if>" href="/admin/attachments?page=$
{
attachments
.totalPages-1
}
">尾页</a> </li>
</ul>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/templates/admin/admin_login.ftl
+
1
-
86
View file @
dba3a5b1
...
...
@@ -44,91 +44,6 @@
<
script
src="/static/plugins/bootstrap/js/bootstrap.min.js"></script>
<
script
src="/static/plugins/toast/js/jquery.toast.min.js"></script>
<
script
src="/static/js/app.js"></script>
<
script
>
<@compress single_line=true>
function btn_login()
{
$
(
'#
btn-login
'
)
.button
(
'
loading
'
)
;
var
name
=
$
(
"#login-name"
)
.val
()
;
var
pwd
=
$
(
"#login-pwd"
)
.val
()
;
if
(
name
==
""
||
pwd
==
""
){
showMsg
(
"请输入完整信息!"
,
"info"
,
2000
)
;
$
(
'#
btn-login
'
)
.button
(
'
reset
'
)
;
}
else
{
$
.ajax
({
type
:
'
POST
'
,
url
:
'/
admin
/
getLogin
'
,
async
:
false
,
data
:{
'
loginName
'
:
name
,
'
loginPwd
'
:
pwd
},
success
:
function
(
status
)
{
if
(
status
==
"true"
){
$
.toast
({
text
:
"登录成功!"
,
heading
:
'提示'
,
icon
:
'
success
'
,
showHideTransition
:
'
fade
'
,
allowToastClose
:
true
,
hideAfter
:
1000
,
stack
:
1
,
position
:
'
top-center
'
,
textAlign
:
'
left
'
,
loader
:
true
,
loaderBg
:
'#
ffffff
'
,
afterHidden
:
function
()
{
window
.location.href
=
"/admin"
;
}
})
;
}
else
if
(
status
==
"disable"
){
$
(
'
.login-body
'
)
.addClass
(
'
animate
shake
'
)
;
$
.toast
({
text
:
"密码错误已达到5次,请10分钟后再试!"
,
heading
:
'提示'
,
icon
:
'
error
'
,
showHideTransition
:
'
fade
'
,
allowToastClose
:
true
,
hideAfter
:
2000
,
stack
:
1
,
position
:
'
top-center
'
,
textAlign
:
'
left
'
,
loader
:
true
,
loaderBg
:
'#
ffffff
'
,
afterHidden
:
function
()
{
$
(
'
.login-body
'
)
.removeClass
(
'
animate
shake
'
)
;
}
})
;
$
(
'#
btn-login
'
)
.button
(
'
reset
'
)
;
}
else
{
$
(
'
.login-body
'
)
.addClass
(
'
animate
shake
'
)
;
$
.toast
({
text
:
"用户名或者密码错误!"
,
heading
:
'提示'
,
icon
:
'
error
'
,
showHideTransition
:
'
fade
'
,
allowToastClose
:
true
,
hideAfter
:
2000
,
stack
:
1
,
position
:
'
top-center
'
,
textAlign
:
'
left
'
,
loader
:
true
,
loaderBg
:
'#
ffffff
'
,
afterHidden
:
function
()
{
$
(
'
.login-body
'
)
.removeClass
(
'
animate
shake
'
)
;
}
})
;
$
(
'#
btn-login
'
)
.button
(
'
reset
'
)
;
}
}
})
;
}
}
$(document).keydown(function (event)
{
if
(
event
.keyCode
==
13
){
btn_login
()
;
}
}
);
</@compress>
</
script
>
<
script
src="/static/js/login.js"></script>
</
html
>
</#
compress
>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/resources/templates/admin/admin_md-editor.ftl
+
16
-
2
View file @
dba3a5b1
...
...
@@ -107,7 +107,17 @@
</div>
</div>
<div class="box-body">
<input type="text" class="form-control input-lg" id="tagList" name=""/>
<input type="text" class="form-control input-lg" id="tagList" name=""/><br>
<select class="form-control" id="chooseTag" name="chooseTag">
<#if tags??>
<option value="">选择添加</option>
<#list tags as tag>
<option value="$
{
tag
.tagName
}
">$
{
tag
.tagName
}
</option>
</#list>
<#else>
<option>暂无标签</option>
</#if>
</select>
</div>
</div>
<div class="box box-primary">
...
...
@@ -148,6 +158,11 @@
</#list>
</#if>
</#if>
$('#chooseTag').change(function ()
{
$
(
'#
tagList
'
)
.tagEditor
(
'
addTag
'
,
$
(
this
)
.val
())
;
}
);
/
**
*
打开附件
*
/
...
...
@@ -227,7 +242,6 @@
*
@param status 文章状态
*
/
function push(status)
{
alert
(
$
(
'#
tagList
'
)
.tagEditor
(
'
getTags
'
)[
0
]
.tags );
var
T
itle
=
""
;
if
(
postTitle
.val
()){
T
itle
=
postTitle
.val
()
;
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/templates/admin/admin_tag.ftl
+
10
-
5
View file @
dba3a5b1
...
...
@@ -164,18 +164,23 @@
<#list tags as tag>
<div class="tag-cloud">
<a class="tag-link" data-pjax="true" href="/admin/tag/edit?tagId=$
{
tag
.tagId
}
">
<span class="label">$
{
tag
.tagName
}
(
2
)</span>
<span class="label">$
{
tag
.tagName
}
(
$
{
tag
.posts
?
size
}
)</span>
</a>
</div>
</#list>
<script>
var randomNum;
var tagLabel = $('.tag-link');
for(var i = 0; i < $
{
tags
?
size
}
; i++)
{
<#--for(var i = 0; i < $
{
tags
?
size
}
; i++)
{
-
->
<#-
-randomNum
=
M
ath
.floor
(
M
ath
.
random
()
*
15
+
1
)
;-
->
<#-
-tagLabel
.children
(
'
.label
'
)
.addClass
(
"bg-color-"
+
randomNum
)
;-
->
<#-
-tagLabel
=
tagLabel
.next
()
;-
->
<#--
}
-->
$(".label").each(function ()
{
randomNum
=
M
ath
.floor
(
M
ath
.
random
()
*
15
+
1
)
;
tagLabel
.children
(
'
.label
'
)
.addClass
(
"bg-color-"
+
randomNum
)
;
tagLabel
=
tagLabel
.next
()
;
}
$
(
this
)
.addClass
(
"bg-color-"
+
randomNum
)
;
}
);
</script>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/templates/common/install.ftl
+
91
-
0
View file @
dba3a5b1
...
...
@@ -120,6 +120,97 @@
<#else >
<div class="animated fadeInUp" style="animation-delay: 0.1s">
<h4>已经安装过了,不能重复安装的酱紫!</h4>
<pre style="font: 10px/7px monospace;border: none;">
.'+:
`+@#'##
+#.```#+
`.@` `` .# `
'+` ` @,`
+'` ``++
,#@@' ` ++ ;#
.@#'..'#`
,# .@ ``.,::;;:,,`
`#+` '@ `#` `@ `.:'##@@###+#++#@@#,
.@
`@' #' `@ ` `.;+#@@#':..` ``;: .'@#`
,@ ,@` ,@` @`.'@@##;,`` ` ., ` .## `
`# #+ #'` ##@+,.` ` + `#+
`#, ` :#` .@. `@.` . ` `,` .#:
;# `#, +#` `` ` `+';+` :` ` '#`
`@:` ++`:@@#: +`` + ' ,. ;@#``@,
` ,@` .@@#:``` .. ##.`: '` ;@@.`#@#;`+'
++ @: ` ` `.` , ,#@'`' ; #@@' +@@:`,#`
@; #: ` ,'` ,+ ..`@@``: .` ;@@:``++ .#`
`.@, :: ,, `` # +``` +` ``;`` :; ` .#`
;@. ` # `: `. `+;;+`` `+` ,@
`@@# `, @@@```' ` ` `: ;#``
`@+ ;` ` `: @@#` `;``` ` ` ;. #:
@'` +``: `.. +` ` .#`
+# ,. ` ' +.` ``#'
.@.
:'``,+ ,'.` `.#@. ``
#' ..` `;';;#`
.@`
` ``:@,``
``#+ ` '@,
@` ` `#@``
;# .'#'` `
`#: ` ` ,;` `,#@+.
`@` :;'@+#@#;`` `
`.#`` '#+#@,. `
;# @:`
#; `:@
@. #.
@. `+'
@. ;#
@. :` .@`
@. ;. ``@`
@. ;, ` `#
@, ` +. `@
+' ;: @` @
,#` +, :; `@
``@` +; ``,# .@
`#; ;#.` ``'+ ;#`
:@ ` ` '@',..,;#+. ``#;
#: ` ```:;;:.` `@`
`` :@ ` ` ;#``
`#+ @,
`@:` +#`
,#. `,@.`
` ;@.` .@:`
'@, .@;`
```@+#; ```;@@ `
` `@' ,@+` ,#@.#'
## ```+@; `,#@'. `@.
`;@ ` ,@#' ` ` ` `;+@@;` ;@` `
#: `,@@#',` ` ```.;#@@@;. ` ` @@#,
`` ;@@` ;+@@@@@@@@##'.` ,@@@#:`
`+@@@:` ` ` ```.`` ` `@::#@@'`
.#@@+++
` ,@` .+@@+.
` ` :#@@;` @, @, `+@@#.``;#@@@`
@@@@#, :@@@: ` ,# ``'#`` `'@@#@@@##@`
`;''+@@@#@:` #' .@`` ` ;@@#.
,#@@: @` @: `.@#@@'`
'@@'@. :# '# `@;`+@#``
`'#+ :@. ``#' .@ ``#+` ;' `
.,
#@`` @` @. ``:@,
`.@; .@ ++ `;`
`,` `;# :#
`#' @`
@. `@.
@` #'`
`@ ;#
,# .#
;+ `@`
#' @.
#: #:
@, `++
@` ;#`
`@` ,@
`@` `@ `
`@` `@`
`@` @`
`@` @.
`@` #: `
`@@@@@@@@@##################@@@@@@@@@@@@@@@@@@@@@@@#@@;
` `::::::::::::::::::::::::::::,:::::,,,,,,,,,,,,,,,,,:,.`
</pre>
</div>
</#if>
</div>
...
...
This diff is collapsed.
Click to expand it.
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