commit 03/02/2026
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -50,3 +50,4 @@ silencehalf.wav
|
||||
bass*.dll
|
||||
bass*.so
|
||||
sdx.dll
|
||||
SecureDongle.dll
|
||||
|
||||
37
.idea/artifacts/AAS_multijar.xml
generated
Normal file
37
.idea/artifacts/AAS_multijar.xml
generated
Normal file
@@ -0,0 +1,37 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact name="AAS multijar">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/AAS_multijar</output-path>
|
||||
<root id="root">
|
||||
<element id="archive" name="AAS_NewGen.jar">
|
||||
<element id="module-output" name="AAS_NewGen" />
|
||||
</element>
|
||||
<element id="library" level="project" name="tinylog.impl" />
|
||||
<element id="library" level="project" name="fasterxml.jackson.module.kotlin" />
|
||||
<element id="library" level="project" name="mysql.connector.j" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-5.3.0.jar" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/xmlbeans-5.2.1.jar" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-ooxml-5.3.0.jar" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/log4j-api-2.23.1.jar" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/SparseBitSet-1.3.jar" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/commons-io-2.16.1.jar" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-5.3.0-sources.jar" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/commons-math3-3.6.1.jar" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/commons-codec-1.17.1.jar" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-ooxml-full-5.3.0.jar" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/commons-compress-1.26.2.jar" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-ooxml-5.3.0-sources.jar" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-ooxml-schemas-4.1.2.jar" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/commons-collections4-4.4.jar" />
|
||||
<element id="file-copy" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-ooxml-full-5.3.0-sources.jar" />
|
||||
<element id="library" level="project" name="io.javalin" />
|
||||
<element id="library" level="project" name="slf4j.simple" />
|
||||
<element id="library" level="project" name="fasterxml.jackson.core.databind" />
|
||||
<element id="library" level="project" name="kotlinx-coroutines-core" />
|
||||
<element id="library" level="project" name="google.cloud.texttospeech" />
|
||||
<element id="library" level="project" name="KotlinJavaRuntime" />
|
||||
<element id="library" level="project" name="projectlombok.lombok" />
|
||||
<element id="library" level="project" name="github.oshi.core" />
|
||||
<element id="library" level="project" name="net.java.dev.jna" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
@@ -1,12 +1,34 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="AAS_NewGen:jar">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/AAS_NewGen_jar</output-path>
|
||||
<artifact type="jar" name="AAS singlejar">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/AAS_singlejar</output-path>
|
||||
<root id="archive" name="AAS_NewGen.jar">
|
||||
<element id="module-output" name="AAS_NewGen" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-core/1.9.0/kotlinx-coroutines-core-1.9.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.9.0/kotlinx-coroutines-core-jvm-1.9.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/annotations/23.0.0/annotations-23.0.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/2.0.0/kotlin-stdlib-2.0.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/github/oshi/oshi-core/6.9.0/oshi-core-6.9.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/net/java/dev/jna/jna/5.17.0/jna-5.17.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/net/java/dev/jna/jna-platform/5.17.0/jna-platform-5.17.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/2.0.17/slf4j-api-2.0.17.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.42/lombok-1.18.42.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-5.3.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/xmlbeans-5.2.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-ooxml-5.3.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/log4j-api-2.23.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/SparseBitSet-1.3.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/commons-io-2.16.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-5.3.0-sources.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/commons-math3-3.6.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/commons-codec-1.17.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-ooxml-full-5.3.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/commons-compress-1.26.2.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-ooxml-5.3.0-sources.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-ooxml-schemas-4.1.2.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/commons-collections4-4.4.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-ooxml-full-5.3.0-sources.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/tinylog/tinylog-impl/2.7.0/tinylog-impl-2.7.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/tinylog/tinylog-api/2.7.0/tinylog-api-2.7.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/fasterxml/jackson/module/jackson-module-kotlin/2.17.2/jackson-module-kotlin-2.17.2.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.17.2/jackson-databind-2.17.2.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.17.2/jackson-core-2.17.2.jar" path-in-jar="/" />
|
||||
@@ -15,7 +37,6 @@
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.7.22/kotlin-stdlib-1.7.22.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-common/1.7.22/kotlin-stdlib-common-1.7.22.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/net/java/dev/jna/jna/5.18.1/jna-5.18.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/google/cloud/google-cloud-texttospeech/2.81.0/google-cloud-texttospeech-2.81.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/grpc/grpc-api/1.76.0/grpc-api-1.76.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar" path-in-jar="/" />
|
||||
@@ -66,11 +87,10 @@
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/opencensus/opencensus-contrib-http-util/0.31.1/opencensus-contrib-http-util-0.31.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/google/http-client/google-http-client-gson/2.0.2/google-http-client-gson-2.0.2.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/threeten/threetenbp/1.7.0/threetenbp-1.7.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/github/oshi/oshi-core/6.9.0/oshi-core-6.9.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/net/java/dev/jna/jna/5.17.0/jna-5.17.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/net/java/dev/jna/jna-platform/5.17.0/jna-platform-5.17.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/2.0.17/slf4j-api-2.0.17.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/slf4j/slf4j-simple/2.0.17/slf4j-simple-2.0.17.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/net/java/dev/jna/jna/5.18.1/jna-5.18.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/2.1.21/kotlin-stdlib-2.1.21.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/mysql/mysql-connector-j/8.4.0/mysql-connector-j-8.4.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/google/protobuf/protobuf-java/3.25.1/protobuf-java-3.25.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/io/javalin/javalin/6.7.0/javalin-6.7.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-server/11.0.25/jetty-server-11.0.25.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/eclipse/jetty/jetty-http/11.0.25/jetty-http-11.0.25.jar" path-in-jar="/" />
|
||||
@@ -90,26 +110,7 @@
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.9.25/kotlin-stdlib-jdk8-1.9.25.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.9.25/kotlin-stdlib-1.9.25.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.9.25/kotlin-stdlib-jdk7-1.9.25.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-5.3.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/xmlbeans-5.2.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-ooxml-5.3.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/log4j-api-2.23.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/SparseBitSet-1.3.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/commons-io-2.16.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-5.3.0-sources.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/commons-math3-3.6.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/commons-codec-1.17.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-ooxml-full-5.3.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/commons-compress-1.26.2.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-ooxml-5.3.0-sources.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-ooxml-schemas-4.1.2.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/commons-collections4-4.4.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/../../../../../../SLC/Apache POI/poi-ooxml-full-5.3.0-sources.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/2.1.21/kotlin-stdlib-2.1.21.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/tinylog/tinylog-impl/2.7.0/tinylog-impl-2.7.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/tinylog/tinylog-api/2.7.0/tinylog-api-2.7.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/mysql/mysql-connector-j/8.4.0/mysql-connector-j-8.4.0.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/com/google/protobuf/protobuf-java/3.25.1/protobuf-java-3.25.1.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$MAVEN_REPOSITORY$/org/slf4j/slf4j-simple/2.0.17/slf4j-simple-2.0.17.jar" path-in-jar="/" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
8
.idea/compiler.xml
generated
Normal file
8
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="true" />
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
||||
15
.idea/deployment.xml
generated
Normal file
15
.idea/deployment.xml
generated
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PublishConfigData" serverName="nuc" remoteFilesAllowedToDisappearOnAutoupload="false" confirmBeforeUploading="false">
|
||||
<option name="confirmBeforeUploading" value="false" />
|
||||
<serverData>
|
||||
<paths name="nuc">
|
||||
<serverdata>
|
||||
<mappings>
|
||||
<mapping deploy="/intellij_deploy" local="$PROJECT_DIR$" web="/" />
|
||||
</mappings>
|
||||
</serverdata>
|
||||
</paths>
|
||||
</serverData>
|
||||
</component>
|
||||
</project>
|
||||
10
.idea/libraries/projectlombok_lombok.xml
generated
Normal file
10
.idea/libraries/projectlombok_lombok.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<component name="libraryTable">
|
||||
<library name="projectlombok.lombok" type="repository">
|
||||
<properties maven-id="org.projectlombok:lombok:1.18.42" />
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/projectlombok/lombok/1.18.42/lombok-1.18.42.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
8
.idea/sshConfigs.xml
generated
Normal file
8
.idea/sshConfigs.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SshConfigs">
|
||||
<configs>
|
||||
<sshConfig authType="PASSWORD" host="192.168.10.3" id="bb74f881-8351-4bff-9594-9d4f5045bf2e" port="22" nameFormat="DESCRIPTIVE" username="nucdev" useOpenSSHConfig="true" />
|
||||
</configs>
|
||||
</component>
|
||||
</project>
|
||||
14
.idea/webServers.xml
generated
Normal file
14
.idea/webServers.xml
generated
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="WebServers">
|
||||
<option name="servers">
|
||||
<webServer id="ed92efbc-e851-4cae-9e0f-ad0acf543f07" name="nuc">
|
||||
<fileTransfer rootFolder="/home/nucdev" accessType="SFTP" host="192.168.10.3" port="22" sshConfigId="bb74f881-8351-4bff-9594-9d4f5045bf2e" sshConfig="nucdev@192.168.10.3:22 password">
|
||||
<advancedOptions>
|
||||
<advancedOptions dataProtectionLevel="Private" keepAliveTimeout="0" passiveMode="true" shareSSLContext="true" isUseRsync="true" />
|
||||
</advancedOptions>
|
||||
</fileTransfer>
|
||||
</webServer>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@@ -37,5 +37,6 @@
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="library" name="google.cloud.texttospeech" level="project" />
|
||||
<orderEntry type="library" name="projectlombok.lombok" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -123,12 +123,13 @@ $(document).ready(function () {
|
||||
categories.forEach(cat => {
|
||||
if ("Phrase" === cat) return; // skip Phrase category
|
||||
if ("Airline_Code" === cat) cat = "Flight_Number"; // revisi 15012026 karena inconsistensi penamaan tag
|
||||
if ("Gate" === cat) cat = "GateNumber"; // revisi 03202026 karena inconsistensi penamaan tag
|
||||
let displayCat = `[${cat}]`.toUpperCase();
|
||||
$messageavailablevariables.append(new Option(text = displayCat, value = displayCat));
|
||||
$messageavailablevariables.append(new Option(text = displayCat, value = displayCat, title = displayCat));
|
||||
});
|
||||
// tambah [ETAD], [BCB] revisi 19012026
|
||||
$messageavailablevariables.append(new Option(text = '[ETAD]', value = '[ETAD]'));
|
||||
$messageavailablevariables.append(new Option(text = '[BCB]', value = '[BCB]'));
|
||||
$messageavailablevariables.append(new Option(text = '[ETAD]', value = '[ETAD]', title = '[ETAD]'));
|
||||
$messageavailablevariables.append(new Option(text = '[BCB]', value = '[BCB]', title = '[BCB]'));
|
||||
|
||||
let lang = $messagelanguage.val();
|
||||
let vt = $messagevoicetype.val();
|
||||
@@ -179,7 +180,9 @@ $(document).ready(function () {
|
||||
|
||||
// iterate messageselectedvariables children
|
||||
$messageselectedvariables.children().each(function () {
|
||||
let text = $(this).text().trim();
|
||||
// text got from title
|
||||
// value got from value
|
||||
let text = $(this).prop('title').trim();
|
||||
let value = $(this).val().trim();
|
||||
console.log('selected text:' + text + ', value:' + value);
|
||||
if (text.length > 0) {
|
||||
@@ -398,9 +401,12 @@ $(document).ready(function () {
|
||||
if (tagLower === "[airline_code]") {
|
||||
tagLower = "[flight_number]";
|
||||
}
|
||||
if (tagLower === "[gatenumber]") {
|
||||
tagLower = "[gate]";
|
||||
}
|
||||
|
||||
// revisi 03022026 karena malah bikin kacau di semi auto
|
||||
// if (tagLower === "[gatenumber]") {
|
||||
// tagLower = "[gate]";
|
||||
// }
|
||||
|
||||
// find <option> in messageavailablevariables with value=tag
|
||||
$messageavailablevariables.find('option').each(function () {
|
||||
let valx = $(this).val().toLowerCase();
|
||||
|
||||
@@ -304,13 +304,7 @@ function LiveAudioCommand(command, bz, cbOK = null, cbFail = null) {
|
||||
window.streamws = null;
|
||||
window.mediasource = null;
|
||||
|
||||
/**
|
||||
* handler for ws_connected, ws_disconnected, ws_message events
|
||||
*/
|
||||
|
||||
ws_connected_handler;
|
||||
ws_disconnected_handler;
|
||||
ws_message_handler;
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
@@ -434,26 +428,22 @@ $(document).ready(function () {
|
||||
|
||||
runIntervalJob();
|
||||
|
||||
if (!ws_connected_handler) {
|
||||
ws_connected_handler = function () {
|
||||
console.log("overview.js ws_connected event triggered");
|
||||
runIntervalJob();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
if (!ws_disconnected_handler) {
|
||||
ws_disconnected_handler = function () {
|
||||
console.log("overview.js ws_disconnected event triggered");
|
||||
|
||||
window.addEventListener('ws_connected', () =>{
|
||||
console.log("overview.js ws_connected event triggered");
|
||||
runIntervalJob();
|
||||
});
|
||||
window.addEventListener('ws_disconnected', ()=>{
|
||||
console.log("overview.js ws_disconnected event triggered");
|
||||
if (intervaljob1) clearInterval(intervaljob1);
|
||||
if (intervaljob2) clearInterval(intervaljob2);
|
||||
intervaljob1 = null;
|
||||
intervaljob2 = null;
|
||||
};
|
||||
}
|
||||
|
||||
if (!ws_message_handler) {
|
||||
ws_message_handler = function (event) {
|
||||
let rep = event.detail;
|
||||
});
|
||||
window.addEventListener('ws_message', ()=>{
|
||||
let rep = event.detail;
|
||||
let cmd = rep.reply;
|
||||
let data = rep.data;
|
||||
if (cmd && cmd.length > 0) {
|
||||
@@ -483,15 +473,7 @@ $(document).ready(function () {
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
window.removeEventListener('ws_connected', ws_connected_handler);
|
||||
window.removeEventListener('ws_disconnected', ws_disconnected_handler);
|
||||
window.removeEventListener('ws_message', ws_message_handler);
|
||||
window.addEventListener('ws_connected', ws_connected_handler);
|
||||
window.addEventListener('ws_disconnected', ws_disconnected_handler);
|
||||
window.addEventListener('ws_message', ws_message_handler);
|
||||
});
|
||||
|
||||
$(window).on('beforeunload', function () {
|
||||
console.log("overview.js beforeunload event triggered");
|
||||
|
||||
@@ -363,11 +363,6 @@ $(document).ready(function () {
|
||||
//console.log("Selected airline tags: ", selected_airlinetags);
|
||||
//console.log("Selected city tags: ", selected_citytags);
|
||||
|
||||
if (selected_airlinetags.length == 0 || selected_citytags.length == 0) {
|
||||
alert("Please select at least one airline tag and one city tag.");
|
||||
return;
|
||||
}
|
||||
|
||||
let airlinevalue = selected_airlinetags.join(";");
|
||||
let cityvalue = selected_citytags.join(";");
|
||||
$('#modalairlinetags').val(airlinevalue);
|
||||
@@ -401,10 +396,7 @@ $(document).ready(function () {
|
||||
selected_messagebankids.push($(this).val());
|
||||
});
|
||||
//console.log("Selected message bank IDs: ", selected_messagebankids);
|
||||
if (selected_messagebankids.length == 0) {
|
||||
alert("Please select at least one message bank ID.");
|
||||
return;
|
||||
}
|
||||
|
||||
let messagebankvalue = selected_messagebankids.join(";");
|
||||
$('#modalmessagebank').val(messagebankvalue);
|
||||
|
||||
@@ -470,23 +462,28 @@ $(document).ready(function () {
|
||||
alert("Password and Verify Password do not match");
|
||||
return;
|
||||
}
|
||||
if (airline_tags.length === 0) {
|
||||
alert("Airline tags cannot be empty");
|
||||
return;
|
||||
}
|
||||
if (city_tags.length === 0) {
|
||||
alert("City tags cannot be empty");
|
||||
return;
|
||||
}
|
||||
if (messagebank_ann_id.length === 0) {
|
||||
alert("Message bank ANN_ID cannot be empty");
|
||||
return;
|
||||
}
|
||||
|
||||
if (broadcastzones.length === 0) {
|
||||
alert("Broadcast zones cannot be empty");
|
||||
return;
|
||||
}
|
||||
|
||||
// bisa empty, kalau user untuk paging saja
|
||||
// revisi 30012026
|
||||
// if (airline_tags.length === 0) {
|
||||
// alert("Airline tags cannot be empty");
|
||||
// return;
|
||||
// }
|
||||
// if (city_tags.length === 0) {
|
||||
// alert("City tags cannot be empty");
|
||||
// return;
|
||||
// }
|
||||
// if (messagebank_ann_id.length === 0) {
|
||||
// alert("Message bank ANN_ID cannot be empty");
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* @type {UserDB}
|
||||
*/
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
libs/linux-x86-64/libSecureDongle.so
Normal file
BIN
libs/linux-x86-64/libSecureDongle.so
Normal file
Binary file not shown.
BIN
libs/linux-x86/libSecureDongle.so
Normal file
BIN
libs/linux-x86/libSecureDongle.so
Normal file
Binary file not shown.
BIN
libs/win32-x86-64/SecureDongle.dll
Normal file
BIN
libs/win32-x86-64/SecureDongle.dll
Normal file
Binary file not shown.
BIN
libs/win32-x86/SecureDongle.dll
Normal file
BIN
libs/win32-x86/SecureDongle.dll
Normal file
Binary file not shown.
42
src/Main.kt
42
src/Main.kt
@@ -39,7 +39,7 @@ lateinit var audioPlayer: AudioPlayer
|
||||
val StreamerOutputs: MutableMap<String, BarixConnection> = HashMap()
|
||||
lateinit var udpreceiver: UDPReceiver
|
||||
lateinit var tcpreceiver: TCPReceiver
|
||||
const val version = "0.0.23 (29/01/2026)"
|
||||
const val version = "0.0.26 (02/02/2026)"
|
||||
// AAS 64 channels
|
||||
const val max_channel = 64
|
||||
|
||||
@@ -79,7 +79,7 @@ fun folder_preparation(){
|
||||
|
||||
private fun Extract_Libraries() {
|
||||
// extract from source root folder to current user dir
|
||||
val libs = listOf("bass", "bassenc", "bassenc_mp3","bassenc_ogg","bassenc_opus","bassmix","bassopus","sdx")
|
||||
val libs = listOf("bass", "bassenc", "bassenc_mp3","bassenc_ogg","bassenc_opus","bassmix","bassopus","SecureDongle")
|
||||
try{
|
||||
val targetfolder = File(Somecodes.current_directory)
|
||||
Logger.info {"target to extract libraries : $targetfolder"}
|
||||
@@ -87,8 +87,13 @@ private fun Extract_Libraries() {
|
||||
|
||||
val x = Native.extractFromResourcePath(ff)
|
||||
val y = System.mapLibraryName(ff)
|
||||
val z = x.copyTo(targetfolder.resolve(y),overwrite = true)
|
||||
Logger.info {"Extracted libraries : $z"}
|
||||
if (targetfolder.resolve(y).exists()){
|
||||
Logger.info{"Library $y already exists, skipping extraction."}
|
||||
} else {
|
||||
val z = x.copyTo(targetfolder.resolve(y),overwrite = true)
|
||||
Logger.info {"Extracted libraries : $z"}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e : Exception){
|
||||
Logger.error { "Error extracting libraries, msg : ${e.message}" }
|
||||
@@ -122,10 +127,15 @@ fun files_preparation(){
|
||||
}
|
||||
|
||||
lateinit var config : configFile
|
||||
//val sdx = DongleChecker()
|
||||
val sdx = DongleChecker()
|
||||
// Application start here
|
||||
fun main() {
|
||||
fun main(args: Array<String>) {
|
||||
|
||||
args.forEach { str ->
|
||||
if ("--bypass-dongle" == str.lowercase()){
|
||||
sdx.BypassDongle = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -140,15 +150,15 @@ fun main() {
|
||||
folder_preparation()
|
||||
Extract_Libraries()
|
||||
|
||||
// if (!sdx.CheckDongle()){
|
||||
// Logger.error { "Dongle check failed. Application will exit." }
|
||||
// exitProcess(1)
|
||||
// } else {
|
||||
// sdx.startChecking {
|
||||
// Logger.error { "Dongle removed. Application will exit." }
|
||||
// exitProcess(1)
|
||||
// }
|
||||
// }
|
||||
if (!sdx.CheckDongle()){
|
||||
Logger.error { "Dongle check failed. Application will exit." }
|
||||
exitProcess(1)
|
||||
} else {
|
||||
sdx.startChecking {
|
||||
Logger.error { "Dongle removed. Application will exit." }
|
||||
exitProcess(1)
|
||||
}
|
||||
}
|
||||
|
||||
audioPlayer = AudioPlayer(44100) // 44100 Hz sampling rate
|
||||
audioPlayer.InitAudio(1)
|
||||
@@ -287,7 +297,7 @@ fun main() {
|
||||
StreamerOutputs.values.forEach { it.close() }
|
||||
audioPlayer.Close()
|
||||
db.close()
|
||||
//sdx.stopChecking()
|
||||
sdx.stopChecking()
|
||||
|
||||
Logger.info { "All services stopped, exiting application." }
|
||||
ProviderRegistry.getLoggingProvider().shutdown()
|
||||
|
||||
@@ -60,6 +60,7 @@ class MainExtension01 {
|
||||
}
|
||||
|
||||
}
|
||||
//TODO buat log lebih informatif
|
||||
if (validbz.size == bz.size) {
|
||||
return true
|
||||
} else Logger.error { "Some requested broadcast zones are not registered in BroadcastZone table" }
|
||||
@@ -601,15 +602,17 @@ class MainExtension01 {
|
||||
db.queuepagingDB.Resort()
|
||||
db.Add_Log(
|
||||
"AAS",
|
||||
"Cancelled paging message with index ${qp.index} due to invalid audio file"
|
||||
"Cancelled paging message $qp due to invalid audio file"
|
||||
)
|
||||
Logger.error { "Cancelled paging message $qp due to invalid audio file" }
|
||||
}
|
||||
} // kalau enggak semua streamer idle, skip dulu
|
||||
} else {
|
||||
// ada broadcast zone yang tidak valid, delete from queue paging
|
||||
db.queuepagingDB.DeleteByIndex(qp.index.toInt())
|
||||
db.queuepagingDB.Resort()
|
||||
db.Add_Log("AAS", "Cancelled paging message with index ${qp.index} due to invalid broadcast zone")
|
||||
db.Add_Log("AAS", "Cancelled paging message $qp due to invalid broadcast zone")
|
||||
Logger.error { "Cancelled paging message $qp due to invalid broadcast zone" }
|
||||
}
|
||||
} else {
|
||||
// file tidak valid, delete from queue paging
|
||||
@@ -617,14 +620,16 @@ class MainExtension01 {
|
||||
db.queuepagingDB.Resort()
|
||||
db.Add_Log(
|
||||
"AAS",
|
||||
"Cancelled paging message with index ${qp.index} due to invalid audio file"
|
||||
"Cancelled paging message $qp due to invalid audio file"
|
||||
)
|
||||
Logger.error { "Cancelled paging message $qp due to invalid audio file" }
|
||||
}
|
||||
} else {
|
||||
// invalid broadcast zone, delete from queue paging
|
||||
db.queuepagingDB.DeleteByIndex(qp.index.toInt())
|
||||
db.queuepagingDB.Resort()
|
||||
db.Add_Log("AAS", "Cancelled paging message with index ${qp.index} due to empty broadcast zone")
|
||||
db.Add_Log("AAS", "Cancelled paging message $qp due to empty broadcast zone")
|
||||
Logger.error { "Cancelled paging message $qp due to empty broadcast zone" }
|
||||
}
|
||||
}
|
||||
return false
|
||||
@@ -718,8 +723,9 @@ class MainExtension01 {
|
||||
db.queuepagingDB.Resort()
|
||||
db.Add_Log(
|
||||
"AAS",
|
||||
"Cancelled Shalat message with index ${qp.index} due to ANN_ID $ann_id not found in Messagebank"
|
||||
"Cancelled Shalat message $qp due to ANN_ID $ann_id not found in Messagebank"
|
||||
)
|
||||
Logger.error { "Cancelled Shalat message $qp due to ANN_ID $ann_id not found in Messagebank" }
|
||||
}
|
||||
} // kalau enggak semua streamer idle, skip dulu
|
||||
|
||||
@@ -727,19 +733,22 @@ class MainExtension01 {
|
||||
// invalid ann_id, delete from queue paging
|
||||
db.queuepagingDB.DeleteByIndex(qp.index.toInt())
|
||||
db.queuepagingDB.Resort()
|
||||
db.Add_Log("AAS", "Cancelled shalat message with index ${qp.index} due to invalid ANN_ID")
|
||||
db.Add_Log("AAS", "Cancelled shalat message $qp due to invalid ANN_ID")
|
||||
Logger.error { "Cancelled shalat message $qp due to invalid ANN_ID" }
|
||||
}
|
||||
} else {
|
||||
// ada broadcast zone yang tidak valid, delete from queue paging
|
||||
db.queuepagingDB.DeleteByIndex(qp.index.toInt())
|
||||
db.queuepagingDB.Resort()
|
||||
db.Add_Log("AAS", "Cancelled shalat message with index ${qp.index} due to invalid broadcast zone")
|
||||
db.Add_Log("AAS", "Cancelled shalat message $qp due to invalid broadcast zone")
|
||||
Logger.error { "Cancelled shalat message $qp due to invalid broadcast zone" }
|
||||
}
|
||||
} else {
|
||||
// invalid broadcast zone, delete from queue paging
|
||||
db.queuepagingDB.DeleteByIndex(qp.index.toInt())
|
||||
db.queuepagingDB.Resort()
|
||||
db.Add_Log("AAS", "Cancelled shalat message with index ${qp.index} due to empty broadcast zone")
|
||||
db.Add_Log("AAS", "Cancelled shalat message $qp due to empty broadcast zone")
|
||||
Logger.error { "Cancelled shalat message $qp due to empty broadcast zone" }
|
||||
}
|
||||
}
|
||||
return false
|
||||
@@ -823,8 +832,9 @@ class MainExtension01 {
|
||||
db.queuetableDB.Resort()
|
||||
db.Add_Log(
|
||||
"AAS",
|
||||
"Cancelled TIMER with index ${qa.index} due to ANN_ID $ann_id not found in Messagebank"
|
||||
"Cancelled TIMER $qa due to ANN_ID $ann_id not found in Messagebank"
|
||||
)
|
||||
Logger.error { "Cancelled TIMER $qa due to ANN_ID $ann_id not found in Messagebank" }
|
||||
}
|
||||
} // kalau enggak semua streamer idle, skip dulu
|
||||
|
||||
@@ -832,19 +842,22 @@ class MainExtension01 {
|
||||
// invalid ann_id, delete from queue table
|
||||
db.queuetableDB.DeleteByIndex(qa.index.toInt())
|
||||
db.queuetableDB.Resort()
|
||||
db.Add_Log("AAS", "Cancelled TIMER message with index ${qa.index} due to invalid ANN_ID")
|
||||
db.Add_Log("AAS", "Cancelled TIMER message $qa due to invalid ANN_ID")
|
||||
Logger.error { "Cancelled TIMER message $qa due to invalid ANN_ID" }
|
||||
}
|
||||
} else {
|
||||
// ada broadcast zone yang tidak valid, delete from queue table
|
||||
db.queuetableDB.DeleteByIndex(qa.index.toInt())
|
||||
db.queuetableDB.Resort()
|
||||
db.Add_Log("AAS", "Cancelled TIMER message with index ${qa.index} due to invalid broadcast zone")
|
||||
db.Add_Log("AAS", "Cancelled TIMER message $qa due to invalid broadcast zone")
|
||||
Logger.error {"Cancelled TIMER message $qa due to invalid broadcast zone"}
|
||||
}
|
||||
} else {
|
||||
// invalid broadcast zone, delete from queue table
|
||||
db.queuetableDB.DeleteByIndex(qa.index.toInt())
|
||||
db.queuetableDB.Resort()
|
||||
db.Add_Log("AAS", "Cancelled TIMER message with index ${qa.index} due to empty broadcast zone")
|
||||
db.Add_Log("AAS", "Cancelled TIMER message $qa due to empty broadcast zone")
|
||||
Logger.error { "Cancelled TIMER message $qa due to empty broadcast zone" }
|
||||
}
|
||||
}
|
||||
return false
|
||||
@@ -897,36 +910,54 @@ class MainExtension01 {
|
||||
val variables = Get_Soundbank_Data(qa.SB_TAGS)
|
||||
val languages = qa.Language.split(";")
|
||||
// cek apakah ANN_ID ada di SB_TAGS
|
||||
if (variables!=null){
|
||||
Logger.info{"SB_TAGS variables: $variables"}
|
||||
} else{
|
||||
Logger.info{"No SB_TAGS variables found"}
|
||||
}
|
||||
|
||||
var ann_id = variables?.get("ANN_ID")?.toIntOrNull() ?: 0
|
||||
|
||||
if (ann_id==0){
|
||||
// not available from variables, try to get from Message column
|
||||
// ada ini, karena protokol FIS dulu tidak ada ANN_ID tapi pake Remark
|
||||
val remark = variables?.get("REMARK").orEmpty()
|
||||
db.Add_Log("AAS", "Trying to get ANN_ID from REMARK field: $remark")
|
||||
Logger.info{ "Trying to get ANN_ID from REMARK field: $remark" }
|
||||
when(remark){
|
||||
"GOP" -> {
|
||||
val remarkMsg = config.Get(configKeys.REMARK_GOP.key)
|
||||
Logger.info{"Remark message for GOP: $remarkMsg"}
|
||||
ann_id = Regex("\\[(\\d+)]").find(remarkMsg)?.value?.toIntOrNull() ?: 0
|
||||
}
|
||||
"GBD" ->{
|
||||
val remarkMsg = config.Get(configKeys.REMARK_GBD.key)
|
||||
Logger.info{"Remark message for GBD: $remarkMsg"}
|
||||
ann_id = Regex("\\[(\\d+)]").find(remarkMsg)?.value?.toIntOrNull() ?: 0
|
||||
}
|
||||
"GFC" ->{
|
||||
val remarkMsg = config.Get(configKeys.REMARK_GFC.key)
|
||||
Logger.info{"Remark message for GFC: $remarkMsg"}
|
||||
ann_id = Regex("\\[(\\d+)]").find(remarkMsg)?.value?.toIntOrNull() ?: 0
|
||||
}
|
||||
"FLD" ->{
|
||||
val remarkMsg = config.Get(configKeys.REMARK_FLD.key)
|
||||
Logger.info{"Remark message for FLD: $remarkMsg"}
|
||||
ann_id = Regex("\\[(\\d+)]").find(remarkMsg)?.value?.toIntOrNull() ?: 0
|
||||
}
|
||||
}
|
||||
Logger.info{"Found ANN_ID from REMARK field: $ann_id" }
|
||||
db.Add_Log("AAS", "Found ANN_ID from REMARK field: $ann_id")
|
||||
} else {
|
||||
db.Add_Log("AAS", "Found ANN_ID from SB_TAGS variables: $ann_id")
|
||||
Logger.info{ "Found ANN_ID from SB_TAGS variables: $ann_id" }
|
||||
}
|
||||
|
||||
// recheck again
|
||||
if (ann_id == 0) {
|
||||
db.Add_Log(
|
||||
"AAS",
|
||||
"Cancelled SOUNDBANK message with index ${qa.index} due to missing or invalid ANN_ID in SB_TAGS"
|
||||
"Cancelled SOUNDBANK message $qa due to missing or invalid ANN_ID in SB_TAGS"
|
||||
)
|
||||
db.queuetableDB.DeleteByIndex(qa.index.toInt())
|
||||
db.queuetableDB.Resort()
|
||||
@@ -1011,8 +1042,9 @@ class MainExtension01 {
|
||||
db.queuetableDB.Resort()
|
||||
db.Add_Log(
|
||||
"AAS",
|
||||
"Cancelled SOUNDBANK message with index ${qa.index} due to ANN_ID $ann_id not found in Messagebank"
|
||||
"Cancelled SOUNDBANK message $qa due to ANN_ID $ann_id not found in Messagebank"
|
||||
)
|
||||
Logger.error { "Cancelled SOUNDBANK message $qa due to ANN_ID $ann_id not found in Messagebank" }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1021,13 +1053,15 @@ class MainExtension01 {
|
||||
// ada broadcast zone yang tidak valid, delete from queue table
|
||||
db.queuetableDB.DeleteByIndex(qa.index.toInt())
|
||||
db.queuetableDB.Resort()
|
||||
db.Add_Log("AAS", "Cancelled SOUNDBANK message with index ${qa.index} due to invalid broadcast zone")
|
||||
db.Add_Log("AAS", "Cancelled SOUNDBANK message $qa due to invalid broadcast zone")
|
||||
Logger.error { "Cancelled SOUNDBANK message $qa due to invalid broadcast zone" }
|
||||
}
|
||||
} else {
|
||||
// invalid broadcast zone, delete from queue table
|
||||
db.queuetableDB.DeleteByIndex(qa.index.toInt())
|
||||
db.queuetableDB.Resort()
|
||||
db.Add_Log("AAS", "Cancelled SOUNDBANK message with index ${qa.index} due to empty broadcast zone")
|
||||
db.Add_Log("AAS", "Cancelled SOUNDBANK message $qa due to empty broadcast zone")
|
||||
Logger.error { "Cancelled SOUNDBANK message $qa due to empty broadcast zone" }
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
||||
@@ -158,6 +158,14 @@ class AudioPlayer (var samplingrate: Int = 44100) {
|
||||
|
||||
var all_success = true
|
||||
|
||||
// revisi 03022026, tambah silence1s at beginning
|
||||
val silence = contentCache.getAudioFile("silence1s")
|
||||
if (silence!=null && silence.isValid()){
|
||||
if (!pushData(silence.bytes)){
|
||||
Logger.error { "Failed to push initial Silence 1s" }
|
||||
}
|
||||
} else Logger.error { "silence1s not loaded at contentcache" }
|
||||
|
||||
if (withChime){
|
||||
val chup = contentCache.getAudioFile("chimeup")
|
||||
if (chup!=null && chup.isValid()){
|
||||
@@ -252,9 +260,16 @@ class AudioPlayer (var samplingrate: Int = 44100) {
|
||||
return pushresult != -1
|
||||
}
|
||||
|
||||
|
||||
|
||||
var allsuccess = true
|
||||
|
||||
// revisi 03022026, tambah silence1s at beginning
|
||||
val silence = contentCache.getAudioFile("silence1s")
|
||||
if (silence!=null && silence.isValid()){
|
||||
if (!pushData(silence.bytes)){
|
||||
Logger.error { "Failed to push initial Silence 1s" }
|
||||
}
|
||||
} else Logger.error { "silence1s not loaded at contentcache" }
|
||||
|
||||
if (withChime){
|
||||
val chup = contentCache.getAudioFile("chimeup")
|
||||
if (chup!=null && chup.isValid()){
|
||||
|
||||
@@ -196,6 +196,14 @@ class Somecodes {
|
||||
return byteArray
|
||||
}
|
||||
|
||||
fun ToShort(value : String) : Short{
|
||||
return try {
|
||||
value.toShort()
|
||||
} catch (_ : Exception){
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
fun LibraryFullPath(libname: String) : String{
|
||||
val ff = File(current_directory, System.mapLibraryName(libname))
|
||||
return if (ff.isFile) ff.absolutePath else ""
|
||||
@@ -486,7 +494,7 @@ class Somecodes {
|
||||
* @param values The list of strings to check.
|
||||
* @return True if all strings in the list are valid non-blank strings, false otherwise.
|
||||
*/
|
||||
fun ValidStrings(values: List<String>) : Boolean{
|
||||
fun ValidStrings(vararg values:String) : Boolean{
|
||||
if (values.isNotEmpty()){
|
||||
for (v in values){
|
||||
if (!ValidString(v)){
|
||||
@@ -498,6 +506,8 @@ class Somecodes {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun FilenameWithoutExtension(ff : File) : String{
|
||||
val name = ff.name
|
||||
val lastDotIndex = name.lastIndexOf('.')
|
||||
|
||||
@@ -72,11 +72,18 @@ class TCP_Android_Command_Server {
|
||||
//println("Received command from $key : $str")
|
||||
str.split("@").map { it.trim() }.filter { ValidString(it) }
|
||||
.forEach {
|
||||
Logger.info{"Receive command from $key : $it"}
|
||||
process_command(key,it) { reply ->
|
||||
try {
|
||||
dout.write(String_to_Byte_Android(reply))
|
||||
val cc = String_to_Byte_Android(reply)
|
||||
if (cc.isNotEmpty()){
|
||||
dout.write(cc)
|
||||
dout.flush()
|
||||
Logger.info{"Sent reply ${cc.size} bytes to $key : $reply"}
|
||||
} else Logger.error { "Empty reply to send to $key" }
|
||||
|
||||
} catch (e: Exception) {
|
||||
logcb.accept("Failed to send reply to $key, Message : $e")
|
||||
logcb.accept("Send reply to $key failed, reply=$reply, Message : $e")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,12 +129,14 @@ class TCP_Android_Command_Server {
|
||||
*/
|
||||
private fun String_to_Byte_Android(str: String): ByteArray {
|
||||
if (ValidString(str)) {
|
||||
val bytes = str.toByteArray(Charsets.UTF_8)
|
||||
val len = bytes.size
|
||||
|
||||
val bytes = str.toByteArray()
|
||||
val len = str.length
|
||||
|
||||
return ByteBuffer.allocate(len + 4)
|
||||
.order(ByteOrder.LITTLE_ENDIAN)
|
||||
.putInt(len)
|
||||
.put(bytes)
|
||||
.putInt(0,len)
|
||||
.put(4,bytes)
|
||||
.array()
|
||||
}
|
||||
return ByteArray(0)
|
||||
@@ -169,6 +178,11 @@ class TCP_Android_Command_Server {
|
||||
}
|
||||
}
|
||||
|
||||
"PING" -> {
|
||||
// simple ping command
|
||||
cb.accept("PONG@")
|
||||
}
|
||||
|
||||
"PCMFILE_START" ->{
|
||||
// start sending PCM data from Android for paging
|
||||
val size = parts.getOrElse(1) { "0" }.toInt()
|
||||
@@ -211,6 +225,7 @@ class TCP_Android_Command_Server {
|
||||
Logger.info { "Paging job closed from Android $key, total bytes received ${data.size}, writing to file ${pj.filePath.absolutePathString()}" }
|
||||
val result = audioPlayer.WavWriter(data, pj.filePath.absolutePathString(), true)
|
||||
if (result.success) {
|
||||
Logger.info{"Paging audio file written from Android $key to ${pj.filePath.absolutePathString()}"}
|
||||
val qp = QueuePaging(
|
||||
0u,
|
||||
LocalDateTime.now().format(datetimeformat1),
|
||||
@@ -219,6 +234,7 @@ class TCP_Android_Command_Server {
|
||||
pj.filePath.absolutePathString(),
|
||||
pj.broadcastzones
|
||||
)
|
||||
Logger.info{"Inserting paging audio to queue paging table from Android $key, data=$qp"}
|
||||
if (db.queuepagingDB.Add(qp)) {
|
||||
db.queuepagingDB.Resort()
|
||||
logcb.accept("Paging audio inserted to queue paging table from Android $key, file ${pj.filePath.absolutePathString()}")
|
||||
@@ -334,8 +350,10 @@ class TCP_Android_Command_Server {
|
||||
.forEach { annid ->
|
||||
// masukin ke VARMESSAGES yang unik secara ANN_ID dan Language
|
||||
val xx = db.messageDB.List
|
||||
.filter{ it.ANN_ID == annid.toUInt() }
|
||||
.asSequence()
|
||||
.filter{it.ANN_ID == annid.toUInt()}
|
||||
.distinctBy { it.ANN_ID }
|
||||
|
||||
VARMESSAGES.addAll(xx)
|
||||
}
|
||||
result.append(VARMESSAGES.size).append("@")
|
||||
|
||||
@@ -89,6 +89,12 @@ class MariaDB(
|
||||
Logger.info("Connected to MySQL" as Any)
|
||||
connected = true
|
||||
|
||||
// create databas 'aas' if not exists
|
||||
val statement = connection.createStatement()
|
||||
statement.executeUpdate("CREATE DATABASE IF NOT EXISTS aas")
|
||||
statement.executeUpdate("USE aas")
|
||||
|
||||
|
||||
soundDB = object : dbFunctions<Soundbank>("soundbank", connection, listOf("index", "Description", "TAG", "Category", "Language", "VoiceType", "Path")) {
|
||||
|
||||
override fun Create() {
|
||||
@@ -104,7 +110,7 @@ class MariaDB(
|
||||
super.Create(tabledefinition)
|
||||
}
|
||||
|
||||
override fun Get() {
|
||||
override fun Get(cbOK: Consumer<Unit>?, cbFail: Consumer<String>?) {
|
||||
List.clear()
|
||||
try {
|
||||
val statement = connection.createStatement()
|
||||
@@ -121,8 +127,10 @@ class MariaDB(
|
||||
)
|
||||
List.add(soundbank)
|
||||
}
|
||||
cbOK?.accept(Unit)
|
||||
} catch (e: Exception) {
|
||||
Logger.error("Error fetching soundbanks: ${e.message}" as Any)
|
||||
cbFail?.accept("Error fetching ${super.dbName} : ${e.message}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,7 +343,7 @@ class MariaDB(
|
||||
super.Create(tabledefinition)
|
||||
}
|
||||
|
||||
override fun Get() {
|
||||
override fun Get(cbOK: Consumer<Unit>?, cbFail: Consumer<String>?) {
|
||||
List.clear()
|
||||
try {
|
||||
val statement = connection.createStatement()
|
||||
@@ -353,8 +361,10 @@ class MariaDB(
|
||||
|
||||
List.add(messagebank)
|
||||
}
|
||||
cbOK?.accept(Unit)
|
||||
} catch (e: Exception) {
|
||||
Logger.error("Error fetching ${super.dbName} : ${e.message}" as Any)
|
||||
cbFail?.accept("Error fetching ${super.dbName} : ${e.message}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,7 +566,7 @@ class MariaDB(
|
||||
super.Create(tabledefinition)
|
||||
}
|
||||
|
||||
override fun Get() {
|
||||
override fun Get(cbOK: Consumer<Unit>?, cbFail: Consumer<String>?) {
|
||||
List.clear()
|
||||
try {
|
||||
val statement = connection.createStatement()
|
||||
@@ -569,8 +579,10 @@ class MariaDB(
|
||||
)
|
||||
List.add(languageLink)
|
||||
}
|
||||
cbOK?.accept(Unit)
|
||||
} catch (e: Exception) {
|
||||
Logger.error("Error fetching ${super.dbName} : ${e.message}" as Any)
|
||||
cbFail?.accept("Error fetching ${super.dbName} : ${e.message}" )
|
||||
}
|
||||
}
|
||||
|
||||
@@ -739,7 +751,7 @@ class MariaDB(
|
||||
super.Create(tabledefinition)
|
||||
}
|
||||
|
||||
override fun Get() {
|
||||
override fun Get(cbOK: Consumer<Unit>?, cbFail: Consumer<String>?) {
|
||||
List.clear()
|
||||
try {
|
||||
val statement = connection.createStatement()
|
||||
@@ -758,8 +770,10 @@ class MariaDB(
|
||||
)
|
||||
List.add(schedulebank)
|
||||
}
|
||||
cbOK?.accept(Unit)
|
||||
} catch (e: Exception) {
|
||||
Logger.error("Error fetching ${super.dbName}: ${e.message}" as Any)
|
||||
cbFail?.accept("Error fetching ${super.dbName}: ${e.message}" )
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1019,7 +1033,7 @@ class MariaDB(
|
||||
super.Create(tabledefinition)
|
||||
}
|
||||
|
||||
override fun Get() {
|
||||
override fun Get(cbOK: Consumer<Unit>?, cbFail: Consumer<String>?) {
|
||||
List.clear()
|
||||
try {
|
||||
val statement = connection.createStatement()
|
||||
@@ -1034,8 +1048,10 @@ class MariaDB(
|
||||
)
|
||||
List.add(zone)
|
||||
}
|
||||
cbOK?.accept(Unit)
|
||||
} catch (e: Exception) {
|
||||
Logger.error("Error fetching ${super.dbName} : ${e.message}" as Any)
|
||||
cbFail?.accept("Error fetching ${super.dbName} : ${e.message}" )
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1214,7 +1230,7 @@ class MariaDB(
|
||||
super.Create(tabledefinition)
|
||||
}
|
||||
|
||||
override fun Get() {
|
||||
override fun Get(cbOK: Consumer<Unit>?, cbFail: Consumer<String>?) {
|
||||
List.clear()
|
||||
val queueList = ArrayList<QueueTable>()
|
||||
try {
|
||||
@@ -1235,8 +1251,10 @@ class MariaDB(
|
||||
queueList.add(queueTable)
|
||||
List.add(queueTable)
|
||||
}
|
||||
cbOK?.accept(Unit)
|
||||
} catch (e: Exception) {
|
||||
Logger.error("Error fetching ${super.dbName} : ${e.message}" as Any)
|
||||
cbFail?.accept("Error fetching ${super.dbName} : ${e.message}" )
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1385,7 +1403,7 @@ class MariaDB(
|
||||
super.Create(tabledefinition)
|
||||
}
|
||||
|
||||
override fun Get() {
|
||||
override fun Get(cbOK: Consumer<Unit>?, cbFail: Consumer<String>?) {
|
||||
List.clear()
|
||||
val queueList = ArrayList<QueuePaging>()
|
||||
try {
|
||||
@@ -1403,8 +1421,10 @@ class MariaDB(
|
||||
queueList.add(queuePaging)
|
||||
List.add(queuePaging)
|
||||
}
|
||||
cbOK?.accept(Unit)
|
||||
} catch (e: Exception) {
|
||||
Logger.error("Error fetching ${super.dbName} : ${e.message}" as Any)
|
||||
cbFail?.accept("Error fetching ${super.dbName} : ${e.message}" )
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1417,7 +1437,6 @@ class MariaDB(
|
||||
statement?.setString(2, data.Source)
|
||||
statement?.setString(3, data.Type)
|
||||
statement?.setString(4, data.Message)
|
||||
|
||||
statement?.setString(5, data.BroadcastZones)
|
||||
val rowsAffected = statement?.executeUpdate()
|
||||
if (rowsAffected != null && rowsAffected > 0) {
|
||||
@@ -1548,7 +1567,7 @@ class MariaDB(
|
||||
}
|
||||
}
|
||||
|
||||
override fun Get() {
|
||||
override fun Get(cbOK: Consumer<Unit>?, cbFail: Consumer<String>?) {
|
||||
List.clear()
|
||||
try {
|
||||
val statement = connection.createStatement()
|
||||
@@ -1561,9 +1580,10 @@ class MariaDB(
|
||||
)
|
||||
List.add(channel)
|
||||
}
|
||||
|
||||
cbOK?.accept(Unit)
|
||||
} catch (e: Exception) {
|
||||
Logger.error("Error fetching sound channels: ${e.message}" as Any)
|
||||
cbFail?.accept("Error fetching sound channels: ${e.message}" )
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1783,7 +1803,7 @@ class MariaDB(
|
||||
|
||||
}
|
||||
|
||||
override fun Get() {
|
||||
override fun Get(cbOK: Consumer<Unit>?, cbFail: Consumer<String>?) {
|
||||
List.clear()
|
||||
try {
|
||||
val statement = connection.createStatement()
|
||||
@@ -1798,8 +1818,11 @@ class MariaDB(
|
||||
)
|
||||
List.add(log)
|
||||
}
|
||||
cbOK?.accept(Unit)
|
||||
} catch (e: Exception) {
|
||||
cbFail?.accept("Error fetching ${super.dbName}: ${e.message}")
|
||||
Logger.error("Error fetching ${super.dbName}: ${e.message}" as Any)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1936,7 +1959,7 @@ class MariaDB(
|
||||
super.Create(tableDefinition)
|
||||
}
|
||||
|
||||
override fun Get() {
|
||||
override fun Get(cbOK: Consumer<Unit>?, cbFail: Consumer<String>?) {
|
||||
List.clear()
|
||||
try {
|
||||
val statement = connection.createStatement()
|
||||
@@ -1954,9 +1977,10 @@ class MariaDB(
|
||||
)
|
||||
List.add(user)
|
||||
}
|
||||
|
||||
cbOK?.accept(Unit)
|
||||
} catch (e: Exception) {
|
||||
Logger.error("Error fetching users: ${e.message}" as Any)
|
||||
cbFail?.accept("Error fetching users: ${e.message}" )
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2400,10 +2424,11 @@ class MariaDB(
|
||||
* @return a list of distinct airline code tags sorted alphabetically
|
||||
*/
|
||||
fun Get_AirlineCode_Tags(): List<String> {
|
||||
|
||||
return soundDB.List
|
||||
.filter { it.Category == Category.Airline_Code.name }
|
||||
.filter { it.Category.equals(Category.Airline_Code.name,true) }
|
||||
.distinctBy { it.TAG }
|
||||
.map { it.TAG }
|
||||
.distinct()
|
||||
.sorted()
|
||||
}
|
||||
|
||||
@@ -2413,9 +2438,9 @@ class MariaDB(
|
||||
*/
|
||||
fun Get_City_Tags(): List<String> {
|
||||
return soundDB.List
|
||||
.filter { it.Category == Category.City.name }
|
||||
.filter { it.Category.equals(Category.City.name,true) }
|
||||
.distinctBy { it.TAG }
|
||||
.map { it.TAG }
|
||||
.distinct()
|
||||
.sorted()
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package database
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook
|
||||
import org.tinylog.Logger
|
||||
import java.sql.Connection
|
||||
import java.util.function.Consumer
|
||||
|
||||
@Suppress("unused", "SqlDialectInspection", "SqlSourceToSinkFlow")
|
||||
abstract class dbFunctions<T>(val dbName: String, val connection: Connection, requiredcolumns: List<String>) {
|
||||
@@ -118,7 +119,7 @@ abstract class dbFunctions<T>(val dbName: String, val connection: Connection, re
|
||||
/**
|
||||
* Get all entries from the table and populate the List
|
||||
*/
|
||||
abstract fun Get()
|
||||
abstract fun Get(cbOK : Consumer<Unit>? = null, cbFail: Consumer<String>? = null)
|
||||
|
||||
/**
|
||||
* Add a new entry to the table
|
||||
|
||||
@@ -7,11 +7,13 @@ import kotlinx.coroutines.launch
|
||||
import org.tinylog.Logger
|
||||
import java.util.function.Consumer
|
||||
|
||||
|
||||
/**
|
||||
* Class to periodically check for the presence of a security dongle.
|
||||
*/
|
||||
class DongleChecker {
|
||||
private var isRunning = false
|
||||
var BypassDongle : Boolean = false
|
||||
|
||||
/**
|
||||
* Starts checking for the dongle at specified intervals.
|
||||
@@ -46,21 +48,42 @@ class DongleChecker {
|
||||
* Checks for the presence of the security dongle.
|
||||
* @return True if the dongle is found and opened successfully, false otherwise.
|
||||
*/
|
||||
// fun CheckDongle() : Boolean{
|
||||
// try{
|
||||
// val sdx = securedonglex.Instance
|
||||
// val found = sdx.SDX_Find()
|
||||
// if (found>0){
|
||||
// val uid = securedonglex.DWORD(253570225)
|
||||
// val hid = securedonglex.DWORDByReference(securedonglex.DWORD(0))
|
||||
// val handle = sdx.SDX_Open(1, uid, hid)
|
||||
// if (handle>=0){
|
||||
// sdx.SDX_Close(handle)
|
||||
// return true
|
||||
// }
|
||||
// }
|
||||
// } catch (e: Exception){
|
||||
// Logger.error(e) { "Error checking dongle: ${e.message}" }
|
||||
// }
|
||||
// return false
|
||||
// }
|
||||
|
||||
fun CheckDongle() : Boolean{
|
||||
try{
|
||||
val sdx = securedonglex.Instance
|
||||
val found = sdx.SDX_Find()
|
||||
if (found>0){
|
||||
val uid = securedonglex.DWORD(253570225)
|
||||
val hid = securedonglex.DWORDByReference(securedonglex.DWORD(0))
|
||||
val handle = sdx.SDX_Open(1, uid, hid)
|
||||
if (handle>=0){
|
||||
sdx.SDX_Close(handle)
|
||||
return true
|
||||
}
|
||||
}
|
||||
} catch (e: Exception){
|
||||
Logger.error(e) { "Error checking dongle: ${e.message}" }
|
||||
if (BypassDongle) return true
|
||||
// sementarsa pake dongle Erha
|
||||
val dongle = SecureDongle(0x4B30.toShort(), 0xA66C.toShort(), 0x3109.toShort(), 0x37B1.toShort())
|
||||
if (dongle.Find()){
|
||||
if (dongle.Open()){
|
||||
val UserID = Integer.toHexString(dongle.ReadUserID())
|
||||
dongle.Close()
|
||||
if (UserID.equals("14022025") || UserID.equals("3102025")){
|
||||
// 14022025 = Erha, 3102025 = Dermies
|
||||
return true
|
||||
} else throw Exception("Invalid dongle UserID")
|
||||
} else throw Exception("Cant open dongle")
|
||||
} else throw Exception("Cant find dongle")
|
||||
} catch (e : Exception){
|
||||
Logger.error { "Error checking dongle: ${e.message}" }
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
109
src/securedonglex/LibSecureDongle.java
Normal file
109
src/securedonglex/LibSecureDongle.java
Normal file
@@ -0,0 +1,109 @@
|
||||
package securedonglex;
|
||||
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.sun.jna.ptr.ShortByReference;
|
||||
|
||||
public interface LibSecureDongle extends Library {
|
||||
LibSecureDongle Instance = (LibSecureDongle) Native.load("SecureDongle", LibSecureDongle.class);
|
||||
short SD_FIND=1;
|
||||
short SD_FIND_NEXT=2;
|
||||
short SD_OPEN=3;
|
||||
short SD_CLOSE=4;
|
||||
short SD_READ=5;
|
||||
short SD_WRITE=6;
|
||||
short SD_RANDOM=7;
|
||||
short SD_SEED=8;
|
||||
short SD_WRITE_USERID=9;
|
||||
short SD_READ_USERID=10;
|
||||
short SD_SET_MODULE=11;
|
||||
short SD_CHECK_MODULE=12;
|
||||
short SD_WRITE_ARITHMETIC=13;
|
||||
short SD_CALCULATE1=14;
|
||||
short SD_CALCULATE2=15;
|
||||
short SD_CALCULATE3=16;
|
||||
short SD_DECREASE=17;
|
||||
|
||||
short SD_SET_RSAKEY_N=29;
|
||||
short SD_SET_RSAKEY_D=30;
|
||||
|
||||
short SD_SET_DES_KEY=41;
|
||||
short SD_DES_ENC=42;
|
||||
short SD_DES_DEC=43;
|
||||
short SD_RSA_ENC=44;
|
||||
short SD_RSA_DEC=45;
|
||||
|
||||
short SD_READ_EX=46;
|
||||
short SD_WRITE_EX=47;
|
||||
|
||||
short SD_SET_COUNTER_EX=160;
|
||||
short SD_GET_COUNTER_EX=161;
|
||||
short SD_SET_TIMER_EX=162;
|
||||
short SD_GET_TIMER_EX=163;
|
||||
short SD_ADJUST_TIMER_EX=164;
|
||||
short SD_UPDATE_GEN_HEADER_EX=165;
|
||||
short SD_UPDATE_GEN_EX=166;
|
||||
short SD_UPDATE_CHECK_EX=167;
|
||||
short SD_UPDATE_EX=168;
|
||||
short SD_SET_UPDATE_KEY=169;
|
||||
short SD_ADD_UPDATE_HEADER=170;
|
||||
short SD_ADD_UPDATE_CONTENT=171;
|
||||
short SD_GET_TIME_DWORD=172;
|
||||
|
||||
short SD_VERSION=100;
|
||||
|
||||
short DES_SINGLE_MODE=0;
|
||||
short DES_TRIPLE_MODE=1;
|
||||
short RSA_PRIVATE_KEY=0;
|
||||
short RSA_PUBLIC_KEY=1;
|
||||
short RSA_SECUREDONGLE_PADDING=0;
|
||||
short RSA_USER_PADDING=1;
|
||||
|
||||
//error code
|
||||
short ERR_SUCCESS=0;
|
||||
short ERR_NO_ROCKEY=3;
|
||||
short ERR_INVALID_PASSWORD=4;
|
||||
short ERR_INVALID_PASSWORD_OR_ID=5;
|
||||
short ERR_SETID=6;
|
||||
short ERR_INVALID_ADDR_OR_SIZE=7;
|
||||
short ERR_UNKNOWN_COMMAND=8;
|
||||
short ERR_NOTBELEVEL3=9;
|
||||
short ERR_READ=10;
|
||||
short ERR_WRITE=11;
|
||||
short ERR_RANDOM=12;
|
||||
short ERR_SEED=13;
|
||||
short ERR_CALCULATE=14;
|
||||
short ERR_NO_OPEN=15;
|
||||
short ERR_OPEN_OVERFLOW=16;
|
||||
short ERR_NOMORE=17;
|
||||
short ERR_NEED_FIND=18;
|
||||
short ERR_DECREASE=19;
|
||||
short ERR_AR_BADCOMMAND=20;
|
||||
short ERR_AR_UNKNOWN_OPCODE=21;
|
||||
short ERR_AR_WRONGBEGIN=22;
|
||||
short ERR_AR_WRONG_END=23;
|
||||
short ERR_AR_VALUEOVERFLOW=24;
|
||||
|
||||
short ERR_TOOMUCHTHREAD=25;
|
||||
short ERR_INVALID_SD=30;
|
||||
short ERR_INVALID_PARAMETER=31;
|
||||
short ERR_INVALID_TIMEVALUE=32;
|
||||
|
||||
short ERR_SET_DES_KEY=40;
|
||||
short ERR_DES_ENCRYPT=41;
|
||||
short ERR_DES_DECRYPT=42;
|
||||
short ERR_SET_RSAKEY_N=43;
|
||||
short ERR_SET_RSAKEY_D=44;
|
||||
short ERR_RSA_ENCRYPT=45;
|
||||
short ERR_RSA_DECRYPT=46;
|
||||
short ERR_INVALID_LENGTH=47;
|
||||
|
||||
short ERR_UNKNOWN=-1;
|
||||
short ERR_RECEIVE_NULL=256;
|
||||
short ERR_INVALID_BUFFER=257;
|
||||
short ERR_UNKNOWN_SYSTEM=258;
|
||||
short ERR_UNINIT_TIME_UNIT=259;
|
||||
|
||||
short SecureDongle(Short command, ShortByReference handle, IntByReference lp1, IntByReference lp2, ShortByReference p1, ShortByReference p2, ShortByReference p3, ShortByReference p4, byte[] buffer);
|
||||
}
|
||||
222
src/securedonglex/SecureDongle.java
Normal file
222
src/securedonglex/SecureDongle.java
Normal file
@@ -0,0 +1,222 @@
|
||||
package securedonglex;
|
||||
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
import com.sun.jna.ptr.ShortByReference;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class SecureDongle {
|
||||
|
||||
private final IntByReference lp1 = new IntByReference();
|
||||
private final IntByReference lp2 = new IntByReference();
|
||||
// for Open/Close Handle
|
||||
private final ShortByReference handle = new ShortByReference();
|
||||
// P1
|
||||
private final ShortByReference p1 = new ShortByReference();
|
||||
// P2
|
||||
private final ShortByReference p2 = new ShortByReference();
|
||||
// P3
|
||||
private final ShortByReference p3 = new ShortByReference();
|
||||
// P4
|
||||
private final ShortByReference p4 = new ShortByReference();
|
||||
|
||||
private final byte[] buffer = new byte[1024];
|
||||
|
||||
LibSecureDongle SD;
|
||||
|
||||
private @Getter boolean Opened = false;
|
||||
private @Getter short Handle;
|
||||
private @Getter int HardwareID = 0;
|
||||
private @Getter int UserID = 0;
|
||||
|
||||
private @Setter SecureDongleEvent event;
|
||||
|
||||
/**
|
||||
* Create SecureDongle with P1, P2, P3, P4
|
||||
* @param P1 Password 1
|
||||
* @param P2 Password 2
|
||||
* @param P3 Password 3
|
||||
* @param P4 Password 4
|
||||
*/
|
||||
public SecureDongle(short P1, short P2, short P3, short P4){
|
||||
this.p1.setValue(P1);
|
||||
this.p2.setValue(P2);
|
||||
this.p3.setValue(P3);
|
||||
this.p4.setValue(P4);
|
||||
SD = LibSecureDongle.Instance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Find SecureDongle
|
||||
* This must be executed first time
|
||||
* @return true if found
|
||||
*/
|
||||
public boolean Find(){
|
||||
HardwareID = 0;
|
||||
short result = SD.SecureDongle(LibSecureDongle.SD_FIND, handle, lp1, lp2, p1, p2, p3, p4, buffer);
|
||||
|
||||
if (result== LibSecureDongle.ERR_SUCCESS){
|
||||
HardwareID = lp1.getValue();
|
||||
return true;
|
||||
} else {
|
||||
if (event!=null) event.onDongleError("Find", result);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open SecureDongle
|
||||
* @return true if success
|
||||
*/
|
||||
public boolean Open(){
|
||||
Handle=0;
|
||||
if (HardwareID!=0){
|
||||
lp1.setValue(HardwareID);
|
||||
short result = SD.SecureDongle(LibSecureDongle.SD_OPEN, handle, lp1, lp2, p1, p2, p3, p4, buffer);
|
||||
if (result== LibSecureDongle.ERR_SUCCESS){
|
||||
Handle = handle.getValue();
|
||||
Opened = true;
|
||||
return true;
|
||||
} else if (event!=null) event.onDongleError("Open", result);
|
||||
} //else System.out.println("HardwareID not found, Find SecureDongle first");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close SecureDongle
|
||||
* @return true if success
|
||||
*/
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
public boolean Close(){
|
||||
handle.setValue(Handle);
|
||||
short result = SD.SecureDongle(LibSecureDongle.SD_CLOSE, handle, lp1, lp2, p1, p2, p3, p4, buffer);
|
||||
if (result== LibSecureDongle.ERR_SUCCESS){
|
||||
return true;
|
||||
} else if (event!=null) event.onDongleError("Close", result);
|
||||
Opened = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write to User Data Zone (UDZ)
|
||||
* @param StartAddress start address of UDZ, zero based
|
||||
* @param length length of data to write, max 1000 bytes
|
||||
* @param data data to write
|
||||
* @return true if success
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public boolean Write(short StartAddress, short length, byte[] data){
|
||||
if (Opened){
|
||||
handle.setValue(Handle);
|
||||
p1.setValue(StartAddress>=0 ? StartAddress : 0);
|
||||
if (length<1) length=1;
|
||||
if (length>1000) length=1000;
|
||||
p2.setValue(length);
|
||||
System.arraycopy(data, 0, buffer, 0, length);
|
||||
short result = SD.SecureDongle(LibSecureDongle.SD_WRITE, handle, lp1, lp2, p1, p2, p3, p4, buffer);
|
||||
if (result== LibSecureDongle.ERR_SUCCESS){
|
||||
return true;
|
||||
} else if (event!=null) event.onDongleError("Write", result);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read from User Data Zone (UDZ)
|
||||
* @param StartAddress Start Address, zero based
|
||||
* @param Length Length of data to read, max 1000 bytes
|
||||
* @return byte array of data, length=0 if failed
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public byte[] Read(short StartAddress, short Length){
|
||||
if (Opened){
|
||||
handle.setValue(Handle);
|
||||
p1.setValue(StartAddress>=0 ? StartAddress : 0);
|
||||
if (Length<1) Length=1;
|
||||
if (Length>1000) Length=1000;
|
||||
p2.setValue(Length);
|
||||
short result = SD.SecureDongle(LibSecureDongle.SD_READ, handle, lp1, lp2, p1, p2, p3, p4, buffer);
|
||||
if (result== LibSecureDongle.ERR_SUCCESS){
|
||||
byte[] data = new byte[Length];
|
||||
System.arraycopy(buffer, 0, data, 0, Length);
|
||||
return data;
|
||||
} else if (event!=null) event.onDongleError("Read", result);
|
||||
}
|
||||
|
||||
return new byte[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Random Number
|
||||
* @return short array of random number
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public short[] GenerateRandomNumber(){
|
||||
short[] random = new short[4];
|
||||
if (Opened){
|
||||
handle.setValue(Handle);
|
||||
short result = SD.SecureDongle(LibSecureDongle.SD_RANDOM, handle, lp1, lp2, p1, p2, p3, p4, buffer);
|
||||
if (result== LibSecureDongle.ERR_SUCCESS){
|
||||
random[0] = p1.getValue();
|
||||
random[1] = p2.getValue();
|
||||
random[2] = p3.getValue();
|
||||
random[3] = p4.getValue();
|
||||
return random;
|
||||
} else if (event!=null) event.onDongleError("GenerateRandomNumber", result);
|
||||
}
|
||||
|
||||
return random;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write UserID to SecureDongle
|
||||
* @param UserID UserID to write
|
||||
* @return true if success
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public boolean WriteUserID(int UserID){
|
||||
if (Opened){
|
||||
handle.setValue(Handle);
|
||||
lp1.setValue(UserID);
|
||||
short result = SD.SecureDongle(LibSecureDongle.SD_WRITE_USERID, handle, lp1, lp2, p1, p2, p3, p4, buffer);
|
||||
if (result== LibSecureDongle.ERR_SUCCESS){
|
||||
this.UserID = UserID;
|
||||
return true;
|
||||
} else if (event!=null) event.onDongleError("WriteUserID", result);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read UserID from SecureDongle
|
||||
* @return UserID, 0 if failed
|
||||
*/
|
||||
public int ReadUserID(){
|
||||
if (Opened){
|
||||
handle.setValue(Handle);
|
||||
short result = SD.SecureDongle(LibSecureDongle.SD_READ_USERID, handle, lp1, lp2, p1, p2, p3, p4, buffer);
|
||||
if (result== LibSecureDongle.ERR_SUCCESS){
|
||||
this.UserID = lp1.getValue();
|
||||
return UserID;
|
||||
} else if (event!=null) event.onDongleError("ReadUserID", result);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean ismonitoring = false;
|
||||
|
||||
/**
|
||||
* Stop Monitoring SecureDongle
|
||||
*/
|
||||
public void StopMonitor(){
|
||||
ismonitoring = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
6
src/securedonglex/SecureDongleEvent.java
Normal file
6
src/securedonglex/SecureDongleEvent.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package securedonglex;
|
||||
|
||||
public interface SecureDongleEvent {
|
||||
void onDongleMissing();
|
||||
void onDongleError(String function,int errorCode);
|
||||
}
|
||||
@@ -1,13 +1,17 @@
|
||||
package securedonglex;
|
||||
|
||||
import codes.Somecodes;
|
||||
import com.sun.jna.IntegerType;
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.ptr.ByReference;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public interface securedonglex extends Library {
|
||||
securedonglex Instance = (securedonglex) com.sun.jna.Native.load("sdx", securedonglex.class);
|
||||
String path = Somecodes.Companion.LibraryFullPath("sdx");
|
||||
|
||||
securedonglex Instance = (securedonglex) Native.load(path, securedonglex.class);
|
||||
|
||||
// =========================
|
||||
// Constants from header
|
||||
|
||||
@@ -567,8 +567,13 @@ class WebApp(val listenPort: Int, var userlist: List<Pair<String, String>>, val
|
||||
}
|
||||
}
|
||||
path("SoundBank") {
|
||||
get("List") {
|
||||
it.result(MariaDB.ArrayListtoString(db.soundDB.List))
|
||||
get("List") { ctx ->
|
||||
db.soundDB.Get({
|
||||
ctx.result(MariaDB.ArrayListtoString(db.soundDB.List))
|
||||
},{msgFail ->
|
||||
ctx.status(500)
|
||||
.result(objectmapper.writeValueAsString(resultMessage(msgFail)))
|
||||
})
|
||||
}
|
||||
get("ListFiles") {
|
||||
it.result(objectmapper.writeValueAsString(ListAudioFiles(Somecodes.Soundbank_directory)))
|
||||
@@ -579,11 +584,13 @@ class WebApp(val listenPort: Int, var userlist: List<Pair<String, String>>, val
|
||||
if (ValidString(language) && Language.entries.any { lang -> lang.name == language }) {
|
||||
if (ValidString(voiceType) && VoiceType.entries.any { vt -> vt.name == voiceType }) {
|
||||
val phrases = db.soundDB.List
|
||||
.asSequence()
|
||||
.filter { sb -> sb.Language == language }
|
||||
.filter { sb -> sb.VoiceType == voiceType }
|
||||
.filter { sb -> sb.Category == Category.Phrase.name }
|
||||
.distinctBy { sb -> sb.TAG }
|
||||
.sortedBy { sb -> sb.TAG }
|
||||
.toList()
|
||||
it.result(objectmapper.writeValueAsString(phrases))
|
||||
} else it.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Invalid VoiceType")))
|
||||
@@ -591,11 +598,15 @@ class WebApp(val listenPort: Int, var userlist: List<Pair<String, String>>, val
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Invalid Language")))
|
||||
}
|
||||
get("AirlineTags") { ctx ->
|
||||
val tags = db.Get_AirlineCode_Tags()
|
||||
val value = db.soundDB.List
|
||||
.filter { it.Category == Category.Airplane_Name.name }
|
||||
.asSequence()
|
||||
.filter { f1 -> f1.Category.equals(Category.Airplane_Name.name,true) }
|
||||
.filter { f2 -> tags.any{t -> t.equals(f2.TAG,true)}}
|
||||
.distinctBy { it.TAG }
|
||||
.sortedBy { it.TAG }
|
||||
.map { KeyValueMessage(it.TAG, it.Description) }
|
||||
.toList()
|
||||
ctx.result(objectmapper.writeValueAsString(value))
|
||||
}
|
||||
get("CityTags") { ctx ->
|
||||
@@ -790,9 +801,14 @@ class WebApp(val listenPort: Int, var userlist: List<Pair<String, String>>, val
|
||||
}
|
||||
}
|
||||
path("MessageBank") {
|
||||
get("List") {
|
||||
get("List") { ctx ->
|
||||
// get messagebank list
|
||||
it.result(MariaDB.ArrayListtoString(db.messageDB.List))
|
||||
db.messageDB.Get({
|
||||
ctx.result(MariaDB.ArrayListtoString(db.messageDB.List))
|
||||
},{msgFail ->
|
||||
ctx.status(500).result(objectmapper.writeValueAsString(resultMessage(msgFail)))
|
||||
})
|
||||
|
||||
}
|
||||
get("MessageIDs") { ctx ->
|
||||
val value = db.messageDB.List
|
||||
@@ -980,9 +996,15 @@ class WebApp(val listenPort: Int, var userlist: List<Pair<String, String>>, val
|
||||
}
|
||||
}
|
||||
path("LanguageLink") {
|
||||
get("List") {
|
||||
// get language link list
|
||||
it.result(MariaDB.ArrayListtoString(db.languageDB.List))
|
||||
get("List") { ctx ->
|
||||
db.languageDB.Get({
|
||||
// get language link list
|
||||
ctx.result(MariaDB.ArrayListtoString(db.languageDB.List))
|
||||
},{
|
||||
msgFail ->
|
||||
ctx.status(500).result(objectmapper.writeValueAsString(resultMessage(msgFail)))
|
||||
})
|
||||
|
||||
}
|
||||
post("Add") {
|
||||
// Parse JSON from request body
|
||||
@@ -1126,9 +1148,16 @@ class WebApp(val listenPort: Int, var userlist: List<Pair<String, String>>, val
|
||||
}
|
||||
}
|
||||
path("ScheduleBank") {
|
||||
get("List") {
|
||||
get("List") { ctx ->
|
||||
|
||||
db.scheduleDB.Get({
|
||||
// get timer list
|
||||
ctx.result(MariaDB.ArrayListtoString(db.scheduleDB.List))
|
||||
},{
|
||||
msgFail ->
|
||||
ctx.status(500).result(objectmapper.writeValueAsString(resultMessage(msgFail)))
|
||||
})
|
||||
// get timer list
|
||||
it.result(MariaDB.ArrayListtoString(db.scheduleDB.List))
|
||||
}
|
||||
delete("List") {
|
||||
// truncate timer table
|
||||
@@ -1330,8 +1359,14 @@ class WebApp(val listenPort: Int, var userlist: List<Pair<String, String>>, val
|
||||
|
||||
}
|
||||
path("UserManagement") {
|
||||
get("List") {
|
||||
it.result(objectmapper.writeValueAsString(db.userDB.List))
|
||||
get("List") { ctx ->
|
||||
db.userDB.Get({
|
||||
ctx.result(objectmapper.writeValueAsString(db.userDB.List))
|
||||
},{
|
||||
msgFail ->
|
||||
ctx.status(500).result(objectmapper.writeValueAsString(resultMessage(msgFail)))
|
||||
})
|
||||
|
||||
}
|
||||
delete("List") {
|
||||
if (db.userDB.Clear()) {
|
||||
@@ -1346,13 +1381,72 @@ class WebApp(val listenPort: Int, var userlist: List<Pair<String, String>>, val
|
||||
val json: JsonNode = objectmapper.readTree(ctx.body())
|
||||
val username = json.get("username").asText("")
|
||||
val password = json.get("password").asText("")
|
||||
val location = json.get("location").asText("")
|
||||
val location = json.get("location").asText("N/A")
|
||||
val airline_tags = json.get("airline_tags").asText("")
|
||||
val city_tags = json.get("city_tags").asText("")
|
||||
val messagebank_ann_id = json.get("messagebank_ann_id").asText("")
|
||||
val broadcastzones = json.get("broadcastzones").asText("")
|
||||
if (ValidStrings(
|
||||
listOf(
|
||||
// revisi 30012026
|
||||
// city, airline, messagebank_ann_id boleh kosong, untuk user yang paging saja
|
||||
// location juga optional
|
||||
// yang wajib ada adalah username, password, broadcastzones
|
||||
if (ValidStrings(username, password, broadcastzones ))
|
||||
{
|
||||
if (!db.Username_exists(username)) {
|
||||
if (ValidString(airline_tags)){
|
||||
// ada airline_tags, berarti harus di cek apakah ada di table soundbank
|
||||
// kalau tidak ada airline_tags, tidak perlu cek
|
||||
val atags = airline_tags.split(";").map { it.trim() }
|
||||
.filter { it.isNotEmpty() }.distinct()
|
||||
val airlinetags = db.Get_AirlineCode_Tags()
|
||||
if (!atags.all { tag -> airlinetags.any { it.equals(tag,true) } }) {
|
||||
ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Some airline tags not found in soundbank")))
|
||||
return@post
|
||||
}
|
||||
}
|
||||
if (ValidString(city_tags)){
|
||||
// ada city_tags, berarti harus di cek apakah ada di table soundbank
|
||||
// kalau tidak ada city_tags, tidak perlu cek
|
||||
val ctags = city_tags.split(";").map { it.trim() }
|
||||
.filter { it.isNotEmpty() }.distinct()
|
||||
val citytags = db.Get_City_Tags()
|
||||
if (!ctags.all { tag -> citytags.any { it.equals(tag,true) } }) {
|
||||
ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Some city tags not found in soundbank")))
|
||||
return@post
|
||||
}
|
||||
}
|
||||
if (ValidString(messagebank_ann_id)){
|
||||
// ada messagebank_ann_id, berarti harus di cek apakah ada di table messagebank
|
||||
// kalau tidak ada messagebank_ann_id, tidak perlu cek
|
||||
val mbids = messagebank_ann_id.split(";")
|
||||
.map { it.trim() }
|
||||
.filter { it.isNotEmpty() }.distinct()
|
||||
.mapNotNull { it.toUIntOrNull() }
|
||||
val mbankids = db.Get_MessageID_List()
|
||||
if (!mbids.all { id -> mbankids.any { it == id } }) {
|
||||
ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Some ANN_ID not found in Messagebank")))
|
||||
return@post
|
||||
}
|
||||
}
|
||||
|
||||
// check apakah semua broadcast zones ada di soundbank
|
||||
val bzdesc =
|
||||
broadcastzones.split(";").map { it.trim() }
|
||||
.filter { it.isNotEmpty() }.distinct()
|
||||
val bzlist = db.Get_BroadcastZone_List()
|
||||
if (!bzdesc.all { desc -> bzlist.any { it.equals(desc,true) } }) {
|
||||
ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Some broadcast zone tags not found in soundbank")))
|
||||
return@post
|
||||
}
|
||||
|
||||
// sampe sini valid semua
|
||||
// semua valid, tambain ke database
|
||||
val newuser = UserDB(
|
||||
0u,
|
||||
username,
|
||||
password,
|
||||
location,
|
||||
@@ -1361,54 +1455,12 @@ class WebApp(val listenPort: Int, var userlist: List<Pair<String, String>>, val
|
||||
messagebank_ann_id,
|
||||
broadcastzones
|
||||
)
|
||||
)
|
||||
) {
|
||||
if (!db.Username_exists(username)) {
|
||||
// check apakah ada airline tag yang tidak ada di soundbank
|
||||
val atags = airline_tags.split(";").map { it.trim() }
|
||||
.filter { it.isNotEmpty() }.distinct()
|
||||
val airlinetags = db.Get_AirlineCode_Tags()
|
||||
if (atags.all { tag -> airlinetags.any { it == tag } }) {
|
||||
// check apakah ada city tag yang tidak ada di soundbank
|
||||
val ctags = city_tags.split(";").map { it.trim() }
|
||||
.filter { it.isNotEmpty() }.distinct()
|
||||
val citytags = db.Get_City_Tags()
|
||||
if (ctags.all { tag -> citytags.any { it == tag } }) {
|
||||
val bzdesc =
|
||||
broadcastzones.split(";").map { it.trim() }
|
||||
.filter { it.isNotEmpty() }.distinct()
|
||||
val bzlist = db.Get_BroadcastZone_List()
|
||||
if (bzdesc.all { desc -> bzlist.any { it == desc } }) {
|
||||
val mbids = messagebank_ann_id.split(";")
|
||||
.map { it.trim() }
|
||||
.filter { it.isNotEmpty() }.distinct()
|
||||
.mapNotNull { it.toUIntOrNull() }
|
||||
val mbankids = db.Get_MessageID_List()
|
||||
if (mbids.all { id -> mbankids.any { it == id } }) {
|
||||
// semua valid, tambain ke database
|
||||
val newuser = UserDB(
|
||||
0u,
|
||||
username,
|
||||
password,
|
||||
location,
|
||||
airline_tags,
|
||||
city_tags,
|
||||
messagebank_ann_id,
|
||||
broadcastzones
|
||||
)
|
||||
if (db.userDB.Add(newuser)) {
|
||||
db.userDB.Resort()
|
||||
ctx.result(objectmapper.writeValueAsString(resultMessage("OK")))
|
||||
} else ctx.status(500)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Failed to add user to database")))
|
||||
} else ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Some ANN_ID not found in Messagebank")))
|
||||
} else ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Some broadcast zone tags not found in soundbank")))
|
||||
} else ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Some city tags not found in soundbank")))
|
||||
} else ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Some airline tags not found in soundbank")))
|
||||
if (db.userDB.Add(newuser)) {
|
||||
db.userDB.Resort()
|
||||
ctx.result(objectmapper.writeValueAsString(resultMessage("OK")))
|
||||
} else ctx.status(500)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Failed to add user to database")))
|
||||
|
||||
} else ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString("Username already exists"))
|
||||
} else ctx.status(400)
|
||||
@@ -1439,96 +1491,113 @@ class WebApp(val listenPort: Int, var userlist: List<Pair<String, String>>, val
|
||||
if (!json.isEmpty) {
|
||||
val _username = json.get("username").asText("")
|
||||
val _password = json.get("password").asText("")
|
||||
val _location = json.get("location").asText("")
|
||||
val _location = json.get("location").asText("N/A")
|
||||
val _airline_tags = json.get("airline_tags").asText("")
|
||||
val _city_tags = json.get("city_tags").asText("")
|
||||
val _messagebank_ann_id = json.get("messagebank_ann_id").asText("")
|
||||
val _broadcastzones = json.get("broadcastzones").asText("")
|
||||
if (ValidStrings(
|
||||
listOf(
|
||||
_username,
|
||||
_password,
|
||||
_location,
|
||||
_airline_tags,
|
||||
_city_tags,
|
||||
_messagebank_ann_id,
|
||||
_broadcastzones
|
||||
)
|
||||
)
|
||||
) {
|
||||
// revisi 30012026
|
||||
// city, airline, messagebank_ann_id boleh kosong, untuk user yang paging saja
|
||||
// location juga optional
|
||||
// yang wajib ada adalah username, password, broadcastzones
|
||||
if (ValidStrings(_username, _password, _broadcastzones))
|
||||
{
|
||||
val _otherusername = db.userDB.List.find { xx ->
|
||||
xx.username.equals(
|
||||
_username,
|
||||
true
|
||||
) && xx.index != index
|
||||
}
|
||||
if (_otherusername == null) {
|
||||
// belum ada user lain yang pakai username ini
|
||||
if (_otherusername!=null){
|
||||
Logger.info{"Found other username with same name: ${_otherusername.username} at index ${_otherusername.index}"}
|
||||
ctx.status(400).result(
|
||||
objectmapper.writeValueAsString(
|
||||
resultMessage("Username already exists for another user")
|
||||
)
|
||||
)
|
||||
return@patch
|
||||
}
|
||||
|
||||
if (ValidString(_airline_tags)){
|
||||
// ada airline_tags, berarti harus di cek apakah ada di table soundbank
|
||||
// kalau tidak ada airline_tags, tidak perlu cek
|
||||
val atags = _airline_tags.split(";").map { it.trim() }
|
||||
.filter { it.isNotEmpty() }.distinct()
|
||||
val ctags =
|
||||
_city_tags.split(";").map { it.trim() }
|
||||
.filter { it.isNotEmpty() }
|
||||
.distinct()
|
||||
val msgids = _messagebank_ann_id.split(";").map { it.trim() }
|
||||
val airlinetags = db.Get_AirlineCode_Tags()
|
||||
if (!atags.all { tag -> airlinetags.any { it.equals(tag,true) } }) {
|
||||
ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Some airline tags not found in soundbank")))
|
||||
return@patch
|
||||
}
|
||||
}
|
||||
if (ValidString(_city_tags)){
|
||||
// ada city_tags, berarti harus di cek apakah ada di table soundbank
|
||||
// kalau tidak ada city_tags, tidak perlu cek
|
||||
val ctags = _city_tags.split(";").map { it.trim() }
|
||||
.filter { it.isNotEmpty() }.distinct()
|
||||
val citytags = db.Get_City_Tags()
|
||||
if (!ctags.all { tag -> citytags.any { it.equals(tag,true) } }) {
|
||||
ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Some city tags not found in soundbank")))
|
||||
return@patch
|
||||
}
|
||||
}
|
||||
if (ValidString(_messagebank_ann_id)){
|
||||
// ada messagebank_ann_id, berarti harus di cek apakah ada di table messagebank
|
||||
// kalau tidak ada messagebank_ann_id, tidak perlu cek
|
||||
val mbids = _messagebank_ann_id.split(";")
|
||||
.map { it.trim() }
|
||||
.filter { it.isNotEmpty() }.distinct()
|
||||
.mapNotNull { it.toUIntOrNull() }
|
||||
val bzdesc = _broadcastzones.split(";").map { it.trim() }
|
||||
.filter { it.isNotEmpty() }.distinct()
|
||||
val mbankids = db.Get_MessageID_List()
|
||||
if (!mbids.all { id -> mbankids.any { it == id } }) {
|
||||
ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Some ANN_ID not found in Messagebank")))
|
||||
return@patch
|
||||
}
|
||||
}
|
||||
|
||||
val airline_tags = db.Get_AirlineCode_Tags()
|
||||
val city_tags = db.Get_City_Tags()
|
||||
val msgbankids = db.Get_MessageID_List()
|
||||
val bzlist = db.Get_BroadcastZone_List()
|
||||
if (atags.all { tag -> airline_tags.any { it == tag } }) {
|
||||
if (ctags.all { tag -> city_tags.any { it == tag } }) {
|
||||
if (msgids.all { tag -> msgbankids.any { it == tag } }) {
|
||||
if (bzdesc.all { tag -> bzlist.any { it == tag } }) {
|
||||
val editeduser = UserDB(
|
||||
index,
|
||||
_username,
|
||||
_password,
|
||||
_location,
|
||||
_airline_tags,
|
||||
_city_tags,
|
||||
_messagebank_ann_id,
|
||||
_broadcastzones
|
||||
)
|
||||
if (!user.isEqual(editeduser)) {
|
||||
if (db.userDB.UpdateByIndex(
|
||||
index.toInt(),
|
||||
editeduser
|
||||
)
|
||||
) {
|
||||
db.userDB.Resort()
|
||||
ctx.result(
|
||||
objectmapper.writeValueAsString(
|
||||
resultMessage("OK")
|
||||
)
|
||||
)
|
||||
val bzdesc = _broadcastzones.split(";").map { it.trim() }
|
||||
.filter { it.isNotEmpty() }.distinct()
|
||||
val bzlist = db.Get_BroadcastZone_List()
|
||||
if (!bzdesc.all { desc -> bzlist.any { it.equals(desc,true) } }) {
|
||||
ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Some broadcast zone is not found in Broadcast Zone list")))
|
||||
return@patch
|
||||
}
|
||||
|
||||
} else ctx.status(500).result(
|
||||
objectmapper.writeValueAsString(
|
||||
resultMessage("Failed to update user with index $index")
|
||||
)
|
||||
)
|
||||
} else ctx.status(400).result(
|
||||
objectmapper.writeValueAsString(resultMessage("Nothing has changed for user with index $index"))
|
||||
)
|
||||
} else ctx.status(400)
|
||||
.result(
|
||||
objectmapper.writeValueAsString(
|
||||
resultMessage("Some broadcast zone is not found in Broadcast Zone list")
|
||||
)
|
||||
)
|
||||
} else ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Some ANN_ID not found in Messagebank")))
|
||||
} else ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Some city tags not found in soundbank")))
|
||||
} else ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString("Some airline tags not found in soundbank"))
|
||||
} else ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Username already exists for another user")))
|
||||
// sampe sini valid semua
|
||||
val editeduser = UserDB(
|
||||
index,
|
||||
_username,
|
||||
_password,
|
||||
_location,
|
||||
_airline_tags,
|
||||
_city_tags,
|
||||
_messagebank_ann_id,
|
||||
_broadcastzones
|
||||
)
|
||||
if (!user.isEqual(editeduser)) {
|
||||
if (db.userDB.UpdateByIndex(
|
||||
index.toInt(),
|
||||
editeduser
|
||||
)
|
||||
) {
|
||||
db.userDB.Resort()
|
||||
ctx.result(
|
||||
objectmapper.writeValueAsString(
|
||||
resultMessage("OK")
|
||||
)
|
||||
)
|
||||
|
||||
} else ctx.status(500).result(
|
||||
objectmapper.writeValueAsString(
|
||||
resultMessage("Failed to update user with index $index")
|
||||
)
|
||||
)
|
||||
} else ctx.status(400).result(
|
||||
objectmapper.writeValueAsString(resultMessage("Nothing has changed for user with index $index"))
|
||||
)
|
||||
} else ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Not all fiels have value")))
|
||||
} else ctx.status(400)
|
||||
@@ -1632,8 +1701,13 @@ class WebApp(val listenPort: Int, var userlist: List<Pair<String, String>>, val
|
||||
}
|
||||
}
|
||||
path("BroadcastZones") {
|
||||
get("List") {
|
||||
it.result(MariaDB.ArrayListtoString(db.broadcastDB.List))
|
||||
get("List") { ctx ->
|
||||
db.broadcastDB.Get({
|
||||
ctx.result(MariaDB.ArrayListtoString(db.broadcastDB.List))
|
||||
},{
|
||||
msgFail ->
|
||||
ctx.status(500).result(objectmapper.writeValueAsString(resultMessage(msgFail)))
|
||||
})
|
||||
}
|
||||
get("BroadcastZoneDescriptions") { ctx ->
|
||||
val value = db.broadcastDB.List
|
||||
@@ -1785,8 +1859,14 @@ class WebApp(val listenPort: Int, var userlist: List<Pair<String, String>>, val
|
||||
|
||||
}
|
||||
path("SoundChannel") {
|
||||
get("List") {
|
||||
it.result(MariaDB.ArrayListtoString(db.soundchannelDB.List))
|
||||
get("List") { ctx ->
|
||||
db.soundchannelDB.Get({
|
||||
ctx.result(MariaDB.ArrayListtoString(db.soundchannelDB.List))
|
||||
},{
|
||||
msgFail ->
|
||||
ctx.status(500).result(objectmapper.writeValueAsString(resultMessage(msgFail)))
|
||||
})
|
||||
|
||||
}
|
||||
get("SoundChannelDescriptions") {
|
||||
it.result(objectmapper.writeValueAsString(db.Get_SoundChannel_List()))
|
||||
@@ -1915,8 +1995,14 @@ class WebApp(val listenPort: Int, var userlist: List<Pair<String, String>>, val
|
||||
}
|
||||
|
||||
path("QueuePaging") {
|
||||
get("List") {
|
||||
it.result(MariaDB.ArrayListtoString(db.queuepagingDB.List))
|
||||
get("List") { ctx ->
|
||||
db.queuepagingDB.Get({
|
||||
ctx.result(MariaDB.ArrayListtoString(db.queuepagingDB.List))
|
||||
},{
|
||||
msgFail ->
|
||||
ctx.status(500).result(objectmapper.writeValueAsString(resultMessage(msgFail)))
|
||||
})
|
||||
|
||||
}
|
||||
delete("List") {
|
||||
// truncate queue paging table
|
||||
@@ -1948,8 +2034,14 @@ class WebApp(val listenPort: Int, var userlist: List<Pair<String, String>>, val
|
||||
|
||||
}
|
||||
path("QueueTable") {
|
||||
get("List") {
|
||||
it.result(MariaDB.ArrayListtoString(db.queuetableDB.List))
|
||||
get("List") { ctx ->
|
||||
db.queuetableDB.Get({
|
||||
ctx.result(MariaDB.ArrayListtoString(db.queuetableDB.List))
|
||||
},{
|
||||
msgFail ->
|
||||
ctx.status(500).result(objectmapper.writeValueAsString(resultMessage(msgFail)))
|
||||
})
|
||||
|
||||
}
|
||||
delete("List") {
|
||||
// truncate queue table
|
||||
|
||||
Reference in New Issue
Block a user