main #8
7 changed files with 7561 additions and 13 deletions
|
@ -211,3 +211,21 @@ fun getBeep(): String {
|
|||
"$randomBot$randomBalloon$bGen$eGen$pGen"
|
||||
}
|
||||
}
|
||||
|
||||
fun getKaomoji(): String {
|
||||
val kaomoji =
|
||||
listOf(
|
||||
":3",
|
||||
"\u200B>:3",
|
||||
":3c",
|
||||
"\u200B>:3c",
|
||||
"(✖╭╮✖)",
|
||||
"(◣_◢)",
|
||||
"(▰˘◡˘▰)",
|
||||
"(✯ᴗ✯)",
|
||||
)
|
||||
|
||||
val randomKaomoji = kaomoji.asSequence().shuffled().find { true }
|
||||
|
||||
return "$randomKaomoji"
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import io.ktor.server.response.*
|
|||
import io.ktor.server.routing.*
|
||||
import observer.nelle.nelleObserverBackend.*
|
||||
import observer.nelle.nelleObserverBackend.helpers.getBeep
|
||||
import observer.nelle.nelleObserverBackend.helpers.getKaomoji
|
||||
import observer.nelle.nelleObserverBackend.helpers.getMeow
|
||||
import observer.nelle.nelleObserverBackend.helpers.storeMessage
|
||||
import java.util.*
|
||||
|
@ -19,6 +20,7 @@ import kotlin.time.Duration.Companion.minutes
|
|||
|
||||
var meowTimedOut = false
|
||||
var beepTimedOut = false
|
||||
var kaomojiTimedOut = false
|
||||
|
||||
// function to facilitate the timeout for meows
|
||||
fun meowTimer() {
|
||||
|
@ -49,6 +51,20 @@ fun beepTimer() {
|
|||
)
|
||||
}
|
||||
|
||||
// same as meowTimer, but for kaomoji's
|
||||
fun kaomojiTimer() {
|
||||
kaomojiTimedOut = true
|
||||
val timeoutTime = (1..1440).random().minutes
|
||||
Timer("SettingUp", true).schedule(
|
||||
timerTask {
|
||||
kaomojiTimedOut = false
|
||||
logger.debug { "timeout reset" }
|
||||
},
|
||||
// 33 minutes in milliseconds
|
||||
timeoutTime.inWholeMilliseconds,
|
||||
)
|
||||
}
|
||||
|
||||
// this is where the fun REST comes in!
|
||||
fun Application.configureRouting(client: HttpClient) {
|
||||
routing {
|
||||
|
@ -94,7 +110,7 @@ fun Application.configureRouting(client: HttpClient) {
|
|||
|
||||
// beep
|
||||
route("/beep") {
|
||||
// get meow timeout
|
||||
// get beep timeout
|
||||
get {
|
||||
if (beepTimedOut) {
|
||||
call.response.status(HttpStatusCode(423, "Timed Out"))
|
||||
|
@ -129,7 +145,43 @@ fun Application.configureRouting(client: HttpClient) {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO
|
||||
// kaomoji
|
||||
route("/kaomoji") {
|
||||
// get kamoji timeout
|
||||
get {
|
||||
if (beepTimedOut) {
|
||||
call.response.status(HttpStatusCode(423, "Timed Out"))
|
||||
call.respondText("Timed Out")
|
||||
logger.debug { "timed out" }
|
||||
} else {
|
||||
call.response.status(HttpStatusCode(100, "Not Timed Out"))
|
||||
call.respondText("Not Timed Out")
|
||||
logger.debug { "not timed out" }
|
||||
}
|
||||
}
|
||||
// kaomoji button
|
||||
post {
|
||||
if (call.receiveText() == superSecret) {
|
||||
call.response.status(HttpStatusCode(201, "Meow Posted"))
|
||||
makePost(client, getKaomoji(), instanceDomain)
|
||||
call.respondText("beeped with bypass")
|
||||
logger.info { "beeped with bypass" }
|
||||
} else {
|
||||
if (beepTimedOut) {
|
||||
call.response.status(HttpStatusCode(423, "Timed Out"))
|
||||
call.respondText("still sleeping...")
|
||||
logger.info { "failed beeped" }
|
||||
} else {
|
||||
call.response.status(HttpStatusCode(201, "Meow Posted"))
|
||||
makePost(client, getKaomoji(), instanceDomain)
|
||||
kaomojiTimer()
|
||||
call.respondText("beep sent!")
|
||||
logger.info { "beeped" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
route("/ntfy") {
|
||||
get {
|
||||
}
|
||||
|
|
7357
frontend/package-lock.json
generated
Normal file
7357
frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -26,13 +26,6 @@ async function getMeowTimeout(endpoint) {
|
|||
}
|
||||
}
|
||||
|
||||
function sendBeep(endpoint) {
|
||||
const request = new XMLHttpRequest();
|
||||
request.open("POST", endpoint);
|
||||
request.send("superSecret=null");
|
||||
console.warn(request.response.text);
|
||||
}
|
||||
|
||||
async function getBeepTimeout(endpoint) {
|
||||
const response = await fetch(endpoint)
|
||||
if (response.status === 423) {
|
||||
|
@ -46,3 +39,17 @@ async function getBeepTimeout(endpoint) {
|
|||
console.warn("NOT TIMED OUT")
|
||||
}
|
||||
}
|
||||
|
||||
async function getKaomojiTimeout(endpoint) {
|
||||
const response = await fetch(endpoint)
|
||||
if (response.status === 423) {
|
||||
kaomojiButton.disabled=true;
|
||||
kaomojiButton.innerHTML = "<span>sleeping...</span>";
|
||||
console.warn("TIMED OUT")
|
||||
}
|
||||
if (response.status === 100) {
|
||||
kaomojiButton.disabled=false;
|
||||
kaomojiButton.innerHTML = "<span>meow</span>";
|
||||
console.warn("NOT TIMED OUT")
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
const meowEndpoint = "https://nelle.observer/api/meow";
|
||||
const beepEndpoint = "https://nelle.observer/api/beep";
|
||||
const kaomojiEndpoint = "https://nelle.observer/api/kaomoji";
|
||||
var random_boolean = Math.random() < 0.5;
|
||||
|
||||
// loads all the functions to be loaded on load, pretty simple, it loads shit on load.
|
||||
function onLoad() {
|
||||
|
@ -10,6 +12,7 @@ function onLoad() {
|
|||
getPlaceholder();
|
||||
getMeowTimeout(meowEndpoint);
|
||||
getBeepTimeout(beepEndpoint);
|
||||
getKaomojiTimeout(beepEndpoint);
|
||||
}
|
||||
|
||||
// if javascript is enabled, this script will load, enabling all site elements that use javascript, by default these are all hidden.
|
||||
|
@ -61,21 +64,29 @@ function redirect() {
|
|||
// meow
|
||||
const meowButton = document.getElementById("meow-button");
|
||||
const beepButton = document.getElementById("beep-button");
|
||||
const kaomojiButton = document.getElementById("kaomoji-button");
|
||||
|
||||
// on send button click
|
||||
// on send meow button click
|
||||
async function meowClick() {
|
||||
meowButton.disabled=true;
|
||||
meowButton.innerHTML = "<span>sleeping...</span>";
|
||||
sendMeow(meowEndpoint);
|
||||
}
|
||||
|
||||
// on send button click
|
||||
// on send beep button click
|
||||
async function beepClick() {
|
||||
beepButton.disabled=true;
|
||||
beepButton.innerHTML = "<span>sleeping...</span>";
|
||||
sendMeow(beepEndpoint);
|
||||
}
|
||||
|
||||
// on send kaomoji button click
|
||||
async function kaomojiClick() {
|
||||
kaomojiButton.disabled=true;
|
||||
kaomojiButton.innerHTML = "<span>sleeping...</span>";
|
||||
sendMeow(kaomojiEndpoint);
|
||||
}
|
||||
|
||||
|
||||
// Show/Hide Info Boxes
|
||||
const posterInfoButton = document.getElementById("poster-info-button");
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* default */
|
||||
:root {
|
||||
--text: #f2ede7;
|
||||
--background: var(--background-950);
|
||||
|
@ -90,3 +91,98 @@
|
|||
--alt-accent-900: #0b3300;
|
||||
--alt-accent-950: #061900;
|
||||
}
|
||||
|
||||
/* green */
|
||||
#green :root {
|
||||
--text: #e7eeea;
|
||||
--background: #060d09;
|
||||
--primary: #9ae2b9;
|
||||
--secondary: #14904a;
|
||||
--accent: #47e48a;
|
||||
|
||||
--content-gradient: linear-gradient(to bottom right, var(--secondary-800), var(--primary-900));
|
||||
--accent-gradient: linear-gradient(to bottom right, var(--accent), var(--accent-200) 30%, var(--text) 60%);
|
||||
|
||||
--link: var(--accent-300);
|
||||
--visited: var(--accent-400);
|
||||
--hover: var(--accent-500);
|
||||
|
||||
--text-50: #f0f4f2;
|
||||
--text-100: #e1eae5;
|
||||
--text-200: #c3d5cb;
|
||||
--text-300: #a5c0b1;
|
||||
--text-400: #88aa97;
|
||||
--text-500: #6a957d;
|
||||
--text-600: #557764;
|
||||
--text-700: #3f5a4b;
|
||||
--text-800: #2a3c32;
|
||||
--text-900: #151e19;
|
||||
--text-950: #0b0f0c;
|
||||
|
||||
--background-50: #eef7f2;
|
||||
--background-100: #dcefe4;
|
||||
--background-200: #b9dfc9;
|
||||
--background-300: #96cfaf;
|
||||
--background-400: #73bf94;
|
||||
--background-500: #50af79;
|
||||
--background-600: #408c61;
|
||||
--background-700: #306949;
|
||||
--background-800: #204630;
|
||||
--background-900: #102318;
|
||||
--background-950: #08110c;
|
||||
|
||||
--primary-50: #ebf9f1;
|
||||
--primary-100: #d7f4e4;
|
||||
--primary-200: #b0e8c8;
|
||||
--primary-300: #88ddad;
|
||||
--primary-400: #61d192;
|
||||
--primary-500: #39c676;
|
||||
--primary-600: #2e9e5f;
|
||||
--primary-700: #227747;
|
||||
--primary-800: #174f2f;
|
||||
--primary-900: #0b2818;
|
||||
--primary-950: #06140c;
|
||||
|
||||
--secondary-50: #e9fcf1;
|
||||
--secondary-100: #d2f9e3;
|
||||
--secondary-200: #a5f3c7;
|
||||
--secondary-300: #78edab;
|
||||
--secondary-400: #4be78f;
|
||||
--secondary-500: #1fe073;
|
||||
--secondary-600: #18b45c;
|
||||
--secondary-700: #128745;
|
||||
--secondary-800: #0c5a2e;
|
||||
--secondary-900: #062d17;
|
||||
--secondary-950: #03160b;
|
||||
|
||||
--accent-50: #e9fcf1;
|
||||
--accent-100: #d3f8e3;
|
||||
--accent-200: #a6f2c7;
|
||||
--accent-300: #7aebab;
|
||||
--accent-400: #4ee48f;
|
||||
--accent-500: #21de73;
|
||||
--accent-600: #1bb15c;
|
||||
--accent-700: #148545;
|
||||
--accent-800: #0d592e;
|
||||
--accent-900: #072c17;
|
||||
--accent-950: #03160b;
|
||||
|
||||
--alt-accent: #fbb055;
|
||||
|
||||
/* TODO: Alter This */
|
||||
--glitch-1: var(--alt-accent-400);
|
||||
--glitch-2: var(--alt-accent-500);
|
||||
--glitch-3: var(--alt-accent-600);
|
||||
|
||||
--alt-accent-50: #fef3e7;
|
||||
--alt-accent-100: #fce8cf;
|
||||
--alt-accent-200: #fad19e;
|
||||
--alt-accent-300: #f7b96e;
|
||||
--alt-accent-400: #f5a23d;
|
||||
--alt-accent-500: #f28b0d;
|
||||
--alt-accent-600: #c26f0a;
|
||||
--alt-accent-700: #915308;
|
||||
--alt-accent-800: #613805;
|
||||
--alt-accent-900: #301c03;
|
||||
--alt-accent-950: #180e01;
|
||||
}
|
|
@ -19,9 +19,16 @@
|
|||
<span>beep</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="custom-btn btn-1 beep-buttons"
|
||||
onclick="kaomoji-click()"
|
||||
id="kaomoji-button">
|
||||
<span>( ꈍᴗꈍ)</span>
|
||||
</button>
|
||||
|
||||
<div id="poster-info" style="display: none;">
|
||||
<br>you can POST to <span class="glitch">https://nelle.observer/api/meow</span> or <span class="glitch">https://nelle.observer/api/beep</span>
|
||||
respectively, and GET at the same endpoints to check the status of the timer.</small>
|
||||
respectively, and GET at the same endpoints to check the status of the timer.
|
||||
</div>
|
||||
<br>
|
||||
<a onclick="showPosterInfo()"><span id="poster-info-button" class="glitch" style="cursor: pointer;">[show more info]</span></a>
|
||||
|
|
Loading…
Reference in a new issue