ai-adventure-labs/server/frontend/connect-router.js

34 lines
1.1 KiB
JavaScript

module.exports = function (req, res) {
console.log(123);
const serverAddress = req.query.server;
const encryption = req.query.encrypted === "true";
if (req.query.encrypted === undefined || req.query.server === undefined)
return res.status(400).send(`<!DOCTYPE html>
<html>
<head>
<title>Error</title>
<meta charset="utf-8">
</head>
<body class="bg text-white">
<h1>[400] Error</h1><hr/><p>unuse required params</p>
</body>
</html>`);
res.send(`<!DOCTYPE html>
<html>
<head>
<title>Connection: ${serverAddress}</title>
<meta charset="utf-8">
</head>
<body class="bg text-white">
<div id="js-required">
<h1>Error: Javascript off</h1><hr/>
<p>Javascript is required for the site to work, enable it in your browser settings</p>
</div>
<script>
document.getElementById("js-required").innerHTML = "<p>Loading...</p>";
</script>
<script src="/bootstrap/bootstrap.bundle.min.js" defer></script>
<script src="/js/connect/main.js" type="module" defer></script>
</body>
</html>`);
}