From 0d12ce7dcd919598b30763b074799d2eabb2592f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Tue, 15 Feb 2022 17:38:01 +0100 Subject: [PATCH] fix update period --- src/bash/filter.sh | 9 +++++++-- src/cpp/jirafeauAPI.cpp | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/bash/filter.sh b/src/bash/filter.sh index 1662b11..6934383 100644 --- a/src/bash/filter.sh +++ b/src/bash/filter.sh @@ -79,6 +79,11 @@ MAIL_SOURCE=$(echo $@ | awk 'BEGIN{FS=" "} {print $2}') DATE_TEMPS=$(date "+%Y-%m-%d-%H:%M:%S") REP_PIECE_JOINTE="${MAILS}/${DATE_TEMPS}_${MAIL_SOURCE}_$$" TRACK=$(curl "${JIRAFEAU_LOCAL}/a.php?r=${MAIL_SOURCE}" 2>/dev/null) +PERIOD=$(curl "${JIRAFEAU_LOCAL}/a.php?p=${MAIL_SOURCE}" 2>/dev/null) +if [ -n "$(echo "${PERIOD}" | grep -e minute -e hour -e day -e week -e month -e quarter 2>/dev/null)" ]; then + JIRAFEAU_TIME="${PERIOD}" +fi + cd "${INSPECT_DIR}" || { echo "${INSPECT_DIR} does not exist"; exit "${EX_TEMPFAIL}"; } # lien renvoyé par le téléverssement @@ -135,8 +140,8 @@ LOG_FIC "${SHRINK_CMD} -s ${MAX_KEEP_IN_MAIL} -d ${REP_PIECE_JOINTE} ${INSPECT_D # Etape de televersement des pieces jointes PASSWORD=$(apg -n 1 -m 12) PASSWORD_MD5=$(echo -n ${PASSWORD} | ${MD5_CMD} | cut -d \ -f 1) - LOG_FIC " - \"${JIRAFEAU_CMD}\" -f \"${JIRAFEAU_LOCAL}\" -s \"${MAX_UPLOAD_SIZE}\" -c \"${ATTACH_CONTENT_TYPE}\" -n \"${ATTACH_NAME}\" send \"${ATTACH_MEDIA}\" \"${PASSWORD}\" 2>> \"${FIC_LOG}\" > \"${ONE_LINK}\"" - "${JIRAFEAU_CMD}" -f "${JIRAFEAU_LOCAL}" -s "${MAX_UPLOAD_SIZE}" -c "${ATTACH_CONTENT_TYPE}" -n "${ATTACH_NAME}" send "${ATTACH_MEDIA}" "${PASSWORD}" 2>> "${FIC_LOG}" > "${ONE_LINK}" + LOG_FIC " - \"${JIRAFEAU_CMD}\" -f \"${JIRAFEAU_LOCAL}\" -t \"${JIRAFEAU_TIME}\"-s \"${MAX_UPLOAD_SIZE}\" -c \"${ATTACH_CONTENT_TYPE}\" -n \"${ATTACH_NAME}\" send \"${ATTACH_MEDIA}\" \"${PASSWORD}\" 2>> \"${FIC_LOG}\" > \"${ONE_LINK}\"" + "${JIRAFEAU_CMD}" -f "${JIRAFEAU_LOCAL}" -t "${JIRAFEAU_TIME}" -s "${MAX_UPLOAD_SIZE}" -c "${ATTACH_CONTENT_TYPE}" -n "${ATTACH_NAME}" send "${ATTACH_MEDIA}" "${PASSWORD}" 2>> "${FIC_LOG}" > "${ONE_LINK}" cat "${ONE_LINK}" | { read JIR_TOKEN read JIR_CODE diff --git a/src/cpp/jirafeauAPI.cpp b/src/cpp/jirafeauAPI.cpp index a938a2a..488cb50 100644 --- a/src/cpp/jirafeauAPI.cpp +++ b/src/cpp/jirafeauAPI.cpp @@ -124,6 +124,7 @@ main (int argc, char** argv) { urlBase ("http://file.kaz.bzh"), apiPage ("/script.php"), downloadPage ("/f.php"), + updatePage ("/a.php"), minimumAvailability ("month"), proxy; @@ -264,8 +265,8 @@ main (int argc, char** argv) { break; case UPDATE: { - LOG ("UPDATE: " << (urlBase+downloadPage)); - curl_easy_setopt (easyhandle, CURLOPT_URL, (urlBase+downloadPage).c_str ()); + LOG ("UPDATE: " << (urlBase+updatePage)); + curl_easy_setopt (easyhandle, CURLOPT_URL, (urlBase+updatePage).c_str ()); LOG ("h: " << inputFileName); part = curl_mime_addpart (multipart);