aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoreperelm2 <emily_perelman@brown.edu>2023-07-26 11:21:18 -0400
committereperelm2 <emily_perelman@brown.edu>2023-07-26 11:21:18 -0400
commit68f11338ad62d38e8537d438bbbf17df4fb5b0f2 (patch)
tree3907ce8113ae4acd13a1de59cd24ecf4dbd434d7 /src
parentb84d3851d3baeeb0e2da5d4bd2fde9c911697d21 (diff)
parentc87024c06941920f1df689d54d82cc309891e3d2 (diff)
Merge branch 'master' into secondpropertiesmenu-emily
Diffstat (limited to 'src')
-rw-r--r--src/client/DocServer.ts6
-rw-r--r--src/server/server_Initialization.ts6
2 files changed, 7 insertions, 5 deletions
diff --git a/src/client/DocServer.ts b/src/client/DocServer.ts
index fa1fca6ff..ba59a9f50 100644
--- a/src/client/DocServer.ts
+++ b/src/client/DocServer.ts
@@ -64,7 +64,7 @@ export namespace DocServer {
}
export let _socket: SocketIOClient.Socket;
// this client's distinct GUID created at initialization
- let GUID: string;
+ let USER_ID: string;
// indicates whether or not a document is currently being udpated, and, if so, its id
export enum WriteMode {
@@ -154,7 +154,7 @@ export namespace DocServer {
export function init(protocol: string, hostname: string, port: number, identifier: string) {
_cache = {};
- GUID = identifier;
+ USER_ID = identifier;
protocol = protocol.startsWith('https') ? 'wss' : 'ws';
_socket = io.connect(`${protocol}://${hostname}:${port}`);
// io.connect(`https://7f079dda.ngrok.io`);// if using ngrok, create a special address for the websocket
@@ -228,7 +228,7 @@ export namespace DocServer {
* indicating that this client has connected
*/
function onConnection() {
- _socket.emit(MessageStore.Bar.Message, GUID);
+ _socket.emit(MessageStore.Bar.Message, USER_ID);
}
export namespace Util {
diff --git a/src/server/server_Initialization.ts b/src/server/server_Initialization.ts
index 805da1d43..c38ee8ac9 100644
--- a/src/server/server_Initialization.ts
+++ b/src/server/server_Initialization.ts
@@ -234,8 +234,10 @@ function proxyServe(req: any, requrl: string, response: any) {
function registerEmbeddedBrowseRelativePathHandler(server: express.Express) {
server.use('*', (req, res) => {
const relativeUrl = req.originalUrl;
- if (!req.user) res.redirect('/home'); // When no user is logged in, we interpret a relative URL as being a reference to something they don't have access to and redirect to /home
- else if (!res.headersSent && req.headers.referer?.includes('corsProxy')) {
+ // if (req.originalUrl === '/css/main.css' || req.originalUrl === '/favicon.ico') res.end();
+ // else
+ if (!res.headersSent && req.headers.referer?.includes('corsProxy')) {
+ if (!req.user) res.redirect('/home'); // When no user is logged in, we interpret a relative URL as being a reference to something they don't have access to and redirect to /home
// a request for something by a proxied referrer means it must be a relative reference. So construct a proxied absolute reference here.
try {
const proxiedRefererUrl = decodeURIComponent(req.headers.referer); // (e.g., http://localhost:<port>/corsProxy/https://en.wikipedia.org/wiki/Engelbart)