☠️☠️ Bye bye feedproxy.config ☠️☠️

This commit is contained in:
Warren Buckley
2019-01-24 13:59:17 +00:00
parent c7bbad3c0c
commit ba098f49c4
14 changed files with 111 additions and 150 deletions

View File

@@ -14,7 +14,7 @@ function dashboardResource($q, $http, umbRequestHelper) {
*
* @description
* Retrieves the dashboard configuration for a given section
*
*
* @param {string} section Alias of section to retrieve dashboard configuraton for
* @returns {Promise} resourcePromise object containing the user array.
*
@@ -36,7 +36,7 @@ function dashboardResource($q, $http, umbRequestHelper) {
*
* @description
* Retrieves dashboard content from a remote source for a given section
*
*
* @param {string} section Alias of section to retrieve dashboard content for
* @returns {Promise} resourcePromise object containing the user array.
*
@@ -70,10 +70,18 @@ function dashboardResource($q, $http, umbRequestHelper) {
"dashboardApiBaseUrl",
"GetRemoteDashboardCss",
values);
},
getRemoteXmlData: function (site, url) {
//build request values with optional params
var values = { site: site, url: url };
return umbRequestHelper.resourcePromise(
$http.get(
umbRequestHelper.getApiUrl(
"dashboardApiBaseUrl",
"GetRemoteXml",
values)), "Failed to get remote xml");
}
};
}

View File

@@ -1,9 +1,9 @@
angular.module('umbraco.services')
.factory('helpService', function ($http, $q, umbRequestHelper) {
.factory('helpService', function ($http, $q, umbRequestHelper, dashboardResource) {
var helpTopics = {};
var defaultUrl = "https://our.umbraco.com/rss/help";
var tvUrl = "https://umbraco.tv/feeds/help";
var defaultUrl = "rss/help";
var tvUrl = "feeds/help";
function getCachedHelp(url){
if(helpTopics[url]){
@@ -17,16 +17,14 @@ angular.module('umbraco.services')
helpTopics[url] = data;
}
function fetchUrl(url){
function fetchUrl(site, url){
var deferred = $q.defer();
var found = getCachedHelp(url);
if(found){
deferred.resolve(found);
}else{
var proxyUrl = "dashboard/feedproxy.aspx?url=" + url;
$http.get(proxyUrl).then(function(data){
dashboardResource.getRemoteXmlData(site, url).then(function (data) {
var feed = $(data.data);
var topics = [];
@@ -41,7 +39,12 @@ angular.module('umbraco.services')
setCachedHelp(topics);
deferred.resolve(topics);
},
function (exception) {
console.error('ex from remote data', exception);
});
}
return deferred.promise;
@@ -50,12 +53,12 @@ angular.module('umbraco.services')
var service = {
findHelp: function (args) {
var url = service.getUrl(defaultUrl, args);
return fetchUrl(url);
return fetchUrl('OUR', url);
},
findVideos: function (args) {
var url = service.getUrl(tvUrl, args);
return fetchUrl(url);
return fetchUrl('TV', url);
},
getContextHelpForPage: function (section, tree, baseurl) {

View File

@@ -1,9 +1,9 @@
function startUpVideosDashboardController($scope, xmlhelper, $log, $http) {
function startUpVideosDashboardController($scope, dashboardResource) {
$scope.videos = [];
$scope.init = function(url){
var proxyUrl = "dashboard/feedproxy.aspx?url=" + url;
$http.get(proxyUrl).then(function(data){
var feed = $(data.data);
dashboardResource.getRemoteXmlData('COM', url).then(function (data) {
var feed = $(data.data);
$('item', feed).each(function (i, item) {
var video = {};
video.thumbnail = $(item).find('thumbnail').attr('url');
@@ -11,6 +11,10 @@ function startUpVideosDashboardController($scope, xmlhelper, $log, $http) {
video.link = $("guid", item).text();
$scope.videos.push(video);
});
},
function (exception) {
console.error('ex from remote data', exception);
});
};
}
@@ -24,7 +28,7 @@ function startUpDynamicContentController($timeout, $scope, dashboardResource, as
vm.loading = true;
vm.showDefault = false;
vm.startTour = startTour;
function onInit() {
@@ -93,7 +97,7 @@ function startUpDynamicContentController($timeout, $scope, dashboardResource, as
});
});
}));
//proxy remote css through the local server
assetsService.loadCss(dashboardResource.getRemoteDashboardCssUrl("content"), $scope);
dashboardResource.getRemoteDashboardContent("content").then(
@@ -117,7 +121,7 @@ function startUpDynamicContentController($timeout, $scope, dashboardResource, as
vm.showDefault = true;
});
onInit();
}

View File

@@ -1,5 +1,5 @@
<div class="row-fluid"
ng-init="init('https://umbraco.com/feeds/videos/members')"
<div class="row-fluid"
ng-init="init('feeds/videos/members')"
ng-controller="Umbraco.Dashboard.StartupVideosController">
<umb-box>
@@ -8,7 +8,7 @@
<p>Want to master Umbraco? Spend a couple of minutes learning some best practices by watching one of these videos about using Umbraco. And visit <a href="https://umbraco.tv" target="_blank">umbraco.tv</a> for even more Umbraco videos</p>
</umb-box-content>
</umb-box>
<div ng-show="videos.length">
<h4>To get you started:</h4>
<ul class="thumbnails" >