mirror of https://github.com/usbharu/Hideout.git
parent
aa34fb0370
commit
df6d2940ed
|
@ -23,6 +23,7 @@ class GetLocalInstanceApplicationService(
|
||||||
|
|
||||||
override suspend fun internalExecute(command: Unit, principal: Principal): Instance {
|
override suspend fun internalExecute(command: Unit, principal: Principal): Instance {
|
||||||
if (cachedInstance != null) {
|
if (cachedInstance != null) {
|
||||||
|
logger.trace("Use cache {}", cachedInstance)
|
||||||
@Suppress("UnsafeCallOnNullableType")
|
@Suppress("UnsafeCallOnNullableType")
|
||||||
return cachedInstance!!
|
return cachedInstance!!
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package dev.usbharu.hideout.core.interfaces.web
|
package dev.usbharu.hideout.core.interfaces.web
|
||||||
|
|
||||||
|
import dev.usbharu.hideout.core.application.instance.GetLocalInstanceApplicationService
|
||||||
import dev.usbharu.hideout.core.config.ApplicationConfig
|
import dev.usbharu.hideout.core.config.ApplicationConfig
|
||||||
|
import dev.usbharu.hideout.core.domain.model.support.principal.Anonymous
|
||||||
import dev.usbharu.hideout.core.infrastructure.springframework.SpringSecurityFormLoginPrincipalContextHolder
|
import dev.usbharu.hideout.core.infrastructure.springframework.SpringSecurityFormLoginPrincipalContextHolder
|
||||||
import org.springframework.stereotype.Controller
|
import org.springframework.stereotype.Controller
|
||||||
import org.springframework.ui.Model
|
import org.springframework.ui.Model
|
||||||
|
@ -9,7 +11,8 @@ import org.springframework.web.bind.annotation.GetMapping
|
||||||
@Controller
|
@Controller
|
||||||
class IndexController(
|
class IndexController(
|
||||||
private val applicationConfig: ApplicationConfig,
|
private val applicationConfig: ApplicationConfig,
|
||||||
private val springSecurityFormLoginPrincipalContextHolder: SpringSecurityFormLoginPrincipalContextHolder
|
private val springSecurityFormLoginPrincipalContextHolder: SpringSecurityFormLoginPrincipalContextHolder,
|
||||||
|
private val getLocalInstanceApplicationService: GetLocalInstanceApplicationService
|
||||||
) {
|
) {
|
||||||
@GetMapping("/")
|
@GetMapping("/")
|
||||||
suspend fun index(model: Model): String {
|
suspend fun index(model: Model): String {
|
||||||
|
@ -17,7 +20,8 @@ class IndexController(
|
||||||
return "redirect:/home"
|
return "redirect:/home"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val instance = getLocalInstanceApplicationService.execute(Unit, Anonymous)
|
||||||
|
model.addAttribute("instance", instance)
|
||||||
model.addAttribute("applicationConfig", applicationConfig)
|
model.addAttribute("applicationConfig", applicationConfig)
|
||||||
return "top"
|
return "top"
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
<meta property="og:image" th:content="${image}">
|
<meta property="og:image" th:content="${image}">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1 th:text="${applicationConfig.url + ' - Hideout'}">Hideout</h1>
|
<h1 th:text="${instance.name + ' - Hideout'}">Hideout</h1>
|
||||||
<div><a href="/auth/sign_up"></a></div>
|
<div><a href="/auth/sign_up" th:unless="${applicationConfig.private}">Sign up</a> <a href="/auth/sign_in">Sign in</a>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue