Skip to content

Commit

Permalink
feat: added new parameter: protocol (close #6)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnnyTheTank committed Jan 20, 2016
1 parent 02326ea commit e0bb9c7
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ Every **apiNG plugin** expects an array of **requests** as html attribute.
| **`path`** | `http://blog.hackerearth.com/feed` | | RSS feed url | no |
| **`items`** | `15` | | Items per request (`0`-`n`) | yes |
| **`parseImage`** | `false` | `true` | Use `true` for try to parse image from content. This parameter only works for `social` model | yes |
| **`protocol`** | `https` | | Use `https` or `http` to force the protocol. Leave it blank to for dynamic choose | yes |

Sample requests:
* `[{'path':'http://blog.hackerearth.com/feed'}, {'path':'http://www.magazin.dtv.de/index.php/feed/'}]`
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"authors": [
"Jonathan Hornung <jonathan.hornung@gmail.com>"
],
"version": "0.7.6",
"version": "0.7.7",
"description": "RSS plugin for apiNG",
"main": "dist/aping-plugin-rss.min.js",
"moduleType": [],
Expand Down
2 changes: 1 addition & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<aping
template-url="template.html"
model="social"
aping-rss="[{'path':'https://github.com/JohnnyTheTank.atom'}]">
aping-rss="[{'path':'https://github.com/JohnnyTheTank.atom', 'protocol':'https'}]">
</aping>
<hr>
<aping
Expand Down
14 changes: 12 additions & 2 deletions dist/aping-plugin-rss.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
@name: aping-plugin-rss
@version: 0.7.6 (11-01-2016)
@version: 0.7.7 (20-01-2016)
@author: Jonathan Hornung
@url: https://github.com/JohnnyTheTank/apiNG-plugin-rss#readme
@license: MIT
Expand Down Expand Up @@ -57,6 +57,12 @@ var jjtApingRss = angular.module("jtt_aping_rss", [])
requestObject.q = request.path;
}

if(request.protocol === "http" || request.protocol === "https") {
requestObject.protocol = request.protocol+"://";
} else {
requestObject.protocol = "//";
}

// -1 is "no explicit limit". same for NaN value
if(requestObject.num < 0 || isNaN(requestObject.num)) {
requestObject.num = undefined;
Expand All @@ -77,8 +83,12 @@ var jjtApingRss = angular.module("jtt_aping_rss", [])
jjtApingRss.factory('rssFactory', ['$http', function ($http) {
var rssFactory = {};
rssFactory.getData = function (_requestObject) {

var url = _requestObject.protocol + 'ajax.googleapis.com/ajax/services/feed/load';
_requestObject.protocol = undefined;

return $http.jsonp(
'//ajax.googleapis.com/ajax/services/feed/load',
url,
{
method: 'GET',
params: _requestObject
Expand Down
4 changes: 2 additions & 2 deletions dist/aping-plugin-rss.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aping-plugin-rss",
"version": "0.7.6",
"version": "0.7.7",
"description": "RSS plugin for apiNG",
"main": "dist/aping-plugin-rss.min.js",
"scripts": {
Expand Down
6 changes: 6 additions & 0 deletions src/aping-rss-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ var jjtApingRss = angular.module("jtt_aping_rss", [])
requestObject.q = request.path;
}

if(request.protocol === "http" || request.protocol === "https") {
requestObject.protocol = request.protocol+"://";
} else {
requestObject.protocol = "//";
}

// -1 is "no explicit limit". same for NaN value
if(requestObject.num < 0 || isNaN(requestObject.num)) {
requestObject.num = undefined;
Expand Down
6 changes: 5 additions & 1 deletion src/aping-rss-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
jjtApingRss.factory('rssFactory', ['$http', function ($http) {
var rssFactory = {};
rssFactory.getData = function (_requestObject) {

var url = _requestObject.protocol + 'ajax.googleapis.com/ajax/services/feed/load';
_requestObject.protocol = undefined;

return $http.jsonp(
'//ajax.googleapis.com/ajax/services/feed/load',
url,
{
method: 'GET',
params: _requestObject
Expand Down

0 comments on commit e0bb9c7

Please sign in to comment.