upload.c: stub function for accepting uploads
authorArt Cancro <ajc@citadel.org>
Tue, 26 Sep 2023 02:13:59 +0000 (22:13 -0400)
committerArt Cancro <ajc@citadel.org>
Tue, 26 Sep 2023 02:13:59 +0000 (22:13 -0400)
webcit-ng/README.md
webcit-ng/api.txt
webcit-ng/server/admin_functions.c
webcit-ng/server/webcit.h
webcit-ng/static/js/view_mail.js

index 442d40e31ed46686237c0b8a2088a5d008f1bcda..95ab1f80e9bf8db25b4f0c18b957dfd598d8d50b 100644 (file)
@@ -20,7 +20,7 @@ REST format URLs will generally take the form of:
   /ctdl/objectClass/[container/]object[/operation]
 
 ## We are using
-* libcitadel for information about the Citadel server, some string handling, and the JSON encoder
+* libcitadel for Citadel server tooling, string handling, JSON encoder, MIME parser
 * Expat for DAV handling
 * OpenSSL for TLS
 * FontAwesome for icons
index 3182f4c20bcf8e4e3e3e415afa2b6794f3078395..97ae9c0d571158934d06be339b01f449546b87a5 100644 (file)
@@ -30,6 +30,8 @@ GET             /ctdl/r/ROOMNAME/slrp           Set the "Last Read Pointer" for
 GET             /ctdl/c/info                    Returns a JSON representation of the output of an INFO server command
 POST            /ctdl/a/login                   Send it a your credentials and it will log you in
 GET             /ctdl/a/whoami
+GET            /ctdl/a/biff                    Check for new mail
+POST           /ctdl/a/upload                  Handler for uploading attachments and other file items
 GET             /ctdl/u/USERNAME/userpic        Returns an image containing the photo/avatar of the specified user
 GET             /ctdl/s/                        Static content (html, css, js, images...)
 GET             /.well-known/                   Static content (RFC5785 compliant paths)
index 1d193cf9b3becf29c84d23d69109315fafa07c6f..61afb48b122e06291aa8a4efe3681112d537fc18 100644 (file)
@@ -120,6 +120,10 @@ void ctdl_a(struct http_transaction *h, struct ctdlsession *c) {
                biff(h, c);
                return;
        }
+       if (!strcasecmp(h->url, "/ctdl/a/upload")) {    // upload files
+               upload_files(h, c);
+               return;
+       }
 
        do_404(h);                                      // unknown
 }
index 1304100dd24d0440ef6ab791499151b9e3250e4d..c9ce2913293412f5d7534a27cabc4c25fb127255 100644 (file)
@@ -168,3 +168,4 @@ void ctdl_printf(struct ctdlsession *ctdl, const char *format,...);
 int webcit_tcp_server(const char *ip_addr, int port_number, int queue_len);
 void UrlizeText(StrBuf* Target, StrBuf *Source, StrBuf *WrkBuf);
 void json_render_one_message(struct http_transaction *h, struct ctdlsession *c, long msgnum);
+void upload_files(struct http_transaction *h, struct ctdlsession *c);
index 2e05f7d6df7516643dadf8e0c33460613c33dde8..819a9e3971e0ed52a999d60679af1c15160edb4c 100644 (file)
@@ -595,7 +595,7 @@ function handleFiles(files) {
 
 
 function uploadFile(file) {
-       var url = '/ctdl/zzz/attach_it;'
+       var url = '/ctdl/a/upload';
        var xhr = new XMLHttpRequest();
        var formData = new FormData();
        xhr.open('POST', url, true);