Commit a5e5d64a by zhongmh

'udopate'

parent d7f9e802
......@@ -23,6 +23,11 @@ public class SiteServer implements ApplicationRunner {
@Autowired
private SystemFile systemFile;
static {
System.setProperty("http.proxyHost", "172.18.151.175");
System.setProperty("http.proxyPort", "8888");
}
public static void main(String[] args) {
SpringApplication.run(SiteServer.class, args);
}
......
......@@ -25,6 +25,10 @@ public class SiteServierMvcConfiguration implements WebMvcConfigurer {
.addResourceLocations(systemFile.getWwwDir().toURI().toString());
registry.addResourceHandler("/favicon.ico")
.addResourceLocations("classpath:/static/");
registry.addResourceHandler("/*.css")
.addResourceLocations("classpath:/static/");
registry.addResourceHandler("/*.js")
.addResourceLocations("classpath:/static/");
}
@Override
......
......@@ -36,31 +36,57 @@ public class IndexController {
UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
Developer developer = new Developer(systemFile, userDetails.getUsername());
File[] files = systemFile.getWwwDir().listFiles();
StringBuilder sb = new StringBuilder();
sb.append("<ul>");
Set<File> fileSet = new TreeSet<>(Arrays.asList(files));
boolean isRole = developer.isRole();
StringBuilder html = new StringBuilder();
html.append("<!DOCTYPE html>");
html.append("<html>");
html.append("<head>");
html.append("<meta charset=\"utf-8\">");
html.append("<meta name=\"viewport\" content=\"initial-scale=1.0, maximum-scale=1.0, user-scalable=no\" />");
html.append("<title>文档系统</title>");
html.append("<link rel=\"stylesheet\" href=\"/bootstrap.min.css\" />");
html.append("</head>");
html.append("<body>");
html.append("<table class=\"table table-hover\">");
html.append("<thead>");
html.append("<tr>");
html.append("<th>项目名称</th>");
html.append("<th>最近更新时间</th>");
if (isRole)
html.append("<th>操作</th>");
html.append("</tr>");
html.append("</thead>");
html.append("<tbody>");
Set<File> fileSet = new TreeSet<>(Arrays.asList(files));
for (File file : fileSet) {
if (isRole || developer.exitProject(file.getName())) {
sb.append("<li>").append("<a ").append("href=\'").append(file.getName())
.append("\\index.html")
.append("\'").append(">").append(file.getName()).append("</a>");
html.append("<tr>");
//项目名字
html.append("<td>").append("<button type=\"button\" class=\"btn btn-link\" url='/").append(file.getName()).append("/index.html'>").append(file.getName()).append("</button>").append("</td>");
//项目时间
html.append("<tr>");
if (isRole) {
sb.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\'")
html.append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\'")
.append("/del/").append(file.getName()).append("'>").append("delete").append("</a>");
}
sb.append("</li>");
html.append("</li>");
}
}
sb.append("</ul>");
return sb.toString();
html.append("</ul>");
return html.toString();
}
@ResponseBody
@GetMapping("del/{project}")
public void del(@PathVariable("project") String project, HttpServletResponse response) throws IOException {
logger.info("当前正在删除项目:{}",project);
systemFile.cleanFile(project);
UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
Developer developer = new Developer(systemFile, userDetails.getUsername());
boolean isRole = developer.isRole();
if (isRole) {
logger.info("当前正在删除项目:{}", project);
systemFile.cleanFile(project);
}
response.sendRedirect("/");
}
}
......@@ -36,7 +36,7 @@ public class EmailService {
public void sendLog(String applicationName, String content, String address) {
if (StringUtils.isAnyEmpty(address, content, address)) {
logger.info("当前发送参数有部为空 applicationName[{}] content[{}] address[{}]", applicationName, content, address);
logger.info("当前发送参数有部为空 applicationName[{}] content[{}] address[{}]", applicationName, content, address);
return;
}
logger.info("当前正在向[{}] 发送内容[{}]", address, content);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
package cn.boliyuan.security;
import cn.boliyuan.ApplicationTest;
import cn.yunmaozj.email.EmailService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @author zhongminghong
* @email zhongmh@yunmaozj.com
* @create 2019-10-28 16:30
*/
public class EmailServiceTest extends ApplicationTest {
@Autowired
private EmailService emailService;
@Test
public void sendEmail(){
emailService.sendLog("docs.yunmaozj.com", "你当前登录网站的密码是:","zhongmh@yunmaozj.com");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment