diff --git a/README.md b/README.md
index b1dc3ca..30d95e1 100755
--- a/README.md
+++ b/README.md
@@ -29,6 +29,15 @@ Look up [this wiki page](https://github.com/kraiz/icecult/wiki).
Changelog
---------
+* upcoming:
+ * feature: added settings tab
+ * feature: enabled possibility to pause/resume hashing
+ * feature: updated angular to 1.3.13 and bootstrap to 3.3.2
+ * bugfix: another error in update check
+
+* 0.4.1:
+ * bugfix: error in update check
+
* 0.4.0:
* feature: show available updates in statusbar
diff --git a/app/index.html b/app/index.html
index 9ee24a5..fa2c040 100644
--- a/app/index.html
+++ b/app/index.html
@@ -22,6 +22,8 @@
+
+
diff --git a/app/js/app.js b/app/js/app.js
index fa85685..c547c88 100644
--- a/app/js/app.js
+++ b/app/js/app.js
@@ -11,7 +11,16 @@ EiskaltApp.value('settings', {
hashAndRatio: 5000,
chat: 3000,
queues: 3000
- }
+ },
+ settings: [
+ {key: 'Nick', type: 'text'},
+ {key: 'Description', type: 'text'},
+ {key: 'ExternalIp', type: 'text'},
+ {key: 'MaxUploadSpeedMain', type: 'number', suffix: 'kB/s'},
+ {key: 'MaxDownloadSpeedMain', type: 'number', suffix: 'kB/s'},
+ {key: 'DownloadDirectory', type: 'text'},
+ {key: 'TempDownloadDirectory', type: 'text'},
+ ]
});
EiskaltApp.config(function ($routeProvider) {
@@ -28,5 +37,9 @@ EiskaltApp.config(function ($routeProvider) {
controller: 'QueueCtrl',
templateUrl: 'partials/queue.html'
})
+ .when('/settings', {
+ controller: 'SettingsCtrl',
+ templateUrl: 'partials/settings.html'
+ })
.otherwise({redirectTo: '/hubs'});
});
diff --git a/app/js/controllers/settings.js b/app/js/controllers/settings.js
new file mode 100644
index 0000000..b4fb541
--- /dev/null
+++ b/app/js/controllers/settings.js
@@ -0,0 +1,35 @@
+'use strict';
+
+EiskaltApp.controller('SettingsCtrl', function ($scope, $timeout, $modal, settings, EiskaltRPC) {
+ $scope.settings = settings.settings
+
+ $scope.reset = function() {
+ angular.forEach($scope.settings, function (setting) {
+ EiskaltRPC.SettingsGetSet(setting.key).success(function(value) {
+ if (setting.type === 'number') {
+ value = parseInt(value);
+ }
+ setting.value = value;
+ });
+ });
+ EiskaltRPC.ListShare().success(function(shares) {
+ $scope.shares = shares;
+ });
+ };
+ $scope.reset();
+
+ $scope.save = function() {
+ angular.forEach($scope.settings, function (setting) {
+ EiskaltRPC.SettingsGetSet(setting.key, setting.value).success(function(success) {
+ if (success) {
+ setting.success = true;
+ $timeout(function() {
+ delete setting.success;
+ }, 2000)
+ } else {
+ setting.error = true;
+ }
+ });
+ });
+ };
+});
\ No newline at end of file
diff --git a/app/js/controllers/share.js b/app/js/controllers/share.js
new file mode 100644
index 0000000..40d218c
--- /dev/null
+++ b/app/js/controllers/share.js
@@ -0,0 +1,43 @@
+"use strict";
+
+EiskaltApp.controller('ShareCtrl', function ($scope, $modal, settings, EiskaltRPC) {
+ $scope.directories = []
+
+ $scope.refresh = function () {
+ EiskaltRPC.ListShare().success(function (directories) {
+ $scope.directories = directories;
+ });
+ };
+ $scope.refresh();
+
+ $scope.openAddShareDirModal = function () {
+ $modal.open({
+ templateUrl: 'addShareDirModal.html',
+ controller: 'AddShareDirCtrl'
+ }).result.then($scope.refresh);
+ };
+
+ $scope.removeShareDir = function (directory) {
+ if (confirm(
+ 'Are you sure to unshare the directory ' + directory.name + '?\n' +
+ 'Rehashing ' + directory.sizeFormatted + ' may take a while.'
+ )) {
+ EiskaltRPC.DelDirFromShare(directory.name).success($scope.refresh);
+ }
+ }
+});
+
+EiskaltApp.controller('AddShareDirCtrl', function ($scope, $modalInstance, EiskaltRPC) {
+ $scope.name = "";
+ $scope.path = "";
+
+ $scope.ok = function () {
+ EiskaltRPC.AddDirInShare($scope.path, $scope.name).success(function (result) {
+ $modalInstance.close(result === 0);
+ });
+ };
+
+ $scope.cancel = function () {
+ $modalInstance.dismiss('cancel');
+ };
+});
\ No newline at end of file
diff --git a/app/js/services/rpc.js b/app/js/services/rpc.js
index 0f0fc17..33c7e68 100644
--- a/app/js/services/rpc.js
+++ b/app/js/services/rpc.js
@@ -57,7 +57,7 @@ angular.module('EiskaltRPC', []).factory('EiskaltRPC', function($http) {
return jsonrpc('hub.pm', {huburl: huburl, nick: nick, message: message});
},
ListHubs: function() {
- return jsonrpc('hub.list', {separator: '#'}, true);
+ return jsonrpc('hub.list', {separator: '┴'}, true);
},
AddDirInShare: function(directory, virtname) {
return jsonrpc('share.add', {directory: directory, virtname: virtname});
@@ -69,12 +69,12 @@ angular.module('EiskaltRPC', []).factory('EiskaltRPC', function($http) {
return jsonrpc('share.del', {directory: directory});
},
ListShare: function() {
- var promise = jsonrpc('share.list', {separator: '#'});
+ var promise = jsonrpc('share.list', {separator: '┴'});
promise.success = function(fn) {
promise.then(function(response) {
var result = response.data.result.replace(/(\r\n|\n|\r)/gm, '');
- result = result.replace(/#+$/, '');
- result = result.split('#');
+ result = result.replace(/┴+$/, '');
+ result = result.split('┴');
var shares = [];
while (result.length) {
var data = result.splice(0, 3);
@@ -96,7 +96,7 @@ angular.module('EiskaltRPC', []).factory('EiskaltRPC', function($http) {
return jsonrpc('list.download', {huburl: huburl, nick: nick});
},
GetChatPub: function(huburl) {
- return jsonrpc('hub.getchat', {huburl: huburl, separator: '#'}, true);
+ return jsonrpc('hub.getchat', {huburl: huburl, separator: '┴'}, true);
},
SendSearch: function(searchstring, searchtype, sizemode, sizetype, size, huburls) {
return jsonrpc('search.send', { searchstring: searchstring, searchtype: searchtype, sizemode: sizemode, sizetype: sizetype, size: size, huburls: huburls});
@@ -120,7 +120,7 @@ angular.module('EiskaltRPC', []).factory('EiskaltRPC', function($http) {
return jsonrpc('queue.remove', {target: target});
},
ListQueueTargets: function() {
- return jsonrpc('queue.listtargets', {separator: '#'}, true);
+ return jsonrpc('queue.listtargets', {separator: '┴'}, true);
},
ListQueue: function() {
return jsonrpc('queue.list');
@@ -132,7 +132,7 @@ angular.module('EiskaltRPC', []).factory('EiskaltRPC', function($http) {
return jsonrpc('queue.add', {directory: directory, tth: tth, filename: filename, size: size});
},
GetSourcesItem: function(target) {
- return jsonrpc('queue.getsources', {target: target, separator: '#'}, true);
+ return jsonrpc('queue.getsources', {target: target, separator: '┴'}, true);
},
GetHashStatus: function() {
return jsonrpc('hash.status');
@@ -161,7 +161,7 @@ angular.module('EiskaltRPC', []).factory('EiskaltRPC', function($http) {
return promise;
},
GetHubUserList: function(huburl) {
- return jsonrpc('hub.getusers', {huburl: huburl, separator: '#'}, true);
+ return jsonrpc('hub.getusers', {huburl: huburl, separator: '┴'}, true);
},
GetUserInfo: function(nick, huburl) {
var promise = jsonrpc('hub.getuserinfo', {nick: nick, huburl: huburl});
@@ -177,7 +177,7 @@ angular.module('EiskaltRPC', []).factory('EiskaltRPC', function($http) {
return promise;
},
ShowLocalLists: function() {
- return jsonrpc('list.local', {separator: '#'}, true);
+ return jsonrpc('list.local', {separator: '┴'}, true);
},
GetClientFileList: function(filelist) {
return jsonrpc('queue.listtargets', {filelist: filelist});
@@ -192,7 +192,7 @@ angular.module('EiskaltRPC', []).factory('EiskaltRPC', function($http) {
return jsonrpc('list.closeall');
},
ShowOpenedLists: function() {
- return jsonrpc('list.listopened', {separator: '#'}, true);
+ return jsonrpc('list.listopened', {separator: '┴'}, true);
},
LsDirInList: function(directory, filelist) {
if (directory.length > 0) {
@@ -231,6 +231,22 @@ angular.module('EiskaltRPC', []).factory('EiskaltRPC', function($http) {
},
GetItemDescbyTarget: function(target) {
return jsonrpc('queue.getiteminfo');
+ },
+ QueueClear: function() {
+ return jsonrpc('queue.clear');
+ },
+ SettingsGetSet: function(key, value) {
+ var promise = jsonrpc('settings.getset', {key: key, value: value});
+ promise.success = function(fn) {
+ promise.then(function(response) {
+ if (angular.isDefined(value)) { // set
+ fn(response.data.result !== 1);
+ } else { // get
+ fn(response.data.result.value);
+ }
+ });
+ };
+ return promise;
}
};
});
diff --git a/app/partials/navbar.html b/app/partials/navbar.html
index 005f209..a087d79 100644
--- a/app/partials/navbar.html
+++ b/app/partials/navbar.html
@@ -31,6 +31,12 @@
Browse
+
+
+
+ Settings
+
+
diff --git a/app/partials/settings.html b/app/partials/settings.html
new file mode 100644
index 0000000..462e626
--- /dev/null
+++ b/app/partials/settings.html
@@ -0,0 +1,85 @@
+
+ Shares
+
+
+
+
+ Name |
+ Path |
+ Size |
+ |
+
+
+
+
+ {{ directory.name }} |
+ {{ directory.path }} |
+ {{ directory.sizeFormatted }} |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file