X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FGetStatusAjaxPage.kt;h=853fe26d136058c689175897fccdf412151377e1;hb=2ee758b50d597bfd1ec01db720e5b050027c80ea;hp=05a69d7b57b68e65e62014720deb5c3ab7b463af;hpb=a979c29be02a3b18e7c2104f3f7b780fea9c6f13;p=Sone.git diff --git a/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.kt b/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.kt index 05a69d7..853fe26 100644 --- a/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.kt +++ b/src/main/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.kt @@ -16,18 +16,21 @@ import net.pterodactylus.sone.utils.toArray import net.pterodactylus.sone.web.WebInterface import net.pterodactylus.sone.web.page.FreenetRequest import java.text.SimpleDateFormat +import java.util.TimeZone /** * The “get status” AJAX handler returns all information that is necessary to * update the web interface in real-time. */ -class GetStatusAjaxPage(webInterface: WebInterface, private val elementLoader: ElementLoader, private val timeTextConverter: TimeTextConverter, private val l10nFilter: L10nFilter): +class GetStatusAjaxPage(webInterface: WebInterface, private val elementLoader: ElementLoader, private val timeTextConverter: TimeTextConverter, private val l10nFilter: L10nFilter, timeZone: TimeZone = TimeZone.getDefault()): JsonPage("getStatus.ajax", webInterface) { - private val dateFormatter = SimpleDateFormat("MMM d, yyyy, HH:mm:ss") + private val dateFormatter = SimpleDateFormat("MMM d, yyyy, HH:mm:ss").apply { + this.timeZone = timeZone + } override fun createJsonObject(request: FreenetRequest) = - (webInterface.getCurrentSoneWithoutCreatingSession(request.toadletContext) as Sone?).let { currentSone -> + webInterface.getCurrentSoneWithoutCreatingSession(request.toadletContext).let { currentSone -> createSuccessJsonObject().apply { this["loggedIn"] = currentSone != null this["options"] = currentSone?.options?.toJsonOptions() ?: jsonObject {}