commit 27/10/2025
This commit is contained in:
@@ -815,7 +815,6 @@ class MainExtension01 {
|
||||
db.queuetableDB.Resort()
|
||||
db.Add_Log("AAS", result.message)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
@@ -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")
|
||||
}
|
||||
@@ -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<Pair<String, String>>, 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<Pair<String, String>>, 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")))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user