From 17b4485e697cdbd4ba7451416a52b25b9b6ad3ed Mon Sep 17 00:00:00 2001 From: stephaniegl Date: Fri, 17 Oct 2025 17:15:00 +0700 Subject: [PATCH] commit 17/10/2025 Add few logs --- html/webpage/assets/css/bss-overrides.css | 49 +++++++ html/webpage/assets/css/styles.css | 43 +++++- html/webpage/assets/js/schedulebank.js | 35 ++--- html/webpage/broadcastzones.html | 2 +- html/webpage/language.html | 8 +- html/webpage/log.html | 12 +- html/webpage/login.html | 21 ++- html/webpage/messagebank.html | 16 +-- html/webpage/overview.html | 154 +++++++++++----------- html/webpage/setting.html | 63 ++++++++- html/webpage/soundbank.html | 18 +-- html/webpage/streamerstatus.html | 2 +- html/webpage/timer.html | 93 +++++++------ html/webpage/usermanagement.html | 16 +-- src/codes/Somecodes.kt | 33 +++++ src/database/MariaDB.kt | 2 +- src/web/WebApp.kt | 30 +++-- 17 files changed, 392 insertions(+), 205 deletions(-) diff --git a/html/webpage/assets/css/bss-overrides.css b/html/webpage/assets/css/bss-overrides.css index d06cc3c..e4c6b12 100644 --- a/html/webpage/assets/css/bss-overrides.css +++ b/html/webpage/assets/css/bss-overrides.css @@ -37,3 +37,52 @@ --bs-btn-disabled-border-color: #0d6efd; } +.my-4 { + margin-top: 1.5rem!important; + margin-bottom: 1.5rem!important; +} + +.mt-0 { + margin-top: 0!important; +} + +.me-2 { + margin-right: .5rem!important; +} + +.mb-2 { + margin-bottom: .5rem!important; +} + +.mb-3 { + margin-bottom: 1rem!important; +} + +.mb-4 { + margin-bottom: 1.5rem!important; +} + +.mb-5 { + margin-bottom: 3rem!important; +} + +.mb-7 { + margin-bottom: 6rem !important; +} + +.mb-auto { + margin-bottom: auto!important; +} + +@media (min-width:768px) { + .me-md-auto { + margin-right: auto!important; + } +} + +@media (min-width:768px) { + .mb-md-0 { + margin-bottom: 0!important; + } +} + diff --git a/html/webpage/assets/css/styles.css b/html/webpage/assets/css/styles.css index 0c12988..0f45c33 100644 --- a/html/webpage/assets/css/styles.css +++ b/html/webpage/assets/css/styles.css @@ -104,7 +104,7 @@ body { } .btn-login { - border-radius: 20px; + border-radius: 8px; box-shadow: rgba(136, 165, 191, 0.48) 6px 2px 16px 0px, rgba(255, 255, 255, 0.8) -6px -2px 16px 0px; --bs-btn-hover-bg: #5780f2; background-color: #5278e1; @@ -277,3 +277,44 @@ table { border-radius: 0 !important; } +.p-login { + text-align: left; + font-weight: 600; + margin-bottom: 0; + color: #3E4C66; +} + +.h-login { + font-weight: 600; + color: #2E3A59; +} + +#file-input { + display: none; +} + +.card-setting { + border-radius: 8px; + border: white solid 3px; +} + +#drop-area { + border: 2px dashed #ccc; + border-radius: 20px; + width: 400px; + height: 200px; + display: flex; + justify-content: center; + align-items: center; + font-family: sans-serif; + color: #666; + cursor: pointer; + transition: background 0.2s, border-color 0.2s; +} + +#drop-area.highlight { + background: #f0f8ff; + border-color: #0d6efd; + color: #0d6efd; +} + diff --git a/html/webpage/assets/js/schedulebank.js b/html/webpage/assets/js/schedulebank.js index a93d0dd..fc51576 100644 --- a/html/webpage/assets/js/schedulebank.js +++ b/html/webpage/assets/js/schedulebank.js @@ -101,30 +101,30 @@ $(document).ready(function () { let $schedulehour = $schedulemodal.find('#schedulehour'); // number input 0-59 let $scheduleminute = $schedulemodal.find('#scheduleminute'); - - //TODO ganti dropdown with list of messages from MessageBank - // text input - let $schedulesoundpath = $schedulemodal.find('#schedulesoundpath'); + // select2 for message + let $schedulemessage = $schedulemodal.find('#schedulemessage'); + $schedulemessage.select2({}); // number input 0-5 let $schedulerepeat = $schedulemodal.find('#schedulerepeat'); // checkbox let $scheduleenable = $schedulemodal.find('#scheduleenable'); - // div for list of checkboxes + // select2 for broadcastzones let $schedulezones = $schedulemodal.find('#schedulezones'); + $schedulezones.select2({}); // radio button for everyday let $scheduleeveryday = $schedulemodal.find('#scheduleeveryday'); - // radio button for weekdays - let $schedulesunday = $schedulemodal.find('#schedulesunday'); - let $schedulemonday = $schedulemodal.find('#schedulemonday'); - let $scheduletuesday = $schedulemodal.find('#scheduletuesday'); - let $schedulewednesday = $schedulemodal.find('#schedulewednesday'); - let $schedulethursday = $schedulemodal.find('#schedulethursday'); - let $schedulefriday = $schedulemodal.find('#schedulefriday'); - let $schedulesaturday = $schedulemodal.find('#schedulesaturday'); + // radio button for weekly + let $scheduleweekly = $schedulemodal.find('#scheduleweekly'); + // select2 for weekly selection + let $weeklyselect = $schedulemodal.find('#weeklyselect'); + $weeklyselect.select2({}); // radio button for specific date let $schedulespecialdate = $schedulemodal.find('#schedulespecialdate'); // date input let $scheduledate = $schedulemodal.find('#scheduledate'); + // select2 for language + let $languageselect = $schedulemodal.find('#languageselect'); + $languageselect.select2({}); $schedulespecialdate.on('change', function () { if ($(this).is(':checked')) { @@ -139,17 +139,10 @@ $(document).ready(function () { $scheduledescription.val(''); $schedulehour.val('0'); $scheduleminute.val('0'); - $schedulesoundpath.val(''); $schedulerepeat.val('0'); $scheduleenable.prop('checked', true); $scheduleeveryday.prop('checked', false); - $schedulesunday.prop('checked', false); - $schedulemonday.prop('checked', false); - $scheduletuesday.prop('checked', false); - $schedulewednesday.prop('checked', false); - $schedulethursday.prop('checked', false); - $schedulefriday.prop('checked', false); - $schedulesaturday.prop('checked', false); + $schedulespecialdate.prop('checked', false); $scheduledate.prop('disabled', true).val(''); diff --git a/html/webpage/broadcastzones.html b/html/webpage/broadcastzones.html index 5a033f7..6a656b2 100644 --- a/html/webpage/broadcastzones.html +++ b/html/webpage/broadcastzones.html @@ -4,7 +4,7 @@ - AAS_NewGen_08OKT25 + AAS_NewGen_17OKT25 diff --git a/html/webpage/language.html b/html/webpage/language.html index c0e37d9..eb19006 100644 --- a/html/webpage/language.html +++ b/html/webpage/language.html @@ -4,7 +4,7 @@ - AAS_NewGen_08OKT25 + AAS_NewGen_17OKT25 @@ -42,9 +42,9 @@ - - - + + + diff --git a/html/webpage/log.html b/html/webpage/log.html index d942a70..b292290 100644 --- a/html/webpage/log.html +++ b/html/webpage/log.html @@ -4,7 +4,7 @@ - AAS_NewGen_08OKT25 + AAS_NewGen_17OKT25 @@ -39,11 +39,11 @@
NoTAGLanguagesNoTAGLanguages
- - - - - + + + + + diff --git a/html/webpage/login.html b/html/webpage/login.html index ba46872..d39616f 100644 --- a/html/webpage/login.html +++ b/html/webpage/login.html @@ -14,22 +14,21 @@
-
-
-

Sign In

-
-
-
+
+
NoDateTimeMachineDescriptionNoDateTimeMachineDescription
- - - - - - - + + + + + + + diff --git a/html/webpage/overview.html b/html/webpage/overview.html index 0d31f99..54e1e43 100644 --- a/html/webpage/overview.html +++ b/html/webpage/overview.html @@ -4,7 +4,7 @@ - AAS_NewGen_08OKT25 + AAS_NewGen_17OKT25 @@ -19,8 +19,8 @@
- -
+ +
@@ -102,7 +102,7 @@
-
+

Channel 05

@@ -121,7 +121,7 @@
-
+

Channel 06

@@ -140,7 +140,7 @@
-
+

Channel 07

@@ -159,7 +159,7 @@
-
+

Channel 08

@@ -180,7 +180,7 @@
-
+

Channel 09

@@ -199,7 +199,7 @@
-
+

Channel 10

@@ -218,7 +218,7 @@
-
+

Channel 11

@@ -237,7 +237,7 @@
-
+

Channel 12

@@ -258,7 +258,7 @@
-
+

Channel 13

@@ -277,7 +277,7 @@
-
+

Channel 14

@@ -296,7 +296,7 @@
-
+

Channel 15

@@ -315,7 +315,7 @@
-
+

Channel 16

@@ -336,7 +336,7 @@
-
+

Channel 17

@@ -355,7 +355,7 @@
-
+

Channel 18

@@ -374,7 +374,7 @@
-
+

Channel 19

@@ -393,7 +393,7 @@
-
+

Channel 20

@@ -414,7 +414,7 @@
-
+

Channel 21

@@ -433,7 +433,7 @@
-
+

Channel 22

@@ -452,7 +452,7 @@
-
+

Channel 23

@@ -471,7 +471,7 @@
-
+

Channel 24

@@ -492,7 +492,7 @@
-
+

Channel 25

@@ -511,7 +511,7 @@
-
+

Channel 26

@@ -530,7 +530,7 @@
-
+

Channel 27

@@ -549,7 +549,7 @@
-
+

Channel 28

@@ -570,7 +570,7 @@
-
+

Channel 29

@@ -589,7 +589,7 @@
-
+

Channel 30

@@ -608,7 +608,7 @@
-
+

Channel 31

@@ -627,7 +627,7 @@
-
+

Channel 32

@@ -648,7 +648,7 @@
-
+

Channel 33

@@ -667,7 +667,7 @@
-
+

Channel 34

@@ -686,7 +686,7 @@
-
+

Channel 35

@@ -705,7 +705,7 @@
-
+

Channel 36

@@ -726,7 +726,7 @@
-
+

Channel 37

@@ -745,7 +745,7 @@
-
+

Channel 38

@@ -764,7 +764,7 @@
-
+

Channel 39

@@ -783,7 +783,7 @@
-
+

Channel 40

@@ -804,7 +804,7 @@
-
+

Channel 41

@@ -823,7 +823,7 @@
-
+

Channel 42

@@ -842,7 +842,7 @@
-
+

Channel 43

@@ -861,7 +861,7 @@
-
+

Channel 44

@@ -882,7 +882,7 @@
-
+

Channel 45

@@ -901,7 +901,7 @@
-
+

Channel 46

@@ -920,7 +920,7 @@
-
+

Channel 47

@@ -939,7 +939,7 @@
-
+

Channel 48

@@ -960,7 +960,7 @@
-
+

Channel 49

@@ -979,7 +979,7 @@
-
+

Channel 50

@@ -998,7 +998,7 @@
-
+

Channel 51

@@ -1017,7 +1017,7 @@
-
+

Channel 52

@@ -1038,7 +1038,7 @@
-
+

Channel 53

@@ -1057,7 +1057,7 @@
-
+

Channel 54

@@ -1076,7 +1076,7 @@
-
+

Channel 55

@@ -1095,7 +1095,7 @@
-
+

Channel 56

@@ -1116,7 +1116,7 @@
-
+

Channel 57

@@ -1135,7 +1135,7 @@
-
+

Channel 58

@@ -1154,7 +1154,7 @@
-
+

Channel 59

@@ -1173,7 +1173,7 @@
-
+

Channel 60

@@ -1194,7 +1194,7 @@
-
+

Channel 61

@@ -1213,7 +1213,7 @@
-
+

Channel 62

@@ -1232,7 +1232,7 @@
-
+

Channel 63

@@ -1251,7 +1251,7 @@
-
+

Channel 64

@@ -1274,20 +1274,20 @@
- -
+ +
NoDescriptionLanguageANN IDTypeMessage DetailsMessage TagsNoDescriptionLanguageANN IDTypeMessage DetailsMessage Tags
- - - - - - + + + + + + @@ -1310,12 +1310,12 @@
IndexDate TimeSourceTypeMessageBroadcast ZonesIndexDate TimeSourceTypeMessageBroadcast Zones
- - - - - - + + + + + + diff --git a/html/webpage/setting.html b/html/webpage/setting.html index e17dcd0..ae89f21 100644 --- a/html/webpage/setting.html +++ b/html/webpage/setting.html @@ -4,7 +4,7 @@ - AAS_NewGen_08OKT25 + AAS_NewGen_17OKT25 @@ -17,6 +17,67 @@

Setting

+
+
+
+
+

Upload Soundbank

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

FIS CODE

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/html/webpage/soundbank.html b/html/webpage/soundbank.html index 6db7233..4bc18ba 100644 --- a/html/webpage/soundbank.html +++ b/html/webpage/soundbank.html @@ -4,7 +4,7 @@ - AAS_NewGen_08OKT25 + AAS_NewGen_17OKT25 @@ -42,13 +42,13 @@
IndexDate TimeSourceTypeMessageBroadcast ZonesIndexDate TimeSourceTypeMessageBroadcast Zones
- - - - - - - + + + + + + + @@ -102,7 +102,7 @@

Path

-
+
diff --git a/html/webpage/streamerstatus.html b/html/webpage/streamerstatus.html index b251933..89ff588 100644 --- a/html/webpage/streamerstatus.html +++ b/html/webpage/streamerstatus.html @@ -4,7 +4,7 @@ - AAS_NewGen_08OKT25 + AAS_NewGen_17OKT25 diff --git a/html/webpage/timer.html b/html/webpage/timer.html index 458b974..71903aa 100644 --- a/html/webpage/timer.html +++ b/html/webpage/timer.html @@ -4,7 +4,7 @@ - AAS_NewGen_08OKT25 + AAS_NewGen_17OKT25 @@ -42,14 +42,15 @@
NoDescriptionTAGCategoryLanguageTypeFilenameNoDescriptionTAGCategoryLanguageTypeFilename
- - - - - - - - + + + + + + + + + @@ -87,37 +88,13 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -134,12 +111,12 @@
-
-
+
+

(H)

-
-
+
+

(M)

@@ -147,9 +124,25 @@
-

Sound Path

+

Message

+
+
+
+
+
+

Language

+
+
+
+
+
-
@@ -167,7 +160,13 @@

Broadcast Zones

-
+
diff --git a/html/webpage/usermanagement.html b/html/webpage/usermanagement.html index 2599c2a..1a26400 100644 --- a/html/webpage/usermanagement.html +++ b/html/webpage/usermanagement.html @@ -4,7 +4,7 @@ - AAS_NewGen_08OKT25 + AAS_NewGen_17OKT25 @@ -42,13 +42,13 @@
NoDescriptionDayTimeSound PathRepeatEnableBroadcast ZonesNoDescriptionDayTimeSound PathRepeatEnableBroadcast ZonesLanguage
- - - - - - - + + + + + + + diff --git a/src/codes/Somecodes.kt b/src/codes/Somecodes.kt index 8795e2c..f689679 100644 --- a/src/codes/Somecodes.kt +++ b/src/codes/Somecodes.kt @@ -16,6 +16,8 @@ import oshi.SystemInfo import oshi.hardware.CentralProcessor import oshi.hardware.GlobalMemory import oshi.hardware.NetworkIF +import oshi.hardware.Sensors +import oshi.software.os.OperatingSystem import java.nio.file.Files import java.nio.file.Path import java.time.LocalDateTime @@ -37,6 +39,8 @@ class Somecodes { val processor: CentralProcessor = si.hardware.processor val memory : GlobalMemory = si.hardware.memory val NetworkInfoMap = mutableMapOf() + val sensor : Sensors = si.hardware.sensors + val os : OperatingSystem = si.operatingSystem val datetimeformat1: DateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm:ss") val dateformat1: DateTimeFormatter = DateTimeFormatter.ofPattern("dd/MM/yyyy") @@ -492,6 +496,35 @@ class Somecodes { sb.append(".wav") return sb.toString() } + + /** + * Get sensors information using OSHI library. + * @return A string representing the CPU temperature, fan speeds, and CPU voltage, or an empty string if not available. + */ + fun GetSensorsInfo() : String { + val cputemp = sensor.cpuTemperature + val cpuvolt = sensor.cpuVoltage + val fanspeed = sensor.fanSpeeds + return if (cpuvolt>0 && cputemp > 0 && fanspeed.isNotEmpty()){ + String.format("CPU Temp: %.1f °C\nFan Speeds: %s RPM\nCPU Voltage: %.2f V", + sensor.cpuTemperature, + sensor.fanSpeeds.joinToString("/"), + sensor.cpuVoltage + ) + } else "" + + } + + fun GetUptime() : String { + val value = os.systemUptime + return if (value>0){ + // number of seconds since system boot + val hours = value / 3600 + val minutes = (value % 3600) / 60 + val seconds = value % 60 + String.format("%02d:%02d:%02d", hours, minutes, seconds) + } else "" + } } diff --git a/src/database/MariaDB.kt b/src/database/MariaDB.kt index c8b50e1..b80d882 100644 --- a/src/database/MariaDB.kt +++ b/src/database/MariaDB.kt @@ -670,7 +670,7 @@ class MariaDB( val statement = connection.createStatement() val resultSet = statement?.executeQuery("SELECT * FROM ${super.dbName}") val workbook = XSSFWorkbook() - val sheet = workbook.createSheet("LanguageLink") + val sheet = workbook.createSheet("languagelinking") val headerRow = sheet.createRow(0) val headers = arrayOf("Index", "TAG", "Language") for ((colIndex, header) in headers.withIndex()) { diff --git a/src/web/WebApp.kt b/src/web/WebApp.kt index 89c8b31..1af40c3 100644 --- a/src/web/WebApp.kt +++ b/src/web/WebApp.kt @@ -2,6 +2,8 @@ package web import StreamerOutputs import codes.Somecodes +import codes.Somecodes.Companion.GetSensorsInfo +import codes.Somecodes.Companion.GetUptime import codes.Somecodes.Companion.ListAudioFiles import codes.Somecodes.Companion.ValiDateForLogHtml import codes.Somecodes.Companion.ValidFile @@ -24,7 +26,6 @@ import database.ScheduleBank import database.SoundChannel import database.Soundbank import database.UserDB -//>>>>>>>>> Temporary merge branch 2 import db import io.javalin.Javalin import io.javalin.apibuilder.ApiBuilder.before @@ -41,7 +42,6 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook import java.nio.file.Files import java.time.LocalDateTime - @Suppress("unused") class WebApp(val listenPort: Int, val userlist: List>) { @@ -91,7 +91,6 @@ class WebApp(val listenPort: Int, val userlist: List>) { it.sessionAttribute("user", user.first) //println("User ${user.first} logged in") // Redirect to home page - //db.Add_Log("WEB", "User ${user.first} logged in") it.redirect("home.html") } } @@ -107,16 +106,23 @@ class WebApp(val listenPort: Int, val userlist: List>) { objectmapper.readValue(wsMessageContext.message(), WebsocketCommand::class.java) when (cmd.command) { "getSystemTime" -> { + val systemtime = LocalDateTime.now().format(Somecodes.datetimeformat1) + val uptime = GetUptime() SendReply( wsMessageContext, cmd.command, - LocalDateTime.now().format(Somecodes.datetimeformat1) + if (uptime.isNotEmpty()) "Date & Time : $systemtime\nSystem Uptime : $uptime" else "Date & Time : $systemtime" ) } "getCPUStatus" -> { Somecodes.getCPUUsage { vv -> - SendReply(wsMessageContext, cmd.command, vv) + val sv = GetSensorsInfo() + if (sv.isNotEmpty()){ + SendReply(wsMessageContext, cmd.command, vv+"\n"+sv) + } else { + SendReply(wsMessageContext, cmd.command, vv) + } } } @@ -437,8 +443,15 @@ class WebApp(val listenPort: Int, val userlist: List>) { // get messagebank list it.result(MariaDB.ArrayListtoString(db.messageDB.List)) } - post("Add"){ - val json : JsonNode = objectmapper.readTree(it.body()) + get("MessageIDs") { ctx -> + val value = db.messageDB.List + .distinctBy { it.ANN_ID } + .sortedBy { it.ANN_ID } + .map { KeyValueMessage(it.ANN_ID.toString(), it.Description) } + ctx.result(objectmapper.writeValueAsString(value)) + } + post("Add") { + val json: JsonNode = objectmapper.readTree(it.body()) val description = json.get("Description")?.asText("") ?: "" val language = json.get("Language")?.asText("") ?: "" val ann_id = json.get("ANN_ID")?.asInt()?.toUInt() ?: 0u @@ -750,8 +763,7 @@ class WebApp(val listenPort: Int, val userlist: List>) { if (ValidString(description)){ if (ValidString(day) && ValidScheduleDay(day)){ if (ValidString(time) && ValidScheduleTime(time)){ - //soundpath is a messagebank desc and aan_id - if (ValidString(soundpath)) { + if (ValidString(soundpath) && ValidFile(soundpath)){ if (repeat in 0u..127u){ if (ValidString(broadcast_zones)){ val zones = broadcast_zones.split(";")
NoUsernameLocationAirlineCityMessagebankBroadcast ZonesNoUsernameLocationAirlineCityMessagebankBroadcast Zones