mirror of
https://codeberg.org/Amm0ni4/bypass-all-shortlinks-debloated.git
synced 2024-12-28 07:53:01 +05:00
use match rules instead of include rules whenever possible
This commit is contained in:
parent
1ecd379f76
commit
788abf64fd
2 changed files with 544 additions and 537 deletions
|
@ -22,9 +22,16 @@ def extract_regex_from_js(js_code):
|
|||
|
||||
def regex_to_include_line(regex):
|
||||
#regex = regex.strip("/")
|
||||
regex = '(' + regex + ')'
|
||||
include_line = "// @include /^(https?:\/\/)(.+)?" + regex + "(\/.*)/"
|
||||
include_line = include_line.replace( "\.*)(\/.*)/", "\.*)/" ) #clean excess in the regex
|
||||
|
||||
#Use @include for more complex regex
|
||||
if '|' in regex:
|
||||
regex = '(' + regex + ')'
|
||||
include_line = "// @include /^(https?:\/\/)(.+)?" + regex + "(\/.*)/"
|
||||
include_line = include_line.replace( "\.*)(\/.*)/", "\.*)/" ) #clean excess in the regex
|
||||
|
||||
#Use @match for simpler regex
|
||||
else:
|
||||
include_line = '// @match *://*.' + regex + '/*'
|
||||
|
||||
return include_line
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue