Merge pull request #12 from chillout2k/devel

cosmetics
This commit is contained in:
Dominik Chilla 2020-01-17 19:20:06 +01:00 committed by GitHub
commit 4d9e7c4efb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 20 deletions

View File

@ -18,7 +18,7 @@ curl -v -s http://127.0.0.1:9090/api/v1/quarmails?rfc822_message=1 | jq
curl -v -s -G --data-urlencode 'filters={"groupOp":"OR","rules":[{"field":"hdr_subject","op":"eq","data":"996 test from quar mit sync xyz"}]}' http://127.0.0.1:9090/api/v1/quarmails | jq curl -v -s -G --data-urlencode 'filters={"groupOp":"OR","rules":[{"field":"hdr_subject","op":"eq","data":"996 test from quar mit sync xyz"}]}' http://127.0.0.1:9090/api/v1/quarmails | jq
``` ```
## update a QuarMail´s metadata (e.g. sandbox_results) by ID ## update metadata of a QuarMail (e.g. sandbox_results) by ID
``` ```
curl -v -s -X PATCH -d '{"cf_meta":"12345abc"}' http://127.0.0.1:9090/api/v1/quarmails/311|jq curl -v -s -X PATCH -d '{"cf_meta":"12345abc"}' http://127.0.0.1:9090/api/v1/quarmails/311|jq
``` ```
@ -28,17 +28,17 @@ curl -v -s http://127.0.0.1:9090/api/v1/quarmails?rfc822_message=1 | jq
curl -v -s -X DELETE http://127.0.0.1:9090/api/v1/quarmails/141 | jq curl -v -s -X DELETE http://127.0.0.1:9090/api/v1/quarmails/141 | jq
``` ```
## get a QuarMail´s metadata by ID ## get metadata of a QuarMail by ID
``` ```
curl -v -s http://127.0.0.1:9090/api/v1/quarmails/136 | jq curl -v -s http://127.0.0.1:9090/api/v1/quarmails/136 | jq
``` ```
## get a QuarMail´s metadata by ID + RFC822 message ## get metadata of a QuarMail by ID + RFC822 message
``` ```
curl -v -s http://127.0.0.1:9090/api/v1/quarmails/136?rfc822_message=1 | jq curl -v -s http://127.0.0.1:9090/api/v1/quarmails/136?rfc822_message=1 | jq
``` ```
## get a QuarMail´s metadata by ID + RFC822 message headers ## get metadata of a QuarMail by ID + RFC822 message headers
``` ```
curl -v -s http://127.0.0.1:9090/api/v1/quarmails/136?headers=1 | jq curl -v -s http://127.0.0.1:9090/api/v1/quarmails/136?headers=1 | jq
``` ```
@ -58,17 +58,17 @@ curl -v -s http://127.0.0.1:9090/api/v1/quarmails/136/uris | jq
curl -v -s http://127.0.0.1:9090/api/v1/quarmails/136/uris/249 | jq curl -v -s http://127.0.0.1:9090/api/v1/quarmails/136/uris/249 | jq
``` ```
## get all attachments metadata of a QuarMail ## get metadata of all attachments QuarMail-ID
``` ```
curl -v -s http://127.0.0.1:9090/api/v1/quarmails/136/attachments | jq curl -v -s http://127.0.0.1:9090/api/v1/quarmails/136/attachments | jq
``` ```
## get an attachments metadata of a QuarMail by ID ## get metadata of an attachments by ID (quarmail + attachment)
``` ```
curl -v -s http://127.0.0.1:9090/api/v1/quarmails/136/attachments/71 | jq curl -v -s http://127.0.0.1:9090/api/v1/quarmails/136/attachments/71 | jq
``` ```
## get an attachments metadata of a QuarMail by ID + attachment data ## get metadata of an attachment by ID (quarmail + attachment) + attachment data
``` ```
curl -v -s http://127.0.0.1:9090/api/v1/quarmails/136/attachments/71?data=1 | jq curl -v -s http://127.0.0.1:9090/api/v1/quarmails/136/attachments/71?data=1 | jq
``` ```

View File

@ -139,7 +139,6 @@ class Gulag:
r5321_rcpts = email.header.decode_header( r5321_rcpts = email.header.decode_header(
msg['X-Envelope-To-Blocked'])[0][0] msg['X-Envelope-To-Blocked'])[0][0]
except: except:
# TODO: move_message to INBOX.failed
logging.warning(whoami(self) + logging.warning(whoami(self) +
"Failed to extract envelope recipients! Moving message to failed folder!" "Failed to extract envelope recipients! Moving message to failed folder!"
) )
@ -149,7 +148,6 @@ class Gulag:
try: try:
r5322_from = email.header.decode_header(msg['From'])[0][0] r5322_from = email.header.decode_header(msg['From'])[0][0]
except: except:
# TODO: move_message to INBOX.failed
logging.warning(whoami(self) + logging.warning(whoami(self) +
"Failed to extract from header! Moving message to failed folder!" "Failed to extract from header! Moving message to failed folder!"
) )
@ -214,7 +212,7 @@ class Gulag:
# attachments (parts with a name/filename attribute) # attachments (parts with a name/filename attribute)
for part in msg.walk(): for part in msg.walk():
if part.get_filename(): if part.get_filename():
# ist ein Attachment # is an Attachment
filename = email.header.decode_header(part.get_filename()) filename = email.header.decode_header(part.get_filename())
if filename[0][1]: if filename[0][1]:
# filename is encoded # filename is encoded

View File

@ -11,7 +11,8 @@ def extract_uris(input_text):
for m in re.finditer(uri_pattern, input_text): for m in re.finditer(uri_pattern, input_text):
uri = urllib.parse.unquote(m.group(0)) uri = urllib.parse.unquote(m.group(0))
uris[uri] = {} uris[uri] = {}
# extract sub-URIs (google redirector: https://www.google.de/url?sa=t&url=...) # extract sub-URIs like google´s redirector:
# https://www.google.de/url?sa=t&url=...
for m2 in re.finditer(suburi_pattern, uri): for m2 in re.finditer(suburi_pattern, uri):
suburi = urllib.parse.unquote(m2.group(1)) suburi = urllib.parse.unquote(m2.group(1))
uris[suburi] = {"suburi": True} uris[suburi] = {"suburi": True}

View File

@ -3,7 +3,6 @@
BRANCH="$(/usr/bin/git branch|/bin/grep \*|/usr/bin/awk {'print $2'})" BRANCH="$(/usr/bin/git branch|/bin/grep \*|/usr/bin/awk {'print $2'})"
VERSION="$(/bin/cat VERSION)" VERSION="$(/bin/cat VERSION)"
BASEOS="$(/bin/cat BASEOS)" BASEOS="$(/bin/cat BASEOS)"
#REGISTRY="some-registry.invalid"
GO="" GO=""
while getopts g opt while getopts g opt
@ -21,16 +20,8 @@ fi
IMAGES="gulag-server gulag-db" IMAGES="gulag-server gulag-db"
# --build-arg http_proxy=http://wprx-zdf.zwackl.local:3128 \
# --build-arg https_proxy=http://wprx-zdf.zwackl.local:3128 \
for IMAGE in ${IMAGES}; do for IMAGE in ${IMAGES}; do
/usr/bin/docker build \ /usr/bin/docker build \
-t "${IMAGE}/${BASEOS}:${VERSION}_${BRANCH}" \ -t "${IMAGE}/${BASEOS}:${VERSION}_${BRANCH}" \
-f "docker/${IMAGE}/${BASEOS}/Dockerfile" . -f "docker/${IMAGE}/${BASEOS}/Dockerfile" .
# /usr/bin/docker tag "${IMAGE}/${BASEOS}:${VERSION}_${BRANCH}" "${REGISTRY}/${IMAGE}/${BASEOS}:${VERSION}_${BRANCH}"
done done
#/bin/echo "Push images to registry:"
#for IMAGE in ${IMAGES}; do
# /bin/echo "/usr/bin/docker push ${REGISTRY}/${IMAGE}/${BASEOS}:${VERSION}_${BRANCH}"
#done