forked from amethystnetwork-dev/Incognito
-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
238c313
commit da28ffd
Showing
16 changed files
with
361 additions
and
238 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
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,2 +1 @@ | ||
node_modules | ||
.junk | ||
node_modules |
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,4 +1,4 @@ | ||
entrypoint = "README.md" | ||
run = "./repl.sh" | ||
onBoot = "chmod u+x repl.sh && chmod u+x webretro.sh" | ||
language = "nodejs" | ||
language = "nodejs" | ||
run = ["npm", "start"] | ||
onBoot = "chmod u+x webretro.sh" |
File renamed without changes.
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,3 +1,40 @@ | ||
(async() => { | ||
await import('./index.mjs'); | ||
})(); | ||
import createServer from '@tomphttp/bare-server-node'; | ||
import { fileURLToPath } from "url"; | ||
import http from 'http'; | ||
import serveStatic from "serve-static"; | ||
|
||
// The following message MAY NOT be removed | ||
console.log("Incognito\nThis program comes with ABSOLUTELY NO WARRANTY.\nThis is free software, and you are welcome to redistribute it\nunder the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nYou should have received a copy of the GNU General Public License\nalong with this program. If not, see <https://www.gnu.org/licenses/>.\n") | ||
|
||
const port = process.env.PORT || 8080; | ||
const bare = createServer('/bare/'); | ||
const serve = serveStatic(fileURLToPath(new URL("./static/", import.meta.url)), { fallthrough: false }); | ||
const server = http.createServer(); | ||
|
||
server.on('request', (req, res) => { | ||
if (bare.shouldRoute(req)) { | ||
bare.routeRequest(req, res); | ||
} else { | ||
serve(req, res, (err) => { | ||
res.writeHead(err?.statusCode || 500, null, { | ||
"Content-Type": "text/plain", | ||
}); | ||
res.end(err?.stack); | ||
}); | ||
} | ||
}); | ||
|
||
server.on('upgrade', (req, socket, head) => { | ||
if (bare.shouldRoute(req, socket, head)) { | ||
bare.routeUpgrade(req, socket, head); | ||
} else { | ||
socket.end(); | ||
} | ||
}); | ||
|
||
|
||
server.listen({ | ||
port: port, | ||
}); | ||
|
||
console.log("Server running on port " + port) |
Oops, something went wrong.