Merge branch 'master' into fx/doctype

# Conflicts:
#	index.html
This commit is contained in:
slnpacifist 2016-04-27 19:57:48 +08:00
commit 5836df17cb
10 changed files with 287 additions and 76 deletions

View File

@ -11,7 +11,7 @@ aria2c --enable-rpc --rpc-listen-all
```` ````
If aria2 is not installed in your local machine then head on to http://aria2.sourceforge.net/ and follow the instructions there. If aria2 is not installed in your local machine then head on to https://aria2.github.io/ and follow the instructions there.
Then download the webui, you can either do that by downloading this repository and running index.html in the browser. Or you could just head on to http://ziahamza.github.io/webui-aria2/ and just start downloading files! After that you can also save it for offline use by saving from the browser save page as option. Then download the webui, you can either do that by downloading this repository and running index.html in the browser. Or you could just head on to http://ziahamza.github.io/webui-aria2/ and just start downloading files! After that you can also save it for offline use by saving from the browser save page as option.

View File

@ -81,6 +81,7 @@
<script src="js/translate/zh_CN.js"></script> <script src="js/translate/zh_CN.js"></script>
<script src="js/translate/pl_PL.js"></script> <script src="js/translate/pl_PL.js"></script>
<script src="js/translate/fr_FR.js"></script> <script src="js/translate/fr_FR.js"></script>
<script src="js/translate/de_DE.js"></script>
</head> </head>
<!-- }}} --> <!-- }}} -->
@ -149,7 +150,11 @@
href="#" href="#"
ng-click="purgeDownloadResult()"><span class="fa fa-fw fa-times-circle">&nbsp;</span> {{ 'Purge Completed' | translate }}</a> ng-click="purgeDownloadResult()"><span class="fa fa-fw fa-times-circle">&nbsp;</span> {{ 'Purge Completed' | translate }}</a>
</li> </li>
<li>
<a
href="#"
ng-click="shutDownServer()"><span class="fa fa-fw fa-power-off">&nbsp;</span> {{ 'Shutdown Server' | translate }}</a>
</li>
<!-- not adding remove all as requires many rpc syscalls to finish <!-- not adding remove all as requires many rpc syscalls to finish
<li> <li>
<a <a
@ -250,6 +255,11 @@
ng-click="changeLanguage('fr_FR')" ng-click="changeLanguage('fr_FR')"
href="#"><span class="fa fa-fw flag-icon flag-icon-fr">&nbsp;</span> Français</a> href="#"><span class="fa fa-fw flag-icon flag-icon-fr">&nbsp;</span> Français</a>
</li> </li>
<li>
<a
ng-click="changeLanguage('de_DE')"
href="#"><span class="fa fa-fw flag-icon flag-icon-de">&nbsp;</span> Deutsch</a>
</li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -443,7 +453,18 @@
ng-click="showSettings(download)"> ng-click="showSettings(download)">
<span class="fa fa-fw fa-cog"></span> <span class="fa fa-fw fa-cog"></span>
</button> </button>
<button
ng-if="hasStatus(download, 'waiting')"
class="btn btn-default hidden-phone"
ng-click="moveDown(download)">
<span class="fa fa-fw fa-arrow-circle-o-down"></span>
</button>
<button
ng-if="hasStatus(download, 'waiting')"
class="btn btn-default hidden-phone"
ng-click="moveUp(download)">
<span class="fa fa-fw fa-arrow-circle-o-up"></span>
</button>
<div class="btn-group" dropdown> <div class="btn-group" dropdown>
<button class="btn btn-default dropdown-toggle" dropdown-toggle> <button class="btn btn-default dropdown-toggle" dropdown-toggle>
<span class="caret"></span> <span class="caret"></span>

View File

@ -400,6 +400,8 @@ function(
}; };
} }
else { else {
if (ctx.gid !== d.gid)
ctx.files = [];
ctx.dir = d.dir; ctx.dir = d.dir;
ctx.status = d.status; ctx.status = d.status;
ctx.errorCode = d.errorCode; ctx.errorCode = d.errorCode;
@ -588,5 +590,11 @@ function(
return false; return false;
} }
scope.moveDown = function (d) {
rpc.once('changePosition', [d.gid, 1, 'POS_CUR']);
};
scope.moveUp = function (d) {
rpc.once('changePosition', [d.gid, -1, 'POS_CUR']);
};
}]); }]);

View File

@ -137,4 +137,7 @@ angular
translate.use(langkey); translate.use(langkey);
}; };
scope.shutDownServer = function () {
rpc.once('shutdown', []);
};
}]); }]);

View File

@ -35,6 +35,7 @@ webui.config(['$translateProvider', function ($translateProvider) {
.translations('zh_CN', mergeTranslation(translations.zh_CN, translations.en_US)) .translations('zh_CN', mergeTranslation(translations.zh_CN, translations.en_US))
.translations('pl_PL', mergeTranslation(translations.pl_PL, translations.en_US)) .translations('pl_PL', mergeTranslation(translations.pl_PL, translations.en_US))
.translations('fr_FR', mergeTranslation(translations.fr_FR, translations.en_US)) .translations('fr_FR', mergeTranslation(translations.fr_FR, translations.en_US))
.translations('de_DE', mergeTranslation(translations.de_DE, translations.en_US))
.determinePreferredLanguage(); .determinePreferredLanguage();
}]); }]);

View File

@ -43,6 +43,9 @@ function(syscall, globalTimeout, alerts, utils, rootScope, uri, authconf) {
} }
// set if we got error on connection. This will cause another connection attempt.
var needNewConnection = true;
// update is implemented such that // update is implemented such that
// only one syscall at max is ongoing // only one syscall at max is ongoing
// (i.e. serially) so should be private // (i.e. serially) so should be private
@ -57,11 +60,18 @@ function(syscall, globalTimeout, alerts, utils, rootScope, uri, authconf) {
}); });
var subs = subscriptions.slice(); var subs = subscriptions.slice();
if (!subs.length) { if (!subs.length) {
timeout = setTimeout(update, time); timeout = setTimeout(update, globalTimeout);
return; return;
} }
if (configurations.length) { if (syscall.state == 'initializing') {
console.log("Syscall is initializing, waiting");
timeout = setTimeout(update, globalTimeout);
return;
}
if (needNewConnection && configurations.length) {
needNewConnection = false;
currentConf = configurations[0]; currentConf = configurations[0];
if (currentConf && currentConf.auth && currentConf.auth.token) { if (currentConf && currentConf.auth && currentConf.auth.token) {
currentToken = currentConf.auth.token; currentToken = currentConf.auth.token;
@ -70,6 +80,8 @@ function(syscall, globalTimeout, alerts, utils, rootScope, uri, authconf) {
currentToken = null; currentToken = null;
} }
syscall.init(currentConf); syscall.init(currentConf);
timeout = setTimeout(update, globalTimeout);
return;
} }
var params = _.map(subs, function(s) { var params = _.map(subs, function(s) {
@ -84,6 +96,7 @@ function(syscall, globalTimeout, alerts, utils, rootScope, uri, authconf) {
}); });
var error = function() { var error = function() {
needNewConnection = true;
var ind = configurations.indexOf(currentConf); var ind = configurations.indexOf(currentConf);
if (ind != -1) configurations.splice(ind, 1); if (ind != -1) configurations.splice(ind, 1);

View File

@ -28,17 +28,29 @@ function(_, JSON, name, utils, alerts) {
_.each(sockRPC.handles, function(h) { h.error() }); _.each(sockRPC.handles, function(h) { h.error() });
sockRPC.handles = []; sockRPC.handles = [];
sockRPC.initialized = false; sockRPC.initialized = false;
if (sockRPC.onready) {
sockRPC.onready();
sockRPC.onready = null;
}
}, },
onclose: function(ev) { onclose: function(ev) {
if (sockRPC.handles && sockRPC.handles.length) if (sockRPC.handles && sockRPC.handles.length)
sockRPC.onerror('Connection reset while calling aria2'); sockRPC.onerror('Connection reset while calling aria2');
sockRPC.initialized = false; sockRPC.initialized = false;
if (sockRPC.onready) {
sockRPC.onready();
sockRPC.onready = null;
}
}, },
// when connection opens // when connection opens
onopen: function() { onopen: function() {
console.log('websocket initialized!!!'); console.log('websocket initialized!!!');
sockRPC.initialized = true; sockRPC.initialized = true;
if (sockRPC.onready) {
sockRPC.onready();
sockRPC.onready = null;
}
}, },
@ -77,11 +89,18 @@ function(_, JSON, name, utils, alerts) {
}, },
// should be called initially to start using the sock rpc // should be called initially to start using the sock rpc
init: function(conf) { // onready is called when initial connection is resolved
init: function(conf, onready) {
sockRPC.initialized = false; sockRPC.initialized = false;
if (sockRPC.onready) {
// make previous call is resolved
sockRPC.onready();
sockRPC.onready = null;
}
if (typeof WebSocket == "undefined") { if (typeof WebSocket == "undefined") {
alerts.addAlert('Web sockets are not supported! Falling back to JSONP.', 'info'); alerts.addAlert('Web sockets are not supported! Falling back to JSONP.', 'info');
onready();
return; return;
} }
sockRPC.conf = conf || sockRPC.conf; sockRPC.conf = conf || sockRPC.conf;
@ -108,11 +127,13 @@ function(_, JSON, name, utils, alerts) {
sockRPC.sock.onclose = sockRPC.onclose; sockRPC.sock.onclose = sockRPC.onclose;
sockRPC.sock.onerror = sockRPC.onerror; sockRPC.sock.onerror = sockRPC.onerror;
sockRPC.sock.onmessage = sockRPC.onmessage; sockRPC.sock.onmessage = sockRPC.onmessage;
sockRPC.onready = onready;
} }
catch (ex) { catch (ex) {
// ignoring IE securty exception on local ip addresses // ignoring IE security exception on local ip addresses
console.log('not using websocket for aria2 rpc due to: ', ex); console.log('not using websocket for aria2 rpc due to: ', ex);
alerts.addAlert('Web sockets not working due to ' + ex.message, 'info'); alerts.addAlert('Web sockets not working due to ' + ex.message, 'info');
onready();
} }
}, },
}; };

View File

@ -6,6 +6,7 @@ angular
.factory('$syscall', ['$log', '$jsoncall', '$sockcall', '$alerts', .factory('$syscall', ['$log', '$jsoncall', '$sockcall', '$alerts',
function(log, jsonRPC, sockRPC, alerts) { function(log, jsonRPC, sockRPC, alerts) {
return { return {
state: 'none',
// called to initialize the rpc interface, call everytime configuration changes // called to initialize the rpc interface, call everytime configuration changes
// conf has the following structure: // conf has the following structure:
// { // {
@ -18,8 +19,14 @@ function(log, jsonRPC, sockRPC, alerts) {
// pass (string): password for the http authentication if enabled // pass (string): password for the http authentication if enabled
// } // }
init: function(conf) { init: function(conf) {
console.log("Syscall is initializing to", conf);
this.state = 'initializing';
jsonRPC.init(conf); jsonRPC.init(conf);
sockRPC.init(conf); var syscall = this;
sockRPC.init(conf, function() {
console.log("Syscall is ready");
syscall.state = 'ready';
});
}, },
// call this to start an rpc call, opts has the following structure: // call this to start an rpc call, opts has the following structure:

136
js/translate/de_DE.js Normal file
View File

@ -0,0 +1,136 @@
if(typeof translations == 'undefined'){
translations = {};
}
translations.de_DE = {
// header
'Search': 'Suche',
// Nav menu
'Add': 'Hinzufügen',
'By URIs': 'mit URIs',
'By Torrents': 'mit Torrents',
'By Metalinks': 'mit Metalinks',
'Manage': 'Verwalten',
'Pause All': 'Alle anhalten',
'Resume Paused': 'Angehaltene fortsetzen',
'Purge Completed': 'Fertige entfernen',
'Settings': 'Einstellungen',
'Connection Settings': 'Verbindungseinstellungen',
'Global Settings': 'Globale Einstellungen',
'Server info': 'Server Information',
'About and contribute': 'Über webui-aria2',
'Toggle navigation': 'Navigation an/ausschalten',
// body
// nav side bar
'Miscellaneous': 'Verschiedenes',
'Global Statistics': 'Globale Statistiken',
'About': 'Über',
'Displaying': 'Anzeige',
'of': 'von',
'downloads': 'Downloads',
'Language': 'Sprache',
// download filters
'Download Filters': 'Download Filter',
'Running': 'Laufende',
'Active': 'Aktive',
'Waiting': 'Wartende',
'Complete': 'Fertige',
'Error': 'Fehler',
'Paused': 'Angehaltene',
'Removed': 'Gelöschte',
'Hide linked meta-data': 'Blende verlinkte Meta-Daten aus',
'Displaying': 'Anzeige',
'of': 'von',
'downloads': 'Downloads',
'Toggle': 'Umschalten',
'Reset filters': 'Filter zurücksetzen',
// starred properties
'Quick Access Settings': 'Ausgewählte Einstellungen',
'Save settings': 'Einstellungen speichern',
'Currently no download in line to display, use the': 'Aktuell sind keine Downloads vorhanden, bitte benutz den',
'download button to start downloading files!': 'Download Link um den Download von Dateien zu beginnen!',
'Peers': 'Peers',
'More Info': 'Mehr Infos',
'Remove': 'Entfernen',
'# of': '# von',
'Length': 'Länge',
// modals
'Add Downloads By URIs': 'Downloads anhand von URIs hinzufügen',
'- You can add multiple downloads (files) at the same time by putting URIs for each file on a separate line.':
'- Es können mehrere Downloads (Dateien) gleichzeitig hinzugefügt werden, indem jede URI in eine separate Zeile eingegeben wird.',
'- You can also add multiple URIs (mirrors) for the *same* file. To do this, separate the URIs by a space.':
'- Es können auch mehrere URIs (Spiegelserver) für *dieselbe* Datei durch Leerzeichen getrennt angegeben werden.',
'- A URI can be HTTP(S)/FTP/BitTorrent-Magnet.': '- Eine URI kann folgende Protokolle besitzen: HTTP(S)/FTP/BitTorrent-Magnet.',
'E.g. to add 2 files (downloads) f1.jpg and f2.mp4 with 2 URIs (mirrors) each, add URIs as follows':
'Um z.B. 2 Dateien (Downloads) f1.jpg und f2.mp4 mit jeweis einem zweiten Spiegelserver herunterzuladen, kann folgendes angegeben werden',
'Download settings': 'Download Einstellungen',
'Advanced settings': 'Erweiterte Einstellungen',
'Cancel': 'Abbrechen',
'Start': 'Beginnen',
'Choose': 'Auswählen',
'Quick Access (shown on the main page)': 'Schnellzugriff (Anzeige auf der Hauptseite)',
// add torrent modal
'Add Downloads By Torrents': 'Downloads mit Torrents hinzufügen',
'- Select the torrent from the local filesystem to start the download.': '- Wähle ein Torrent vom lokalen Dateisystem um den Download zu starten',
'- You can select multiple torrents to start multiple downloads.': '- Es können mehrere Torrents ausgewählt werden um mehrere Downloads zu starten',
'- To add a BitTorrent-Magnet URL, use the Add By URI option and add it there.': '- Für BitTorrent-Magnet URLs benutz die Option \'Mit URIs hinzufügen\'',
'Select Torrents': 'Wähle Torrents',
'Select a Torrent': 'Wähle ein Torrent',
// add metalink modal
'Add Downloads By Metalinks': 'Download mit Metalinks hinzufügen',
'Select Metalinks': 'Wähle Metalinks',
'- Select the Metalink from the local filesystem to start the download.': '- Wähle ein Metalink vom lokalen Dateisystem um den Download zu starten',
'- You can select multiple Metalinks to start multiple downloads.': '- Es können mehrere Metalinks ausgewählt werden um mehrere Downloads zu starten',
'Select a Metalink': 'Wähle einen Metalink',
// select file modal
'Choose files to start download for': 'Wähle Dateien für den Download aus',
'Select to download': 'Wähle zum Download',
// settings modal
'Aria2 RPC host and port': 'Aria2 RPC host und port',
'Enter the host': 'Host',
'Enter the IP or DNS name of the server on which the RPC for Aria2 is running (default: localhost)':
'Gib die IP oder den DNS Namen des Servers ein, auf dem Aria2 läuft und mit dem du eine RPC-Verbindung etablieren willst (Standard: localhost)',
'Enter the port': 'Port',
'Enter the port of the server on which the RPC for Aria2 is running (default: 6800)':
'Gib den Port des Servers ein, auf dem der RPC-Dienst von Aria2 läuft (Standard: 6800)',
'Enter the RPC path': 'RPC Pfad',
'Enter the path for the Aria2 RPC endpoint (default: /jsonrpc)': 'Gib den Pfad zum Aria2 RPC Endpunkt an (Standard: /jsonrpc)',
'SSL/TLS encryption': 'SSL/TLS',
'Enable SSL/TLS encryption': 'Aktiviere SSL/TLS Verschlüsselung',
'Enter the secret token (optional)': 'Secret Token (optional)',
'Enter the Aria2 RPC secret token (leave empty if authentication is not enabled)':
'Gib den Aria2 RPC secret Token ein (leer lassen falls keine Authentifizierung aktiv)',
'Enter the username (optional)': 'Benutzername (optional)',
'Enter the Aria2 RPC username (empty if authentication not enabled)':
'Gib den Aria2 RPC Benutzernamen ein (leer lassen falls keine Authentifizierung aktiv)',
'Enter the password (optional)': 'Passwort (optional)',
'Enter the Aria2 RPC password (empty if authentication not enabled)': 'Gib das Aria2 RPC Passwort ein (leer lassen falls keine Authentifizierung aktiv)',
'Enter base URL (optional)': 'Base URL (optional)',
'Direct Download': 'Direkter Download',
'If supplied, links will be created to enable direct download from the Aria2 server.':
'Falls angegeben, werden Links erstellt um einen direkten Download vom Aria2 Server zu ermöglichen',
'(Requires appropriate webserver to be configured.)': '(Es wird ein entsprechend konfigurierter WebServer benötigt.)',
'Save Connection configuration': 'Speichern der Verbindungseinstellung',
// server info modal
'Aria2 server info': 'Aria2 Server Info',
'Aria2 Version': 'Aria2 Version',
'Features Enabled': 'Aktive Funktionen',
// about modal
'To download the latest version of the project, add issues or to contribute back, head on to':
'Um die neuste Version des Projects zu laden, Fehler zu melden oder sich zu beteiligen, besuch',
'Or you can open the latest version in the browser through': 'Oder du kannst die neueste Version direkt in deinem Browser verwenden',
'Close': 'Schließen',
// lables
'Download status':'Download Status',
'Download Speed':'Download Geschwindigkeit',
'Upload Speed':'Upload Geschwindigkeit',
'Estimated time':'Geschätzte Zeit',
'Download Size':'Download Größe',
'Downloaded':'Heruntergeladen',
'Progress':'Fortschritt',
'Download Path':'Download Pfad',
'Uploaded':'Hochgeladen',
'Download GID':'Download GID',
'Number of Pieces':'Anzahl der Stücken',
'Piece Length':'Größe der Stücken'
};

View File

@ -132,5 +132,6 @@ translations.en_US = {
'Uploaded':'Uploaded', 'Uploaded':'Uploaded',
'Download GID':'Download GID', 'Download GID':'Download GID',
'Number of Pieces':'Number of Pieces', 'Number of Pieces':'Number of Pieces',
'Piece Length':'Piece Length' 'Piece Length': 'Piece Length',
'Shutdown Server': 'Shutdown Server'
}; };