From 0c5c07b0fea9e734b1b178ecf856501441515f4a Mon Sep 17 00:00:00 2001
From: Brian Peiris <brianpeiris@gmail.com>
Date: Thu, 16 Nov 2017 16:07:43 -0800
Subject: [PATCH] Update minijanus/naf-janus-adapter

* remove pre-commit and now, since they're kinda broken

* Used fixed SHA for input-mapping-component

* new janus-plugin-sfu api

* fix input mappings config

* update yarn.lock

* Use quander.me for now

* Upgraded naf-janus-adapter
---
 package.json          | 10 ++-----
 src/config.js         |  2 +-
 src/input-mappings.js | 66 ++++++++++++++++++++++---------------------
 src/lobby.js          | 20 ++++---------
 yarn.lock             | 51 ++++++++-------------------------
 5 files changed, 55 insertions(+), 94 deletions(-)

diff --git a/package.json b/package.json
index 69b31a5a3..7acb2082d 100644
--- a/package.json
+++ b/package.json
@@ -9,14 +9,12 @@
     "prettier": "prettier --write src/**/*.js",
     "deploy": "npm run build && now deploy --static ./public/"
   },
-  "pre-commit": [
-    "prettier"
-  ],
   "dependencies": {
     "aframe": "0.7.0",
-    "aframe-input-mapping-component": "https://github.com/fernandojsg/aframe-input-mapping-component",
+    "aframe-input-mapping-component": "https://github.com/fernandojsg/aframe-input-mapping-component#6ebc38f",
     "aframe-teleport-controls": "https://github.com/netpro2k/aframe-teleport-controls#feature/teleport-origin",
-    "naf-janus-adapter": "^0.1.4",
+    "minijanus": "^0.1.6",
+    "naf-janus-adapter": "^0.1.5",
     "networked-aframe": "https://github.com/netpro2k/networked-aframe#bugfix/chrome/audio",
     "nipplejs": "^0.6.7",
     "pleasejs": "^0.4.2",
@@ -34,8 +32,6 @@
     "eslint": "^4.10.0",
     "eslint-config-prettier": "^2.6.0",
     "eslint-plugin-prettier": "^2.3.1",
-    "now": "^8.3.11",
-    "pre-commit": "^1.2.2",
     "prettier": "^1.7.0",
     "style-loader": "^0.19.0",
     "webpack": "^3.6.0",
diff --git a/src/config.js b/src/config.js
index 194137a54..eed5c042f 100644
--- a/src/config.js
+++ b/src/config.js
@@ -1,5 +1,5 @@
 export default {
-  janus_server_url: "wss://dev-janus.reticulum.io",
+  janus_server_url: "wss://quander.me:8989",
   public_rooms: [1, 2, 3, 4, 5],
   default_room: 1
 };
diff --git a/src/input-mappings.js b/src/input-mappings.js
index d1e8c6d4f..2f03c6303 100644
--- a/src/input-mappings.js
+++ b/src/input-mappings.js
@@ -1,37 +1,39 @@
 export default function registerInputMappings() {
   AFRAME.registerInputMappings({
-    default: {
-      common: {
-        // @TODO these dpad events are emmited by an axis-dpad component. This should probalby move into either tracked-controller or input-mapping
-        dpadleftdown: "action_snap_rotate_left",
-        dpadrightdown: "action_snap_rotate_right",
-        dpadcenterdown: "action_teleport_down", // @TODO once once #30 lands in aframe-teleport controls this just maps to "action_teleport_aim"
-        dpadcenterup: "action_teleport_up", // @TODO once once #30 lands in aframe-teleport controls this just maps to "action_teleport_teleport"
-        touchpadpressedaxismovex: "translateX",
-        touchpadpressedaxismovey: "translateZ",
-        touchpadbuttonup: "stop_moving"
-      },
-      "vive-controls": {
-        menudown: "action_mute"
-      },
-      "oculus-touch-controls": {
-        xbuttondown: "action_mute"
-      },
-      daydream: {
-        menudown: "action_mute"
-      },
-      keyboard: {
-        m_press: "action_mute",
-        q_press: "action_snap_rotate_left",
-        e_press: "action_snap_rotate_right",
-        w_down: "action_move_forward",
-        w_up: "action_dont_move_forward",
-        a_down: "action_move_left",
-        a_up: "action_dont_move_left",
-        s_down: "action_move_backward",
-        s_up: "action_dont_move_backward",
-        d_down: "action_move_right",
-        d_up: "action_dont_move_right"
+    mappings: {
+      default: {
+        common: {
+          // @TODO these dpad events are emmited by an axis-dpad component. This should probalby move into either tracked-controller or input-mapping
+          dpadleftdown: "action_snap_rotate_left",
+          dpadrightdown: "action_snap_rotate_right",
+          dpadcenterdown: "action_teleport_down", // @TODO once once #30 lands in aframe-teleport controls this just maps to "action_teleport_aim"
+          dpadcenterup: "action_teleport_up", // @TODO once once #30 lands in aframe-teleport controls this just maps to "action_teleport_teleport"
+          touchpadpressedaxismovex: "translateX",
+          touchpadpressedaxismovey: "translateZ",
+          touchpadbuttonup: "stop_moving"
+        },
+        "vive-controls": {
+          menudown: "action_mute"
+        },
+        "oculus-touch-controls": {
+          xbuttondown: "action_mute"
+        },
+        daydream: {
+          menudown: "action_mute"
+        },
+        keyboard: {
+          m_press: "action_mute",
+          q_press: "action_snap_rotate_left",
+          e_press: "action_snap_rotate_right",
+          w_down: "action_move_forward",
+          w_up: "action_dont_move_forward",
+          a_down: "action_move_left",
+          a_up: "action_dont_move_left",
+          s_down: "action_move_backward",
+          s_up: "action_dont_move_backward",
+          d_down: "action_move_right",
+          d_up: "action_dont_move_right"
+        }
       }
     }
   });
diff --git a/src/lobby.js b/src/lobby.js
index 4ae9eeef7..61b3e35e8 100644
--- a/src/lobby.js
+++ b/src/lobby.js
@@ -46,20 +46,12 @@ class Lobby extends React.Component {
   }
 
   fetchRooms() {
-    return Promise.all(
-      Config.public_rooms.map(room_id => {
-        return this.handle
-          .sendMessage({
-            kind: "listusers",
-            room_id
-          })
-          .then(signal => ({
-            id: room_id,
-            limit: 12,
-            users: signal.plugindata.data.response.user_ids
-          }));
-      })
-    );
+    return this.handle
+      .sendMessage({ kind: "listusers" })
+      .then(signal => {
+        const usersByRoom = signal.plugindata.data.response.users;
+        return Config.public_rooms.map(id => ({id, limit: 12, users: usersByRoom[id] || []}));
+      });
   }
 
   onWebsocketMessage(event) {
diff --git a/yarn.lock b/yarn.lock
index c60d2aea8..113f5c6fb 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -52,9 +52,9 @@ acorn@^5.1.1:
   version "5.2.1"
   resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.2.1.tgz#317ac7821826c22c702d66189ab8359675f135d7"
 
-"aframe-input-mapping-component@https://github.com/fernandojsg/aframe-input-mapping-component":
-  version "1.0.0"
-  resolved "https://github.com/fernandojsg/aframe-input-mapping-component#577cadad5a42e7216843dfeca9770fa8be465e09"
+"aframe-input-mapping-component@https://github.com/fernandojsg/aframe-input-mapping-component#6ebc38f":
+  version "0.1.1"
+  resolved "https://github.com/fernandojsg/aframe-input-mapping-component#6ebc38f0e871e8ab66673aef5cd11f6ce052076c"
 
 aframe-lerp-component@^1.1.0:
   version "1.1.0"
@@ -1564,7 +1564,7 @@ concat-stream@1.4.x:
     readable-stream "~1.1.9"
     typedarray "~0.0.5"
 
-concat-stream@^1.4.7, concat-stream@^1.6.0:
+concat-stream@^1.6.0:
   version "1.6.0"
   resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7"
   dependencies:
@@ -3642,9 +3642,9 @@ min-document@^2.19.0:
   dependencies:
     dom-walk "^0.1.0"
 
-minijanus@^0.1.4:
-  version "0.1.4"
-  resolved "https://registry.yarnpkg.com/minijanus/-/minijanus-0.1.4.tgz#1a8294fa0735ce6a6c58a10dcff9a9ab0cfe8132"
+minijanus@^0.1.6:
+  version "0.1.6"
+  resolved "https://registry.yarnpkg.com/minijanus/-/minijanus-0.1.6.tgz#8aa08d5797239b3c54a998efa0ee25fa4a700689"
 
 minimalistic-assert@^1.0.0:
   version "1.0.0"
@@ -3704,11 +3704,11 @@ mute-stream@0.0.7:
   version "0.0.7"
   resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
 
-naf-janus-adapter@^0.1.4:
-  version "0.1.4"
-  resolved "https://registry.yarnpkg.com/naf-janus-adapter/-/naf-janus-adapter-0.1.4.tgz#3e6e2022e8f6d5b7f6221fcec8b36a1e1e13be44"
+naf-janus-adapter@^0.1.5:
+  version "0.1.5"
+  resolved "https://registry.yarnpkg.com/naf-janus-adapter/-/naf-janus-adapter-0.1.5.tgz#f10c8cf390e226ddd62a0058c19f072547bd783a"
   dependencies:
-    minijanus "^0.1.4"
+    minijanus "^0.1.6"
 
 nan@^2.3.0:
   version "2.7.0"
@@ -3840,10 +3840,6 @@ normalize-url@^1.4.0:
     query-string "^4.1.0"
     sort-keys "^1.0.0"
 
-now@^8.3.11:
-  version "8.3.11"
-  resolved "https://registry.yarnpkg.com/now/-/now-8.3.11.tgz#bca2043bc4485b1b24ea656d652e448ae27fe0bb"
-
 npm-run-path@^2.0.0:
   version "2.0.2"
   resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f"
@@ -3987,10 +3983,6 @@ os-locale@^2.0.0:
     lcid "^1.0.0"
     mem "^1.1.0"
 
-os-shim@^0.1.2:
-  version "0.1.3"
-  resolved "https://registry.yarnpkg.com/os-shim/-/os-shim-0.1.3.tgz#6b62c3791cf7909ea35ed46e17658bb417cb3917"
-
 os-tmpdir@^1.0.0, os-tmpdir@^1.0.1, os-tmpdir@~1.0.2:
   version "1.0.2"
   resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274"
@@ -4441,14 +4433,6 @@ postcss@^6.0.1:
     source-map "^0.6.1"
     supports-color "^4.4.0"
 
-pre-commit@^1.2.2:
-  version "1.2.2"
-  resolved "https://registry.yarnpkg.com/pre-commit/-/pre-commit-1.2.2.tgz#dbcee0ee9de7235e57f79c56d7ce94641a69eec6"
-  dependencies:
-    cross-spawn "^5.0.1"
-    spawn-sync "^1.0.15"
-    which "1.2.x"
-
 prelude-ls@~1.1.2:
   version "1.1.2"
   resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54"
@@ -5164,13 +5148,6 @@ source-map@~0.1.31:
   dependencies:
     amdefine ">=0.0.4"
 
-spawn-sync@^1.0.15:
-  version "1.0.15"
-  resolved "https://registry.yarnpkg.com/spawn-sync/-/spawn-sync-1.0.15.tgz#b00799557eb7fb0c8376c29d44e8a1ea67e57476"
-  dependencies:
-    concat-stream "^1.4.7"
-    os-shim "^0.1.2"
-
 spdx-correct@~1.0.0:
   version "1.0.2"
   resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40"
@@ -5796,12 +5773,6 @@ which-module@^2.0.0:
   version "2.0.0"
   resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
 
-which@1.2.x:
-  version "1.2.14"
-  resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5"
-  dependencies:
-    isexe "^2.0.0"
-
 which@^1.2.12, which@^1.2.9:
   version "1.3.0"
   resolved "https://registry.yarnpkg.com/which/-/which-1.3.0.tgz#ff04bdfc010ee547d780bec38e1ac1c2777d253a"
-- 
GitLab