Browse Source

WebUI: Fix WebAPI returned data.

adaptive-webui-19844
Vladimir Golovnev (Glassez) 10 years ago
parent
commit
7b7f88ae4f
  1. 3
      src/webui/extra_translations.h
  2. 3
      src/webui/requesthandler.cpp
  3. 11
      src/webui/www/public/upload.html

3
src/webui/extra_translations.h

@ -65,7 +65,8 @@ static const char *__TRANSLATIONS__[] = { @@ -65,7 +65,8 @@ static const char *__TRANSLATIONS__[] = {
QT_TRANSLATE_NOOP("HttpServer", "Invalid Username or Password."),
QT_TRANSLATE_NOOP("HttpServer", "Password"),
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__[] = {

3
src/webui/requesthandler.cpp

@ -263,11 +263,12 @@ void RequestHandler::action_command_upload() @@ -263,11 +263,12 @@ void RequestHandler::action_command_upload()
QBtSession::instance()->addTorrent(filePath);
// Clean up
fsutils::forceRemove(filePath);
print(QLatin1String("<script type=\"text/javascript\">window.parent.hideAll();</script>"));
}
else
{
qWarning() << "I/O Error: Could not create temporary file";
status(500, "Internal Server Error");
print(QByteArray("I/O Error: Could not create temporary file."), CONTENT_TYPE_TXT);
}
}
}

11
src/webui/www/public/upload.html

@ -9,10 +9,15 @@ @@ -9,10 +9,15 @@
function stateChangeHandler() {
if (this.readyState == this.DONE) {
if (this.status == 200)
if (this.status == 200) {
window.parent.closeWindows();
else
alert("Upload Failed!");
} else {
if (this.responseText != "") {
alert(this.responseText);
} else {
alert("_(Upload Failed!)");
}
}
}
}

Loading…
Cancel
Save