Skip to content
This repository was archived by the owner on Oct 12, 2023. It is now read-only.

Commit 6c16388

Browse files
authored
Commit
1 parent 297c49c commit 6c16388

File tree

6 files changed

+1334
-2
lines changed

6 files changed

+1334
-2
lines changed

.replit

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
entrypoint = "index.js"
2+
3+
hidden = [".config"]
4+
5+
[interpreter]
6+
command = [
7+
"prybar-nodejs",
8+
"-q",
9+
"--ps1",
10+
"\u0001\u001b[33m\u0002\u0001\u001b[00m\u0002 ",
11+
"-i"
12+
]
13+
14+
[[hints]]
15+
regex = "Error \\[ERR_REQUIRE_ESM\\]"
16+
message = "We see that you are using require(...) inside your code. We currently do not support this syntax. Please use 'import' instead when using external modules. (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import)"
17+
18+
[nix]
19+
channel = "stable-22_05"
20+
21+
[env]
22+
XDG_CONFIG_HOME = "/home/runner/.config"
23+
PATH = "/home/runner/$REPL_SLUG/.config/npm/node_global/bin:/home/runner/$REPL_SLUG/node_modules/.bin"
24+
npm_config_prefix = "/home/runner/$REPL_SLUG/.config/npm/node_global"
25+
26+
[gitHubImport]
27+
requiredFiles = [".replit", "replit.nix", ".config"]
28+
29+
[packager]
30+
language = "nodejs"
31+
32+
[packager.features]
33+
packageSearch = true
34+
guessImports = true
35+
enabledForHosting = false
36+
37+
[unitTest]
38+
language = "nodejs"
39+
40+
[debugger]
41+
support = true
42+
43+
[debugger.interactive]
44+
transport = "localhost:0"
45+
startCommand = [ "dap-node" ]
46+
47+
[debugger.interactive.initializeMessage]
48+
command = "initialize"
49+
type = "request"
50+
51+
[debugger.interactive.initializeMessage.arguments]
52+
clientID = "replit"
53+
clientName = "replit.com"
54+
columnsStartAt1 = true
55+
linesStartAt1 = true
56+
locale = "en-us"
57+
pathFormat = "path"
58+
supportsInvalidatedEvent = true
59+
supportsProgressReporting = true
60+
supportsRunInTerminalRequest = true
61+
supportsVariablePaging = true
62+
supportsVariableType = true
63+
64+
[debugger.interactive.launchMessage]
65+
command = "launch"
66+
type = "request"
67+
68+
[debugger.interactive.launchMessage.arguments]
69+
args = []
70+
console = "externalTerminal"
71+
cwd = "."
72+
environment = []
73+
pauseForSourceMap = false
74+
program = "./index.js"
75+
request = "launch"
76+
sourceMaps = true
77+
stopOnEntry = false
78+
type = "pwa-node"
79+
80+
[languages]
81+
82+
[languages.javascript]
83+
pattern = "**/{*.js,*.jsx,*.ts,*.tsx}"
84+
85+
[languages.javascript.languageServer]
86+
start = "typescript-language-server --stdio"

README.md

+24-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,24 @@
1-
# 3kh0.github.io-replit
2-
Option to deploy 3kh0.github.io with Replit using BUFFY by @retronbv using node-fetch and express
1+
# 3kh0.github.io Replit
2+
3+
This repo is a simple proxy build by @retronbv ([BUFFY](https://github.com/retronbv/buffy)), made to proxy 3kh0.github.io
4+
5+
This was made due to the fact that the repo size is too big for replit.
6+
7+
## Running
8+
9+
[![Run on Replit](https://binbashbanana.github.io/deploy-buttons/buttons/remade/replit.svg)](https://replit.com/github/3kh0/3kh0.github.io-replit)
10+
11+
Running this is super easy!
12+
13+
1. Click on the button above to clone the repo to a new replit.
14+
2. Click on the green Run button.
15+
3. Click on the link that is shown in console.
16+
4. That's it!
17+
18+
It is really just that simple!
19+
20+
## Contributing
21+
22+
Please contribute to retronbv's repo found at the link below.
23+
24+
https://github.com/retronbv/buffy

index.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const express = require("express");
2+
const fetch = require("node-fetch"); // How we are actually proxying the assets
3+
const kuler = require("kuler"); // Console colors
4+
const app = express();
5+
6+
const proxyUrl = "3kh0.github.io";
7+
console.log(kuler("Proxying the domain: " + proxyUrl, "#00ffdd"));
8+
app.get("/*", async (req, res) => {
9+
const proxied = await fetch("https://" + proxyUrl + req.url); // Get the asset from the website
10+
const mime = proxied.headers.get("content-type"); // Send the correct MIME type so the browser knows what it is
11+
res.set("Content-Type", mime.split(";")[0]); // Setting the MIME type
12+
const body = new Buffer.from(await proxied.arrayBuffer()); // Get the buffer of the asset
13+
res.status(proxied.status); // Send the correct HTTP Response back
14+
res.write(body); // Write the buffered asset to the response
15+
res.end();
16+
});
17+
18+
// Here we start the proxy
19+
app.listen(3000, () => {
20+
console.log(`
21+
██████╗ ██╗ ██╗███████╗███████╗██╗ ██╗
22+
██╔══██╗██║ ██║██╔════╝██╔════╝╚██╗ ██╔╝
23+
██████╔╝██║ ██║█████╗ █████╗ ╚████╔╝
24+
██╔══██╗██║ ██║██╔══╝ ██╔══╝ ╚██╔╝
25+
██████╔╝╚██████╔╝██║ ██║ ██║
26+
╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝
27+
https://github.com/retronbv/buffy
28+
`)
29+
console.log(kuler("Server has been started! Listening on port 3000", "#00ff00"));
30+
console.log("Link to view: " + kuler(`https://${process.env.REPL_SLUG}.${process.env.REPL_OWNER}.repl.co`, "#0000ff"));
31+
});

0 commit comments

Comments
 (0)