summaryrefslogtreecommitdiffstats
path: root/js/app/Config.js
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2014-05-19 02:22:02 +0200
committerBernhard Posselt <dev@bernhard-posselt.com>2014-05-19 02:22:02 +0200
commit90584316b8f275fcad904b644676544eb0322636 (patch)
tree35ead28e8f0cdccc1771464442bb83ce5b558cc6 /js/app/Config.js
parentded252d29e99e068ea341506129e47a05e053a24 (diff)
add test for firstrun page
Diffstat (limited to 'js/app/Config.js')
-rw-r--r--js/app/Config.js65
1 files changed, 65 insertions, 0 deletions
diff --git a/js/app/Config.js b/js/app/Config.js
new file mode 100644
index 000000000..67a5e7215
--- /dev/null
+++ b/js/app/Config.js
@@ -0,0 +1,65 @@
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2014
+ */
+app.config(function ($routeProvider, $provide, $httpProvider) {
+ 'use strict';
+
+ // constants
+ $provide.constant('BASE_URL', OC.generateUrl('/apps/news'));
+
+ $provide.constant('FEED_TYPE', {
+ FEED: 0,
+ FOLDER: 1,
+ STARRED: 2,
+ SUBSCRIPTIONS: 3,
+ SHARED: 4
+ });
+
+ // make sure that the CSRF header is only sent to the ownCloud domain
+ $provide.factory('CSRFInterceptor', function ($q, BASE_URL) {
+ return {
+ request: function (config) {
+ if (config.url.indexOf(BASE_URL) === 0) {
+ config.headers.requesttoken = oc_requesttoken;
+ }
+
+ return config || $q.when(config);
+ }
+ };
+ });
+ $httpProvider.interceptors.push('CSRFInterceptor');
+
+ // routing
+ $routeProvider
+ .when('/items', {
+ controller: 'ItemsController',
+ templateUrl: 'content.html',
+ resolve: {}
+ })
+ .when('/items/starred', {
+ controller: 'StarredController',
+ templateUrl: 'content.html',
+ resolve: {}
+ })
+ .when('/items/feeds/:id', {
+ controller: 'FeedController',
+ templateUrl: 'content.html',
+ resolve: {}
+ })
+ .when('/items/folders/:id', {
+ controller: 'FolderController',
+ templateUrl: 'content.html',
+ resolve: {}
+ })
+ .otherwise({
+ redirectTo: '/items'
+ });
+
+});
+