Cleanup main().
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
b1224b82b5
commit
5c6a6414f2
57
src/main.cpp
57
src/main.cpp
|
@ -34,58 +34,29 @@ using std::to_string;
|
|||
|
||||
using namespace FediBlock;
|
||||
|
||||
void print_debug(const cgi::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 << json::to_json(entry) << "\r\n";
|
||||
|
||||
cout << "\r\n\r\nDATADIR: " << files::get_datadir() << "\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 cgi::entry_type entry{cgi::parse_formdata()};
|
||||
|
||||
// print_debug(entry);
|
||||
|
||||
git_libgit2_init();
|
||||
gitea::init();
|
||||
|
||||
git::clone();
|
||||
git::create_branch();
|
||||
git::commit(entry);
|
||||
git::push();
|
||||
|
||||
gitea::pull_request("web-" + to_string(gitea::get_last_pr_number() + 1),
|
||||
entry);
|
||||
|
||||
cout << "Created pull request: <"
|
||||
<< "https://schlomp.space/FediBlock/data/pulls/"
|
||||
<< gitea::get_last_pr_number() << ">\r\n";
|
||||
|
||||
try
|
||||
{
|
||||
const cgi::entry_type entry{cgi::parse_formdata()};
|
||||
|
||||
git::clone();
|
||||
git::create_branch();
|
||||
git::commit(entry);
|
||||
git::push();
|
||||
|
||||
gitea::pull_request("web-" + to_string(gitea::get_last_pr_number() + 1),
|
||||
entry);
|
||||
|
||||
cout << "Created pull request: <"
|
||||
<< "https://schlomp.space/FediBlock/data/pulls/"
|
||||
<< gitea::get_last_pr_number() << ">\r\n";
|
||||
|
||||
files::remove_tmpdir();
|
||||
}
|
||||
catch (const exception &e)
|
||||
|
|
Reference in New Issue