Add version api endpoint (#66)

This commit is contained in:
Kolby Moroz Liebl 2021-04-29 19:17:23 -06:00 committed by GitHub
parent 1ea821584c
commit 34d8feacdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 0 deletions

View File

@ -7,8 +7,10 @@ plugins {
id("com.github.johnrengelman.shadow") version "6.1.0"
id("org.jmailen.kotlinter") version "3.3.0"
id("edu.sc.seis.launch4j") version "2.4.9"
id("de.fuerstenau.buildconfig") version "1.1.8"
}
val group = "ir.armor.tachidesk"
val TachideskVersion = "v0.3.0"
@ -215,5 +217,11 @@ tasks.named("processResources") {
mustRunAfter(":webUI:copyBuild")
}
buildConfig {
version = TachideskVersion
clsName = "BuildConfig"
packageName = group.toString()
buildConfigField("boolean", "DEBUG", project.hasProperty("debugApp").toString())
}

View File

@ -0,0 +1,6 @@
package ir.armor.tachidesk.impl
import ir.armor.tachidesk.BuildConfig
fun getVersion(): String {
return BuildConfig.VERSION
}

View File

@ -33,6 +33,7 @@ import ir.armor.tachidesk.impl.Source.getSourceList
import ir.armor.tachidesk.impl.backup.BackupFlags
import ir.armor.tachidesk.impl.backup.legacy.LegacyBackupExport.createLegacyBackup
import ir.armor.tachidesk.impl.backup.legacy.LegacyBackupImport.restoreLegacyBackup
import ir.armor.tachidesk.impl.getVersion
import ir.armor.tachidesk.server.util.openInBrowser
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@ -297,6 +298,11 @@ object JavalinSetup {
ctx.status(200)
}
// returns version of the app
app.get("/api/v1/version/") { ctx ->
ctx.json(getVersion())
}
// category modification
app.patch("/api/v1/category/:categoryId") { ctx ->
val categoryId = ctx.pathParam("categoryId").toInt()