diff --git a/components/auth/auth.js b/components/auth/auth.js index f08db805..54fe48e9 100644 --- a/components/auth/auth.js +++ b/components/auth/auth.js @@ -12,6 +12,27 @@ export function signOut() { if(window.dontReconnect) { return; } + + // remove all cookies + console.log("Removing cookies"); + (function () { + var cookies = document.cookie.split("; "); + for (var c = 0; c < cookies.length; c++) { + var d = window.location.hostname.split("."); + while (d.length > 0) { + var cookieBase = encodeURIComponent(cookies[c].split(";")[0].split("=")[0]) + '=; expires=Thu, 01-Jan-1970 00:00:01 GMT; domain=' + d.join('.') + ' ;path='; + var p = location.pathname.split('/'); + document.cookie = cookieBase + '/'; + while (p.length > 0) { + document.cookie = cookieBase + p.join('/'); + console.log(cookieBase + p.join('/')); + p.pop(); + }; + d.shift(); + } + } +})(); + window.location.reload(); } diff --git a/package.json b/package.json index bb8c50b9..f6bc1787 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,10 @@ "private": true, "type": "module", "scripts": { - "dev": "node welcome.js && npx concurrently \"cross-env nodemon ws/ws --exec \"node --no-warnings=ExperimentalWarning\" --watch ws/ws.js\" \"cross-env nodemon server.js --exec \"node --no-warnings=ExperimentalWarning\" --watch server.js\" \"npx next dev\"", + "dev": "node welcome.js && npx concurrently \"cross-env UWS_HTTP_MAX_HEADERS_SIZE=16384 nodemon ws/ws --exec \"node --no-warnings=ExperimentalWarning\" --watch ws/ws.js\" \"cross-env nodemon server.js --exec \"node --no-warnings=ExperimentalWarning\" --watch server.js\" \"npx next dev\"", "build": "cross-env next build", "start-api": "cross-env NODE_ENV=production node server.js", - "start-ws": "cross-env NODE_ENV=production node ws/ws", + "start-ws": "cross-env UWS_HTTP_MAX_HEADERS_SIZE=16384 NODE_ENV=production node ws/ws", "heroku-postbuild": "cross-env next build" }, "dependencies": { diff --git a/styles/globals.scss b/styles/globals.scss index ec8a30d3..e8dce679 100644 --- a/styles/globals.scss +++ b/styles/globals.scss @@ -36,6 +36,8 @@ button { overflow-y: auto; } +/// ccar + .home__content.hidden { left: 100%; opacity: 0; diff --git a/ws/ws.js b/ws/ws.js index eae4a80e..babf8904 100644 --- a/ws/ws.js +++ b/ws/ws.js @@ -17,10 +17,7 @@ import { players, games } from '../serverUtils/states.js'; import Memsave from '../models/Memsave.js'; import blockedAt from 'blocked-at'; -import axios from 'axios'; - config(); - // Load the profanity filter const filter = new Filter(); filter.removeWords('damn') @@ -198,7 +195,9 @@ process.on('unhandledRejection', (reason, promise) => { stop('unhandledRejection'); }); // uWebSockets.js -let app = uws.App(); +let app = uws.App({ + +}); app.listen('0.0.0.0', port, (ws) => { if (ws) { log('**WS Server started on port** ' + port); @@ -206,18 +205,21 @@ app.listen('0.0.0.0', port, (ws) => { }); app.get('/', (res, req) => { - // make sureonly cf can access - let ip = req.getHeader('cf-connecting-ip') || res.getRemoteAddressAsText(); - // cjeck if ip isarraybuffer - if (ip instanceof ArrayBuffer) { - ip = new TextDecoder().decode(ip); - } + + // count all the headers + let headerKb = 0; + req.forEach((key, value) => { + + headerKb += key.length + value.length; + + }); + headerKb = headerKb / 1024; setCorsHeaders(res); - res.writeHeader('Content-Type', 'text/plain'); + res.writeHeader('Content-Type', 'text/html'); res.writeStatus('200 OK'); - res.end("WorldGuessr - Powered by uWebSockets.js"); + res.end("WorldGuessr - Powered by uWebSockets.js
Headers: "+headerKb.toFixed(2)+'kb'); }); // maintenance mode