mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
add/allow to create a bookmark of result viewed via urlproxy.
For this on the header of the viewed result a "add bookmark" button is available (for authenticated users). Currently the bookmark is added to a (virtual) bookmark folder "/proxy" w/o any additional tags etc.
This commit is contained in:
parent
7bf2bcf504
commit
f153cc4b5d
|
@ -2,8 +2,11 @@
|
||||||
<html>
|
<html>
|
||||||
<body style="background:white">
|
<body style="background:white">
|
||||||
<div align="center" style="width:98%; padding:5px; background:white; border-bottom: medium solid lightgrey;">
|
<div align="center" style="width:98%; padding:5px; background:white; border-bottom: medium solid lightgrey;">
|
||||||
<form method="get" target="_parent" action="#[proxyurl]#">
|
<form method="get" action="?url=#[proxyurl]#">
|
||||||
<input type="submit" value="YaCy stop proxy"> #(httpsAlertMsg)#:: - <span style='color:red'>(Warning: secure target viewed over normal http)</span>#(/httpsAlertMsg)#
|
<button name="exit" onclick="parent.location='#[proxyurl]#'">YaCy stop proxy</button>
|
||||||
|
#(httpsAlertMsg)#:: - <span style='color:red'>(Warning: secure target viewed over normal http)</span>#(/httpsAlertMsg)#
|
||||||
|
#(allowbookmark)#::<input type="hidden" name="bookmark" value="#[proxyurl]#">
|
||||||
|
<input type="submit" name="addbookmark" value="add bookmark">#(/allowbookmark)#
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import net.yacy.cora.protocol.RequestHeader;
|
import net.yacy.cora.protocol.RequestHeader;
|
||||||
|
import net.yacy.data.BookmarksDB.Bookmark;
|
||||||
import net.yacy.search.Switchboard;
|
import net.yacy.search.Switchboard;
|
||||||
import net.yacy.server.serverObjects;
|
import net.yacy.server.serverObjects;
|
||||||
import net.yacy.server.serverSwitch;
|
import net.yacy.server.serverSwitch;
|
||||||
|
@ -13,10 +14,24 @@ public class urlproxyheader {
|
||||||
final serverObjects prop = new serverObjects();
|
final serverObjects prop = new serverObjects();
|
||||||
final Switchboard sb = (Switchboard) env;
|
final Switchboard sb = (Switchboard) env;
|
||||||
|
|
||||||
final String proxyurlstr = post.get("url",""); // the url of remote page currently viewed
|
String proxyurlstr = post.get("url",""); // the url of remote page currently viewed
|
||||||
prop.put("proxyurl", proxyurlstr);
|
boolean hasRights = sb.verifyAuthentication(requestHeader);
|
||||||
|
prop.put("allowbookmark", hasRights);
|
||||||
|
|
||||||
if (proxyurlstr.startsWith("https")) {
|
if (post.containsKey("addbookmark")) {
|
||||||
|
proxyurlstr = post.get("bookmark");
|
||||||
|
Bookmark bmk = sb.bookmarksDB.createorgetBookmark(proxyurlstr, null);
|
||||||
|
if (bmk != null) {
|
||||||
|
bmk.setPublic(false);
|
||||||
|
bmk.addTag("/proxy"); // add to bookmark folder
|
||||||
|
sb.bookmarksDB.saveBookmark(bmk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
prop.put("proxyurl", proxyurlstr);
|
||||||
|
prop.put("allowbookmark_proxyurl", proxyurlstr);
|
||||||
|
|
||||||
|
if (proxyurlstr.startsWith("https") && !requestHeader.getScheme().equalsIgnoreCase("https")) {
|
||||||
prop.put("httpsAlertMsg", "1");
|
prop.put("httpsAlertMsg", "1");
|
||||||
} else {
|
} else {
|
||||||
prop.put("httpsAlertMsg", "0");
|
prop.put("httpsAlertMsg", "0");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user