Checkpoint
This commit is contained in:
@@ -40,7 +40,6 @@
|
||||
#include "util.hpp"
|
||||
#include "HtmlHelper.hpp"
|
||||
#include "WebServerMod.hpp"
|
||||
#include "Tone3000Download.hpp"
|
||||
|
||||
#define OLD_PRESET_EXTENSION ".piPreset"
|
||||
#define PRESET_EXTENSION ".piPreset"
|
||||
@@ -147,10 +146,6 @@ public:
|
||||
}
|
||||
std::string segment = request_uri.segment(1);
|
||||
|
||||
if (segment == "tone3000Upload")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (segment == "downloadMediaFile")
|
||||
{
|
||||
return true;
|
||||
@@ -437,44 +432,6 @@ public:
|
||||
{
|
||||
std::string segment = request_uri.segment(1);
|
||||
|
||||
if (segment == "tone3000Upload")
|
||||
{
|
||||
|
||||
tone3000::Tone3000DownloadResult result;
|
||||
try
|
||||
{
|
||||
fs::path downloadPath = request_uri.query("path");
|
||||
if (downloadPath.empty())
|
||||
{
|
||||
throw std::runtime_error("Invalid query parameters.");
|
||||
}
|
||||
if (!this->model->IsInUploadsDirectory(downloadPath) || HasDotDot(downloadPath))
|
||||
{
|
||||
throw std::runtime_error("Invalid path.");
|
||||
}
|
||||
std::string downloadUrl = request_uri.query("url");
|
||||
uri downloadUri{downloadUrl};
|
||||
if (!downloadUri.authority().ends_with(".tone3000.com"))
|
||||
{
|
||||
throw std::runtime_error("Invalid Tone3000 URL address.");
|
||||
}
|
||||
tone3000::DownloadTone3000Bundle(downloadPath, downloadUrl);
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
result = tone3000::Tone3000DownloadResult(e);
|
||||
}
|
||||
std::ostringstream os;
|
||||
json_writer writer(os);
|
||||
writer.write(&result);
|
||||
std::string strResult = os.str();
|
||||
|
||||
res.set(HttpField::content_type,"application/json");
|
||||
res.set(HttpField::cache_control, "no-cache");
|
||||
res.setBody(strResult);
|
||||
|
||||
return;
|
||||
}
|
||||
if (segment == "downloadMediaFile")
|
||||
{
|
||||
fs::path path = request_uri.query("path");
|
||||
|
||||
Reference in New Issue
Block a user