From 29bab1bfdfa1052791a5d93b47c82b79d703fe10 Mon Sep 17 00:00:00 2001
From: Ben Davies <34197615+Kaiepi@users.noreply.github.com>
Date: Wed, 4 Sep 2019 16:54:03 -0300
Subject: [PATCH] Fix SockJS when using the desktop client (#1360)
* Patch SockJS v1.4.0 to work with nw.js
* Document how to upgrade SockJS in UPGRADING-SOCKJS.md
---
UPGRADING-SOCKJS.md | 15 +++++++++++++++
index.template.html | 2 +-
js/lib/sockjs-1.4.0-nwjsfix.min.js | 3 +++
preactalpha.template.html | 2 +-
testclient-beta.html | 2 +-
testclient.html | 2 +-
6 files changed, 22 insertions(+), 4 deletions(-)
create mode 100644 UPGRADING-SOCKJS.md
create mode 100644 js/lib/sockjs-1.4.0-nwjsfix.min.js
diff --git a/UPGRADING-SOCKJS.md b/UPGRADING-SOCKJS.md
new file mode 100644
index 000000000..45f5f6df3
--- /dev/null
+++ b/UPGRADING-SOCKJS.md
@@ -0,0 +1,15 @@
+Upgrading SockJS
+=======================================================================
+
+When SockJS needs to be upgraded, you will also need to patch it to work
+properly with nw.js. In the minified script, replace all instances of this:
+
+```javascript
+.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})
+```
+
+With this:
+
+```javascript
+.call(this,window)
+```
diff --git a/index.template.html b/index.template.html
index 404c0030b..75fc1a83f 100644
--- a/index.template.html
+++ b/index.template.html
@@ -120,7 +120,7 @@ ga('send', 'pageview');
-
+
-
+
diff --git a/testclient-beta.html b/testclient-beta.html
index c981edac6..a9690f211 100644
--- a/testclient-beta.html
+++ b/testclient-beta.html
@@ -56,7 +56,7 @@
-
+
diff --git a/testclient.html b/testclient.html
index a6b62e82c..902e18111 100644
--- a/testclient.html
+++ b/testclient.html
@@ -90,7 +90,7 @@
-
+