Refactor test-app: remove unused build scripts and migrate components, utilities, and database files to vst-ui-base. Update SVG utilities with viewBox fix, enhance KnobComponent with global mouse listeners, and clean up unused imports.
This commit is contained in:
14
.idea/gradle.xml
generated
14
.idea/gradle.xml
generated
@@ -4,22 +4,12 @@
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<compositeConfiguration>
|
||||
<compositeBuild compositeDefinitionSource="SCRIPT">
|
||||
<builds>
|
||||
<build path="$PROJECT_DIR$" name="vst-ui-base">
|
||||
<projects>
|
||||
<project path="$PROJECT_DIR$" />
|
||||
</projects>
|
||||
</build>
|
||||
</builds>
|
||||
</compositeBuild>
|
||||
</compositeConfiguration>
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/test-app" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/test-app" />
|
||||
<option value="$PROJECT_DIR$/vst-ui-base" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
|
||||
7
.run/JS.run.xml
Normal file
7
.run/JS.run.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="JS" type="JavascriptDebugType" engineId="98ca6316-2f89-46d9-a9e5-fa9e2b0625b3" uri="http://localhost:9999">
|
||||
<method v="2">
|
||||
<option name="Gradle.BeforeRunTask" enabled="true" tasks="jsBrowserDevelopmentExecutableDistribution" externalProjectPath="$PROJECT_DIR$/test-app" vmOptions="" scriptParameters="" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
27
.run/Test [jvm].run.xml
Normal file
27
.run/Test [jvm].run.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Test [jvm]" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$/test-app" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" value="-DmainClass=nl.astraeus.vst.ui.TestKt --quiet" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value="jvmRun" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" />
|
||||
</ExternalSystemSettings>
|
||||
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
|
||||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
|
||||
<ExternalSystemDebugDisabled>false</ExternalSystemDebugDisabled>
|
||||
<DebugAllEnabled>false</DebugAllEnabled>
|
||||
<RunAsTest>false</RunAsTest>
|
||||
<GradleProfilingDisabled>false</GradleProfilingDisabled>
|
||||
<GradleCoverageDisabled>false</GradleCoverageDisabled>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
164
build.gradle.kts
164
build.gradle.kts
@@ -1,162 +1,14 @@
|
||||
@file:OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||
|
||||
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||
import org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode
|
||||
|
||||
buildscript {
|
||||
apply(from = "./common.gradle.kts")
|
||||
}
|
||||
|
||||
plugins {
|
||||
kotlin("multiplatform") version "2.1.20"
|
||||
`maven-publish`
|
||||
signing
|
||||
}
|
||||
|
||||
group = "nl.astraeus"
|
||||
version = "2.2.0-alpha-5"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
setUrl("https://gitea.astraeus.nl/api/packages/rnentjes/maven")
|
||||
}
|
||||
maven {
|
||||
setUrl("https://gitea.astraeus.nl:8443/api/packages/rnentjes/maven")
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
js {
|
||||
compilerOptions {
|
||||
target.set("es2015")
|
||||
sourceMap.set(true)
|
||||
sourceMapEmbedSources.set(JsSourceMapEmbedMode.SOURCE_MAP_SOURCE_CONTENT_ALWAYS)
|
||||
}
|
||||
binaries.library()
|
||||
browser {
|
||||
commonWebpackConfig {
|
||||
sourceMaps = true
|
||||
devtool = "inline-source-map"
|
||||
}
|
||||
}
|
||||
}
|
||||
jvm {}
|
||||
|
||||
sourceSets {
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
api("nl.astraeus:kotlin-css-generator:1.0.10")
|
||||
}
|
||||
}
|
||||
val jsMain by getting {
|
||||
dependencies {
|
||||
api("nl.astraeus:kotlin-komponent:1.2.8")
|
||||
}
|
||||
}
|
||||
val jsTest by getting {
|
||||
dependencies {
|
||||
implementation(kotlin("test"))
|
||||
}
|
||||
}
|
||||
val jvmMain by getting {
|
||||
dependencies {
|
||||
api("org.jetbrains.kotlinx:kotlinx-datetime:0.6.0")
|
||||
|
||||
implementation("io.undertow:undertow-core:2.3.14.Final")
|
||||
implementation("io.undertow:undertow-websockets-jsr:2.3.14.Final")
|
||||
implementation("org.jboss.xnio:xnio-nio:3.8.16.Final")
|
||||
|
||||
implementation("org.xerial:sqlite-jdbc:3.46.0.0")
|
||||
implementation("com.zaxxer:HikariCP:4.0.3")
|
||||
implementation("nl.astraeus:simple-jdbc-stats:1.6.1")
|
||||
|
||||
api("org.jetbrains.kotlinx:kotlinx-html-jvm:0.11.0")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extra["PUBLISH_GROUP_ID"] = group
|
||||
extra["PUBLISH_VERSION"] = version
|
||||
extra["PUBLISH_ARTIFACT_ID"] = name
|
||||
|
||||
// Stub secrets to let the project sync and build without the publication values set up
|
||||
val signingKeyId: String? by project
|
||||
val signingPassword: String? by project
|
||||
val signingSecretKeyRingFile: String? by project
|
||||
|
||||
extra["signing.keyId"] = signingKeyId
|
||||
extra["signing.password"] = signingPassword
|
||||
extra["signing.secretKeyRingFile"] = signingSecretKeyRingFile
|
||||
|
||||
val javadocJar by tasks.registering(Jar::class) {
|
||||
archiveClassifier.set("javadoc")
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "gitea"
|
||||
setUrl("https://gitea.astraeus.nl/api/packages/rnentjes/maven")
|
||||
|
||||
credentials {
|
||||
val giteaUsername: String? by project
|
||||
val giteaPassword: String? by project
|
||||
|
||||
username = giteaUsername
|
||||
password = giteaPassword
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name = "gitea8443"
|
||||
setUrl("https://gitea.astraeus.nl:8443/api/packages/rnentjes/maven")
|
||||
|
||||
credentials {
|
||||
val giteaUsername: String? by project
|
||||
val giteaPassword: String? by project
|
||||
|
||||
username = giteaUsername
|
||||
password = giteaPassword
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Configure all publications
|
||||
publications.withType<MavenPublication> {
|
||||
// Stub javadoc.jar artifact
|
||||
artifact(javadocJar.get())
|
||||
|
||||
// Provide artifacts information requited by Maven Central
|
||||
pom {
|
||||
name.set("vst-ui-base")
|
||||
description.set("Vst UI base")
|
||||
url.set("https://gitea.astraeus.nl/rnentjes/vst-ui-base")
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name.set("MIT")
|
||||
url.set("https://opensource.org/licenses/MIT")
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id.set("rnentjes")
|
||||
name.set("Rien Nentjes")
|
||||
email.set("info@nentjes.com")
|
||||
}
|
||||
}
|
||||
scm {
|
||||
url.set("https://gitea.astraeus.nl/rnentjes/vst-ui-base")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signing {
|
||||
sign(publishing.publications)
|
||||
}
|
||||
|
||||
tasks.withType<PublishToMavenRepository> {
|
||||
dependsOn(tasks.withType<Sign>())
|
||||
}
|
||||
|
||||
tasks.withType<PublishToMavenLocal> {
|
||||
dependsOn(tasks.withType<Sign>())
|
||||
// This loads the plugin but doesn't apply it to the root project
|
||||
kotlin("multiplatform") version "2.3.0" apply false
|
||||
id("org.jetbrains.dokka") version "2.0.0" apply false
|
||||
id("com.vanniktech.maven.publish") version "0.31.0" apply false
|
||||
}
|
||||
|
||||
18
common.gradle.kts
Normal file
18
common.gradle.kts
Normal file
@@ -0,0 +1,18 @@
|
||||
project.extra.set("devMode", true)
|
||||
project.extra.set("enabledSourceMaps", true)
|
||||
|
||||
group = "nl.astraeus"
|
||||
version = "2.2.2"
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
setUrl("https://gitea.astraeus.nl/api/packages/rnentjes/maven")
|
||||
}
|
||||
maven {
|
||||
setUrl("https://gitea.astraeus.nl:8443/api/packages/rnentjes/maven")
|
||||
}
|
||||
mavenLocal()
|
||||
}
|
||||
}
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Sat Jun 15 15:16:05 CEST 2024
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
12
settings.common.gradle.kts
Normal file
12
settings.common.gradle.kts
Normal file
@@ -0,0 +1,12 @@
|
||||
pluginManagement {
|
||||
plugins {
|
||||
kotlin("multiplatform") version "2.3.0"
|
||||
id("org.jetbrains.dokka") version "2.0.0"
|
||||
id("com.vanniktech.maven.publish") version "0.31.0"
|
||||
}
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
maven { setUrl("https://plugins.gradle.org/m2/") }
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,4 @@
|
||||
plugins {
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0"
|
||||
}
|
||||
apply(from = "settings.common.gradle.kts")
|
||||
|
||||
rootProject.name = "vst-ui-base"
|
||||
|
||||
//include("test-app")
|
||||
include(":vst-ui-base")
|
||||
include(":test-app")
|
||||
|
||||
@@ -3,21 +3,12 @@
|
||||
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||
import org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode
|
||||
|
||||
plugins {
|
||||
kotlin("multiplatform") version "2.1.10"
|
||||
buildscript {
|
||||
apply(from = "../common.gradle.kts")
|
||||
}
|
||||
|
||||
group = "nl.astraeus"
|
||||
version = "2.0.0-SNAPSHOT"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
setUrl("https://gitea.astraeus.nl/api/packages/rnentjes/maven")
|
||||
}
|
||||
maven {
|
||||
setUrl("https://gitea.astraeus.nl:8443/api/packages/rnentjes/maven")
|
||||
}
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
@@ -39,13 +30,12 @@ kotlin {
|
||||
}
|
||||
}
|
||||
jvm {
|
||||
withJava()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
api("nl.astraeus:vst-ui-base")
|
||||
implementation(project(":vst-ui-base"))
|
||||
}
|
||||
}
|
||||
val jsMain by getting {
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
plugins {
|
||||
kotlin("multiplatform") version "2.1.0"
|
||||
application
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
setUrl("https://gitea.astraeus.nl/api/packages/rnentjes/maven")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
js {
|
||||
compilerOptions {
|
||||
target.set("es2015")
|
||||
}
|
||||
//useEsModules()
|
||||
//useCommonJs()
|
||||
|
||||
binaries.executable()
|
||||
browser {
|
||||
commonWebpackConfig {
|
||||
outputFileName = "vst-ui-base-test.js"
|
||||
sourceMaps = true
|
||||
devtool = "inline-source-map"
|
||||
}
|
||||
|
||||
distribution {
|
||||
outputDirectory.set(File("$projectDir/web/"))
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
@OptIn(ExperimentalWasmDsl::class)
|
||||
wasmJs {
|
||||
binaries.executable()
|
||||
browser{
|
||||
distribution {
|
||||
outputDirectory.set(File("$projectDir/web/"))
|
||||
}
|
||||
}
|
||||
|
||||
mavenPublication {
|
||||
groupId = group as String
|
||||
pom { name = "${project.name}-wasm-js" }
|
||||
}
|
||||
}
|
||||
*/
|
||||
jvm {
|
||||
withJava()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
//base
|
||||
api("nl.astraeus:vst-ui-base")
|
||||
}
|
||||
}
|
||||
val jsMain by getting
|
||||
val jsTest by getting {
|
||||
dependencies {
|
||||
implementation(kotlin("test-js"))
|
||||
}
|
||||
}
|
||||
val jvmMain by getting
|
||||
}
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("nl.astraeus.vst.ui.TestKt")
|
||||
}
|
||||
BIN
test-app/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
test-app/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@@ -1,7 +0,0 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
252
test-app/gradlew
vendored
252
test-app/gradlew
vendored
@@ -1,252 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
94
test-app/gradlew.bat
vendored
94
test-app/gradlew.bat
vendored
@@ -1,94 +0,0 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -1,5 +1 @@
|
||||
plugins {
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
|
||||
}
|
||||
|
||||
includeBuild("..")
|
||||
apply(from = "../settings.common.gradle.kts")
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
Target directory for the generated web content
|
||||
116
vst-ui-base/build.gradle.kts
Normal file
116
vst-ui-base/build.gradle.kts
Normal file
@@ -0,0 +1,116 @@
|
||||
@file:OptIn(ExperimentalKotlinGradlePluginApi::class)
|
||||
|
||||
import com.vanniktech.maven.publish.KotlinMultiplatform
|
||||
import com.vanniktech.maven.publish.SonatypeHost
|
||||
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
|
||||
import org.jetbrains.kotlin.gradle.dsl.JsSourceMapEmbedMode
|
||||
|
||||
buildscript {
|
||||
apply(from = "../common.gradle.kts")
|
||||
}
|
||||
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
id("org.jetbrains.dokka")
|
||||
id("com.vanniktech.maven.publish")
|
||||
}
|
||||
|
||||
kotlin {
|
||||
js {
|
||||
compilerOptions {
|
||||
target.set("es2015")
|
||||
sourceMap.set(true)
|
||||
sourceMapEmbedSources.set(JsSourceMapEmbedMode.SOURCE_MAP_SOURCE_CONTENT_ALWAYS)
|
||||
}
|
||||
binaries.library()
|
||||
browser {
|
||||
commonWebpackConfig {
|
||||
sourceMaps = true
|
||||
devtool = "inline-source-map"
|
||||
}
|
||||
}
|
||||
}
|
||||
jvm {}
|
||||
|
||||
sourceSets {
|
||||
val commonMain by getting {
|
||||
dependencies {
|
||||
api("nl.astraeus:kotlin-css-generator:1.0.10")
|
||||
}
|
||||
}
|
||||
val jsMain by getting {
|
||||
dependencies {
|
||||
api("nl.astraeus:kotlin-komponent:1.2.8")
|
||||
}
|
||||
}
|
||||
val jsTest by getting {
|
||||
dependencies {
|
||||
implementation(kotlin("test"))
|
||||
}
|
||||
}
|
||||
val jvmMain by getting {
|
||||
dependencies {
|
||||
api("org.jetbrains.kotlinx:kotlinx-datetime:0.6.0")
|
||||
|
||||
api("io.undertow:undertow-core:2.3.21.Final")
|
||||
implementation("io.undertow:undertow-websockets-jsr:2.3.21.Final")
|
||||
//implementation("org.jboss.xnio:xnio-nio:3.8.16.Final")
|
||||
|
||||
implementation("org.xerial:sqlite-jdbc:3.46.0.0")
|
||||
implementation("com.zaxxer:HikariCP:4.0.3")
|
||||
implementation("nl.astraeus:simple-jdbc-stats:1.6.1")
|
||||
|
||||
api("org.jetbrains.kotlinx:kotlinx-html-jvm:0.11.0")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mavenPublishing {
|
||||
coordinates(group.toString(), name, version.toString())
|
||||
|
||||
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
|
||||
|
||||
configure(KotlinMultiplatform())
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "gitea"
|
||||
setUrl("https://gitea.astraeus.nl/api/packages/rnentjes/maven")
|
||||
|
||||
credentials {
|
||||
val giteaUsername: String? by project
|
||||
val giteaPassword: String? by project
|
||||
|
||||
username = giteaUsername
|
||||
password = giteaPassword
|
||||
}
|
||||
}
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
signAllPublications()
|
||||
|
||||
pom {
|
||||
name = "vst-ui-base"
|
||||
description = "VST UI Base"
|
||||
inceptionYear = "2024"
|
||||
url = "https://gitea.astraeus.nl/rnentjes/vst-ui-base"
|
||||
licenses {
|
||||
license {
|
||||
name = "MIT"
|
||||
url = "https://gitea.astraeus.nl/rnentjes/vst-ui-base"
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id = "rnentjes"
|
||||
name = "Rien Nentjes"
|
||||
email = "info@nentjes.com"
|
||||
}
|
||||
}
|
||||
scm {
|
||||
url = "https://gitea.astraeus.nl/rnentjes/vst-ui-base"
|
||||
}
|
||||
}
|
||||
}
|
||||
1
vst-ui-base/settings.gradle.kts
Normal file
1
vst-ui-base/settings.gradle.kts
Normal file
@@ -0,0 +1 @@
|
||||
apply(from = "../settings.common.gradle.kts")
|
||||
@@ -1,24 +1,13 @@
|
||||
package nl.astraeus.vst.ui.components
|
||||
|
||||
import kotlinx.html.classes
|
||||
import kotlinx.html.div
|
||||
import kotlinx.browser.document
|
||||
import kotlinx.html.*
|
||||
import kotlinx.html.js.onMouseDownFunction
|
||||
import kotlinx.html.js.onMouseLeaveFunction
|
||||
import kotlinx.html.js.onMouseMoveFunction
|
||||
import kotlinx.html.js.onMouseUpFunction
|
||||
import kotlinx.html.js.onWheelFunction
|
||||
import kotlinx.html.org.w3c.dom.events.Event
|
||||
import kotlinx.html.span
|
||||
import kotlinx.html.style
|
||||
import kotlinx.html.svg
|
||||
import nl.astraeus.css.properties.Color
|
||||
import nl.astraeus.css.properties.Position
|
||||
import nl.astraeus.css.properties.TextAlign
|
||||
import nl.astraeus.css.properties.em
|
||||
import nl.astraeus.css.properties.hsla
|
||||
import nl.astraeus.css.properties.prc
|
||||
import nl.astraeus.css.properties.px
|
||||
import nl.astraeus.css.properties.rem
|
||||
import nl.astraeus.css.properties.*
|
||||
import nl.astraeus.css.style.cls
|
||||
import nl.astraeus.komp.HtmlBuilder
|
||||
import nl.astraeus.komp.Komponent
|
||||
@@ -30,6 +19,7 @@ import nl.astraeus.vst.ui.css.CssId
|
||||
import nl.astraeus.vst.ui.css.CssName
|
||||
import nl.astraeus.vst.ui.util.arc
|
||||
import nl.astraeus.vst.ui.util.height
|
||||
import nl.astraeus.vst.ui.util.viewBox
|
||||
import nl.astraeus.vst.ui.util.width
|
||||
import org.w3c.dom.Element
|
||||
import org.w3c.dom.HTMLElement
|
||||
@@ -83,10 +73,6 @@ open class BaseKnobComponent(
|
||||
var startValue = 0.0
|
||||
var knobElement: Element? = null
|
||||
|
||||
private fun getMiddleX() = width / 2
|
||||
private fun getMiddleY() = ((height - 16) / 2) + 16
|
||||
private fun getRadius() = min(getMiddleX(), getMiddleY() - 16) - 5
|
||||
|
||||
override fun HtmlBuilder.render() {
|
||||
div(KnobCls.name) {
|
||||
style = "width: ${width}px; height: ${height}px"
|
||||
@@ -101,6 +87,7 @@ open class BaseKnobComponent(
|
||||
classes = classes + ActiveCls.name
|
||||
}
|
||||
|
||||
viewBox("0 0 $width $height")
|
||||
width(width)
|
||||
height(height)
|
||||
|
||||
@@ -181,6 +168,7 @@ open class BaseKnobComponent(
|
||||
if (it is MouseEvent) {
|
||||
activated = true
|
||||
setValueByMouseCoords(it, callback)
|
||||
attachGlobalMouseListeners()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,15 +184,41 @@ open class BaseKnobComponent(
|
||||
}
|
||||
}
|
||||
|
||||
onMouseLeaveFunction = {
|
||||
if (it is MouseEvent) {
|
||||
activated = false
|
||||
}
|
||||
}
|
||||
|
||||
private fun getMiddleX() = width / 2
|
||||
private fun getMiddleY() = ((height - 16) / 2) + 16
|
||||
private fun getRadius() = min(getMiddleX(), getMiddleY() - 16) - 5
|
||||
|
||||
private var globalMoveListener: ((Event) -> Unit)? = null
|
||||
private var globalUpListener: ((Event) -> Unit)? = null
|
||||
|
||||
private fun attachGlobalMouseListeners() {
|
||||
globalMoveListener = { event ->
|
||||
if (activated && event is MouseEvent) {
|
||||
setValueByMouseCoords(event, callback)
|
||||
}
|
||||
}
|
||||
|
||||
globalUpListener = { event ->
|
||||
if (event is MouseEvent) {
|
||||
deactivateKnob()
|
||||
document.removeEventListener("mousemove", globalMoveListener)
|
||||
document.removeEventListener("mouseup", globalUpListener)
|
||||
globalMoveListener = null
|
||||
globalUpListener = null
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("mousemove", globalMoveListener)
|
||||
document.addEventListener("mouseup", globalUpListener)
|
||||
}
|
||||
|
||||
private fun deactivateKnob() {
|
||||
activated = false
|
||||
}
|
||||
|
||||
private fun wheelFunction(event: Event) {
|
||||
console.log("onMouseWheelFunction", event)
|
||||
if (event is WheelEvent) {
|
||||
@@ -14,7 +14,7 @@ fun SVG.height(height: Int) {
|
||||
this.attributes["height"] = "$height"
|
||||
}
|
||||
|
||||
fun SVG.viewbox(viewbox: String) {
|
||||
fun SVG.viewBox(viewbox: String) {
|
||||
this.attributes["viewbox"] = viewbox
|
||||
}
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
package nl.astraeus.vst.base.web
|
||||
|
||||
import kotlinx.html.body
|
||||
import kotlinx.html.head
|
||||
import kotlinx.html.html
|
||||
import kotlinx.html.meta
|
||||
import kotlinx.html.script
|
||||
import kotlinx.html.*
|
||||
import kotlinx.html.stream.appendHTML
|
||||
import kotlinx.html.title
|
||||
|
||||
fun generateIndex(
|
||||
title: String,
|
||||
script: String,
|
||||
patch: String?,
|
||||
): String {
|
||||
val result = StringBuilder();
|
||||
val result = StringBuilder()
|
||||
result.append("<!DOCTYPE html>\n")
|
||||
|
||||
if (patch == null) {
|
||||
result.appendHTML(true).html {
|
||||
@@ -0,0 +1,33 @@
|
||||
package nl.astraeus.vst.base.web
|
||||
|
||||
import io.undertow.server.HttpHandler
|
||||
import io.undertow.server.HttpServerExchange
|
||||
import io.undertow.server.session.Session
|
||||
import io.undertow.server.session.SessionManager
|
||||
import io.undertow.util.Headers
|
||||
|
||||
class PatchHandler(
|
||||
val title: String,
|
||||
val scriptName: String,
|
||||
) : HttpHandler {
|
||||
override fun handleRequest(exchange: HttpServerExchange) {
|
||||
exchange.responseHeaders.put(Headers.CONTENT_TYPE, "text/html")
|
||||
if (exchange.requestPath.startsWith("/patch/")) {
|
||||
val patchId = exchange.requestPath.substring(7)
|
||||
val sessionManager = exchange.getAttachment(SessionManager.ATTACHMENT_KEY)
|
||||
var httpSession: Session? = sessionManager.getSession(exchange, VstSessionConfig.config)
|
||||
|
||||
if (httpSession == null) {
|
||||
httpSession = sessionManager.createSession(exchange, VstSessionConfig.config)
|
||||
}
|
||||
httpSession?.setAttribute("html-session", VstSession(patchId))
|
||||
|
||||
exchange.responseHeaders.put(Headers.CONTENT_TYPE, "text/html; charset=utf-8")
|
||||
exchange.responseSender.send(generateIndex(title, scriptName, null))
|
||||
} else {
|
||||
val patchId = generateId()
|
||||
|
||||
exchange.responseSender.send(generateIndex(title, scriptName, patchId))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,6 @@ import io.undertow.server.handlers.resource.ResourceHandler
|
||||
import io.undertow.server.session.Session
|
||||
import io.undertow.server.session.SessionCookieConfig
|
||||
import io.undertow.server.session.SessionManager
|
||||
import io.undertow.util.Headers
|
||||
import java.nio.file.Paths
|
||||
|
||||
object VstSessionConfig {
|
||||
@@ -31,32 +30,6 @@ object WebsocketConnectHandler : HttpHandler {
|
||||
}
|
||||
}
|
||||
|
||||
class PatchHandler(
|
||||
val title: String,
|
||||
val scriptName: String,
|
||||
) : HttpHandler {
|
||||
override fun handleRequest(exchange: HttpServerExchange) {
|
||||
exchange.responseHeaders.put(Headers.CONTENT_TYPE, "text/html")
|
||||
if (exchange.requestPath.startsWith("/patch/")) {
|
||||
val patchId = exchange.requestPath.substring(7)
|
||||
val sessionManager = exchange.getAttachment(SessionManager.ATTACHMENT_KEY)
|
||||
var httpSession: Session? = sessionManager.getSession(exchange, VstSessionConfig.config)
|
||||
|
||||
if (httpSession == null) {
|
||||
httpSession = sessionManager.createSession(exchange, VstSessionConfig.config)
|
||||
}
|
||||
httpSession?.setAttribute("html-session", VstSession(patchId))
|
||||
|
||||
exchange.responseHeaders.put(Headers.CONTENT_TYPE, "text/html; charset=utf-8")
|
||||
exchange.responseSender.send(generateIndex(title, scriptName, null))
|
||||
} else {
|
||||
val patchId = generateId()
|
||||
|
||||
exchange.responseSender.send(generateIndex(title, scriptName, patchId))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class RequestHandler(
|
||||
title: String,
|
||||
scriptName: String,
|
||||
@@ -66,9 +39,12 @@ class RequestHandler(
|
||||
|
||||
init {
|
||||
val patchHandler = PatchHandler(title, scriptName)
|
||||
val urlDataHandler = UrlDataHandler(title, scriptName)
|
||||
|
||||
pathHandler.addExactPath("/", patchHandler)
|
||||
pathHandler.addExactPath("/index.html", patchHandler)
|
||||
pathHandler.addPrefixPath("/patch", patchHandler)
|
||||
//pathHandler.addPrefixPath("/data", urlDataHandler)
|
||||
pathHandler.addExactPath("/ws", WebsocketConnectHandler)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package nl.astraeus.vst.base.web
|
||||
|
||||
import io.undertow.server.HttpHandler
|
||||
import io.undertow.server.HttpServerExchange
|
||||
import io.undertow.server.session.Session
|
||||
import io.undertow.server.session.SessionManager
|
||||
import io.undertow.util.Headers
|
||||
|
||||
class UrlDataHandler(
|
||||
val title: String,
|
||||
val scriptName: String,
|
||||
) : HttpHandler {
|
||||
override fun handleRequest(exchange: HttpServerExchange) {
|
||||
exchange.responseHeaders.put(Headers.CONTENT_TYPE, "text/html")
|
||||
|
||||
if (exchange.requestPath.startsWith("/data/")) {
|
||||
val patchJson = exchange.requestPath.substring(6)
|
||||
val sessionManager = exchange.getAttachment(SessionManager.ATTACHMENT_KEY)
|
||||
var httpSession: Session? = sessionManager.getSession(exchange, VstSessionConfig.config)
|
||||
|
||||
if (httpSession == null) {
|
||||
httpSession = sessionManager.createSession(exchange, VstSessionConfig.config)
|
||||
}
|
||||
httpSession?.setAttribute("html-session", VstSession("1"))
|
||||
|
||||
exchange.responseHeaders.put(Headers.CONTENT_TYPE, "text/html; charset=utf-8")
|
||||
exchange.responseSender.send(generateIndex(title, scriptName, null))
|
||||
} else {
|
||||
val patchId = generateId()
|
||||
|
||||
exchange.responseSender.send(generateIndex(title, scriptName, patchId))
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user