mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2025-10-30 14:17:54 +00:00
Compare commits
1 Commits
3321b969a4
...
feature/me
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
472cd58a8c |
@@ -224,6 +224,11 @@ function get_hash_for_app([String] $app, $config, [String] $version, [String] $u
|
||||
$hashmode = 'sourceforge'
|
||||
}
|
||||
|
||||
if (!$hashfile_url -and $url -match "^.*mediafire.com\/\w+\/(?<random>\w+)\/(?<filename>.*)\/file(?:#\/.*)?$") {
|
||||
$hashmode = 'mediafire'
|
||||
}
|
||||
|
||||
debug $hashmode
|
||||
switch ($hashmode) {
|
||||
'extract' {
|
||||
$hash = find_hash_in_textfile $hashfile_url $substitutions $regex
|
||||
@@ -251,6 +256,11 @@ function get_hash_for_app([String] $app, $config, [String] $version, [String] $u
|
||||
$hashfile_url = (strip_filename (strip_fragment "https://sourceforge.net/projects/$($matches['project'])/files/$($matches['file'])")).TrimEnd('/')
|
||||
$hash = find_hash_in_textfile $hashfile_url $substitutions '"$basename":.*?"sha1":\s"([a-fA-F0-9]{40})"'
|
||||
}
|
||||
'mediafire' {
|
||||
if ((Invoke-RestMethod -Uri $url) -match 'aria-label="Download file"\s+href="(?<url>[^"]+)"') {
|
||||
$url = $Matches.url
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($hash) {
|
||||
|
||||
@@ -917,6 +917,13 @@ function handle_special_urls($url)
|
||||
# Reshapes the URL to avoid redirections
|
||||
$url = "https://downloads.sourceforge.net/project/$($matches['project'])/$($matches['file'])"
|
||||
}
|
||||
|
||||
# MediaFire.com
|
||||
if ($url -match "^.*mediafire.com\/\w+\/(?<random>\w+)\/(?<filename>.*)\/file(?:#\/.*)?$") {
|
||||
if ((Invoke-RestMethod -Uri $url) -match 'aria-label="Download file"\s+href="(?<url>[^"]+)"') {
|
||||
$url = $Matches.url
|
||||
}
|
||||
}
|
||||
return $url
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user