Просмотр исходного кода

website: fix the mixed content emails from netlify

Renée Kooi 4 лет назад
Родитель
Сommit
c06196ae68
3 измененных файлов с 14 добавлено и 0 удалено
  1. 2 0
      bin/disc.js
  2. 11 0
      package-lock.json
  3. 1 0
      package.json

+ 2 - 0
bin/disc.js

@@ -1,6 +1,7 @@
 const fs = require('fs')
 const path = require('path')
 const { PassThrough } = require('stream')
+const replace = require('replacestream')
 const browserify = require('browserify')
 const babelify = require('babelify')
 const minify = require('minify-stream')
@@ -30,6 +31,7 @@ bundler.transform(minifyify, { global: true })
 bundler.bundle()
   .pipe(disc())
   .pipe(prepend('---\nlayout: false\n---\n'))
+  .pipe(replace('http://', 'https://', { limit: 1 }))
   .pipe(fs.createWriteStream(outputPath))
   .on('error', (err) => {
     throw err

+ 11 - 0
package-lock.json

@@ -32624,6 +32624,17 @@
         "yargs": "^14.0.0"
       }
     },
+    "replacestream": {
+      "version": "4.0.3",
+      "resolved": "https://registry.npmjs.org/replacestream/-/replacestream-4.0.3.tgz",
+      "integrity": "sha512-AC0FiLS352pBBiZhd4VXB1Ab/lh0lEgpP+GGvZqbQh8a5cmXVoTe5EX/YeTFArnp4SRGTHh1qCHu9lGs1qG8sA==",
+      "dev": true,
+      "requires": {
+        "escape-string-regexp": "^1.0.3",
+        "object-assign": "^4.0.1",
+        "readable-stream": "^2.0.2"
+      }
+    },
     "request": {
       "version": "2.88.2",
       "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",

+ 1 - 0
package.json

@@ -180,6 +180,7 @@
     "redux": "4.0.5",
     "remark-cli": "^8.0.0",
     "replace-x": "1.7.2",
+    "replacestream": "^4.0.3",
     "rimraf": "2.7.1",
     "stringify-object": "3.3.0",
     "supertest": "3.4.2",