new: user: open in new tab

This commit is contained in:
rachmadaniHaryono 2019-06-07 07:52:55 +08:00
parent 9aee5652f0
commit 087184771b
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