mirror of
https://github.com/axllent/mailpit.git
synced 2025-02-05 13:14:57 +02:00
Chore: JSON key case-consistency for posted API data (backwards-compatible)
This commit is contained in:
parent
22d28a7b18
commit
f424856685
@ -666,18 +666,18 @@ func ReleaseMessage(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
froms, err := m.Header.AddressList("From")
|
||||
fromAddresses, err := m.Header.AddressList("From")
|
||||
if err != nil {
|
||||
httpError(w, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
if len(froms) == 0 {
|
||||
if len(fromAddresses) == 0 {
|
||||
httpError(w, "No From header found")
|
||||
return
|
||||
}
|
||||
|
||||
from := froms[0].Address
|
||||
from := fromAddresses[0].Address
|
||||
|
||||
// if sender is used, then change from to the sender
|
||||
if senders, err := m.Header.AddressList("Sender"); err == nil {
|
||||
|
@ -47,7 +47,7 @@ type deleteMessagesRequestBody struct {
|
||||
//
|
||||
// required: false
|
||||
// example: ["5dec4247-812e-4b77-9101-e25ad406e9ea", "8ac66bbc-2d9a-4c41-ad99-00aa75fa674e"]
|
||||
IDs []string `json:"ids"`
|
||||
IDs []string
|
||||
}
|
||||
|
||||
// swagger:parameters SetReadStatus
|
||||
@ -64,13 +64,13 @@ type setReadStatusRequestBody struct {
|
||||
// required: false
|
||||
// default: false
|
||||
// example: true
|
||||
Read bool `json:"read"`
|
||||
Read bool
|
||||
|
||||
// Array of message database IDs
|
||||
//
|
||||
// required: false
|
||||
// example: ["5dec4247-812e-4b77-9101-e25ad406e9ea", "8ac66bbc-2d9a-4c41-ad99-00aa75fa674e"]
|
||||
IDs []string `json:"ids"`
|
||||
IDs []string
|
||||
}
|
||||
|
||||
// swagger:parameters SetTags
|
||||
@ -86,13 +86,13 @@ type setTagsRequestBody struct {
|
||||
//
|
||||
// required: true
|
||||
// example: ["Tag 1", "Tag 2"]
|
||||
Tags []string `json:"tags"`
|
||||
Tags []string
|
||||
|
||||
// Array of message database IDs
|
||||
//
|
||||
// required: true
|
||||
// example: ["5dec4247-812e-4b77-9101-e25ad406e9ea", "8ac66bbc-2d9a-4c41-ad99-00aa75fa674e"]
|
||||
IDs []string `json:"ids"`
|
||||
IDs []string
|
||||
}
|
||||
|
||||
// swagger:parameters ReleaseMessage
|
||||
@ -112,10 +112,9 @@ type releaseMessageParams struct {
|
||||
// swagger:model releaseMessageRequestBody
|
||||
type releaseMessageRequestBody struct {
|
||||
// Array of email addresses to relay the message to
|
||||
//
|
||||
// required: true
|
||||
// example: ["user1@example.com", "user2@example.com"]
|
||||
To []string `json:"to"`
|
||||
To []string
|
||||
}
|
||||
|
||||
// swagger:parameters HTMLCheck
|
||||
@ -156,7 +155,7 @@ type spamAssassinCheckParams struct {
|
||||
ID string
|
||||
}
|
||||
|
||||
// Binary data response inherits the attachment's content type
|
||||
// Binary data response inherits the attachment's content type.
|
||||
// swagger:response BinaryResponse
|
||||
type binaryResponse string
|
||||
|
||||
|
@ -21,8 +21,8 @@ import (
|
||||
|
||||
var (
|
||||
putDataStruct struct {
|
||||
Read bool `json:"read"`
|
||||
IDs []string `json:"ids"`
|
||||
Read bool
|
||||
IDs []string
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -29,7 +29,7 @@ export default {
|
||||
if (!mailbox.selected.length) {
|
||||
return false
|
||||
}
|
||||
self.put(self.resolve(`/api/v1/messages`), { 'read': true, 'ids': mailbox.selected }, function (response) {
|
||||
self.put(self.resolve(`/api/v1/messages`), { 'Read': true, 'IDs': mailbox.selected }, function (response) {
|
||||
window.scrollInPlace = true
|
||||
self.loadMessages()
|
||||
})
|
||||
@ -45,7 +45,7 @@ export default {
|
||||
if (!mailbox.selected.length) {
|
||||
return false
|
||||
}
|
||||
self.put(self.resolve(`/api/v1/messages`), { 'read': false, 'ids': mailbox.selected }, function (response) {
|
||||
self.put(self.resolve(`/api/v1/messages`), { 'Read': false, 'IDs': mailbox.selected }, function (response) {
|
||||
window.scrollInPlace = true
|
||||
self.loadMessages()
|
||||
})
|
||||
@ -59,7 +59,7 @@ export default {
|
||||
if (!ids.length) {
|
||||
return false
|
||||
}
|
||||
self.delete(self.resolve(`/api/v1/messages`), { 'ids': ids }, function (response) {
|
||||
self.delete(self.resolve(`/api/v1/messages`), { 'IDs': ids }, function (response) {
|
||||
window.scrollInPlace = true
|
||||
self.loadMessages()
|
||||
})
|
||||
|
@ -70,9 +70,9 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
hasAnyChecksEnabled: function() {
|
||||
hasAnyChecksEnabled: function () {
|
||||
return (mailbox.showHTMLCheck && this.message.HTML)
|
||||
|| mailbox.showLinkCheck
|
||||
|| mailbox.showLinkCheck
|
||||
|| (mailbox.showSpamCheck && mailbox.uiConfig.SpamAssassin)
|
||||
}
|
||||
},
|
||||
@ -198,8 +198,8 @@ export default {
|
||||
let self = this
|
||||
|
||||
var data = {
|
||||
ids: [this.message.ID],
|
||||
tags: this.messageTags
|
||||
IDs: [this.message.ID],
|
||||
Tags: this.messageTags
|
||||
}
|
||||
|
||||
self.put(self.resolve('/api/v1/tags'), data, function (response) {
|
||||
@ -476,8 +476,7 @@ export default {
|
||||
</div>
|
||||
<button class="d-none d-xl-inline-block nav-link position-relative" id="nav-html-check-tab"
|
||||
data-bs-toggle="tab" data-bs-target="#nav-html-check" type="button" role="tab"
|
||||
aria-controls="nav-html" aria-selected="false"
|
||||
v-if="mailbox.showHTMLCheck && message.HTML != ''">
|
||||
aria-controls="nav-html" aria-selected="false" v-if="mailbox.showHTMLCheck && message.HTML != ''">
|
||||
HTML Check
|
||||
<span class="badge rounded-pill p-1" :class="htmlScoreColor" v-if="htmlScore !== false">
|
||||
<small>{{ Math.floor(htmlScore) }}%</small>
|
||||
@ -494,7 +493,8 @@ export default {
|
||||
</button>
|
||||
<button class="d-none d-xl-inline-block nav-link position-relative" id="nav-spam-check-tab"
|
||||
data-bs-toggle="tab" data-bs-target="#nav-spam-check" type="button" role="tab"
|
||||
aria-controls="nav-html" aria-selected="false" v-if="mailbox.showSpamCheck && mailbox.uiConfig.SpamAssassin">
|
||||
aria-controls="nav-html" aria-selected="false"
|
||||
v-if="mailbox.showSpamCheck && mailbox.uiConfig.SpamAssassin">
|
||||
Spam Analysis
|
||||
<span class="badge rounded-pill" :class="spamScoreColor" v-if="spamScore !== false">
|
||||
<small>{{ spamScore }}</small>
|
||||
@ -545,13 +545,13 @@ export default {
|
||||
</div>
|
||||
<div class="tab-pane fade" id="nav-html-check" role="tabpanel" aria-labelledby="nav-html-check-tab"
|
||||
tabindex="0">
|
||||
<HTMLCheck v-if="mailbox.showHTMLCheck && message.HTML != ''"
|
||||
:message="message" @setHtmlScore="(n) => htmlScore = n" @set-badge-style="(v) => htmlScoreColor = v" />
|
||||
<HTMLCheck v-if="mailbox.showHTMLCheck && message.HTML != ''" :message="message"
|
||||
@setHtmlScore="(n) => htmlScore = n" @set-badge-style="(v) => htmlScoreColor = v" />
|
||||
</div>
|
||||
<div class="tab-pane fade" id="nav-spam-check" role="tabpanel" aria-labelledby="nav-spam-check-tab"
|
||||
tabindex="0" v-if="mailbox.showSpamCheck && mailbox.uiConfig.SpamAssassin">
|
||||
<SpamAssassin :message="message"
|
||||
@setSpamScore="(n) => spamScore = n" @set-badge-style="(v) => spamScoreColor = v" />
|
||||
<SpamAssassin :message="message" @setSpamScore="(n) => spamScore = n"
|
||||
@set-badge-style="(v) => spamScoreColor = v" />
|
||||
</div>
|
||||
<div class="tab-pane fade" id="nav-link-check" role="tabpanel" aria-labelledby="nav-html-check-tab"
|
||||
tabindex="0" v-if="mailbox.showLinkCheck">
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
<script>
|
||||
import AjaxLoader from '../AjaxLoader.vue'
|
||||
import Tags from "bootstrap5-tags"
|
||||
@ -60,7 +59,7 @@ export default {
|
||||
}
|
||||
|
||||
let data = {
|
||||
to: self.addresses
|
||||
To: self.addresses
|
||||
}
|
||||
|
||||
self.post(self.resolve('/api/v1/message/' + self.message.ID + '/release'), data, function (response) {
|
||||
@ -103,8 +102,9 @@ export default {
|
||||
<label class="col-sm-2 col-form-label text-body-secondary">Send to</label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-select tag-selector" v-model="addresses" multiple data-allow-new="true"
|
||||
data-clear-end="true" data-allow-clear="true" data-placeholder="Enter email addresses..."
|
||||
data-add-on-blur="true" data-badge-style="primary"
|
||||
data-clear-end="true" data-allow-clear="true"
|
||||
data-placeholder="Enter email addresses..." data-add-on-blur="true"
|
||||
data-badge-style="primary"
|
||||
data-regex='^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|.(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$'
|
||||
data-separator="|,|">
|
||||
<option value="">Enter email addresses...</option>
|
||||
@ -127,16 +127,17 @@ export default {
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-text text-center" v-if="mailbox.uiConfig.MessageRelay.AllowedRecipients != ''">
|
||||
Note: A recipient allowlist has been configured. Any mail address not matching it will be rejected.
|
||||
<br class="d-none d-md-inline">
|
||||
Note: A recipient allowlist has been configured. Any mail address not matching it will be
|
||||
rejected.<br class="d-none d-md-inline">
|
||||
Allowed recipients: <b>{{ mailbox.uiConfig.MessageRelay.AllowedRecipients }}</b>
|
||||
</div>
|
||||
<div class="form-text text-center">
|
||||
Note: For testing purposes, a unique Message-Id will be generated on send.
|
||||
<br class="d-none d-md-inline">
|
||||
SMTP delivery failures will bounce back to
|
||||
<b v-if="mailbox.uiConfig.MessageRelay.ReturnPath != ''">{{ mailbox.uiConfig.MessageRelay.ReturnPath
|
||||
}}</b>
|
||||
<b v-if="mailbox.uiConfig.MessageRelay.ReturnPath != ''">
|
||||
{{ mailbox.uiConfig.MessageRelay.ReturnPath }}
|
||||
</b>
|
||||
<b v-else>{{ message.ReturnPath }}</b>.
|
||||
</div>
|
||||
</div>
|
||||
|
@ -927,13 +927,12 @@
|
||||
"description": "Delete request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ids": {
|
||||
"IDs": {
|
||||
"description": "Array of message database IDs",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"x-go-name": "IDs",
|
||||
"example": [
|
||||
"5dec4247-812e-4b77-9101-e25ad406e9ea",
|
||||
"8ac66bbc-2d9a-4c41-ad99-00aa75fa674e"
|
||||
@ -1670,16 +1669,15 @@
|
||||
"description": "Release request",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"to"
|
||||
"To"
|
||||
],
|
||||
"properties": {
|
||||
"to": {
|
||||
"To": {
|
||||
"description": "Array of email addresses to relay the message to",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"x-go-name": "To",
|
||||
"example": [
|
||||
"user1@example.com",
|
||||
"user2@example.com"
|
||||
@ -1692,23 +1690,21 @@
|
||||
"description": "Set read status request",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ids": {
|
||||
"IDs": {
|
||||
"description": "Array of message database IDs",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"x-go-name": "IDs",
|
||||
"example": [
|
||||
"5dec4247-812e-4b77-9101-e25ad406e9ea",
|
||||
"8ac66bbc-2d9a-4c41-ad99-00aa75fa674e"
|
||||
]
|
||||
},
|
||||
"read": {
|
||||
"Read": {
|
||||
"description": "Read status",
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"x-go-name": "Read",
|
||||
"example": true
|
||||
}
|
||||
},
|
||||
@ -1718,29 +1714,27 @@
|
||||
"description": "Set tags request",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"tags",
|
||||
"ids"
|
||||
"Tags",
|
||||
"IDs"
|
||||
],
|
||||
"properties": {
|
||||
"ids": {
|
||||
"IDs": {
|
||||
"description": "Array of message database IDs",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"x-go-name": "IDs",
|
||||
"example": [
|
||||
"5dec4247-812e-4b77-9101-e25ad406e9ea",
|
||||
"8ac66bbc-2d9a-4c41-ad99-00aa75fa674e"
|
||||
]
|
||||
},
|
||||
"tags": {
|
||||
"Tags": {
|
||||
"description": "Array of tag names to set",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"x-go-name": "Tags",
|
||||
"example": [
|
||||
"Tag 1",
|
||||
"Tag 2"
|
||||
@ -1761,7 +1755,7 @@
|
||||
}
|
||||
},
|
||||
"BinaryResponse": {
|
||||
"description": "Binary data response inherits the attachment's content type",
|
||||
"description": "Binary data response inherits the attachment's content type.",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user