diff --git a/config.properties b/config.properties index 02d4505..d399f34 100644 --- a/config.properties +++ b/config.properties @@ -1,5 +1,6 @@ #Configuration file -#Mon Oct 27 15:51:50 WIB 2025 +#Mon Oct 27 17:19:33 WIB 2025 +auto.delete.result.days=10 database.host=localhost database.name=aas database.password=admin diff --git a/html/webpage/assets/css/styles.css b/html/webpage/assets/css/styles.css index 3fc979b..e2aef14 100644 --- a/html/webpage/assets/css/styles.css +++ b/html/webpage/assets/css/styles.css @@ -401,7 +401,7 @@ table { } .div-file-list { - height: 20vh; + height: 150px; overflow-y: auto; overflow-x: hidden; padding: 10px; @@ -433,3 +433,12 @@ table { border-bottom: 1px dashed #000000; } +.pad-left { + margin-left: 1rem; +} + +.btn-download { + background-color: #2d3578; + color: white; +} + diff --git a/html/webpage/assets/js/filemanagement.js b/html/webpage/assets/js/filemanagement.js index 3deab66..2353a26 100644 --- a/html/webpage/assets/js/filemanagement.js +++ b/html/webpage/assets/js/filemanagement.js @@ -262,7 +262,7 @@ $(document).ready(function () { } if (allValid) { if (confirm(`Are you sure want to upload ${files.length} file(s) to the soundbank directory for Category: ${$("#setting_category").val()}, Language: ${$("#setting_language").val()}, Voice Type: ${$("#setting_voice").val()}?`)) { - let url = `api/Settings/UploadSoundbank/${lang}/${voice}/${category}`; + let url = `api/FileManager/UploadSoundbank/${lang}/${voice}/${category}`; const formdata = new FormData(); for (let i = 0; i < files.length; i++) { formdata.append('files', files[i]); @@ -275,6 +275,8 @@ $(document).ready(function () { .then(response => response.json()) .then(okdata => { console.log("Upload result: ", JSON.stringify(okdata)); + change_droparea_enable(); + alert("Files uploaded successfully to soundbank directory."); }) .catch(errdata => { alert("Error uploading files to soundbank directory : " + errdata.message); diff --git a/html/webpage/assets/js/setting.js b/html/webpage/assets/js/setting.js index afa3aa3..13c24d4 100644 --- a/html/webpage/assets/js/setting.js +++ b/html/webpage/assets/js/setting.js @@ -1,8 +1,3 @@ - - - - - /** * Load message bank data into selection dropdowns * @param {Function || null} cbOK callback when complete @@ -39,6 +34,32 @@ function load_remark_selection() { }); } +function Get_OldResultDays(){ + fetchAPI("Settings/OldResultDays", "GET", {}, null, (okdata) => { + let days = parseInt(okdata.message); + if(isNaN(days) || days < 0){ + days = 3; + } + $("#oldresultdays").val(days); + }, (errdata) => { + alert("Error getting Old Result Days : " + errdata.message); + }); +} + +function Set_OldResultDays(){ + let days = parseInt($("#oldresultdays").val()); + if(isNaN(days) || days < 0){ + alert("Please enter a valid number of days (0 or more)."); + return; + } + + fetchAPI("Settings/OldResultDays", "POST", {}, { days: days }, (okdata) => { + alert("Old Result Days updated successfully."); + }, (errdata) => { + alert("Error updating Old Result Days : " + errdata.message); + }); +} + function load_default_voice(){ $("#input_defaultvoice").empty(); window.voiceTypes.forEach((voice) => { @@ -49,8 +70,10 @@ function load_default_voice(){ $(document).ready(function () { console.log("setting.js loaded"); load_default_voice(); + Get_OldResultDays(); load_messagebank(() => load_remark_selection()); $("#fiscodesave").off('click').on('click', function () { + Set_OldResultDays(); let gop = $("#input_GOP").val(); let gbd = $("#input_GBD").val(); let gfc = $("#input_GFC").val(); diff --git a/html/webpage/broadcastzones.html b/html/webpage/broadcastzones.html index 57f3239..ec97628 100644 --- a/html/webpage/broadcastzones.html +++ b/html/webpage/broadcastzones.html @@ -4,7 +4,7 @@ - AAS_NewGen_27OKT25 + AAS_NewGen_27OKT25rev1 diff --git a/html/webpage/filemanagement.html b/html/webpage/filemanagement.html index 8c1f2f0..852a8e9 100644 --- a/html/webpage/filemanagement.html +++ b/html/webpage/filemanagement.html @@ -4,7 +4,7 @@ - AAS_NewGen_27OKT25 + AAS_NewGen_27OKT25rev1 @@ -68,6 +68,14 @@

Soundbank Result


+
+
+
+
+

Search

+
+
+
@@ -79,14 +87,7 @@ - +
Result Soundbank 001
@@ -95,6 +96,14 @@

Paging Result


+
+
+
+
+

Search

+
+
+
@@ -106,14 +115,7 @@ - +
Result Paging 001
diff --git a/html/webpage/language.html b/html/webpage/language.html index 6d667c7..86086d3 100644 --- a/html/webpage/language.html +++ b/html/webpage/language.html @@ -4,7 +4,7 @@ - AAS_NewGen_27OKT25 + AAS_NewGen_27OKT25rev1 diff --git a/html/webpage/log.html b/html/webpage/log.html index 9577b03..2b36a19 100644 --- a/html/webpage/log.html +++ b/html/webpage/log.html @@ -4,7 +4,7 @@ - AAS_NewGen_27OKT25 + AAS_NewGen_27OKT25rev1 diff --git a/html/webpage/messagebank.html b/html/webpage/messagebank.html index 012fa7c..91d0629 100644 --- a/html/webpage/messagebank.html +++ b/html/webpage/messagebank.html @@ -4,7 +4,7 @@ - AAS_NewGen_27OKT25 + AAS_NewGen_27OKT25rev1 diff --git a/html/webpage/overview.html b/html/webpage/overview.html index fce2fda..d3192b3 100644 --- a/html/webpage/overview.html +++ b/html/webpage/overview.html @@ -4,7 +4,7 @@ - AAS_NewGen_27OKT25 + AAS_NewGen_27OKT25rev1 diff --git a/html/webpage/setting.html b/html/webpage/setting.html index 40403fc..9307d4d 100644 --- a/html/webpage/setting.html +++ b/html/webpage/setting.html @@ -4,7 +4,7 @@ - AAS_NewGen_27OKT25 + AAS_NewGen_27OKT25rev1 @@ -31,24 +31,57 @@
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
+
+
+
+
diff --git a/html/webpage/soundbank.html b/html/webpage/soundbank.html index c6de92b..1e97bce 100644 --- a/html/webpage/soundbank.html +++ b/html/webpage/soundbank.html @@ -4,7 +4,7 @@ - AAS_NewGen_27OKT25 + AAS_NewGen_27OKT25rev1 diff --git a/html/webpage/streamerstatus.html b/html/webpage/streamerstatus.html index dd22749..0b010c2 100644 --- a/html/webpage/streamerstatus.html +++ b/html/webpage/streamerstatus.html @@ -4,7 +4,7 @@ - AAS_NewGen_27OKT25 + AAS_NewGen_27OKT25rev1 diff --git a/html/webpage/timer.html b/html/webpage/timer.html index e6eec9d..d2445d2 100644 --- a/html/webpage/timer.html +++ b/html/webpage/timer.html @@ -4,7 +4,7 @@ - AAS_NewGen_27OKT25 + AAS_NewGen_27OKT25rev1 diff --git a/html/webpage/usermanagement.html b/html/webpage/usermanagement.html index 8c0ae44..7fa01f7 100644 --- a/html/webpage/usermanagement.html +++ b/html/webpage/usermanagement.html @@ -4,7 +4,7 @@ - AAS_NewGen_27OKT25 + AAS_NewGen_27OKT25rev1 diff --git a/src/MainExtension01.kt b/src/MainExtension01.kt index c6b1146..4f5ebd9 100644 --- a/src/MainExtension01.kt +++ b/src/MainExtension01.kt @@ -815,7 +815,6 @@ class MainExtension01 { db.queuetableDB.Resort() db.Add_Log("AAS", result.message) } - } } else { diff --git a/src/codes/configFile.kt b/src/codes/configFile.kt index a293024..fccc2d3 100644 --- a/src/codes/configFile.kt +++ b/src/codes/configFile.kt @@ -68,6 +68,7 @@ class configFile { config[configKeys.WEBAPP_VIEWER_PASSWORD.key] = "password" config[configKeys.WEBAPP_PORT.key] = "3030" config[configKeys.DEFAULT_VOICE_TYPE.key] = VoiceType.VOICE_1.name + config[configKeys.AUTO_DELETE_RESULT_DAYS.key] = "7" Save() } } \ No newline at end of file diff --git a/src/codes/configKeys.kt b/src/codes/configKeys.kt index b331591..f57d690 100644 --- a/src/codes/configKeys.kt +++ b/src/codes/configKeys.kt @@ -16,5 +16,6 @@ enum class configKeys(val key: String) { WEBAPP_ADMIN_PASSWORD("webapp.admin.password"), WEBAPP_VIEWER_USERNAME("webapp.viewer.username"), WEBAPP_VIEWER_PASSWORD("webapp.viewer.password"), - WEBAPP_PORT("webapp.port") + WEBAPP_PORT("webapp.port"), + AUTO_DELETE_RESULT_DAYS("auto.delete.result.days") } \ No newline at end of file diff --git a/src/web/WebApp.kt b/src/web/WebApp.kt index 4c7c28c..376ea59 100644 --- a/src/web/WebApp.kt +++ b/src/web/WebApp.kt @@ -6,6 +6,7 @@ import codes.Somecodes.Companion.GetSensorsInfo import codes.Somecodes.Companion.GetUptime import codes.Somecodes.Companion.ListAudioFiles import codes.Somecodes.Companion.ValiDateForLogHtml +import codes.Somecodes.Companion.ValidDirectory import codes.Somecodes.Companion.ValidFile import codes.Somecodes.Companion.ValidIPV4 import codes.Somecodes.Companion.ValidScheduleDay @@ -1793,6 +1794,7 @@ class WebApp(val listenPort: Int, val userlist: List>, val val category = it.pathParam("category") val uploaded = it.uploadedFiles() + println("UploadSoundbank called with language=$language, voice=$voice, category=$category, uploaded files count=${uploaded.size}") if (ValidString(language) && Language.entries.any { lang -> lang.name == language }) { if (ValidString(voice) && VoiceType.entries.any { vtype -> vtype.name == voice }) { if (ValidString(category) && Category.entries.any { cat -> cat.name == category }) { @@ -1873,65 +1875,81 @@ class WebApp(val listenPort: Int, val userlist: List>, val } } path("Settings") { - get("SoundbankDirectory") { - val dir = _config.Get(configKeys.SOUNDBANK_DIRECTORY.key) - it.result(objectmapper.writeValueAsString(resultMessage(dir))) - } - post("SoundbankDirectory") { - val json: JsonNode = objectmapper.readTree(it.body()) - val newdir = json.get("directory").asText("") - if (ValidString(newdir)) { - _config.Set(configKeys.SOUNDBANK_DIRECTORY.key, newdir) + path("OldResultDays"){ + get { + it.result(objectmapper.writeValueAsString(resultMessage(_config.Get(configKeys.AUTO_DELETE_RESULT_DAYS.key)))) + } + post { + val json : JsonNode = objectmapper.readTree(it.body()) + val days = json.get("days").asInt(3) + _config.Set(configKeys.AUTO_DELETE_RESULT_DAYS.key, days.toString()) _config.Save() - Logger.info { "Changed Soundbank Directory to $newdir" } + Logger.info { "Changed Auto Delete Result Days to $days" } it.result(objectmapper.writeValueAsString(resultMessage("OK"))) - } else { - it.status(400) - .result(objectmapper.writeValueAsString(resultMessage("Invalid directory value"))) } } - get("FISCode") { - - val value = object { - //get from config file - val GOP = _config.Get(configKeys.REMARK_GOP.key) - val GBD = _config.Get(configKeys.REMARK_GBD.key) - val GFC = _config.Get(configKeys.REMARK_GFC.key) - val FLD = _config.Get(configKeys.REMARK_FLD.key) - val defaultvoice = _config.Get(configKeys.DEFAULT_VOICE_TYPE.key) + path("SoundbankDirectory"){ + get { + val dir = _config.Get(configKeys.SOUNDBANK_DIRECTORY.key) + it.result(objectmapper.writeValueAsString(resultMessage(dir))) } - //println("Serving FIS Code request: GOP=${value.GOP}, GBD=${value.GBD}, GFC=${value.GFC}, FLD=${value.FLD}, DefaultVoice=${value.defaultvoice}") - it.result(objectmapper.writeValueAsString(value)) - } + post { + val json: JsonNode = objectmapper.readTree(it.body()) + val newdir = json.get("directory").asText("") + if (ValidDirectory(newdir)) { + _config.Set(configKeys.SOUNDBANK_DIRECTORY.key, newdir) + _config.Save() + Somecodes.Soundbank_directory = Path.of(newdir) - post("FISCode") { - - val json: JsonNode = objectmapper.readTree(it.body()) - val _gop = json.get("GOP").asText("") - val _gbd = json.get("GBD").asText("") - val _gfc = json.get("GFC").asText("") - val _fld = json.get("FLD").asText("") - val defaultvoice = json.get("defaultvoice").asText("") - //println("Received FIS Code update: GOP=$_gop, GBD=$_gbd, GFC=$_gfc, FLD=$_fld, DefaultVoice=$defaultvoice") - if (ValidString(_gop) && ValidString(_gbd) && ValidString(_gfc) && ValidString(_fld)) { - // save to config file - _config.Set(configKeys.REMARK_GOP.key, _gop) - _config.Set(configKeys.REMARK_GBD.key, _gbd) - _config.Set(configKeys.REMARK_GFC.key, _gfc) - _config.Set(configKeys.REMARK_FLD.key, _fld) - _config.Set(configKeys.DEFAULT_VOICE_TYPE.key, defaultvoice) - _config.Save() - Logger.info { "Changed FIS Codes" } - db.Add_Log( - "AAS", - "Save FIS Codes Message: GOP=$_gop, GBD=$_gbd, GFC=$_gfc, FLD=$_fld" - ) - it.result(objectmapper.writeValueAsString(resultMessage("OK"))) - } else { - it.status(400) - .result(objectmapper.writeValueAsString(resultMessage("Invalid FIS code value"))) + Logger.info { "Changed Soundbank Directory to $newdir" } + it.result(objectmapper.writeValueAsString(resultMessage("OK"))) + } else { + it.status(400) + .result(objectmapper.writeValueAsString(resultMessage("Invalid directory value"))) + } } } + path("FISCode"){ + get { + val value = object { + //get from config file + val GOP = _config.Get(configKeys.REMARK_GOP.key) + val GBD = _config.Get(configKeys.REMARK_GBD.key) + val GFC = _config.Get(configKeys.REMARK_GFC.key) + val FLD = _config.Get(configKeys.REMARK_FLD.key) + val defaultvoice = _config.Get(configKeys.DEFAULT_VOICE_TYPE.key) + val autodeleteresult = _config.Get(configKeys.AUTO_DELETE_RESULT_DAYS.key) + } + it.result(objectmapper.writeValueAsString(value)) + } + post { + val json: JsonNode = objectmapper.readTree(it.body()) + val _gop = json.get("GOP").asText("") + val _gbd = json.get("GBD").asText("") + val _gfc = json.get("GFC").asText("") + val _fld = json.get("FLD").asText("") + val defaultvoice = json.get("defaultvoice").asText("") + if (ValidString(_gop) && ValidString(_gbd) && ValidString(_gfc) && ValidString(_fld)) { + // save to config file + _config.Set(configKeys.REMARK_GOP.key, _gop) + _config.Set(configKeys.REMARK_GBD.key, _gbd) + _config.Set(configKeys.REMARK_GFC.key, _gfc) + _config.Set(configKeys.REMARK_FLD.key, _fld) + _config.Set(configKeys.DEFAULT_VOICE_TYPE.key, defaultvoice) + _config.Save() + Logger.info { "Changed FIS Codes" } + db.Add_Log( + "AAS", + "Save FIS Codes Message: GOP=$_gop, GBD=$_gbd, GFC=$_gfc, FLD=$_fld, DefaultVoice=$defaultvoice" + ) + it.result(objectmapper.writeValueAsString(resultMessage("OK"))) + } else { + it.status(400) + .result(objectmapper.writeValueAsString(resultMessage("Invalid FIS code value"))) + } + } + } + } }