This repository has been archived on 2021-03-22. You can view files and clone it, but cannot push or open issues or pull requests.
backend/src/main.cpp

65 lines
1.7 KiB
C++

/* This file is part of FediBlock-backend.
* Copyright © 2020 tastytea <tastytea@tastytea.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "cgi.hpp"
#include "json.hpp"
#include <filesystem>
#include <iostream>
using std::cout;
namespace fs = std::filesystem;
using namespace FediBlock;
void print_debug(const entry_type &entry)
{
cout << "\r\n\r\nDEBUG:\r\n";
cout << " Instance: " << entry.instance << "\r\n";
cout << " Tags:";
for (const auto &tag : entry.tags)
{
cout << " " << tag;
}
cout << "\r\n";
cout << " Receipts:";
for (const auto &receipt : entry.receipts)
{
cout << " " << receipt;
}
cout << "\r\n";
cout << " Description: " << entry.description << "\r\n";
cout << " Screenshot: " << entry.screenshot_filepath << "\r\n";
cout << "\r\n\r\nJSON:\r\n";
cout << to_json(entry) << "\r\n";
}
int main()
{
cout << "Content-Type: text/plain; charset=utf-8\r\n\r\n";
cout << "Received and filed to /dev/null. 😝\r\n";
const entry_type entry{parse_formdata()};
print_debug(entry);
fs::remove(entry.screenshot_filepath);
return 0;
}