Fix http/https confusion on my end

This commit is contained in:
2019-07-05 11:03:49 +02:00
parent 83b0c01f8e
commit df833c7159
2 changed files with 16 additions and 10 deletions

View File

@ -13,6 +13,7 @@ sub parse_arguments {
"wowpath=s" => \$toret{'wowpath'},
"baseuri=s" => \$toret{'baseuri'},
"config=s" => \$toret{'config'},
"test" => \$toret{'test'},
);
return %toret;
}
@ -53,7 +54,7 @@ sub check_config {
sub sane_defaults {
my $in = shift;
$in->{'baseuri'} = 'http://www.curseforge.com' unless(exists($in->{'baseuri'}));
$in->{'baseuri'} = 'https://www.curseforge.com' unless(exists($in->{'baseuri'}));
$in->{'config'} = $ENV{'HOME'}.'/.pcurse/config.json' unless(exists($in->{'config'}));
$in->{'addons'} = $ENV{'HOME'}.'/.pcurse/addons.json' unless(exists($in->{'addons'}));
return $in;
@ -76,12 +77,15 @@ sub load_addons {
$json = $json->{'addons'};
my $jsonreff = ref $json;
foreach my $addon(@{$json}) {
$addon->{'uri'} =~ s/^http\:\/\/www.curseforge\.com//;
$addon->{'uri'} =~ s/^http(s|)\:\/\/www.curseforge\.com//;
}
return $json;
}
} else {
my $json = &import_json($addons_file);
foreach my $addon(@{$json}) {
$addon->{'uri'} =~ s/^http(s|)\:\/\/www.curseforge\.com//;
}
return $json;
}
return 0;