diff --git a/.gitignore b/.gitignore index 7891eb6..8581f98 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ templates.js .tmp/ coverage/ node_modules/ +app/panoptes-client.js diff --git a/app/index.html b/app/index.html index 7f7d3a7..6198cc4 100644 --- a/app/index.html +++ b/app/index.html @@ -176,8 +176,7 @@

- - + @@ -228,6 +227,8 @@

+ + diff --git a/app/modules/zoo-api/scripts/project-service.js b/app/modules/zoo-api/scripts/project-service.js index ef61f70..193e97d 100644 --- a/app/modules/zoo-api/scripts/project-service.js +++ b/app/modules/zoo-api/scripts/project-service.js @@ -1,6 +1,9 @@ (function (angular, _) { 'use strict'; + // use to determine if in production or staging + var isProd = window.location.hostname === 'www.oldweather.org' || window.location.hostname === 'oldweather.org'; + var module = angular.module('zooAPI'); var upsert = function (arr, key, newVal) { @@ -15,19 +18,19 @@ module.constant('zooAPIConfig', { display_name: 'oldweather', - app_id: '0cee9a29027e78cc7f9df99a3d6b0d00aaf3bbfad014a4bb73bf29f30b46575f' // panoptes staging - // app_id: '2b10a14e8f11eefb130a275f01898c8406600834bff1063bb1b7938795acc8a3' // panoptes production + app_id: isProd ? + '2b10a14e8f11eefb130a275f01898c8406600834bff1063bb1b7938795acc8a3' : // production + '0cee9a29027e78cc7f9df99a3d6b0d00aaf3bbfad014a4bb73bf29f30b46575f', // staging + url: isProd ? + 'https://panoptes.zooniverse.org/api' : + 'https://panoptes-staging.zooniverse.org/api' }); module.factory('zooAPI', function ($window, zooAPIConfig) { - // Set API root depending on environment - var isProd = window.location.hostname === 'www.oldweather.org' || window.location.hostname === 'oldweather.org'; - $window.zooAPI.root = isProd ? 'https://panoptes.zooniverse.org/api' : 'https://panoptes-staging.zooniverse.org/api'; - // Send Old Weather app id when in production - if (isProd) { - $window.zooAPI.appID = zooAPIConfig.app_id; - } - return $window.zooAPI; + console.log('zooAPIConfig = ', zooAPIConfig); + $window.zooAPI.root = zooAPIConfig.url; + $window.zooAPI.appID = zooAPIConfig.app_id; + return $window.zooAPI; }); module.filter('removeCircularDeps', function () { diff --git a/bower.json b/bower.json index 4d343e7..2da1ce5 100644 --- a/bower.json +++ b/bower.json @@ -19,7 +19,6 @@ "angular-spinner": "0.6.1", "spin.js": "2.3.0", "animate.css": "3.3.0", - "panoptes-javascript-lib": "0.0.3", "angular-local-storage": "0.2.2", "masonry": "3.3.1", "packery": "1.4.1", diff --git a/package.json b/package.json index 93462a0..0d974b1 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "doc": "docs" }, "scripts": { - "postinstall": "gulp hookmeup", + "postinstall": "bower install && browserify panoptes-client-wrapper/index.js > app/panoptes-client.js && gulp hookmeup", "test": "gulp test-ci" }, "repository": { @@ -21,6 +21,8 @@ }, "homepage": "https://github.com/zooniverse/old-weather", "devDependencies": { + "bower": "^1.7.9", + "browserify": "^13.0.1", "gulp": "^3.8.11", "gulp-angular-templatecache": "^1.6.0", "gulp-chmod": "1.2.0", @@ -45,7 +47,9 @@ "karma-firefox-launcher": "^0.1.6", "karma-jasmine": "0.3.5", "nib": "1.1.0", + "panoptes-client": "^2.5.1", "run-sequence": "^1.1.0", "stylus": "^0.51.1" - } + }, + "dependencies": {} } diff --git a/panoptes-client-wrapper/index.js b/panoptes-client-wrapper/index.js new file mode 100644 index 0000000..ec506e7 --- /dev/null +++ b/panoptes-client-wrapper/index.js @@ -0,0 +1,2 @@ +window.zooAPI = require('panoptes-client/lib/api-client'); +window.zooAuth = require('panoptes-client/lib/auth'); \ No newline at end of file