aboutsummaryrefslogtreecommitdiff
path: root/console/src/jsMain
diff options
context:
space:
mode:
authorecho <91651232+exhq@users.noreply.github.com>2022-08-26 18:24:39 +0430
committerGitHub <noreply@github.com>2022-08-26 18:24:39 +0430
commit547f5955f1cca47750bfa18e31f1ee56f1b7b2f3 (patch)
tree1e3306d1fd56d12f9ccc97b4c43cec3982c53cde /console/src/jsMain
parent60608b4bb1759bb58d28923b3e222d8e11eaeafa (diff)
parentc6c56d11b83d65c69b09007c7b43f0788b958ff2 (diff)
downloadexhq.github.io-547f5955f1cca47750bfa18e31f1ee56f1b7b2f3.tar.gz
exhq.github.io-547f5955f1cca47750bfa18e31f1ee56f1b7b2f3.tar.bz2
exhq.github.io-547f5955f1cca47750bfa18e31f1ee56f1b7b2f3.zip
Merge pull request #5 from romangraef/main
nea my beloved
Diffstat (limited to 'console/src/jsMain')
-rw-r--r--console/src/jsMain/kotlin/main.kt41
-rw-r--r--console/src/jsMain/resources/index.html13
2 files changed, 54 insertions, 0 deletions
diff --git a/console/src/jsMain/kotlin/main.kt b/console/src/jsMain/kotlin/main.kt
new file mode 100644
index 0000000..c0a4f38
--- /dev/null
+++ b/console/src/jsMain/kotlin/main.kt
@@ -0,0 +1,41 @@
+import kotlinx.browser.document
+import kotlinx.css.minHeight
+import kotlinx.css.vh
+import kotlinx.html.dom.append
+import kotlinx.html.js.div
+import moe.nea89.website.KConsole
+import moe.nea89.website.Styles
+import moe.nea89.website.defaultLsCommand
+import moe.nea89.website.fileSystem
+import styled.injectGlobal
+
+
+val defaultFileSystem = fileSystem {
+ "etc" {
+ "passwd" text "hunter2"
+ }
+ "home/nea" {
+ "todo" text """
+ | - git gud
+ | - finish this website
+ | - convince the general public that comic sans is a viable font
+ """.trimMargin()
+ }
+ "flag" text "CTF{12345abcdefghijklmonp3.1.4.1.5.9.2.8}"
+}
+
+fun main() {
+ injectGlobal {
+ ".${Styles.consoleClass}" {
+ minHeight = 100.vh
+ }
+ }
+
+ val root = document.body!!.append.div()
+ val console = KConsole.createFor(root, fileSystem = defaultFileSystem)
+ console.addLine("Starting stfff")
+ console.PS1 = { "echowebsite > " }
+ console.rerender()
+ console.registerCommand(defaultLsCommand("ls"))
+
+} \ No newline at end of file
diff --git a/console/src/jsMain/resources/index.html b/console/src/jsMain/resources/index.html
new file mode 100644
index 0000000..dfa64ec
--- /dev/null
+++ b/console/src/jsMain/resources/index.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8">
+ <meta name="viewport"
+ content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
+ <title>Document</title>
+</head>
+<body>
+<script src="exhqwebsitebeta.js"></script>
+</body>
+</html> \ No newline at end of file