diff --git a/.classpath b/.classpath index c8ae866ba..c57d83ee4 100644 --- a/.classpath +++ b/.classpath @@ -1,49 +1,49 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build.xml b/build.xml index a2b3aa334..1de828c63 100644 --- a/build.xml +++ b/build.xml @@ -184,7 +184,7 @@ - + diff --git a/htroot/ConfigBasic.html b/htroot/ConfigBasic.html index 1f1a403fb..c60f32407 100644 --- a/htroot/ConfigBasic.html +++ b/htroot/ConfigBasic.html @@ -25,7 +25,7 @@ Your YaCy Peer needs some basic information to operate properly

-
+
  1. ok Select a language for the interface:
    @@ -53,7 +53,8 @@ - + + diff --git a/htroot/Trails.html b/htroot/Trails.html new file mode 100644 index 000000000..befd1a2c1 --- /dev/null +++ b/htroot/Trails.html @@ -0,0 +1,67 @@ + + + + CyTag Trails + #%env/templates/metas.template%# + + + +#%env/templates/header.template%# + +
    + +#%env/templates/footer.template%# + + \ No newline at end of file diff --git a/htroot/Trails.java b/htroot/Trails.java new file mode 100644 index 000000000..07ffc728b --- /dev/null +++ b/htroot/Trails.java @@ -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; + } +} diff --git a/htroot/api/trail_p.java b/htroot/api/trail_p.java new file mode 100644 index 000000000..f56f880a3 --- /dev/null +++ b/htroot/api/trail_p.java @@ -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; + } + +} diff --git a/htroot/api/trail_p.json b/htroot/api/trail_p.json new file mode 100644 index 000000000..fbb1d9c32 --- /dev/null +++ b/htroot/api/trail_p.json @@ -0,0 +1,8 @@ +{ + "trails": [ +#{trails}# +#[trail]#, +#{/trails}# +{} + ] +} \ No newline at end of file diff --git a/htroot/cytag.java b/htroot/cytag.java new file mode 100644 index 000000000..ce382b8b4 --- /dev/null +++ b/htroot/cytag.java @@ -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('\"'); + } +} diff --git a/htroot/env/grafics/invisible.png b/htroot/env/grafics/invisible.png new file mode 100644 index 000000000..91433addf Binary files /dev/null and b/htroot/env/grafics/invisible.png differ diff --git a/htroot/env/grafics/mcemailh.gif b/htroot/env/grafics/mcemailh.gif deleted file mode 100644 index 7f63a4c41..000000000 Binary files a/htroot/env/grafics/mcemailh.gif and /dev/null differ diff --git a/htroot/env/grafics/redpillmini.png b/htroot/env/grafics/redpillmini.png new file mode 100644 index 000000000..7cb8bf2f5 Binary files /dev/null and b/htroot/env/grafics/redpillmini.png differ diff --git a/htroot/index.html b/htroot/index.html index 4f0fde45f..3eb32cb9c 100644 --- a/htroot/index.html +++ b/htroot/index.html @@ -133,5 +133,6 @@ :: #%env/templates/embeddedfooter.template%# #(/display)# + diff --git a/source/de/anomic/http/httpHeader.java b/source/de/anomic/http/httpHeader.java index 760801674..bf32cb33a 100644 --- a/source/de/anomic/http/httpHeader.java +++ b/source/de/anomic/http/httpHeader.java @@ -277,14 +277,14 @@ public class httpHeader extends TreeMap implements Map disallowZippedContentEncoding = new HashSet(Arrays.asList(new String[]{ - ".gz", ".tgz", ".jpg", ".jpeg", ".gif", ".zip", ".rar", ".bz2", ".lha", ".jar", ".rpm", ".arc", ".arj", ".wmv", ".png", ".ico", ".bmp" + ".gz", ".tgz", ".jpg", ".jpeg", ".png", ".mp3", ".mov", ".avi", ".gif", ".zip", ".rar", ".bz2", ".lha", ".jar", ".rpm", ".arc", ".arj", ".wmv", ".ico", ".bmp" })); // static objects diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.java index de7ddc91c..5c5cd74f7 100644 --- a/source/de/anomic/http/httpdFileHandler.java +++ b/source/de/anomic/http/httpdFileHandler.java @@ -787,6 +787,7 @@ public final class httpdFileHandler { templatePatterns.put(servletProperties.PEER_STAT_VERSION, switchboard.getConfig("version", "")); templatePatterns.put(servletProperties.PEER_STAT_UPTIME, ((System.currentTimeMillis() - serverCore.startupTime) / 1000) / 60); // uptime in minutes templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTNAME, switchboard.getConfig("peerName", "anomic")); + templatePatterns.putHTML(servletProperties.PEER_STAT_CLIENTID, ((plasmaSwitchboard) switchboard).webIndex.seedDB.myID()); templatePatterns.put(servletProperties.PEER_STAT_MYTIME, DateFormatter.formatShortSecond()); //System.out.println("respond props: " + ((tp == null) ? "null" : tp.toString())); // debug } catch (final InvocationTargetException e) { @@ -972,8 +973,8 @@ public final class httpdFileHandler { // write the file to the client targetDate = new Date(targetFile.lastModified()); final long contentLength = (zipContent)?-1:targetFile.length()-rangeStartOffset; - final String contentEncoding = (zipContent)?"gzip":null; - final String transferEncoding = (!httpVersion.equals(httpHeader.HTTP_VERSION_1_1))?null:(zipContent)?"chunked":null; + final String contentEncoding = (zipContent) ? "gzip" : null; + final String transferEncoding = (httpVersion.equals(httpHeader.HTTP_VERSION_1_1) && zipContent) ? "chunked" : null; if (!httpVersion.equals(httpHeader.HTTP_VERSION_1_1) && zipContent) forceConnectionClose(conProp); httpd.sendRespondHeader(conProp, out, httpVersion, statusCode, null, mimeType, contentLength, targetDate, null, header, contentEncoding, transferEncoding, nocache); @@ -1026,7 +1027,7 @@ public final class httpdFileHandler { } catch (final Exception e) { try { // doing some errorhandling ... - e.printStackTrace(); + //e.printStackTrace(); int httpStatusCode = 400; final String httpStatusText = null; final StringBuilder errorMessage = new StringBuilder(2000); diff --git a/source/de/anomic/kelondro/order/DateFormatter.java b/source/de/anomic/kelondro/order/DateFormatter.java index a221ee771..9703f0627 100644 --- a/source/de/anomic/kelondro/order/DateFormatter.java +++ b/source/de/anomic/kelondro/order/DateFormatter.java @@ -323,6 +323,11 @@ public final class DateFormatter { return format(FORMAT_SHORT_SECOND, date); } + public static String formatShortMilliSecond(final Date date) { + return format(FORMAT_SHORT_MILSEC, date); + } + + /** * Identical to {@link #formatShortDay(Date, TimeZone)}, but for short second format. */ diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java index 21d92f57a..bed911d32 100644 --- a/source/de/anomic/plasma/plasmaSwitchboard.java +++ b/source/de/anomic/plasma/plasmaSwitchboard.java @@ -236,6 +236,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch networkWhitelist, networkBlacklist; + public List trail; public serverProcessor indexingDocumentProcessor; public serverProcessor indexingCondensementProcessor; @@ -270,6 +271,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch(); + // load values from configs this.plasmaPath = getConfigPath(plasmaSwitchboardConstants.PLASMA_PATH, plasmaSwitchboardConstants.PLASMA_PATH_DEFAULT); this.log.logConfig("Plasma DB Path: " + this.plasmaPath.toString()); diff --git a/source/de/anomic/server/serverCore.java b/source/de/anomic/server/serverCore.java index f1a0f50db..97aa21365 100644 --- a/source/de/anomic/server/serverCore.java +++ b/source/de/anomic/server/serverCore.java @@ -645,9 +645,6 @@ public final class serverCore extends serverAbstractBusyThread implements server this.in.close(); this.out.close(); - // sleep for a while - //try {Thread.sleep(500);} catch (final InterruptedException e) {} - // close everything this.controlSocket.close(); diff --git a/source/de/anomic/server/servletProperties.java b/source/de/anomic/server/servletProperties.java index 62ea97f5d..3fdbb8d01 100644 --- a/source/de/anomic/server/servletProperties.java +++ b/source/de/anomic/server/servletProperties.java @@ -34,6 +34,7 @@ public class servletProperties extends serverObjects { public static final String PEER_STAT_UPTIME = "uptime"; public static final String PEER_STAT_MYTIME = "mytime"; public static final String PEER_STAT_CLIENTNAME = "clientname"; + public static final String PEER_STAT_CLIENTID = "clientid"; private String prefix="";