mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	switchable image shrinking
This commit is contained in:
		
							
								
								
									
										262
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										262
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@@ -774,19 +774,19 @@
 | 
				
			|||||||
      "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0="
 | 
					      "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "asar": {
 | 
					    "asar": {
 | 
				
			||||||
      "version": "0.14.6",
 | 
					      "version": "1.0.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/asar/-/asar-0.14.6.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/asar/-/asar-1.0.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-ZqybKcdO5At6y3ge2RHxVImc6Eltb2t3sxT7lk4T4zjZBSFUuIGCIZY6f41dCjlvJSizN5QPRr8YTgMhpgBjLg==",
 | 
					      "integrity": "sha512-MBiDU5cDr9UWuY2F0zq2fZlnyRq1aOPmJGMas22Qa14K1odpRXL3xkMHPN3uw2hAK5mD89Q+/KidOUtpi4V0Cg==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "requires": {
 | 
					      "requires": {
 | 
				
			||||||
        "chromium-pickle-js": "^0.2.0",
 | 
					        "chromium-pickle-js": "^0.2.0",
 | 
				
			||||||
        "commander": "^2.9.0",
 | 
					        "commander": "^2.19.0",
 | 
				
			||||||
        "cuint": "^0.2.1",
 | 
					        "cuint": "^0.2.2",
 | 
				
			||||||
        "glob": "^6.0.4",
 | 
					        "glob": "^7.1.3",
 | 
				
			||||||
        "minimatch": "^3.0.3",
 | 
					        "minimatch": "^3.0.4",
 | 
				
			||||||
        "mkdirp": "^0.5.0",
 | 
					        "mkdirp": "^0.5.1",
 | 
				
			||||||
        "mksnapshot": "^0.3.4",
 | 
					        "pify": "^4.0.1",
 | 
				
			||||||
        "tmp": "0.0.28"
 | 
					        "tmp-promise": "^1.0.5"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "commander": {
 | 
					        "commander": {
 | 
				
			||||||
@@ -795,18 +795,11 @@
 | 
				
			|||||||
          "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==",
 | 
					          "integrity": "sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==",
 | 
				
			||||||
          "dev": true
 | 
					          "dev": true
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        "glob": {
 | 
					        "pify": {
 | 
				
			||||||
          "version": "6.0.4",
 | 
					          "version": "4.0.1",
 | 
				
			||||||
          "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz",
 | 
					          "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
 | 
				
			||||||
          "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=",
 | 
					          "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==",
 | 
				
			||||||
          "dev": true,
 | 
					          "dev": true
 | 
				
			||||||
          "requires": {
 | 
					 | 
				
			||||||
            "inflight": "^1.0.4",
 | 
					 | 
				
			||||||
            "inherits": "2",
 | 
					 | 
				
			||||||
            "minimatch": "2 || 3",
 | 
					 | 
				
			||||||
            "once": "^1.3.0",
 | 
					 | 
				
			||||||
            "path-is-absolute": "^1.0.0"
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
@@ -1053,16 +1046,6 @@
 | 
				
			|||||||
        "os-filter-obj": "^1.0.0"
 | 
					        "os-filter-obj": "^1.0.0"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "binary": {
 | 
					 | 
				
			||||||
      "version": "0.3.0",
 | 
					 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz",
 | 
					 | 
				
			||||||
      "integrity": "sha1-n2BVO8XOjDOG87VTz/R0Yq3sqnk=",
 | 
					 | 
				
			||||||
      "dev": true,
 | 
					 | 
				
			||||||
      "requires": {
 | 
					 | 
				
			||||||
        "buffers": "~0.1.1",
 | 
					 | 
				
			||||||
        "chainsaw": "~0.1.0"
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "bl": {
 | 
					    "bl": {
 | 
				
			||||||
      "version": "1.2.2",
 | 
					      "version": "1.2.2",
 | 
				
			||||||
      "resolved": "http://registry.npmjs.org/bl/-/bl-1.2.2.tgz",
 | 
					      "resolved": "http://registry.npmjs.org/bl/-/bl-1.2.2.tgz",
 | 
				
			||||||
@@ -1331,12 +1314,6 @@
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "buffers": {
 | 
					 | 
				
			||||||
      "version": "0.1.1",
 | 
					 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/buffers/-/buffers-0.1.1.tgz",
 | 
					 | 
				
			||||||
      "integrity": "sha1-skV5w77U1tOWru5tmorn9Ugqt7s=",
 | 
					 | 
				
			||||||
      "dev": true
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "builder-util": {
 | 
					    "builder-util": {
 | 
				
			||||||
      "version": "9.6.2",
 | 
					      "version": "9.6.2",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/builder-util/-/builder-util-9.6.2.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/builder-util/-/builder-util-9.6.2.tgz",
 | 
				
			||||||
@@ -1568,15 +1545,6 @@
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "chainsaw": {
 | 
					 | 
				
			||||||
      "version": "0.1.0",
 | 
					 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz",
 | 
					 | 
				
			||||||
      "integrity": "sha1-XqtQsor+WAdNDVgpE4iCi15fvJg=",
 | 
					 | 
				
			||||||
      "dev": true,
 | 
					 | 
				
			||||||
      "requires": {
 | 
					 | 
				
			||||||
        "traverse": ">=0.3.0 <0.4"
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "chalk": {
 | 
					    "chalk": {
 | 
				
			||||||
      "version": "1.1.3",
 | 
					      "version": "1.1.3",
 | 
				
			||||||
      "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
 | 
					      "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz",
 | 
				
			||||||
@@ -2307,56 +2275,6 @@
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "decompress-zip": {
 | 
					 | 
				
			||||||
      "version": "0.3.0",
 | 
					 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/decompress-zip/-/decompress-zip-0.3.0.tgz",
 | 
					 | 
				
			||||||
      "integrity": "sha1-rjvLfjTGWHmt/nfhnDD4ZgK0vbA=",
 | 
					 | 
				
			||||||
      "dev": true,
 | 
					 | 
				
			||||||
      "requires": {
 | 
					 | 
				
			||||||
        "binary": "^0.3.0",
 | 
					 | 
				
			||||||
        "graceful-fs": "^4.1.3",
 | 
					 | 
				
			||||||
        "mkpath": "^0.1.0",
 | 
					 | 
				
			||||||
        "nopt": "^3.0.1",
 | 
					 | 
				
			||||||
        "q": "^1.1.2",
 | 
					 | 
				
			||||||
        "readable-stream": "^1.1.8",
 | 
					 | 
				
			||||||
        "touch": "0.0.3"
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "dependencies": {
 | 
					 | 
				
			||||||
        "isarray": {
 | 
					 | 
				
			||||||
          "version": "0.0.1",
 | 
					 | 
				
			||||||
          "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
 | 
					 | 
				
			||||||
          "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=",
 | 
					 | 
				
			||||||
          "dev": true
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        "nopt": {
 | 
					 | 
				
			||||||
          "version": "3.0.6",
 | 
					 | 
				
			||||||
          "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz",
 | 
					 | 
				
			||||||
          "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=",
 | 
					 | 
				
			||||||
          "dev": true,
 | 
					 | 
				
			||||||
          "requires": {
 | 
					 | 
				
			||||||
            "abbrev": "1"
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        "readable-stream": {
 | 
					 | 
				
			||||||
          "version": "1.1.14",
 | 
					 | 
				
			||||||
          "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
 | 
					 | 
				
			||||||
          "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
 | 
					 | 
				
			||||||
          "dev": true,
 | 
					 | 
				
			||||||
          "requires": {
 | 
					 | 
				
			||||||
            "core-util-is": "~1.0.0",
 | 
					 | 
				
			||||||
            "inherits": "~2.0.1",
 | 
					 | 
				
			||||||
            "isarray": "0.0.1",
 | 
					 | 
				
			||||||
            "string_decoder": "~0.10.x"
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        "string_decoder": {
 | 
					 | 
				
			||||||
          "version": "0.10.31",
 | 
					 | 
				
			||||||
          "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
 | 
					 | 
				
			||||||
          "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=",
 | 
					 | 
				
			||||||
          "dev": true
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "deep-equal": {
 | 
					    "deep-equal": {
 | 
				
			||||||
      "version": "1.0.1",
 | 
					      "version": "1.0.1",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz",
 | 
				
			||||||
@@ -2939,13 +2857,14 @@
 | 
				
			|||||||
      "integrity": "sha512-gHZtUV3t5g3UXndAOUC+QM0ZzvB43mtKvba4zig65SsOnYqu1G5SMeRq41OIKnDftZN8iXD0NgTzuK3fWh4F8g=="
 | 
					      "integrity": "sha512-gHZtUV3t5g3UXndAOUC+QM0ZzvB43mtKvba4zig65SsOnYqu1G5SMeRq41OIKnDftZN8iXD0NgTzuK3fWh4F8g=="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "electron-installer-common": {
 | 
					    "electron-installer-common": {
 | 
				
			||||||
      "version": "0.5.0",
 | 
					      "version": "0.6.1",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/electron-installer-common/-/electron-installer-common-0.5.0.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/electron-installer-common/-/electron-installer-common-0.6.1.tgz",
 | 
				
			||||||
      "integrity": "sha512-BNIPjCI4LB+I0f5gK+1+NVxM9Hez8xLck48yKr6yosyze5S2p0K87QvNGZu8KBY8+X32RcHeI5Dfdyt+NK+fnw==",
 | 
					      "integrity": "sha512-C5lj5NJ9IlY/GtV1aegC0Tn7K0IeNFShVzlQ+jkHG7SEdiFnt+PlGx7aRBLEWOC4wc9hVgx/lvu6kM6oB4Dl9w==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "requires": {
 | 
					      "requires": {
 | 
				
			||||||
        "asar": "^0.14.6",
 | 
					        "asar": "^1.0.0",
 | 
				
			||||||
        "cross-spawn-promise": "^0.10.1",
 | 
					        "cross-spawn-promise": "^0.10.1",
 | 
				
			||||||
 | 
					        "debug": "^4.1.1",
 | 
				
			||||||
        "fs-extra": "^7.0.1",
 | 
					        "fs-extra": "^7.0.1",
 | 
				
			||||||
        "glob": "^7.1.3",
 | 
					        "glob": "^7.1.3",
 | 
				
			||||||
        "glob-promise": "^3.4.0",
 | 
					        "glob-promise": "^3.4.0",
 | 
				
			||||||
@@ -2956,20 +2875,20 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "electron-installer-debian": {
 | 
					    "electron-installer-debian": {
 | 
				
			||||||
      "version": "1.1.0",
 | 
					      "version": "1.1.1",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/electron-installer-debian/-/electron-installer-debian-1.1.0.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/electron-installer-debian/-/electron-installer-debian-1.1.1.tgz",
 | 
				
			||||||
      "integrity": "sha512-PqWNjVBsfjHiyCYxWBB4W22wSS1DpDfwmAhRsCA2W/0NtOE2yQrnnOrIOC77TcmxY2HmsNlv+n0Aabp8O6b0SA==",
 | 
					      "integrity": "sha512-2r27a1AhB6iCy3dmdm6aoS9Mn42UW0Y9KhCWUgf2Xd8zIB58Ew1ALTaB8xevVU0nOW5s+quq6McPS633PPHQIA==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "requires": {
 | 
					      "requires": {
 | 
				
			||||||
        "debug": "^4.0.1",
 | 
					        "debug": "^4.1.1",
 | 
				
			||||||
        "electron-installer-common": "^0.5.0",
 | 
					        "electron-installer-common": "^0.6.1",
 | 
				
			||||||
        "fs-extra": "^7.0.0",
 | 
					        "fs-extra": "^7.0.1",
 | 
				
			||||||
        "get-folder-size": "^2.0.0",
 | 
					        "get-folder-size": "^2.0.1",
 | 
				
			||||||
        "lodash": "^4.17.4",
 | 
					        "lodash": "^4.17.4",
 | 
				
			||||||
        "pify": "^4.0.0",
 | 
					        "pify": "^4.0.1",
 | 
				
			||||||
        "semver": "^5.4.1",
 | 
					        "semver": "^5.6.0",
 | 
				
			||||||
        "word-wrap": "^1.2.3",
 | 
					        "word-wrap": "^1.2.3",
 | 
				
			||||||
        "yargs": "^12.0.2"
 | 
					        "yargs": "^12.0.5"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "pify": {
 | 
					        "pify": {
 | 
				
			||||||
@@ -3047,12 +2966,12 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "electron-packager": {
 | 
					    "electron-packager": {
 | 
				
			||||||
      "version": "13.0.1",
 | 
					      "version": "13.1.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/electron-packager/-/electron-packager-13.0.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/electron-packager/-/electron-packager-13.1.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-fXfldaZ1wihpPaMTSGMxvCeETJwVArlnMmKafVXLJbbZwS+WTjY4iL7ju9WMQ0LNGuiiIwSMCQFxt5iA087mqg==",
 | 
					      "integrity": "sha512-XHoDqgG90NGBfgUJ3NcOmELAuvHucOIYzi7AhZKIC8FivRR45PDs0pXSf53OqTXXOkdL/1xSveogvJLjKJwkAQ==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "requires": {
 | 
					      "requires": {
 | 
				
			||||||
        "asar": "^0.14.0",
 | 
					        "asar": "^1.0.0",
 | 
				
			||||||
        "debug": "^4.0.1",
 | 
					        "debug": "^4.0.1",
 | 
				
			||||||
        "electron-download": "^4.1.1",
 | 
					        "electron-download": "^4.1.1",
 | 
				
			||||||
        "electron-notarize": "^0.0.5",
 | 
					        "electron-notarize": "^0.0.5",
 | 
				
			||||||
@@ -3068,7 +2987,7 @@
 | 
				
			|||||||
        "resolve": "^1.1.6",
 | 
					        "resolve": "^1.1.6",
 | 
				
			||||||
        "sanitize-filename": "^1.6.0",
 | 
					        "sanitize-filename": "^1.6.0",
 | 
				
			||||||
        "semver": "^5.3.0",
 | 
					        "semver": "^5.3.0",
 | 
				
			||||||
        "yargs-parser": "^11.0.0"
 | 
					        "yargs-parser": "^13.0.0"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "camelcase": {
 | 
					        "camelcase": {
 | 
				
			||||||
@@ -3084,9 +3003,9 @@
 | 
				
			|||||||
          "dev": true
 | 
					          "dev": true
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        "yargs-parser": {
 | 
					        "yargs-parser": {
 | 
				
			||||||
          "version": "11.1.1",
 | 
					          "version": "13.0.0",
 | 
				
			||||||
          "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-11.1.1.tgz",
 | 
					          "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.0.0.tgz",
 | 
				
			||||||
          "integrity": "sha512-C6kB/WJDiaxONLJQnF8ccx9SEeoTTLek8RVbaOIsrAUS8VrBEXfmeSnCZxygc+XC2sNMBIwOOnfcxiynjHsVSQ==",
 | 
					          "integrity": "sha512-w2LXjoL8oRdRQN+hOyppuXs+V/fVAYtpcrRxZuF7Kt/Oc+Jr2uAcVntaUTNT6w5ihoWfFDpNY8CPx1QskxZ/pw==",
 | 
				
			||||||
          "dev": true,
 | 
					          "dev": true,
 | 
				
			||||||
          "requires": {
 | 
					          "requires": {
 | 
				
			||||||
            "camelcase": "^5.0.0",
 | 
					            "camelcase": "^5.0.0",
 | 
				
			||||||
@@ -4961,7 +4880,7 @@
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        "load-json-file": {
 | 
					        "load-json-file": {
 | 
				
			||||||
          "version": "2.0.0",
 | 
					          "version": "2.0.0",
 | 
				
			||||||
          "resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
 | 
					          "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
 | 
				
			||||||
          "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=",
 | 
					          "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=",
 | 
				
			||||||
          "dev": true,
 | 
					          "dev": true,
 | 
				
			||||||
          "requires": {
 | 
					          "requires": {
 | 
				
			||||||
@@ -4982,7 +4901,7 @@
 | 
				
			|||||||
        },
 | 
					        },
 | 
				
			||||||
        "pify": {
 | 
					        "pify": {
 | 
				
			||||||
          "version": "2.3.0",
 | 
					          "version": "2.3.0",
 | 
				
			||||||
          "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
 | 
					          "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
 | 
				
			||||||
          "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
 | 
					          "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
 | 
				
			||||||
          "dev": true
 | 
					          "dev": true
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
@@ -6656,15 +6575,6 @@
 | 
				
			|||||||
      "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
 | 
				
			||||||
      "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA=="
 | 
					      "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA=="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "klaw": {
 | 
					 | 
				
			||||||
      "version": "1.3.1",
 | 
					 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/klaw/-/klaw-1.3.1.tgz",
 | 
					 | 
				
			||||||
      "integrity": "sha1-QIhDO0azsbolnXh4XY6W9zugJDk=",
 | 
					 | 
				
			||||||
      "dev": true,
 | 
					 | 
				
			||||||
      "requires": {
 | 
					 | 
				
			||||||
        "graceful-fs": "^4.1.9"
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "latest-version": {
 | 
					    "latest-version": {
 | 
				
			||||||
      "version": "3.1.0",
 | 
					      "version": "3.1.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-3.1.0.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-3.1.0.tgz",
 | 
				
			||||||
@@ -7290,47 +7200,6 @@
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "mkpath": {
 | 
					 | 
				
			||||||
      "version": "0.1.0",
 | 
					 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/mkpath/-/mkpath-0.1.0.tgz",
 | 
					 | 
				
			||||||
      "integrity": "sha1-dVSm+Nhxg0zJe1RisSLEwSTW3pE=",
 | 
					 | 
				
			||||||
      "dev": true
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "mksnapshot": {
 | 
					 | 
				
			||||||
      "version": "0.3.4",
 | 
					 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/mksnapshot/-/mksnapshot-0.3.4.tgz",
 | 
					 | 
				
			||||||
      "integrity": "sha512-FgUTiWiY+35LgL95P/MDYrBuQO5o0s3MmaWKX6ZJWoX4vMOY9vPsAv763l1OSSelL9jPsBQ/wf4bzfqTLNPSFg==",
 | 
					 | 
				
			||||||
      "dev": true,
 | 
					 | 
				
			||||||
      "requires": {
 | 
					 | 
				
			||||||
        "decompress-zip": "0.3.0",
 | 
					 | 
				
			||||||
        "fs-extra": "0.26.7",
 | 
					 | 
				
			||||||
        "request": "2.x"
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "dependencies": {
 | 
					 | 
				
			||||||
        "fs-extra": {
 | 
					 | 
				
			||||||
          "version": "0.26.7",
 | 
					 | 
				
			||||||
          "resolved": "http://registry.npmjs.org/fs-extra/-/fs-extra-0.26.7.tgz",
 | 
					 | 
				
			||||||
          "integrity": "sha1-muH92UiXeY7at20JGM9C0MMYT6k=",
 | 
					 | 
				
			||||||
          "dev": true,
 | 
					 | 
				
			||||||
          "requires": {
 | 
					 | 
				
			||||||
            "graceful-fs": "^4.1.2",
 | 
					 | 
				
			||||||
            "jsonfile": "^2.1.0",
 | 
					 | 
				
			||||||
            "klaw": "^1.0.0",
 | 
					 | 
				
			||||||
            "path-is-absolute": "^1.0.0",
 | 
					 | 
				
			||||||
            "rimraf": "^2.2.8"
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
        "jsonfile": {
 | 
					 | 
				
			||||||
          "version": "2.4.0",
 | 
					 | 
				
			||||||
          "resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
 | 
					 | 
				
			||||||
          "integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=",
 | 
					 | 
				
			||||||
          "dev": true,
 | 
					 | 
				
			||||||
          "requires": {
 | 
					 | 
				
			||||||
            "graceful-fs": "^4.1.6"
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "modify-filename": {
 | 
					    "modify-filename": {
 | 
				
			||||||
      "version": "1.1.0",
 | 
					      "version": "1.1.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/modify-filename/-/modify-filename-1.1.0.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/modify-filename/-/modify-filename-1.1.0.tgz",
 | 
				
			||||||
@@ -9651,12 +9520,6 @@
 | 
				
			|||||||
      "resolved": "https://registry.npmjs.org/pupa/-/pupa-1.0.0.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/pupa/-/pupa-1.0.0.tgz",
 | 
				
			||||||
      "integrity": "sha1-mpVopa9+ZXuEYqbp1TKHQ1YM7/Y="
 | 
					      "integrity": "sha1-mpVopa9+ZXuEYqbp1TKHQ1YM7/Y="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "q": {
 | 
					 | 
				
			||||||
      "version": "1.5.1",
 | 
					 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/q/-/q-1.5.1.tgz",
 | 
					 | 
				
			||||||
      "integrity": "sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc=",
 | 
					 | 
				
			||||||
      "dev": true
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "qs": {
 | 
					    "qs": {
 | 
				
			||||||
      "version": "6.5.2",
 | 
					      "version": "6.5.2",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
 | 
				
			||||||
@@ -11368,12 +11231,12 @@
 | 
				
			|||||||
      "integrity": "sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g="
 | 
					      "integrity": "sha1-9PrTM0R7wLB9TcjpIJ2POaisd+g="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "tmp": {
 | 
					    "tmp": {
 | 
				
			||||||
      "version": "0.0.28",
 | 
					      "version": "0.0.33",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.28.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
 | 
				
			||||||
      "integrity": "sha1-Fyc1t/YU6nrzlmT6hM8N5OUV0SA=",
 | 
					      "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "requires": {
 | 
					      "requires": {
 | 
				
			||||||
        "os-tmpdir": "~1.0.1"
 | 
					        "os-tmpdir": "~1.0.2"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "tmp-promise": {
 | 
					    "tmp-promise": {
 | 
				
			||||||
@@ -11384,17 +11247,6 @@
 | 
				
			|||||||
      "requires": {
 | 
					      "requires": {
 | 
				
			||||||
        "bluebird": "^3.5.0",
 | 
					        "bluebird": "^3.5.0",
 | 
				
			||||||
        "tmp": "0.0.33"
 | 
					        "tmp": "0.0.33"
 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "dependencies": {
 | 
					 | 
				
			||||||
        "tmp": {
 | 
					 | 
				
			||||||
          "version": "0.0.33",
 | 
					 | 
				
			||||||
          "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
 | 
					 | 
				
			||||||
          "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
 | 
					 | 
				
			||||||
          "dev": true,
 | 
					 | 
				
			||||||
          "requires": {
 | 
					 | 
				
			||||||
            "os-tmpdir": "~1.0.2"
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "to-absolute-glob": {
 | 
					    "to-absolute-glob": {
 | 
				
			||||||
@@ -11458,26 +11310,6 @@
 | 
				
			|||||||
        "repeat-string": "^1.6.1"
 | 
					        "repeat-string": "^1.6.1"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "touch": {
 | 
					 | 
				
			||||||
      "version": "0.0.3",
 | 
					 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/touch/-/touch-0.0.3.tgz",
 | 
					 | 
				
			||||||
      "integrity": "sha1-Ua7z1ElXHU8oel2Hyci0kYGg2x0=",
 | 
					 | 
				
			||||||
      "dev": true,
 | 
					 | 
				
			||||||
      "requires": {
 | 
					 | 
				
			||||||
        "nopt": "~1.0.10"
 | 
					 | 
				
			||||||
      },
 | 
					 | 
				
			||||||
      "dependencies": {
 | 
					 | 
				
			||||||
        "nopt": {
 | 
					 | 
				
			||||||
          "version": "1.0.10",
 | 
					 | 
				
			||||||
          "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz",
 | 
					 | 
				
			||||||
          "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=",
 | 
					 | 
				
			||||||
          "dev": true,
 | 
					 | 
				
			||||||
          "requires": {
 | 
					 | 
				
			||||||
            "abbrev": "1"
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "tough-cookie": {
 | 
					    "tough-cookie": {
 | 
				
			||||||
      "version": "2.4.3",
 | 
					      "version": "2.4.3",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
 | 
				
			||||||
@@ -11502,12 +11334,6 @@
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "traverse": {
 | 
					 | 
				
			||||||
      "version": "0.3.9",
 | 
					 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz",
 | 
					 | 
				
			||||||
      "integrity": "sha1-cXuPIgzAu3tE5AUUwisui7xw2Lk=",
 | 
					 | 
				
			||||||
      "dev": true
 | 
					 | 
				
			||||||
    },
 | 
					 | 
				
			||||||
    "trim": {
 | 
					    "trim": {
 | 
				
			||||||
      "version": "0.0.1",
 | 
					      "version": "0.0.1",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,8 +73,8 @@
 | 
				
			|||||||
    "electron": "4.0.3",
 | 
					    "electron": "4.0.3",
 | 
				
			||||||
    "electron-builder": "20.38.5",
 | 
					    "electron-builder": "20.38.5",
 | 
				
			||||||
    "electron-compile": "6.4.4",
 | 
					    "electron-compile": "6.4.4",
 | 
				
			||||||
    "electron-installer-debian": "^1.1.0",
 | 
					    "electron-installer-debian": "^1.1.1",
 | 
				
			||||||
    "electron-packager": "13.0.1",
 | 
					    "electron-packager": "13.1.0",
 | 
				
			||||||
    "electron-rebuild": "1.8.4",
 | 
					    "electron-rebuild": "1.8.4",
 | 
				
			||||||
    "lorem-ipsum": "1.0.6",
 | 
					    "lorem-ipsum": "1.0.6",
 | 
				
			||||||
    "tape": "4.10.1",
 | 
					    "tape": "4.10.1",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,10 @@ const $fileUploadInput = $("#import-file-upload-input");
 | 
				
			|||||||
const $importProgressCountWrapper = $("#import-progress-count-wrapper");
 | 
					const $importProgressCountWrapper = $("#import-progress-count-wrapper");
 | 
				
			||||||
const $importProgressCount = $("#import-progress-count");
 | 
					const $importProgressCount = $("#import-progress-count");
 | 
				
			||||||
const $importButton = $("#import-button");
 | 
					const $importButton = $("#import-button");
 | 
				
			||||||
const $safeImport = $("#safe-import");
 | 
					const $safeImportCheckbox = $("#safe-import-checkbox");
 | 
				
			||||||
 | 
					const $shrinkImagesCheckbox = $("#shrink-images-checkbox");
 | 
				
			||||||
 | 
					const $textImportedAsTextCheckbox = $("#text-imported-as-text-checkbox");
 | 
				
			||||||
 | 
					const $codeImportedAsCodeCheckbox = $("#code-imported-as-code-checkbox");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
let importId;
 | 
					let importId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -22,7 +25,11 @@ async function showDialog() {
 | 
				
			|||||||
    $importProgressCountWrapper.hide();
 | 
					    $importProgressCountWrapper.hide();
 | 
				
			||||||
    $importProgressCount.text('0');
 | 
					    $importProgressCount.text('0');
 | 
				
			||||||
    $fileUploadInput.val('').change(); // to trigger Import button disabling listener below
 | 
					    $fileUploadInput.val('').change(); // to trigger Import button disabling listener below
 | 
				
			||||||
    $safeImport.attr("checked", "checked");
 | 
					
 | 
				
			||||||
 | 
					    $safeImportCheckbox.attr("checked", "checked");
 | 
				
			||||||
 | 
					    $shrinkImagesCheckbox.attr("checked", "checked");
 | 
				
			||||||
 | 
					    $textImportedAsTextCheckbox.attr("checked", "checked");
 | 
				
			||||||
 | 
					    $codeImportedAsCodeCheckbox.attr("checked", "checked");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    glob.activeDialog = $dialog;
 | 
					    glob.activeDialog = $dialog;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -50,7 +57,11 @@ async function importIntoNote(importNoteId) {
 | 
				
			|||||||
    // dialog (which shouldn't happen, but still ...)
 | 
					    // dialog (which shouldn't happen, but still ...)
 | 
				
			||||||
    importId = utils.randomString(10);
 | 
					    importId = utils.randomString(10);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const safeImport = $safeImport.is(":checked") ? "true" : "false";
 | 
					    const safeImport = boolToString($safeImportCheckbox);
 | 
				
			||||||
 | 
					    const shrinkImages = boolToString($shrinkImagesCheckbox);
 | 
				
			||||||
 | 
					    const textImportedAsText = boolToString($textImportedAsTextCheckbox);
 | 
				
			||||||
 | 
					    const codeImportedAsCode = boolToString($codeImportedAsCodeCheckbox);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let noteId;
 | 
					    let noteId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (const file of files) {
 | 
					    for (const file of files) {
 | 
				
			||||||
@@ -58,6 +69,9 @@ async function importIntoNote(importNoteId) {
 | 
				
			|||||||
        formData.append('upload', file);
 | 
					        formData.append('upload', file);
 | 
				
			||||||
        formData.append('importId', importId);
 | 
					        formData.append('importId', importId);
 | 
				
			||||||
        formData.append('safeImport', safeImport);
 | 
					        formData.append('safeImport', safeImport);
 | 
				
			||||||
 | 
					        formData.append('shrinkImages', shrinkImages);
 | 
				
			||||||
 | 
					        formData.append('textImportedAsText', textImportedAsText);
 | 
				
			||||||
 | 
					        formData.append('codeImportedAsCode', codeImportedAsCode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ({noteId} = await $.ajax({
 | 
					        ({noteId} = await $.ajax({
 | 
				
			||||||
            url: baseApiUrl + 'notes/' + importNoteId + '/import',
 | 
					            url: baseApiUrl + 'notes/' + importNoteId + '/import',
 | 
				
			||||||
@@ -86,6 +100,10 @@ async function importIntoNote(importNoteId) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function boolToString($el) {
 | 
				
			||||||
 | 
					    return $el.is(":checked") ? "true" : "false";
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
messagingService.subscribeToMessages(async message => {
 | 
					messagingService.subscribeToMessages(async message => {
 | 
				
			||||||
    if (message.type === 'import-error') {
 | 
					    if (message.type === 'import-error') {
 | 
				
			||||||
        infoService.showError(message.message);
 | 
					        infoService.showError(message.message);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,9 +13,14 @@ const ImportContext = require('../../services/import_context');
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
async function importToBranch(req) {
 | 
					async function importToBranch(req) {
 | 
				
			||||||
    const {parentNoteId} = req.params;
 | 
					    const {parentNoteId} = req.params;
 | 
				
			||||||
    let {importId, safeImport} = req.body;
 | 
					    const {importId} = req.body;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    safeImport = safeImport !== 'false';
 | 
					    const options = {
 | 
				
			||||||
 | 
					        safeImport: req.body.safeImport !== 'false',
 | 
				
			||||||
 | 
					        optimizedImages: req.body.optimizedImages !== 'false',
 | 
				
			||||||
 | 
					        textImportedAsText: req.body.textImportedAsText !== 'false',
 | 
				
			||||||
 | 
					        codeImportedAsCode: req.body.codeImportedAsCode !== 'false'
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const file = req.file;
 | 
					    const file = req.file;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -37,7 +42,7 @@ async function importToBranch(req) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    let note; // typically root of the import - client can show it after finishing the import
 | 
					    let note; // typically root of the import - client can show it after finishing the import
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const importContext = ImportContext.getInstance(importId, safeImport);
 | 
					    const importContext = ImportContext.getInstance(importId, options);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
        if (extension === '.tar') {
 | 
					        if (extension === '.tar') {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,31 +12,24 @@ const jimp = require('jimp');
 | 
				
			|||||||
const imageType = require('image-type');
 | 
					const imageType = require('image-type');
 | 
				
			||||||
const sanitizeFilename = require('sanitize-filename');
 | 
					const sanitizeFilename = require('sanitize-filename');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function saveImage(buffer, originalName, parentNoteId) {
 | 
					async function saveImage(buffer, originalName, parentNoteId, shrinkImage) {
 | 
				
			||||||
    const resizedImage = await resize(buffer);
 | 
					    const finalImageBuffer = shrinkImage ? await shrinkImage(buffer) : buffer;
 | 
				
			||||||
    let optimizedImage;
 | 
					 | 
				
			||||||
    try {
 | 
					 | 
				
			||||||
      optimizedImage = await optimize(resizedImage);
 | 
					 | 
				
			||||||
    } catch (e) {
 | 
					 | 
				
			||||||
      log.error(e);
 | 
					 | 
				
			||||||
      optimizedImage = resizedImage;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const imageFormat = imageType(optimizedImage);
 | 
					    const imageFormat = imageType(finalImageBuffer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const parentNote = await repository.getNote(parentNoteId);
 | 
					    const parentNote = await repository.getNote(parentNoteId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const fileNameWithoutExtension = originalName.replace(/\.[^/.]+$/, "");
 | 
					    const fileNameWithoutExtension = originalName.replace(/\.[^/.]+$/, "");
 | 
				
			||||||
    const fileName = sanitizeFilename(fileNameWithoutExtension + "." + imageFormat.ext);
 | 
					    const fileName = sanitizeFilename(fileNameWithoutExtension + "." + imageFormat.ext);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const {note} = await noteService.createNote(parentNoteId, fileName, optimizedImage, {
 | 
					    const {note} = await noteService.createNote(parentNoteId, fileName, finalImageBuffer, {
 | 
				
			||||||
        target: 'into',
 | 
					        target: 'into',
 | 
				
			||||||
        type: 'image',
 | 
					        type: 'image',
 | 
				
			||||||
        isProtected: parentNote.isProtected && protectedSessionService.isProtectedSessionAvailable(),
 | 
					        isProtected: parentNote.isProtected && protectedSessionService.isProtectedSessionAvailable(),
 | 
				
			||||||
        mime: 'image/' + imageFormat.ext.toLowerCase(),
 | 
					        mime: 'image/' + imageFormat.ext.toLowerCase(),
 | 
				
			||||||
        attributes: [
 | 
					        attributes: [
 | 
				
			||||||
            { type: 'label', name: 'originalFileName', value: originalName },
 | 
					            { type: 'label', name: 'originalFileName', value: originalName },
 | 
				
			||||||
            { type: 'label', name: 'fileSize', value: optimizedImage.byteLength }
 | 
					            { type: 'label', name: 'fileSize', value: finalImageBuffer.byteLength }
 | 
				
			||||||
        ]
 | 
					        ]
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -47,6 +40,19 @@ async function saveImage(buffer, originalName, parentNoteId) {
 | 
				
			|||||||
    };
 | 
					    };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					async function shrinkImage(buffer) {
 | 
				
			||||||
 | 
					    const resizedImage = await resize(buffer);
 | 
				
			||||||
 | 
					    let finalImageBuffer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    try {
 | 
				
			||||||
 | 
					        finalImageBuffer = await optimize(resizedImage);
 | 
				
			||||||
 | 
					    } catch (e) {
 | 
				
			||||||
 | 
					        log.error(e);
 | 
				
			||||||
 | 
					        finalImageBuffer = resizedImage;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return finalImageBuffer;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const MAX_SIZE = 1000;
 | 
					const MAX_SIZE = 1000;
 | 
				
			||||||
const MAX_BYTE_SIZE = 200000; // images should have under 100 KBs
 | 
					const MAX_BYTE_SIZE = 200000; // images should have under 100 KBs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -233,7 +233,7 @@ async function importEnex(importContext, file, parentNote) {
 | 
				
			|||||||
              resource.mime = fileTypeFromBuffer.mime;
 | 
					              resource.mime = fileTypeFromBuffer.mime;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            const createResourceNote = async () => {
 | 
					            const createFileNote = async () => {
 | 
				
			||||||
                const resourceNote = (await noteService.createNote(noteEntity.noteId, resource.title, resource.content, {
 | 
					                const resourceNote = (await noteService.createNote(noteEntity.noteId, resource.title, resource.content, {
 | 
				
			||||||
                    attributes: resource.attributes,
 | 
					                    attributes: resource.attributes,
 | 
				
			||||||
                    type: 'file',
 | 
					                    type: 'file',
 | 
				
			||||||
@@ -264,10 +264,10 @@ async function importEnex(importContext, file, parentNote) {
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                } catch (e) {
 | 
					                } catch (e) {
 | 
				
			||||||
                    log.error("error when saving image from ENEX file: " + e);
 | 
					                    log.error("error when saving image from ENEX file: " + e);
 | 
				
			||||||
                    await createResourceNote();
 | 
					                    await createFileNote();
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                await createResourceNote();
 | 
					                await createFileNote();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,8 +22,6 @@ const ImportContext = require('../import_context');
 | 
				
			|||||||
 * @return {Promise<*>}
 | 
					 * @return {Promise<*>}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
async function importTar(importContext, fileBuffer, importRootNote) {
 | 
					async function importTar(importContext, fileBuffer, importRootNote) {
 | 
				
			||||||
    importContext = importContext || new ImportContext("1", false);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // maps from original noteId (in tar file) to newly generated noteId
 | 
					    // maps from original noteId (in tar file) to newly generated noteId
 | 
				
			||||||
    const noteIdMap = {};
 | 
					    const noteIdMap = {};
 | 
				
			||||||
    const attributes = [];
 | 
					    const attributes = [];
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,12 +6,15 @@ const messagingService = require('./messaging');
 | 
				
			|||||||
const importContexts = {};
 | 
					const importContexts = {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ImportContext {
 | 
					class ImportContext {
 | 
				
			||||||
    constructor(importId, safeImport) {
 | 
					    constructor(importId, options) {
 | 
				
			||||||
        // importId is to distinguish between different import events - it is possible (though not recommended)
 | 
					        // importId is to distinguish between different import events - it is possible (though not recommended)
 | 
				
			||||||
        // to have multiple imports going at the same time
 | 
					        // to have multiple imports going at the same time
 | 
				
			||||||
        this.importId = importId;
 | 
					        this.importId = importId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.safeImport = safeImport;
 | 
					        this.safeImport = options.safeImport;
 | 
				
			||||||
 | 
					        this.shrinkImages = options.shrinkImages;
 | 
				
			||||||
 | 
					        this.codeImportedAsCode = options.codeImportedAsCode;
 | 
				
			||||||
 | 
					        this.textImportedAsText = options.textImportedAsText;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // // count is mean to represent count of exported notes where practical, otherwise it's just some measure of progress
 | 
					        // // count is mean to represent count of exported notes where practical, otherwise it's just some measure of progress
 | 
				
			||||||
        this.progressCount = 0;
 | 
					        this.progressCount = 0;
 | 
				
			||||||
@@ -19,9 +22,9 @@ class ImportContext {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /** @return {ImportContext} */
 | 
					    /** @return {ImportContext} */
 | 
				
			||||||
    static getInstance(importId, safeImport) {
 | 
					    static getInstance(importId, options) {
 | 
				
			||||||
        if (!importContexts[importId]) {
 | 
					        if (!importContexts[importId]) {
 | 
				
			||||||
            importContexts[importId] = new ImportContext(importId, safeImport);
 | 
					            importContexts[importId] = new ImportContext(importId, options);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return importContexts[importId];
 | 
					        return importContexts[importId];
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,6 +8,7 @@ const sql = require('./sql');
 | 
				
			|||||||
const cls = require('./cls');
 | 
					const cls = require('./cls');
 | 
				
			||||||
const optionService = require('./options');
 | 
					const optionService = require('./options');
 | 
				
			||||||
const Option = require('../entities/option');
 | 
					const Option = require('../entities/option');
 | 
				
			||||||
 | 
					const ImportContext = require('../services/import_context');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function createConnection() {
 | 
					async function createConnection() {
 | 
				
			||||||
    return await sqlite.open(dataDir.DOCUMENT_PATH, {Promise});
 | 
					    return await sqlite.open(dataDir.DOCUMENT_PATH, {Promise});
 | 
				
			||||||
@@ -100,8 +101,10 @@ async function createInitialDatabase(username, password) {
 | 
				
			|||||||
            notePosition: 0
 | 
					            notePosition: 0
 | 
				
			||||||
        }).save();
 | 
					        }).save();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        const dummyImportContext = new ImportContext("1", false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const tarImportService = require("./import/tar");
 | 
					        const tarImportService = require("./import/tar");
 | 
				
			||||||
        await tarImportService.importTar(null, demoFile, rootNote);
 | 
					        await tarImportService.importTar(dummyImportContext, demoFile, rootNote);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        const startNoteId = await sql.getValue("SELECT noteId FROM branches WHERE parentNoteId = 'root' AND isDeleted = 0 ORDER BY notePosition");
 | 
					        const startNoteId = await sql.getValue("SELECT noteId FROM branches WHERE parentNoteId = 'root' AND isDeleted = 0 ORDER BY notePosition");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,20 +32,20 @@
 | 
				
			|||||||
                        </div>
 | 
					                        </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        <div class="checkbox">
 | 
					                        <div class="checkbox">
 | 
				
			||||||
                            <label data-toggle="tooltip" title="<p>If you check this option, Trilium will attempt to optimize the imported images for size which may affect the perceived image quality. If unchecked, images will be imported without changes.</p><p>This doesn't apply to <code>.tar</code> imports with metadata since it is assumed these files are already optimized.</p>">
 | 
					                            <label data-toggle="tooltip" title="<p>If you check this option, Trilium will attempt to shrink the imported images by scaling and optimization which may affect the perceived image quality. If unchecked, images will be imported without changes.</p><p>This doesn't apply to <code>.tar</code> imports with metadata since it is assumed these files are already optimized.</p>">
 | 
				
			||||||
                                <input id="optimize-images" value="1" type="checkbox" checked> Optimize images
 | 
					                                <input id="shrink-images-checkbox" value="1" type="checkbox" checked> Shrink images
 | 
				
			||||||
                            </label>
 | 
					                            </label>
 | 
				
			||||||
                        </div>
 | 
					                        </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        <div class="checkbox">
 | 
					                        <div class="checkbox">
 | 
				
			||||||
                            <label>
 | 
					                            <label>
 | 
				
			||||||
                                <input id="text-imported-as-text" value="1" type="checkbox" checked> Import HTML, Markdown and TXT as text notes if it's unclear from metadata
 | 
					                                <input id="text-imported-as-text-checkbox" value="1" type="checkbox" checked> Import HTML, Markdown and TXT as text notes if it's unclear from metadata
 | 
				
			||||||
                            </label>
 | 
					                            </label>
 | 
				
			||||||
                        </div>
 | 
					                        </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        <div class="checkbox">
 | 
					                        <div class="checkbox">
 | 
				
			||||||
                            <label>
 | 
					                            <label>
 | 
				
			||||||
                                <input id="code-imported-as-code" value="1" type="checkbox" checked> Import recognized code files (e.g. <code>.json</code>) as code notes if it's unclear from metadata
 | 
					                                <input id="code-imported-as-code-checkbox" value="1" type="checkbox" checked> Import recognized code files (e.g. <code>.json</code>) as code notes if it's unclear from metadata
 | 
				
			||||||
                            </label>
 | 
					                            </label>
 | 
				
			||||||
                        </div>
 | 
					                        </div>
 | 
				
			||||||
                    </div>
 | 
					                    </div>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user