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)
+POST /ctdl/p/ Handler for uploading attachments and other file items
// Admin functions
//
-// Copyright (c) 1996-2022 by the citadel.org team
+// Copyright (c) 1996-2023 by the citadel.org team
//
// This program is open source software. Use, duplication, or
// disclosure are subject to the GNU General Public License v3.
biff(h, c);
return;
}
- if (!strcasecmp(h->url, "/ctdl/a/upload")) { // upload files
- upload_files(h, c);
- return;
- }
do_404(h); // unknown
}
case 'u': // /ctdl/u/ == RESTful path to users
ctdl_u(h, c);
break;
+ case 'p': // /ctdl/p/ == RESTful path to upload functions
+ ctdl_p(h, c);
+ break;
default:
do_404(h);
}
// Upload handler
//
-// Copyright (c) 1996-2022 by the citadel.org team
+// Copyright (c) 1996-2023 by the citadel.org team
//
// This program is open source software. Use, duplication, or
// disclosure are subject to the GNU General Public License v3.
h->response_string = strdup("OK");
h->response_body_length = StrLength(sj);
h->response_body = SmashStrBuf(&sj);
-}
\ No newline at end of file
+}
+
+
+// Dispatcher for paths starting with /ctdl/p/
+void ctdl_p(struct http_transaction *h, struct ctdlsession *c) {
+ if (!strcasecmp(h->url, "/ctdl/p/")) { // upload files
+ upload_files(h, c);
+ return;
+ }
+
+ do_404(h); // unknown
+}
void ctdl_f(struct http_transaction *, struct ctdlsession *);
void ctdl_r(struct http_transaction *, struct ctdlsession *);
void ctdl_u(struct http_transaction *, struct ctdlsession *);
+void ctdl_p(struct http_transaction *, struct ctdlsession *);
struct ctdlsession *connect_to_citadel(struct http_transaction *);
void disconnect_from_citadel(struct ctdlsession *);
char *header_val(struct http_transaction *h, char *requested_header);
function upload_file(file) {
- var url = '/ctdl/a/upload';
+ var url = '/ctdl/p/';
var xhr = new XMLHttpRequest();
var formData = new FormData();
xhr.open('POST', url, true);
document.getElementById('ctdl-upload').style.display='none';
// FIXME tell the server to delete the files
uploads=[];
-}
\ No newline at end of file
+}