summaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea89
diff options
context:
space:
mode:
authornea <romangraef@gmail.com>2022-08-20 15:48:04 +0200
committernea <romangraef@gmail.com>2022-08-20 15:48:04 +0200
commit6207fd482a685527fda286e0df5d4fa87aa85149 (patch)
tree497bc3aa56286ce29224ae83382396ee69462e82 /src/main/kotlin/moe/nea89
parent893ece6b2f02329d460538311f572cb5b1936d3f (diff)
downloadneamoe-6207fd482a685527fda286e0df5d4fa87aa85149.tar.gz
neamoe-6207fd482a685527fda286e0df5d4fa87aa85149.tar.bz2
neamoe-6207fd482a685527fda286e0df5d4fa87aa85149.zip
subprojectification
Diffstat (limited to 'src/main/kotlin/moe/nea89')
-rw-r--r--src/main/kotlin/moe/nea89/website/AsciiArt.kt5
-rw-r--r--src/main/kotlin/moe/nea89/website/KConsole.kt1
-rw-r--r--src/main/kotlin/moe/nea89/website/index.kt124
3 files changed, 0 insertions, 130 deletions
diff --git a/src/main/kotlin/moe/nea89/website/AsciiArt.kt b/src/main/kotlin/moe/nea89/website/AsciiArt.kt
deleted file mode 100644
index 6acc8b5..0000000
--- a/src/main/kotlin/moe/nea89/website/AsciiArt.kt
+++ /dev/null
@@ -1,5 +0,0 @@
-package moe.nea89.website
-
-import kotlinext.js.require
-
-val boobs = require("./asciiart/boob.txt") as String \ No newline at end of file
diff --git a/src/main/kotlin/moe/nea89/website/KConsole.kt b/src/main/kotlin/moe/nea89/website/KConsole.kt
index dd37223..56a6e3c 100644
--- a/src/main/kotlin/moe/nea89/website/KConsole.kt
+++ b/src/main/kotlin/moe/nea89/website/KConsole.kt
@@ -34,7 +34,6 @@ class KConsole(
element.classList.add(Styles.consoleClass)
val console = KConsole(element, text, prompt, fileSystem)
document.body!!.onkeydown = console::keydown
- console.addLine("Starting up terminal.")
console.rerender()
return console
}
diff --git a/src/main/kotlin/moe/nea89/website/index.kt b/src/main/kotlin/moe/nea89/website/index.kt
deleted file mode 100644
index e52d942..0000000
--- a/src/main/kotlin/moe/nea89/website/index.kt
+++ /dev/null
@@ -1,124 +0,0 @@
-package moe.nea89.website
-
-import kotlinext.js.require
-import kotlinx.browser.document
-import kotlinx.html.dom.append
-import kotlinx.html.dom.create
-import kotlinx.html.img
-import kotlinx.html.js.a
-import kotlinx.html.js.div
-import kotlinx.html.js.p
-import styled.injectGlobal
-import kotlin.time.Duration.Companion.milliseconds
-
-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()
- "moisturized" image require("images/moisturized.jpg")
- "download" download require("images/me.jpeg")
- }
- "flag" text "CTF{12345abcdefghijklmonp3.1.4.1.5.9.2.8}"
-}
-
-fun main() {
-
- require("@fontsource/comic-mono/index.css")
- injectGlobal(Styles.global)
- val root = document.body!!.append.div()
- val console = KConsole.createFor(root, fileSystem = defaultFileSystem)
- console.PS1 = ">"
- console.rerender()
- console.registerCommand(command("cwd", "pwd") {
- val fa = requireFileAccessor()
- console.addLine(fa.currentDir.joinToString(separator = "/", prefix = "/"))
- })
- console.registerCommand(command("cd") {
- val fa = requireFileAccessor()
- val path = args.singleOrNull()
- if (path == null) {
- console.addLine("Usage: cd <directory>")
- return@command
- }
- val error = fa.cd(path)
- if (error != null) {
- console.addLine("cd: ${error.name}")
- }
- })
- console.registerCommand(command("ls") {
- val fa = requireFileAccessor()
- val path = when (args.size) {
- 0 -> "."
- 1 -> args[0]
- else -> {
- console.addLine("Usage: ls [directory or file]")
- return@command
- }
- }
- val file = fa.resolve(path)
- if (file == null) {
- console.addLine("ls: Could not find file or directory")
- return@command
- }
- when (file) {
- is KFile.Directory -> {
- val longestName = file.files.keys.maxOf { it.length }
- file.files.forEach { (name, file) ->
- wait(200.milliseconds)
- console.addLine(
- name + " ".repeat(longestName + 1 - name.length) + file.fileType
- )
- console.rerender()
- }
- }
-
- else -> console.addLine("ls: is a ${file.fileType}")
- }
- })
- console.registerCommand(command("color") {
- console.addLine("This is a ", red("red"), " word: ", green("1.0"), " ", blue("BLUUEEE"))
- })
- console.registerCommand(command("cat") {
- val fa = requireFileAccessor()
- val path = when (args.size) {
- 1 -> args[0]
- else -> {
- console.addLine("Usage: cat [directory or file]")
- return@command
- }
- }
- val file = fa.resolve(path)
- if (file == null) {
- console.addLine("cat: Could not find file or directory")
- return@command
- }
- when (file) {
- is KFile.Directory -> console.addLine("cat: Is a directory")
- is KFile.Text -> console.addMultilineText(file.text)
- is KFile.Image -> console.addLine(document.create.p {
- img(src = file.url)
- })
-
- is KFile.Download -> {
- val link = document.create.a(file.url)
- link.download = file.name.last()
- document.body!!.append(link)
- link.click()
- link.remove()
- console.addLine("Download started")
- }
- }
- })
- console.registerCommand(command("dick", "cock") {
- console.addMultilineText("Hehe")
- })
- console.registerCommand(command("boob", "booob") {
- console.addMultilineText(boobs)
- })
-} \ No newline at end of file