Created
July 26, 2024 21:36
-
-
Save dumorando/bc42fc739f18000052ede40f3c437d16 to your computer and use it in GitHub Desktop.
uwu.dumorando.com source code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
//run this as a cgi script | |
const querystring = require('node:querystring'); | |
const qs = querystring.decode(process.env.QUERY_STRING); | |
function ReturnJson(json, success) { | |
console.log("Content-Type: application/json"); | |
//disable cors | |
console.log("Access-Control-Allow-Origin: *"); | |
if (success) console.log("X-Comedy: Extreme"); | |
console.log(); | |
console.log(JSON.stringify(json)); | |
process.exit(Number(!success)); | |
} | |
if (!qs.text) { | |
ReturnJson({ | |
error: 'no text provided in query parameter..', | |
example: 'https://uwu.dumorando.com/?text=hello there' | |
}); | |
} | |
const text = qs.text; | |
var faces = ["(・`ω´・)", ";;w;;", "owo", "UwU", ">w<", "^w^"]; | |
function uwu(txt) { | |
v = txt; | |
v = v.replace(/(?:r|l)/g, "w"); | |
v = v.replace(/(?:R|L)/g, "W"); | |
v = v.replace(/n([aeiou])/g, "ny$1"); | |
v = v.replace(/N([aeiou])/g, "Ny$1"); | |
v = v.replace(/N([AEIOU])/g, "Ny$1"); | |
v = v.replace(/ove/g, "uv"); | |
v = v.replace( | |
/\!+/g, | |
" " + faces[Math.floor(Math.random() * faces.length)] + " " | |
); | |
return v; | |
} | |
ReturnJson({ | |
result: uwu(text) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment