Compare commits
4 Commits
919c770fe3
...
f2e6923953
Author | SHA1 | Date |
---|---|---|
ClaraCrazy | f2e6923953 | |
ClaraCrazy | 2636f5f56a | |
ClaraCrazy | 05bb74e1d3 | |
ClaraCrazy | 159cd9942e |
|
@ -23,12 +23,12 @@ const config = {
|
|||
http: { // HTTP configuration
|
||||
port: normalizePort(process.env.HTTP_PORT || 3000), // http port to listen on
|
||||
branding: process.env.HTTP_BRANDING || ["48hr.email", "CrazyCo", "https://crazyco.xyz"], // branding [service_title, company_name, company_url]
|
||||
displaySort: process.env.HTTP_DISPLAY_SORT || 0, // Sorting logic used for display:
|
||||
displaySort: process.env.HTTP_DISPLAY_SORT || 0, // Sorting logic used for displaying available email domains:
|
||||
// 0 does not modify,
|
||||
// 1 sorts alphabetically,
|
||||
// 2 sorts alphabetically and only shuffles the first item,
|
||||
// 3 shuffles all
|
||||
hideOther: process.env.HTTP_HIDE_OTHER || false, // Hide other emails in the list and only show first (true) or show all (false)
|
||||
hideOther: process.env.HTTP_HIDE_OTHER || false, // Hide other email domains in the list and only show first (true) or show all (false)
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -107,11 +107,8 @@ class Helper {
|
|||
|
||||
shuffleFirstItem(array) {
|
||||
let first = array[Math.floor(Math.random()*array.length)]
|
||||
console.log(first)
|
||||
array = array.filter((value)=>value!=first);
|
||||
console.log(array)
|
||||
array = [first].concat(array)
|
||||
console.log(array)
|
||||
return array
|
||||
}
|
||||
|
||||
|
|
|
@ -202,15 +202,16 @@ class ImapService extends EventEmitter {
|
|||
async deleteOldMails(deleteMailsBefore) {
|
||||
let uids = []
|
||||
if (helper.moreThanOneDay(moment(), deleteMailsBefore)) {
|
||||
//fetch mails from date -1day (calculated in MS) to avoid wasting resources
|
||||
deleteMailsBefore = deleteMailsBefore - 24 * 60 * 60 * 1000
|
||||
uids = await this._searchWithoutFetch([
|
||||
['!DELETED'],
|
||||
['BEFORE', deleteMailsBefore]
|
||||
])
|
||||
} else {
|
||||
//fetch mails from date -1day (calculated in MS) to avoid wasting resources
|
||||
deleteMailsBefore = new Date(moment() - 24 * 60 * 60 * 1000)
|
||||
uids = await this._searchWithoutFetch([
|
||||
['!DELETED']
|
||||
['!DELETED'],
|
||||
['BEFORE', deleteMailsBefore]
|
||||
])
|
||||
}
|
||||
|
||||
|
@ -244,7 +245,7 @@ class ImapService extends EventEmitter {
|
|||
*/
|
||||
async deleteSpecificEmail(uid) {
|
||||
debug(`deleting mails ${uid}`)
|
||||
if (!this.config.http.examples.uids.includes(parseInt(uid))) {
|
||||
if (!this.config.email.examples.uids.includes(parseInt(uid))) {
|
||||
await this.connection.deleteMessage(uid)
|
||||
console.log(`deleted mail with UID: ${uid}.`)
|
||||
this.emit(ImapService.EVENT_DELETED_MAIL, uid)
|
||||
|
|
Loading…
Reference in New Issue