Replaced the inframe loading from yacy.net for donations with the

loading of this iframe from the local host. To make this more flexible,
this iframe is loaded once after startup from yacy.net.
pull/1/head
Michael Peter Christen 11 years ago
parent dfb73c9519
commit 820b896146

@ -1045,7 +1045,10 @@ content.phpbb3.dumpfile =
# search engine teaser: an about box in search results
# this is only shown, if the about.body is filled
about.headline=Please support YaCy!
about.body=<iframe src="http://yacy.net/include/donate.html" width="100%" height="90" border="0" frameborder="0" scrolling="no" hspace="0" vspace="0" name="donate"></iframe><br/><div style="padding:8px;">If you run a YaCy server, feel free to replace our donation plea with your own support message, use the <a href="/ConfigPortal.html">Portal Configuration</a> servlet.</div>
about.body=<iframe src="/env/donate.html" width="100%" height="90" border="0" frameborder="0" scrolling="no" hspace="0" vspace="0" name="donate"></iframe><br/><div style="padding:8px;">If you run a YaCy server, feel free to replace our donation plea with your own support message, use the <a href="/ConfigPortal.html">Portal Configuration</a> servlet.</div>
donation.iframesource=http://yacy.net/include/donate.html
donation.iframetarget=env/donate.html
# search heuristics
heuristic.site = false

@ -42,6 +42,8 @@ import java.util.concurrent.Semaphore;
import java.util.concurrent.ExecutionException;
import net.yacy.cora.date.GenericFormatter;
import net.yacy.cora.document.id.DigestURL;
import net.yacy.cora.federate.yacy.CacheStrategy;
import net.yacy.cora.lod.JenaTripleStore;
import net.yacy.cora.protocol.ClientIdentification;
import net.yacy.cora.protocol.RequestHeader;
@ -49,6 +51,7 @@ import net.yacy.cora.protocol.TimeoutRequest;
import net.yacy.cora.protocol.http.HTTPClient;
import net.yacy.cora.sorting.Array;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.crawler.retrieval.Response;
import net.yacy.data.Translator;
import net.yacy.gui.YaCyApp;
import net.yacy.gui.framework.Browser;
@ -263,12 +266,26 @@ public final class yacy {
mkdirIfNeseccary(htDocsPath);
//final File htTemplatePath = new File(homePath, sb.getConfig("htTemplatePath","htdocs"));
// copy the donate iframe (better to copy this once here instead of doing this in an actual iframe in the search result)
final File wwwEnvPath = new File(htDocsPath, "env");
mkdirIfNeseccary(wwwEnvPath);
final String iframesource = sb.getConfig("donation.iframesource", "");
final String iframetarget = sb.getConfig("donation.iframetarget", "");
final File iframefile = new File(htDocsPath, iframetarget);
if (!iframefile.exists()) new Thread() {
public void run() {
final ClientIdentification.Agent agent = ClientIdentification.getAgent(ClientIdentification.yacyInternetCrawlerAgentName);
Response response;
try {
response = sb.loader == null ? null : sb.loader.load(sb.loader.request(new DigestURL(iframesource), false, true), CacheStrategy.NOCACHE, Integer.MAX_VALUE, null, agent);
if (response != null) FileUtils.copy(response.getContent(), iframefile);
} catch (Throwable e) {}
}
}.start();
// create default notifier picture
//TODO: Use templates instead of copying images ...
if (!((new File(htDocsPath, "notifier.gif")).exists())) try {
Files.copy(new File(htRootPath, "env/grafics/empty.gif"),
new File(htDocsPath, "notifier.gif"));
} catch (final IOException e) {}
File notifierFile = new File(htDocsPath, "notifier.gif");
if (!notifierFile.exists()) try {Files.copy(new File(htRootPath, "env/grafics/empty.gif"), notifierFile);} catch (final IOException e) {}
final File htdocsReadme = new File(htDocsPath, "readme.txt");
if (!(htdocsReadme.exists())) try {FileUtils.copy((
@ -290,7 +307,6 @@ public final class yacy {
final File wwwDefaultPath = new File(htDocsPath, "www");
mkdirIfNeseccary(wwwDefaultPath);
final File shareDefaultPath = new File(htDocsPath, "share");
mkdirIfNeseccary(shareDefaultPath);

Loading…
Cancel
Save