Skip to content

Commit

Permalink
1.0.74 (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
acharneski authored May 25, 2024
1 parent de7ffb8 commit 2870c5e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Gradle Releases -> https://github.com/gradle/gradle/releases
libraryGroup = com.simiacryptus.skyenet
libraryVersion = 1.0.73
libraryVersion = 1.0.74
gradleVersion = 7.6.1
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ abstract class ApplicationServer(
open val description: String = ""
open val singleInput = true
open val stickyInput = false
open val appInfo by lazy {
open val appInfo: Map<String, Any> by lazy {
mapOf(
"applicationName" to applicationName,
"singleInput" to singleInput,
Expand All @@ -40,7 +40,9 @@ abstract class ApplicationServer(

final override val dataStorage: StorageInterface by lazy { dataStorageFactory(root) }

protected open val appInfoServlet by lazy { ServletHolder("appInfo", AppInfoServlet(appInfo)) }
protected open val appInfoServlet by lazy { ServletHolder("appInfo", AppInfoServlet {
session -> sessionAppInfoMap[session] ?: appInfo
}) }
protected open val userInfo by lazy { ServletHolder("userInfo", UserInfoServlet()) }
protected open val usageServlet by lazy { ServletHolder("usage", UsageServlet()) }
protected open val fileZip by lazy { ServletHolder("fileZip", ZipServlet(dataStorage)) }
Expand Down Expand Up @@ -177,6 +179,8 @@ abstract class ApplicationServer(
fun HttpServletRequest.getCookie(name: String = AuthenticationInterface.AUTH_COOKIE) =
cookies?.find { it.name == name }?.value

val sessionAppInfoMap = mutableMapOf<String, Map<String, Any>>()

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import jakarta.servlet.http.HttpServlet
import jakarta.servlet.http.HttpServletRequest
import jakarta.servlet.http.HttpServletResponse

class AppInfoServlet<T>(val info: T) : HttpServlet() {
class AppInfoServlet<T>(val info: (String?) -> T) : HttpServlet() {
override fun doGet(req: HttpServletRequest, resp: HttpServletResponse) {
val session = req.getParameter("session")
resp.contentType = "text/json"
resp.status = HttpServletResponse.SC_OK
resp.writer.write(JsonUtil.objectMapper().writeValueAsString(info))
resp.writer.write(JsonUtil.objectMapper().writeValueAsString(info(session)))
}

}
2 changes: 1 addition & 1 deletion webui/src/main/resources/application/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ document.addEventListener('DOMContentLoaded', () => {
window.open(url, "_blank");
});

fetch('appInfo')
fetch('appInfo?session=' + sessionId)
.then(response => {
if (!response.ok) {
throw new Error('Network response was not ok');
Expand Down

0 comments on commit 2870c5e

Please sign in to comment.