From 6ff05f11ffcce75d0e6f78ed111f52ddd8cf9541 Mon Sep 17 00:00:00 2001 From: tastytea Date: Mon, 22 Apr 2019 09:59:24 +0200 Subject: [PATCH] Added atom:link to own URL. --- src/write.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/write.cpp b/src/write.cpp index fc02279..2c7d078 100644 --- a/src/write.cpp +++ b/src/write.cpp @@ -15,6 +15,7 @@ */ #include +#include #include "version.hpp" #include "gitea2rss.hpp" @@ -41,8 +42,31 @@ void write_line(const uint8_t spaces, const string &tag, const string &value) void write_preamble(const string &url, const string &type) { - cout << "\n" + const char *request_uri = std::getenv("REQUEST_URI"); + const char *server_name = std::getenv("SERVER_NAME"); + const char *https = getenv("HTTPS"); + string selfurl; + + if (request_uri != nullptr && server_name != nullptr) + { + if (https != nullptr && string(https) == "on") + { + selfurl = "https://"; + } + else + { + selfurl = "http://"; + } + selfurl += string(server_name) + request_uri; + } + + cout << "\n" " \n"; + if (cgi) + { + cout << " \n"; + } write_line(4, "title", get_project(url) + " " + type); write_line(4, "link", url);