-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
53 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
server/src/main/kotlin/suwayomi/tachidesk/graphql/queries/InfoQuery.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package suwayomi.tachidesk.graphql.queries | ||
|
||
import suwayomi.tachidesk.global.impl.AppUpdate | ||
import suwayomi.tachidesk.server.BuildConfig | ||
import suwayomi.tachidesk.server.JavalinSetup.future | ||
import java.util.concurrent.CompletableFuture | ||
|
||
class InfoQuery { | ||
data class AboutPayload( | ||
val name: String, | ||
val version: String, | ||
val revision: String, | ||
val buildType: String, | ||
val buildTime: Long, | ||
val github: String, | ||
val discord: String | ||
) | ||
|
||
fun about(): AboutPayload { | ||
return AboutPayload( | ||
BuildConfig.NAME, | ||
BuildConfig.VERSION, | ||
BuildConfig.REVISION, | ||
BuildConfig.BUILD_TYPE, | ||
BuildConfig.BUILD_TIME, | ||
BuildConfig.GITHUB, | ||
BuildConfig.DISCORD | ||
) | ||
} | ||
|
||
data class CheckForUpdatesPayload( | ||
/** [channel] mirrors [suwayomi.tachidesk.server.BuildConfig.BUILD_TYPE] */ | ||
val channel: String, | ||
val tag: String, | ||
val url: String | ||
) | ||
|
||
fun checkForUpdates(): CompletableFuture<List<CheckForUpdatesPayload>> { | ||
return future { | ||
AppUpdate.checkUpdate().map { | ||
CheckForUpdatesPayload( | ||
channel = it.channel, | ||
tag = it.tag, | ||
url = it.url | ||
) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters