mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-12 15:24:33 -05:00
separate Global API
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package suwayomi.tachidesk.global
|
||||
|
||||
import io.javalin.Javalin
|
||||
import suwayomi.tachidesk.global.impl.About
|
||||
|
||||
/*
|
||||
* Copyright (C) Contributors to the Suwayomi project
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
object GlobalAPI {
|
||||
fun defineEndpoints(app: Javalin) {
|
||||
// returns some static info about the current app build
|
||||
app.get("/api/v1/settings/about/") { ctx ->
|
||||
ctx.json(About.getAbout())
|
||||
}
|
||||
|
||||
// TODO: app update check api
|
||||
app.get("/api/v1/settings/check-update/") { ctx ->
|
||||
ctx.json(About.getAbout())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package suwayomi.tachidesk.global.impl
|
||||
|
||||
/*
|
||||
* Copyright (C) Contributors to the Suwayomi project
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import suwayomi.server.BuildConfig
|
||||
|
||||
data class AboutDataClass(
|
||||
val name: String,
|
||||
val version: String,
|
||||
val revision: String,
|
||||
val buildType: String,
|
||||
val buildTime: Long,
|
||||
val github: String,
|
||||
val discord: String,
|
||||
)
|
||||
|
||||
object About {
|
||||
fun getAbout(): AboutDataClass {
|
||||
return AboutDataClass(
|
||||
BuildConfig.NAME,
|
||||
BuildConfig.VERSION,
|
||||
BuildConfig.REVISION,
|
||||
BuildConfig.BUILD_TYPE,
|
||||
BuildConfig.BUILD_TIME,
|
||||
BuildConfig.GITHUB,
|
||||
BuildConfig.DISCORD,
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user