autoupdate: add 'regex' alias for 'find'

This commit is contained in:
Richard Kuhnt
2018-09-18 19:30:18 +02:00
parent 76fdb6b74c
commit 3453487ed6
2 changed files with 13 additions and 1 deletions
+8 -1
View File
@@ -168,6 +168,13 @@ function get_hash_for_app([String] $app, $config, [String] $version, [String] $u
$jsonpath = $config.jsonpath
$hashmode = 'json'
}
$regex = ''
if ($config.find) {
$regex = $config.find
}
if ($config.regex) {
$regex = $config.regex
}
if (!$hashfile_url -and $url -match "(?:downloads\.)?sourceforge.net\/projects?\/(?<project>[^\/]+)\/(?:files\/)?(?<file>.*)") {
$hashmode = 'sourceforge'
@@ -178,7 +185,7 @@ function get_hash_for_app([String] $app, $config, [String] $version, [String] $u
switch ($hashmode) {
'extract' {
$hash = find_hash_in_textfile $hashfile_url $basename $config.find
$hash = find_hash_in_textfile $hashfile_url $basename $regex
}
'json' {
$hash = find_hash_in_json $hashfile_url $basename $jsonpath
+5
View File
@@ -26,6 +26,11 @@
"additionalProperties": false,
"properties": {
"find": {
"format": "regex",
"type": "string",
"description": "Same as 'regex'"
},
"regex": {
"format": "regex",
"type": "string"
},