Author: xor
Date: 2008-11-16 14:12:26 +0000 (Sun, 16 Nov 2008)
New Revision: 23641
Modified:
trunk/plugins/WoT/introduction/IntroductionPuzzle.java
trunk/plugins/WoT/ui/web/IntroduceIdentityPage.java
Log:
Display puzzles by including their image data directly in the img tag as
base64. Cool, eh?
Modified: trunk/plugins/WoT/introduction/IntroductionPuzzle.java
===================================================================
--- trunk/plugins/WoT/introduction/IntroductionPuzzle.java 2008-11-16
10:41:06 UTC (rev 23640)
+++ trunk/plugins/WoT/introduction/IntroductionPuzzle.java 2008-11-16
14:12:26 UTC (rev 23641)
@@ -39,9 +39,9 @@
import com.db4o.ObjectContainer;
import com.db4o.ObjectSet;
import com.db4o.query.Query;
-import com.sun.org.apache.xerces.internal.impl.dv.util.Base64;
import freenet.keys.FreenetURI;
+import freenet.support.Base64;
import freenet.support.Logger;
public final class IntroductionPuzzle {
@@ -265,6 +265,10 @@
return mData;
}
+ public String getDataBase64() {
+ return Base64.encode(mData, true);
+ }
+
/**
* Get the solution of the puzzle. Null if the puzzle was received and
not locally generated.
*/
@@ -380,7 +384,7 @@
puzzleTag.appendChild(validUntilTag);
Element dataTag = xmlDoc.createElement("Data");
- dataTag.setAttribute("value", Base64.encode(mData));
+ dataTag.setAttribute("value", Base64.encode(mData, true));
puzzleTag.appendChild(dataTag);
rootElement.appendChild(puzzleTag);
Modified: trunk/plugins/WoT/ui/web/IntroduceIdentityPage.java
===================================================================
--- trunk/plugins/WoT/ui/web/IntroduceIdentityPage.java 2008-11-16 10:41:06 UTC
(rev 23640)
+++ trunk/plugins/WoT/ui/web/IntroduceIdentityPage.java 2008-11-16 14:12:26 UTC
(rev 23641)
@@ -76,7 +76,7 @@
row = puzzleTable.addChild("tr");
HTMLNode cell = row.addChild("td");
- cell.addChild("img", new String[] {"src"}, new
String[] {SELF_URI + "/puzzle?id=" + p.getID()});
+ cell.addChild("img", new String[] {"src"}, new
String[] {"data:image/jpeg;base64," + p.getDataBase64()}); /* FIXME: use
SELF_URI + "puzzle?id=" instead */
cell.addChild("input", new String[] { "type",
"name", "size"}, new String[] { "text", "solution" + p.getID(), "10" });
}
} else {
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs