uploads.c: made the syslog less verbose
authorArt Cancro <ajc@citadel.org>
Wed, 13 Dec 2023 22:25:43 +0000 (17:25 -0500)
committerArt Cancro <ajc@citadel.org>
Wed, 13 Dec 2023 22:25:43 +0000 (17:25 -0500)
Also documented the JSON return values in api.txt

webcit-ng/api.txt
webcit-ng/server/upload.c

index 35de78ef313e60d70aebe3a495019c78762438fb..f148f53c5e03fa790ff0b5f87cf0f08f2f30fd14 100644 (file)
@@ -35,5 +35,14 @@ GET             /ctdl/u/<username>/userpic         Returns an image containing t
 GET             /ctdl/s/                           Static content (html, css, js, images...)
 GET             /.well-known/                      Static content (RFC5785 compliant paths)
 POST            /ctdl/p                            Handler for uploading attachments and other file items
+                                                   The JSON returned wil contain one or more uploads in an array like this:
+                                                   [
+                                                     {
+                                                       "uploadfilename" : "Track 01.wav",
+                                                       "contenttype" : "audio/wav",
+                                                       "ref" : "cdarzowkk",
+                                                       "contentlength" : 56222252
+                                                     }
+                                                   ]
 GET             /ctdl/p/<id>                       Fetch a specific item that was uploaded
 DELETE          /ctdl/p/<id>                       Delete a specific item that was uploaded
index 8c3fd44e0c5d12c771cfcb549ee0ccaa748f28a2..6854acf8ae726f4fdb6e3a7ab9421e7f1faa2766 100644 (file)
@@ -16,20 +16,6 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp,
                    void *content, char *cbtype, char *cbcharset,
                    size_t length, char *encoding, char *cbid, void *userdata)
 {
-       syslog(LOG_DEBUG, "upload_handler()");
-       syslog(LOG_DEBUG, "        name: %s", name);
-       syslog(LOG_DEBUG, "    filename: %s", filename);
-       syslog(LOG_DEBUG, " part number: %s", partnum);
-       syslog(LOG_DEBUG, " disposition: %s", disp);
-       syslog(LOG_DEBUG, "content type: %s", cbtype);
-       syslog(LOG_DEBUG, "    char set: %s", cbcharset);
-       syslog(LOG_DEBUG, "      length: %ld", length);
-       syslog(LOG_DEBUG, "    encoding: %s", encoding);
-       syslog(LOG_DEBUG, "          id: %s", cbid);
-       //fprintf(stderr, "\033[31m--------------------------------------------\n");
-       //write(content, length, 1, stderr);    // FIXME
-       //printf(stderr, "--------------------------------------------\033[0m\n");
-
        struct uploaded_file u;
 
        // create a random ID for the attachment
@@ -65,7 +51,6 @@ void upload_handler(char *name, char *filename, char *partnum, char *disp,
 
        for (int i=0; i<array_len(upload_list); ++i) {
                memcpy(&u, array_get_element_at(upload_list, i), sizeof(struct uploaded_file));
-               syslog(LOG_DEBUG, "%d: %s %s", i, u.id, u.filename);
        }
 
        // Create a JSON object describing this upload
@@ -103,6 +88,7 @@ void upload_files(struct http_transaction *h, struct ctdlsession *c) {
        h->response_string = strdup("OK");
        h->response_body_length = StrLength(sj);
        h->response_body = SmashStrBuf(&sj);
+       syslog(LOG_DEBUG, "upload: %s", h->response_body);
 }