mirror of https://github.com/halo-dev/halo
fix: Accessing the /install interface exposes the administrator interface address (#1908)
* Update MainController.java * Update MainController.javapull/2076/head
parent
ff782c2e6f
commit
b20ab0f1e5
|
@ -10,6 +10,7 @@ import run.halo.app.config.properties.HaloProperties;
|
||||||
import run.halo.app.exception.ServiceException;
|
import run.halo.app.exception.ServiceException;
|
||||||
import run.halo.app.model.entity.User;
|
import run.halo.app.model.entity.User;
|
||||||
import run.halo.app.model.properties.BlogProperties;
|
import run.halo.app.model.properties.BlogProperties;
|
||||||
|
import run.halo.app.model.properties.PrimaryProperties;
|
||||||
import run.halo.app.model.support.HaloConst;
|
import run.halo.app.model.support.HaloConst;
|
||||||
import run.halo.app.service.OptionService;
|
import run.halo.app.service.OptionService;
|
||||||
import run.halo.app.service.UserService;
|
import run.halo.app.service.UserService;
|
||||||
|
@ -63,10 +64,14 @@ public class MainController {
|
||||||
|
|
||||||
@GetMapping("install")
|
@GetMapping("install")
|
||||||
public void installation(HttpServletResponse response) throws IOException {
|
public void installation(HttpServletResponse response) throws IOException {
|
||||||
String installRedirectUri =
|
boolean isInstalled = optionService
|
||||||
StringUtils.appendIfMissing(this.haloProperties.getAdminPath(), "/")
|
.getByPropertyOrDefault(PrimaryProperties.IS_INSTALLED, Boolean.class, false);
|
||||||
+ INSTALL_REDIRECT_URI;
|
if (!isInstalled) {
|
||||||
response.sendRedirect(installRedirectUri);
|
String installRedirectUri =
|
||||||
|
StringUtils.appendIfMissing(this.haloProperties.getAdminPath(), "/")
|
||||||
|
+ INSTALL_REDIRECT_URI;
|
||||||
|
response.sendRedirect(installRedirectUri);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("avatar")
|
@GetMapping("avatar")
|
||||||
|
|
Loading…
Reference in New Issue