summaryrefslogtreecommitdiffstats
path: root/js/build/app.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/build/app.js')
-rw-r--r--js/build/app.js39
1 files changed, 33 insertions, 6 deletions
diff --git a/js/build/app.js b/js/build/app.js
index 04596e6fc..0e3606add 100644
--- a/js/build/app.js
+++ b/js/build/app.js
@@ -28,10 +28,13 @@ app.config(["$routeProvider", "$provide", "$httpProvider", function ($routeProvi
$provide.constant('SCROLL_TIMEOUT', 0.1);
// make sure that the CSRF header is only sent to the ownCloud domain
- $provide.factory('CSRFInterceptor', ["$q", "BASE_URL", function ($q, BASE_URL) {
+ $provide.factory('CSRFInterceptor', ["$q", "BASE_URL", "$window", function ($q, BASE_URL, $window) {
return {
request: function (config) {
- if (config.url.indexOf(BASE_URL) === 0) {
+ var domain =
+ $window.location.href.split($window.location.pathname)[0];
+ if (config.url.indexOf(BASE_URL) === 0 ||
+ config.url.indexOf(domain) === 0) {
config.headers.requesttoken = csrfToken;
}
@@ -100,8 +103,31 @@ app.config(["$routeProvider", "$provide", "$httpProvider", function ($routeProvi
controller: 'ExploreController as Explore',
templateUrl: 'explore.html',
resolve: {
- sites: /* @ngInject */ ["$http", "BASE_URL", function ($http, BASE_URL) {
- return $http.get(BASE_URL + '/explore');
+ sites: /* @ngInject */ ["$http", "$q", "BASE_URL", "Publisher", "SettingsResource", function (
+ $http, $q, BASE_URL, Publisher, SettingsResource) {
+ var deferred = $q.defer();
+
+ $http.get(BASE_URL + '/settings').then(function (data) {
+ Publisher.publishAll(data);
+
+ var url = SettingsResource.get('exploreUrl');
+ var language = SettingsResource.get('language');
+ return $http({
+ url: url,
+ method: 'GET',
+ params: {
+ lang: language
+ }
+ });
+
+ }).then(function (data) {
+ console.log(data);
+ deferred.resolve(data.data);
+ }, function () {
+ deferred.reject();
+ });
+
+ return deferred.promise;
}]
},
type: feedType.EXPLORE
@@ -395,7 +421,7 @@ app.controller('ContentController',
app.controller('ExploreController', ["sites", "$rootScope", function (sites, $rootScope) {
'use strict';
- this.sites = sites.data;
+ this.sites = sites;
this.subscribeTo = function (url) {
@@ -1737,7 +1763,8 @@ app.service('SettingsResource', ["$http", "BASE_URL", function ($http, BASE_URL)
showAll: false,
compact: false,
oldestFirst: false,
- preventReadOnScroll: false
+ preventReadOnScroll: false,
+ exploreUrl: ''
};
this.defaultLanguageCode = 'en';
this.supportedLanguageCodes = [