From 325235c6881a3f91f2b13855c580678e606a71ee Mon Sep 17 00:00:00 2001 From: ccd0 Date: Mon, 11 Jan 2016 14:17:55 -0800 Subject: [PATCH] Support URL-safe base64 MD5 in sauce as %sMD5. #717 --- src/General/Config.coffee | 6 +++--- src/General/Settings/Sauce.html | 3 ++- src/Images/Sauce.coffee | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/General/Config.coffee b/src/General/Config.coffee index be53fa68b..44706d8b6 100644 --- a/src/General/Config.coffee +++ b/src/General/Config.coffee @@ -721,11 +721,11 @@ Config = # uploaders: #//imgur.com/upload?url=%URL;types:gif,jpg,png,pdf;text:Upload to imgur # "View Same" in archives: - #https://archive.4plebs.org/_/search/image/%MD5/;text:View same on 4plebs - #https://archive.4plebs.org/%board/search/image/%MD5/;text:View same on 4plebs /%board/;boards:<%= + #https://archive.4plebs.org/_/search/image/%sMD5/;text:View same on 4plebs + #https://archive.4plebs.org/%board/search/image/%sMD5/;text:View same on 4plebs /%board/;boards:<%= grunt.file.readJSON('src/Archive/archives.json').filter(function(x) {return x.uid === 3})[0].files.join(',') %> - #https://rbt.asia/%board/?task=search2&search_media_hash=%MD5;text:View same on RBT /%board/;boards:<%= + #https://rbt.asia/%board/image/%sMD5;text:View same on RBT /%board/;boards:<%= grunt.file.readJSON('src/Archive/archives.json').filter(function(x) {return x.uid === 8})[0].files.join(',') %> """ diff --git a/src/General/Settings/Sauce.html b/src/General/Settings/Sauce.html index bf13382a3..b52a9f31b 100644 --- a/src/General/Settings/Sauce.html +++ b/src/General/Settings/Sauce.html @@ -8,7 +8,8 @@
  • %TURL: Thumbnail URL.
  • %URL: Full image URL.
  • %IMG: Full image URL for GIF, JPG, and PNG; thumbnail URL for other types.
  • -
  • %MD5: MD5 hash.
  • +
  • %MD5: MD5 hash in base64.
  • +
  • %sMD5: MD5 hash in base64 using - and _.
  • %name: Original file name.
  • %board: Current board.
  • %%, %semi: Literal % and ;.
  • diff --git a/src/Images/Sauce.coffee b/src/Images/Sauce.coffee index 68c7f4669..0e2cf12a3 100644 --- a/src/Images/Sauce.coffee +++ b/src/Images/Sauce.coffee @@ -42,12 +42,13 @@ Sauce = skip = false for key of parts - parts[key] = parts[key].replace /%(T?URL|IMG|MD5|board|name|%|semi)/g, (parameter) -> + parts[key] = parts[key].replace /%(T?URL|IMG|s?MD5|board|name|%|semi)/g, (parameter) -> type = { '%TURL': post.file.thumbURL '%URL': post.file.url '%IMG': if ext in ['gif', 'jpg', 'png'] then post.file.url else post.file.thumbURL '%MD5': post.file.MD5 + '%sMD5': post.file.MD5.replace /[+/=]/g, (c) -> {'+': '-', '/': '_', '=': ''}[c] '%board': post.board.ID '%name': post.file.name '%%': '%'