diff options
Diffstat (limited to 'src/web')
-rw-r--r-- | src/web/templates/edit_bookmark.html | 2 | ||||
-rw-r--r-- | src/web/views/bookmark.py | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/web/templates/edit_bookmark.html b/src/web/templates/edit_bookmark.html index da7c0eaa..efd9d775 100644 --- a/src/web/templates/edit_bookmark.html +++ b/src/web/templates/edit_bookmark.html @@ -66,7 +66,7 @@ <div class="row"> <div class="col-md-6 pull-right"> <p>{{ _('You can add a bookmark with a bookmarklet. Drag the following button to your browser bookmarks.') }}</p> - {{ _('<a class="btn btn-default" href="%(bookmarklet)s" rel="bookmark">Bookmark this page using Newspipe</a>', bookmarklet='javascript:window.location="%s?href="+encodeURIComponent(document.location)' % url_for('bookmark.bookmarklet', _external=True)) }} + {{ _('<a class="btn btn-default" href="%(bookmarklet)s" rel="bookmark">Bookmark this page using Newspipe</a>', bookmarklet='javascript:window.location="%s?href="+encodeURIComponent(document.location)+"&title="+document.title' % url_for('bookmark.bookmarklet', _external=True)) }} </div> <div class="col-md-6"> <form action="{{ url_for('bookmark.import_pinboard') }}" method="post" id="formImportPinboard" enctype="multipart/form-data"> diff --git a/src/web/views/bookmark.py b/src/web/views/bookmark.py index e7a4181e..31026405 100644 --- a/src/web/views/bookmark.py +++ b/src/web/views/bookmark.py @@ -203,6 +203,10 @@ def bookmarklet(): if not href: flash(gettext("Couldn't add bookmark: url missing."), "error") raise BadRequest("url is missing") + title = (request.args if request.method == 'GET' else request.form)\ + .get('title', None) + if not title: + title = href bookmark_exists = bookmark_contr.read(**{'href': href}).all() if bookmark_exists: @@ -213,7 +217,7 @@ def bookmarklet(): bookmark_attr = {'href': href, 'description': '', - 'title': href, + 'title': title, 'shared': False, 'to_read': True} |