Compare commits

..

No commits in common. "f2e69239539ec6e3f7e0e41b23707d0f159ee3f5" and "919c770fe37de319793f444f77c3756e6720108a" have entirely different histories.

3 changed files with 9 additions and 7 deletions

View File

@ -23,12 +23,12 @@ const config = {
http: { // HTTP configuration http: { // HTTP configuration
port: normalizePort(process.env.HTTP_PORT || 3000), // http port to listen on 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] 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 displaying available email domains: displaySort: process.env.HTTP_DISPLAY_SORT || 0, // Sorting logic used for display:
// 0 does not modify, // 0 does not modify,
// 1 sorts alphabetically, // 1 sorts alphabetically,
// 2 sorts alphabetically and only shuffles the first item, // 2 sorts alphabetically and only shuffles the first item,
// 3 shuffles all // 3 shuffles all
hideOther: process.env.HTTP_HIDE_OTHER || false, // Hide other email domains in the list and only show first (true) or show all (false) hideOther: process.env.HTTP_HIDE_OTHER || false, // Hide other emails in the list and only show first (true) or show all (false)
}, },
} }

View File

@ -107,8 +107,11 @@ class Helper {
shuffleFirstItem(array) { shuffleFirstItem(array) {
let first = array[Math.floor(Math.random()*array.length)] let first = array[Math.floor(Math.random()*array.length)]
console.log(first)
array = array.filter((value)=>value!=first); array = array.filter((value)=>value!=first);
console.log(array)
array = [first].concat(array) array = [first].concat(array)
console.log(array)
return array return array
} }

View File

@ -202,16 +202,15 @@ class ImapService extends EventEmitter {
async deleteOldMails(deleteMailsBefore) { async deleteOldMails(deleteMailsBefore) {
let uids = [] let uids = []
if (helper.moreThanOneDay(moment(), deleteMailsBefore)) { 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([ uids = await this._searchWithoutFetch([
['!DELETED'], ['!DELETED'],
['BEFORE', deleteMailsBefore] ['BEFORE', deleteMailsBefore]
]) ])
} else { } 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([ uids = await this._searchWithoutFetch([
['!DELETED'], ['!DELETED']
['BEFORE', deleteMailsBefore]
]) ])
} }
@ -245,7 +244,7 @@ class ImapService extends EventEmitter {
*/ */
async deleteSpecificEmail(uid) { async deleteSpecificEmail(uid) {
debug(`deleting mails ${uid}`) debug(`deleting mails ${uid}`)
if (!this.config.email.examples.uids.includes(parseInt(uid))) { if (!this.config.http.examples.uids.includes(parseInt(uid))) {
await this.connection.deleteMessage(uid) await this.connection.deleteMessage(uid)
console.log(`deleted mail with UID: ${uid}.`) console.log(`deleted mail with UID: ${uid}.`)
this.emit(ImapService.EVENT_DELETED_MAIL, uid) this.emit(ImapService.EVENT_DELETED_MAIL, uid)