Compare commits
6 Commits
muwire-0.6
...
muwire-0.6
Author | SHA1 | Date | |
---|---|---|---|
![]() |
a2637570b1 | ||
![]() |
6012adbeab | ||
![]() |
8f6b6b0caa | ||
![]() |
8f3b5aea8d | ||
![]() |
ee098ace8e | ||
![]() |
5d8401e4bf |
@@ -4,7 +4,7 @@ MuWire is an easy to use file-sharing program which offers anonymity using [I2P
|
|||||||
|
|
||||||
It is inspired by the LimeWire Gnutella client and developped by a former LimeWire developer.
|
It is inspired by the LimeWire Gnutella client and developped by a former LimeWire developer.
|
||||||
|
|
||||||
The current stable release - 0.5.9 is avaiable for download at https://muwire.com. You can find technical documentation in the "doc" folder.
|
The current stable release - 0.6.0 is avaiable for download at https://muwire.com. You can find technical documentation in the "doc" folder.
|
||||||
|
|
||||||
### Building
|
### Building
|
||||||
|
|
||||||
|
@@ -32,7 +32,7 @@ import com.muwire.core.UILoadedEvent
|
|||||||
import com.muwire.core.files.AllFilesLoadedEvent
|
import com.muwire.core.files.AllFilesLoadedEvent
|
||||||
|
|
||||||
class CliLanterna {
|
class CliLanterna {
|
||||||
private static final String MW_VERSION = "0.6.0"
|
private static final String MW_VERSION = "0.6.1"
|
||||||
|
|
||||||
private static volatile Core core
|
private static volatile Core core
|
||||||
|
|
||||||
|
@@ -406,7 +406,7 @@ public class Core {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Core core = new Core(props, home, "0.6.0")
|
Core core = new Core(props, home, "0.6.1")
|
||||||
core.startServices()
|
core.startServices()
|
||||||
|
|
||||||
// ... at the end, sleep or execute script
|
// ... at the end, sleep or execute script
|
||||||
|
@@ -143,6 +143,7 @@ class FileManager {
|
|||||||
|
|
||||||
String comment = sf.getComment()
|
String comment = sf.getComment()
|
||||||
if (comment != null) {
|
if (comment != null) {
|
||||||
|
comment = DataUtil.readi18nString(Base64.decode(comment))
|
||||||
Set<File> existingComment = commentToFile.get(comment)
|
Set<File> existingComment = commentToFile.get(comment)
|
||||||
if (existingComment != null) {
|
if (existingComment != null) {
|
||||||
existingComment.remove(sf.getFile())
|
existingComment.remove(sf.getFile())
|
||||||
@@ -229,7 +230,7 @@ class FileManager {
|
|||||||
return files
|
return files
|
||||||
Set<SharedFile> rv = new HashSet<>()
|
Set<SharedFile> rv = new HashSet<>()
|
||||||
files.each {
|
files.each {
|
||||||
if (it.getPieceSize() != 0)
|
if (it != null && it.getPieceSize() != 0)
|
||||||
rv.add(it)
|
rv.add(it)
|
||||||
}
|
}
|
||||||
rv
|
rv
|
||||||
|
@@ -39,10 +39,11 @@ class SearchIndex {
|
|||||||
split.each { if (it.length() > 0) rv << it }
|
split.each { if (it.length() > 0) rv << it }
|
||||||
|
|
||||||
// then just by ' '
|
// then just by ' '
|
||||||
source.split(' ').each { if (it.length() > 0) rv << it }
|
source.toLowerCase().split(' ').each { if (it.length() > 0) rv << it }
|
||||||
|
|
||||||
// and add original string
|
// and add original string
|
||||||
rv << source
|
rv << source
|
||||||
|
rv << source.toLowerCase()
|
||||||
rv.toArray(new String[0])
|
rv.toArray(new String[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
package com.muwire.core.files
|
package com.muwire.core.files
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertAll
|
||||||
|
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
|
||||||
@@ -9,6 +11,9 @@ import com.muwire.core.MuWireSettings
|
|||||||
import com.muwire.core.SharedFile
|
import com.muwire.core.SharedFile
|
||||||
import com.muwire.core.search.ResultsEvent
|
import com.muwire.core.search.ResultsEvent
|
||||||
import com.muwire.core.search.SearchEvent
|
import com.muwire.core.search.SearchEvent
|
||||||
|
import com.muwire.core.util.DataUtil
|
||||||
|
|
||||||
|
import net.i2p.data.Base64
|
||||||
|
|
||||||
class FileManagerTest {
|
class FileManagerTest {
|
||||||
|
|
||||||
@@ -185,4 +190,39 @@ class FileManagerTest {
|
|||||||
assert results == null
|
assert results == null
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testComplicatedScenario() {
|
||||||
|
// this tries to reproduce an NPE when un-sharing then sharing again and searching
|
||||||
|
String comment = "same comment"
|
||||||
|
comment = Base64.encode(DataUtil.encodei18nString(comment))
|
||||||
|
File f1 = new File("MuWire-0.5.10.AppImage")
|
||||||
|
InfoHash ih1 = InfoHash.fromHashList(new byte[32])
|
||||||
|
SharedFile sf1 = new SharedFile(f1, ih1, 0)
|
||||||
|
sf1.setComment(comment)
|
||||||
|
|
||||||
|
manager.onFileLoadedEvent(new FileLoadedEvent(loadedFile : sf1))
|
||||||
|
manager.onFileUnsharedEvent(new FileUnsharedEvent(unsharedFile : sf1, deleted : true))
|
||||||
|
|
||||||
|
File f2 = new File("MuWire-0.6.0.AppImage")
|
||||||
|
InfoHash ih2 = InfoHash.fromHashList(new byte[64])
|
||||||
|
SharedFile sf2 = new SharedFile(f2, ih2, 0)
|
||||||
|
sf2.setComment(comment)
|
||||||
|
|
||||||
|
manager.onFileLoadedEvent(new FileLoadedEvent(loadedFile : sf2))
|
||||||
|
|
||||||
|
manager.onSearchEvent(new SearchEvent(searchTerms : ["muwire"]))
|
||||||
|
Thread.sleep(20)
|
||||||
|
|
||||||
|
assert results != null
|
||||||
|
assert results.results.size() == 1
|
||||||
|
assert results.results.contains(sf2)
|
||||||
|
|
||||||
|
results = null
|
||||||
|
manager.onSearchEvent(new SearchEvent(searchTerms : ['comment'], searchComments : true, oobInfohash : true))
|
||||||
|
Thread.sleep(20)
|
||||||
|
assert results != null
|
||||||
|
assert results.results.size() == 1
|
||||||
|
assert results.results.contains(sf2)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,6 +8,7 @@ import com.muwire.core.Destinations
|
|||||||
import com.muwire.core.Persona
|
import com.muwire.core.Persona
|
||||||
import com.muwire.core.Personas
|
import com.muwire.core.Personas
|
||||||
|
|
||||||
|
import groovy.json.JsonSlurper
|
||||||
import net.i2p.data.Base64
|
import net.i2p.data.Base64
|
||||||
import net.i2p.data.Destination
|
import net.i2p.data.Destination
|
||||||
|
|
||||||
@@ -55,13 +56,16 @@ class TrustServiceTest {
|
|||||||
service.onTrustEvent new TrustEvent(level: TrustLevel.DISTRUSTED, persona: personas.persona2)
|
service.onTrustEvent new TrustEvent(level: TrustLevel.DISTRUSTED, persona: personas.persona2)
|
||||||
|
|
||||||
Thread.sleep(250)
|
Thread.sleep(250)
|
||||||
|
JsonSlurper slurper = new JsonSlurper()
|
||||||
def trusted = new HashSet<>()
|
def trusted = new HashSet<>()
|
||||||
persistGood.eachLine {
|
persistGood.eachLine {
|
||||||
trusted.add(new Persona(new ByteArrayInputStream(Base64.decode(it))))
|
def json = slurper.parseText(it)
|
||||||
|
trusted.add(new Persona(new ByteArrayInputStream(Base64.decode(json.persona))))
|
||||||
}
|
}
|
||||||
def distrusted = new HashSet<>()
|
def distrusted = new HashSet<>()
|
||||||
persistBad.eachLine {
|
persistBad.eachLine {
|
||||||
distrusted.add(new Persona(new ByteArrayInputStream(Base64.decode(it))))
|
def json = slurper.parseText(it)
|
||||||
|
distrusted.add(new Persona(new ByteArrayInputStream(Base64.decode(json.persona))))
|
||||||
}
|
}
|
||||||
|
|
||||||
assert trusted.size() == 1
|
assert trusted.size() == 1
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
group = com.muwire
|
group = com.muwire
|
||||||
version = 0.6.0
|
version = 0.6.1
|
||||||
i2pVersion = 0.9.43
|
i2pVersion = 0.9.43
|
||||||
groovyVersion = 2.4.15
|
groovyVersion = 2.4.15
|
||||||
slf4jVersion = 1.7.25
|
slf4jVersion = 1.7.25
|
||||||
|
Reference in New Issue
Block a user