mirror of https://github.com/halo-dev/halo
👽 日常完善文章系统
parent
fa41bbc491
commit
dba3a5b153
2
pom.xml
2
pom.xml
|
@ -83,7 +83,7 @@
|
|||
<!-- druid数据源 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
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();
|
||||
}
|
||||
});
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
|
@ -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 Title = "";
|
||||
if(postTitle.val()){
|
||||
Title = postTitle.val();
|
||||
|
|
|
@ -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 = Math.floor(Math. random() * 15 + 1);-->
|
||||
<#--tagLabel.children('.label').addClass("bg-color-"+randomNum);-->
|
||||
<#--tagLabel = tagLabel.next();-->
|
||||
<#--}-->
|
||||
|
||||
$(".label").each(function () {
|
||||
randomNum = Math.floor(Math. random() * 15 + 1);
|
||||
tagLabel.children('.label').addClass("bg-color-"+randomNum);
|
||||
tagLabel = tagLabel.next();
|
||||
}
|
||||
$(this).addClass("bg-color-"+randomNum);
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue