Skip to content

Commit

Permalink
2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Thedogecraft committed Dec 19, 2024
1 parent 31a18b7 commit 016ea8d
Show file tree
Hide file tree
Showing 71 changed files with 8,560 additions and 1,032 deletions.
26 changes: 24 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
node_modules/
package-lock.json
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
39 changes: 39 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import js from "@eslint/js";
import globals from "globals";
import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import reactRefresh from "eslint-plugin-react-refresh";

export default [
{ ignores: ["dist"] },
{
files: ["**/*.{js,jsx}"],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaVersion: "latest",
ecmaFeatures: { jsx: true },
sourceType: "module",
},
},
settings: { react: { version: "18.3" } },
plugins: {
react,
"react-hooks": reactHooks,
"react-refresh": reactRefresh,
},
rules: {
...js.configs.recommended.rules,
"react/prop-types": "off",
...react.configs.recommended.rules,
...react.configs["jsx-runtime"].rules,
...reactHooks.configs.recommended.rules,
"react/jsx-no-target-blank": "off",
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
},
];
70 changes: 70 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!DOCTYPE html>
<html lang="en" data-theme="sunset">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/media/logo.svg" id="favicon" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="description"
content="Discover the top unblocked games like Slope, 1v1.lol, Cookie Clicker, Geometry Dash, and more. Enjoy seamless gaming experiences at school or work."
/>
<meta
name="keywords"
content="unblocked games, slope unblocked, 1v1.lol unblocked, cookie clicker unblocked, geometry dash unblocked, roblox unblocked, minecraft unblocked, tetris unblocked, retro bowl unblocked, unblocked anime websites"
/>
<title>Starlight</title>
<script src="/chemical.js"></script>
<!-- Google tag (gtag.js) -->
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-SHFE3BF9EH"
></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());

gtag("config", "G-SHFE3BF9EH");
</script>
</head>
<body>
<div id="root"></div>

<script type="module" src="/src/main.jsx"></script>
<script>
const cloaks = [
{
name: "drive",
icon: "./media/cloaks/googledrive.png",
title: "Home - Google Drive",
},
{
name: "edpuzzle",
icon: "./media/cloaks/edpuzzle.png",
title: "Edpuzzle",
},
{
name: "wikipedia",
icon: "./media/cloaks/wikipedia.ico",
title: "Wikipedia",
},

{
name: "canvas",
icon: "./media/cloaks/canvas.png",
title: "Dashboard",
},
{
name: "classroom",
icon: "./media/cloaks/classroom.png",
title: "Home",
},
{ name: "zoom", icon: "./media/cloaks/zoom.png", title: "Zoom" },
];
</script>
<script src="https://cdn.jsdelivr.net/gh/Parcoil/cloak@main/src/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/eruda"></script>
</body>
</html>
108 changes: 22 additions & 86 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,104 +1,40 @@
import { ChemicalServer } from "chemicaljs";
import express from "express";
import { createServer } from "node:http";
import httpProxy from "http-proxy";
import { uvPath } from "@titaniumnetwork-dev/ultraviolet";
import { epoxyPath } from "@mercuryworkshop/epoxy-transport";
import { baremuxPath } from "@mercuryworkshop/bare-mux/node";
import { join, dirname } from "node:path";
import { hostname } from "node:os";
import { fileURLToPath } from "url";
import wisp from "wisp-server-node";
import expressLayouts from "express-ejs-layouts";
import path from "node:path";
import compression from "compression";

const cdnProxy = httpProxy.createProxyServer();
const app = express();
const __dirname = dirname(fileURLToPath(import.meta.url));
const publicPath = join(__dirname, "public");
const [app, listen] = new ChemicalServer();
const port = process.env.PORT || 8181;

app.use(express.static(publicPath));
app.disable("x-powered-by");

app.set("view engine", "ejs");
app.set("views", join(__dirname, "public/views"));
app.use(expressLayouts);
app.use("/stars/", express.static(uvPath));
app.use("/epoxy/", express.static(epoxyPath));
app.use("/baremux/", express.static(baremuxPath));

app.get("/", (req, res) => {
res.render("index", (err, html) => {
if (err) {
res.status(500).send("Internal Server Error");
} else {
res.send(html);
}
});
});
app.use(
express.static("dist", {
index: "index.html",
extensions: ["html"],
})
);
app.use(compression());
app.serveChemical();

app.use("/cdn", (req, res) => {
cdnProxy.web(req, res, {
target: "https://glcdn.githack.com/Thedogecraft/assets/-/raw/main/public/",
target: "https://gms.parcoil.com/",
changeOrigin: true,
});
});

app.get("/go", (req, res) => {
res.render("go", { layout: false });
});

app.get("/:page", (req, res) => {
const page = req.params.page;
res.render(page, (err, html) => {
if (err) {
if (err.message.includes("Failed to lookup view")) {
res.status(404).render("404");
} else {
res.status(500).send("Internal Server Error");
}
} else {
res.send(html);
}
});
app.get("*", (_req, res) => {
res.sendFile(path.resolve("dist", "index.html"));
});

const server = createServer();

server.on("request", (req, res) => {
res.setHeader("Cross-Origin-Opener-Policy", "same-origin");
res.setHeader("Cross-Origin-Embedder-Policy", "same-origin");
app(req, res);
});
server.on("upgrade", (req, socket, head) => {
if (req.url.endsWith("/wisp/")) wisp.routeRequest(req, socket, head);
else socket.end();
app.use((req, res) => {
res.status(404);
res.send("404 Error");
});

let port = parseInt(process.env.PORT || "");

if (isNaN(port)) port = 8080;

server.on("listening", () => {
const address = server.address();

console.log(`[+] Starting 💫 Starlight...`);
console.log();
console.log(`[+] Made by The Parcoil Network:`);
console.log();
console.warn(`[+] https://github.com/Parcoil/starlight`);
console.log();
console.log(`[+] Starlight Running on port ${address.port}`);
console.log();
});

// https://expressjs.com/en/advanced/healthcheck-graceful-shutdown.html
process.on("SIGINT", shutdown);
process.on("SIGTERM", shutdown);

function shutdown() {
console.log("SIGTERM signal received: closing HTTP server");
server.close();
process.exit(0);
}

server.listen({
port,
listen(port, () => {
console.log(`Starlight Running on port: ${port}`);
});
66 changes: 37 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,44 @@
{
"name": "starlight",
"version": "1.1.0",
"description": "Ending Internet censorship.",
"private": true,
"version": "2.0.0",
"type": "module",
"main": "index.js",
"dependencies": {
"@mercuryworkshop/bare-mux": "^1.1.2",
"@mercuryworkshop/epoxy-transport": "^1.1.0",
"@titaniumnetwork-dev/ultraviolet": "^3.1.2",
"ejs": "^3.1.10",
"express": "^4.18.2",
"express-ejs-layouts": "^2.5.1",
"http-proxy": "^1.18.1",
"nodemon": "^3.1.4",
"wisp-server-node": "^1.0.6",
"ws": "^8.16.0"
},
"scripts": {
"start": "node index.js",
"dev": "nodemon index.js --ext *"
"dev": "vite --host",
"build": "vite build",
"start": "vite build && node index.js",
"lint": "eslint .",
"preview": "vite preview"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Parcoil/starlight.git"
},
"keywords": [
"proxy"
],
"author": "Parcoil Network",
"license": "GPL-3.0",
"bugs": {
"url": "https://github.com/Parcoil/starlight/issues"
"dependencies": {
"chemicaljs": "^2.2.0",
"compression": "^1.7.4",
"express": "^4.21.1",
"fuse.js": "^7.0.0",
"http-proxy": "^1.18.1",
"lucide-react": "^0.454.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-icons": "^5.3.0",
"react-lazy-load-image-component": "^1.6.2",
"react-router-dom": "^6.27.0",
"recoil": "^0.7.7"
},
"homepage": "https://github.com/Parcoil/starlight#readme"
"devDependencies": {
"@eslint/js": "^9.13.0",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.3",
"autoprefixer": "^10.4.20",
"daisyui": "^4.12.14",
"eslint": "^9.13.0",
"eslint-plugin-react": "^7.37.1",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.13",
"globals": "^15.11.0",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.14",
"vite": "^5.4.9",
"vite-plugin-compression": "^0.5.1"
}
}
Loading

0 comments on commit 016ea8d

Please sign in to comment.