فهرست منبع

Fixed gnupg issues

Will Browning 6 سال پیش
والد
کامیت
5398b5bea5
5فایلهای تغییر یافته به همراه49 افزوده شده و 34 حذف شده
  1. 0 3
      app/Console/Commands/ReceiveEmail.php
  2. 0 10
      app/Helpers/OpenPGPSigner.php
  3. 7 9
      app/Mail/ForwardEmail.php
  4. 41 11
      package-lock.json
  5. 1 1
      package.json

+ 0 - 3
app/Console/Commands/ReceiveEmail.php

@@ -184,17 +184,14 @@ class ReceiveEmail extends Command
             $alias->refresh();
         }
 
-        // This is simply a class that allows us to base64_encode all attachment data before serialization
         $emailData = new EmailData($this->parser);
 
-
         $alias->recipientsUsingPgp()->each(function ($recipient) use ($alias, $emailData) {
             $message = (new ForwardEmail($alias, $emailData, $recipient->should_encrypt, $recipient->fingerprint))->onQueue('default');
 
             Mail::to($recipient->email)->queue($message);
         });
 
-
         if ($alias->hasNonPgpRecipients()) {
             $message = (new ForwardEmail($alias, $emailData))->onQueue('default');
 

+ 0 - 10
app/Helpers/OpenPGPSigner.php

@@ -338,16 +338,6 @@ EOT;
             $this->gnupgHome = getenv('HOME') . '/.gnupg';
         }
 
-        if (!$this->gnupgHome) {
-            throw new Swift_SwiftException('Unable to detect GnuPG home path, please call PHPMailerPGP::setGPGHome()');
-        }
-
-        if (!file_exists($this->gnupgHome)) {
-            throw new Swift_SwiftException('GnuPG home path does not exist');
-        }
-
-        putenv("GNUPGHOME=" . escapeshellcmd($this->gnupgHome));
-
         if (!$this->gnupg) {
             $this->gnupg = new \gnupg();
         }

+ 7 - 9
app/Mail/ForwardEmail.php

@@ -25,6 +25,7 @@ class ForwardEmail extends Mailable implements ShouldQueue
     protected $emailAttachments;
     protected $deactivateUrl;
     protected $bannerLocation;
+    protected $shouldEncrypt;
     protected $openpgpsigner;
 
     /**
@@ -41,20 +42,15 @@ class ForwardEmail extends Mailable implements ShouldQueue
         $this->emailText = $emailData->text;
         $this->emailHtml = $emailData->html;
         $this->emailAttachments = $emailData->attachments;
-
         $this->deactivateUrl = URL::signedRoute('deactivate', ['alias' => $alias->id]);
         $this->bannerLocation = $this->alias->user->banner_location;
 
-        /* $path = "~/.gnupg";
-        $this->openpgpsigner = OpenPGPSigner::newInstance($signingKey = config('anonaddy.signing_key_fingerprint'), $recipientKeys = [], $gnupgHome = $path);
-        $this->openpgpsigner->setGnupgHome($path);
-        $this->openpgpsigner->setEncrypt($shouldEncrypt);
+        $this->shouldEncrypt = $shouldEncrypt;
 
-        if ($fingerprint) {
+        if ($shouldEncrypt) {
+            $this->openpgpsigner = OpenPGPSigner::newInstance(config('anonaddy.signing_key_fingerprint'), [], "~/.gnupg");
             $this->openpgpsigner->addRecipient($fingerprint);
         }
-
-        $this->openpgpsigner->addSignature(config('mail.from.address'), config('anonaddy.signing_key_fingerprint')); */
     }
 
     /**
@@ -86,7 +82,9 @@ class ForwardEmail extends Mailable implements ShouldQueue
                 $message->getHeaders()
                         ->addTextHeader('Return-Path', 'bounces@anonaddy.me');
 
-                //$message->attachSigner($this->openpgpsigner);
+                if ($this->shouldEncrypt) {
+                    $message->attachSigner($this->openpgpsigner);
+                }
             });
 
         if ($this->emailHtml) {

+ 41 - 11
package-lock.json

@@ -6548,12 +6548,37 @@
             }
         },
         "postcss-js": {
-            "version": "2.0.1",
-            "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-2.0.1.tgz",
-            "integrity": "sha512-8XQGohCbj6+kq8e3w6WlexkGaSjb5S8zoXnH49eB8JC6+qN2kQW+ib6fTjRgCpRRN9eeFOhMlD0NDjThW1DCBg==",
+            "version": "2.0.2",
+            "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-2.0.2.tgz",
+            "integrity": "sha512-HxXLw1lrczsbVXxyC+t/VIfje9ZeZhkkXE8KpFa3MEKfp2FyHDv29JShYY9eLhYrhLyWWHNIuwkktTfLXu2otw==",
             "requires": {
                 "camelcase-css": "^2.0.1",
-                "postcss": "^7.0.14"
+                "postcss": "^7.0.17"
+            },
+            "dependencies": {
+                "postcss": {
+                    "version": "7.0.17",
+                    "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.17.tgz",
+                    "integrity": "sha512-546ZowA+KZ3OasvQZHsbuEpysvwTZNGJv9EfyCQdsIDltPSWHAeTQ5fQy/Npi2ZDtLI3zs7Ps/p6wThErhm9fQ==",
+                    "requires": {
+                        "chalk": "^2.4.2",
+                        "source-map": "^0.6.1",
+                        "supports-color": "^6.1.0"
+                    }
+                },
+                "source-map": {
+                    "version": "0.6.1",
+                    "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+                    "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
+                },
+                "supports-color": {
+                    "version": "6.1.0",
+                    "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-6.1.0.tgz",
+                    "integrity": "sha512-qe1jfm1Mg7Nq/NSh6XE24gPXROEVsWHxC1LIx//XNlD9iw7YZQGjZNjYN7xGaEG6iKdA8EtNFW6R0gjnVXp+wQ==",
+                    "requires": {
+                        "has-flag": "^3.0.0"
+                    }
+                }
             }
         },
         "postcss-load-config": {
@@ -8402,9 +8427,9 @@
             "dev": true
         },
         "tailwindcss": {
-            "version": "1.0.4",
-            "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-1.0.4.tgz",
-            "integrity": "sha512-+1NNPW+U83k6DV/uUOnsfmX86Cfb8N87fiuN0cX0mEi2sZUpglLzZqlXtP8FD9Hlne5H1UhlS8tajz+F9SSxjA==",
+            "version": "1.0.5",
+            "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-1.0.5.tgz",
+            "integrity": "sha512-e5edrSKqNOvWAVEutXN5czeJSXjQQxO7zNN4RDd5vQF/JTxnKdndcMFIC6p6YkRvcGFKPCZ/0rY1zZvPeq9V4A==",
             "requires": {
                 "autoprefixer": "^9.4.5",
                 "bytes": "^3.0.0",
@@ -8427,15 +8452,20 @@
                     "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg=="
                 },
                 "fs-extra": {
-                    "version": "8.0.1",
-                    "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.0.1.tgz",
-                    "integrity": "sha512-W+XLrggcDzlle47X/XnS7FXrXu9sDo+Ze9zpndeBxdgv88FHLm1HtmkhEwavruS6koanBjp098rUpHs65EmG7A==",
+                    "version": "8.1.0",
+                    "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
+                    "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
                     "requires": {
-                        "graceful-fs": "^4.1.2",
+                        "graceful-fs": "^4.2.0",
                         "jsonfile": "^4.0.0",
                         "universalify": "^0.1.0"
                     }
                 },
+                "graceful-fs": {
+                    "version": "4.2.0",
+                    "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.0.tgz",
+                    "integrity": "sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg=="
+                },
                 "postcss-selector-parser": {
                     "version": "6.0.2",
                     "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.2.tgz",

+ 1 - 1
package.json

@@ -21,7 +21,7 @@
         "postcss-import": "^11.1.0",
         "postcss-nesting": "^5.0.0",
         "resolve-url-loader": "^2.3.2",
-        "tailwindcss": "^1.0.4",
+        "tailwindcss": "^1.0.5",
         "tippy.js": "^4.3.4",
         "v-clipboard": "^2.2.2",
         "vue": "^2.6.10",