From a564fd0a7a60990fc8bd31ffabb9a33cf9a42f32 Mon Sep 17 00:00:00 2001 From: steckbrief Date: Thu, 4 May 2017 16:23:36 +0200 Subject: storage-backend: Added json interface to list transferred files --- storage-backend/index.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'storage-backend/index.php') diff --git a/storage-backend/index.php b/storage-backend/index.php index d153e63..3707963 100644 --- a/storage-backend/index.php +++ b/storage-backend/index.php @@ -11,7 +11,7 @@ * size * content_type * user_jid - * receipient_jid + * recipient_jid * 403: In case the XMPP Server Key is not valid * 406: * File is empty (error code: 1) @@ -50,6 +50,7 @@ include_once(__DIR__.'/lib/functions.common.inc.php'); include_once(__DIR__.'/lib/functions.http.inc.php'); include_once(__DIR__.'/lib/functions.filetransfer.inc.php'); +include_once(__DIR__.'/lib/xmpp.util.inc.php'); $method = $_SERVER['REQUEST_METHOD']; // Load configuration @@ -74,6 +75,10 @@ switch ($method) { } switch ($slotType) { + case 'list': + $slots = readSlots($userJid); + $result = ['list' => $slots]; + break; case 'delete': // Check if all parameters needed for an delete are present - return 400 (bad request) if a parameter is missing / empty $fileURL = getMandatoryPostParameter('file_url'); @@ -104,7 +109,7 @@ switch ($method) { $filename = rawurlencode(getMandatoryPostParameter('filename')); $filesize = getMandatoryPostParameter('size'); $mimeType = getOptionalPostParameter('content_type'); - $receipientJid = getMandatoryPostParameter('receipient_jid'); + $recipientJid = getMandatoryPostParameter('recipient_jid'); // check file name - return 406 (not acceptable) if file contains invalid characters foreach ($config['invalid_characters_in_filename'] as $invalidCharacter) { @@ -122,7 +127,7 @@ switch ($method) { } // generate slot uuid, register slot uuid and expected file size and expected mime type $slotUUID = generate_uuid(); - registerSlot($slotUUID, $filename, $filesize, $mimeType, $userJid, $receipientJid, $config); + registerSlot($slotUUID, $filename, $filesize, $mimeType, $userJid, $recipientJid, $config); if (!mkdir(getUploadFilePath($slotUUID, $config))) { sendHttpReturnCodeAndJson(500, "Could not create directory for upload."); } -- cgit v1.2.3