Compare commits
30 Commits
muwire-0.3
...
muwire-0.4
Author | SHA1 | Date | |
---|---|---|---|
53105245f4 | |||
b68eab91e0 | |||
f72cf91462 | |||
a655c4ef50 | |||
5d46e9b796 | |||
642e6e67b3 | |||
2b6b86f903 | |||
f2706a4426 | |||
1af75413aa | |||
adc4077b1a | |||
01f4e2453b | |||
61267374dd | |||
970f814685 | |||
4fd9fc1991 | |||
26207ffd1b | |||
2614cfbe5f | |||
f11d461ec0 | |||
b2eb2d2755 | |||
ea46a54f19 | |||
627add45ad | |||
d364855459 | |||
14ee35e77a | |||
8773eb4ee0 | |||
51425bbfd9 | |||
6a4879bc0b | |||
e7fe56439b | |||
2886feab4a | |||
fb91194026 | |||
4527478b0d | |||
b0062f146e |
@ -35,7 +35,7 @@ class Cli {
|
||||
|
||||
Core core
|
||||
try {
|
||||
core = new Core(props, home, "0.3.7")
|
||||
core = new Core(props, home, "0.4.0")
|
||||
} catch (Exception bad) {
|
||||
bad.printStackTrace(System.out)
|
||||
println "Failed to initialize core, exiting"
|
||||
|
@ -53,7 +53,7 @@ class CliDownloader {
|
||||
|
||||
Core core
|
||||
try {
|
||||
core = new Core(props, home, "0.3.7")
|
||||
core = new Core(props, home, "0.4.0")
|
||||
} catch (Exception bad) {
|
||||
bad.printStackTrace(System.out)
|
||||
println "Failed to initialize core, exiting"
|
||||
|
@ -9,7 +9,5 @@ class Constants {
|
||||
public static final int MAX_HEADER_SIZE = 0x1 << 14
|
||||
public static final int MAX_HEADERS = 16
|
||||
|
||||
public static final float DOWNLOAD_SEQUENTIAL_RATIO = 0.8f
|
||||
|
||||
public static final String SPLIT_PATTERN = "[\\+\\-,\\.:;\\(\\)=_/\\\\\\!\\\"\\\'\\\$%\\|]"
|
||||
public static final String SPLIT_PATTERN = "[\\*\\+\\-,\\.:;\\(\\)=_/\\\\\\!\\\"\\\'\\\$%\\|\\[\\]\\{\\}]"
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import com.muwire.core.files.FileSharedEvent
|
||||
import com.muwire.core.files.FileUnsharedEvent
|
||||
import com.muwire.core.files.HasherService
|
||||
import com.muwire.core.files.PersisterService
|
||||
import com.muwire.core.files.AllFilesLoadedEvent
|
||||
import com.muwire.core.files.DirectoryWatcher
|
||||
import com.muwire.core.hostcache.CacheClient
|
||||
import com.muwire.core.hostcache.HostCache
|
||||
@ -173,7 +174,7 @@ public class Core {
|
||||
eventBus.register(SearchEvent.class, fileManager)
|
||||
|
||||
log.info("initializing mesh manager")
|
||||
MeshManager meshManager = new MeshManager(fileManager, home)
|
||||
MeshManager meshManager = new MeshManager(fileManager, home, props)
|
||||
eventBus.register(SourceDiscoveredEvent.class, meshManager)
|
||||
|
||||
log.info "initializing persistence service"
|
||||
@ -236,6 +237,7 @@ public class Core {
|
||||
log.info("initializing directory watcher")
|
||||
directoryWatcher = new DirectoryWatcher(eventBus, fileManager)
|
||||
eventBus.register(FileSharedEvent.class, directoryWatcher)
|
||||
eventBus.register(AllFilesLoadedEvent.class, directoryWatcher)
|
||||
|
||||
log.info("initializing hasher service")
|
||||
hasherService = new HasherService(new FileHasher(), eventBus, fileManager)
|
||||
@ -244,7 +246,6 @@ public class Core {
|
||||
|
||||
public void startServices() {
|
||||
hasherService.start()
|
||||
directoryWatcher.start()
|
||||
trustService.start()
|
||||
trustService.waitForLoad()
|
||||
hostCache.start()
|
||||
@ -297,7 +298,7 @@ public class Core {
|
||||
}
|
||||
}
|
||||
|
||||
Core core = new Core(props, home, "0.3.7")
|
||||
Core core = new Core(props, home, "0.4.0")
|
||||
core.startServices()
|
||||
|
||||
// ... at the end, sleep or execute script
|
||||
|
@ -18,6 +18,9 @@ class MuWireSettings {
|
||||
CrawlerResponse crawlerResponse
|
||||
boolean shareDownloadedFiles
|
||||
Set<String> watchedDirectories
|
||||
float downloadSequentialRatio
|
||||
int hostClearInterval
|
||||
int meshExpiration
|
||||
|
||||
MuWireSettings() {
|
||||
this(new Properties())
|
||||
@ -33,6 +36,9 @@ class MuWireSettings {
|
||||
downloadRetryInterval = Integer.parseInt(props.getProperty("downloadRetryInterval","1"))
|
||||
updateCheckInterval = Integer.parseInt(props.getProperty("updateCheckInterval","24"))
|
||||
shareDownloadedFiles = Boolean.parseBoolean(props.getProperty("shareDownloadedFiles","true"))
|
||||
downloadSequentialRatio = Float.valueOf(props.getProperty("downloadSequentialRatio","0.8"))
|
||||
hostClearInterval = Integer.valueOf(props.getProperty("hostClearInterval","60"))
|
||||
meshExpiration = Integer.valueOf(props.getProperty("meshExpiration","60"))
|
||||
|
||||
watchedDirectories = new HashSet<>()
|
||||
if (props.containsKey("watchedDirectories")) {
|
||||
@ -52,6 +58,9 @@ class MuWireSettings {
|
||||
props.setProperty("downloadRetryInterval", String.valueOf(downloadRetryInterval))
|
||||
props.setProperty("updateCheckInterval", String.valueOf(updateCheckInterval))
|
||||
props.setProperty("shareDownloadedFiles", String.valueOf(shareDownloadedFiles))
|
||||
props.setProperty("downloadSequentialRatio", String.valueOf(downloadSequentialRatio))
|
||||
props.setProperty("hostClearInterval", String.valueOf(hostClearInterval))
|
||||
props.setProperty("meshExpiration", String.valueOf(meshExpiration))
|
||||
|
||||
if (!watchedDirectories.isEmpty()) {
|
||||
String encoded = watchedDirectories.stream().
|
||||
|
@ -75,7 +75,7 @@ class DownloadSession {
|
||||
if (available.isEmpty())
|
||||
piece = pieces.claim()
|
||||
else
|
||||
piece = pieces.claim(available)
|
||||
piece = pieces.claim(new HashSet<>(available))
|
||||
if (piece == -1)
|
||||
return false
|
||||
boolean unclaim = true
|
||||
|
@ -18,6 +18,7 @@ import com.muwire.core.DownloadedFile
|
||||
import com.muwire.core.EventBus
|
||||
import com.muwire.core.connection.I2PConnector
|
||||
import com.muwire.core.files.FileDownloadedEvent
|
||||
import com.muwire.core.util.DataUtil
|
||||
|
||||
import groovy.util.logging.Log
|
||||
import net.i2p.data.Destination
|
||||
@ -269,7 +270,7 @@ public class Downloader {
|
||||
writePieces()
|
||||
}
|
||||
} catch (Exception bad) {
|
||||
log.log(Level.WARNING,"Exception while downloading",bad)
|
||||
log.log(Level.WARNING,"Exception while downloading",DataUtil.findRoot(bad))
|
||||
} finally {
|
||||
currentState = WorkerState.FINISHED
|
||||
if (pieces.isComplete() && eventFired.compareAndSet(false, true)) {
|
||||
|
@ -47,7 +47,7 @@ class DirectoryWatcher {
|
||||
publisherThread.setDaemon(true)
|
||||
}
|
||||
|
||||
void start() {
|
||||
void onAllFilesLoadedEvent(AllFilesLoadedEvent e) {
|
||||
watchService = FileSystems.getDefault().newWatchService()
|
||||
watcherThread.start()
|
||||
publisherThread.start()
|
||||
@ -55,9 +55,9 @@ class DirectoryWatcher {
|
||||
|
||||
void stop() {
|
||||
shutdown = true
|
||||
watcherThread.interrupt()
|
||||
publisherThread.interrupt()
|
||||
watchService.close()
|
||||
watcherThread?.interrupt()
|
||||
publisherThread?.interrupt()
|
||||
watchService?.close()
|
||||
}
|
||||
|
||||
void onFileSharedEvent(FileSharedEvent e) {
|
||||
|
@ -7,4 +7,10 @@ class FileHashedEvent extends Event {
|
||||
|
||||
SharedFile sharedFile
|
||||
String error
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
super.toString() + " sharedFile " + sharedFile?.file.getAbsolutePath() + " error: $error"
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,4 +5,9 @@ import com.muwire.core.Event
|
||||
class FileSharedEvent extends Event {
|
||||
|
||||
File file
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " file: "+file.getAbsolutePath()
|
||||
}
|
||||
}
|
||||
|
@ -5,14 +5,15 @@ import net.i2p.data.Destination
|
||||
class Host {
|
||||
|
||||
private static final int MAX_FAILURES = 3
|
||||
private static final int CLEAR_INTERVAL = 60 * 60 * 1000
|
||||
|
||||
final Destination destination
|
||||
private final int clearInterval
|
||||
int failures,successes
|
||||
long lastAttempt
|
||||
|
||||
public Host(Destination destination) {
|
||||
public Host(Destination destination, int clearInterval) {
|
||||
this.destination = destination
|
||||
this.clearInterval = clearInterval
|
||||
}
|
||||
|
||||
synchronized void onConnect() {
|
||||
@ -40,6 +41,6 @@ class Host {
|
||||
}
|
||||
|
||||
synchronized void canTryAgain() {
|
||||
System.currentTimeMillis() - lastAttempt > CLEAR_INTERVAL
|
||||
System.currentTimeMillis() - lastAttempt > (clearInterval * 60 * 1000)
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class HostCache extends Service {
|
||||
hosts.get(e.destination).clearFailures()
|
||||
return
|
||||
}
|
||||
Host host = new Host(e.destination)
|
||||
Host host = new Host(e.destination, settings.hostClearInterval)
|
||||
if (allowHost(host)) {
|
||||
hosts.put(e.destination, host)
|
||||
}
|
||||
@ -64,7 +64,7 @@ class HostCache extends Service {
|
||||
Destination dest = e.endpoint.destination
|
||||
Host host = hosts.get(dest)
|
||||
if (host == null) {
|
||||
host = new Host(dest)
|
||||
host = new Host(dest, settings.hostClearInterval)
|
||||
hosts.put(dest, host)
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ class HostCache extends Service {
|
||||
storage.eachLine {
|
||||
def entry = slurper.parseText(it)
|
||||
Destination dest = new Destination(entry.destination)
|
||||
Host host = new Host(dest)
|
||||
Host host = new Host(dest, settings.hostClearInterval)
|
||||
host.failures = Integer.valueOf(String.valueOf(entry.failures))
|
||||
host.successes = Integer.valueOf(String.valueOf(entry.successes))
|
||||
if (entry.lastAttempt != null)
|
||||
|
@ -4,10 +4,12 @@ import java.util.stream.Collectors
|
||||
|
||||
import com.muwire.core.Constants
|
||||
import com.muwire.core.InfoHash
|
||||
import com.muwire.core.MuWireSettings
|
||||
import com.muwire.core.Persona
|
||||
import com.muwire.core.download.Pieces
|
||||
import com.muwire.core.download.SourceDiscoveredEvent
|
||||
import com.muwire.core.files.FileManager
|
||||
import com.muwire.core.util.DataUtil
|
||||
|
||||
import groovy.json.JsonOutput
|
||||
import groovy.json.JsonSlurper
|
||||
@ -15,15 +17,15 @@ import net.i2p.data.Base64
|
||||
|
||||
class MeshManager {
|
||||
|
||||
private static final int EXPIRATION = 60 * 60 * 1000
|
||||
|
||||
private final Map<InfoHash, Mesh> meshes = Collections.synchronizedMap(new HashMap<>())
|
||||
private final FileManager fileManager
|
||||
private final File home
|
||||
private final MuWireSettings settings
|
||||
|
||||
MeshManager(FileManager fileManager, File home) {
|
||||
MeshManager(FileManager fileManager, File home, MuWireSettings settings) {
|
||||
this.fileManager = fileManager
|
||||
this.home = home
|
||||
this.settings = settings
|
||||
load()
|
||||
}
|
||||
|
||||
@ -35,7 +37,7 @@ class MeshManager {
|
||||
synchronized(meshes) {
|
||||
if (meshes.containsKey(infoHash))
|
||||
return meshes.get(infoHash)
|
||||
Pieces pieces = new Pieces(nPieces, Constants.DOWNLOAD_SEQUENTIAL_RATIO)
|
||||
Pieces pieces = new Pieces(nPieces, settings.downloadSequentialRatio)
|
||||
if (fileManager.rootToFiles.containsKey(infoHash)) {
|
||||
for (int i = 0; i < nPieces; i++)
|
||||
pieces.markDownloaded(i)
|
||||
@ -50,8 +52,8 @@ class MeshManager {
|
||||
Mesh mesh = meshes.get(e.infoHash)
|
||||
if (mesh == null)
|
||||
return
|
||||
if (mesh.sources.add(e.source))
|
||||
save()
|
||||
mesh.sources.add(e.source)
|
||||
save()
|
||||
}
|
||||
|
||||
private void save() {
|
||||
@ -64,6 +66,7 @@ class MeshManager {
|
||||
json.infoHash = Base64.encode(mesh.infoHash.getRoot())
|
||||
json.sources = mesh.sources.stream().map({it.toBase64()}).collect(Collectors.toList())
|
||||
json.nPieces = mesh.pieces.nPieces
|
||||
json.xHave = DataUtil.encodeXHave(mesh.pieces.downloaded, mesh.pieces.nPieces)
|
||||
writer.println(JsonOutput.toJson(json))
|
||||
}
|
||||
}
|
||||
@ -78,10 +81,10 @@ class MeshManager {
|
||||
JsonSlurper slurper = new JsonSlurper()
|
||||
meshFile.eachLine {
|
||||
def json = slurper.parseText(it)
|
||||
if (now - json.timestamp > EXPIRATION)
|
||||
if (now - json.timestamp > settings.meshExpiration * 60 * 1000)
|
||||
return
|
||||
InfoHash infoHash = new InfoHash(Base64.decode(json.infoHash))
|
||||
Pieces pieces = new Pieces(json.nPieces, Constants.DOWNLOAD_SEQUENTIAL_RATIO)
|
||||
Pieces pieces = new Pieces(json.nPieces, settings.downloadSequentialRatio)
|
||||
|
||||
Mesh mesh = new Mesh(infoHash, pieces)
|
||||
json.sources.each { source ->
|
||||
@ -89,6 +92,9 @@ class MeshManager {
|
||||
mesh.sources.add(persona)
|
||||
}
|
||||
|
||||
if (json.xHave != null)
|
||||
DataUtil.decodeXHave(json.xHave).each { pieces.markDownloaded(it) }
|
||||
|
||||
if (!mesh.sources.isEmpty())
|
||||
meshes.put(infoHash, mesh)
|
||||
}
|
||||
|
@ -2,5 +2,5 @@ package com.muwire.core.upload
|
||||
|
||||
class ContentRequest extends Request {
|
||||
Range range
|
||||
boolean have
|
||||
int have
|
||||
}
|
||||
|
@ -105,4 +105,14 @@ class ContentUploader extends Uploader {
|
||||
request.downloader.getHumanReadableName()
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDonePieces() {
|
||||
return request.have;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalPieces() {
|
||||
return mesh.pieces.nPieces;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -50,6 +50,16 @@ class HashListUploader extends Uploader {
|
||||
public String getDownloader() {
|
||||
request.downloader.getHumanReadableName()
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDonePieces() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalPieces() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -50,10 +50,10 @@ class Request {
|
||||
downloader = new Persona(new ByteArrayInputStream(decoded))
|
||||
}
|
||||
|
||||
boolean have = false
|
||||
int have = 0
|
||||
if (headers.containsKey("X-Have")) {
|
||||
def encoded = headers["X-Have"].trim()
|
||||
have = DataUtil.decodeXHave(encoded).size() > 0
|
||||
have = DataUtil.decodeXHave(encoded).size()
|
||||
}
|
||||
new ContentRequest( infoHash : infoHash, range : new Range(start, end),
|
||||
headers : headers, downloader : downloader, have : have)
|
||||
|
@ -80,7 +80,7 @@ public class UploadManager {
|
||||
return
|
||||
}
|
||||
|
||||
if (request.have)
|
||||
if (request.have > 0)
|
||||
eventBus.publish(new SourceDiscoveredEvent(infoHash : request.infoHash, source : request.downloader))
|
||||
|
||||
Mesh mesh
|
||||
@ -205,7 +205,7 @@ public class UploadManager {
|
||||
return
|
||||
}
|
||||
|
||||
if (request.have)
|
||||
if (request.have > 0)
|
||||
eventBus.publish(new SourceDiscoveredEvent(infoHash : request.infoHash, source : request.downloader))
|
||||
|
||||
Mesh mesh
|
||||
|
@ -32,4 +32,8 @@ abstract class Uploader {
|
||||
abstract int getProgress();
|
||||
|
||||
abstract String getDownloader();
|
||||
|
||||
abstract int getDonePieces();
|
||||
|
||||
abstract int getTotalPieces()
|
||||
}
|
||||
|
@ -109,4 +109,10 @@ class DataUtil {
|
||||
}
|
||||
available
|
||||
}
|
||||
|
||||
public static Exception findRoot(Exception e) {
|
||||
while(e.getCause() != null)
|
||||
e = e.getCause()
|
||||
e
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class SharedFile {
|
||||
long length = file.length();
|
||||
int rawPieceSize = 0x1 << pieceSize;
|
||||
int rv = (int) (length / rawPieceSize);
|
||||
if (length % pieceSize != 0)
|
||||
if (length % rawPieceSize != 0)
|
||||
rv++;
|
||||
return rv;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
group = com.muwire
|
||||
version = 0.3.7
|
||||
version = 0.4.0
|
||||
groovyVersion = 2.4.15
|
||||
slf4jVersion = 1.7.25
|
||||
spockVersion = 1.1-groovy-2.4
|
||||
|
@ -44,6 +44,8 @@ class MainFrameController {
|
||||
search = search.trim()
|
||||
if (search.length() == 0)
|
||||
return
|
||||
if (search.length() > 128)
|
||||
search = search.substring(0,128)
|
||||
def uuid = UUID.randomUUID()
|
||||
Map<String, Object> params = new HashMap<>()
|
||||
params["search-terms"] = search
|
||||
|
@ -5,6 +5,7 @@ import griffon.core.controller.ControllerAction
|
||||
import griffon.inject.MVCMember
|
||||
import griffon.metadata.ArtifactProviderFor
|
||||
import javax.annotation.Nonnull
|
||||
import javax.swing.JFileChooser
|
||||
|
||||
import com.muwire.core.Core
|
||||
|
||||
@ -60,6 +61,9 @@ class OptionsController {
|
||||
boolean shareDownloaded = view.shareDownloadedCheckbox.model.isSelected()
|
||||
model.shareDownloadedFiles = shareDownloaded
|
||||
settings.shareDownloadedFiles = shareDownloaded
|
||||
|
||||
String downloadLocation = model.downloadLocation
|
||||
settings.downloadLocation = new File(downloadLocation)
|
||||
|
||||
File settingsFile = new File(core.home, "MuWire.properties")
|
||||
settingsFile.withOutputStream {
|
||||
@ -110,4 +114,15 @@ class OptionsController {
|
||||
view.d.setVisible(false)
|
||||
mvcGroup.destroy()
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
void downloadLocation() {
|
||||
def chooser = new JFileChooser()
|
||||
chooser.setFileHidingEnabled(false)
|
||||
chooser.setDialogTitle("Select location for downloaded files")
|
||||
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY)
|
||||
int rv = chooser.showOpenDialog(null)
|
||||
if (rv == JFileChooser.APPROVE_OPTION)
|
||||
model.downloadLocation = chooser.getSelectedFile().getAbsolutePath()
|
||||
}
|
||||
}
|
@ -43,6 +43,8 @@ class Initialize extends AbstractLifecycleHandler {
|
||||
|
||||
application.context.put("muwire-home", home.getAbsolutePath())
|
||||
|
||||
System.getProperties().setProperty("awt.useSystemAAFontSettings", "true")
|
||||
|
||||
def guiPropsFile = new File(home, "gui.properties")
|
||||
UISettings uiSettings
|
||||
if (guiPropsFile.exists()) {
|
||||
|
@ -74,6 +74,7 @@ class Ready extends AbstractLifecycleHandler {
|
||||
props.downloadLocation = new File(portableDownloads)
|
||||
} else {
|
||||
def chooser = new JFileChooser()
|
||||
chooser.setFileHidingEnabled(false)
|
||||
chooser.setDialogTitle("Select a directory where downloads will be saved")
|
||||
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY)
|
||||
int rv = chooser.showOpenDialog(null)
|
||||
|
@ -17,6 +17,7 @@ import com.muwire.core.connection.ConnectionEvent
|
||||
import com.muwire.core.connection.DisconnectionEvent
|
||||
import com.muwire.core.download.DownloadStartedEvent
|
||||
import com.muwire.core.download.Downloader
|
||||
import com.muwire.core.files.AllFilesLoadedEvent
|
||||
import com.muwire.core.files.FileDownloadedEvent
|
||||
import com.muwire.core.files.FileHashedEvent
|
||||
import com.muwire.core.files.FileLoadedEvent
|
||||
@ -139,6 +140,7 @@ class MainFrameModel {
|
||||
core.eventBus.register(FileDownloadedEvent.class, this)
|
||||
core.eventBus.register(FileUnsharedEvent.class, this)
|
||||
core.eventBus.register(RouterDisconnectedEvent.class, this)
|
||||
core.eventBus.register(AllFilesLoadedEvent.class, this)
|
||||
|
||||
timer.schedule({
|
||||
if (core.shutdown.get())
|
||||
@ -167,9 +169,6 @@ class MainFrameModel {
|
||||
trusted.addAll(core.trustService.good.values())
|
||||
distrusted.addAll(core.trustService.bad.values())
|
||||
|
||||
watched.addAll(core.muOptions.watchedDirectories)
|
||||
builder.getVariable("watched-directories-table").model.fireTableDataChanged()
|
||||
watched.each { core.eventBus.publish(new FileSharedEvent(file : new File(it))) }
|
||||
|
||||
resumeButtonText = "Retry"
|
||||
}
|
||||
@ -177,6 +176,13 @@ class MainFrameModel {
|
||||
|
||||
}
|
||||
|
||||
void onAllFilesLoadedEvent(AllFilesLoadedEvent e) {
|
||||
runInsideUIAsync {
|
||||
watched.addAll(core.muOptions.watchedDirectories)
|
||||
builder.getVariable("watched-directories-table").model.fireTableDataChanged()
|
||||
watched.each { core.eventBus.publish(new FileSharedEvent(file : new File(it))) }
|
||||
}
|
||||
}
|
||||
void onUIResultEvent(UIResultEvent e) {
|
||||
MVCGroup resultsGroup = results.get(e.uuid)
|
||||
resultsGroup?.model.handleResult(e)
|
||||
|
@ -13,6 +13,7 @@ class OptionsModel {
|
||||
@Observable String updateCheckInterval
|
||||
@Observable boolean onlyTrusted
|
||||
@Observable boolean shareDownloadedFiles
|
||||
@Observable String downloadLocation
|
||||
|
||||
// i2p options
|
||||
@Observable String inboundLength
|
||||
@ -35,6 +36,7 @@ class OptionsModel {
|
||||
updateCheckInterval = settings.updateCheckInterval
|
||||
onlyTrusted = !settings.allowUntrusted()
|
||||
shareDownloadedFiles = settings.shareDownloadedFiles
|
||||
downloadLocation = settings.downloadLocation.getAbsolutePath()
|
||||
|
||||
Core core = application.context.get("core")
|
||||
inboundLength = core.i2pOptions["inbound.length"]
|
||||
|
BIN
gui/griffon-app/resources/MuWire-128x128.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
gui/griffon-app/resources/MuWire-16x16.png
Normal file
After Width: | Height: | Size: 344 B |
BIN
gui/griffon-app/resources/MuWire-32x32.png
Normal file
After Width: | Height: | Size: 459 B |
BIN
gui/griffon-app/resources/MuWire-48x48.png
Normal file
After Width: | Height: | Size: 1003 B |
BIN
gui/griffon-app/resources/MuWire-64x64.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 5.8 KiB |
@ -21,10 +21,10 @@ class EventListView {
|
||||
application(size: [320, 80], id: 'event-list',
|
||||
locationRelativeTo : null,
|
||||
title: application.configuration['application.title'],
|
||||
iconImage: imageIcon('/griffon-icon-48x48.png').image,
|
||||
iconImages: [imageIcon('/griffon-icon-48x48.png').image,
|
||||
imageIcon('/griffon-icon-32x32.png').image,
|
||||
imageIcon('/griffon-icon-16x16.png').image],
|
||||
iconImage: imageIcon('/MuWire-48x48.png').image,
|
||||
iconImages: [imageIcon('/MuWire-48x48.png').image,
|
||||
imageIcon('/MuWire-32x32.png').image,
|
||||
imageIcon('/MuWire-16x16.png').image],
|
||||
visible: bind { !model.coreInitialized} ) {
|
||||
panel {
|
||||
vbox {
|
||||
|
@ -60,10 +60,10 @@ class MainFrameView {
|
||||
locationRelativeTo : null,
|
||||
title: application.configuration['application.title'] + " " +
|
||||
metadata["application.version"] + " revision " + metadata["build.revision"],
|
||||
iconImage: imageIcon('/griffon-icon-48x48.png').image,
|
||||
iconImages: [imageIcon('/griffon-icon-48x48.png').image,
|
||||
imageIcon('/griffon-icon-32x32.png').image,
|
||||
imageIcon('/griffon-icon-16x16.png').image],
|
||||
iconImage: imageIcon('/MuWire-48x48.png').image,
|
||||
iconImages: [imageIcon('/MuWire-48x48.png').image,
|
||||
imageIcon('/MuWire-32x32.png').image,
|
||||
imageIcon('/MuWire-16x16.png').image],
|
||||
pack : false,
|
||||
visible : bind { model.coreInitialized }) {
|
||||
menuBar {
|
||||
@ -185,11 +185,14 @@ class MainFrameView {
|
||||
closureColumn(header : "Name", type : String, read : {row -> row.getName() })
|
||||
closureColumn(header : "Progress", type : String, read : { row ->
|
||||
int percent = row.getProgress()
|
||||
"$percent%"
|
||||
"$percent% of piece".toString()
|
||||
})
|
||||
closureColumn(header : "Downloader", type : String, read : { row ->
|
||||
row.getDownloader()
|
||||
})
|
||||
closureColumn(header : "Remote Pieces", type : String, read : { row ->
|
||||
"${row.getDonePieces()}/${row.getTotalPieces()}".toString()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -516,6 +519,7 @@ class MainFrameView {
|
||||
|
||||
def shareFiles = {
|
||||
def chooser = new JFileChooser()
|
||||
chooser.setFileHidingEnabled(false)
|
||||
chooser.setDialogTitle("Select file to share")
|
||||
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY)
|
||||
int rv = chooser.showOpenDialog(null)
|
||||
@ -526,6 +530,7 @@ class MainFrameView {
|
||||
|
||||
def watchDirectories = {
|
||||
def chooser = new JFileChooser()
|
||||
chooser.setFileHidingEnabled(false)
|
||||
chooser.setDialogTitle("Select directory to watch")
|
||||
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY)
|
||||
int rv = chooser.showOpenDialog(null)
|
||||
|
@ -68,6 +68,10 @@ class OptionsView {
|
||||
|
||||
label(text : "Share downloaded files", constraints : gbc(gridx : 0, gridy:3))
|
||||
shareDownloadedCheckbox = checkBox(selected : bind {model.shareDownloadedFiles}, constraints : gbc(gridx :1, gridy:3))
|
||||
|
||||
label(text : "Save downloaded files to:", constraints: gbc(gridx:0, gridy:4))
|
||||
button(text : "Choose", constraints : gbc(gridx : 1, gridy:4), downloadLocationAction)
|
||||
label(text : bind {model.downloadLocation}, constraints: gbc(gridx:0, gridy:5, gridwidth:2))
|
||||
|
||||
}
|
||||
i = builder.panel {
|
||||
|
@ -26,7 +26,7 @@ handlers= java.util.logging.FileHandler
|
||||
# can be overriden by a facility specific level
|
||||
# Note that the ConsoleHandler also has a separate level
|
||||
# setting to limit messages printed to the console.
|
||||
.level= SEVERE
|
||||
.level= INFO
|
||||
|
||||
############################################################
|
||||
# Handler specific properties.
|
||||
@ -35,7 +35,7 @@ handlers= java.util.logging.FileHandler
|
||||
|
||||
# default file output is in user's home directory.
|
||||
java.util.logging.FileHandler.pattern = MuWire.log
|
||||
java.util.logging.FileHandler.limit = 50000000
|
||||
java.util.logging.FileHandler.limit = 150000000
|
||||
java.util.logging.FileHandler.count = 1
|
||||
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
|
||||
|
||||
@ -60,3 +60,5 @@ java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$
|
||||
# messages:
|
||||
com.xyz.foo.level = SEVERE
|
||||
com.muwire.core.level = FINE
|
||||
net.i2p.client.streaming.impl.level = FINE
|
||||
net.i2p.client.impl.level = FINE
|
||||
|