Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
derpbyte authored Feb 22, 2023
0 parents commit 18bd937
Show file tree
Hide file tree
Showing 18 changed files with 41,715 additions and 0 deletions.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: npm start
7 changes: 7 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "Ultraviolet App",
"description": "Node.js Ultraviolet instance",
"repository": "https://github.com/titaniumnetwork-dev/ultraviolet-web-app",
"logo": "https://github.com/titaniumnetwork-dev/Ultraviolet/blob/main/uv.png?raw=true",
"keywords": ["tomp", "ultraviolet"]
}
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(async() => {
await import('./index.mjs');
})();
29 changes: 29 additions & 0 deletions index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import createServer from '@tomphttp/bare-server-node';
import http from 'http';
import nodeStatic from 'node-static';


const bare = createServer('/bare/');
const serve = new nodeStatic.Server('static/');

const server = http.createServer();

server.on('request', (req, res) => {
if (bare.shouldRoute(req)) {
bare.routeRequest(req, res);
} else {
serve.serve(req, res);
}
});

server.on('upgrade', (req, socket, head) => {
if (bare.shouldRoute(req, socket, head)) {
bare.routeUpgrade(req, socket, head);
}else{
socket.end();
}
});

server.listen({
port: process.env.PORT || 8080,
});
13 changes: 13 additions & 0 deletions main.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
# Set this to 1 to automatically attempt a fix when an error occurs while running npm start.
fix=0


# Stuff to do at first run(submodule, npm install).
if [[ -d "static" && -n "$(find static -prune -empty 2>/dev/null)" ]] || [[ ! -d "static" ]]; then
npm install
git submodule update --init --recursive
fi


npm start || [[ $fix = 1 ]] && npm install && npm update && git submodule update --init --recursive
294 changes: 294 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"dependencies": {
"@tomphttp/bare-server-node": "^1.0.2-beta-readme2",
"bare-server-node": "github:tomphttp/bare-server-node",
"node-static": "^0.7.11"
},
"name": "uv-app",
"version": "1.0.0",
"description": "Ultraviolet instance",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node ."
},
"keywords": [
"proxy"
],
"author": "",
"license": "GPL-3.0-or-later"
}
8 changes: 8 additions & 0 deletions replit.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ pkgs }: {
deps = [
pkgs.nodejs-16_x
pkgs.nodePackages.typescript-language-server
pkgs.yarn
pkgs.replitPackages.jest
];
}
Loading

0 comments on commit 18bd937

Please sign in to comment.