reset repository for public consumption 🍽️

This commit is contained in:
Jake Jarvis 2020-05-24 16:41:56 -04:00
commit 2de1c29e0c
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
14 changed files with 376 additions and 0 deletions

19
.github/workflows/deploy.yml vendored Normal file
View File

@ -0,0 +1,19 @@
name: Deploy
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cloudflare/wrangler-action@master
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
- uses: jakejarvis/cloudflare-purge-action@master
env:
CLOUDFLARE_ZONE: "92e2ec634800f776ec4f3e983491c349"
CLOUDFLARE_TOKEN: ${{ secrets.CF_API_TOKEN }}

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
node_modules/
worker/
dist/
package-lock.json
*.img

21
LICENSE.md Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020-present Jake Jarvis <jake@jarv.is>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

26
README.md Normal file
View File

@ -0,0 +1,26 @@
# 💾 [y2k.lol](https://y2k.lol/)
Nostalgic time machine powered by on-demand Windows Me VMs and [my first website](https://jarv.is/y2k/). Inspired by [charlie.bz](https://charlie.bz/) (and quarantine boredom).
The backend isn't quite ready to be open-sourced (read: it's still a fatally embarrassing ball of spaghetti) but will be moved here very soon! 🍝
<p align="center"><a href="https://y2k.lol/"><img width="600" src="screenshot.png"></a></p>
## Requirements
- Ruby
- [QEMU 4.x](https://www.qemu.org/) (target i386)
- [websocketd](https://github.com/joewalnes/websocketd)
- [noVNC](https://github.com/novnc/noVNC)
- [Cloudflare Workers](https://workers.cloudflare.com/) & [Argo Tunnel](https://www.cloudflare.com/products/argo-tunnel/)
## To-Do
- [x] Sync user's mouse cursor/movements with VM
- [ ] Error messages: no websockets, server down, etc.
- [ ] Usage limits
- [ ] Responsive browser sizing
## License
This project is distributed under the [MIT license](LICENSE.md).

155
public/app.js Normal file

File diff suppressed because one or more lines are too long

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

36
public/index.html Normal file
View File

@ -0,0 +1,36 @@
<!doctype html>
<!--
_.-;;-._
'-..-'| || | Made with love & sarcasm by Jake Jarvis.
'-..-'|_.-;;-._| https://jarv.is/
'-..-'| || | https://github.com/jakejarvis
'-..-'|_.-''-._|
-->
<html>
<head>
<meta charset="utf-8">
<title>y2k.lol  Powered by Windows Me 💾</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="My first website on a Windows Me-powered time machine. You've been warned.">
<link rel="stylesheet" href="style.css">
<link rel="shortcut icon" href="favicon.ico">
<link rel="canonical" href="https://y2k.lol/">
</head>
<body>
<canvas id="display"></canvas>
<a class="github" href="https://github.com/jakejarvis/y2k" title="GitHub Repository" target="_blank" rel="noopener">
<svg viewBox="0 0 16 16" width="32" height="32"><path fill="#222222" d="M8 0a8 8 0 00-2.5 15.6c.4 0 .5-.2.5-.4v-1.5c-2 .4-2.5-.5-2.7-1 0-.1-.5-.9-.8-1-.3-.2-.7-.6 0-.6.6 0 1 .6 1.2.8.7 1.2 1.9 1 2.4.7 0-.5.2-.9.5-1-1.8-.3-3.7-1-3.7-4 0-.9.3-1.6.8-2.2 0-.2-.3-1 .1-2 0 0 .7-.3 2.2.7a7.4 7.4 0 014 0c1.5-1 2.2-.8 2.2-.8.5 1.1.2 2 .1 2.1.5.6.8 1.3.8 2.2 0 3-1.9 3.7-3.6 4 .3.2.5.7.5 1.4v2.2c0 .2.1.5.5.4A8 8 0 0016 8a8 8 0 00-8-8z"/></svg>
</a>
<script src="app.js"></script>
<script>
if (window.WebSocket) {
var display = document.getElementById("display");
var rfb = new RFB({ target: display, encrypt: true });
rfb.connect("sandbox.y2k.lol", 443);
}
</script>
<script async defer src="https://scripts.simpleanalyticscdn.com/latest.js" data-skip-dnt="true"></script>
</body>
</html>

32
public/style.css Normal file
View File

@ -0,0 +1,32 @@
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
canvas {
display: block;
margin: 25px auto;
/* VM resolution is 800x600 */
width: 800px;
height: 600px;
/* fix fuzziness: https://stackoverflow.com/a/13492784 */
image-rendering: optimizeSpeed;
image-rendering: -moz-crisp-edges;
image-rendering: -o-crisp-edges;
image-rendering: -webkit-optimize-contrast;
image-rendering: crisp-edges;
-ms-interpolation-mode: nearest-neighbor;
}
a.github {
position: absolute;
right: 16px;
bottom: 16px;
text-decoration: none;
}
a.github, a.github svg {
width: 32px;
height: 32px;
}

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 KiB

0
workers-site/.cargo-ok Normal file
View File

2
workers-site/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
node_modules
worker

57
workers-site/index.js Normal file
View File

@ -0,0 +1,57 @@
import { getAssetFromKV, mapRequestToAsset } from '@cloudflare/kv-asset-handler'
/**
* The DEBUG flag will do two things that help during development:
* 1. we will skip caching on the edge, which makes it easier to
* debug.
* 2. we will return an error message on exception in your Response rather
* than the default 404.html page.
*/
const DEBUG = false
addEventListener('fetch', event => {
try {
event.respondWith(handleEvent(event))
} catch (e) {
if (DEBUG) {
return event.respondWith(
new Response(e.message || e.toString(), {
status: 500,
}),
)
}
event.respondWith(new Response('Internal Error', { status: 500 }))
}
})
async function handleEvent(event) {
const url = new URL(event.request.url)
let options = {
cacheControl: {
edgeTTL: 60 * 60 * 1, // 1 hour
browserTTL: 60 * 60 * 1, // 1 hour
bypassCache: false,
}
}
try {
if (DEBUG) {
// customize caching
options.cacheControl.bypassCache = true
}
return await getAssetFromKV(event, options)
} catch (e) {
// if an error is thrown try to serve the asset at 404.html
if (!DEBUG) {
try {
let notFoundResponse = await getAssetFromKV(event, {
mapRequestToAsset: req => new Request(`${new URL(req.url).origin}/404.html`, req),
})
return new Response(notFoundResponse.body, { ...notFoundResponse, status: 404 })
} catch (e) {}
}
return new Response(e.message || e.toString(), { status: 500 })
}
}

12
workers-site/package.json Normal file
View File

@ -0,0 +1,12 @@
{
"private": true,
"name": "worker",
"version": "1.0.0",
"description": "A template for kick starting a Cloudflare Workers project",
"main": "index.js",
"author": "Ashley Lewis <ashleymichal@gmail.com>",
"license": "MIT",
"dependencies": {
"@cloudflare/kv-asset-handler": "^0.0.5"
}
}

10
wrangler.toml Normal file
View File

@ -0,0 +1,10 @@
name = "y2k"
type = "webpack"
account_id = "bd1a636a30a817137ce1e91c9e407373"
zone_id = "92e2ec634800f776ec4f3e983491c349"
route = "y2k.lol/*"
# workers_dev = true
[site]
bucket = "public"
entry-point = "workers-site"