From 0543a9e9ce9ebcee9ea9f26dfb6e913065d1db5a Mon Sep 17 00:00:00 2001 From: synt-xerror <169557594+synt-xerror@users.noreply.github.com> Date: Fri, 20 Feb 2026 21:30:22 -0300 Subject: [PATCH] idk what am i doing --- neocities.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/neocities.c b/neocities.c index 8da6d20..c6ca441 100644 --- a/neocities.c +++ b/neocities.c @@ -235,3 +235,33 @@ int neocities_upload( *response = resp.data; return 0; } + +// ------------------------- +// key — GET /api/key +// ------------------------- + +int neocities_apikey( + const char *user, + const char *pass, + char **out + +) +{ + CURL *curl; + CURLcode resp; + + char buf[128]; + snprintf(buf, sizeof(buf), "%s:%s", user, pass); + + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &resp); + + CURLcode rc = curl_easy_perform(curl); + if(rc == CURLE_OK) { + *out = resp.data; + } else { + return 1; + } + + return 0; +}