// #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include "common.h" // clang-format off /* { "projectId": 64525, "handle": "nabijaczleweli", "displayName": "наб", "dek": "", "description": "Dazed and confused, but trying to continue 🇵🇱/🏴/🇷🇺 ⚧ they\r\n\r\nMaintains homie/hoe stasis. Store horizontally when not in use. Contains sulfites.", "avatarURL": "https://staging.cohostcdn.org/avatar/64525-86aae4bf-ce4c-46c4-818f-62b37dc26506-profile.png", "avatarPreviewURL": "https://staging.cohostcdn.org/avatar/64525-86aae4bf-ce4c-46c4-818f-62b37dc26506-profile.png", "headerURL": "https://staging.cohostcdn.org/header/64525-35de9d6d-d833-4c3e-89c3-4b0ad3e04709-profile.jpg", "headerPreviewURL": "https://staging.cohostcdn.org/header/64525-35de9d6d-d833-4c3e-89c3-4b0ad3e04709-profile.jpg", "privacy": "public", "url": "https://nabijaczleweli.xyz/", "pronouns": "", "flags": [], "avatarShape": "roundrect", "loggedOutPostVisibility": "public", "frequentlyUsedTags": [ "big yellow", "grey", "splotchy", "voreutils", "tzpfms", "ratrun", "wg14" ], "askSettings": { "enabled": false, "allowAnon": false, "requireLoggedInAnon": true }, "contactCard": [] } */ // clang-format on struct profile { unsigned projectId; // 64525, std::string handle; // "nabijaczleweli", std::string displayName; // "наб", std::string dek; // "", std::string description; // "Dazed and confused, but trying to continue 🇵🇱/🏴/🇷🇺 ⚧ they\r\n\r\nMaintains homie/hoe stasis. Store horizontally when not in // use. Contains sulfites.", std::string avatarURL; // "https://staging.cohostcdn.org/avatar/64525-86aae4bf-ce4c-46c4-818f-62b37dc26506-profile.png", std::string headerURL; // "https://staging.cohostcdn.org/header/64525-35de9d6d-d833-4c3e-89c3-4b0ad3e04709-profile.jpg", std::string privacy; // "public", std::string url; // "https://nabijaczleweli.xyz/", std::string pronouns; // "", std::string avatarShape; // "roundrect", std::string loggedOutPostVisibility; // "public", std::vector frequentlyUsedTags; // ["big yellow", "grey", "splotchy", "voreutils", "tzpfms", "ratrun", "wg14"], }; NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(profile, projectId, handle, displayName, dek, description, avatarURL, headerURL, privacy, url, pronouns, avatarShape, loggedOutPostVisibility, frequentlyUsedTags) int main() { int memfd = memfd_create(__FILE__, 0); auto p = json::parse(stdin).template get(); htmlencode(p.description); p.description.erase(std::remove(std::begin(p.description), std::end(p.description), '\r'), std::end(p.description)); if(p.displayName.empty()) p.displayName = p.handle; std::string profile_url = uid_maps.at(p.projectId) ?: (std::string("//cohost.org/") += p.handle); printf("\"\"\n", p.headerURL.data()); printf("
\n", p.handle.data()); printf("
\n"); printf("
\n"); printf(" \"\"\n", profile_url.data(), p.avatarURL.data()); printf("
\n"); printf("

%s

\n", profile_url.data(), p.displayName.data()); printf("
@%s
\n", profile_url.data(), p.handle.data()); printf(" %1$s\n", p.url.data()); printf("
\n"); printf("
\n"); markdownise(p.description, 0, memfd); printf("
\n"); printf(" \n"); printf("
\n"); }