Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version api endpoint #66

Merged
merged 1 commit into from
Apr 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down Expand Up @@ -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())
}
6 changes: 6 additions & 0 deletions server/src/main/kotlin/ir/armor/tachidesk/impl/Version.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package ir.armor.tachidesk.impl
import ir.armor.tachidesk.BuildConfig

fun getVersion(): String {
return BuildConfig.VERSION
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down