settings to disable or not advertise file feed
This commit is contained in:
@ -31,6 +31,8 @@ class MuWireSettings {
|
||||
boolean shareHiddenFiles
|
||||
boolean searchComments
|
||||
boolean browseFiles
|
||||
boolean fileFeed
|
||||
boolean advertiseFeed
|
||||
boolean startChatServer
|
||||
int maxChatConnections
|
||||
boolean advertiseChat
|
||||
@ -82,6 +84,8 @@ class MuWireSettings {
|
||||
outBw = Integer.valueOf(props.getProperty("outBw","128"))
|
||||
searchComments = Boolean.valueOf(props.getProperty("searchComments","true"))
|
||||
browseFiles = Boolean.valueOf(props.getProperty("browseFiles","true"))
|
||||
fileFeed = Boolean.valueOf(props.getProperty("fileFeed","true"))
|
||||
advertiseFeed = Boolean.valueOf(props.getProperty("advertiseFeed","true"))
|
||||
speedSmoothSeconds = Integer.valueOf(props.getProperty("speedSmoothSeconds","60"))
|
||||
totalUploadSlots = Integer.valueOf(props.getProperty("totalUploadSlots","-1"))
|
||||
uploadSlotsPerUser = Integer.valueOf(props.getProperty("uploadSlotsPerUser","-1"))
|
||||
@ -137,6 +141,8 @@ class MuWireSettings {
|
||||
props.setProperty("outBw", String.valueOf(outBw))
|
||||
props.setProperty("searchComments", String.valueOf(searchComments))
|
||||
props.setProperty("browseFiles", String.valueOf(browseFiles))
|
||||
props.setProperty("fileFeed", String.valueOf(fileFeed))
|
||||
props.setProperty("advertiseFeed", String.valueOf(advertiseFeed))
|
||||
props.setProperty("speedSmoothSeconds", String.valueOf(speedSmoothSeconds))
|
||||
props.setProperty("totalUploadSlots", String.valueOf(totalUploadSlots))
|
||||
props.setProperty("uploadSlotsPerUser", String.valueOf(uploadSlotsPerUser))
|
||||
|
@ -379,6 +379,9 @@ class ConnectionAcceptor {
|
||||
boolean chat = chatServer.running.get() && settings.advertiseChat
|
||||
os.write("Chat: ${chat}\r\n".getBytes(StandardCharsets.US_ASCII))
|
||||
|
||||
boolean feed = settings.fileFeed && settings.advertiseFeed
|
||||
os.write("Feed: ${feed}\r\n".getBytes(StandardCharsets.US_ASCII))
|
||||
|
||||
os.write("\r\n".getBytes(StandardCharsets.US_ASCII))
|
||||
|
||||
DataOutputStream dos = new DataOutputStream(new GZIPOutputStream(os))
|
||||
@ -538,6 +541,7 @@ class ConnectionAcceptor {
|
||||
if (EED != "EED\r\n".getBytes(StandardCharsets.US_ASCII))
|
||||
throw new Exception("Invalid FEED connection")
|
||||
|
||||
OutputStream os = e.getOutputStream()
|
||||
|
||||
Map<String, String> headers = DataUtil.readAllHeaders(dis)
|
||||
if (!headers.containsKey("Persona"))
|
||||
@ -546,7 +550,12 @@ class ConnectionAcceptor {
|
||||
if (requestor.destination != e.destination)
|
||||
throw new Exception("Requestor persona mismatch")
|
||||
|
||||
// TODO: check settings if feed is permitted at all
|
||||
if (!settings.fileFeed) {
|
||||
os.write("403 Not Allowed\r\n\r\n".getBytes(StandardCharsets.US_ASCII))
|
||||
os.flush()
|
||||
e.close()
|
||||
return
|
||||
}
|
||||
|
||||
long timestamp = 0
|
||||
if (headers.containsKey("Timestamp")) {
|
||||
@ -555,7 +564,6 @@ class ConnectionAcceptor {
|
||||
|
||||
List<SharedFile> published = fileManager.getPublishedSince(timestamp)
|
||||
|
||||
OutputStream os = e.getOutputStream()
|
||||
os.write("200 OK\r\n".getBytes(StandardCharsets.US_ASCII))
|
||||
os.write("Count: ${published.size()}\r\n".getBytes(StandardCharsets.US_ASCII));
|
||||
os.write("\r\n".getBytes(StandardCharsets.US_ASCII))
|
||||
|
@ -138,6 +138,8 @@ class ResultsSender {
|
||||
os.write("Count: $results.length\r\n".getBytes(StandardCharsets.US_ASCII))
|
||||
boolean chat = chatServer.running.get() && settings.advertiseChat
|
||||
os.write("Chat: $chat\r\n".getBytes(StandardCharsets.US_ASCII))
|
||||
boolean feed = settings.fileFeed && settings.advertiseFeed
|
||||
os.write("Feed: $feed\r\n".getBytes(StandardCharsets.US_ASCII))
|
||||
os.write("\r\n".getBytes(StandardCharsets.US_ASCII))
|
||||
DataOutputStream dos = new DataOutputStream(new GZIPOutputStream(os))
|
||||
results.each {
|
||||
|
Reference in New Issue
Block a user