mirror of https://github.com/halo-dev/halo
👽 细节修改
parent
210ae09f1e
commit
2bd40d3ec8
|
@ -10,6 +10,7 @@ import com.sun.syndication.io.FeedException;
|
||||||
import com.sun.syndication.io.WireFeedOutput;
|
import com.sun.syndication.io.WireFeedOutput;
|
||||||
import io.github.biezhi.ome.OhMyEmail;
|
import io.github.biezhi.ome.OhMyEmail;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.util.ResourceUtils;
|
import org.springframework.util.ResourceUtils;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
@ -23,7 +24,6 @@ import java.io.*;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.security.MessageDigest;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
|
@ -121,6 +121,9 @@ public class HaloUtils {
|
||||||
Theme theme = null;
|
Theme theme = null;
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
|
if (StringUtils.equals("__MACOSX", file.getName())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
theme = new Theme();
|
theme = new Theme();
|
||||||
theme.setThemeName(file.getName());
|
theme.setThemeName(file.getName());
|
||||||
File optionsPath = new File(themesPath.getAbsolutePath(), file.getName() + "/module/options.ftl");
|
File optionsPath = new File(themesPath.getAbsolutePath(), file.getName() + "/module/options.ftl");
|
||||||
|
@ -134,7 +137,7 @@ public class HaloUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("主题获取失败:{0}",e.getMessage());
|
log.error("主题获取失败:", e.getMessage());
|
||||||
}
|
}
|
||||||
return themes;
|
return themes;
|
||||||
}
|
}
|
||||||
|
@ -170,7 +173,7 @@ public class HaloUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("未知错误:{0}",e.getMessage());
|
log.error("未知错误:", e.getMessage());
|
||||||
}
|
}
|
||||||
return tpls;
|
return tpls;
|
||||||
}
|
}
|
||||||
|
@ -191,7 +194,7 @@ public class HaloUtils {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
return new String(fileContent,"UTF-8");
|
return new String(fileContent,"UTF-8");
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("读取模板文件错误:{0}",e.getMessage());
|
log.error("读取模板文件错误:", e.getMessage());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -220,14 +223,14 @@ public class HaloUtils {
|
||||||
*/
|
*/
|
||||||
public static String getIpAddr(HttpServletRequest request) {
|
public static String getIpAddr(HttpServletRequest request) {
|
||||||
String ip = request.getHeader("x-forwarded-for");
|
String ip = request.getHeader("x-forwarded-for");
|
||||||
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
ip = request.getHeader("Proxy-Client-IP");
|
ip = request.getHeader("Proxy-Client-IP");
|
||||||
}
|
}
|
||||||
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
ip = request.getHeader("WL-Proxy-Client-IP");
|
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||||
}
|
}
|
||||||
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||||
ip = request.getRemoteAddr();
|
ip = request.getRemoteAddr();
|
||||||
}
|
}
|
||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
|
|
@ -259,14 +259,14 @@ public class PostController extends BaseController{
|
||||||
* @return 重定向到/admin/posts
|
* @return 重定向到/admin/posts
|
||||||
*/
|
*/
|
||||||
@GetMapping("/throw")
|
@GetMapping("/throw")
|
||||||
public String moveToTrash(@RequestParam("postId") Long postId){
|
public String moveToTrash(@RequestParam("postId") Long postId,@RequestParam("status") Integer status){
|
||||||
try{
|
try{
|
||||||
postService.updatePostStatus(postId,2);
|
postService.updatePostStatus(postId,2);
|
||||||
log.info("编号为"+postId+"的文章已被移到回收站");
|
log.info("编号为"+postId+"的文章已被移到回收站");
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("未知错误:{0}",e.getMessage());
|
log.error("未知错误:{0}",e.getMessage());
|
||||||
}
|
}
|
||||||
return "redirect:/admin/posts";
|
return "redirect:/admin/posts?status="+status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -96,13 +96,13 @@
|
||||||
<#case 0>
|
<#case 0>
|
||||||
<a href="/archives/${post.postUrl}" class="btn btn-primary btn-xs " target="_blank">查看</a>
|
<a href="/archives/${post.postUrl}" class="btn btn-primary btn-xs " target="_blank">查看</a>
|
||||||
<a href="/admin/posts/edit?postId=${post.postId?c}" class="btn btn-info btn-xs ">编辑</a>
|
<a href="/admin/posts/edit?postId=${post.postId?c}" class="btn btn-info btn-xs ">编辑</a>
|
||||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/posts/throw?postId=${post.postId?c}','确定移到回收站?')">丢弃</button>
|
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/posts/throw?postId=${post.postId?c}&status=0','确定移到回收站?')">丢弃</button>
|
||||||
<#break >
|
<#break >
|
||||||
<#case 1>
|
<#case 1>
|
||||||
<a href="/admin/posts/edit?postId=${post.postId?c}"
|
<a href="/admin/posts/edit?postId=${post.postId?c}"
|
||||||
class="btn btn-info btn-xs ">编辑</a>
|
class="btn btn-info btn-xs ">编辑</a>
|
||||||
<button class="btn btn-primary btn-xs " onclick="modelShow('/admin/posts/revert?postId=${post.postId?c}&status=1','确定发布该文章?')">发布</button>
|
<button class="btn btn-primary btn-xs " onclick="modelShow('/admin/posts/revert?postId=${post.postId?c}&status=1','确定发布该文章?')">发布</button>
|
||||||
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/posts/throw?postId=${post.postId?c}','确定移到回收站?')">丢弃</button>
|
<button class="btn btn-danger btn-xs " onclick="modelShow('/admin/posts/throw?postId=${post.postId?c}&status=1','确定移到回收站?')">丢弃</button>
|
||||||
<#break >
|
<#break >
|
||||||
<#case 2>
|
<#case 2>
|
||||||
<a href="/admin/posts/revert?postId=${post.postId?c}&status=2" class="btn btn-primary btn-xs ">还原</a>
|
<a href="/admin/posts/revert?postId=${post.postId?c}&status=2" class="btn btn-primary btn-xs ">还原</a>
|
||||||
|
|
Loading…
Reference in New Issue