summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-06-03 17:51:34 -0400
committerJules Laplace <jules@okfoc.us>2014-06-03 17:51:34 -0400
commit90142bd07f926ef8a7f3ea86a563ec0ca648ca5d (patch)
tree2851e990b4b71e215ad2fff4dbcaf80229953c35
parent607f69c67a5b4dc72d2754192e3cdf67d0ad11d0 (diff)
pulling in more stuff from posthang
-rw-r--r--.gitignore2
-rw-r--r--config.json.example8
-rw-r--r--public/assets/javascripts/app.js (renamed from client/assets/javascripts/app.js)0
-rw-r--r--public/assets/javascripts/environments/app.js (renamed from client/assets/javascripts/environments/app.js)0
-rw-r--r--public/assets/javascripts/environments/tableaux/_empty.js (renamed from client/assets/javascripts/environments/tableaux/_empty.js)0
-rw-r--r--public/assets/javascripts/environments/tableaux/columns.js (renamed from client/assets/javascripts/environments/tableaux/columns.js)0
-rw-r--r--public/assets/javascripts/environments/tableaux/columns_circle.js (renamed from client/assets/javascripts/environments/tableaux/columns_circle.js)0
-rw-r--r--public/assets/javascripts/environments/tableaux/columns_split.js (renamed from client/assets/javascripts/environments/tableaux/columns_split.js)0
-rw-r--r--public/assets/javascripts/map/map.js (renamed from client/assets/javascripts/map/map.js)0
-rw-r--r--public/assets/javascripts/map/map_editor.js (renamed from client/assets/javascripts/map/map_editor.js)0
-rw-r--r--public/assets/javascripts/mx/extensions/mx.movements.js (renamed from client/assets/javascripts/mx/extensions/mx.movements.js)0
-rw-r--r--public/assets/javascripts/mx/extensions/mx.rotationControl.js (renamed from client/assets/javascripts/mx/extensions/mx.rotationControl.js)0
-rw-r--r--public/assets/javascripts/mx/extensions/mx.scene.js (renamed from client/assets/javascripts/mx/extensions/mx.scene.js)0
-rw-r--r--public/assets/javascripts/mx/extensions/mx.scrubber.js (renamed from client/assets/javascripts/mx/extensions/mx.scrubber.js)0
-rw-r--r--public/assets/javascripts/mx/mx.js (renamed from client/assets/javascripts/mx/mx.js)0
-rw-r--r--public/assets/javascripts/mx/mx.min.js (renamed from client/assets/javascripts/mx/mx.min.js)0
-rw-r--r--public/assets/javascripts/mx/mx.minimap.js (renamed from client/assets/javascripts/mx/mx.minimap.js)0
-rw-r--r--public/assets/javascripts/mx/mx.quaternion.js (renamed from client/assets/javascripts/mx/mx.quaternion.js)0
-rw-r--r--public/assets/javascripts/mx/primitives/mx.box.js (renamed from client/assets/javascripts/mx/primitives/mx.box.js)0
-rw-r--r--public/assets/javascripts/mx/primitives/mx.boxDimensions.js (renamed from client/assets/javascripts/mx/primitives/mx.boxDimensions.js)0
-rw-r--r--public/assets/javascripts/mx/primitives/mx.coords.js (renamed from client/assets/javascripts/mx/primitives/mx.coords.js)0
-rw-r--r--public/assets/javascripts/mx/primitives/mx.cutout.js (renamed from client/assets/javascripts/mx/primitives/mx.cutout.js)0
-rw-r--r--public/assets/javascripts/mx/primitives/mx.face.js (renamed from client/assets/javascripts/mx/primitives/mx.face.js)0
-rw-r--r--public/assets/javascripts/mx/primitives/mx.image.js (renamed from client/assets/javascripts/mx/primitives/mx.image.js)0
-rw-r--r--public/assets/javascripts/mx/primitives/mx.scaleBox.js (renamed from client/assets/javascripts/mx/primitives/mx.scaleBox.js)0
-rw-r--r--public/assets/javascripts/mx/primitives/mx.tableau.js (renamed from client/assets/javascripts/mx/primitives/mx.tableau.js)0
-rw-r--r--public/assets/javascripts/mx/primitives/mx.text.js (renamed from client/assets/javascripts/mx/primitives/mx.text.js)0
-rw-r--r--public/assets/javascripts/mx/primitives/mx.texturedBox.js (renamed from client/assets/javascripts/mx/primitives/mx.texturedBox.js)0
-rw-r--r--public/assets/javascripts/rectangles/_env.js (renamed from client/assets/javascripts/rectangles/_env.js)0
-rw-r--r--public/assets/javascripts/rectangles/engine/map/_map.js (renamed from client/assets/javascripts/rectangles/engine/map/_map.js)0
-rw-r--r--public/assets/javascripts/rectangles/engine/map/draw.js (renamed from client/assets/javascripts/rectangles/engine/map/draw.js)0
-rw-r--r--public/assets/javascripts/rectangles/engine/map/ui.js (renamed from client/assets/javascripts/rectangles/engine/map/ui.js)0
-rw-r--r--public/assets/javascripts/rectangles/engine/rooms/_rooms.js (renamed from client/assets/javascripts/rectangles/engine/rooms/_rooms.js)0
-rw-r--r--public/assets/javascripts/rectangles/engine/rooms/builder.js (renamed from client/assets/javascripts/rectangles/engine/rooms/builder.js)0
-rw-r--r--public/assets/javascripts/rectangles/engine/rooms/clipper.js (renamed from client/assets/javascripts/rectangles/engine/rooms/clipper.js)0
-rw-r--r--public/assets/javascripts/rectangles/engine/rooms/mover.js (renamed from client/assets/javascripts/rectangles/engine/rooms/mover.js)0
-rw-r--r--public/assets/javascripts/rectangles/engine/scenery/_scenery.js (renamed from client/assets/javascripts/rectangles/engine/scenery/_scenery.js)0
-rw-r--r--public/assets/javascripts/rectangles/engine/scenery/image/_image.js (renamed from client/assets/javascripts/rectangles/engine/scenery/image/_image.js)0
-rw-r--r--public/assets/javascripts/rectangles/engine/scenery/image/move.js (renamed from client/assets/javascripts/rectangles/engine/scenery/image/move.js)0
-rw-r--r--public/assets/javascripts/rectangles/engine/scenery/image/resize.js (renamed from client/assets/javascripts/rectangles/engine/scenery/image/resize.js)0
-rw-r--r--public/assets/javascripts/rectangles/models/rect.js (renamed from client/assets/javascripts/rectangles/models/rect.js)0
-rw-r--r--public/assets/javascripts/rectangles/models/room.js (renamed from client/assets/javascripts/rectangles/models/room.js)0
-rw-r--r--public/assets/javascripts/rectangles/models/tree.js (renamed from client/assets/javascripts/rectangles/models/tree.js)0
-rw-r--r--public/assets/javascripts/rectangles/models/vec2.js (renamed from client/assets/javascripts/rectangles/models/vec2.js)0
-rw-r--r--public/assets/javascripts/rectangles/models/vec3.js (renamed from client/assets/javascripts/rectangles/models/vec3.js)0
-rw-r--r--public/assets/javascripts/rectangles/models/wall.js (renamed from client/assets/javascripts/rectangles/models/wall.js)0
-rw-r--r--public/assets/javascripts/rectangles/util/colors.js (renamed from client/assets/javascripts/rectangles/util/colors.js)0
-rw-r--r--public/assets/javascripts/rectangles/util/constants.js (renamed from client/assets/javascripts/rectangles/util/constants.js)0
-rw-r--r--public/assets/javascripts/rectangles/util/debug.js (renamed from client/assets/javascripts/rectangles/util/debug.js)0
-rw-r--r--public/assets/javascripts/rectangles/util/keys.js (renamed from client/assets/javascripts/rectangles/util/keys.js)0
-rw-r--r--public/assets/javascripts/rectangles/util/mouse.js (renamed from client/assets/javascripts/rectangles/util/mouse.js)0
-rw-r--r--public/assets/javascripts/rectangles/util/sort.js (renamed from client/assets/javascripts/rectangles/util/sort.js)0
-rw-r--r--public/assets/javascripts/rectangles/util/wheel.js (renamed from client/assets/javascripts/rectangles/util/wheel.js)0
-rw-r--r--public/assets/javascripts/util.js (renamed from client/assets/javascripts/util.js)0
-rw-r--r--public/assets/javascripts/vendor/jquery.min.js (renamed from client/assets/javascripts/vendor/jquery.min.js)0
-rw-r--r--public/assets/javascripts/vendor/kdTree.js (renamed from client/assets/javascripts/vendor/kdTree.js)bin3693 -> 3693 bytes
-rw-r--r--public/assets/javascripts/vendor/loader.js (renamed from client/assets/javascripts/vendor/loader.js)0
-rw-r--r--public/assets/javascripts/vendor/polyfill.js (renamed from client/assets/javascripts/vendor/polyfill.js)0
-rw-r--r--public/assets/javascripts/vendor/tube.js (renamed from client/assets/javascripts/vendor/tube.js)0
-rw-r--r--public/assets/javascripts/vendor/tween.js (renamed from client/assets/javascripts/vendor/tween.js)0
-rw-r--r--public/assets/stylesheets/css.css (renamed from client/assets/stylesheets/css.css)0
-rw-r--r--public/assets/stylesheets/map.css (renamed from client/assets/stylesheets/map.css)0
-rw-r--r--public/rectangles.html (renamed from client/rectangles.html)0
-rw-r--r--server/index.js99
-rw-r--r--server/lib/api.js13
-rw-r--r--server/lib/auth.js53
-rw-r--r--server/lib/middleware.js22
-rw-r--r--server/lib/schemas/User.js66
-rw-r--r--server/lib/views.js11
69 files changed, 274 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 54e537b..c0f4c0c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,3 +29,5 @@ tmp/
*.mp4
*.db
+config.json
+
diff --git a/config.json.example b/config.json.example
new file mode 100644
index 0000000..90df381
--- /dev/null
+++ b/config.json.example
@@ -0,0 +1,8 @@
+{
+ "host": "lvh.me:3000",
+ "hostName": "lvh.me",
+ "port": 3000,
+ "socketPort": 1337,
+ "pageSize": 10,
+ "env": { "development": 1 }
+}
diff --git a/client/assets/javascripts/app.js b/public/assets/javascripts/app.js
index 1f7fc7d..1f7fc7d 100644
--- a/client/assets/javascripts/app.js
+++ b/public/assets/javascripts/app.js
diff --git a/client/assets/javascripts/environments/app.js b/public/assets/javascripts/environments/app.js
index cdc104b..cdc104b 100644
--- a/client/assets/javascripts/environments/app.js
+++ b/public/assets/javascripts/environments/app.js
diff --git a/client/assets/javascripts/environments/tableaux/_empty.js b/public/assets/javascripts/environments/tableaux/_empty.js
index b69fa78..b69fa78 100644
--- a/client/assets/javascripts/environments/tableaux/_empty.js
+++ b/public/assets/javascripts/environments/tableaux/_empty.js
diff --git a/client/assets/javascripts/environments/tableaux/columns.js b/public/assets/javascripts/environments/tableaux/columns.js
index e961315..e961315 100644
--- a/client/assets/javascripts/environments/tableaux/columns.js
+++ b/public/assets/javascripts/environments/tableaux/columns.js
diff --git a/client/assets/javascripts/environments/tableaux/columns_circle.js b/public/assets/javascripts/environments/tableaux/columns_circle.js
index 1816e51..1816e51 100644
--- a/client/assets/javascripts/environments/tableaux/columns_circle.js
+++ b/public/assets/javascripts/environments/tableaux/columns_circle.js
diff --git a/client/assets/javascripts/environments/tableaux/columns_split.js b/public/assets/javascripts/environments/tableaux/columns_split.js
index b9981d6..b9981d6 100644
--- a/client/assets/javascripts/environments/tableaux/columns_split.js
+++ b/public/assets/javascripts/environments/tableaux/columns_split.js
diff --git a/client/assets/javascripts/map/map.js b/public/assets/javascripts/map/map.js
index a90963f..a90963f 100644
--- a/client/assets/javascripts/map/map.js
+++ b/public/assets/javascripts/map/map.js
diff --git a/client/assets/javascripts/map/map_editor.js b/public/assets/javascripts/map/map_editor.js
index 754172b..754172b 100644
--- a/client/assets/javascripts/map/map_editor.js
+++ b/public/assets/javascripts/map/map_editor.js
diff --git a/client/assets/javascripts/mx/extensions/mx.movements.js b/public/assets/javascripts/mx/extensions/mx.movements.js
index 074ca9a..074ca9a 100644
--- a/client/assets/javascripts/mx/extensions/mx.movements.js
+++ b/public/assets/javascripts/mx/extensions/mx.movements.js
diff --git a/client/assets/javascripts/mx/extensions/mx.rotationControl.js b/public/assets/javascripts/mx/extensions/mx.rotationControl.js
index 9adb627..9adb627 100644
--- a/client/assets/javascripts/mx/extensions/mx.rotationControl.js
+++ b/public/assets/javascripts/mx/extensions/mx.rotationControl.js
diff --git a/client/assets/javascripts/mx/extensions/mx.scene.js b/public/assets/javascripts/mx/extensions/mx.scene.js
index 8f11fb0..8f11fb0 100644
--- a/client/assets/javascripts/mx/extensions/mx.scene.js
+++ b/public/assets/javascripts/mx/extensions/mx.scene.js
diff --git a/client/assets/javascripts/mx/extensions/mx.scrubber.js b/public/assets/javascripts/mx/extensions/mx.scrubber.js
index 54612f2..54612f2 100644
--- a/client/assets/javascripts/mx/extensions/mx.scrubber.js
+++ b/public/assets/javascripts/mx/extensions/mx.scrubber.js
diff --git a/client/assets/javascripts/mx/mx.js b/public/assets/javascripts/mx/mx.js
index df9abe7..df9abe7 100644
--- a/client/assets/javascripts/mx/mx.js
+++ b/public/assets/javascripts/mx/mx.js
diff --git a/client/assets/javascripts/mx/mx.min.js b/public/assets/javascripts/mx/mx.min.js
index b0f0cdd..b0f0cdd 100644
--- a/client/assets/javascripts/mx/mx.min.js
+++ b/public/assets/javascripts/mx/mx.min.js
diff --git a/client/assets/javascripts/mx/mx.minimap.js b/public/assets/javascripts/mx/mx.minimap.js
index 252305c..252305c 100644
--- a/client/assets/javascripts/mx/mx.minimap.js
+++ b/public/assets/javascripts/mx/mx.minimap.js
diff --git a/client/assets/javascripts/mx/mx.quaternion.js b/public/assets/javascripts/mx/mx.quaternion.js
index 783f887..783f887 100644
--- a/client/assets/javascripts/mx/mx.quaternion.js
+++ b/public/assets/javascripts/mx/mx.quaternion.js
diff --git a/client/assets/javascripts/mx/primitives/mx.box.js b/public/assets/javascripts/mx/primitives/mx.box.js
index dfe3f5e..dfe3f5e 100644
--- a/client/assets/javascripts/mx/primitives/mx.box.js
+++ b/public/assets/javascripts/mx/primitives/mx.box.js
diff --git a/client/assets/javascripts/mx/primitives/mx.boxDimensions.js b/public/assets/javascripts/mx/primitives/mx.boxDimensions.js
index f3edb13..f3edb13 100644
--- a/client/assets/javascripts/mx/primitives/mx.boxDimensions.js
+++ b/public/assets/javascripts/mx/primitives/mx.boxDimensions.js
diff --git a/client/assets/javascripts/mx/primitives/mx.coords.js b/public/assets/javascripts/mx/primitives/mx.coords.js
index 80b148c..80b148c 100644
--- a/client/assets/javascripts/mx/primitives/mx.coords.js
+++ b/public/assets/javascripts/mx/primitives/mx.coords.js
diff --git a/client/assets/javascripts/mx/primitives/mx.cutout.js b/public/assets/javascripts/mx/primitives/mx.cutout.js
index 9d9043f..9d9043f 100644
--- a/client/assets/javascripts/mx/primitives/mx.cutout.js
+++ b/public/assets/javascripts/mx/primitives/mx.cutout.js
diff --git a/client/assets/javascripts/mx/primitives/mx.face.js b/public/assets/javascripts/mx/primitives/mx.face.js
index ac47ab4..ac47ab4 100644
--- a/client/assets/javascripts/mx/primitives/mx.face.js
+++ b/public/assets/javascripts/mx/primitives/mx.face.js
diff --git a/client/assets/javascripts/mx/primitives/mx.image.js b/public/assets/javascripts/mx/primitives/mx.image.js
index d1e292d..d1e292d 100644
--- a/client/assets/javascripts/mx/primitives/mx.image.js
+++ b/public/assets/javascripts/mx/primitives/mx.image.js
diff --git a/client/assets/javascripts/mx/primitives/mx.scaleBox.js b/public/assets/javascripts/mx/primitives/mx.scaleBox.js
index 77f45e9..77f45e9 100644
--- a/client/assets/javascripts/mx/primitives/mx.scaleBox.js
+++ b/public/assets/javascripts/mx/primitives/mx.scaleBox.js
diff --git a/client/assets/javascripts/mx/primitives/mx.tableau.js b/public/assets/javascripts/mx/primitives/mx.tableau.js
index 514e206..514e206 100644
--- a/client/assets/javascripts/mx/primitives/mx.tableau.js
+++ b/public/assets/javascripts/mx/primitives/mx.tableau.js
diff --git a/client/assets/javascripts/mx/primitives/mx.text.js b/public/assets/javascripts/mx/primitives/mx.text.js
index 0c278a9..0c278a9 100644
--- a/client/assets/javascripts/mx/primitives/mx.text.js
+++ b/public/assets/javascripts/mx/primitives/mx.text.js
diff --git a/client/assets/javascripts/mx/primitives/mx.texturedBox.js b/public/assets/javascripts/mx/primitives/mx.texturedBox.js
index daec2d8..daec2d8 100644
--- a/client/assets/javascripts/mx/primitives/mx.texturedBox.js
+++ b/public/assets/javascripts/mx/primitives/mx.texturedBox.js
diff --git a/client/assets/javascripts/rectangles/_env.js b/public/assets/javascripts/rectangles/_env.js
index 972b1fe..972b1fe 100644
--- a/client/assets/javascripts/rectangles/_env.js
+++ b/public/assets/javascripts/rectangles/_env.js
diff --git a/client/assets/javascripts/rectangles/engine/map/_map.js b/public/assets/javascripts/rectangles/engine/map/_map.js
index 53084bb..53084bb 100644
--- a/client/assets/javascripts/rectangles/engine/map/_map.js
+++ b/public/assets/javascripts/rectangles/engine/map/_map.js
diff --git a/client/assets/javascripts/rectangles/engine/map/draw.js b/public/assets/javascripts/rectangles/engine/map/draw.js
index b2fc05f..b2fc05f 100644
--- a/client/assets/javascripts/rectangles/engine/map/draw.js
+++ b/public/assets/javascripts/rectangles/engine/map/draw.js
diff --git a/client/assets/javascripts/rectangles/engine/map/ui.js b/public/assets/javascripts/rectangles/engine/map/ui.js
index 6e9a5ab..6e9a5ab 100644
--- a/client/assets/javascripts/rectangles/engine/map/ui.js
+++ b/public/assets/javascripts/rectangles/engine/map/ui.js
diff --git a/client/assets/javascripts/rectangles/engine/rooms/_rooms.js b/public/assets/javascripts/rectangles/engine/rooms/_rooms.js
index 411a093..411a093 100644
--- a/client/assets/javascripts/rectangles/engine/rooms/_rooms.js
+++ b/public/assets/javascripts/rectangles/engine/rooms/_rooms.js
diff --git a/client/assets/javascripts/rectangles/engine/rooms/builder.js b/public/assets/javascripts/rectangles/engine/rooms/builder.js
index 8586a7b..8586a7b 100644
--- a/client/assets/javascripts/rectangles/engine/rooms/builder.js
+++ b/public/assets/javascripts/rectangles/engine/rooms/builder.js
diff --git a/client/assets/javascripts/rectangles/engine/rooms/clipper.js b/public/assets/javascripts/rectangles/engine/rooms/clipper.js
index 8989ba8..8989ba8 100644
--- a/client/assets/javascripts/rectangles/engine/rooms/clipper.js
+++ b/public/assets/javascripts/rectangles/engine/rooms/clipper.js
diff --git a/client/assets/javascripts/rectangles/engine/rooms/mover.js b/public/assets/javascripts/rectangles/engine/rooms/mover.js
index e67d9bc..e67d9bc 100644
--- a/client/assets/javascripts/rectangles/engine/rooms/mover.js
+++ b/public/assets/javascripts/rectangles/engine/rooms/mover.js
diff --git a/client/assets/javascripts/rectangles/engine/scenery/_scenery.js b/public/assets/javascripts/rectangles/engine/scenery/_scenery.js
index 867bb6f..867bb6f 100644
--- a/client/assets/javascripts/rectangles/engine/scenery/_scenery.js
+++ b/public/assets/javascripts/rectangles/engine/scenery/_scenery.js
diff --git a/client/assets/javascripts/rectangles/engine/scenery/image/_image.js b/public/assets/javascripts/rectangles/engine/scenery/image/_image.js
index dadb2d2..dadb2d2 100644
--- a/client/assets/javascripts/rectangles/engine/scenery/image/_image.js
+++ b/public/assets/javascripts/rectangles/engine/scenery/image/_image.js
diff --git a/client/assets/javascripts/rectangles/engine/scenery/image/move.js b/public/assets/javascripts/rectangles/engine/scenery/image/move.js
index e79ede9..e79ede9 100644
--- a/client/assets/javascripts/rectangles/engine/scenery/image/move.js
+++ b/public/assets/javascripts/rectangles/engine/scenery/image/move.js
diff --git a/client/assets/javascripts/rectangles/engine/scenery/image/resize.js b/public/assets/javascripts/rectangles/engine/scenery/image/resize.js
index a0a98c5..a0a98c5 100644
--- a/client/assets/javascripts/rectangles/engine/scenery/image/resize.js
+++ b/public/assets/javascripts/rectangles/engine/scenery/image/resize.js
diff --git a/client/assets/javascripts/rectangles/models/rect.js b/public/assets/javascripts/rectangles/models/rect.js
index 7a2ac6f..7a2ac6f 100644
--- a/client/assets/javascripts/rectangles/models/rect.js
+++ b/public/assets/javascripts/rectangles/models/rect.js
diff --git a/client/assets/javascripts/rectangles/models/room.js b/public/assets/javascripts/rectangles/models/room.js
index 731411c..731411c 100644
--- a/client/assets/javascripts/rectangles/models/room.js
+++ b/public/assets/javascripts/rectangles/models/room.js
diff --git a/client/assets/javascripts/rectangles/models/tree.js b/public/assets/javascripts/rectangles/models/tree.js
index 8193988..8193988 100644
--- a/client/assets/javascripts/rectangles/models/tree.js
+++ b/public/assets/javascripts/rectangles/models/tree.js
diff --git a/client/assets/javascripts/rectangles/models/vec2.js b/public/assets/javascripts/rectangles/models/vec2.js
index 9b0447c..9b0447c 100644
--- a/client/assets/javascripts/rectangles/models/vec2.js
+++ b/public/assets/javascripts/rectangles/models/vec2.js
diff --git a/client/assets/javascripts/rectangles/models/vec3.js b/public/assets/javascripts/rectangles/models/vec3.js
index 4e9f3cb..4e9f3cb 100644
--- a/client/assets/javascripts/rectangles/models/vec3.js
+++ b/public/assets/javascripts/rectangles/models/vec3.js
diff --git a/client/assets/javascripts/rectangles/models/wall.js b/public/assets/javascripts/rectangles/models/wall.js
index 4270551..4270551 100644
--- a/client/assets/javascripts/rectangles/models/wall.js
+++ b/public/assets/javascripts/rectangles/models/wall.js
diff --git a/client/assets/javascripts/rectangles/util/colors.js b/public/assets/javascripts/rectangles/util/colors.js
index e8e60d0..e8e60d0 100644
--- a/client/assets/javascripts/rectangles/util/colors.js
+++ b/public/assets/javascripts/rectangles/util/colors.js
diff --git a/client/assets/javascripts/rectangles/util/constants.js b/public/assets/javascripts/rectangles/util/constants.js
index 58cb1a5..58cb1a5 100644
--- a/client/assets/javascripts/rectangles/util/constants.js
+++ b/public/assets/javascripts/rectangles/util/constants.js
diff --git a/client/assets/javascripts/rectangles/util/debug.js b/public/assets/javascripts/rectangles/util/debug.js
index 924c816..924c816 100644
--- a/client/assets/javascripts/rectangles/util/debug.js
+++ b/public/assets/javascripts/rectangles/util/debug.js
diff --git a/client/assets/javascripts/rectangles/util/keys.js b/public/assets/javascripts/rectangles/util/keys.js
index 5a5c9d2..5a5c9d2 100644
--- a/client/assets/javascripts/rectangles/util/keys.js
+++ b/public/assets/javascripts/rectangles/util/keys.js
diff --git a/client/assets/javascripts/rectangles/util/mouse.js b/public/assets/javascripts/rectangles/util/mouse.js
index 3aa7cfc..3aa7cfc 100644
--- a/client/assets/javascripts/rectangles/util/mouse.js
+++ b/public/assets/javascripts/rectangles/util/mouse.js
diff --git a/client/assets/javascripts/rectangles/util/sort.js b/public/assets/javascripts/rectangles/util/sort.js
index 0985b75..0985b75 100644
--- a/client/assets/javascripts/rectangles/util/sort.js
+++ b/public/assets/javascripts/rectangles/util/sort.js
diff --git a/client/assets/javascripts/rectangles/util/wheel.js b/public/assets/javascripts/rectangles/util/wheel.js
index 6836772..6836772 100644
--- a/client/assets/javascripts/rectangles/util/wheel.js
+++ b/public/assets/javascripts/rectangles/util/wheel.js
diff --git a/client/assets/javascripts/util.js b/public/assets/javascripts/util.js
index 64bda4d..64bda4d 100644
--- a/client/assets/javascripts/util.js
+++ b/public/assets/javascripts/util.js
diff --git a/client/assets/javascripts/vendor/jquery.min.js b/public/assets/javascripts/vendor/jquery.min.js
index 73f33fb..73f33fb 100644
--- a/client/assets/javascripts/vendor/jquery.min.js
+++ b/public/assets/javascripts/vendor/jquery.min.js
diff --git a/client/assets/javascripts/vendor/kdTree.js b/public/assets/javascripts/vendor/kdTree.js
index 8b2a49b..8b2a49b 100644
--- a/client/assets/javascripts/vendor/kdTree.js
+++ b/public/assets/javascripts/vendor/kdTree.js
Binary files differ
diff --git a/client/assets/javascripts/vendor/loader.js b/public/assets/javascripts/vendor/loader.js
index 4c1c8cd..4c1c8cd 100644
--- a/client/assets/javascripts/vendor/loader.js
+++ b/public/assets/javascripts/vendor/loader.js
diff --git a/client/assets/javascripts/vendor/polyfill.js b/public/assets/javascripts/vendor/polyfill.js
index f97e438..f97e438 100644
--- a/client/assets/javascripts/vendor/polyfill.js
+++ b/public/assets/javascripts/vendor/polyfill.js
diff --git a/client/assets/javascripts/vendor/tube.js b/public/assets/javascripts/vendor/tube.js
index 17d3bfd..17d3bfd 100644
--- a/client/assets/javascripts/vendor/tube.js
+++ b/public/assets/javascripts/vendor/tube.js
diff --git a/client/assets/javascripts/vendor/tween.js b/public/assets/javascripts/vendor/tween.js
index b246ead..b246ead 100644
--- a/client/assets/javascripts/vendor/tween.js
+++ b/public/assets/javascripts/vendor/tween.js
diff --git a/client/assets/stylesheets/css.css b/public/assets/stylesheets/css.css
index 23ca23e..23ca23e 100644
--- a/client/assets/stylesheets/css.css
+++ b/public/assets/stylesheets/css.css
diff --git a/client/assets/stylesheets/map.css b/public/assets/stylesheets/map.css
index 2968f34..2968f34 100644
--- a/client/assets/stylesheets/map.css
+++ b/public/assets/stylesheets/map.css
diff --git a/client/rectangles.html b/public/rectangles.html
index 09be820..09be820 100644
--- a/client/rectangles.html
+++ b/public/rectangles.html
diff --git a/server/index.js b/server/index.js
new file mode 100644
index 0000000..601dbba
--- /dev/null
+++ b/server/index.js
@@ -0,0 +1,99 @@
+/* jshint node: true */
+var ejs = require('ejs');
+ejs.open = '[[';
+ejs.close = ']]';
+
+var config = require('../config.json'),
+ http = require('http'),
+ express = require('express'),
+ MongoStore = require('connect-mongo')(express),
+ TwitterStrategy = require('passport-twitter').Strategy,
+ passport = require('passport'),
+ passportSocketIo = require("passport.socketio"),
+ path = require('path'),
+ mongoose = require('mongoose');
+
+var io = websocket.listen(config.socketPort)
+
+var app = express();
+var DATABASE_URI = process.env.MONGOLAB_URI || ('mongodb://' + config.hostName + '/vvalls')
+
+mongoose.connect(DATABASE_URI);
+var SessionStore = new MongoStore({ mongoose_connection: mongoose.connection })
+
+// Configure things
+app.set('port', config.port);
+app.set('views', path.join(__dirname, '../views'));
+app.set('view engine', 'ejs');
+app.use(express.static(path.join(__dirname, '../public')));
+app.use(express.logger('dev'));
+app.use(express.json());
+app.use(express.urlencoded());
+app.use(express.cookieParser());
+app.use(express.session({
+ key: 'posthang.sid',
+ secret: '1337machine',
+ cookie: { domain: '.' + config.hostName, maxAge: 43200000 },
+ store: SessionStore
+}));
+app.use(express.bodyParser());
+app.use(express.query());
+app.use(express.methodOverride());
+app.use(passport.initialize());
+app.use(passport.session());
+// app.use('/api', middleware.ensureAuthenticated, mers({conn: mongoose.connection}).rest());
+app.use(app.router);
+app.get('env') === 'development' && app.use(express.errorHandler());
+
+
+// Configure user authentication
+passport.serializeUser(auth.serializeUser);
+passport.deserializeUser(auth.deserializeUser);
+passport.use(new TwitterStrategy({
+ consumerKey: process.env.VVALLS_TWITTER_KEY || '0L5blfBIapqhpons8bCXdIoGM',
+ consumerSecret: process.env.VVALLS_TWITTER_SECRET || '5EKW7m7inoODqYSKbp7cadBKFp1FghBl4MBDoXNcUjKtodZfuP',
+ callbackURL: 'http://' + config.host + '/auth/twitter/callback'
+}, api.insertUser));
+
+// Essential middleware
+// app.all('*', middleware.enableCORS);
+
+// Initialize views
+app.get('/login', views.login);
+app.get('/logout', auth.logout);
+app.get('/auth/twitter', auth.login('twitter'));
+app.get('/auth/twitter/callback', auth.loggedIn('twitter'));
+
+
+
+
+io.set('authorization', passportSocketIo.authorize({
+ cookieParser: express.cookieParser,
+ passport: passport,
+ key: 'posthang.sid', // the name of the cookie where express/connect stores its session_id
+ secret: '1337machine', // the session_secret to parse the cookie
+ store: SessionStore, // we NEED to use a sessionstore. no memorystore please
+ success: onAuthorizeSuccess, // *optional* callback on success - read more below
+ fail: onAuthorizeFail, // *optional* callback on fail/error - read more below
+}));
+
+function onAuthorizeSuccess (data, accept) {
+ // console.error('successful connection to socket.io');
+ accept(null, true);
+}
+function onAuthorizeFail(data, message, error, accept){
+ if (error) {
+ throw new Error(message);
+ }
+ // console.log(data)
+ console.error('failed connection to socket.io:', message);
+
+ // We use this callback to log all of our failed connections.
+ accept(null, false);
+}
+
+
+http.createServer(app).listen(app.get('port'), function () {
+ console.log('Express server listening on port ' + app.get('port'));
+});
+
diff --git a/server/lib/api.js b/server/lib/api.js
new file mode 100644
index 0000000..d9934ab
--- /dev/null
+++ b/server/lib/api.js
@@ -0,0 +1,13 @@
+/* jshint node: true */
+
+var passport = require('passport'),
+ _ = require('lodash'),
+ Entities = require('html-entities').XmlEntities,
+ entities = new Entities();
+
+
+var api = {
+}
+
+
+module.exports = api
diff --git a/server/lib/auth.js b/server/lib/auth.js
new file mode 100644
index 0000000..93fe223
--- /dev/null
+++ b/server/lib/auth.js
@@ -0,0 +1,53 @@
+/* jshint node: true */
+
+var passport = require('passport'),
+ _ = require('lodash'),
+ config = require('../../config.json'),
+ User = require('./schemas/User');
+
+var entities = new Entities();
+
+var auth = {
+
+ login: function (method) {
+ return passport.authenticate(method);
+ },
+
+ logout: function (req, res) {
+ req.logout();
+ res.redirect('/');
+ },
+
+ serializeUser: function (user, done) {
+ done(null, user.twitter_id);
+ },
+
+ deserializeUser: function (id, done) {
+ User.findOne({ twitter_id: id }, "_id displayName username photo", function (err, user) {
+ done(err, user);
+ });
+ },
+
+ insertUser: function (accessToken, refreshToken, profile, done) {
+ process.nextTick(function () {
+ var userData = {
+ username: profile.username,
+ displayName: profile.displayName,
+ photo: profile.photos[0].value
+ };
+ User.update({twitter_id: profile.id}, userData, {upsert: true}, function (userData, profile, err) {
+ return done(err, _.merge(userData, {twitter_id: profile.id}));
+ }.bind(this, userData, profile));
+ });
+ },
+
+ loggedIn: function () {
+ return passport.authenticate('twitter', {
+ successReturnToOrRedirect: '/',
+ failureRedirect: '/login'
+ });
+ },
+
+}
+
+module.exports = auth
diff --git a/server/lib/middleware.js b/server/lib/middleware.js
new file mode 100644
index 0000000..dea8019
--- /dev/null
+++ b/server/lib/middleware.js
@@ -0,0 +1,22 @@
+
+/* jshint node: true */
+
+var passport = require('passport'),
+ _ = require('lodash'),
+ config = require('../../config.json'),
+ User = require('./schemas/User');
+
+
+var middleware = {
+
+ enableCORS: function (req, res, next) {
+ res.header('Access-Control-Allow-Credentials', true);
+ // TODO Check https vs. http
+ res.header('Access-Control-Allow-Origin', '*');
+ res.header('Access-Control-Allow-Headers', 'X-Requested-With');
+ next();
+ },
+
+}
+
+module.exports = middleware
diff --git a/server/lib/schemas/User.js b/server/lib/schemas/User.js
new file mode 100644
index 0000000..93c0cd3
--- /dev/null
+++ b/server/lib/schemas/User.js
@@ -0,0 +1,66 @@
+/* jshint node: true */
+
+var NONALPHANUMERICS_REGEX = new RegExp('[^-_a-zA-Z0-9]', 'g')
+
+var mongoose = require('mongoose'),
+ _ = require('lodash'),
+ config = require('../../../config.json');
+
+var UserSchema = new mongoose.Schema({
+ twitter_id: String,
+ displayName: String,
+ username: {
+ type: String,
+ required: true,
+ validate: [function (val) {
+ val = val.replace(NONALPHANUMERICS_REGEX, "")
+ this.username = val.toLowerCase()
+ switch (val) {
+ case 'login':
+ case 'logout':
+ case 'profile':
+ case 'auth':
+ case 'upload':
+ case 'about':
+ case 'settings':
+ case 'admin':
+ case 'terms':
+ case '':
+ return false
+ }
+ if (! this.displayName) { this.displayName = val; }
+ return true
+ }, "{PATH} is not an acceptable name"]
+ },
+ email: {
+ type: String,
+ default: "",
+ },
+ emailVerified: {
+ type: Boolean,
+ default: false,
+ },
+ password: {
+ type: String,
+ validate: [function (val) {
+ if (! val.length) return true
+ return true
+ }, "{PATH} is not an acceptable password"]
+ },
+ photo: {
+ type: String,
+ required: true
+ },
+ bio: {
+ type: String,
+ default: ""
+ },
+ links: [
+ { type: String, default: "" }
+ ],
+ isAdmin: { type: Boolean, default: false }
+});
+
+
+module.exports = exports = mongoose.model('user', UserSchema);
+exports.schema = UserSchema;
diff --git a/server/lib/views.js b/server/lib/views.js
new file mode 100644
index 0000000..7f3d1a0
--- /dev/null
+++ b/server/lib/views.js
@@ -0,0 +1,11 @@
+/* jshint node: true */
+
+var User = require('./schemas/User'),
+ config = require('../../config'),
+ _ = require('lodash');
+
+exports.login = function (req, res) {
+ res.render('login', {
+ config: config
+ });
+};