Sign MacOS Server JAR for Notarization (#15)

* Initial test to sign a server jar for noterization

* Update README and Build.yml

* Remove no Tachidesk jar error
This commit is contained in:
Syer10
2021-07-10 00:42:51 -04:00
committed by GitHub
parent a95f7b0402
commit 7bf2a26fe4
6 changed files with 83 additions and 36 deletions

View File

@@ -45,12 +45,12 @@ class ServerService @Inject constructor(
}
@Throws(IOException::class)
private fun copyJar(jarFile: File): Boolean {
return javaClass.getResourceAsStream("/Tachidesk.jar")?.buffered()?.use { input ->
private fun copyJar(jarFile: File) {
javaClass.getResourceAsStream("/Tachidesk.jar")?.buffered()?.use { input ->
jarFile.outputStream().use { output ->
input.copyTo(output)
}
}?.let { true } ?: false
}
}
private fun getJavaFromPath(javaPath: File): String? {
@@ -108,9 +108,7 @@ class ServerService @Inject constructor(
val jarFile = File(userDataDir, "Tachidesk.jar")
if (!jarFile.exists()) {
info { "Copying server to resources" }
if (withIOContext { !copyJar(jarFile) }) {
initialized.value = ServerResult.NO_TACHIDESK_JAR
}
withIOContext { copyJar(jarFile) }
} else {
try {
val jarVersion = withIOContext {
@@ -121,9 +119,7 @@ class ServerService @Inject constructor(
if (jarVersion != BuildConfig.TACHIDESK_SP_VERSION) {
info { "Updating server file from resources" }
if (withIOContext { !copyJar(jarFile) }) {
initialized.value = ServerResult.NO_TACHIDESK_JAR
}
withIOContext { copyJar(jarFile) }
}
} catch (e: IOException) {
error(e) {

View File

@@ -139,16 +139,10 @@ fun main() {
ServerResult.STARTED, ServerResult.UNUSED -> {
MainMenu(rootBundle)
}
ServerResult.STARTING, ServerResult.FAILED, ServerResult.NO_TACHIDESK_JAR -> {
ServerResult.STARTING, ServerResult.FAILED -> {
LoadingScreen(
initialized == ServerResult.STARTING,
errorMessage = stringResource(
if (initialized == ServerResult.NO_TACHIDESK_JAR) {
"tachidesk_doesnt_exist"
} else {
"unable_to_start_server"
}
),
errorMessage = stringResource("unable_to_start_server"),
retryMessage = stringResource("action_start_anyway"),
retry = serverService::startAnyway
)

View File

@@ -9,7 +9,6 @@
<string name="app_name">TachideskJUI</string>
<!-- Main Menu -->
<string name="tachidesk_doesnt_exist">Tachidesk JAR does not exist, run Tachidesk yourself</string>
<string name="unable_to_start_server">Cannot start server</string>
<!-- Actions -->