diff --git a/assets/wrapper.html b/assets/wrapper.html index b50ada6..79f3354 100644 --- a/assets/wrapper.html +++ b/assets/wrapper.html @@ -4,9 +4,9 @@ {{title}} - - {{#essay}} - {{/essay}} + + {{#essay}} + {{/essay}} {{{body}}} diff --git a/commits.txt b/commits.txt new file mode 100644 index 0000000..95cfd3c --- /dev/null +++ b/commits.txt @@ -0,0 +1,655 @@ + ¯\_(ツ)_/¯ +"Get that shit outta my master." +#GrammarNazi +$(init 0) +$(rm -rvf .) +(\ /)
(O.o)
(> <) Bunny approves these changes. +(c) Microsoft 1988 +--help +-m \'So I hear you like commits ...\' +. +... +/sigh +50/50 +640K ought to be enough for anybody +8==========D +:(:( +:q! +??! what the ... +A fix I believe, not like I tested or anything +A full commitment's what I'm thinking of +A long time ago, in a galaxy far far away... +A tale of Dragons, Heroes and Legends... +ALL SORTS OF THINGS +Abandon all hope, ye who enter here. +Actual final build before release +Add Sandbox +Added a banner to the default admin page. Please have mercy on me =( +Added another dependency +Added missing file in previous commit +Added some NullPointerExceptions - Happy easter, you bastards! :D +Added translation. +All your codebase are belong to us. +And a commit that I don't know the reason of... +And if you ask me how I'm feeling +Another bug bites the dust +Another commit to keep my CAN streak going. +Apparently works-for-me is a crappy excuse. +Argh! About to give up :( +Arrrrgggg +At times like this I wish I was a Garbage Man. +Automate Accounting +Batman! (this commit has no parents) +Become a programmer, they said. It'll be fun, they said. +Best commit ever +Bit Bucket is down. What should I do now? +Blaming regex. +By works, I meant 'doesnt work'. Works now.. +COMMIT ALL THE FILES! +Can someone review this commit, please ? +Check next commit for message. +Chuck Norris Emailed Me This Patch... I'm Not Going To Question It +Code was clean until manager requested to fuck it up +Commit committed +Commit committed.... +Committed some changes +Committing fixes in the dark, seriously, who killed my power!? +Committing in accordance with the prophecy. +Completed with no bugs... +Continued development... +Copy pasta fail. still had a instead of a +Copy-paste to fix previous copy-paste +Corrected mistakes +Crap. Tonight is raid night and I am already late. +DEAL WITH IT +DNS_PROBE_FINISHED_NXDOMAIN +Derp +Derp search/replace fuckup +Derp, asset redirection in dev mode +Derp. Fix missing constant post rename +Derpy hooves +Do things better, faster, stronger +Does anyone read this? I'll be at the coffee shop accross the street. +Does not work. +Does this work +Don't Ask Me, I Have No Idea Why This Works Either +Don't push this commit +Don't tell me you're too blind to see +Done, to whoever merges this, good luck. +Don’t even try to refactor it. +Don’t mess with Voodoo +Duh +Easteregg +Either Hot Shit or Total Bollocks +Errare humanum est. +FONDLED THE CODE +FOR REAL. +FUCKING XUPPERNAMEX +Feed. You. Stuff. No time. +Final commit, ready for tagging +Fingers crossed! +Finished fondling. +First Blood +Fix PC Load Letter Error +Fix all errors, all errors on the WORLD!!!! +Fix edge, single client, error case +Fix hard-coded [object Object] string (thanks!) +Fix my stupidness +Fix the fixes +Fixed Bug +Fixed a bug cause XNAMEX said to +Fixed a bug in NoteLineCount... not seriously... +Fixed a little bug... +Fixed compilation errors +Fixed errors +Fixed everything. +Fixed mispeling +Fixed so the code compiles +Fixed some shit +Fixed the build. +Fixed the fuck out of #XNUMX! +Fixed unnecessary bug. +Fixed what was broken. +Fixing XNAMEX's bug. +Fixing XNAMEX's bugs. +For great justice. +For real, this time. +For the sake of my sanity, just ignore this... +For the statistics only +Friday 5pm +Fuck it, YOLO! +Fucking egotistical bastard. adds expandtab to vimrc +Fucking submodule bull shit +Fucking templates. +Future self, please forgive me and don't hit me with the baseball bat again! +GIT :/ +General commit (no IDs open) - Modifications for bad implementations +Git wants e to commit, I want to sleep. Take me sweet void. +Give me a break, it's 2am. But it works now. +Glue. Match sticks. Paper. Build script! +Gotta make you understand +Gross hack because XNAMEX doesn't know how to code +Handled a particular error. +Here be Dragons +Herp derp I left the debug in there and forgot to reset errors. +Herpderp, shoulda check if it does really compile. +Herping the derp +Herping the derp derp (silly scoping error) +Herping the fucking derp right here and now. +Herpy dooves. +Hide those navs, boi! +I CAN HAZ COMMENTZ. +I CAN HAZ PYTHON, I CAN HAZ INDENTS +I __ a word +I already said I was sorry +I am Root. We are Root. +I am Spartacus +I am even stupider than I thought +I am sorry +I am the greatest javascript developer in the world. +I can't believe it took so long to fix this. +I cannot believe that it took this long to write a test for this. +I did it for the lulz! +I don't believe it +I don't get paid enough for this shit. +I don't give a damn 'bout my reputation +I don't know what the hell I was thinking. +I don't know what these changes are supposed to accomplish but somebody told me to make them. +I don't know why. Just move on. +I dont know what I am doing +I expected something different. +I forgot to commit... So here you go. +I had a cup of tea and now it's fixed +I hate this fucking language. +I have no idea what I'm doing here. +I honestly wish I could remember what was going on here... +I immediately regret this commit. +I just evaluated random code in my console +I just wanna tell you how I'm feeling +I know what I am doing. Trust me. +I know, I know, this is not how I’m supposed to do it, but I can't think of something better. +I made leetle mistake +I must enjoy torturing myself +I must have been drunk. +I must sleep... it's working... in just three hours... +I really should've committed this when I finished it... +I should get a raise for this. +I should have had a V8 this morning. +I think now it works +I transformed a bug into a feature. Once you learn how, you'll never forget it +I understand that it's an antipattern, but it's convenient. +I was told to leave it alone, but I have this thing called OCD, you see +I was wrong... +I will not apologize for art. +I will run 'terraform fmt' before committing. +I would rather be playing SC2. +I'M PUSHING. +I'll explain this when I'm sober .. or revert it +I'll explain when you're older! +I'm guessing this may start causing us problems either soon or never. +I'm human +I'm hungry +I'm just a grunt. Don't blame me for this awful PoS. +I'm sorry. +I'm too foo for this bar +I'm too old for this shit! +I'm totally adding this to epic win. +300 +ID:10T Error +IEize +If it's hacky and you know it clap you hands (clap clap)! +If it's stupid and it works, it ain't stupid +Improvements +Improving the fix +Insert Commit Message Here +Inside we both know what's been going on +Is there an achievement for this? +Is there an award for this? +Issue #XNUM10X is now Issue #XNUM30X +It Compiles! 50 Points For Gryffindor. +It compiles! Ship it! +It fucking compiles \:D/ +It only compiles every XNUM2,5X tries... good luck. +It was the best of times, it was the worst of times +It worked for me... +It works on my computer +It works! +It'd be nice if type errors caused the compiler to issue a type error +It's 2016; why are we using ColdFusion?! +It's Working! +It's getting hard to keep up with the crap I've trashed +It's possible! you can turn a 50-line code chunk into just 3 lines. Here's how +It's secret! +It's time to go home +Just committing so I can go home +Just stop reading these for a while, ok.. +LAST time, XNAMEX, /dev/urandom IS NOT a variable name generator... +LOL! +LOTS of changes. period +Landed. +Last time I said it works? I was kidding. Try this. +Locating the required gigapixels to render... +Lock S-foils in attack position +Love coding? here's the secret reason why +Low On Caffeine, Please Forgive Coding Style +MOAR BIFURCATION +Made it to compile... +Major fixup. +Make Sure You Are Square With Your God Before Trying To Merge This +Make that it works in 90% of the cases. 3:30. +Merge pull my finger request +Merge pull request #67 from Lazersmoke/fix-andys-shit Fix andys shit +Merging 'WIP: Do Not Merge This Branch' Into Master +Merging the merge +Minor updates +Misc. fixes +Mongo.db was empty, filled now with good stuff +More ignore +Moved something to somewhere... goodnight... +My bad +My boss forced me to build this feature... Pure shit. +NOJIRA: No cry +NSA backdoor - ignore +Never Run This Commit As Root +Never before had a small typo like this one caused so much damage. +Never gonna give you up +Never gonna give, never gonna give +Never gonna let you down +Never gonna make you cry +Never gonna run around and desert you +Never gonna say goodbye +Never gonna tell a lie and hurt you +Next time someone asks you how to fix an infinite loop, remember this commit +Nitpicking about alphabetizing methods, minor OCD thing +No changes after this point. +No changes made +No time to commit.. My people need me! +Nobody had ever created a function like this one before. +Not one conflict, today was a good day. +Not sure why +Nothing to see here, move along +Now added delete for real +Now it's all microservices, I hope the fad persists. +Now we tell you your browser sucks in your native tongue. +Obligatory placeholder commit message +Oh my god what year is it?! +Oh no +Ok +Ok, 5am, it works. For real. +One does not simply merge into master +One little whitespace gets its very own commit! Oh, life is so erratic! +One more time, but with feeling. +Only Tom Cruise knows why. +Out for vacation... DONT YOU DARE TO CALL ME. +PEBKAC +Peopleware Chapter 8: "You Never Get Anything Done around Here between 9 and 5." +Pig +Pipeline goes brrrrrrr +Please enter the commit message for your changes. Lines starting with '#' will be ignored, and an empty message aborts the commit. +Please forgive me +Please no changes this time. +Please our Lord and Savior the Great Linter. +Popping stash +Programming the flux capacitor +Push poorly written test can down the road another ten years +Put everything in its right place +QuickFix. +REALLY FUCKING FIXED +Refactor factories, revisit visitors +Refactored configuration. +Reinventing the wheel. Again. +Removed code. +Removed test case since code didn't pass QA +Removed the 2gb .hprof file from git history +Removing unecessary stuff +Replace all whitespaces with tabs. +Reset error count between rows. herpderp +Reticulating splines... +Revert "fuckup". +Revert "git please work" +Revert "just testing, remember to revert" +Revert this commit +Rush B! +SEXY RUSSIAN CODES WAITING FOR YOU TO CALL +SHIT ===> GOLD +SOAP is a piece of shit +Saint Pipeline, please give me the green light +Same as last commit with changes +See last commit +Shit code! +Shovelling coal into the server... +So my boss wanted this button ... +Some bugs fixed +Some shit. +Somebody set up us the bomb. +Something fixed +Spinning up the hamster... +Still can't get this right... +Stuff +Switched off unit test XNUM15X because the build had to go out now and there was no time to fix it properly. +TDD: 1, Me: 0 +TODO: Fix later +TODO: Replace placeholder code +TODO: Replace stubs +TODO: Tell someone to implement this +TODO: write meaningful commit message +Test commit. Please ignore +Testing in progress ;) +Testing the test +That last commit message about silly mistakes pales in comparision to this one +That's just how I roll +The dog is eating my code +The last time I tried this the monkey didn't survive. Let's hope it works better this time. +The same thing we do every night, Pinky - try to take over the world! +The universe is possible +They came from... Behind +Things went wrong... +This Is Why We Don't Push To Production On Fridays +This branch is so dirty, even your mom can't clean it. +This bug has driven lots of coders completely mad. You won't believe how it ended up being fixed +This bunny should be killed. +This changes nothing, don't look +This commit is a lie +This is a basic implementation that works. +This is my code. My code is amazing. +This is not a commit +This is not the commit message you are looking for +This is supposed to crash +This is the last time we let XNAMEX commit ascii porn in the comments. +This is where it all begins... +This is why git rebase is a horrible horrible thing. +This is why the cat shouldn't sit on my keyboard. +This really should not take 19 minutes to build. +This should work until december 2013. +This solves it. +This was the most stupid bug in the world, fixed in the smartest way ever +This will definitely break in 20XNUM20,89X (TODO) +To be honest, I do not quite remember everything I changed here today. But it is all good, I tell ya. +To those I leave behind, good luck! +Todo!!! +Too lazy to write descriptive message +Too tired to write descriptive message +Transpiled mainframe. +Trust me, I'm an engineer!... What the f*ck did just happened here? +Trust me, it's not badly written. It's just way above your head. +Trying to fake a conflict +Ugh. Bad rebase. +Undoing last comming +Update .gitignore +Update commit_messages.txt +Updated +Updated build targets. +Updated framework to the lattest version +Use a real JS construct, WTF knows why this works in chromium. +Useful text +Version control is awful +WHO THE FUCK CAME UP WITH MAKE? +WIP, always +WIPTF +WTF is this. +We Had To Use Dark Magic To Make This Work +We know the game and we're gonna play it +We should delete this crap before shipping. +We should get someone from Purdue to do this. They are the boilerplaters. +We'll figure it out on Monday +We're no strangers to love +We've known each other for so long +Well the book was obviously wrong. +Well, it's doing something. +What happens in vegas stays in vegas +Whatever will be, will be 8{ +Whatever. +Whee, good night. +Whee. +Who Let the Bugs Out?? +Who has two thumbs and remembers the rudiments of his linear algebra courses? Apparently, this guy. +Who knows WTF?! +Who knows... +Why The Fuck? +Working on WIP +Working on tests (haha) +Wubbalubbadubdub! +XNAMEX broke the regex, lame +XNAMEX made me do it +XNAMEX rebase plx? +XNAMEX sucks +XUPPERNAMEX SUCKS +XUPPERNAMEX, WE WENT OVER THIS. C++ IO SUCKS. +XUPPERNAMEX, WE WENT OVER THIS. EXPANDTAB. +Yep, XNAMEX was right on this one. +Yes, I was being sarcastic. +You can't see it, but I'm making a very angry face right now +You know the rules and so do I +You should have trusted me. +You wouldn't get this from any other guy +Your commit is writing checks your merge can't cash. +Your heart's been aching but you're too shy to say it +[Insert your commit message here. Be sure to make it descriptive.] +[no message] +[skip ci] I'll fix the build monday +_ +a few bits tried to escape, but we caught them +a lot of shit +accidental commit +add actual words +add dirty scripts from the dark side of the universe +added code +added message +added security. +added some filthy stuff +added super-widget 2.0. +after of this commit remember do a git reset hard +ajax-loader hotness, oh yeah +and a comma +and so the crazy refactoring process sees the sunlight after some months in the dark! +another big bag of changes +apparently i did something… +arrgghh... damn this thing for not working. +arrrggghhhhh fixed! +asdfasdfasdfasdfasdfasdfadsf +assorted changes +bad things happen when you forget about that one little change you made ages ago +bara bra grejjor +better code +better grepping +better ignores +betterer code +bifurcation +bla +breathe, =, breathe +buenas those-things. +bug fix +bugger +bump to 0.0.3-dev:wq +bumping poms +c&p fail +changed things... +changes +ci test +clarify further the brokenness of C++. why the fuck are we using C++? +commented out failing tests +commit +copy and paste is not a design pattern +de-misunderestimating +debug line test +debug suff +debugo +derp, helper method rename +derpherp +diaaaaaazeeeeeeeeeepam +did everything +dirty hack, have a better idea ? +does it work? maybe. will I check? no. +doh. +done. going to bed now. +dope +enabled ultra instinct +epic +eppic fail XNAMEX +extra debug for stuff module +f +fail +features +ffs +final commit. +first blush +fix +fix /sigh +fix bug, for realz +fix some fucking errors +fix tpyo +fixed conflicts (LOL merge -s ours; push -f) +fixed errors in the previous commit +fixed mistaken bug +fixed shit that havent been fixed in last commit +fixed some minor stuff, might need some additional work. +fixed the israeli-palestinian conflict +fixes +fixing project shit +foo +forgot to save that file +forgot we're not using a smart language +formatted all +freemasonry +fuckup. +gave up and used tables. +giggle. +git + ipynb = :( +git please work +git stash * +god help us all +grmbl +grrrr +hacky sack +happy monday _ bleh _ +harharhar +he knows. +herpderp +herpderp (redux) +hey, look over there! +hey, what's that over there?! +hmmm +hoo boy +i dunno, maybe this works +i hid an easter egg in the code. can you find it? +i need therapy +i think i fixed a bug... +if you're not using et, fuck off +implemented missing semicolon +improved function +include shit +increased loading time by a bit +it is hump day _^_ +it's friday +jobs... steve jobs +just checking if git is working properly... +just shoot me +just trolling the repo +last minute fixes. +less french words +lets drink beer +lol +lol digg +lolwhat? +lots and lots of changes +lots of changes after a lot of time +magic, have no clue but it works +making code less cancer +making this thing actually usable. +marks +mergeconflix is the new hottest Gaul on the block +mergederp +minor changes +more debug... who overwrote! +more fixes +more ignored words +more ignores +more stuff +move your body every every body +need another beer +needs more cow bell +omg what have I done? +omgsosorry +oops +oops - thought I got that one. +oops! +oops, forgot to add the file +oopsie B| +pam anderson is going to love me. +pay no attention to the man behind the curtain +pep8 - cause I fell like doing a barrel roll +pep8 fixer +perfect... +permanent hack, do not revert +pgsql is being a pain +pgsql is more strict, increase the hackiness up to 11 +pointless limitation +pr is failing but merging anyways, because I am an admin +project lead is allergic to changes... +put code that worked where the code that didn't used to be +rats +really ignore ignored worsd +refuckulated the carbonator +remove certain things and added stuff +remove debug
all good +removed echo and die statements, lolz. +removed tests since i can't make them green +removing unit tests +restored deleted entities just to be sure +s/ / /g +s/import/include/ +should get thru ci now +should work I guess... +should work now. +small is a real HTML tag, who knew. +some brief changes +somebody keeps erasing my changes. +someday I gonna kill someone for this shit... +someone fails and it isn't me +sometimes you just herp the derp so hard it herpderps +speling is difikult +squash me +starting the service is always better +stopped caring XNUM8,23X commits ago +stuff +syntax +tagging release w.t.f. +that coulda been bad +that's all folks +the magic is real +these confounded tests drive me nuts +these guys are flipped +things occurred +third time's a charm +this doesn't really make things faster, but I tried +this is Spartaaaaaaaa +this is how we generate our shit. +this is my quickfix branch and i will use to do my quickfixes +this is why docs are important +this should fix it +tl;dr +totally more readable +touched... +try our sister game minceraft! +trying to do something right! +tunning +typo +uhhhhhh +unh +unionfind is no longer being molested. +various changes +well crap. +what the hell happened here +whatthecommit.com’s server IP address could not be found. +who has two thumbs and is a genius? not this guy! +who hurt you +whooooooooooooooooooooooooooo +why is everything broken +wip +woa!! this one was really HARD! +work in progress +workaround for ant being a pile of fail +yet another quality commit +yo recipes +yolo push +you do wanna make me cry and i wanna say goodbye + - Temporary commit. diff --git a/handlers/markdown.js b/handlers/markdown.js index 287ca3c..7d7b376 100644 --- a/handlers/markdown.js +++ b/handlers/markdown.js @@ -13,7 +13,7 @@ exports.render = (where) => mustache.render(template, { body: md(fs.readFileSync(where, "utf8")), essay: where.includes("essay"), cache: { - style: version("/assets/style.css"), + style: version("/assets/style2.css"), code: version("/assets/code.css"), essay: version("/assets/essay.css"), }, diff --git a/index.js b/index.js index 9c9e763..e10630b 100644 --- a/index.js +++ b/index.js @@ -4,7 +4,7 @@ const express = require("express"); const fs = require("fs"); const path = require("path"); const log = require("./log.js"); -const static = require("./static.js"); +const stati = require("./static.js"); const app = express(); const dir = __dirname; @@ -24,7 +24,7 @@ for(let file of fs.readdirSync(dir + "/modules").sort()) { log.info(`loded module ${file}`); } -app.get("*", static.handle); +app.get("*", stati.handle); app.listen(3000, () => log.info("ready!")); diff --git a/modules/01-iplog.js b/modules/01-iplog.js new file mode 100644 index 0000000..1f021cf --- /dev/null +++ b/modules/01-iplog.js @@ -0,0 +1,12 @@ +const domain = "not-ip-logger.alpha.beta.gamma.among-us-sussy-impostor.goofy-ahh-subdomain.google.com.zip.txt.tar.gz.celery.eu.org"; + +module.exports = (app, dir, log) => { + app.get("*", (req, res, next) => { + if (req.headers.host === domain) { + log.info(`someone from ${req.headers["x-forwarded-for"]} fell for it`); + res.send(`\n
haha you are beig logge'd
`); + } else { + next(); + } + }); +} diff --git a/modules/01-secure.js b/modules/01-secure.js deleted file mode 100644 index c26c450..0000000 --- a/modules/01-secure.js +++ /dev/null @@ -1,42 +0,0 @@ -const fs = require("fs"); -const path = require("path"); -const sleep = (ms) => new Promise((res) => setTimeout(res, ms)); - -module.exports = (app, dir, log) => { - const errorpage = fs.readFileSync(path.join(dir, "assets/401.html")); - const authorize = (username, password) => async (req, res, next) => { - if(req.headers["x-forwarded-proto"] !== "https") { - res.writeHead(400).end("use https"); - } - - const auth = req.headers.authorization; - try { - const [user, pass] = atob(auth.slice(6)).split(":"); - if(user !== username) throw "no"; - if(pass !== password) throw "no"; - await sleep(300); - next(); - } catch (err) { - if(err === "no") { - log.warn("attemped login on " + req.path); - await sleep(300); - } - res.writeHead(401, { - "WWW-Authenticate": 'Basic realm="secrets..."', - }).end(errorpage); - } - }; - - // stop sneaky people - app.get("/../*", (req, res) => res.writeHead(400).end("nope.")); - app.get("/./*", (req, res) => res.writeHead(400).end("nope.")); - app.get("*/./*", (req, res) => res.writeHead(400).end("nope.")); - app.get("*/.", (req, res) => res.writeHead(400).end("nope.")); - - // secure the things - app.get("/private/*", authorize(process.env.SECURE_USER, process.env.SECURE_PASS)); - app.get("/private/", authorize(process.env.SECURE_USER, process.env.SECURE_PASS)); - app.all("/upload", authorize(process.env.SECURE_USER, process.env.SECURE_PASS)); - app.all("/upload/", authorize(process.env.SECURE_USER, process.env.SECURE_PASS)); -} - diff --git a/modules/02-remap.js b/modules/02-remap.js index 03e3c3a..11e1847 100644 --- a/modules/02-remap.js +++ b/modules/02-remap.js @@ -6,9 +6,10 @@ module.exports = (app, dir, log) => { const gone = (req, res) => res.status(410).render("410.html", { cache: { style: version("/assets/style.css") } }); const redir = (to) => (req, res, next) => req.path === to ? next() : res.redirect(to); -// app.get("/gone", gone); + app.get("/gone", gone); app.get("/nft", file("no.html")); app.get("/upload", file("/private/upload.html")); + app.get("/read", redir("/read")); app.get("/~skybldev", redir("https://skybldev.eu.org/")); }; diff --git a/modules/03-cache.js b/modules/03-cache.js index af01e10..b1a119a 100644 --- a/modules/03-cache.js +++ b/modules/03-cache.js @@ -26,14 +26,14 @@ module.exports = (app, dir) => { } }); - app.get("/cinny/*", (req, res, next) => { - res.set("Cache-Control", "public, max-age=" + 60 * 60 * 24); - next(); - }); + // app.get("/cinny/*", (req, res, next) => { + // res.set("Cache-Control", "public, max-age=" + 60 * 60 * 24 * 365); + // next(); + // }); app.get("*", (req, res, next) => { if(req.query.v) { - res.set("Cache-Control", "public, max-age=" + 60 * 60 * 24); + res.set("Cache-Control", "public, max-age=" + 60 * 60 * 24 * 365); } next(); }); diff --git a/modules/04-skid.js b/modules/04-skid.js index 62e626d..c229dd1 100644 --- a/modules/04-skid.js +++ b/modules/04-skid.js @@ -1,16 +1,16 @@ module.exports = (app) => { const keepalive = (req, res) => { res.writeHead(200, { - "Content-Type": "application/json", - "Content-Length": "5", - }) + "Content-Type": "text/plain", + "Content-Length": "50000000", + }); const interval = setInterval(() => { try { res.write("a"); } catch { clearInterval(interval); } - }, 1000); + }, 300); }; app.get("*.php", keepalive); diff --git a/modules/08-echo.js b/modules/08-echo.js new file mode 100644 index 0000000..cd3dafd --- /dev/null +++ b/modules/08-echo.js @@ -0,0 +1,15 @@ +const fs = require("fs"); +const file = require("../static.js"); +const { version } = require("./03-cache.js"); + +module.exports = (app, dir, log) => { + const gone = (req, res) => res.status(410).render("410.html", { cache: { style: version("/assets/style.css") } }); + const redir = (to) => (req, res, next) => req.path === to ? next() : res.redirect(to); + + app.get("/echo/*", (req, res) => { + res.json({ + url: req.originalUrl, + }); + }); +}; + diff --git a/modules/99-curl.js b/modules/99-curl.js new file mode 100644 index 0000000..79be3d5 --- /dev/null +++ b/modules/99-curl.js @@ -0,0 +1,43 @@ +const fs = require("fs"); +const commits = fs.readFileSync("commits.txt", "utf8").split("\n"); +const motd = () => ` +░█▀░░█▀▀░█▀▀░█░░░█▀▀░█▀▄░█░█░░░░█▀▀░█░█░░░░█▀█░█▀▄░█▀▀░▀█░ +░█░░░█░░░█▀▀░█░░░█▀▀░█▀▄░░█░░░░░█▀▀░█░█░░░░█░█░█▀▄░█░█░░█░ +░▀▀░░▀▀▀░▀▀▀░▀▀▀░▀▀▀░▀░▀░░▀░░▀░░▀▀▀░▀▀▀░▀░░▀▀▀░▀░▀░▀▀▀░▀▀░ + +\x1b[0m service directory for \x1b[92mcelery.eu.org\x1b[0m: + +\x1b[90m- \x1b[34mhttps://celery.eu.org\x1b[0m: celery.eu.org homepage (you are here!) +\x1b[90m- \x1b[34mhttps://git.celery.eu.org\x1b[0m: my public git repositories and mirrors +\x1b[90m- \x1b[34mhttps://discard.celery.eu.org\x1b[0m: a (very) buggy discord-like matrix client \x1b[34m[1]\x1b[0m [dead] +\x1b[90m- \x1b[34mhttps://celery.eu.org/read\x1b[0m: readability proxy \x1b[34m[2]\x1b[0m +\x1b[90m- \x1b[34mhttps://tw.celery.eu.org\x1b[0m: nitter instance [dead] +\x1b[90m- \x1b[34mhttps://rd.celery.eu.org\x1b[0m: libreddit instance +\x1b[90m- \x1b[34mhttps://celery.eu.org/fallocate\x1b[0m: web based fallocate +\x1b[90m- \x1b[34mhttps://celery.eu.org/stats\x1b[0m: live server reaction +\x1b[90m- \x1b[34mhttps://board.celery.eu.org\x1b[0m: basic collaborative whiteboard service \x1b[34m[3]\x1b[0m +\x1b[90m- \x1b[34mhttps://gem.celery.eu.org\x1b[0m: a gemini-to-web proxy +\x1b[90m- \x1b[34mhttps://search.celery.eu.org\x1b[0m: a silly little semantic search engine \x1b[34m[5]\x1b[0m +\x1b[90m- \x1b[34mhttps://whisper.celery.eu.org\x1b[0m: a web ui for the speech-to-text thing by openai \x1b[34m[4]\x1b[0m [dead] +\x1b[90m- \x1b[34mhttps://🗿.celery.eu.org\x1b[0m: 🗿🗿🗿🗿🗿🗿🗿🗿🗿🗿🗿🗿 + +\x1b[34m[1]\x1b[0m the code is at tezlm/discard on git.celery.eu.org and github +\x1b[34m[2]\x1b[0m proxies runs websites through a reader mode script, sometimes removes paywalls +\x1b[34m[3]\x1b[0m tips: middle click drag to pan, hold shift for a line +\x1b[34m[4]\x1b[0m please don't abuse this too much, i don't have many resources +\x1b[34m[5]\x1b[0m pretty hit or miss. uses multi-qa-MiniLM-L6-cos-v1. tip: use ?like=https://url/ for similar sites + +\x1b[90m$ \x1b[34mgit \x1b[94mcommit \x1b[90m-m\x1b[0m '${commits[Math.floor(Math.random() * commits.length)]}' +`.trim() + "\n"; + +module.exports = (app) => { + app.get("/", (req, res, next) => { + if (!req.headers['user-agent']) { + return res.end(motd() + "\n\n (average manual socket enjoyer, eh?)"); + } + if (req.headers['user-agent'].includes('curl/')) { + return res.end(motd()); + } + next(); + }); +}; diff --git a/modules/99-fallocate.js b/modules/99-fallocate.js index e29fb8f..f0aa135 100644 --- a/modules/99-fallocate.js +++ b/modules/99-fallocate.js @@ -24,16 +24,16 @@ cloud-linux 2.37.2 2022-03-15 FALLOCATE(1) function parseSize(size) { const [_, exp, mult] = size.match(/^([0-9]+)(.)?$/); - const num = parseInt(exp, 10); + const num = BigInt(parseInt(exp, 10)); switch(mult?.toLowerCase()) { - case "k": case "kib": return num * 1024; - case "m": case "mib": return num * 1024 ** 2; - case "g": case "gib": return num * 1024 ** 3; - case "t": case "tib": return num * 1024 ** 4; - case "kb": return num * 1000; - case "mb": return num * 1000 ** 2; - case "gb": return num * 1000 ** 3; - case "tb": return num * 1000 ** 4; + case "k": case "kib": return num * 1024n; + case "m": case "mib": return num * 1024n ** 2n; + case "g": case "gib": return num * 1024n ** 3n; + case "t": case "tib": return num * 1024n ** 4n; + case "kb": return num * 1000n; + case "mb": return num * 1000n ** 2n; + case "gb": return num * 1000n ** 3n; + case "tb": return num * 1000n ** 4n; default: return num; } } @@ -47,13 +47,16 @@ module.exports = (app, dir, log) => { app.get("/fallocate/:size", (req, res) => { try { let size = parseSize(req.params.size); - log.warn(`fallocating ${req.params.size}`); - res.writeHead(200, { "Content-Length": size, "Content-Type": "application/octet-stream" }); - while(size > 0) { - res.write(size >= 1024 ** 2 ? mb : Buffer.alloc(size)); - size -= 1024 ** 2; + log.warn(`fallocating ${req.params.size} (${size}) bytes`); + res.writeHead(200, { "Content-Length": parseFloat(size), "Content-Type": "application/octet-stream" }); + log.debug("wrote head"); + while(size > 0n) { + res.write(size >= 1024n ** 2n ? mb : Buffer.alloc(size)); + size -= 1024n ** 2n; } res.end(); - } catch {} + } catch (err) { + console.log(err); + } }); } diff --git a/modules/99-sus.js b/modules/99-sus.js new file mode 100644 index 0000000..0fd2619 --- /dev/null +++ b/modules/99-sus.js @@ -0,0 +1,14 @@ +module.exports = (app) => { + app.get("/sus.ogg", (req, res) => { + res.writeHead(200, { 'content-type': 'audio/opus' }) + res.write("OggS\x00\x01\x00\x00\x00\x00"); + res.write("\x00\x00\x00\x00\xff"); + let interval = setInterval(() => { + try { + res.write("a"); + } catch { + clearInverval(interval) + } + }, 30); + }); +} diff --git a/motd b/motd new file mode 100644 index 0000000..45eaefe --- /dev/null +++ b/motd @@ -0,0 +1,4 @@ +░█▀▄░▀█▀░█▀▀░█▀▀░█▀█░█▀▄░█▀▄ Open a web browser and go to https://discard.celery.eu.org +░█░█░░█░░▀▀█░█░░░█▀█░█▀▄░█░█ +░▀▀░░▀▀▀░▀▀▀░▀▀▀░▀░▀░▀░▀░▀▀░ (curl doesn't count!) + \ No newline at end of file diff --git a/package.json b/package.json index 48e8cd5..6c661fe 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,11 @@ "highlight.js": "^11.5.1", "lru-cache": "^7.8.1", "markdown-it": "^12.3.2", + "markdown-it-container": "^4.0.0", "markdown-it-image-figures": "^2.1.0", + "marked": "^11.1.1", + "marked-directive": "^1.0.4", + "marked-highlight": "^2.1.0", "multer": "^1.4.4", "mustache": "^4.2.0", "mustache-express": "^1.3.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f282226..8b3d5b1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: 5.3 +lockfileVersion: 5.4 specifiers: dotenv: ^16.0.0 @@ -7,7 +7,11 @@ specifiers: highlight.js: ^11.5.1 lru-cache: ^7.8.1 markdown-it: ^12.3.2 + markdown-it-container: ^4.0.0 markdown-it-image-figures: ^2.1.0 + marked: ^11.1.1 + marked-directive: ^1.0.4 + marked-highlight: ^2.1.0 multer: ^1.4.4 mustache: ^4.2.0 mustache-express: ^1.3.2 @@ -20,7 +24,11 @@ dependencies: highlight.js: 11.5.1 lru-cache: 7.8.1 markdown-it: 12.3.2 + markdown-it-container: 4.0.0 markdown-it-image-figures: 2.1.0_markdown-it@12.3.2 + marked: 11.1.1 + marked-directive: 1.0.4_marked@11.1.1 + marked-highlight: 2.1.0_marked@11.1.1 multer: 1.4.4 mustache: 4.2.0 mustache-express: 1.3.2 @@ -52,6 +60,12 @@ packages: resolution: {integrity: sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==} dev: false + /attributes-parser/2.2.2: + resolution: {integrity: sha512-fIPf8Wo+1mHhsZVTwpI8Kk4znL5+r4jelbRrcYNJ/Q0j6BpCIw1i7IwviJ0zD75mnUEyigkRgAKvwMJ4jeHf6A==} + dependencies: + json-loose: 1.2.3 + dev: false + /body-parser/1.19.2: resolution: {integrity: sha512-SAAwOxgoCKMGs9uUAUFHygfLAyaniaoun6I8mFY9pRAJL9+Kec34aU+oIjDhTycub1jozEfEwx1W1IuOYxVSFw==} engines: {node: '>= 0.8'} @@ -66,6 +80,8 @@ packages: qs: 6.9.7 raw-body: 2.4.3 type-is: 1.6.18 + transitivePeerDependencies: + - supports-color dev: false /buffer-from/1.1.2: @@ -122,6 +138,11 @@ packages: /debug/2.6.9: resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true dependencies: ms: 2.0.0 dev: false @@ -217,6 +238,8 @@ packages: type-is: 1.6.18 utils-merge: 1.0.1 vary: 1.1.2 + transitivePeerDependencies: + - supports-color dev: false /finalhandler/1.1.2: @@ -230,6 +253,8 @@ packages: parseurl: 1.3.3 statuses: 1.5.0 unpipe: 1.0.0 + transitivePeerDependencies: + - supports-color dev: false /forwarded/0.2.0: @@ -282,6 +307,12 @@ packages: resolution: {integrity: sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=} dev: false + /json-loose/1.2.3: + resolution: {integrity: sha512-gnx3y7j68efE7WOAFJq4lcivbUZXjW1Udx0VWh25kGDDhsM4stK6TejLahGvqJ8lraua6+6+BbBxy6ABR0ayWA==} + dependencies: + moo: 0.5.2 + dev: false + /linkify-it/3.0.3: resolution: {integrity: sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==} dependencies: @@ -299,6 +330,10 @@ packages: engines: {node: '>=12'} dev: false + /markdown-it-container/4.0.0: + resolution: {integrity: sha512-HaNccxUH0l7BNGYbFbjmGpf5aLHAMTinqRZQAEQbMr2cdD3z91Q6kIo1oUn1CQndkT03jat6ckrdRYuwwqLlQw==} + dev: false + /markdown-it-image-figures/2.1.0_markdown-it@12.3.2: resolution: {integrity: sha512-a5FIzzUlK65iGfQlNWH94cyxKpV+Qj8a+4Q3+wVseryHMCOfGaX0aCNtdEkCeb19uGDzVw3Az5tst2hXWAdJ1Q==} engines: {node: '>=12.0.0'} @@ -319,6 +354,29 @@ packages: uc.micro: 1.0.6 dev: false + /marked-directive/1.0.4_marked@11.1.1: + resolution: {integrity: sha512-SqtEz+twRuo2iUUbgMyW7uF8Wwxc3+Beqf3KrZ2eltPVNy/8Nb+BYuw5dYNl5Xh30pEg91202DIvpPBR9o0zPg==} + peerDependencies: + marked: '>=7.0.0' + dependencies: + attributes-parser: 2.2.2 + marked: 11.1.1 + dev: false + + /marked-highlight/2.1.0_marked@11.1.1: + resolution: {integrity: sha512-peBvgGZZqUw074Vy/N8Y7/6JQhSnR54/T0Ozq2/fAIBzcYfVfExFdQJptIhQxreR1elpwvJRrqhp6S/Prk8prA==} + peerDependencies: + marked: '>=4 <12' + dependencies: + marked: 11.1.1 + dev: false + + /marked/11.1.1: + resolution: {integrity: sha512-EgxRjgK9axsQuUa/oKMx5DEY8oXpKJfk61rT5iY3aRlgU6QJtUcxU5OAymdhCvWvhYcd9FKmO5eQoX8m9VGJXg==} + engines: {node: '>= 18'} + hasBin: true + dev: false + /mdurl/1.0.1: resolution: {integrity: sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=} dev: false @@ -366,6 +424,10 @@ packages: minimist: 1.2.6 dev: false + /moo/0.5.2: + resolution: {integrity: sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q==} + dev: false + /ms/2.0.0: resolution: {integrity: sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=} dev: false @@ -521,6 +583,8 @@ packages: on-finished: 2.3.0 range-parser: 1.2.1 statuses: 1.5.0 + transitivePeerDependencies: + - supports-color dev: false /serve-static/1.14.2: @@ -531,6 +595,8 @@ packages: escape-html: 1.0.3 parseurl: 1.3.3 send: 0.17.2 + transitivePeerDependencies: + - supports-color dev: false /setprototypeof/1.2.0: diff --git a/static.js b/static.js index ae038a9..7c211cf 100644 --- a/static.js +++ b/static.js @@ -88,8 +88,8 @@ function generate(file, raw = false) { module.exports.handle = (req, res) => { // stop sneaky people - if(req.path.includes("..")) return res.writeHead(400).end("nope."); + if(req.path.includes("..")) return res.writeHead(403).end("nice try bud, but we don't do that here."); - generate(path.normalize(req.path), "raw" in req.query)(req, res); + generate(path.normalize(decodeURIComponent(req.path)), "raw" in req.query)(req, res); }; diff --git a/types.js b/types.js index cd47738..8fea805 100644 --- a/types.js +++ b/types.js @@ -2,6 +2,7 @@ const types = new Map(); types.set("css", "text/css"); types.set("html", "text/html"); types.set("txt", "text/plain"); +types.set("xml", "text/xml"); types.set("js", "text/javascript"); types.set("md", "text/markdown"); types.set("gmi", "text/gemini"); @@ -12,6 +13,7 @@ types.set("gif", "image/gif"); types.set("apng", "image/png"); types.set("svg", "image/svg"); types.set("webp", "image/webp"); +types.set("ico", "image/x-icon"); types.set("ogg", "audio/ogg"); types.set("opus", "audio/ogg"); types.set("mp3", "audio/mp3"); diff --git a/util/markdown.js b/util/markdown.js index 02cd7c5..80019fa 100644 --- a/util/markdown.js +++ b/util/markdown.js @@ -1,18 +1,63 @@ +const { marked } = require("marked"); const hljs = require("highlight.js"); -const md = require("markdown-it")({ - html: true, - xhtmlOut: true, - linkify: true, - typographer: true, - highlight(str, lang) { - if (lang && hljs.getLanguage(lang)) { - try { - return hljs.highlight(str, { language: lang }).value; - } catch {} - } - return ''; - } -}); -module.exports = (data) => md.render(data); +marked.use(require("marked-directive").createDirectives()); +marked.use(require("marked-highlight").markedHighlight({ + langPrefix: 'hljs language-', + highlight(code, lang, info) { + const language = hljs.getLanguage(lang) ? lang : 'plaintext'; + return hljs.highlight(code, { language }).value; + } +})) + +module.exports = (data) => marked.parse(data); + +// const md = require("markdown-it")({ +// html: true, +// xhtmlOut: true, +// linkify: true, +// highlight(str, lang) { +// if (lang && hljs.getLanguage(lang)) { +// try { +// return hljs.highlight(str, { language: lang }).value; +// } catch {} +// } +// return ''; +// } +// }); + +// md.use(require("markdown-it-container"), "header", { +// validate: (params) => params.trim() === "header", +// render: (tokens, idx) => { +// if (tokens[idx].nesting === 1) { +// return "
"; +// } else { +// return "
"; +// } +// }, +// }); + +// md.use(require("markdown-it-container"), "section", { +// validate: (params) => params.trim().startsWith("section"), +// render: (tokens, idx) => { +// if (tokens[idx].nesting === 1) { +// return `
`; +// } else { +// return "
"; +// } +// }, +// }); + +// md.use(require("markdown-it-container"), "eval", { +// validate: (params) => params.trim() === "eval", +// render: (tokens, idx) => { +// if (tokens[idx].nesting === 1) { +// return `
`; +// } else { +// return "
"; +// } +// }, +// }); + +// module.exports = (data) => md.render(data);