Conflicts: htroot/Load_MediawikiWiki.java htroot/Load_PHPBB3.java htroot/ViewImage.javapull/39/head
commit
6e96c7341a
@ -1,19 +1,19 @@
|
||||
*.class
|
||||
*.*~
|
||||
lib/yacycore.jar
|
||||
libbuild/svnRevNr.jar
|
||||
libbuild/GitRevTask.jar
|
||||
gen/**
|
||||
/DATA
|
||||
classes/
|
||||
RELEASE/
|
||||
/yacy.pid
|
||||
.DS_Store
|
||||
lib/yacy-cora.jar
|
||||
/DATA.bkp
|
||||
/DATA.1
|
||||
/gen
|
||||
/api
|
||||
/winDATA.bkp/
|
||||
/DATA.cloud/
|
||||
yacy.log
|
||||
*.class
|
||||
*.*~
|
||||
lib/yacycore.jar
|
||||
libbuild/svnRevNr.jar
|
||||
libbuild/GitRevTask.jar
|
||||
gen/**
|
||||
/DATA
|
||||
classes/
|
||||
RELEASE/
|
||||
/yacy.pid
|
||||
.DS_Store
|
||||
/DATA.bkp
|
||||
/DATA.1
|
||||
/gen
|
||||
/api
|
||||
/winDATA.bkp/
|
||||
/DATA.cloud/
|
||||
yacy.log
|
||||
/target/
|
@ -0,0 +1,78 @@
|
||||
# Network definition file for the freeworld network
|
||||
# this is the default standard network for fresh YaCy Peers
|
||||
|
||||
# -----------------------------------------------------------------#
|
||||
# for an explanation please see the file yacy.network.readme #
|
||||
# this is a work in progress. disabled properties are not yet used #
|
||||
# -----------------------------------------------------------------#
|
||||
|
||||
# define the name of the nework
|
||||
# this nickname is also used to identifiy network requests
|
||||
network.unit.name = zeronet
|
||||
|
||||
# the visible name of the network
|
||||
network.unit.description = ZeroNet Search Index
|
||||
|
||||
# definition of the content domain: possible values are:
|
||||
# global, local, any
|
||||
network.unit.domain = any
|
||||
|
||||
# maximum search time for remote queries (milliseconds)
|
||||
network.unit.remotesearch.maxtime = 3000
|
||||
|
||||
# maximum number of results per remote query
|
||||
network.unit.remotesearch.maxcount = 10
|
||||
|
||||
# flag to switch on dht transmission
|
||||
# if the dht transmission is set to 'false' then for a global
|
||||
# query all targets are accessed
|
||||
network.unit.dht = false
|
||||
|
||||
# the number of redundant target peers:
|
||||
# redundant peers get a copy of the original dht target information
|
||||
network.unit.dhtredundancy.junior = 1
|
||||
network.unit.dhtredundancy.senior = 3
|
||||
|
||||
# the vertical partition of the dht: this applies a division
|
||||
# of the dht into 2^^<partitionExponent> fragments which get
|
||||
# all the same word-partition targets but a document-dht computed
|
||||
# fragment of all documents
|
||||
network.unit.dht.partitionExponent = 4
|
||||
|
||||
# network request burst attributes: this enables non-dht target
|
||||
# positions for certain situations. This is not a 'traditional' burst-mode
|
||||
# since it does not refer to a handshake to a single client but it refers
|
||||
# to not-handshaking in a distributed way. It means to get data without using
|
||||
# a dht transmission logic.
|
||||
|
||||
# switch to enable verification of search results
|
||||
# must be set to true in untrusted networks and can be
|
||||
# set to false in completely trusted networks
|
||||
network.unit.inspection.searchverify = false
|
||||
|
||||
# speed of remote crawl de-queueing. this is the number of milliseconds
|
||||
# as a pause between two requests
|
||||
network.unit.remotecrawl.speed = 300
|
||||
|
||||
# addresses of seed-list bootstrap locations
|
||||
network.unit.bootstrap.seedlist0 = http://search.yacy.net:7050/share/seed.txt
|
||||
|
||||
# each network may use different yacy distributions.
|
||||
# the auto-updater can access network-specific update locations
|
||||
network.unit.update.location0 = http://yacy.net/en/index.html
|
||||
network.unit.update.location0.key = MIIBtzCCASwGByqGSM44BAEwggEfAoGBAP1/U4EddRIpUt9KnC7s5Of2EbdSPO9EAMMeP4C2USZpRV1AIlH7WT2NWPq/xfW6MPbLm1Vs14E7gB00b/JmYLdrmVClpJ+f6AR7ECLCT7up1/63xhv4O1fnxqimFQ8E+4P208UewwI1VBNaFpEy9nXzrith1yrv8iIDGZ3RSAHHAhUAl2BQjxUjC8yykrmCouuEC/BYHPUCgYEA9+GghdabPd7LvKtcNrhXuXmUr7v6OuqC+VdMCz0HgmdRWVeOutRZT+ZxBxCBgLRJFnEj6EwoFhO3zwkyjMim4TwWeotUfI0o4KOuHiuzpnWRbqN/C/ohNWLx+2J6ASQ7zKTxvqhRkImog9/hWuWfBpKLZl6Ae1UlZAFMO/7PSSoDgYQAAoGAbGeo21lW3Ost86RxSrCLIHaYaaj/68jFrTMjAORGJqUTgnvYCd4T1HmD/pCYrW8sQtN4KFPbm8M/MbDWeojQpy+qVqewBilYIdNpArGknvFkw4jpDPu7aR6FRz56zcZTnBiOpqAbBXDB3o6D1w9zVDPd4LBSTLgedt0joZeVAVk=
|
||||
network.unit.update.location1 = http://kaskelix.de/update/
|
||||
network.unit.update.location1.key = MIIBtzCCASwGByqGSM44BAEwggEfAoGBAP1/U4EddRIpUt9KnC7s5Of2EbdSPO9EAMMeP4C2USZpRV1AIlH7WT2NWPq/xfW6MPbLm1Vs14E7gB00b/JmYLdrmVClpJ+f6AR7ECLCT7up1/63xhv4O1fnxqimFQ8E+4P208UewwI1VBNaFpEy9nXzrith1yrv8iIDGZ3RSAHHAhUAl2BQjxUjC8yykrmCouuEC/BYHPUCgYEA9+GghdabPd7LvKtcNrhXuXmUr7v6OuqC+VdMCz0HgmdRWVeOutRZT+ZxBxCBgLRJFnEj6EwoFhO3zwkyjMim4TwWeotUfI0o4KOuHiuzpnWRbqN/C/ohNWLx+2J6ASQ7zKTxvqhRkImog9/hWuWfBpKLZl6Ae1UlZAFMO/7PSSoDgYQAAoGAbGeo21lW3Ost86RxSrCLIHaYaaj/68jFrTMjAORGJqUTgnvYCd4T1HmD/pCYrW8sQtN4KFPbm8M/MbDWeojQpy+qVqewBilYIdNpArGknvFkw4jpDPu7aR6FRz56zcZTnBiOpqAbBXDB3o6D1w9zVDPd4LBSTLgedt0joZeVAVk=
|
||||
network.unit.update.location2 = http://latest.yacy.de/
|
||||
network.unit.update.location2.key = MIIBtzCCASwGByqGSM44BAEwggEfAoGBAP1/U4EddRIpUt9KnC7s5Of2EbdSPO9EAMMeP4C2USZpRV1AIlH7WT2NWPq/xfW6MPbLm1Vs14E7gB00b/JmYLdrmVClpJ+f6AR7ECLCT7up1/63xhv4O1fnxqimFQ8E+4P208UewwI1VBNaFpEy9nXzrith1yrv8iIDGZ3RSAHHAhUAl2BQjxUjC8yykrmCouuEC/BYHPUCgYEA9+GghdabPd7LvKtcNrhXuXmUr7v6OuqC+VdMCz0HgmdRWVeOutRZT+ZxBxCBgLRJFnEj6EwoFhO3zwkyjMim4TwWeotUfI0o4KOuHiuzpnWRbqN/C/ohNWLx+2J6ASQ7zKTxvqhRkImog9/hWuWfBpKLZl6Ae1UlZAFMO/7PSSoDgYQAAoGAbGeo21lW3Ost86RxSrCLIHaYaaj/68jFrTMjAORGJqUTgnvYCd4T1HmD/pCYrW8sQtN4KFPbm8M/MbDWeojQpy+qVqewBilYIdNpArGknvFkw4jpDPu7aR6FRz56zcZTnBiOpqAbBXDB3o6D1w9zVDPd4LBSTLgedt0joZeVAVk=
|
||||
|
||||
# properties for in-protocol response authentication:
|
||||
network.unit.protocol.control = uncontrolled
|
||||
|
||||
# white/blacklists
|
||||
network.unit.access.whitelist = 10\..*,127\..*,172\.(1[6-9]|2[0-9]|3[0-1])\..*,169\.254\..*,192\.168\..*,localhost
|
||||
network.unit.access.blacklist =
|
||||
|
||||
# greedy learning: fast information acquisition heuristic for new peers
|
||||
greedylearning.enabled = false
|
||||
greedylearning.limit.doccount = 1000
|
@ -0,0 +1,46 @@
|
||||
# Build a docker image from latest YaCy sources
|
||||
|
||||
# Base image : latest stable Debian
|
||||
FROM debian:latest
|
||||
|
||||
# Install needed packages
|
||||
RUN apt-get update && apt-get install -yq \
|
||||
default-jdk \
|
||||
default-jre-headless \
|
||||
ant \
|
||||
git
|
||||
|
||||
# set current working dir
|
||||
WORKDIR /opt
|
||||
|
||||
# clone main YaCy git repository (we need to clone git repository to generate correct version when building from source)
|
||||
RUN git clone https://github.com/yacy/yacy_search_server.git
|
||||
|
||||
# trace content of source directory
|
||||
RUN ls -la /opt/yacy_search_server
|
||||
|
||||
# set current working dir
|
||||
WORKDIR /opt/yacy_search_server
|
||||
|
||||
# Compile with ant
|
||||
RUN ant compile
|
||||
|
||||
# Set initial admin password : "docker" (encoded with custom yacy md5 function net.yacy.cora.order.Digest.encodeMD5Hex())
|
||||
RUN sed -i "/adminAccountBase64MD5=/c\adminAccountBase64MD5=MD5:e672161ffdce91be4678605f4f4e6786" /opt/yacy_search_server/defaults/yacy.init
|
||||
|
||||
# make some cleaning to reduce image size
|
||||
RUN rm -rf .git \
|
||||
&& apt-get purge -yq --auto-remove \
|
||||
default-jdk \
|
||||
ant \
|
||||
git \
|
||||
&& apt-get clean
|
||||
|
||||
# Expose port 8090
|
||||
EXPOSE 8090
|
||||
|
||||
# Set data volume : can be used to persist yacy data and configuration
|
||||
VOLUME ["/opt/yacy_search_server/DATA"]
|
||||
|
||||
# Start yacy ind debug mode (-d) to display console logs and to wait for yacy process
|
||||
CMD sh /opt/yacy_search_server/startYACY.sh -d
|
@ -0,0 +1,67 @@
|
||||
# Yacy Docker image from latest sources
|
||||
|
||||
[](https://cloud.docker.com/stack/deploy/?repo=https://github.com/luccioman/yacy_search_server/tree/docker/docker)
|
||||
|
||||
## Getting built image from Docker Hub
|
||||
|
||||
docker pull luccioman/yacy
|
||||
|
||||
Repository URL : (https://hub.docker.com/r/luccioman/yacy/)
|
||||
|
||||
## Building image yourself
|
||||
|
||||
Using yacy_search_server/docker/Dockerfile :
|
||||
|
||||
cd yacy_search_server/docker
|
||||
docker build .
|
||||
|
||||
## Default admin account
|
||||
|
||||
login : admin
|
||||
|
||||
password : docker
|
||||
|
||||
You should modify this default password with page /ConfigAccounts_p.html when exposing publicly your YaCy container.
|
||||
|
||||
## Usage
|
||||
|
||||
### First start
|
||||
|
||||
#### Most basic
|
||||
|
||||
docker run luccioman/yacy
|
||||
|
||||
YaCy web interface is then exposed at http://[container_ip]:8090.
|
||||
You can retrieve the container IP address with `docker inspect`.
|
||||
|
||||
#### Easier to handle
|
||||
|
||||
docker run --name yacy -p 8090:8090 luccioman/yacy
|
||||
|
||||
--name option allow easier management of your container (without it, docker automatically generate a new name at each startup).
|
||||
|
||||
-p option map host port and container port, allowing web interface access through the usual http://localhost:8090.
|
||||
|
||||
#### With persistent data volume
|
||||
|
||||
docker run -v [your_host/data/directory]:/opt/yacy_search_server/DATA luccioman/yacy
|
||||
|
||||
This allow your container to reuse a data directory form the host.
|
||||
|
||||
#### As background process
|
||||
|
||||
docker run -d luccioman/yacy
|
||||
|
||||
### Next starts
|
||||
|
||||
#### As attached process
|
||||
|
||||
docker start -a yacy
|
||||
|
||||
#### As background process
|
||||
|
||||
docker start yacy
|
||||
|
||||
### Shutdown
|
||||
|
||||
* Use "Shutdown" button in administration web interface
|
@ -0,0 +1,6 @@
|
||||
yacy:
|
||||
image: 'luccioman/yacy:latest'
|
||||
ports:
|
||||
- '8090:8090'
|
||||
restart: on-failure
|
||||
autoredeploy: true
|
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.yacy</groupId>
|
||||
<artifactId>SimpleSearchClient</artifactId>
|
||||
<version>1.0</version>
|
||||
<packaging>jar</packaging>
|
||||
<description>Simple search client example to query YaCy and receive search results as RSS feed</description>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
<maven.compiler.target>1.7</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -0,0 +1,52 @@
|
||||
<!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" xml:lang="en" >
|
||||
<head>
|
||||
<title>YaCy '#[clientname]#': Translation Editor</title>
|
||||
#%env/templates/metas.template%#
|
||||
|
||||
</head>
|
||||
<body id="Translator">
|
||||
|
||||
#%env/templates/header.template%#
|
||||
#%env/templates/submenuDesign.template%#
|
||||
<h2>Translation Editor</h2>
|
||||
|
||||
<p>Translate untranslated text of the user interface (current language). The modified translation file is stored in DATA/LOCALE directory.</p>
|
||||
<form id="Translation" method="post" action="Translator_p.html" enctype="multipart/form-data" accept-charset="UTF-8">
|
||||
<fieldset>
|
||||
<legend>
|
||||
<label>UI Translation</label>
|
||||
</legend>
|
||||
<p>Target Language: <b>#[targetlang]#</b></p><p class="error">#[errmsg]#</p>
|
||||
<label for="sourcefile">Source File</label>
|
||||
<select name="sourcefile" onchange="submit();">
|
||||
#{filelist}#
|
||||
<option value="#[filename]#" #(selected)#::selected="selected"#(/selected)#>#[filename]#</option>
|
||||
#{/filelist}#
|
||||
</select> <a href="#[sourcefile]#" target="sourcefilewindow" >view it</a>
|
||||
<label for="filteruntranslated">filter untranslated</label>
|
||||
<input type="checkbox" name="filteruntranslated" id="filteruntranslated" value="true" onclick="submit();" #(filter.checked)#::checked="checked"#(/filter.checked)# />
|
||||
<table>
|
||||
<tr><th style="border-bottom: solid gray; border-bottom-width: 1px;">Source Text</th>
|
||||
<th style="border-bottom: solid gray; border-bottom-width: 1px;">Translated Text ( #[targetlang]# )</th></tr>
|
||||
#{textlist}#
|
||||
<tr>
|
||||
<td style="border-bottom: solid gray; border-bottom-width: 1px;" valign="top">
|
||||
<!--<input type="text" name="sourcetxt" id="sourcetxt#[tokenid]#" size="80" disabled="true" value="#[sourcetxt]#"/>-->
|
||||
<label for="targettxt#[tokenid]#" >#[sourcetxt]#</label>
|
||||
</td>
|
||||
<td style="border-bottom: solid gray; border-bottom-width: 1px;" valign="top" nowrap>
|
||||
<input type="text" name="targettxt#[tokenid]#" id="targettxt#[tokenid]#" size="80" value="#[targettxt]#" #(filteruntranslated)#disabled::#(/filteruntranslated)#/>#(filteruntranslated)#<button name="editapproved" type="submit" value="#[tokenid]#" class="btn btn-sm"><span class="glyphicon glyphicon-pencil"/></button>::<button name="approve" type="submit" value="#[tokenid]#" class="btn btn-sm"><span class="glyphicon glyphicon-ok-sign" style="color: green"/></button>#(/filteruntranslated)#
|
||||
</td>
|
||||
</tr>
|
||||
#{/textlist}#
|
||||
</table>
|
||||
|
||||
<input type="submit" name="savetranslationlist" value="Save translation" class="btn btn-primary"/>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
#%env/templates/footer.template%#
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,160 @@
|
||||
|
||||
/**
|
||||
* Translator_p
|
||||
* Copyright 2012 by Michael Peter Christen, mc@yacy.net, Frankfurt am Main, Germany
|
||||
* First released 14.09.2011 at http://yacy.net
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program in the file lgpl21.txt
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import net.yacy.cora.protocol.RequestHeader;
|
||||
import net.yacy.cora.util.ConcurrentLog;
|
||||
import net.yacy.search.Switchboard;
|
||||
import net.yacy.search.SwitchboardConstants;
|
||||
import net.yacy.server.serverObjects;
|
||||
import net.yacy.server.serverSwitch;
|
||||
import net.yacy.server.servletProperties;
|
||||
import net.yacy.utils.translation.CreateTranslationMasters;
|
||||
|
||||
public class Translator_p {
|
||||
|
||||
public static servletProperties respond(@SuppressWarnings("unused") final RequestHeader requestHeader, @SuppressWarnings("unused") final serverObjects post, @SuppressWarnings("unused") final serverSwitch env) {
|
||||
try {
|
||||
final servletProperties prop = new servletProperties();
|
||||
final Switchboard sb = (Switchboard) env;
|
||||
|
||||
String langcfg = env.getConfig("locale.language", "default");
|
||||
prop.put("targetlang", langcfg);
|
||||
if ("default".equals(langcfg)) {
|
||||
prop.put("errmsg", "activate a different language");
|
||||
return prop;
|
||||
} else {
|
||||
prop.put("errmsg", "");
|
||||
}
|
||||
|
||||
File lngfile = new File("locales", langcfg + ".lng");
|
||||
CreateTranslationMasters ctm = new CreateTranslationMasters(/*new File ("locales","master.lng.xlf")*/);
|
||||
|
||||
File masterxlf = new File("locales", "master.lng.xlf");
|
||||
if (!masterxlf.exists()) ctm.createMasterTranslationLists(masterxlf);
|
||||
Map<String, Map<String, String>> origTrans = ctm.joinMasterTranslationLists(masterxlf, lngfile);
|
||||
final File locallngfile = ctm.getScratchFile(lngfile);
|
||||
Map<String, Map<String, String>> localTrans = ctm.loadTranslationsLists(locallngfile); // TODO: this will read file twice
|
||||
int i = 0;
|
||||
if (origTrans.size() > 0) {
|
||||
String filename = origTrans.keySet().iterator().next();
|
||||
if (post != null && post.containsKey("sourcefile")) {
|
||||
filename = post.get("sourcefile", filename);
|
||||
}
|
||||
|
||||
// prepare filename list for drop-down list
|
||||
Iterator<String> filenameit = origTrans.keySet().iterator();
|
||||
final boolean filteruntranslated = post == null ? false : post.getBoolean("filteruntranslated");
|
||||
while (filenameit.hasNext()) {
|
||||
String tmp = filenameit.next();
|
||||
if (filteruntranslated) { // filter filenames with untranslated entries
|
||||
Map<String, String> tmptrans = origTrans.get(tmp);
|
||||
boolean hasuntrans = false;
|
||||
for (String x : tmptrans.values()) {
|
||||
if (x == null || x.isEmpty()) {
|
||||
hasuntrans = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasuntrans) continue;
|
||||
}
|
||||
prop.put("filelist_" + i + "_filename", tmp);
|
||||
prop.put("filelist_" + i + "_selected", tmp.equals(filename));
|
||||
i++;
|
||||
}
|
||||
prop.put("filelist", i);
|
||||
|
||||
prop.add("sourcefile", filename);
|
||||
Map<String, String> origTextList = origTrans.get(filename);
|
||||
|
||||
i = 0;
|
||||
boolean editapproved = false; // to switch already approved translation in edit mode
|
||||
int textlistid = -1;
|
||||
if (post != null) {
|
||||
prop.put("filter.checked", filteruntranslated); // remember filter setting
|
||||
textlistid = post.getInt("approve", -1);
|
||||
if (post.containsKey("editapproved")) {
|
||||
textlistid = post.getInt("editapproved", -1);
|
||||
editapproved = true;
|
||||
}
|
||||
}
|
||||
boolean changed = false;
|
||||
for (String sourcetext : origTextList.keySet()) {
|
||||
String targettxt = origTextList.get(sourcetext);
|
||||
boolean existinlocalTrans = localTrans.containsKey(filename) && localTrans.get(filename).containsKey(sourcetext);
|
||||
|
||||
if (editapproved) existinlocalTrans |= (i == textlistid); // if edit of approved requested handle as/like existing in local to allow edit
|
||||
|
||||
if (targettxt == null || targettxt.isEmpty() || existinlocalTrans) {
|
||||
prop.put("textlist_" + i + "_filteruntranslated", true);
|
||||
} else if (filteruntranslated) {
|
||||
continue;
|
||||
}
|
||||
// handle (modified) input text
|
||||
if (i == textlistid && post != null) {
|
||||
if (editapproved) { // switch already translated in edit mode by copying to local translation
|
||||
// not saved here as not yet modified/approved
|
||||
ctm.addTranslation(localTrans, filename, sourcetext, targettxt);
|
||||
} else {
|
||||
String t = post.get("targettxt" + Integer.toString(textlistid));
|
||||
// correct common partial html markup (part of text identification for words also used as html parameter)
|
||||
if (!t.isEmpty()) {
|
||||
if (sourcetext.startsWith(">") && !t.startsWith(">")) t=">"+t;
|
||||
if (sourcetext.endsWith("<") && !t.endsWith("<")) t=t+"<";
|
||||
}
|
||||
targettxt = t;
|
||||
// add changes to original (for display) and local (for save)
|
||||
origTextList.put(sourcetext, targettxt);
|
||||
changed = ctm.addTranslation(localTrans, filename, sourcetext, targettxt);
|
||||
}
|
||||
}
|
||||
prop.putHTML("textlist_" + i + "_sourcetxt", sourcetext);
|
||||
prop.putHTML("textlist_" + i + "_targettxt", targettxt);
|
||||
prop.put("textlist_" + i + "_tokenid", Integer.toString(i));
|
||||
prop.put("textlist_" + i + "_filteruntranslated_tokenid", Integer.toString(i));
|
||||
i++;
|
||||
}
|
||||
if (post != null && post.containsKey("savetranslationlist")) {
|
||||
changed = true;
|
||||
}
|
||||
if (changed) {
|
||||
ctm.saveAsLngFile(langcfg, locallngfile, localTrans);
|
||||
// adhoc translate this file
|
||||
// 1. get/calc the path
|
||||
final String htRootPath = env.getConfig(SwitchboardConstants.HTROOT_PATH, SwitchboardConstants.HTROOT_PATH_DEFAULT);
|
||||
final File sourceDir = new File(env.getAppPath(), htRootPath);
|
||||
final File destDir = new File(env.getDataPath("locale.translated_html", "DATA/LOCALE/htroot"), locallngfile.getName().substring(0, locallngfile.getName().length() - 4));// cut .lng
|
||||
// get absolute file by adding relative filename from translationlist
|
||||
final File sourceFile = new File(sourceDir, filename);
|
||||
final File destFile = new File(destDir, filename);
|
||||
ctm.translateFile(sourceFile, destFile, origTextList); // do the translation
|
||||
}
|
||||
}
|
||||
prop.put("textlist", i);
|
||||
return prop;
|
||||
} catch (IOException ex) {
|
||||
ConcurrentLog.logException(ex);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<h1>File Share</h1>
|
||||
#(mode)#
|
||||
<!-- mode = 0 - display an upload form -->
|
||||
<p>This form can be used to share a (index) file</p>
|
||||
<form id="push" action="share.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
|
||||
<dl>
|
||||
<dt>Files to process:<dt>
|
||||
<dt> <dt><dd> </dd>
|
||||
<dd>
|
||||
<dl>
|
||||
<dt>data=</dt>
|
||||
<dd><input name="data" type="file"></dd>
|
||||
</dl>
|
||||
</dd>
|
||||
</dl>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
::
|
||||
<!-- mode 1 - display the push results -->
|
||||
Result for the recently submitted file(s). You can also submit the same form using the servlet share.json to get push confirmations in json format.
|
||||
<dl>
|
||||
<dt>successall</dt><dd>#(successall)#false::true#(/successall)#</dd>
|
||||
<dt>countsuccess</dt><dd>#[countsuccess]#</dd>
|
||||
<dt>countfail</dt><dd>#[countfail]#</dd>
|
||||
</dl>
|
||||
<table border="1">
|
||||
<tr><th>Item</th><th>URL</th><th>Success</th><th>Message</th></tr>
|
||||
<tr>
|
||||
<td>#[item]#</td>
|
||||
<td><a href="#[url]#">#[url]#</a></td>
|
||||
<td>#(success)#fail::ok#(/success)#</td>
|
||||
<td>#(success)##[message]#::<a href="#[message]#" target="_blank">#[message]#</a>#(/success)#</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
If you want to push again files, use this form to pre-define a number of upload forms:
|
||||
<form id="push" action="share.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
|
||||
<input name="c" type="text" value="1" size="4" maxlength="8"><input type="submit" value="Submit">
|
||||
</form>
|
||||
</p>
|
||||
#(/mode)#
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,106 @@
|
||||
/**
|
||||
* share
|
||||
* Copyright 2016 by Michael Peter Christen, mc@yacy.net, Frankfurt a. M., Germany
|
||||
* First released 24.02.2016 at http://yacy.net
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program in the file lgpl21.txt
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
|
||||
import net.yacy.yacy;
|
||||
import net.yacy.cora.document.encoding.UTF8;
|
||||
import net.yacy.cora.order.Base64Order;
|
||||
import net.yacy.cora.protocol.RequestHeader;
|
||||
import net.yacy.cora.util.ConcurrentLog;
|
||||
import net.yacy.search.Switchboard;
|
||||
import net.yacy.search.index.Fulltext;
|
||||
import net.yacy.server.serverObjects;
|
||||
import net.yacy.server.serverSwitch;
|
||||
|
||||
public class share {
|
||||
|
||||
/**
|
||||
* Servlet to share any kind of binary to this peer.
|
||||
* That mean you can upload 'things'. While this is the generic view,
|
||||
* it will operate in the beginning only for full solr export files.
|
||||
* The servlet will decide if it wants that kind of data and if the sender is valid,
|
||||
* i.e. if the sender is within the own network and known.
|
||||
* Index dumps which are uploaded are placed to a specific folder
|
||||
* where they can be downloaded again by peers.
|
||||
* An optional operation is the immediate indexing of the shared index.
|
||||
* @param header
|
||||
* @param post
|
||||
* @param env
|
||||
* @return
|
||||
*/
|
||||
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
|
||||
final serverObjects prop = new serverObjects();
|
||||
|
||||
// display mode: this only helps to display a nice input form for test cases
|
||||
int c = post == null ? 1 : post.getInt("c", 0);
|
||||
if (c > 0) {
|
||||
prop.put("mode", 0);
|
||||
return prop;
|
||||
}
|
||||
|
||||
// push mode: this does a document upload
|
||||
prop.put("mode", 1);
|
||||
prop.put("success", 0);
|
||||
if (post == null) return prop;
|
||||
|
||||
// check file name
|
||||
String filename = post.get("data", "");
|
||||
if (!filename.startsWith(Fulltext.yacy_dump_prefix) || !filename.endsWith(".xml.gz")) return prop;
|
||||
|
||||
// check data
|
||||
String dataString = post.get("data$file", "");
|
||||
if (dataString.length() == 0) return prop;
|
||||
byte[] data;
|
||||
if (filename.endsWith(".base64")) {
|
||||
data = Base64Order.standardCoder.decode(dataString);
|
||||
filename = filename.substring(0, filename.length() - 7);
|
||||
} else {
|
||||
data = UTF8.getBytes(dataString);
|
||||
}
|
||||
if (data == null || data.length == 0) return prop;
|
||||
|
||||
// modify the file name; ignore and replace the used transaction token
|
||||
int ttp = filename.indexOf("_t");
|
||||
if (ttp < 0) return prop;
|
||||
if (filename.charAt(ttp + 3) != '.') return prop;
|
||||
filename = filename.substring(0, ttp) + "_ts" + filename.substring(ttp + 3); // transaction token: 's' as 'shared'.
|
||||
|
||||
// process the data
|
||||
File tmpFile = new File(yacy.shareDumpDefaultPath, filename + ".tmp");
|
||||
File finalFile = new File(yacy.shareDumpDefaultPath, filename);
|
||||
try {
|
||||
Files.copy(new ByteArrayInputStream(data), tmpFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
tmpFile.renameTo(finalFile);
|
||||
} catch (IOException e) {
|
||||
ConcurrentLog.logException(e);
|
||||
return prop;
|
||||
}
|
||||
|
||||
prop.put("success", 1);
|
||||
return prop;
|
||||
}
|
||||
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
<div class="SubMenu">
|
||||
<h3>System Administration</h3>
|
||||
<ul class="SubMenu">
|
||||
<li><a href="Tables_p.html" class="MenuItemLink #(authorized)#lock::unlock#(/authorized)#">Viewer and administration for database tables</a></li>
|
||||
<li><a href="PerformanceQueues_p.html" class="MenuItemLink #(authorized)#lock::unlock#(/authorized)#">Performance Settings of Busy Queues</a></li>
|
||||
<li><a href="Settings_p.html" class="MenuItemLink #(authorized)#lock::unlock#(/authorized)#">Advanced Settings</a></li>
|
||||
<li><a href="PerformanceQueues_p.html" class="MenuItemLink #(authorized)#lock::unlock#(/authorized)#">Performance Settings of Busy Queues</a></li>
|
||||
<li><a href="Tables_p.html" class="MenuItemLink #(authorized)#lock::unlock#(/authorized)#">Viewer and administration for database tables</a></li>
|
||||
<li><a href="ConfigProperties_p.html" class="MenuItemLink #(authorized)#lock::unlock#(/authorized)#">Advanced Properties</a></li>
|
||||
</ul>
|
||||
</div>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,45 +0,0 @@
|
||||
list of library-dependencies:
|
||||
|
||||
* jetty (these files were taken from the solr 3.6.0 example)
|
||||
jetty-6.1.26-patched-JETTY-1340.jar
|
||||
jetty-util-6.1.26-patched-JETTY-1340.jar
|
||||
servlet-api-2.5-20081211.jar
|
||||
|
||||
* apache-solr-solrj-3.4.0.jar depends on:
|
||||
commons-codec-1.4.jar
|
||||
commons-httpclient-3.1.jar
|
||||
commons-io-1.4.jar
|
||||
geronimo-stax-api_1.0_spec-1.0.1.jar
|
||||
jcl-over-slf4j-1.6.1.jar
|
||||
slf4j-api-1.6.1.jar
|
||||
wstx-asl-3.2.7.jar
|
||||
|
||||
* apache-solr-core-3.6.0.jar depends on
|
||||
commons-codec-1.6.jar
|
||||
commons-fileupload-1.2.1.jar
|
||||
commons-httpclient-3.1.jar
|
||||
commons-io-2.1.jar
|
||||
commons-lang-2.6.jar
|
||||
geronimo-stax-api_1.0_spec-1.0.1.jar
|
||||
guava-r05.jar
|
||||
httpclient-4.3.6.jar
|
||||
httpcore-4.3.3.jar
|
||||
jcl-over-slf4j-1.6.1.jar
|
||||
log4j-over-slf4j-1.6.1.jar
|
||||
lucene-analyzers-3.6.0.jar
|
||||
lucene-core-3.6.0.jar
|
||||
lucene-highlighter-3.6.0.jar
|
||||
lucene-phonetic-3.6.0.jar
|
||||
lucene-spatial-3.6.0.jar
|
||||
lucene-spellchecker-3.6.0.jar
|
||||
slf4j-api-1.6.1.jar
|
||||
slf4j-jdk14-1.6.1.jar
|
||||
wstx-asl-3.2.7.jar
|
||||
|
||||
* pdfbox-1.8.5.jar depends on:
|
||||
(see http://pdfbox.apache.org/dependencies.html)
|
||||
fontbox-1.8.5.jar
|
||||
jempbox-1.8.5.jar
|
||||
bcprov-jdk15-1.44.jar
|
||||
bcmail-jdk15-1.44.jar
|
||||
icu4j.jar
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue