Bladeren bron

Preserve original List-Unsubscribe header

Will Browning 4 jaren geleden
bovenliggende
commit
5ab2eca563

+ 14 - 3
.env.example

@@ -3,7 +3,8 @@ APP_ENV=production
 APP_KEY=
 APP_DEBUG=false
 APP_LOG_LEVEL=debug
-APP_URL=https://example.com
+# The URL of the AnonAddy instance, can be anything you like e.g. aa.example.com, or just example.com
+APP_URL=https://app.example.com
 
 LOG_CHANNEL=stack
 
@@ -27,25 +28,35 @@ REDIS_HOST=127.0.0.1
 REDIS_PASSWORD=null
 REDIS_PORT=6379
 
+# The from name to be used for outgoing email notifications from AnonAddy
 MAIL_FROM_NAME=Example
+# The from address to be used for outgoing email notifications from AnonAddy
 MAIL_FROM_ADDRESS=mailer@example.com
 MAIL_DRIVER=smtp
 MAIL_HOST=localhost
 MAIL_PORT=25
 MAIL_ENCRYPTION=null
 
+# The SMTP FROM address to be used if the alias address cannot be, e.g. for a custom domain that is not verified for sending
 ANONADDY_RETURN_PATH=mailer@example.com
+# This allows you to receive emails as a catch-all at the apex domain e.g. *@example.com
 ANONADDY_ADMIN_USERNAME=johndoe
 ANONADDY_ENABLE_REGISTRATION=true
 ANONADDY_DOMAIN=example.com
 ANONADDY_HOSTNAME=mail.example.com
 ANONADDY_DNS_RESOLVER=127.0.0.1
 ANONADDY_ALL_DOMAINS=example.com,example2.com
+# Used for verifying custom domains, can be anything e.g. 64U64QcpgWHAZPyr4nN58kDGvwj9TkKMGyuXcjMFA7CdhTDy2f
 ANONADDY_SECRET=long-random-string
+# Number of emails that can be forwarded through the service per hour by any one user
 ANONADDY_LIMIT=200
+# Monthly bandwidth limit, default 100MB
 ANONADDY_BANDWIDTH_LIMIT=104857600
-ANONADDY_NEW_ALIAS_LIMIT=10
-ANONADDY_ADDITIONAL_USERNAME_LIMIT=3
+# Limit on how many new aliases can be created per hour, default 100
+ANONADDY_NEW_ALIAS_LIMIT=100
+# Limit on the number of additional usernames that can be added, default 10
+ANONADDY_ADDITIONAL_USERNAME_LIMIT=10
+# Fingerprint of the private key that you generated on the server to be used to sign encrypted forwarded emails
 ANONADDY_SIGNING_KEY_FINGERPRINT=
 # This is only needed if you will be adding any custom domains. If you do not need it then leave it blank. ANONADDY_DKIM_SIGNING_KEY=/etc/opendkim/keys/example.com/default.private
 ANONADDY_DKIM_SIGNING_KEY=

+ 2 - 2
README.md

@@ -145,11 +145,11 @@ Yes there is an [open-source](https://github.com/anonaddy/browser-extension) bro
 
 Yes, there is an excellent [open-source](https://gitlab.com/Stjin/anonaddy-android) Android app created by [Stjin](https://twitter.com/Stjinchan) that is available to download from the [Play Store](https://play.google.com/store/apps/details?id=host.stjin.anonaddy) (paid) and [F-Droid](https://f-droid.org/packages/host.stjin.anonaddy) (free). The developer of this app has put in a lot of time and effort so if you would like to support him please purchase the Play Store version.
 
-There is also another [open-source](https://github.com/KhalidWar/anonaddy) Android app created by [KhalidWar](https://twitter.com/RealKhalidWar) available on the [Play Store](https://play.google.com/store/apps/details?id=com.khalidwar.anonaddy).
+There is also another [open-source](https://github.com/KhalidWar/anonaddy) Android app created by [KhalidWar](https://github.com/KhalidWar) available on the [Play Store](https://play.google.com/store/apps/details?id=com.khalidwar.anonaddy).
 
 ## Is there an iOS app?
 
-Yes, [KhalidWar's](https://twitter.com/RealKhalidWar) [open-source](https://github.com/KhalidWar/anonaddy) app from above is also available on the [App Store](https://apps.apple.com/us/app/addymanager/id1547461270).
+Yes, [KhalidWar's](https://github.com/KhalidWar) [open-source](https://github.com/KhalidWar/anonaddy) app from above is also available on the [App Store](https://apps.apple.com/us/app/addymanager/id1547461270).
 
 ## How do I add my own GPG/OpenPGP key for encryption?
 

+ 2 - 2
app/Http/Controllers/Api/FailedDeliveryController.php

@@ -9,7 +9,7 @@ class FailedDeliveryController extends Controller
 {
     public function index()
     {
-        $failedDeliveries = user()->failedDeliveries()->latest();
+        $failedDeliveries = user()->failedDeliveries()->with(['recipient:id,email','alias:id,email'])->latest();
 
         return FailedDeliveryResource::collection($failedDeliveries->get());
     }
@@ -18,7 +18,7 @@ class FailedDeliveryController extends Controller
     {
         $failedDelivery = user()->failedDeliveries()->findOrFail($id);
 
-        return new FailedDeliveryResource($failedDelivery);
+        return new FailedDeliveryResource($failedDelivery->load(['recipient:id,email','alias:id,email']));
     }
 
     public function destroy($id)

+ 2 - 0
app/Http/Resources/FailedDeliveryResource.php

@@ -12,7 +12,9 @@ class FailedDeliveryResource extends JsonResource
             'id' => $this->id,
             'user_id' => $this->user_id,
             'recipient_id' => $this->recipient_id,
+            'recipient_email' => $this->recipient_id ? $this->recipient->email : null,
             'alias_id' => $this->alias_id,
+            'alias_email' => $this->alias_id ? $this->alias->email : null,
             'bounce_type' => $this->bounce_type,
             'remote_mta' => $this->remote_mta,
             'sender' => $this->sender,

+ 10 - 3
app/Mail/ForwardEmail.php

@@ -42,6 +42,7 @@ class ForwardEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
     protected $fromEmail;
     protected $size;
     protected $messageId;
+    protected $listUnsubscribe;
     protected $inReplyTo;
     protected $references;
 
@@ -64,6 +65,7 @@ class ForwardEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
         $this->deactivateUrl = URL::signedRoute('deactivate', ['alias' => $alias->id]);
         $this->size = $emailData->size;
         $this->messageId = $emailData->messageId;
+        $this->listUnsubscribe = $emailData->listUnsubscribe;
         $this->inReplyTo = $emailData->inReplyTo;
         $this->references = $emailData->references;
         $this->encryptedParts = $emailData->encryptedParts ?? null;
@@ -129,9 +131,6 @@ class ForwardEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
                 'text' => base64_decode($this->emailText)
             ])
             ->withSwiftMessage(function ($message) use ($returnPath) {
-                $message->getHeaders()
-                        ->addTextHeader('List-Unsubscribe', '<mailto:' . $this->alias->id . '@unsubscribe.' . config('anonaddy.domain') . '?subject=unsubscribe>, <' . $this->deactivateUrl . '>');
-
                 $message->setReturnPath($returnPath);
 
                 // This header is used to set the To: header as the alias just before sending.
@@ -148,6 +147,14 @@ class ForwardEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
                     $message->setId(bin2hex(random_bytes(16)).'@'.$this->alias->domain);
                 }
 
+                if ($this->listUnsubscribe) {
+                    $message->getHeaders()
+                            ->addTextHeader('List-Unsubscribe', base64_decode($this->listUnsubscribe));
+                }
+
+                /* $message->getHeaders()
+                        ->addTextHeader('List-Unsubscribe', '<mailto:' . $this->alias->id . '@unsubscribe.' . config('anonaddy.domain') . '?subject=unsubscribe>, <' . $this->deactivateUrl . '>'); */
+
                 if ($this->inReplyTo) {
                     $message->getHeaders()
                             ->addTextHeader('In-Reply-To', base64_decode($this->inReplyTo));

+ 1 - 0
app/Models/EmailData.php

@@ -19,6 +19,7 @@ class EmailData
         $this->attachments = [];
         $this->size = $size;
         $this->messageId = base64_encode($parser->getHeader('Message-ID'));
+        $this->listUnsubscribe = base64_encode($parser->getHeader('List-Unsubscribe'));
         $this->inReplyTo = base64_encode($parser->getHeader('In-Reply-To'));
         $this->references = base64_encode($parser->getHeader('References'));
 

+ 4 - 4
config/anonaddy.php

@@ -127,11 +127,11 @@ return [
     |--------------------------------------------------------------------------
     |
     | This value is an integer that determines the number of new aliases
-    | a user can create each hour, the default value is 10 aliases per hour
+    | a user can create each hour, the default value is 100 aliases per hour
     |
     */
 
-    'new_alias_hourly_limit' => env('ANONADDY_NEW_ALIAS_LIMIT', 10),
+    'new_alias_hourly_limit' => env('ANONADDY_NEW_ALIAS_LIMIT', 100),
 
     /*
     |--------------------------------------------------------------------------
@@ -139,11 +139,11 @@ return [
     |--------------------------------------------------------------------------
     |
     | This value is an integer that determines the number of additional
-    | usernames a user can add to their account, the default value is 3
+    | usernames a user can add to their account, the default value is 10
     |
     */
 
-    'additional_username_limit' => env('ANONADDY_ADDITIONAL_USERNAME_LIMIT', 3),
+    'additional_username_limit' => env('ANONADDY_ADDITIONAL_USERNAME_LIMIT', 10),
 
     /*
     |--------------------------------------------------------------------------

BIN
public/webauthn.png


+ 2 - 2
resources/js/app.js

@@ -39,11 +39,11 @@ Vue.component(
 Vue.component('webauthn-keys', require('./components/WebauthnKeys.vue').default)
 
 Vue.filter('formatDate', value => {
-  return dayjs.utc(value).format('Do MMM YYYY')
+  return dayjs.utc(value).local().format('Do MMM YYYY')
 })
 
 Vue.filter('formatDateTime', value => {
-  return dayjs.utc(value).format('Do MMM YYYY h:mm A')
+  return dayjs.utc(value).local().format('Do MMM YYYY h:mm A')
 })
 
 Vue.filter('timeAgo', value => {

+ 1 - 1
resources/views/vendor/webauthn/authenticate.blade.php

@@ -24,7 +24,7 @@
                     </h3>
 
                     <p class="my-4 text-center">
-                        <img src="https://ssl.gstatic.com/accounts/strongauth/Challenge_2SV-Gnubby_graphic.png" alt=""/>
+                        <img src="/webauthn.png" alt="security key"/>
                     </p>
 
                     <p>

+ 1 - 1
resources/views/vendor/webauthn/register.blade.php

@@ -24,7 +24,7 @@
                     </h3>
 
                     <p class="my-4 text-center">
-                        <img src="https://ssl.gstatic.com/accounts/strongauth/Challenge_2SV-Gnubby_graphic.png" alt=""/>
+                        <img src="/webauthn.png" alt="security key"/>
                     </p>
 
                     <p>

+ 1 - 0
tests/emails/email.eml

@@ -2,6 +2,7 @@ Date: Wed, 20 Feb 2019 15:00:00 +0100 (CET)
 From: Will <will@anonaddy.com>
 To: <ebay@johndoe.anonaddy.com>
 Subject: Test Email
+List-Unsubscribe: <mailto:unsubscribe@example.com>
 Content-Type: multipart/mixed; boundary="----=_Part_10031_1199410393.1550677940425"
 
 ------=_Part_10031_1199410393.1550677940425