Merge pull request #398 from rachmadaniHaryono/feature/new-tab

new: user: open in new tab
This commit is contained in:
Mischievous Meerkat 2019-06-07 06:58:07 +05:30 committed by GitHub
commit a4909355d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -57,6 +57,7 @@ Following are available os env config available for bukuserver.
| URL_RENDER_MODE | url render mode | `full` or `netloc` [default: `full`] |
| DB_FILE | full path to db file | path string [default: standard path for buku] |
| DISABLE_FAVICON | disable favicon | boolean [default: `false`] |
| OPEN_IN_NEW_TAB | url link open in new tab | boolean [default: `false`] |
Note: `BUKUSERVER_` is the common prefix.

View File

@ -100,7 +100,10 @@ class BookmarkModelView(BaseModelView):
res = netloc_tmpl.format(
'http://www.google.com/s2/favicons?domain=', netloc)
title = model.title if model.title else '<EMPTY TITLE>'
if is_scheme_valid:
open_in_new_tab = current_app.config.get('BUKUSERVER_OPEN_IN_NEW_TAB', False)
if is_scheme_valid and open_in_new_tab:
res += '<a href="{0.url}" target="_blank">{1}</a>'.format(model, title)
elif is_scheme_valid and not open_in_new_tab:
res += '<a href="{0.url}">{1}</a>'.format(model, title)
else:
res += title