forked from UseInterstellar/Interstellar
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
58 changed files
with
3,768 additions
and
3,572 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# These are supported funding model platforms | ||
|
||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] | ||
patreon: gointerstellar | ||
open_collective: # Replace with a single Open Collective username | ||
ko_fi: # Replace with a single Ko-fi username | ||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
liberapay: # Replace with a single Liberapay username | ||
issuehunt: # Replace with a single IssueHunt username | ||
otechie: # Replace with a single Otechie username | ||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry | ||
custom: https://cash.app/$akabubbo | ||
# These are supported funding model platforms | ||
|
||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] | ||
patreon: gointerstellar | ||
open_collective: # Replace with a single Open Collective username | ||
ko_fi: # Replace with a single Ko-fi username | ||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel | ||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry | ||
liberapay: # Replace with a single Liberapay username | ||
issuehunt: # Replace with a single IssueHunt username | ||
otechie: # Replace with a single Otechie username | ||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry | ||
custom: https://cash.app/$akabubbo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
dist/ | ||
node_modules | ||
package-lock.json | ||
package.json | ||
/static/m/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"tabWidth": 2, | ||
"semi": false, | ||
"singleQuote": true, | ||
"bracketSameLine": true, | ||
"printWidth": 120 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"name": "edu", | ||
"description": "?", | ||
"repository": "https://github.com/interstellarnetwork/interstellar", | ||
"logo": "https://avatars.githubusercontent.com/u/103917385", | ||
"keywords": ["school", "math"], | ||
"image": "heroku/nodejs" | ||
} | ||
{ | ||
"name": "edu", | ||
"description": "?", | ||
"repository": "https://github.com/interstellarnetwork/interstellar", | ||
"logo": "https://avatars.githubusercontent.com/u/103917385", | ||
"keywords": ["school", "math"], | ||
"image": "heroku/nodejs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,73 @@ | ||
import express from 'express'; | ||
import http from 'node:http'; | ||
import { createBareServer } from "@tomphttp/bare-server-node"; | ||
import path from 'node:path'; | ||
import cors from 'cors'; | ||
|
||
const __dirname = process.cwd(); | ||
const server = http.createServer(); | ||
const app = express(server); | ||
const bareServer = createBareServer('/v/'); | ||
const PORT = 8080; | ||
|
||
app.use(express.json()); | ||
app.use(express.urlencoded({ extended: true })); | ||
app.use(cors()); | ||
app.use(express.static(path.join(__dirname, 'static'))); | ||
|
||
const routes = [ | ||
{ path: '/', file: 'index.html' }, | ||
{ path: '/~', file: 'apps.html' }, | ||
{ path: '/-', file: 'games.html' }, | ||
{ path: '/!', file: 'settings.html' }, | ||
{ path: '/0', file: 'tabs.html' }, | ||
{ path: '/&', file: 'go.html' }, | ||
{ path: '/w', file: 'edu.html' }, | ||
]; | ||
|
||
app.get('/y/*', cors({ origin: false }), async (req, res, next) => { | ||
try { | ||
const reqTarget = `https://raw.githubusercontent.com/ypxa/y/main/${req.params[0]}`; | ||
const asset = await fetch(reqTarget); | ||
if (asset.ok) { | ||
const data = await asset.arrayBuffer(); | ||
res.end(Buffer.from(data)); | ||
} else { | ||
next(); | ||
} | ||
} catch (error) { | ||
console.error('Error fetching:', error); | ||
next(error); | ||
} | ||
}); | ||
|
||
routes.forEach((route) => { | ||
app.get(route.path, (req, res) => { | ||
res.sendFile(path.join(__dirname, 'static', route.file)); | ||
}); | ||
}); | ||
|
||
server.on('request', (req, res) => { | ||
if (bareServer.shouldRoute(req)) { | ||
bareServer.routeRequest(req, res); | ||
} else { | ||
app(req, res); | ||
} | ||
}); | ||
|
||
server.on('upgrade', (req, socket, head) => { | ||
if (bareServer.shouldRoute(req)) { | ||
bareServer.routeUpgrade(req, socket, head); | ||
} else { | ||
socket.end(); | ||
} | ||
}); | ||
|
||
server.on('listening', () => { | ||
console.log(`Running at http://localhost:${PORT}`); | ||
}); | ||
|
||
server.listen({ | ||
port: PORT, | ||
}); | ||
import express from 'express' | ||
import http from 'node:http' | ||
import { createBareServer } from '@tomphttp/bare-server-node' | ||
import path from 'node:path' | ||
import cors from 'cors' | ||
|
||
const __dirname = process.cwd() | ||
const server = http.createServer() | ||
const app = express(server) | ||
const bareServer = createBareServer('/v/') | ||
const PORT = 8080 | ||
|
||
app.use(express.json()) | ||
app.use(express.urlencoded({ extended: true })) | ||
app.use(cors()) | ||
app.use(express.static(path.join(__dirname, 'static'))) | ||
|
||
const routes = [ | ||
{ path: '/', file: 'index.html' }, | ||
{ path: '/~', file: 'apps.html' }, | ||
{ path: '/-', file: 'games.html' }, | ||
{ path: '/!', file: 'settings.html' }, | ||
{ path: '/0', file: 'tabs.html' }, | ||
{ path: '/&', file: 'go.html' }, | ||
{ path: '/w', file: 'edu.html' }, | ||
] | ||
|
||
app.get('/y/*', cors({ origin: false }), async (req, res, next) => { | ||
try { | ||
const reqTarget = `https://raw.githubusercontent.com/ypxa/y/main/${req.params[0]}` | ||
const asset = await fetch(reqTarget) | ||
|
||
if (asset.ok) { | ||
const data = await asset.arrayBuffer() | ||
res.end(Buffer.from(data)) | ||
} else { | ||
next() | ||
} | ||
} catch (error) { | ||
console.error('Error fetching:', error) | ||
next(error) | ||
} | ||
}) | ||
|
||
routes.forEach((route) => { | ||
app.get(route.path, (req, res) => { | ||
res.sendFile(path.join(__dirname, 'static', route.file)) | ||
}) | ||
}) | ||
|
||
server.on('request', (req, res) => { | ||
if (bareServer.shouldRoute(req)) { | ||
bareServer.routeRequest(req, res) | ||
} else { | ||
app(req, res) | ||
} | ||
}) | ||
|
||
server.on('upgrade', (req, socket, head) => { | ||
if (bareServer.shouldRoute(req)) { | ||
bareServer.routeUpgrade(req, socket, head) | ||
} else { | ||
socket.end() | ||
} | ||
}) | ||
|
||
server.on('listening', () => { | ||
console.log(`Running at http://localhost:${PORT}`) | ||
}) | ||
|
||
server.listen({ | ||
port: PORT, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
services: | ||
- type: web | ||
name: edu | ||
env: docker | ||
plan: free | ||
services: | ||
- type: web | ||
name: edu | ||
env: docker | ||
plan: free |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.