##// END OF EJS Templates
Search duplicates for file, not hash
neko259 -
r1827:bbdc98ff default
parent child Browse files
Show More
@@ -90,10 +90,10 b' class AbstractViewer:'
90 return '<div class="image">'\
90 return '<div class="image">'\
91 '{}'\
91 '{}'\
92 '<div class="image-metadata"><a href="{}" download >{}, {}</a>'\
92 '<div class="image-metadata"><a href="{}" download >{}, {}</a>'\
93 ' <a class="file-menu" href="#" data-type="{}" data-search-url="{}" data-hash="{}">πŸ” </a></div>'\
93 ' <a class="file-menu" href="#" data-type="{}" data-search-url="{}" data-filename="{}">πŸ” </a></div>'\
94 '</div>'.format(self.get_format_view(), self.file.url,
94 '</div>'.format(self.get_format_view(), self.file.url,
95 self.file_type, filesizeformat(self.file.size),
95 self.file_type, filesizeformat(self.file.size),
96 self.file_type, search_url, self.hash)
96 self.file_type, search_url, self.file.name)
97
97
98 def get_format_view(self):
98 def get_format_view(self):
99 image_name = PLAIN_FILE_FORMATS.get(self.file_type, self.file_type)
99 image_name = PLAIN_FILE_FORMATS.get(self.file_type, self.file_type)
@@ -165,7 +165,7 b' function addContextMenu() {'
165 duplicates: {
165 duplicates: {
166 name: gettext('Duplicates search'),
166 name: gettext('Duplicates search'),
167 callback: function(key, opts) {
167 callback: function(key, opts) {
168 window.location = '/feed/?image_hash=' + $trigger.data('hash');
168 window.location = '/feed/?image=' + $trigger.data('filename');
169 }
169 }
170 },
170 },
171 google: {
171 google: {
@@ -79,21 +79,21 b' class IpFilter(FeedFilter):'
79 return 'IP: {}'.format(ip)
79 return 'IP: {}'.format(ip)
80
80
81
81
82 class HashFilter(FeedFilter):
82 class ImageFilter(FeedFilter):
83 @staticmethod
83 @staticmethod
84 def get_filtered_posts(request, posts):
84 def get_filtered_posts(request, posts):
85 filtered_posts = posts
85 filtered_posts = posts
86
86
87 image_hash = request.GET.get('image_hash', None)
87 image = request.GET.get('image', None)
88 if image_hash:
88 if image:
89 filtered_posts = filtered_posts.filter(attachments__hash=image_hash)
89 filtered_posts = filtered_posts.filter(attachments__file=image)
90 return filtered_posts
90 return filtered_posts
91
91
92 @staticmethod
92 @staticmethod
93 def get_query(request):
93 def get_query(request):
94 image_hash = request.GET.get('image_hash', None)
94 image = request.GET.get('image', None)
95 if image_hash:
95 if image:
96 return 'Hash: {}'.format(image_hash)
96 return 'File: {}'.format(image)
97
97
98
98
99 class FeedView(PostMixin, BaseBoardView):
99 class FeedView(PostMixin, BaseBoardView):
@@ -101,7 +101,7 b' class FeedView(PostMixin, BaseBoardView)'
101 TripcodeFilter,
101 TripcodeFilter,
102 FavoritesFilter,
102 FavoritesFilter,
103 IpFilter,
103 IpFilter,
104 HashFilter,
104 ImageFilter,
105 )
105 )
106
106
107 def get(self, request):
107 def get(self, request):
General Comments 0
You need to be logged in to leave comments. Login now