Skip to content

Commit

Permalink
fix(special-use-flags): Added support for user-specified Archive spec…
Browse files Browse the repository at this point in the history
…ial use tag
  • Loading branch information
andris9 committed Oct 26, 2023
1 parent 858f48b commit a107f23
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 32 deletions.
2 changes: 1 addition & 1 deletion data/google-crawlers.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"creationTime": "2023-10-17T22:00:14.000000",
"creationTime": "2023-10-24T22:01:02.000000",
"prefixes": [
{
"ipv6Prefix": "2001:4860:4801:2008::/64"
Expand Down
3 changes: 2 additions & 1 deletion lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ class Connection {

let accountData = await this.accountObject.loadAccountData();
let specialUseHints = {};
for (let type of ['sent', 'drafts', 'junk', 'trash']) {

for (let type of ['sent', 'drafts', 'junk', 'trash', 'archive']) {
if (accountData.imap && accountData.imap[`${type}MailPath`]) {
specialUseHints[type] = accountData.imap[`${type}MailPath`];
}
Expand Down
41 changes: 28 additions & 13 deletions lib/schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,13 +453,18 @@ const imapSchema = {
junkMailPath: Joi.string()
.allow(null)
.max(1024)
.example('Drafts')
.example('Junk')
.description("Folder for spam. By default the account's Junk Mail folder is used. Set to `null` to unset."),
trashMailPath: Joi.string()
.allow(null)
.max(1024)
.example('Drafts')
.description("Folder for deleted emails. By default the account's Trash folder is used. Set to `null` to unset.")
.example('Trash')
.description("Folder for deleted emails. By default the account's Trash folder is used. Set to `null` to unset."),
archiveMailPath: Joi.string()
.allow(null)
.max(1024)
.example('Archive')
.description("Folder for archived emails. By default the account's Archive folder is used. Set to `null` to unset.")
};

const smtpSchema = {
Expand Down Expand Up @@ -550,7 +555,14 @@ const oauth2Schema = {
expires: Joi.date().iso().example('2021-03-22T13:13:31.000Z').description('Token expiration date')
};

const partialSchema = Joi.boolean()
.example(false)
.description('Set to `true` if you only want to update provided keys, by default the entire object is replaced')
.default(false);

const imapUpdateSchema = {
partial: partialSchema,

auth: Joi.object({
user: Joi.string().max(256).required().example('myuser@gmail.com').description('Account username'),
pass: Joi.string()
Expand Down Expand Up @@ -597,8 +609,6 @@ const imapUpdateSchema = {

disabled: Joi.boolean().example(false).description('Set to true to disable IMAP handling'),

partial: Joi.boolean().example(false).description('Update only listed keys in the imap config').default(false),

sentMailPath: Joi.string()
.allow(null)
.max(1024)
Expand All @@ -613,16 +623,22 @@ const imapUpdateSchema = {
junkMailPath: Joi.string()
.allow(null)
.max(1024)
.example('Drafts')
.example('Junk')
.description("Folder for spam. By default the account's Junk Mail folder is used. Set to `null` to unset."),
trashMailPath: Joi.string()
.allow(null)
.max(1024)
.example('Drafts')
.description("Folder for deleted emails. By default the account's Trash folder is used. Set to `null` to unset.")
.example('Trash')
.description("Folder for deleted emails. By default the account's Trash folder is used. Set to `null` to unset."),
archiveMailPath: Joi.string()
.allow(null)
.max(1024)
.example('Archive')
.description("Folder for archived emails. By default the account's Archive folder is used. Set to `null` to unset.")
};

const smtpUpdateSchema = {
partial: partialSchema,
auth: Joi.object({
user: Joi.string().max(256).required().example('myuser@gmail.com').description('Account username'),
pass: Joi.string()
Expand Down Expand Up @@ -664,11 +680,12 @@ const smtpUpdateSchema = {
})
.unknown()
.description('Optional TLS configuration')
.label('TLS'),
partial: Joi.boolean().example(false).description('Update only listed keys in the smtp config').default(false)
.label('TLS')
};

const oauth2UpdateSchema = {
partial: partialSchema,

authorize: Joi.boolean().example(false).description('Return a redirect link to the OAuth2 consent screen'),
provider: Joi.string().max(256).example('gmail').description('OAuth provider'),

Expand All @@ -695,9 +712,7 @@ const oauth2UpdateSchema = {
.description("Outloook account type. Either 'consumers', 'organizations', 'common' or an organizartion ID")
.label('SupportedAccountTypes'),

expires: Joi.date().iso().example('2021-03-22T13:13:31.000Z').description('Token expiration date'),

partial: Joi.boolean().example(false).description('Update only listed keys in the oauth2 config').default(false)
expires: Joi.date().iso().example('2021-03-22T13:13:31.000Z').description('Token expiration date')
};

const attachmentSchema = Joi.object({
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"ace-builds": "1.31.0",
"base32.js": "0.1.0",
"bull-arena": "4.0.1",
"bullmq": "4.12.5",
"bullmq": "4.12.6",
"compare-versions": "6.1.0",
"dotenv": "16.3.1",
"encoding-japanese": "2.0.0",
Expand All @@ -73,7 +73,7 @@
"humanize": "0.0.9",
"ical.js": "1.5.0",
"iconv-lite": "0.6.3",
"imapflow": "1.0.144",
"imapflow": "1.0.145",
"ioredfour": "1.2.0-ioredis-07",
"ioredis": "5.3.2",
"ipaddr.js": "2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion sbom.json

Large diffs are not rendered by default.

18 changes: 4 additions & 14 deletions static/licenses.html
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ <h1>EmailEngine v2.37.7</h1><p>EmailEngine includes code from the following soft
</tr>
<tr>
<td><a href="https://npmjs.com/package/@eslint-community/regexpp">@eslint-community/regexpp</a></td>
<td>4.9.1</td>
<td>4.10.0</td>
<td>MIT</td>
<td>Toru Nagashima</td>
<td></td>
Expand Down Expand Up @@ -1566,7 +1566,7 @@ <h1>EmailEngine v2.37.7</h1><p>EmailEngine includes code from the following soft
</tr>
<tr>
<td><a href="https://npmjs.com/package/bullmq">bullmq</a></td>
<td>4.12.5</td>
<td>4.12.6</td>
<td>MIT</td>
<td>Taskforce.sh Inc.</td>
<td></td>
Expand Down Expand Up @@ -3815,7 +3815,7 @@ <h1>EmailEngine v2.37.7</h1><p>EmailEngine includes code from the following soft
</tr>
<tr>
<td><a href="https://npmjs.com/package/imapflow">imapflow</a></td>
<td>1.0.144</td>
<td>1.0.145</td>
<td>MIT</td>
<td>Postal Systems O&#xDC;</td>
<td></td>
Expand Down Expand Up @@ -5945,16 +5945,6 @@ <h1>EmailEngine v2.37.7</h1><p>EmailEngine includes code from the following soft
</tr>
<tr>
<td><a href="https://npmjs.com/package/pino">pino</a></td>
<td>8.15.1</td>
<td>MIT</td>
<td>Matteo Collina</td>
<td>hello@matteocollina.com</td>
<td>
<a href="https://github.com/pinojs/pino">github.com/pinojs/pino</a>
</td
</tr>
<tr>
<td><a href="https://npmjs.com/package/pino">pino</a></td>
<td>8.16.0</td>
<td>MIT</td>
<td>Matteo Collina</td>
Expand Down Expand Up @@ -7045,7 +7035,7 @@ <h1>EmailEngine v2.37.7</h1><p>EmailEngine includes code from the following soft
</tr>
<tr>
<td><a href="https://npmjs.com/package/swagger-ui-dist">swagger-ui-dist</a></td>
<td>5.9.0</td>
<td>5.9.1</td>
<td>Apache-2.0</td>
<td></td>
<td></td>
Expand Down

0 comments on commit a107f23

Please sign in to comment.