from the forum discussion in http://forum.yacy-websuche.de/viewtopic.php?p=12612#p12612 The feature will provide two basic entities: - you can integrate image links which point to your yacy installation anywhere in the web. the image can be loaded with <img src="http://<yourpeer>:<yourport>/cytag.png?icon=invisible&nick=<yournickname_or_community_id>&tag=<anything>"> This will place a invisible 1-pixel image. If you change the icon=invisible to icon=redpill, you will see a red pill Use this, to track your activity in the web. - you can view your tracks at http://localhost:8080/Tracks.html - There is a public api to your tracks at http://localhost:8080/api/tracks_p.json which needs authentication git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5581 6c8d7289-2bf4-0310-a012-ef5d649a1542pull/1/head
parent
03a16f6c20
commit
01b97ef3f8
@ -1,49 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry excluding="env/|htdocsdefault/|proxymsg/|yacy/|env/|yacy/user/|yacy/user/|yacy/ui/|processing/domaingraph/applet/|processing/domaingraph/|api/|api/bookmarks/posts/|api/bookmarks/|api/util/|api/bookmarks/xbel/|api/bookmarks/tags/" kind="src" path="htroot"/>
|
||||
<classpathentry excluding="user/|user/|ui/" kind="src" path="htroot/yacy"/>
|
||||
<classpathentry kind="src" path="htroot/env"/>
|
||||
<classpathentry kind="src" path="source"/>
|
||||
<classpathentry kind="src" path="htroot/yacy/ui"/>
|
||||
<classpathentry excluding="bookmarks/posts/|bookmarks/|util/|bookmarks/xbel/|bookmarks/tags/" kind="src" path="htroot/api"/>
|
||||
<classpathentry kind="src" path="htroot/api/bookmarks/posts"/>
|
||||
<classpathentry excluding="posts/|xbel/|tags/" kind="src" path="htroot/api/bookmarks"/>
|
||||
<classpathentry kind="src" path="htroot/api/util"/>
|
||||
<classpathentry kind="src" path="htroot/api/bookmarks/xbel"/>
|
||||
<classpathentry kind="src" path="htroot/api/bookmarks/tags"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="lib/tar.jar"/>
|
||||
<classpathentry kind="lib" path="libx/bzip2.jar"/>
|
||||
<classpathentry kind="lib" path="libx/commons-discovery.jar"/>
|
||||
<classpathentry kind="lib" path="libx/commons-jxpath-1.1.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jakarta-oro-2.0.7.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jaxrpc.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jmimemagic-0.1.0.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jrpm-head.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jrpm-SNAPSHOT.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jsch-0.1.21.jar"/>
|
||||
<classpathentry kind="lib" path="libx/log4j-1.2.9.jar"/>
|
||||
<classpathentry kind="lib" path="libx/odf_utils_05_11_29.jar"/>
|
||||
<classpathentry kind="lib" path="libx/sbbi-upnplib-1.0.3.jar"/>
|
||||
<classpathentry kind="lib" path="libx/tm-extractors-1.0.jar"/>
|
||||
<classpathentry kind="lib" path="libx/wsdl4j.jar"/>
|
||||
<classpathentry kind="lib" path="libx/xerces.jar"/>
|
||||
<classpathentry kind="lib" path="libx/poi-3.0-alpha2-20060616.jar"/>
|
||||
<classpathentry kind="lib" path="libx/poi-scratchpad-3.0-alpha2-20060616.jar"/>
|
||||
<classpathentry kind="lib" path="libx/inetlib.jar"/>
|
||||
<classpathentry kind="lib" path="libx/gnumail.jar"/>
|
||||
<classpathentry kind="lib" path="libx/activation.jar"/>
|
||||
<classpathentry kind="lib" path="libx/webcat-0.1-swf.jar"/>
|
||||
<classpathentry kind="lib" path="libx/J7Zip-modified.jar"/>
|
||||
<classpathentry kind="lib" path="libx/PDFBox-0.7.3.jar"/>
|
||||
<classpathentry kind="lib" path="libx/FontBox-0.1.0-dev.jar"/>
|
||||
<classpathentry kind="lib" path="libx/bcprov-jdk14-139.jar"/>
|
||||
<classpathentry kind="lib" path="libx/bcmail-jdk14-139.jar"/>
|
||||
<classpathentry kind="lib" path="libx/commons-codec-1.3.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-io-1.4.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-fileupload-1.2.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/servlet-api.jar"/>
|
||||
<classpathentry kind="output" path="gen"/>
|
||||
</classpath>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry excluding="env/|htdocsdefault/|proxymsg/|yacy/|env/|yacy/user/|yacy/user/|yacy/ui/|processing/domaingraph/applet/|processing/domaingraph/|api/|api/bookmarks/posts/|api/bookmarks/|api/util/|api/bookmarks/xbel/|api/bookmarks/tags/" kind="src" path="htroot"/>
|
||||
<classpathentry excluding="user/|user/|ui/" kind="src" path="htroot/yacy"/>
|
||||
<classpathentry kind="src" path="htroot/env"/>
|
||||
<classpathentry kind="src" path="source"/>
|
||||
<classpathentry kind="src" path="htroot/yacy/ui"/>
|
||||
<classpathentry excluding="bookmarks/posts/|bookmarks/|util/|bookmarks/xbel/|bookmarks/tags/" kind="src" path="htroot/api"/>
|
||||
<classpathentry kind="src" path="htroot/api/bookmarks/posts"/>
|
||||
<classpathentry excluding="posts/|xbel/|tags/" kind="src" path="htroot/api/bookmarks"/>
|
||||
<classpathentry kind="src" path="htroot/api/util"/>
|
||||
<classpathentry kind="src" path="htroot/api/bookmarks/xbel"/>
|
||||
<classpathentry kind="src" path="htroot/api/bookmarks/tags"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="lib/tar.jar"/>
|
||||
<classpathentry kind="lib" path="libx/bzip2.jar"/>
|
||||
<classpathentry kind="lib" path="libx/commons-discovery.jar"/>
|
||||
<classpathentry kind="lib" path="libx/commons-jxpath-1.1.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jakarta-oro-2.0.7.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jaxrpc.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jmimemagic-0.1.0.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jrpm-head.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jrpm-SNAPSHOT.jar"/>
|
||||
<classpathentry kind="lib" path="libx/jsch-0.1.21.jar"/>
|
||||
<classpathentry kind="lib" path="libx/log4j-1.2.9.jar"/>
|
||||
<classpathentry kind="lib" path="libx/odf_utils_05_11_29.jar"/>
|
||||
<classpathentry kind="lib" path="libx/sbbi-upnplib-1.0.3.jar"/>
|
||||
<classpathentry kind="lib" path="libx/tm-extractors-1.0.jar"/>
|
||||
<classpathentry kind="lib" path="libx/wsdl4j.jar"/>
|
||||
<classpathentry kind="lib" path="libx/xerces.jar"/>
|
||||
<classpathentry kind="lib" path="libx/poi-3.0-alpha2-20060616.jar"/>
|
||||
<classpathentry kind="lib" path="libx/poi-scratchpad-3.0-alpha2-20060616.jar"/>
|
||||
<classpathentry kind="lib" path="libx/inetlib.jar"/>
|
||||
<classpathentry kind="lib" path="libx/gnumail.jar"/>
|
||||
<classpathentry kind="lib" path="libx/activation.jar"/>
|
||||
<classpathentry kind="lib" path="libx/webcat-0.1-swf.jar"/>
|
||||
<classpathentry kind="lib" path="libx/J7Zip-modified.jar"/>
|
||||
<classpathentry kind="lib" path="libx/PDFBox-0.7.3.jar"/>
|
||||
<classpathentry kind="lib" path="libx/FontBox-0.1.0-dev.jar"/>
|
||||
<classpathentry kind="lib" path="libx/bcprov-jdk14-139.jar"/>
|
||||
<classpathentry kind="lib" path="libx/bcmail-jdk14-139.jar"/>
|
||||
<classpathentry kind="lib" path="libx/commons-codec-1.3.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-httpclient-3.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-logging-1.1.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-io-1.4.jar"/>
|
||||
<classpathentry kind="lib" path="lib/commons-fileupload-1.2.1.jar"/>
|
||||
<classpathentry kind="lib" path="lib/servlet-api.jar"/>
|
||||
<classpathentry kind="output" path="gen"/>
|
||||
</classpath>
|
||||
|
@ -0,0 +1,67 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>CyTag Trails</title>
|
||||
#%env/templates/metas.template%#
|
||||
<script language="Javascript">
|
||||
function search() {
|
||||
var xmlHttpReq = false;
|
||||
var self = this;
|
||||
if (window.XMLHttpRequest) { // Mozilla/Safari
|
||||
self.xmlHttpReq = new XMLHttpRequest();
|
||||
}
|
||||
else if (window.ActiveXObject) { // IE
|
||||
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
self.xmlHttpReq.open('GET', "api/trail_p.json", true);
|
||||
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
self.xmlHttpReq.onreadystatechange = function() {
|
||||
if (self.xmlHttpReq.readyState == 4) {
|
||||
updatepage(self.xmlHttpReq.responseText);
|
||||
}
|
||||
}
|
||||
self.xmlHttpReq.send(null);
|
||||
}
|
||||
|
||||
function updatepage(str) {
|
||||
var rsp = eval("("+str+")");
|
||||
var trails = rsp.trails;
|
||||
|
||||
var html = "";
|
||||
|
||||
var item;
|
||||
html += "<table class=\"networkTable\" border=\"0\" cellpadding=\"2\" cellspacing=\"1\">";
|
||||
html += "<tr class=\"TableHeader\" valign=\"bottom\">";
|
||||
html += "<td>time</td>";
|
||||
html += "<td>trail</td>";
|
||||
html += "<td>nick</td>";
|
||||
html += "<td>tag</td>";
|
||||
html += "<td>icon</td>";
|
||||
html += "<td>ip</td>";
|
||||
html += "<td>agent</td></tr>";
|
||||
for (var i = 0; i < trails.length; i++) {
|
||||
item = trails[i];
|
||||
if (item.time == null) break;
|
||||
html += "<tr class=\"TableCellLight\"><td>"+ item.time + "</td>";
|
||||
html += "<td>" + item.trail + "</td>";
|
||||
html += "<td>" + item.nick + "</td>";
|
||||
html += "<td>" + item.tag + "</td>";
|
||||
html += "<td>" + item.icon + "</td>";
|
||||
html += "<td>" + item.ip + "</td>";
|
||||
html += "<td>" + item.agent + "</td></tr>";
|
||||
}
|
||||
html += "</table>";
|
||||
document.getElementById("trails").innerHTML = html;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
#%env/templates/header.template%#
|
||||
<script type="text/javascript">
|
||||
search();
|
||||
</script>
|
||||
<div id="trails"></div>
|
||||
|
||||
#%env/templates/footer.template%#
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,13 @@
|
||||
import de.anomic.http.httpRequestHeader;
|
||||
import de.anomic.server.serverObjects;
|
||||
import de.anomic.server.serverSwitch;
|
||||
import de.anomic.server.servletProperties;
|
||||
|
||||
//dummy class
|
||||
public class Trails {
|
||||
|
||||
public static servletProperties respond(final httpRequestHeader requestHeader, final serverObjects post, final serverSwitch<?> env) {
|
||||
final servletProperties prop = new servletProperties();
|
||||
return prop;
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
// trail_p.java
|
||||
// (C) 2009 by Michael Peter Christen; mc@yacy.net, Frankfurt a. M., Germany
|
||||
// first published 06.02.2009 on http://www.yacy.net
|
||||
//
|
||||
// This is a part of YaCy.
|
||||
// The Software shall be used for Good, not Evil.
|
||||
//
|
||||
// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $
|
||||
// $LastChangedRevision: 1986 $
|
||||
// $LastChangedBy: orbiter $
|
||||
//
|
||||
// LICENSE
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
import de.anomic.http.httpRequestHeader;
|
||||
import de.anomic.plasma.plasmaSwitchboard;
|
||||
import de.anomic.server.serverObjects;
|
||||
import de.anomic.server.serverSwitch;
|
||||
|
||||
public class trail_p {
|
||||
|
||||
public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch<?> env) {
|
||||
final plasmaSwitchboard sb = (plasmaSwitchboard) env;
|
||||
final serverObjects prop = new serverObjects();
|
||||
|
||||
int c = 0;
|
||||
for (String t: sb.trail) {
|
||||
prop.put("trails_" + c++ + "_trail", t); // don't put in putHTML or putXML in, this is wrong!
|
||||
}
|
||||
prop.put("trails", c);
|
||||
return prop;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"trails": [
|
||||
#{trails}#
|
||||
#[trail]#,
|
||||
#{/trails}#
|
||||
{}
|
||||
]
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
// cytag.java
|
||||
// (C) 2009 by Michael Peter Christen; mc@yacy.net, Frankfurt a. M., Germany
|
||||
// first published 06.02.2009 on http://www.yacy.net
|
||||
//
|
||||
// This is a part of YaCy.
|
||||
// The Software shall be used for Good, not Evil.
|
||||
//
|
||||
// $LastChangedDate: 2006-04-02 22:40:07 +0200 (So, 02 Apr 2006) $
|
||||
// $LastChangedRevision: 1986 $
|
||||
// $LastChangedBy: orbiter $
|
||||
//
|
||||
// LICENSE
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
import java.awt.Image;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
import de.anomic.htmlFilter.htmlFilterCharacterCoding;
|
||||
import de.anomic.http.httpRequestHeader;
|
||||
import de.anomic.kelondro.order.DateFormatter;
|
||||
import de.anomic.kelondro.util.FileUtils;
|
||||
import de.anomic.plasma.plasmaSwitchboard;
|
||||
import de.anomic.server.serverObjects;
|
||||
import de.anomic.server.serverSwitch;
|
||||
import de.anomic.ymage.ymageImageParser;
|
||||
|
||||
public class cytag {
|
||||
|
||||
public static Image respond(final httpRequestHeader header, final serverObjects post, final serverSwitch<?> env) {
|
||||
|
||||
final plasmaSwitchboard sb = (plasmaSwitchboard)env;
|
||||
|
||||
// harvest request information
|
||||
StringBuilder connect = new StringBuilder();
|
||||
connect.append('{');
|
||||
addJSON(connect, "time", DateFormatter.formatShortMilliSecond(new Date()));
|
||||
addJSON(connect, "trail", header.get("Referer", ""));
|
||||
addJSON(connect, "nick", (post == null) ? "" : post.get("nick", ""));
|
||||
addJSON(connect, "tag", (post == null) ? "" : post.get("tag", ""));
|
||||
addJSON(connect, "icon", (post == null) ? "" : post.get("icon", ""));
|
||||
addJSON(connect, "ip", header.get("CLIENTIP", ""));
|
||||
addJSON(connect, "agent", header.get("User-Agent", ""));
|
||||
connect.append('}');
|
||||
|
||||
sb.trail.add(connect.toString());
|
||||
//Log.logInfo("CYTAG", "catched trail - " + connect.toString());
|
||||
|
||||
String defaultimage = "redpillmini.png";
|
||||
if (post != null && post.get("icon", "").equals("invisible")) defaultimage = "invisible.png";
|
||||
File iconfile = new File(sb.getRootPath(), "/htroot/env/grafics/" + defaultimage);
|
||||
|
||||
byte[] imgb = null;
|
||||
try {
|
||||
imgb = FileUtils.read(iconfile);
|
||||
} catch (final IOException e) {
|
||||
return null;
|
||||
}
|
||||
if (imgb == null) return null;
|
||||
|
||||
// read image
|
||||
final Image image = ymageImageParser.parse("cytag.png", imgb);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
private static final void addJSON(StringBuilder sb, String k, String v) {
|
||||
if (sb.length() > 2) sb.append(',');
|
||||
sb.append('\"');
|
||||
sb.append(k);
|
||||
sb.append("\":\"");
|
||||
sb.append(htmlFilterCharacterCoding.unicode2xml(v, true));
|
||||
sb.append('\"');
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 143 B |
Before Width: | Height: | Size: 423 B |
After Width: | Height: | Size: 482 B |
Loading…
Reference in new issue