From 9cb31c17cd82dabc36d945c0e6e89799b9c313d0 Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Fri, 18 Dec 2020 00:14:24 +0000 Subject: [PATCH] Make search case-insensitive by default and add a checkbox for toggling --- irclog.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/irclog.py b/irclog.py index dda402a..e968d14 100644 --- a/irclog.py +++ b/irclog.py @@ -1050,6 +1050,8 @@ class WebServer: '
', '', '', + '
', + ' Case-sensitive', '
', ]) @@ -1072,8 +1074,11 @@ class WebServer: # So instead, use a wrapper script in Bash which sets the niceness and memory limit. cmd = [ os.path.join('.', os.path.dirname(__file__), 'nicegrep'), str(self.config['web']['search']['nice']), str(self.config['web']['search']['maxMemory']), - '--fixed-strings', '--recursive', '--with-filename', '--null', '--line-number', request.query['q'] + '--fixed-strings', '--recursive', '--with-filename', '--null', '--line-number', ] + if 'casesensitive' not in request.query: + cmd.append('--ignore-case') + cmd.append(request.query['q']) for path in itertools.chain((request.match_info['path'],), self._paths[request.match_info['path']][3]): cmd.append(os.path.join(self.config['storage']['path'], path, ''))