koniu / recoll-webui

web interface for recoll desktop search
266 stars 55 forks source link

How to open files directly from browser? #54

Closed joelewing closed 7 years ago

joelewing commented 7 years ago

I am able to open the folder location from the recoll webui interface, but I am not able to open the local file. Instead, the dialog gives me the option to download the file, which isn't what I want. I've tried this in both Chrome (using the extension) and Firefox (using the user.js) file. Am I missing something?

nabsiddiqui commented 7 years ago

This is happening to me also in Firefox. With the chrome extension, however, it seems to work.

ghost commented 7 years ago

Have you had a look at the "Opening files via local links" in ther README ? https://github.com/koniu/recoll-webui/blob/master/README.rst

nabsiddiqui commented 7 years ago

Yeah I did. I realized that clicking the title was actually sending me to the download link. I don't seem to have an "Open" link. Most of my files are pdfs if that matters.

When I click on the folders location underneath the title , the "folder view" opens correctly. Is there a way to change the title to be the file name and location?

joelewing commented 7 years ago

My experience has been the same.

ghost commented 7 years ago

The change is due to this commit: https://github.com/koniu/recoll-webui/commit/95e93e4db2ff23d43a896c51d2a2c6a2f9766e09

I'm not too sure why the possibility to open a file was removed, esp. because the author seems to have missed the fact that paths could be translated.

You can restore the old behaviour by changing:

 <div class="search-result-title" id="r{{d['sha']}}" title="{{d['abstract']}}">
  <a href="download/{{number-1}}?{{query_string}}">{{d['label']}}</a>
  </div>

Into:

<div class="search-result-title" id="r{{d['sha']}}" title="{{d['abstract']}}"><a href="{{url}}">{{d['label']}}</a></div> 

Koniu does not seem to be around, so I'm not too sure what good reason for this to have been changed without making it a setting. Maybe no browser actually supports this anymore ?

koniu commented 7 years ago

The 'Open' link is now restored and you can select the default action (when clicking title) in Settings. Tested on Firefox using the method described in the README. If the workarounds changed for other browsers please let me know or, better yet, make a pull request :)

nabsiddiqui commented 7 years ago

Thanks works great in Firefox. I didn't want to start another issue for this but is there a way to display the full filename with location in the results page like recoll does by default?

koniu commented 7 years ago

is there a way to display the full filename with location in the results page

There's currently no way to configure search output (see #25 ) but you can change views/result.tpl to your liking. For example, to replace the link to the file's directory with its full (local) path, change: <a href="{{os.path.dirname(url)}}">{{urllabel}}</a> to <a href="{{url)}}">{{url}}</a>.

nabsiddiqui commented 7 years ago

That would probably work for my purposes, but unfortunately I get a syntax error with the substitution you provided.

File "/home/nabeel/Dropbox/Miscellaneous/scripts/recoll-webui-master/bottle.py", line 744, in _handle
    return route.call(**args)
  File "/home/nabeel/Dropbox/Miscellaneous/scripts/recoll-webui-master/bottle.py", line 1479, in wrapper
    rv = callback(*a, **ka)
  File "/home/nabeel/Dropbox/Miscellaneous/scripts/recoll-webui-master/bottle.py", line 2854, in wrapper
    return template(tpl_name, **tplvars)
  File "/home/nabeel/Dropbox/Miscellaneous/scripts/recoll-webui-master/bottle.py", line 2829, in template
    return TEMPLATES[tpl].render(kwargs)
  File "/home/nabeel/Dropbox/Miscellaneous/scripts/recoll-webui-master/bottle.py", line 2803, in render
    self.execute(stdout, kwargs)
  File "/home/nabeel/Dropbox/Miscellaneous/scripts/recoll-webui-master/bottle.py", line 2791, in execute
    eval(self.co, env)
  File "/home/nabeel/Dropbox/Miscellaneous/scripts/recoll-webui-master/views/results.tpl", line 19, in <module>
    %include result d=res[i], i=i, query=query, config=config, query_string=query_string, hasrclextract=hasrclextract
  File "/home/nabeel/Dropbox/Miscellaneous/scripts/recoll-webui-master/bottle.py", line 2781, in subtemplate
    return self.cache[_name].execute(_stdout, kwargs)
  File "/home/nabeel/Dropbox/Miscellaneous/scripts/recoll-webui-master/bottle.py", line 2791, in execute
    eval(self.co, env)
  File "/home/nabeel/Dropbox/Miscellaneous/scripts/recoll-webui-master/bottle.py", line 185, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "/home/nabeel/Dropbox/Miscellaneous/scripts/recoll-webui-master/views/result.tpl", line 31
    _printlist([u' <a href="', _escape(url)), u'">', _escape(url), u'</a>\n'\
ghost commented 7 years ago

Nabeel Siddiqui writes:

That would probably work for my purposes, but unfortunately I get a syntax error with the substitution you provided.

Typo, there is an excess additional parenthesis leftover from editing the previous line:

<a href="{{url)}}">{{url}}</a>

Should be

<a href="{{url}}">{{url}}</a>
nabsiddiqui commented 7 years ago

Thank you works great!!!