Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
MattheousDT committed Jul 13, 2018
2 parents 0ea0df7 + 61fb2b7 commit 385eda7
Show file tree
Hide file tree
Showing 3 changed files with 222 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/web/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ try {
apiLogger.fatalError(`Could not read config file: ${err}`);
}

app.enable("trust proxy");

app.use(morgan(config.env === "dev" ? "combined" : "combined", { stream: new stream.Writable({
write: (chunk, encoding, next) => {

Expand All @@ -43,9 +45,7 @@ app.engine("ejs", ejs.renderFile);
app.use(express.static(path.join(__dirname, "static")));

app.use(express.json());
app.use(cookieParser(config.rawrxd, {
secure: config.env === "dev" ? false : true
}));
app.use(cookieParser());

app.use(i18n({
translationsPath: path.join(__dirname, 'translations'),
Expand Down
7 changes: 6 additions & 1 deletion src/web/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ router.get("/auth/discord", async (req, res) => {
res.json({ status: 401, message: "Unauthorized", error });
}

res.cookie("session", jwt.sign({ id: new_session_doc._id }, config.jwt_secret));
res.cookie("session", jwt.sign({ id: new_session_doc._id }, config.jwt_secret), config.rawrxd, { maxAge: 604800, expire: new Date() + 604800, secure: true });
res.redirect(`https://discordapp.com/api/oauth2/authorize?client_id=${config.discord_id}&redirect_uri=${encodeURIComponent(config.discord_redirect)}&response_type=code&scope=guilds%20identify&state=${nonce}`);
});

Expand Down Expand Up @@ -290,6 +290,11 @@ router.get("/dragonsplayroom", authUser, async (req, res) => {
res.render("dumbshit/dragonsplayroom", { user_data: user_res.data });
});

router.get("/dragonsplayroompp", authUser, (req, res) => {

res.render("dumbshit/dragonsplayroompp");
});

router.get("/token", authAdmin, (req, res) => {

res.json({ token: req.cookies.session });
Expand Down
213 changes: 213 additions & 0 deletions src/web/templates/dumbshit/dragonsplayroompp.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>I be gay yo</title>

<link rel="icon" type="image/png" href="/img/favicon.png" />
<link rel="shortcut icon" type="image/png" href="/img/favicon.png" />
<meta name="theme-color" content="#ff594f">

<link rel="alternate" href="/" hreflang="x-default" />
<link rel="alternate" href="/?hl=en" hreflang="en" />
<link rel="alternate" href="/?hl=ie" hreflang="ie" />
<link rel="alternate" href="/?hl=pt" hreflang="pt" />

<!-- Font Awesome -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<!-- Bootstrap core CSS -->
<link href="/css/bootstrap.min.css" rel="stylesheet">
<!-- Material Design Bootstrap -->
<link href="/css/mdb.min.css" rel="stylesheet">

<link href="/css/style.css" rel="stylesheet">

</head>

<body class="fixed-sn">

<canvas id="gl_canvas" width="640" height="480"></canvas>

<!-- JQuery -->
<script type="text/javascript" src="/js/jquery-3.2.1.min.js"></script>

<!-- Bootstrap tooltips -->
<script type="text/javascript" src="/js/popper.min.js"></script>

<!-- Bootstrap core JavaScript -->
<script type="text/javascript" src="/js/bootstrap.min.js"></script>

<!-- MDB core JavaScript -->
<script type="text/javascript" src="/js/mdb.min.js"></script>

<script>
//Animation init
new WOW().init();
//Modal
$('#myModal').on('shown.bs.modal', function () {
$('#myInput').focus()
})
// Material Select Initialization
$(document).ready(function () {
$('.mdb-select').material_select();
});
// SideNav Button Initialization
$(".button-collapse").sideNav();
// SideNav Scrollbar Initialization
var sideNavScrollbar = document.querySelector('.custom-scrollbar');
Ps.initialize(sideNavScrollbar);
// Tooltips Initialization
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
</script>

<script>
"use strict";
class Vertex2D {
constructor(x, y) {
this.x = x;
this.y = y;
}
}
const vsSource =
`
attribute vec2 vertex_pos;
void main() {
gl_Position = vec4(vertex_pos.xy, 0.0, 1.0);
}
`;
const fsSource =
`
void main() {
gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
}
`;
const initShaderProgram = (gl, vsSource, fsSource) => {
const vertexShader = loadShader(gl, gl.VERTEX_SHADER, vsSource);
const fragmentShader = loadShader(gl, gl.FRAGMENT_SHADER, fsSource);
const shaderProgram = gl.createProgram();
gl.attachShader(shaderProgram, vertexShader);
gl.attachShader(shaderProgram, fragmentShader);
gl.linkProgram(shaderProgram);
if (gl.getProgramParameter(shaderProgram, gl.LINK_STATUS) === false) {
alert('Unable to initialize the shader program: ' + gl.getProgramInfoLog(shaderProgram));
return null;
}
return shaderProgram;
}
const loadShader = (gl, type, source) => {
const shader = gl.createShader(type);
gl.shaderSource(shader, source);
gl.compileShader(shader);
if (gl.getShaderParameter(shader, gl.COMPILE_STATUS) === false) {
alert('An error occurred compiling the shaders: ' + gl.getShaderInfoLog(shader));
gl.deleteShader(shader);
return null;
}
return shader;
}
const initBuffers = gl => {
const positionBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer);
const positions = [-0.5, -0.5, 0.7, 0.7, 0.3, -0.3];
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW);
return positionBuffer;
}
const drawScene = (gl, programInfo, buffers) => {
gl.clearColor(0.0, 0.0, 0.0, 1.0);
gl.clear(gl.COLOR_BUFFER_BIT);
{
const numComponents = 2;
const type = gl.FLOAT;
const normalize = false;
const stride = 0;
const offset = 0;
gl.vertexAttribPointer(programInfo.attribLocations.vertexPosition, numComponents, type, normalize,
stride, offset);
gl.enableVertexAttribArray(programInfo.attribLocations.vertexPosition);
}
gl.useProgram(programInfo.program);
{
const offset = 0;
const vertexCount = 3;
gl.drawArrays(gl.TRIANGLES, offset, vertexCount);
}
}
//
// start here
//
function main() {
const canvas = document.querySelector("#gl_canvas");
// Initialize the GL context
const gl = canvas.getContext("webgl");
// Only continue if WebGL is available and working
if (gl === null) {
alert("Unable to initialize WebGL. Your browser or machine may not support it.");
return;
}
// Set clear color to black, fully opaque
gl.clearColor(0.0, 0.0, 0.0, 1.0);
// Clear the color buffer with specified clear color
gl.clear(gl.COLOR_BUFFER_BIT);
const shaderProgram = initShaderProgram(gl, vsSource, fsSource);
const programInfo = {
program: shaderProgram,
attribLocations: {
vertexPosition: gl.getAttribLocation(shaderProgram, "vertex_pos"),
}
};
const buffers = initBuffers(gl);
drawScene(gl, programInfo, buffers);
}
window.onload = () => {
main();
}
</script>

</body>

</html>

0 comments on commit 385eda7

Please sign in to comment.