43 lines
856 B
Kotlin
43 lines
856 B
Kotlin
package nl.astraeus.vst.string.web
|
|
|
|
import kotlinx.html.body
|
|
import kotlinx.html.head
|
|
import kotlinx.html.html
|
|
import kotlinx.html.meta
|
|
import kotlinx.html.script
|
|
import kotlinx.html.stream.appendHTML
|
|
import kotlinx.html.title
|
|
|
|
fun generateIndex(patch: String?): String {
|
|
val result = StringBuilder();
|
|
|
|
if (patch == null) {
|
|
result.appendHTML(true).html {
|
|
head {
|
|
title { +"VST String" }
|
|
}
|
|
body {
|
|
script {
|
|
type = "application/javascript"
|
|
src = "/vst-string-worklet-ui.js"
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
result.appendHTML(true).html {
|
|
head {
|
|
title { +"VST Chip" }
|
|
meta {
|
|
httpEquiv = "refresh"
|
|
content = "0; url=/patch/$patch"
|
|
}
|
|
}
|
|
body {
|
|
+"Redirecting to patch $patch..."
|
|
}
|
|
}
|
|
}
|
|
|
|
return result.toString()
|
|
}
|