update plugin with recent features

auto-update
Zlatin Balevsky 2021-10-12 14:39:48 +01:00
parent 7673222672
commit 8ffa81d223
No known key found for this signature in database
GPG Key ID: A72832072D525E41
4 changed files with 825 additions and 746 deletions

File diff suppressed because it is too large Load Diff

View File

@ -37,6 +37,7 @@ public class ConfigurationServlet extends HttpServlet {
INPUT_VALIDATORS.put("outbound.quantity", new PositiveIntegerValidator("Outbound tunnel quantity"));
INPUT_VALIDATORS.put("defaultFeedUpdateInterval", new PositiveIntegerValidator("Feed update frequency (minutes)"));
INPUT_VALIDATORS.put("defaultFeedItemsToKeep", new IntegerValidator("Number of items to keep on disk (-1 means unlimited)"));
INPUT_VALIDATORS.put("hashingCores", new PositiveIntegerValidator("CPU cores to use when hashing files"));
}
private WebUISettings webSettings;
@ -85,6 +86,8 @@ public class ConfigurationServlet extends HttpServlet {
core.getMuOptions().setShareDownloadedFiles(false);
core.getMuOptions().setShareHiddenFiles(false);
core.getMuOptions().setSearchComments(false);
core.getMuOptions().setSearchPaths(false);
core.getMuOptions().setShowPaths(false);
core.getMuOptions().setBrowseFiles(false);
core.getMuOptions().setFileFeed(false);
core.getMuOptions().setAdvertiseFeed(false);
@ -92,6 +95,7 @@ public class ConfigurationServlet extends HttpServlet {
core.getMuOptions().setDefaultFeedAutoDownload(false);
core.getMuOptions().setDefaultFeedSequential(false);
core.getMuOptions().setAllowTracking(false);
core.getMuOptions().setSearchCollections(false);
}
private void update(String name, String value) throws Exception {
@ -110,6 +114,9 @@ public class ConfigurationServlet extends HttpServlet {
case "shareDownloadedFiles" : core.getMuOptions().setShareDownloadedFiles(true); break;
case "shareHiddenFiles" : core.getMuOptions().setShareHiddenFiles(true); break;
case "searchComments" : core.getMuOptions().setSearchComments(true); break;
case "searchCollections" : core.getMuOptions().setSearchCollections(true); break;
case "searchPaths" : core.getMuOptions().setSearchPaths(true); break;
case "showPaths" : core.getMuOptions().setShowPaths(true); break;
case "browseFiles" : core.getMuOptions().setBrowseFiles(true); break;
case "allowTracking" : core.getMuOptions().setAllowTracking(true); break;
case "speedSmoothSeconds" : core.getMuOptions().setSpeedSmoothSeconds(Integer.parseInt(value)); break;
@ -124,7 +131,7 @@ public class ConfigurationServlet extends HttpServlet {
case "defaultFeedSequential" : core.getMuOptions().setDefaultFeedSequential(true); break;
case "defaultFeedUpdateInterval" : core.getMuOptions().setDefaultFeedUpdateInterval(60000 * Long.parseLong(value)); break;
case "defaultFeedItemsToKeep" : core.getMuOptions().setDefaultFeedItemsToKeep(Integer.parseInt(value)); break;
case "hashingCores" : core.getMuOptions().setHashingCores(Integer.parseInt(value)); break;
}
}

View File

@ -64,6 +64,8 @@ class SearchManager {
payload = String.join(" ", nonEmpty).getBytes(StandardCharsets.UTF_8);
searchEvent.setSearchTerms(Arrays.asList(nonEmpty));
searchEvent.setSearchComments(core.getMuOptions().getSearchComments());
searchEvent.setCollections(core.getMuOptions().getSearchCollections());
searchEvent.setSearchPaths(core.getMuOptions().getSearchPaths());
}
boolean firstHop = core.getMuOptions().allowUntrusted() || core.getMuOptions().getSearchExtraHop();
@ -74,6 +76,7 @@ class SearchManager {
QueryEvent queryEvent = new QueryEvent();
queryEvent.setSearchEvent(searchEvent);
queryEvent.setFirstHop(firstHop);
queryEvent.setLocal(true);
queryEvent.setReplyTo(core.getMe().getDestination());
queryEvent.setReceivedOn(core.getMe().getDestination());
queryEvent.setOriginator(core.getMe());

View File

@ -55,6 +55,22 @@ Exception error = (Exception) application.getAttribute("MWConfigError");
</td>
<td><p align="right"><input type="checkbox" <% if (core.getMuOptions().getSearchComments()) out.write("checked"); %> name="searchComments" value="true"></p></td>
</tr>
<tr>
<td>
<div class="tooltip"><%=Util._t("Search in collections")%>
<span class="tooltiptext"><%=Util._t("When searching the network, should MuWire search in collections?")%></span>
</div>
</td>
<td><p align="right"><input type="checkbox" <% if (core.getMuOptions().getSearchCollections()) out.write("checked"); %> name="searchCollections" value="true"></p></td>
</tr>
<tr>
<td>
<div class="tooltip"><%=Util._t("Search in folder names")%>
<span class="tooltiptext"><%=Util._t("When searching the network, should MuWire search in the names of shared folders?")%></span>
</div>
</td>
<td><p align="right"><input type="checkbox" <% if (core.getMuOptions().getSearchPaths()) out.write("checked"); %> name="searchPaths" value="true"></p></td>
</tr>
<tr>
<td>
<div class="tooltip"><%=Util._t("Allow browsing")%>
@ -71,6 +87,14 @@ Exception error = (Exception) application.getAttribute("MWConfigError");
</td>
<td><p align="right"><input type="checkbox" <% if (core.getMuOptions().getAllowTracking()) out.write("checked"); %> name="allowTracking" value="true"></p></td>
</tr>
<tr>
<td>
<div class="tooltip"><%=Util._t("Show folder names")%>
<span class="tooltiptext"><%=Util._t("Should MuWire show the names of your shared folders?")%></span>
</div>
</td>
<td><p align="right"><input type="checkbox" <% if (core.getMuOptions().getShowPaths()) out.write("checked"); %> name="showPaths" value="true"></p></td>
</tr>
</table>
</div>
<div class="configuration-section">
@ -149,6 +173,13 @@ Exception error = (Exception) application.getAttribute("MWConfigError");
</td>
<td><p align="right"><input type="checkbox" <% if (core.getMuOptions().getShareHiddenFiles()) out.write("checked"); %> name="shareHiddenFiles" value="true"></p></td>
</tr>
<tr>
<td><div class="tooltip"><%=Util._t("CPU cores to use when hashing files")%>
<span class="tooltiptext"><%=Util._t("How many CPU cores to use when hashing shared files")%></span>
</div>
</td>
<td><p align="right"><input type="text" size="1" name="hashingCores" class="right" value="<%= core.getMuOptions().getHashingCores() %>"></p></td>
</tr>
</table>
</div>
<div class="configuration-section">