Skip to content

Commit

Permalink
Item13152: ignore ssl certificate issues
Browse files Browse the repository at this point in the history
also:
- fixed error handling on the UI
- fixed jquery dependency issues in module loader
- fixed syntax error in jsrender template
  • Loading branch information
MichaelDaum committed Dec 16, 2014
1 parent 2300f0e commit 98d0e2d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
9 changes: 5 additions & 4 deletions data/System/HarvestPlugin.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="autosave" date="1356278772" format="1.1" version="3"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1418734826" format="1.1" version="1"}%

---+!! %TOPIC%

Expand Down Expand Up @@ -35,6 +35,7 @@ have to modify your local !PatternSkin to add this tool to your site.
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 16 Dec 2014 | ignore ssl certificate problems when downloading stuff |
| 29 Sep 2014 | replaced deprecated jquery.tmpl with jsrendr |
| 03 Sep 2014 | fixed corruption of downloaded files |
| 04 Apr 2014 | flag rest handlers that don't require authentication |
Expand All @@ -43,6 +44,6 @@ have to modify your local !PatternSkin to add this tool to your site.
| Home page: | Foswiki:Extensions/%TOPIC% |
| Support: | Foswiki:Support/%TOPIC% |

%META:FILEATTACHMENT{name="HarvestPluginSnap3.png" attachment="HarvestPluginSnap3.png" attr="" comment="" date="1338285037" size="101095" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="HarvestPluginSnap2.png" attachment="HarvestPluginSnap2.png" attr="" comment="" date="1338285038" size="51494" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="HarvestPluginSnap1.png" attachment="HarvestPluginSnap1.png" attr="" comment="" date="1338285039" size="43468" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="HarvestPluginSnap3.png" attachment="HarvestPluginSnap3.png" attr="" comment="" date="1418734826" size="101095" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="HarvestPluginSnap2.png" attachment="HarvestPluginSnap2.png" attr="" comment="" date="1418734826" size="51494" user="ProjectContributor" version="1"}%
%META:FILEATTACHMENT{name="HarvestPluginSnap1.png" attachment="HarvestPluginSnap1.png" attr="" comment="" date="1418734826" size="43468" user="ProjectContributor" version="1"}%
4 changes: 2 additions & 2 deletions lib/Foswiki/Plugins/HarvestPlugin.pm
Expand Up @@ -27,8 +27,8 @@ use warnings;
use Foswiki::Func ();
use Foswiki::Contrib::JsonRpcContrib ();

our $VERSION = '1.10';
our $RELEASE = '1.10';
our $VERSION = '1.20';
our $RELEASE = '1.20';
our $SHORTDESCRIPTION = 'Download and archive resources from the web';
our $NO_PREFS_IN_TOPIC = 1;
our $baseWeb;
Expand Down
6 changes: 5 additions & 1 deletion lib/Foswiki/Plugins/HarvestPlugin/Core.pm
Expand Up @@ -430,7 +430,6 @@ sub node2record {
# a
if ($node->[0] eq 'a') {
my $src = $node->[1]{href} || '';

return if $src =~ /^#/; # weed out anchors;

my $type = $this->getMimeType($src);
Expand All @@ -447,6 +446,7 @@ sub node2record {
}
writeDebug("src=$src, type=$type");


$record = {
title => $node->[1]{title} || $node->[1]{_content} || $src,
src => $src,
Expand Down Expand Up @@ -628,6 +628,10 @@ sub client {
}
}

$ua->ssl_opts(
verify_hostname => 0, # SMELL
);

$this->{client} = $ua;
}

Expand Down
7 changes: 5 additions & 2 deletions pub/System/HarvestPlugin/harvest.uncompressed.js
Expand Up @@ -22,6 +22,7 @@ jQuery(function($) {
dataType:"json",
beforeSubmit: function() {
$.blockUI({message:"<h1>Inspecting ...</h1>"});
$("#messageContainer").hide();
},
success: function(data, msg, xhr) {
var downloadForm = $("#downloadForm"),
Expand Down Expand Up @@ -58,7 +59,7 @@ jQuery(function($) {
type:"post",
beforeSubmit: function() {
$.blockUI({message:"<h1>Downloading ...</h1>"});
$(".foswikiErrorMessage").remove();
$("#messageContainer").empty().hide();
},
success: function(data, msg, xhr) {
var url = foswiki.getPreference("SCRIPTURL")+"/view/"+foswiki.getPreference("WEB")+"/"+foswiki.getPreference("TOPIC");
Expand All @@ -69,8 +70,10 @@ jQuery(function($) {
}, 500);
},
error: function(xhr, status, error) {
var data = xhr.responseJSON;
$.unblockUI();
$("#messageContainer").append("<div class='foswikiErrorMessage'>Error: "+data.error.message+"</div>");
$("#messageContainer").append("<div class='foswikiErrorMessage'>Error: "+data.error.message+"</div>").show();
$("#downloadForm").hide();
}
});

Expand Down
7 changes: 4 additions & 3 deletions templates/harvestplugin.tmpl
Expand Up @@ -21,7 +21,7 @@
"script"
text="<script src='%PUBURLPATH%/%SYSTEMWEB%/HarvestPlugin/harvest.js'></script>"
id="HARVESTPLUGIN::JS"
requires="JQUERYPLUGIN::PNOTIFY, JQUERYPLUGIN::BLOCKUI, JQUERYPLUGIN::TOOLTIP, JQUERYPLUGIN::FORM, JQUERYPLUGIN::TMPL"
requires="JQUERYPLUGIN::PNOTIFY, JQUERYPLUGIN::BLOCKUI, JQUERYPLUGIN::TOOLTIP, JQUERYPLUGIN::FORM, JQUERYPLUGIN::RENDER"
}%<!-- -->
<!-- -->%TMPL:END%

Expand Down Expand Up @@ -95,7 +95,8 @@
</div>
</div>
</form>
<div id="#messageContainer"></div>

<div id="messageContainer"></div>
<!-- -->%TMPL:END%

%TMPL:DEF{"downloadform"}%<!-- -->
Expand Down Expand Up @@ -126,7 +127,7 @@
<script id="imageTemplate" type="text/x-jsrender">
<tr>
<td>
<img src="{{:thumbnail}}" title="{{:title}}" {{if !width || parseInt(width, 10) > 48}}width="48"{{/if}} />
<div style='overflow:hidden;width:48px;max-height:48px'><img src="{{:thumbnail}}" title="{{:title}}" width="48" /></div>
</td>
<td>
{{:shorttitle}}
Expand Down

0 comments on commit 98d0e2d

Please sign in to comment.