mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 13:23:34 -07:00
commit
f5c93e0b4d
5 changed files with 21 additions and 12 deletions
|
@ -50,7 +50,7 @@ HttpResponse AbstractRequestHandler::run()
|
||||||
if (isBanned())
|
if (isBanned())
|
||||||
{
|
{
|
||||||
status(403, "Forbidden");
|
status(403, "Forbidden");
|
||||||
print(QObject::tr("Your IP address has been banned after too many failed authentication attempts."));
|
print(QObject::tr("Your IP address has been banned after too many failed authentication attempts."), CONTENT_TYPE_TXT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,7 +65,8 @@ static const char *__TRANSLATIONS__[] = {
|
||||||
QT_TRANSLATE_NOOP("HttpServer", "Invalid Username or Password."),
|
QT_TRANSLATE_NOOP("HttpServer", "Invalid Username or Password."),
|
||||||
QT_TRANSLATE_NOOP("HttpServer", "Password"),
|
QT_TRANSLATE_NOOP("HttpServer", "Password"),
|
||||||
QT_TRANSLATE_NOOP("HttpServer", "Login"),
|
QT_TRANSLATE_NOOP("HttpServer", "Login"),
|
||||||
QT_TRANSLATE_NOOP("HttpServer", "qBittorrent web User Interface")
|
QT_TRANSLATE_NOOP("HttpServer", "qBittorrent web User Interface"),
|
||||||
|
QT_TRANSLATE_NOOP("HttpServer", "Upload Failed!")
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct { const char *source; const char *comment; } __COMMENTED_TRANSLATIONS__[] = {
|
static const struct { const char *source; const char *comment; } __COMMENTED_TRANSLATIONS__[] = {
|
||||||
|
|
|
@ -40,12 +40,12 @@ const QString HEADER_CONTENT_TYPE = "Content-Type";
|
||||||
const QString HEADER_CONTENT_ENCODING = "Content-Encoding";
|
const QString HEADER_CONTENT_ENCODING = "Content-Encoding";
|
||||||
const QString HEADER_CONTENT_LENGTH = "Content-Length";
|
const QString HEADER_CONTENT_LENGTH = "Content-Length";
|
||||||
|
|
||||||
const QString CONTENT_TYPE_CSS = "text/css";
|
const QString CONTENT_TYPE_CSS = "text/css; charset=UTF-8";
|
||||||
const QString CONTENT_TYPE_GIF = "image/gif";
|
const QString CONTENT_TYPE_GIF = "image/gif";
|
||||||
const QString CONTENT_TYPE_HTML = "text/html";
|
const QString CONTENT_TYPE_HTML = "text/html; charset=UTF-8";
|
||||||
const QString CONTENT_TYPE_JS = "text/javascript";
|
const QString CONTENT_TYPE_JS = "text/javascript; charset=UTF-8";
|
||||||
const QString CONTENT_TYPE_PNG = "image/png";
|
const QString CONTENT_TYPE_PNG = "image/png";
|
||||||
const QString CONTENT_TYPE_TXT = "text/plain";
|
const QString CONTENT_TYPE_TXT = "text/plain; charset=UTF-8";
|
||||||
|
|
||||||
struct HttpEnvironment
|
struct HttpEnvironment
|
||||||
{
|
{
|
||||||
|
|
|
@ -263,11 +263,12 @@ void RequestHandler::action_command_upload()
|
||||||
QBtSession::instance()->addTorrent(filePath);
|
QBtSession::instance()->addTorrent(filePath);
|
||||||
// Clean up
|
// Clean up
|
||||||
fsutils::forceRemove(filePath);
|
fsutils::forceRemove(filePath);
|
||||||
print(QLatin1String("<script type=\"text/javascript\">window.parent.hideAll();</script>"));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qWarning() << "I/O Error: Could not create temporary file";
|
qWarning() << "I/O Error: Could not create temporary file";
|
||||||
|
status(500, "Internal Server Error");
|
||||||
|
print(QObject::tr("I/O Error: Could not create temporary file."), CONTENT_TYPE_TXT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,15 @@
|
||||||
|
|
||||||
function stateChangeHandler() {
|
function stateChangeHandler() {
|
||||||
if (this.readyState == this.DONE) {
|
if (this.readyState == this.DONE) {
|
||||||
if (this.status == 200)
|
if (this.status == 200) {
|
||||||
window.parent.closeWindows();
|
window.parent.closeWindows();
|
||||||
else
|
} else {
|
||||||
alert("Upload Failed!");
|
if (this.responseText != "") {
|
||||||
|
alert(this.responseText);
|
||||||
|
} else {
|
||||||
|
alert("_(Upload Failed!)");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +49,9 @@ window.addEvent('load', function() {
|
||||||
// is XHR2 available?
|
// is XHR2 available?
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
if (xhr.upload)
|
if (xhr.upload)
|
||||||
$('submitbutton').addClass("invisible");
|
$('submitbutton').addClass("invisible");
|
||||||
|
else
|
||||||
|
$('upload_frame').addEvent('load', function(e) { window.parent.closeWindows(); });
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
@ -55,7 +62,7 @@ window.addEvent('load', function() {
|
||||||
<input type="file" id="fileselect" name="fileselect[]" multiple="multiple" /><br/>
|
<input type="file" id="fileselect" name="fileselect[]" multiple="multiple" /><br/>
|
||||||
<div id="submitbutton">
|
<div id="submitbutton">
|
||||||
<button type="submit">_(Upload Torrents)</button>
|
<button type="submit">_(Upload Torrents)</button>
|
||||||
</div
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue