Expose core as member of JsonPage
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 5 Oct 2017 19:21:26 +0000 (21:21 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 5 Oct 2017 19:21:26 +0000 (21:21 +0200)
27 files changed:
src/main/kotlin/net/pterodactylus/sone/web/ajax/BookmarkAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/CreatePostAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/CreateReplyAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/DeletePostAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/DeleteProfileFieldAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/DeleteReplyAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/DistrustAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/EditAlbumAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/EditImageAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/FollowSoneAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/GetLikesAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/GetNotificationsAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/GetPostAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/GetReplyAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/GetTimesAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/JsonPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/LikeAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/LockSoneAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/MarkAsKnownAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/MoveProfileFieldAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/TrustAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/UnbookmarkAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/UnfollowSoneAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/UnlikeAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/UnlockSoneAjaxPage.kt
src/main/kotlin/net/pterodactylus/sone/web/ajax/UntrustAjaxPage.kt

index fd22f06..f7d3cc7 100644 (file)
@@ -15,8 +15,8 @@ class BookmarkAjaxPage(webInterface: WebInterface) : JsonPage("bookmark.ajax", w
 
        override fun createJsonObject(request: FreenetRequest) =
                        request.parameters["post"].emptyToNull
-                                       ?.let(webInterface.core::getPost)
-                                       ?.also(webInterface.core::bookmarkPost)
+                                       ?.let(core::getPost)
+                                       ?.also(core::bookmarkPost)
                                        ?.let { createSuccessJsonObject() }
                                        ?: createErrorJsonObject("invalid-post-id")
 
index 9e96e69..ec65b55 100644 (file)
@@ -18,9 +18,9 @@ class CreatePostAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("createP
                        request.parameters["text"].emptyToNull
                                        ?.let { TextFilter.filter(request.headers["Host"], it) }
                                        ?.let { text ->
-                                               val sender = request.parameters["sender"].emptyToNull?.let(webInterface.core::getSone)?.orNull() ?: currentSone
-                                               val recipient = request.parameters["recipient"].let(webInterface.core::getSone)
-                                               webInterface.core.createPost(sender, recipient, text).let { post ->
+                                               val sender = request.parameters["sender"].emptyToNull?.let(core::getSone)?.orNull() ?: currentSone
+                                               val recipient = request.parameters["recipient"].let(core::getSone)
+                                               core.createPost(sender, recipient, text).let { post ->
                                                        createSuccessJsonObject().apply {
                                                                put("postId", post.id)
                                                                put("sone", sender.id)
index c8f9317..f817e28 100644 (file)
@@ -16,11 +16,11 @@ class CreateReplyAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("create
 
        override fun createJsonObject(currentSone: Sone, request: FreenetRequest): JsonReturnObject =
                        request.parameters["post"].emptyToNull
-                                       ?.let(webInterface.core::getPost)
+                                       ?.let(core::getPost)
                                        ?.let { post ->
                                                val text = TextFilter.filter(request.headers["Host"], request.parameters["text"])
-                                               val sender = request.parameters["sender"].let(webInterface.core::getLocalSone) ?: currentSone
-                                               val reply = webInterface.core.createReply(sender, post, text)
+                                               val sender = request.parameters["sender"].let(core::getLocalSone) ?: currentSone
+                                               val reply = core.createReply(sender, post, text)
                                                createSuccessJsonObject().apply {
                                                        put("reply", reply.id)
                                                        put("sone", sender.id)
index 74fd796..76d867e 100644 (file)
@@ -14,11 +14,11 @@ class DeletePostAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("deleteP
 
        override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
                        request.parameters["post"]
-                                       .let(webInterface.core::getPost)
+                                       .let(core::getPost)
                                        ?.let { post ->
                                                post.sone.isLocal.ifTrue {
                                                        createSuccessJsonObject().also {
-                                                               webInterface.core.deletePost(post)
+                                                               core.deletePost(post)
                                                        }
                                                } ?: createErrorJsonObject("not-authorized")
                                        } ?: createErrorJsonObject("invalid-post-id")
index 9595a8c..05f53da 100644 (file)
@@ -18,7 +18,7 @@ class DeleteProfileFieldAjaxPage(webInterface: WebInterface) : LoggedInJsonPage(
                                                        createSuccessJsonObject().also {
                                                                profile.removeField(field)
                                                                currentSone.profile = profile
-                                                               webInterface.core.touchConfiguration()
+                                                               core.touchConfiguration()
                                                        }
                                                } ?: createErrorJsonObject("invalid-field-id")
                        }
index 010e02b..2108daf 100644 (file)
@@ -14,11 +14,11 @@ class DeleteReplyAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("delete
 
        override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
                        request.parameters["reply"]
-                                       .let(webInterface.core::getPostReply)
+                                       .let(core::getPostReply)
                                        ?.let { reply ->
                                                reply.sone.isLocal.ifTrue {
                                                        createSuccessJsonObject().also {
-                                                               webInterface.core.deleteReply(reply)
+                                                               core.deleteReply(reply)
                                                        }
                                                } ?: createErrorJsonObject("not-authorized")
                                        } ?: createErrorJsonObject("invalid-reply-id")
index 1c3506b..e4f8435 100644 (file)
@@ -16,12 +16,12 @@ class DistrustAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("distrustS
 
        override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
                        request.parameters["sone"]
-                                       .let(webInterface.core::getSone)
+                                       .let(core::getSone)
                                        ?.let { sone ->
                                                createSuccessJsonObject()
-                                                               .put("trustValue", webInterface.core.preferences.negativeTrust)
+                                                               .put("trustValue", core.preferences.negativeTrust)
                                                                .also {
-                                                                       webInterface.core.distrustSone(currentSone, sone)
+                                                                       core.distrustSone(currentSone, sone)
                                                                }
                                        } ?: createErrorJsonObject("invalid-sone-id")
 
index cf12b33..321ee7d 100644 (file)
@@ -14,7 +14,7 @@ class EditAlbumAjaxPage(webInterface: WebInterface) : JsonPage("editAlbum.ajax",
 
        override fun createJsonObject(request: FreenetRequest) =
                        request.parameters["album"]!!
-                                       .let(webInterface.core::getAlbum)
+                                       .let(core::getAlbum)
                                        ?.let { album ->
                                                album.sone.isLocal.ifTrue {
                                                        when {
index ee2cf19..dbeb2d2 100644 (file)
@@ -21,19 +21,19 @@ class EditImageAjaxPage(webInterface: WebInterface,
 
        override fun createJsonObject(request: FreenetRequest) =
                        request.parameters["image"]
-                                       .let(webInterface.core::getImage)
+                                       .let(core::getImage)
                                        ?.let { image ->
                                                image.sone.isLocal.ifTrue {
                                                        when {
                                                                request.parameters["moveLeft"] == "true" -> createSuccessJsonObject().apply {
                                                                        put("sourceImageId", image.id)
                                                                        put("destinationImageId", image.album.moveImageUp(image).id)
-                                                                       webInterface.core.touchConfiguration()
+                                                                       core.touchConfiguration()
                                                                }
                                                                request.parameters["moveRight"] == "true" -> createSuccessJsonObject().apply {
                                                                        put("sourceImageId", image.id)
                                                                        put("destinationImageId", image.album.moveImageDown(image).id)
-                                                                       webInterface.core.touchConfiguration()
+                                                                       core.touchConfiguration()
                                                                }
                                                                else -> request.parameters["title"]!!.let { title ->
                                                                        title.trim().isNotBlank().ifTrue {
@@ -52,7 +52,7 @@ class EditImageAjaxPage(webInterface: WebInterface,
                                                                                                                        }
                                                                                                                }
                                                                                                        })
-                                                                                                       webInterface.core.touchConfiguration()
+                                                                                                       core.touchConfiguration()
                                                                                                }
                                                                                        }
                                                                                }
index b37b48a..c6aa25e 100644 (file)
@@ -14,9 +14,9 @@ class FollowSoneAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("followS
 
        override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
                        request.parameters["sone"]
-                                       .let(webInterface.core::getSone)
-                                       ?.also { webInterface.core.followSone(currentSone, it.id) }
-                                       ?.also(webInterface.core::markSoneKnown)
+                                       .let(core::getSone)
+                                       ?.also { core.followSone(currentSone, it.id) }
+                                       ?.also(core::markSoneKnown)
                                        ?.let { createSuccessJsonObject() }
                                        ?: createErrorJsonObject("invalid-sone-id")
 
index fc2142d..12e8309 100644 (file)
@@ -20,13 +20,13 @@ class GetLikesAjaxPage(webInterface: WebInterface) : JsonPage("getLikes.ajax", w
        override fun createJsonObject(request: FreenetRequest) =
                        when (request.parameters["type"]) {
                                "post" -> request.parameters["post"]
-                                               .let(webInterface.core::getPost)
-                                               ?.let(webInterface.core::getLikes)
+                                               .let(core::getPost)
+                                               ?.let(core::getLikes)
                                                ?.toReply()
                                                ?: createErrorJsonObject("invalid-post-id")
                                "reply" -> request.parameters["reply"]
-                                               .let(webInterface.core::getPostReply)
-                                               ?.let(webInterface.core::getLikes)
+                                               .let(core::getPostReply)
+                                               ?.let(core::getLikes)
                                                ?.toReply()
                                                ?: createErrorJsonObject("invalid-reply-id")
                                else -> createErrorJsonObject("invalid-type")
index d218a3d..1671d6d 100644 (file)
@@ -48,15 +48,15 @@ class GetNotificationsAjaxPage(webInterface: WebInterface) : JsonPage("getNotifi
                val mergedTemplateContext = webInterface.templateContextFactory.createTemplateContext()
                                .mergeContext(templateContext)
                                .apply {
-                                       this["core"] = webInterface.core
+                                       this["core"] = core
                                        this["currentSone"] = currentSone
-                                       this["localSones"] = webInterface.core.localSones
+                                       this["localSones"] = core.localSones
                                        this["request"] = freenetRequest
                                        this["currentVersion"] = SonePlugin.getPluginVersion()
-                                       this["hasLatestVersion"] = webInterface.core.updateChecker.hasLatestVersion()
-                                       this["latestEdition"] = webInterface.core.updateChecker.latestEdition
-                                       this["latestVersion"] = webInterface.core.updateChecker.latestVersion
-                                       this["latestVersionTime"] = webInterface.core.updateChecker.latestVersionDate
+                                       this["hasLatestVersion"] = core.updateChecker.hasLatestVersion()
+                                       this["latestEdition"] = core.updateChecker.latestEdition
+                                       this["latestVersion"] = core.updateChecker.latestVersion
+                                       this["latestVersionTime"] = core.updateChecker.latestVersionDate
                                        this["notification"] = this@render
                                }
                it.also { render(mergedTemplateContext, it) }
index eb8d8a0..2b1deca 100644 (file)
@@ -19,7 +19,7 @@ class GetPostAjaxPage(webInterface: WebInterface, private val postTemplate: Temp
 
        override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
                        request.parameters["post"]
-                                       .let(webInterface.core::getPost)
+                                       .let(core::getPost)
                                        .let { post ->
                                                createSuccessJsonObject().
                                                                put("post", jsonObject(
@@ -33,11 +33,11 @@ class GetPostAjaxPage(webInterface: WebInterface, private val postTemplate: Temp
 
        private fun Post.render(currentSone: Sone, request: FreenetRequest) =
                        webInterface.templateContextFactory.createTemplateContext().apply {
-                               set("core", webInterface.core)
+                               set("core", core)
                                set("request", request)
                                set("post", this@render)
                                set("currentSone", currentSone)
-                               set("localSones", webInterface.core.localSones)
+                               set("localSones", core.localSones)
                        }.let { postTemplate.render(it) }
 
 }
index a9709e8..332ab87 100644 (file)
@@ -19,7 +19,7 @@ class GetReplyAjaxPage(webInterface: WebInterface, private val template: Templat
 
        override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
                        request.parameters["reply"]
-                                       .let(webInterface.core::getPostReply)
+                                       .let(core::getPostReply)
                                        ?.let { it.toJson(currentSone, request) }
                                        ?.let { replyJson ->
                                                createSuccessJsonObject().apply {
@@ -37,7 +37,7 @@ class GetReplyAjaxPage(webInterface: WebInterface, private val template: Templat
 
        private fun PostReply.render(currentSone: Sone, request: FreenetRequest) =
                        webInterface.templateContextFactory.createTemplateContext().apply {
-                               set("core", webInterface.core)
+                               set("core", core)
                                set("request", request)
                                set("reply", this@render)
                                set("currentSone", currentSone)
index e2642c9..696c65a 100644 (file)
@@ -64,8 +64,8 @@ class GetStatusAjaxPage(webInterface: WebInterface, private val elementLoader: E
                        put("name", SoneAccessor.getNiceName(sone))
                        put("local", sone.isLocal)
                        put("status", sone.status.name)
-                       put("modified", webInterface.core.isModifiedSone(sone))
-                       put("locked", webInterface.core.isLocked(sone))
+                       put("modified", core.isModifiedSone(sone))
+                       put("locked", core.isLocked(sone))
                        put("lastUpdatedUnknown", sone.time == 0L)
                        synchronized(dateFormatter) {
                                put("lastUpdated", dateFormatter.format(sone.time))
index 9310786..87eafc3 100644 (file)
@@ -27,8 +27,8 @@ class GetTimesAjaxPage(webInterface: WebInterface,
 
        override fun createJsonObject(request: FreenetRequest) =
                        createSuccessJsonObject().apply {
-                               put("postTimes", request.parameters["posts"]!!.idsToJson { webInterface.core.getPost(it)?.let { it.id to it.time } })
-                               put("replyTimes", request.parameters["replies"]!!.idsToJson { webInterface.core.getPostReply(it)?.let { it.id to it.time } })
+                               put("postTimes", request.parameters["posts"]!!.idsToJson { core.getPost(it)?.let { it.id to it.time } })
+                               put("replyTimes", request.parameters["replies"]!!.idsToJson { core.getPostReply(it)?.let { it.id to it.time } })
                        }
 
        private fun String.idsToJson(transform: (String) -> Pair<String, Long>?) =
index 6ba842f..1136616 100644 (file)
@@ -19,6 +19,7 @@ abstract class JsonPage(private val path: String, protected val webInterface: We
 
        private val objectMapper = ObjectMapper()
        private val sessionProvider: SessionProvider = webInterface
+       protected val core = webInterface.core
 
        override fun getPath() = path
        override fun isPrefixPage() = false
@@ -34,7 +35,7 @@ abstract class JsonPage(private val path: String, protected val webInterface: We
                        sessionProvider.getCurrentSone(toadletContext, createSession)
 
        override fun handleRequest(request: FreenetRequest, response: Response): Response {
-               if (webInterface.core.preferences.isRequireFullAccess && !request.toadletContext.isAllowedFullAccess) {
+               if (core.preferences.isRequireFullAccess && !request.toadletContext.isAllowedFullAccess) {
                        return response.setStatusCode(403).setStatusText("Forbidden").setContentType("application/json").write(createErrorJsonObject("auth-required").asJsonString())
                }
                if (needsFormPassword() && request.parameters["formPassword"] != webInterface.formPassword) {
index 3b206c8..4257725 100644 (file)
@@ -14,15 +14,15 @@ class LikeAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("like.ajax", w
        override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
                        when (request.parameters["type"]) {
                                "post" -> request.parameters["post"]
-                                               .let(webInterface.core::getPost)
+                                               .let(core::getPost)
                                                ?.let { currentSone.addLikedPostId(it.id) }
-                                               ?.also { webInterface.core.touchConfiguration() }
+                                               ?.also { core.touchConfiguration() }
                                                ?.let { createSuccessJsonObject() }
                                                ?: createErrorJsonObject("invalid-post-id")
                                "reply" -> request.parameters["reply"]
-                                               .let(webInterface.core::getPostReply)
+                                               .let(core::getPostReply)
                                                ?.let { currentSone.addLikedReplyId(it.id) }
-                                               ?.also { webInterface.core.touchConfiguration() }
+                                               ?.also { core.touchConfiguration() }
                                                ?.let { createSuccessJsonObject() }
                                                ?: createErrorJsonObject("invalid-reply-id")
                                else -> createErrorJsonObject("invalid-type")
index add66b5..7b3a9b2 100644 (file)
@@ -13,8 +13,8 @@ class LockSoneAjaxPage(webInterface: WebInterface) : JsonPage("lockSone.ajax", w
 
        override fun createJsonObject(request: FreenetRequest) =
                        request.parameters["sone"]
-                                       .let(webInterface.core::getLocalSone)
-                                       ?.let(webInterface.core::lockSone)
+                                       .let(core::getLocalSone)
+                                       ?.let(core::lockSone)
                                        ?.let { createSuccessJsonObject() }
                                        ?: createErrorJsonObject("invalid-sone-id")
 
index beec718..8053591 100644 (file)
@@ -15,9 +15,9 @@ class MarkAsKnownAjaxPage(webInterface: WebInterface) : JsonPage("markAsKnown.aj
        override fun requiresLogin() = false
 
        override fun createJsonObject(request: FreenetRequest) = when (request.parameters["type"]) {
-               "sone" -> processIds(request, webInterface.core::getSone, webInterface.core::markSoneKnown)
-               "post" -> processIds(request, webInterface.core::getPost, webInterface.core::markPostKnown)
-               "reply" -> processIds(request, webInterface.core::getPostReply, webInterface.core::markReplyKnown)
+               "sone" -> processIds(request, core::getSone, core::markSoneKnown)
+               "post" -> processIds(request, core::getPost, core::markPostKnown)
+               "reply" -> processIds(request, core::getPostReply, core::markReplyKnown)
                else -> createErrorJsonObject("invalid-type")
        }
 
index e2b039b..1c050bf 100644 (file)
@@ -31,7 +31,7 @@ class MoveProfileFieldAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("m
                                        else -> null
                                }?.let {
                                        currentSone.profile = profile
-                                       webInterface.core.touchConfiguration()
+                                       core.touchConfiguration()
                                        createSuccessJsonObject()
                                } ?: createErrorJsonObject("invalid-direction")
                        } catch (e: IllegalArgumentException) {
index 228a0b5..9a01af8 100644 (file)
@@ -15,9 +15,9 @@ class TrustAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("trustSone.aj
 
        override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
                        request.parameters["sone"]
-                                       .let(webInterface.core::getSone)
-                                       ?.let { webInterface.core.trustSone(currentSone, it) }
-                                       ?.let { createSuccessJsonObject().put("trustValue", webInterface.core.preferences.positiveTrust) }
+                                       .let(core::getSone)
+                                       ?.let { core.trustSone(currentSone, it) }
+                                       ?.let { createSuccessJsonObject().put("trustValue", core.preferences.positiveTrust) }
                                        ?: createErrorJsonObject("invalid-sone-id")
 
 }
index 09a9a88..11b3bbf 100644 (file)
@@ -15,8 +15,8 @@ class UnbookmarkAjaxPage(webInterface: WebInterface) : JsonPage("unbookmark.ajax
 
        override fun createJsonObject(request: FreenetRequest) =
                        request.parameters["post"]
-                                       ?.let(webInterface.core::getPost)
-                                       ?.also(webInterface.core::unbookmarkPost)
+                                       ?.let(core::getPost)
+                                       ?.also(core::unbookmarkPost)
                                        ?.let { createSuccessJsonObject() }
                                        ?: createErrorJsonObject("invalid-post-id")
 
index 229765d..6889d04 100644 (file)
@@ -12,8 +12,8 @@ class UnfollowSoneAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("unfol
 
        override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
                        request.parameters["sone"]
-                                       ?.takeIf { webInterface.core.getSone(it).isPresent }
-                                       ?.also { webInterface.core.unfollowSone(currentSone, it) }
+                                       ?.takeIf { core.getSone(it).isPresent }
+                                       ?.also { core.unfollowSone(currentSone, it) }
                                        ?.let { createSuccessJsonObject() }
                                        ?: createErrorJsonObject("invalid-sone-id")
 
index c4ec236..b30829a 100644 (file)
@@ -20,7 +20,7 @@ class UnlikeAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("unlike.ajax
        private fun FreenetRequest.processEntity(entity: String, likeRemover: (String) -> Unit) =
                        parameters[entity].emptyToNull
                                        ?.also(likeRemover)
-                                       ?.also { webInterface.core.touchConfiguration() }
+                                       ?.also { core.touchConfiguration() }
                                        ?.let { createSuccessJsonObject() }
                                        ?: createErrorJsonObject("invalid-$entity-id")
 
index 2dffbed..18129f3 100644 (file)
@@ -13,9 +13,9 @@ class UnlockSoneAjaxPage(webInterface: WebInterface) : JsonPage("unlockSone.ajax
 
        override fun createJsonObject(request: FreenetRequest) =
                        request.parameters["sone"]
-                                       ?.let(webInterface.core::getLocalSone)
-                                       ?.also(webInterface.core::unlockSone)
-                                       ?.also { webInterface.core.touchConfiguration() }
+                                       ?.let(core::getLocalSone)
+                                       ?.also(core::unlockSone)
+                                       ?.also { core.touchConfiguration() }
                                        ?.let { createSuccessJsonObject() }
                                        ?: createErrorJsonObject("invalid-sone-id")
 
index e622554..c6274a2 100644 (file)
@@ -14,8 +14,8 @@ class UntrustAjaxPage(webInterface: WebInterface) : LoggedInJsonPage("untrustSon
 
        override fun createJsonObject(currentSone: Sone, request: FreenetRequest) =
                        request.parameters["sone"]
-                                       ?.let(webInterface.core::getSone)
-                                       ?.also { webInterface.core.untrustSone(currentSone, it) }
+                                       ?.let(core::getSone)
+                                       ?.also { core.untrustSone(currentSone, it) }
                                        ?.let { createSuccessJsonObject() }
                                        ?: createErrorJsonObject("invalid-sone-id")