Compare commits
No commits in common. "abef0a0b17267ea91f1716670e10f3b4810da5aa" and "40b26899529a372ad35491dd6d3a540bbe7c3bd2" have entirely different histories.
abef0a0b17
...
40b2689952
|
@ -19,7 +19,6 @@ type InboxSearch struct {
|
||||||
From string
|
From string
|
||||||
Body string
|
Body string
|
||||||
Subject string
|
Subject string
|
||||||
Headers map[string]string
|
|
||||||
After time.Time
|
After time.Time
|
||||||
Before time.Time
|
Before time.Time
|
||||||
}
|
}
|
||||||
|
@ -150,38 +149,6 @@ func HandleGetInbox(ctx context.Context, qry cqrs.Query) (interface{}, error) {
|
||||||
match = false
|
match = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if req.Search.Headers != nil {
|
|
||||||
found := false
|
|
||||||
|
|
||||||
for searchKey, searchValue := range req.Search.Headers {
|
|
||||||
for headerKey, headerValues := range eml.Headers {
|
|
||||||
if searchKey != headerKey {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, hv := range headerValues {
|
|
||||||
if strings.Contains(hv, searchValue) {
|
|
||||||
found = true
|
|
||||||
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if found {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if found {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if !found {
|
|
||||||
match = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if match {
|
if match {
|
||||||
filtered = append(filtered, eml)
|
filtered = append(filtered, eml)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package route
|
package route
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
@ -76,16 +75,6 @@ func createInboxQueryFromRequest(r *http.Request) (*query.GetInboxRequest, error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var headers map[string]string
|
|
||||||
|
|
||||||
rawHeaders := r.URL.Query().Get("headers")
|
|
||||||
if rawHeaders != "" {
|
|
||||||
headers = make(map[string]string)
|
|
||||||
if err := json.Unmarshal([]byte(rawHeaders), &headers); err != nil {
|
|
||||||
return nil, errors.WithStack(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
search := &query.InboxSearch{}
|
search := &query.InboxSearch{}
|
||||||
if to != "" {
|
if to != "" {
|
||||||
search.To = to
|
search.To = to
|
||||||
|
@ -107,10 +96,6 @@ func createInboxQueryFromRequest(r *http.Request) (*query.GetInboxRequest, error
|
||||||
search.Before = before
|
search.Before = before
|
||||||
}
|
}
|
||||||
|
|
||||||
if rawHeaders != "" {
|
|
||||||
search.Headers = headers
|
|
||||||
}
|
|
||||||
|
|
||||||
inboxRequest := &query.GetInboxRequest{
|
inboxRequest := &query.GetInboxRequest{
|
||||||
OrderBy: orderBy,
|
OrderBy: orderBy,
|
||||||
Reverse: reverse == "y",
|
Reverse: reverse == "y",
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
@baseURL = http://localhost:8080
|
|
||||||
|
|
||||||
### Filter emails via headers
|
|
||||||
|
|
||||||
GET {{ baseURL }}/api/v1/emails?headers={"Mime-Version":"1.0"}
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM golang:1.17 AS build
|
FROM golang:1.15 AS build
|
||||||
|
|
||||||
ARG HTTP_PROXY=
|
ARG HTTP_PROXY=
|
||||||
ARG HTTPS_PROXY=
|
ARG HTTPS_PROXY=
|
||||||
|
@ -7,7 +7,7 @@ ARG https_proxy=
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y build-essential git bash curl
|
RUN apt-get update && apt-get install -y build-essential git bash curl
|
||||||
|
|
||||||
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - \
|
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - \
|
||||||
&& apt-get install -y nodejs
|
&& apt-get install -y nodejs
|
||||||
|
|
||||||
COPY . /src
|
COPY . /src
|
||||||
|
|
Loading…
Reference in New Issue