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