Add version api for halo application

pull/146/head
johnniang 2019-05-07 11:33:58 +08:00
parent 497aaab67f
commit e2d8792da4
4 changed files with 12 additions and 2 deletions

View File

@ -97,7 +97,7 @@ public class HaloConfiguration {
OptionService optionService) {
ContentFilter contentFilter = new ContentFilter(haloProperties, optionService);
contentFilter.setFailureHandler(new ContentAuthenticationFailureHandler());
contentFilter.addExcludeUrlPatterns("/api/*", "/install", "/admin/*", "/js/*", "/css/*");
contentFilter.addExcludeUrlPatterns("/api/*", "/install", "/version", "/admin/*", "/js/*", "/css/*");
FilterRegistrationBean<ContentFilter> contentFrb = new FilterRegistrationBean<>();
contentFrb.addUrlPatterns("/*");

View File

@ -66,4 +66,5 @@ public class AdminController {
public AuthToken refresh(@PathVariable("refreshToken") String refreshToken) {
return adminService.refreshToken(refreshToken);
}
}

View File

@ -1,7 +1,9 @@
package run.halo.app.controller.content.api;
package run.halo.app.controller.content;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import run.halo.app.model.support.HaloConst;
/**
* Admin page.
@ -22,4 +24,10 @@ public class MainController {
public String installation() {
return "redirect:/admin/index.html#install";
}
@GetMapping("/version")
@ResponseBody
public String version() {
return HaloConst.HALO_VERSION;
}
}

View File

@ -76,6 +76,7 @@ public class HaloConst {
public static String USER_SESSION_KEY = "user_session";
static {
// Set version
HALO_VERSION = HaloConst.class.getPackage().getImplementationVersion();
}
}