diff --git a/config.properties b/config.properties
index 4e83766..d0a0446 100644
--- a/config.properties
+++ b/config.properties
@@ -1,5 +1,5 @@
#Configuration file
-#Tue Oct 28 14:18:19 WIB 2025
+#Tue Nov 25 10:00:19 WIB 2025
auto.delete.result.days=7
database.host=localhost
database.name=aas
diff --git a/html/webpage/assets/js/setting.js b/html/webpage/assets/js/setting.js
index 13c24d4..bb84398 100644
--- a/html/webpage/assets/js/setting.js
+++ b/html/webpage/assets/js/setting.js
@@ -67,10 +67,48 @@ function load_default_voice(){
});
}
+function Get_WebAccessSetting(){
+ fetchAPI("Settings/WebAccess", "GET", {}, null, (okdata) => {
+ let adminpass = okdata.adminpass || "password";
+ let viewerpass = okdata.userpass || "password";
+ $("#adminpassword1").val(adminpass);
+ $("#adminpassword2").val(adminpass);
+ $("#viewerpassword1").val(viewerpass);
+ $("#viewerpassword2").val(viewerpass);
+ }, (errdata) => {
+ alert("Error getting Web Access settings : " + errdata.message);
+ });
+}
+
+function Set_WebAccessSetting(){
+ let adminpass1 = $("#adminpassword1").val();
+ let adminpass2 = $("#adminpassword2").val();
+ let viewerpass1 = $("#viewerpassword1").val();
+ let viewerpass2 = $("#viewerpassword2").val();
+ if(adminpass1 !== adminpass2){
+ alert("Admin passwords do not match.");
+ return;
+ }
+ if(viewerpass1 !== viewerpass2){
+ alert("Viewer passwords do not match.");
+ return;
+ }
+ let data = {
+ adminpass: adminpass1,
+ viewerpass: viewerpass1
+ };
+ fetchAPI("Settings/WebAccess", "POST", {}, data, (okdata) => {
+ alert("Web Access settings updated successfully.");
+ }, (errdata) => {
+ alert("Error updating Web Access settings : " + errdata.message);
+ });
+}
+
$(document).ready(function () {
console.log("setting.js loaded");
load_default_voice();
Get_OldResultDays();
+ Get_WebAccessSetting();
load_messagebank(() => load_remark_selection());
$("#fiscodesave").off('click').on('click', function () {
Set_OldResultDays();
@@ -97,6 +135,9 @@ $(document).ready(function () {
}
});
+ $("#webaccesssave").off('click').on('click', function () {
+ Set_WebAccessSetting();
+ });
diff --git a/html/webpage/homeadmin.html b/html/webpage/homeadmin.html
new file mode 100644
index 0000000..9fdb09c
--- /dev/null
+++ b/html/webpage/homeadmin.html
@@ -0,0 +1,125 @@
+
+
+
+
+
+
+ AAS NewGeneration 17092025
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/html/webpage/homeviewer.html b/html/webpage/homeviewer.html
new file mode 100644
index 0000000..caec04f
--- /dev/null
+++ b/html/webpage/homeviewer.html
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+ AAS NewGeneration 17092025
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/html/webpage/setting.html b/html/webpage/setting.html
index 90f0449..cf4c646 100644
--- a/html/webpage/setting.html
+++ b/html/webpage/setting.html
@@ -97,6 +97,31 @@
+
+
+
+
+
Web Access Setting
+
+
+
+
+
+
diff --git a/src/Main.kt b/src/Main.kt
index b20ca8d..839176a 100644
--- a/src/Main.kt
+++ b/src/Main.kt
@@ -33,7 +33,7 @@ lateinit var audioPlayer: AudioPlayer
val StreamerOutputs: MutableMap = HashMap()
lateinit var udpreceiver: UDPReceiver
lateinit var tcpreceiver: TCPReceiver
-const val version = "0.0.15 (24/11/2025)"
+const val version = "0.0.16 (25/11/2025)"
// AAS 64 channels
const val max_channel = 64
diff --git a/src/web/WebApp.kt b/src/web/WebApp.kt
index 1263359..4a15410 100644
--- a/src/web/WebApp.kt
+++ b/src/web/WebApp.kt
@@ -53,7 +53,7 @@ import java.util.UUID
@Suppress("unused")
-class WebApp(val listenPort: Int, val userlist: List>, val _config: configFile) {
+class WebApp(val listenPort: Int, var userlist: List>, val _config: configFile) {
lateinit var app: Javalin
lateinit var semiauto: Javalin
@@ -119,11 +119,103 @@ class WebApp(val listenPort: Int, val userlist: List>, val
//it.sessionAttribute("user", user.first)
it.cookie("aas-user", user.first)
// Redirect to home page
- it.redirect("home.html")
+ if (user.first== GetAdminUserFromConfig()){
+ it.redirect("homeadmin.html")
+ } else {
+ it.redirect("homeviewer.html")
+ }
}
}
+ // home for admin user
+ path("homeadmin.html") {
+ before { CheckUsers(it) }
+ ws("/ws") { ws ->
+ // WebSocket endpoint for home
+ ws.onConnect {
+ it.enableAutomaticPings()
+ }
+ ws.onMessage { wsMessageContext ->
- path("home.html") {
+ try {
+ val cmd =
+ objectmapper.readValue(wsMessageContext.message(), WebsocketCommand::class.java)
+ when (cmd.command) {
+ "getSystemTime" -> {
+ val systemtime = LocalDateTime.now().format(datetimeformat1)
+ val uptime = GetUptime()
+ SendReply(
+ wsMessageContext,
+ cmd.command,
+ if (uptime.isNotEmpty()) "Date & Time : $systemtime\nSystem Uptime : $uptime" else "Date & Time : $systemtime"
+ )
+ }
+
+ "getCPUStatus" -> {
+ Somecodes.getCPUUsage { vv ->
+ val sv = GetSensorsInfo()
+ if (sv.isNotEmpty()) {
+ SendReply(wsMessageContext, cmd.command, vv + "\n" + sv)
+ } else {
+ SendReply(wsMessageContext, cmd.command, vv)
+ }
+ }
+ }
+
+ "getMemoryStatus" -> {
+ SendReply(wsMessageContext, cmd.command, Somecodes.getMemoryUsage())
+ }
+
+ "getDiskStatus" -> {
+ SendReply(wsMessageContext, cmd.command, Somecodes.getDiskUsage())
+ }
+
+ "getNetworkStatus" -> {
+ Somecodes.GetNetworkStatus { nn ->
+ SendReply(
+ wsMessageContext,
+ cmd.command,
+ objectmapper.writeValueAsString(nn)
+ )
+ }
+ }
+
+ "getPagingQueue" -> {
+ SendReply(
+ wsMessageContext,
+ cmd.command,
+ objectmapper.writeValueAsString(db.queuepagingDB.List)
+ )
+ }
+
+ "getAASQueue" -> {
+ SendReply(
+ wsMessageContext,
+ cmd.command,
+ objectmapper.writeValueAsString(db.queuetableDB.List)
+ )
+ }
+
+ "getStreamerOutputs" -> {
+ val reply: List =
+ StreamerOutputs.map { so -> StreamerOutputData.fromBarixConnection(so.value) }
+ SendReply(wsMessageContext, cmd.command, objectmapper.writeValueAsString(reply))
+ }
+
+ else -> {
+ SendReply(wsMessageContext, cmd.command, "Unknown command")
+ }
+ }
+ } catch (e: Exception) {
+ if (e.message != null && (e.message is String) && e.message!!.isNotEmpty()) {
+ Logger.error { "Error processing WebSocket message: ${e.message}" }
+ }
+ }
+
+ }
+ }
+ }
+ // home for viewer user
+ path("homeviewer.html") {
before { CheckUsers(it) }
ws("/ws") { ws ->
// WebSocket endpoint for home
@@ -2137,6 +2229,35 @@ class WebApp(val listenPort: Int, val userlist: List>, val
}
}
}
+ path("WebAccess"){
+ get {
+ val value = object {
+ val adminpass = _config.Get(configKeys.WEBAPP_ADMIN_PASSWORD.key)
+ val viewerpass = _config.Get(configKeys.WEBAPP_VIEWER_PASSWORD.key)
+ }
+ it.result(objectmapper.writeValueAsString(value))
+ }
+ post{
+ val json : JsonNode = objectmapper.readTree(it.body())
+ val adminpass = json.get("adminpass").asText("")
+ val viewerpass = json.get("viewerpass").asText("")
+ if(ValidString(adminpass) && ValidString(viewerpass)){
+ _config.Set(configKeys.WEBAPP_ADMIN_PASSWORD.key, adminpass)
+ _config.Set(configKeys.WEBAPP_VIEWER_PASSWORD.key, viewerpass)
+ _config.Save()
+ Logger.info { "Changed Web Access Passwords" }
+ // update userlist
+ userlist = listOf(
+ Pair(_config.Get(configKeys.WEBAPP_ADMIN_USERNAME.key), _config.Get(configKeys.WEBAPP_ADMIN_PASSWORD.key)),
+ Pair(_config.Get(configKeys.WEBAPP_VIEWER_USERNAME.key), _config.Get(configKeys.WEBAPP_VIEWER_PASSWORD.key))
+ )
+ it.result(objectmapper.writeValueAsString(resultMessage("OK")))
+ } else {
+ it.status(400)
+ .result(objectmapper.writeValueAsString(resultMessage("Password cannot be empty")))
+ }
+ }
+ }
}