feat: remove halo prefix for admin path.

pull/398/head
ruibaby 2019-11-22 12:31:14 +08:00
parent ede23329d5
commit c1292438ea
4 changed files with 14 additions and 13 deletions

View File

@ -80,7 +80,7 @@ public class SwaggerConfiguration {
log.debug("Doc has been disabled"); log.debug("Doc has been disabled");
} }
return buildApiDocket("run.halo.app.admin", return buildApiDocket("run.halo.app.admin.api",
"run.halo.app.controller.admin", "run.halo.app.controller.admin",
"/api/admin/**") "/api/admin/**")
.securitySchemes(adminApiKeys()) .securitySchemes(adminApiKeys())
@ -171,7 +171,9 @@ public class SwaggerConfiguration {
.description("Documentation for Halo API") .description("Documentation for Halo API")
.version(HALO_VERSION) .version(HALO_VERSION)
.termsOfServiceUrl("https://github.com/halo-dev") .termsOfServiceUrl("https://github.com/halo-dev")
.contact(new Contact("RYAN0UP", "https://ryanc.cc/", "i#ryanc.cc")) .contact(new Contact("halo-dev", "https://github.com/halo-dev/halo/issues", "i#ryanc.cc"))
.license("GNU General Public License v3.0")
.licenseUrl("https://github.com/halo-dev/halo/blob/master/LICENSE")
.build(); .build();
} }

View File

@ -92,7 +92,7 @@ public class WebMvcAutoConfiguration implements WebMvcConfigurer {
.addResourceLocations(workDir + "upload/"); .addResourceLocations(workDir + "upload/");
registry.addResourceHandler(haloProperties.getBackupUrlPrefix() + "/**") registry.addResourceHandler(haloProperties.getBackupUrlPrefix() + "/**")
.addResourceLocations(workDir + "backup/", backupDir); .addResourceLocations(workDir + "backup/", backupDir);
registry.addResourceHandler("/halo" + haloProperties.getAdminPath() + "/**") registry.addResourceHandler(haloProperties.getAdminPath() + "/**")
.addResourceLocations(workDir + HALO_ADMIN_RELATIVE_PATH) .addResourceLocations(workDir + HALO_ADMIN_RELATIVE_PATH)
.addResourceLocations("classpath:/admin/"); .addResourceLocations("classpath:/admin/");

View File

@ -37,24 +37,23 @@ public class MainController {
this.haloProperties = haloProperties; this.haloProperties = haloProperties;
} }
@GetMapping("/halo/{permlink}") @GetMapping("{permlink}")
@Deprecated
public String admin(@PathVariable(name = "permlink") String permlink) { public String admin(@PathVariable(name = "permlink") String permlink) {
return "redirect:/halo/" + permlink + "/index.html"; return "redirect:/" + permlink + "/index.html";
} }
@GetMapping("/halo/version") @GetMapping("version")
@ResponseBody @ResponseBody
public String version() { public String version() {
return HaloConst.HALO_VERSION; return HaloConst.HALO_VERSION;
} }
@GetMapping("/install") @GetMapping("install")
public String installation() { public String installation() {
return "redirect:/halo" + haloProperties.getAdminPath() + "/index.html#install"; return "redirect:" + haloProperties.getAdminPath() + "/index.html#install";
} }
@GetMapping("/avatar") @GetMapping("avatar")
public void avatar(HttpServletResponse response) throws IOException { public void avatar(HttpServletResponse response) throws IOException {
User user = userService.getCurrentUser().orElseThrow(() -> new ServiceException("未查询到博主信息")); User user = userService.getCurrentUser().orElseThrow(() -> new ServiceException("未查询到博主信息"));
if (StringUtils.isNotEmpty(user.getAvatar())) { if (StringUtils.isNotEmpty(user.getAvatar())) {
@ -62,7 +61,7 @@ public class MainController {
} }
} }
@GetMapping("/logo") @GetMapping("logo")
public void logo(HttpServletResponse response) throws IOException { public void logo(HttpServletResponse response) throws IOException {
String blogLogo = optionService.getByProperty(BlogProperties.BLOG_LOGO).orElse("").toString(); String blogLogo = optionService.getByProperty(BlogProperties.BLOG_LOGO).orElse("").toString();
if (StringUtils.isNotEmpty(blogLogo)) { if (StringUtils.isNotEmpty(blogLogo)) {
@ -70,7 +69,7 @@ public class MainController {
} }
} }
@GetMapping("/favicon.ico") @GetMapping("favicon.ico")
public void favicon(HttpServletResponse response) throws IOException { public void favicon(HttpServletResponse response) throws IOException {
String favicon = optionService.getByProperty(BlogProperties.BLOG_FAVICON).orElse("").toString(); String favicon = optionService.getByProperty(BlogProperties.BLOG_FAVICON).orElse("").toString();
if (StringUtils.isNotEmpty(favicon)) { if (StringUtils.isNotEmpty(favicon)) {

View File

@ -52,7 +52,7 @@ public class StartedListener implements ApplicationListener<ApplicationStartedEv
String blogUrl = optionService.getBlogBaseUrl(); String blogUrl = optionService.getBlogBaseUrl();
log.info("Halo started at {}", blogUrl); log.info("Halo started at {}", blogUrl);
log.info("Halo admin started at {}/halo{}", blogUrl, haloProperties.getAdminPath()); log.info("Halo admin started at {}{}", blogUrl, haloProperties.getAdminPath());
if (!haloProperties.isDocDisabled()) { if (!haloProperties.isDocDisabled()) {
log.debug("Halo doc was enable at {}/swagger-ui.html", blogUrl); log.debug("Halo doc was enable at {}/swagger-ui.html", blogUrl);
} }