fix: Accessing the /install interface exposes the administrator interface address (#1908)

* Update MainController.java

* Update MainController.java
pull/2076/head
Ljfanny 2022-05-05 15:26:36 +08:00 committed by GitHub
parent ff782c2e6f
commit b20ab0f1e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 4 deletions

View File

@ -10,6 +10,7 @@ import run.halo.app.config.properties.HaloProperties;
import run.halo.app.exception.ServiceException;
import run.halo.app.model.entity.User;
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.service.OptionService;
import run.halo.app.service.UserService;
@ -63,10 +64,14 @@ public class MainController {
@GetMapping("install")
public void installation(HttpServletResponse response) throws IOException {
String installRedirectUri =
StringUtils.appendIfMissing(this.haloProperties.getAdminPath(), "/")
+ INSTALL_REDIRECT_URI;
response.sendRedirect(installRedirectUri);
boolean isInstalled = optionService
.getByPropertyOrDefault(PrimaryProperties.IS_INSTALLED, Boolean.class, false);
if (!isInstalled) {
String installRedirectUri =
StringUtils.appendIfMissing(this.haloProperties.getAdminPath(), "/")
+ INSTALL_REDIRECT_URI;
response.sendRedirect(installRedirectUri);
}
}
@GetMapping("avatar")