diff --git a/package-lock.json b/package-lock.json index 352612ac2..b51cf1f25 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,13 +25,13 @@ "ldd": "^1.0.0", "mime": "^2.5.2", "node-7z": "^3.0.0", - "pdfjs-dist": "^2.9.359", + "pdfjs-dist": "^3.8.162", "request": "^2.88.0", "sha1": "^1.1.1", "sharp": "^0.30.6", "tar-fs": "^2.0.0", "unrar": "^0.2.0", - "unzipper": "^0.10.11" + "unzipper": "^0.10.14" }, "devDependencies": { "electron": "^19.0.4", @@ -599,64 +599,6 @@ "regenerator-runtime": "^0.13.3" } }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", - "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", - "peer": true, - "dependencies": { - "@jridgewell/set-array": "^1.0.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", - "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", - "peer": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/set-array": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", - "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", - "peer": true, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/source-map": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.5.tgz", - "integrity": "sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==", - "peer": true, - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.0", - "@jridgewell/trace-mapping": "^0.3.9" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.14", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", - "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", - "peer": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.18", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", - "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", - "peer": true, - "dependencies": { - "@jridgewell/resolve-uri": "3.1.0", - "@jridgewell/sourcemap-codec": "1.4.14" - } - }, "node_modules/@malept/cross-spawn-promise": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@malept/cross-spawn-promise/-/cross-spawn-promise-1.1.1.tgz", @@ -770,48 +712,59 @@ } } }, - "node_modules/@npmcli/fs": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.1.tgz", - "integrity": "sha512-8KG5RD0GVP4ydEzRn/I4BNDuxDtqVbOdm8675T49OIG/NGhaK0pjPX7ZcDlvKYbA+ulvVK3ztfcF4uBdOxuJbQ==", - "dev": true, + "node_modules/@mapbox/node-pre-gyp": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.11.tgz", + "integrity": "sha512-Yhlar6v9WQgUp/He7BdgzOz8lqMQ8sU+jkCq7Wx8Myc5YFJLbEe7lgui/V7G1qB1DJykHSGwreceSaD60Y0PUQ==", + "optional": true, "dependencies": { - "@gar/promisify": "^1.0.1", - "semver": "^7.3.5" + "detect-libc": "^2.0.0", + "https-proxy-agent": "^5.0.0", + "make-dir": "^3.1.0", + "node-fetch": "^2.6.7", + "nopt": "^5.0.0", + "npmlog": "^5.0.1", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.11" + }, + "bin": { + "node-pre-gyp": "bin/node-pre-gyp" } }, - "node_modules/@npmcli/fs/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, + "node_modules/@mapbox/node-pre-gyp/node_modules/detect-libc": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", + "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", + "optional": true, "engines": { - "node": ">=10" + "node": ">=8" } }, - "node_modules/@npmcli/fs/node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dev": true, + "node_modules/@mapbox/node-pre-gyp/node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "optional": true, "dependencies": { - "lru-cache": "^6.0.0" + "glob": "^7.1.3" }, "bin": { - "semver": "bin/semver.js" + "rimraf": "bin.js" }, - "engines": { - "node": ">=10" + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@npmcli/fs/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "node_modules/@npmcli/fs": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-1.1.1.tgz", + "integrity": "sha512-8KG5RD0GVP4ydEzRn/I4BNDuxDtqVbOdm8675T49OIG/NGhaK0pjPX7ZcDlvKYbA+ulvVK3ztfcF4uBdOxuJbQ==", + "dev": true, + "dependencies": { + "@gar/promisify": "^1.0.1", + "semver": "^7.3.5" + } }, "node_modules/@npmcli/move-file": { "version": "1.1.2", @@ -917,32 +870,6 @@ "@types/ms": "*" } }, - "node_modules/@types/eslint": { - "version": "8.44.0", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.0.tgz", - "integrity": "sha512-gsF+c/0XOguWgaOgvFs+xnnRqt9GwgTvIks36WpE6ueeI4KCEHHd8K/CKHqhOqrJKsYH8m27kRzQEvWXAwXUTw==", - "peer": true, - "dependencies": { - "@types/estree": "*", - "@types/json-schema": "*" - } - }, - "node_modules/@types/eslint-scope": { - "version": "3.7.4", - "resolved": "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.4.tgz", - "integrity": "sha512-9K4zoImiZc3HlIp6AVUDE4CWYx22a+lhSZMYNpbjW04+YF0KWj4pJXnEMjdnFTiQibFFmElcsasJXDbdI/EPhA==", - "peer": true, - "dependencies": { - "@types/eslint": "*", - "@types/estree": "*" - } - }, - "node_modules/@types/estree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz", - "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==", - "peer": true - }, "node_modules/@types/fs-extra": { "version": "9.0.13", "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.13.tgz", @@ -975,12 +902,6 @@ "integrity": "sha512-3YP80IxxFJB4b5tYC2SUPwkg0XQLiu0nWvhRgEatgjf+29IcWO9X1k8xRv5DGssJ/lCrjYTjQPcobJr2yWIVuQ==", "dev": true }, - "node_modules/@types/json-schema": { - "version": "7.0.12", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz", - "integrity": "sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==", - "peer": true - }, "node_modules/@types/keyv": { "version": "3.1.4", "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", @@ -1050,164 +971,6 @@ "integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==", "dev": true }, - "node_modules/@webassemblyjs/ast": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.6.tgz", - "integrity": "sha512-IN1xI7PwOvLPgjcf180gC1bqn3q/QaOCwYUahIOhbYUu8KA/3tw2RT/T0Gidi1l7Hhj5D/INhJxiICObqpMu4Q==", - "peer": true, - "dependencies": { - "@webassemblyjs/helper-numbers": "1.11.6", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6" - } - }, - "node_modules/@webassemblyjs/floating-point-hex-parser": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.6.tgz", - "integrity": "sha512-ejAj9hfRJ2XMsNHk/v6Fu2dGS+i4UaXBXGemOfQ/JfQ6mdQg/WXtwleQRLLS4OvfDhv8rYnVwH27YJLMyYsxhw==", - "peer": true - }, - "node_modules/@webassemblyjs/helper-api-error": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.6.tgz", - "integrity": "sha512-o0YkoP4pVu4rN8aTJgAyj9hC2Sv5UlkzCHhxqWj8butaLvnpdc2jOwh4ewE6CX0txSfLn/UYaV/pheS2Txg//Q==", - "peer": true - }, - "node_modules/@webassemblyjs/helper-buffer": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.6.tgz", - "integrity": "sha512-z3nFzdcp1mb8nEOFFk8DrYLpHvhKC3grJD2ardfKOzmbmJvEf/tPIqCY+sNcwZIY8ZD7IkB2l7/pqhUhqm7hLA==", - "peer": true - }, - "node_modules/@webassemblyjs/helper-numbers": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.6.tgz", - "integrity": "sha512-vUIhZ8LZoIWHBohiEObxVm6hwP034jwmc9kuq5GdHZH0wiLVLIPcMCdpJzG4C11cHoQ25TFIQj9kaVADVX7N3g==", - "peer": true, - "dependencies": { - "@webassemblyjs/floating-point-hex-parser": "1.11.6", - "@webassemblyjs/helper-api-error": "1.11.6", - "@xtuc/long": "4.2.2" - } - }, - "node_modules/@webassemblyjs/helper-wasm-bytecode": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.6.tgz", - "integrity": "sha512-sFFHKwcmBprO9e7Icf0+gddyWYDViL8bpPjJJl0WHxCdETktXdmtWLGVzoHbqUcY4Be1LkNfwTmXOJUFZYSJdA==", - "peer": true - }, - "node_modules/@webassemblyjs/helper-wasm-section": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.6.tgz", - "integrity": "sha512-LPpZbSOwTpEC2cgn4hTydySy1Ke+XEu+ETXuoyvuyezHO3Kjdu90KK95Sh9xTbmjrCsUwvWwCOQQNta37VrS9g==", - "peer": true, - "dependencies": { - "@webassemblyjs/ast": "1.11.6", - "@webassemblyjs/helper-buffer": "1.11.6", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/wasm-gen": "1.11.6" - } - }, - "node_modules/@webassemblyjs/ieee754": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.6.tgz", - "integrity": "sha512-LM4p2csPNvbij6U1f19v6WR56QZ8JcHg3QIJTlSwzFcmx6WSORicYj6I63f9yU1kEUtrpG+kjkiIAkevHpDXrg==", - "peer": true, - "dependencies": { - "@xtuc/ieee754": "^1.2.0" - } - }, - "node_modules/@webassemblyjs/leb128": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.6.tgz", - "integrity": "sha512-m7a0FhE67DQXgouf1tbN5XQcdWoNgaAuoULHIfGFIEVKA6tu/edls6XnIlkmS6FrXAquJRPni3ZZKjw6FSPjPQ==", - "peer": true, - "dependencies": { - "@xtuc/long": "4.2.2" - } - }, - "node_modules/@webassemblyjs/utf8": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.6.tgz", - "integrity": "sha512-vtXf2wTQ3+up9Zsg8sa2yWiQpzSsMyXj0qViVP6xKGCUT8p8YJ6HqI7l5eCnWx1T/FYdsv07HQs2wTFbbof/RA==", - "peer": true - }, - "node_modules/@webassemblyjs/wasm-edit": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.6.tgz", - "integrity": "sha512-Ybn2I6fnfIGuCR+Faaz7YcvtBKxvoLV3Lebn1tM4o/IAJzmi9AWYIPWpyBfU8cC+JxAO57bk4+zdsTjJR+VTOw==", - "peer": true, - "dependencies": { - "@webassemblyjs/ast": "1.11.6", - "@webassemblyjs/helper-buffer": "1.11.6", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/helper-wasm-section": "1.11.6", - "@webassemblyjs/wasm-gen": "1.11.6", - "@webassemblyjs/wasm-opt": "1.11.6", - "@webassemblyjs/wasm-parser": "1.11.6", - "@webassemblyjs/wast-printer": "1.11.6" - } - }, - "node_modules/@webassemblyjs/wasm-gen": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.6.tgz", - "integrity": "sha512-3XOqkZP/y6B4F0PBAXvI1/bky7GryoogUtfwExeP/v7Nzwo1QLcq5oQmpKlftZLbT+ERUOAZVQjuNVak6UXjPA==", - "peer": true, - "dependencies": { - "@webassemblyjs/ast": "1.11.6", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/ieee754": "1.11.6", - "@webassemblyjs/leb128": "1.11.6", - "@webassemblyjs/utf8": "1.11.6" - } - }, - "node_modules/@webassemblyjs/wasm-opt": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.6.tgz", - "integrity": "sha512-cOrKuLRE7PCe6AsOVl7WasYf3wbSo4CeOk6PkrjS7g57MFfVUF9u6ysQBBODX0LdgSvQqRiGz3CXvIDKcPNy4g==", - "peer": true, - "dependencies": { - "@webassemblyjs/ast": "1.11.6", - "@webassemblyjs/helper-buffer": "1.11.6", - "@webassemblyjs/wasm-gen": "1.11.6", - "@webassemblyjs/wasm-parser": "1.11.6" - } - }, - "node_modules/@webassemblyjs/wasm-parser": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.6.tgz", - "integrity": "sha512-6ZwPeGzMJM3Dqp3hCsLgESxBGtT/OeCvCZ4TA1JUPYgmhAx38tTPR9JaKy0S5H3evQpO/h2uWs2j6Yc/fjkpTQ==", - "peer": true, - "dependencies": { - "@webassemblyjs/ast": "1.11.6", - "@webassemblyjs/helper-api-error": "1.11.6", - "@webassemblyjs/helper-wasm-bytecode": "1.11.6", - "@webassemblyjs/ieee754": "1.11.6", - "@webassemblyjs/leb128": "1.11.6", - "@webassemblyjs/utf8": "1.11.6" - } - }, - "node_modules/@webassemblyjs/wast-printer": { - "version": "1.11.6", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.6.tgz", - "integrity": "sha512-JM7AhRcE+yW2GWYaKeHL5vt4xqee5N2WcezptmgyhNS+ScggqcT1OtXykhAb13Sn5Yas0j2uv9tHgrjwvzAP4A==", - "peer": true, - "dependencies": { - "@webassemblyjs/ast": "1.11.6", - "@xtuc/long": "4.2.2" - } - }, - "node_modules/@xtuc/ieee754": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", - "integrity": "sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==", - "peer": true - }, - "node_modules/@xtuc/long": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/@xtuc/long/-/long-4.2.2.tgz", - "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==", - "peer": true - }, "node_modules/7zip-bin": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/7zip-bin/-/7zip-bin-5.2.0.tgz", @@ -1217,34 +980,13 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true - }, - "node_modules/acorn": { - "version": "8.10.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", - "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", - "peer": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-import-assertions": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz", - "integrity": "sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==", - "peer": true, - "peerDependencies": { - "acorn": "^8" - } + "devOptional": true }, "node_modules/agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, + "devOptional": true, "dependencies": { "debug": "4" }, @@ -1256,7 +998,7 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, + "devOptional": true, "dependencies": { "ms": "2.1.2" }, @@ -1332,6 +1074,7 @@ "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", "integrity": "sha512-5p6WTN0DdTGVQk6VjcEju19IgaHudalcfabD7yhDGeA6bcQnmL+CpveLJq/3hvfwd1aof6L386Ougkx6RfyMIQ==", + "dev": true, "peerDependencies": { "ajv": "^6.9.1" } @@ -1345,7 +1088,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, + "devOptional": true, "engines": { "node": ">=8" } @@ -1507,33 +1250,6 @@ "graceful-fs": "^4.1.6" } }, - "node_modules/app-builder-lib/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/app-builder-lib/node_modules/semver": { - "version": "7.3.8", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", - "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/app-builder-lib/node_modules/universalify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", @@ -1543,17 +1259,24 @@ "node": ">= 10.0.0" } }, - "node_modules/app-builder-lib/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, "node_modules/aproba": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", - "dev": true + "devOptional": true + }, + "node_modules/are-we-there-yet": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz", + "integrity": "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==", + "optional": true, + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">=10" + } }, "node_modules/argparse": { "version": "1.0.10", @@ -1714,15 +1437,6 @@ "node": ">=0.6" } }, - "node_modules/big.js": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", - "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", - "peer": true, - "engines": { - "node": "*" - } - }, "node_modules/binary": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/binary/-/binary-0.3.0.tgz", @@ -1799,38 +1513,6 @@ "node": ">=8" } }, - "node_modules/browserslist": { - "version": "4.21.9", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.9.tgz", - "integrity": "sha512-M0MFoZzbUrRU4KNfCrDLnvyE7gub+peetoTid3TBIqtunaDJyXlwhakT+/VkvSXcfIzFfK/nkCs4nmyTmxdNSg==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "peer": true, - "dependencies": { - "caniuse-lite": "^1.0.30001503", - "electron-to-chromium": "^1.4.431", - "node-releases": "^2.0.12", - "update-browserslist-db": "^1.0.11" - }, - "bin": { - "browserslist": "cli.js" - }, - "engines": { - "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" - } - }, "node_modules/buffer": { "version": "5.6.0", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.6.0.tgz", @@ -2221,25 +1903,55 @@ "node": ">=8" } }, - "node_modules/caniuse-lite": { - "version": "1.0.30001517", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001517.tgz", - "integrity": "sha512-Vdhm5S11DaFVLlyiKu4hiUTkpZu+y1KA/rZZqVQfOD5YdDT/eQKlkt7NaE0WGOFgX32diqt9MiP9CAiFeRklaA==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/caniuse-lite" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "peer": true + "node_modules/canvas": { + "version": "2.11.2", + "resolved": "https://registry.npmjs.org/canvas/-/canvas-2.11.2.tgz", + "integrity": "sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "@mapbox/node-pre-gyp": "^1.0.0", + "nan": "^2.17.0", + "simple-get": "^3.0.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/canvas/node_modules/decompress-response": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz", + "integrity": "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw==", + "optional": true, + "dependencies": { + "mimic-response": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/canvas/node_modules/mimic-response": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz", + "integrity": "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA==", + "optional": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/canvas/node_modules/simple-get": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-3.1.1.tgz", + "integrity": "sha512-CQ5LTKGfCpvE1K0n2us+kuMPbk/q0EKl82s4aheV9oXjFEz6W/Y7oQFVJuU6QG77hRT4Ghb5RURteF5vnWjupA==", + "optional": true, + "dependencies": { + "decompress-response": "^4.2.0", + "once": "^1.3.1", + "simple-concat": "^1.0.0" + } }, "node_modules/caseless": { "version": "0.12.0", @@ -2313,15 +2025,6 @@ "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==" }, - "node_modules/chrome-trace-event": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.3.tgz", - "integrity": "sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==", - "peer": true, - "engines": { - "node": ">=6.0" - } - }, "node_modules/chromium-pickle-js": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/chromium-pickle-js/-/chromium-pickle-js-0.2.0.tgz", @@ -2472,7 +2175,7 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz", "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==", - "dev": true, + "devOptional": true, "bin": { "color-support": "bin.js" } @@ -2500,7 +2203,8 @@ "node_modules/commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "optional": true }, "node_modules/compare-version": { "version": "0.1.2", @@ -2577,7 +2281,7 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true + "devOptional": true }, "node_modules/core-util-is": { "version": "1.0.2", @@ -2692,7 +2396,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", - "dev": true + "devOptional": true }, "node_modules/depd": { "version": "1.1.2", @@ -3357,18 +3061,6 @@ "node": ">=8" } }, - "node_modules/electron-rebuild/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/electron-rebuild/node_modules/mimic-response": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", @@ -3420,21 +3112,6 @@ "lowercase-keys": "^2.0.0" } }, - "node_modules/electron-rebuild/node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/electron-rebuild/node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -3480,18 +3157,6 @@ "node": ">= 8" } }, - "node_modules/electron-rebuild/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "node_modules/electron-to-chromium": { - "version": "1.4.468", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.468.tgz", - "integrity": "sha512-6M1qyhaJOt7rQtNti1lBA0GwclPH+oKCmsra/hkcWs5INLxfXXD/dtdnaKUYQu/pjOBP/8Osoe4mAcNvvzoFag==", - "peer": true - }, "node_modules/electron-window-state": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/electron-window-state/-/electron-window-state-5.0.3.tgz", @@ -3508,16 +3173,7 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/emojis-list": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", - "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", - "peer": true, - "engines": { - "node": ">= 4" - } + "devOptional": true }, "node_modules/encodeurl": { "version": "1.0.2", @@ -3532,7 +3188,6 @@ "version": "0.1.13", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", - "dev": true, "optional": true, "dependencies": { "iconv-lite": "^0.6.2" @@ -3546,19 +3201,6 @@ "once": "^1.4.0" } }, - "node_modules/enhanced-resolve": { - "version": "5.15.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.15.0.tgz", - "integrity": "sha512-LXYT42KJ7lpIKECr2mAXIaMldcNCh/7E0KBKOu4KSfkHmP+mZmSs+8V5gBAqisWBy0OO4W5Oyys0GO1Y8KtdKg==", - "peer": true, - "dependencies": { - "graceful-fs": "^4.2.4", - "tapable": "^2.2.0" - }, - "engines": { - "node": ">=10.13.0" - } - }, "node_modules/env-paths": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz", @@ -3573,12 +3215,6 @@ "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==", "dev": true }, - "node_modules/es-module-lexer": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.3.0.tgz", - "integrity": "sha512-vZK7T0N2CBmBOixhmjdqx2gWVbFZ4DXZ/NyRMZVlJXPa7CyFS+/a4QQsDGDQy9ZfEzxFuNEsMLeQJnKP2p5/JA==", - "peer": true - }, "node_modules/es6-error": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", @@ -3589,6 +3225,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, "engines": { "node": ">=6" } @@ -3605,19 +3242,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "peer": true, - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - }, - "engines": { - "node": ">=8.0.0" - } - }, "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", @@ -3631,45 +3255,6 @@ "node": ">=4" } }, - "node_modules/esrecurse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", - "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", - "peer": true, - "dependencies": { - "estraverse": "^5.2.0" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/esrecurse/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "peer": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "peer": true, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/events": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", - "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", - "peer": true, - "engines": { - "node": ">=0.8.x" - } - }, "node_modules/exif-parser": { "version": "0.1.12", "resolved": "https://registry.npmjs.org/exif-parser/-/exif-parser-0.1.12.tgz", @@ -3875,7 +3460,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", - "dev": true, + "devOptional": true, "dependencies": { "minipass": "^3.0.0" }, @@ -3922,6 +3507,26 @@ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "optional": true }, + "node_modules/gauge": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz", + "integrity": "sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==", + "optional": true, + "dependencies": { + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.2", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.1", + "object-assign": "^4.1.1", + "signal-exit": "^3.0.0", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.2" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -4009,12 +3614,6 @@ "node": ">= 6" } }, - "node_modules/glob-to-regexp": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", - "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", - "peer": true - }, "node_modules/global": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/global/-/global-4.4.0.tgz", @@ -4041,39 +3640,6 @@ "node": ">=10.0" } }, - "node_modules/global-agent/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "optional": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/global-agent/node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "optional": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/global-agent/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "optional": true - }, "node_modules/global-tunnel-ng": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/global-tunnel-ng/-/global-tunnel-ng-2.7.1.tgz", @@ -4207,6 +3773,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, "engines": { "node": ">=8" } @@ -4239,7 +3806,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", - "dev": true + "devOptional": true }, "node_modules/hosted-git-info": { "version": "4.1.0", @@ -4338,7 +3905,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", - "dev": true, + "devOptional": true, "dependencies": { "agent-base": "6", "debug": "4" @@ -4351,7 +3918,7 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, + "devOptional": true, "dependencies": { "ms": "2.1.2" }, @@ -4401,7 +3968,7 @@ "version": "0.6.3", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "dev": true, + "devOptional": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" }, @@ -4537,7 +4104,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, + "devOptional": true, "engines": { "node": ">=8" } @@ -4651,35 +4218,6 @@ "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", "dev": true }, - "node_modules/jest-worker": { - "version": "27.5.1", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.5.1.tgz", - "integrity": "sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==", - "peer": true, - "dependencies": { - "@types/node": "*", - "merge-stream": "^2.0.0", - "supports-color": "^8.0.0" - }, - "engines": { - "node": ">= 10.13.0" - } - }, - "node_modules/jest-worker/node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "peer": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, "node_modules/jimp": { "version": "0.16.13", "resolved": "https://registry.npmjs.org/jimp/-/jimp-0.16.13.tgz", @@ -4730,12 +4268,6 @@ "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", "integrity": "sha512-CuUqjv0FUZIdXkHPI8MezCnFCdaTAacej1TZYulLoAg1h/PhwkdXFN4V/gzY4g+fMBCOV2xF+rp7t2XD2ns/NQ==" }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "peer": true - }, "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -4750,6 +4282,7 @@ "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, "bin": { "json5": "lib/cli.js" }, @@ -4851,29 +4384,6 @@ "node": ">=4" } }, - "node_modules/loader-runner": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz", - "integrity": "sha512-3R/1M+yS3j5ou80Me59j7F9IMs4PXs3VqRrm0TU3AbKPxlmpoY1TNscJV/oGJXo8qCatFGTfDbY6W6ipGOYXfg==", - "peer": true, - "engines": { - "node": ">=6.11.5" - } - }, - "node_modules/loader-utils": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.4.tgz", - "integrity": "sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==", - "peer": true, - "dependencies": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - }, - "engines": { - "node": ">=8.9.0" - } - }, "node_modules/lockfile": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/lockfile/-/lockfile-1.0.4.tgz", @@ -4963,6 +4473,30 @@ "node": ">=10.0.0" } }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "optional": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "optional": true, + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/make-fetch-happen": { "version": "9.1.0", "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-9.1.0.tgz", @@ -5060,12 +4594,6 @@ "node": ">=10" } }, - "node_modules/merge-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", - "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", - "peer": true - }, "node_modules/mime": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz", @@ -5141,7 +4669,7 @@ "version": "3.1.6", "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.1.6.tgz", "integrity": "sha512-rty5kpw9/z8SX9dmxblFA6edItUmwJgMeYDZRrwlIVN27i8gysGbznJwUggw2V/FVqFSDdWy040ZPS811DYAqQ==", - "dev": true, + "devOptional": true, "dependencies": { "yallist": "^4.0.0" }, @@ -5218,13 +4746,13 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "devOptional": true }, "node_modules/minizlib": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", - "dev": true, + "devOptional": true, "dependencies": { "minipass": "^3.0.0", "yallist": "^4.0.0" @@ -5237,7 +4765,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "devOptional": true }, "node_modules/mkdirp": { "version": "0.5.5", @@ -5260,6 +4788,12 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "node_modules/nan": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.17.0.tgz", + "integrity": "sha512-2ZTgtl0nJsO0KQCjEpxcIr5D+Yv90plTitZt9JBfQvVJDS5seMl3FOvsh3+9CoYWXf/1l5OaZzzF6nDm4cagaQ==", + "optional": true + }, "node_modules/napi-build-utils": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", @@ -5323,36 +4857,6 @@ "node": ">=10" } }, - "node_modules/node-abi/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/node-abi/node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/node-abi/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, "node_modules/node-addon-api": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz", @@ -5368,39 +4872,26 @@ "semver": "^7.3.5" } }, - "node_modules/node-api-version/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, + "node_modules/node-fetch": { + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.12.tgz", + "integrity": "sha512-C/fGU2E8ToujUivIO0H+tpQ6HWo4eEmchoPIoXtxCrVghxdKq+QOHqEZW7tuP3KlV3bC8FRMO5nMCC7Zm1VP6g==", + "optional": true, "dependencies": { - "yallist": "^4.0.0" + "whatwg-url": "^5.0.0" }, "engines": { - "node": ">=10" - } - }, - "node_modules/node-api-version/node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" + "node": "4.x || >=6.0.0" }, - "bin": { - "semver": "bin/semver.js" + "peerDependencies": { + "encoding": "^0.1.0" }, - "engines": { - "node": ">=10" + "peerDependenciesMeta": { + "encoding": { + "optional": true + } } }, - "node_modules/node-api-version/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, "node_modules/node-gyp": { "version": "8.4.1", "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-8.4.1.tgz", @@ -5468,18 +4959,6 @@ "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, - "node_modules/node-gyp/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/node-gyp/node_modules/npmlog": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-6.0.2.tgz", @@ -5510,21 +4989,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/node-gyp/node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/node-gyp/node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -5546,27 +5010,6 @@ "node": ">= 8" } }, - "node_modules/node-gyp/node_modules/wide-align": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", - "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", - "dev": true, - "dependencies": { - "string-width": "^1.0.2 || 2 || 3 || 4" - } - }, - "node_modules/node-gyp/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "node_modules/node-releases": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", - "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==", - "peer": true - }, "node_modules/node-yaml": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/node-yaml/-/node-yaml-4.0.1.tgz", @@ -5652,7 +5095,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", - "dev": true, + "devOptional": true, "dependencies": { "abbrev": "1" }, @@ -5692,6 +5135,18 @@ "node": ">=4" } }, + "node_modules/npmlog": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz", + "integrity": "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw==", + "optional": true, + "dependencies": { + "are-we-there-yet": "^2.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^3.0.0", + "set-blocking": "^2.0.0" + } + }, "node_modules/oauth-sign": { "version": "0.9.0", "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", @@ -5700,6 +5155,15 @@ "node": "*" } }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -5837,12 +5301,25 @@ "node": ">=0.10.0" } }, + "node_modules/path2d-polyfill": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path2d-polyfill/-/path2d-polyfill-2.0.1.tgz", + "integrity": "sha512-ad/3bsalbbWhmBo0D6FZ4RNMwsLsPpL6gnvhuSaU5Vm7b06Kr5ubSltQQ0T7YKsiJQO+g22zJ4dJKNTXIyOXtA==", + "optional": true, + "engines": { + "node": ">=8" + } + }, "node_modules/pdfjs-dist": { - "version": "2.9.359", - "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-2.9.359.tgz", - "integrity": "sha512-P2nYtkacdlZaNNwrBLw1ZyMm0oE2yY/5S/GDCAmMJ7U4+ciL/D0mrlEC/o4HZZc/LNE3w8lEVzBEyVgEQlPVKQ==", - "peerDependencies": { - "worker-loader": "^3.0.7" + "version": "3.8.162", + "resolved": "https://registry.npmjs.org/pdfjs-dist/-/pdfjs-dist-3.8.162.tgz", + "integrity": "sha512-Do0Lpuk1ItcNnIPr9MM+/jnnMOb4i6asRX7gVnL6fFUW1QPC7ERfHQkbhF7jkAri1o6GxttX0Yn7ZhOmpFUeGA==", + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "canvas": "^2.11.2", + "path2d-polyfill": "^2.0.1" } }, "node_modules/peek-readable": { @@ -5872,12 +5349,6 @@ "resolved": "https://registry.npmjs.org/phin/-/phin-2.9.3.tgz", "integrity": "sha512-CzFr90qM24ju5f88quFC/6qohjC144rehe5n6DH900lgXmUe86+xCKc10ev56gRKC4/BkHUoG4uSiQgBiIXwDA==" }, - "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", - "peer": true - }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", @@ -6088,15 +5559,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "peer": true, - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, "node_modules/rc": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", @@ -6332,22 +5794,18 @@ "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" }, - "node_modules/schema-utils": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", - "integrity": "sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==", - "peer": true, + "node_modules/semver": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", "dependencies": { - "@types/json-schema": "^7.0.8", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" + "lru-cache": "^6.0.0" }, - "engines": { - "node": ">= 10.13.0" + "bin": { + "semver": "bin/semver.js" }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" + "engines": { + "node": ">=10" } }, "node_modules/semver-compare": { @@ -6356,6 +5814,22 @@ "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==", "optional": true }, + "node_modules/semver/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/semver/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + }, "node_modules/serialize-error": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz", @@ -6371,20 +5845,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/serialize-javascript": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.1.tgz", - "integrity": "sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w==", - "peer": true, - "dependencies": { - "randombytes": "^2.1.0" - } - }, "node_modules/set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true + "devOptional": true }, "node_modules/setimmediate": { "version": "1.0.5", @@ -6448,36 +5913,11 @@ "node": ">=8" } }, - "node_modules/sharp/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/sharp/node_modules/node-addon-api": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.0.0.tgz", "integrity": "sha512-CvkDw2OEnme7ybCykJpVcKH+uAOLV2qLqiyla128dN9TkEWfrYmxG6C2boDe5KcNQqZF3orkqzGgOMvZ/JNekA==" }, - "node_modules/sharp/node_modules/semver": { - "version": "7.3.7", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz", - "integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==", - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/sharp/node_modules/tar-fs": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", @@ -6504,11 +5944,6 @@ "node": ">=6" } }, - "node_modules/sharp/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, "node_modules/signal-exit": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", @@ -6693,6 +6128,7 @@ "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, "dependencies": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" @@ -6761,7 +6197,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, + "devOptional": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -6775,7 +6211,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, + "devOptional": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -6846,20 +6282,11 @@ "node": ">=8" } }, - "node_modules/tapable": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", - "integrity": "sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==", - "peer": true, - "engines": { - "node": ">=6" - } - }, "node_modules/tar": { "version": "6.1.11", "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", - "dev": true, + "devOptional": true, "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", @@ -6899,7 +6326,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", - "dev": true, + "devOptional": true, "engines": { "node": ">=10" } @@ -6908,7 +6335,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "dev": true, + "devOptional": true, "bin": { "mkdirp": "bin/cmd.js" }, @@ -6920,7 +6347,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "devOptional": true }, "node_modules/temp-file": { "version": "3.4.0", @@ -6967,58 +6394,6 @@ "node": ">= 10.0.0" } }, - "node_modules/terser": { - "version": "5.19.2", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.19.2.tgz", - "integrity": "sha512-qC5+dmecKJA4cpYxRa5aVkKehYsQKc+AHeKl0Oe62aYjBL8ZA33tTljktDHJSaxxMnbI5ZYw+o/S2DxxLu8OfA==", - "peer": true, - "dependencies": { - "@jridgewell/source-map": "^0.3.3", - "acorn": "^8.8.2", - "commander": "^2.20.0", - "source-map-support": "~0.5.20" - }, - "bin": { - "terser": "bin/terser" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/terser-webpack-plugin": { - "version": "5.3.9", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.9.tgz", - "integrity": "sha512-ZuXsqE07EcggTWQjXUj+Aot/OMcD0bMKGgF63f7UxYcu5/AJF53aIpK1YoP5xR9l6s/Hy2b+t1AM0bLNPRuhwA==", - "peer": true, - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.17", - "jest-worker": "^27.4.5", - "schema-utils": "^3.1.1", - "serialize-javascript": "^6.0.1", - "terser": "^5.16.8" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "^5.1.0" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "esbuild": { - "optional": true - }, - "uglify-js": { - "optional": true - } - } - }, "node_modules/timm": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/timm/-/timm-1.7.1.tgz", @@ -7140,6 +6515,12 @@ "node": ">=0.8" } }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "optional": true + }, "node_modules/traverse": { "version": "0.3.9", "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", @@ -7255,9 +6636,9 @@ } }, "node_modules/unzipper": { - "version": "0.10.11", - "resolved": "https://registry.npmjs.org/unzipper/-/unzipper-0.10.11.tgz", - "integrity": "sha512-+BrAq2oFqWod5IESRjL3S8baohbevGcVA+teAIOYWM3pDVdseogqbzhhvvmiyQrUNKFUnDMtELW3X8ykbyDCJw==", + "version": "0.10.14", + "resolved": "https://registry.npmjs.org/unzipper/-/unzipper-0.10.14.tgz", + "integrity": "sha512-ti4wZj+0bQTiX2KmKWuwj7lhV+2n//uXEotUmGuQqrbVZSEGFMbI68+c6JCQ8aAmUWYvtHEz2A8K6wXvueR/6g==", "dependencies": { "big-integer": "^1.6.17", "binary": "~0.3.0", @@ -7290,36 +6671,6 @@ "util-deprecate": "~1.0.1" } }, - "node_modules/update-browserslist-db": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", - "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/browserslist" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "peer": true, - "dependencies": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" - }, - "bin": { - "update-browserslist-db": "cli.js" - }, - "peerDependencies": { - "browserslist": ">= 4.21.0" - } - }, "node_modules/uri-js": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", @@ -7380,19 +6731,6 @@ "extsprintf": "^1.2.0" } }, - "node_modules/watchpack": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.0.tgz", - "integrity": "sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==", - "peer": true, - "dependencies": { - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.1.2" - }, - "engines": { - "node": ">=10.13.0" - } - }, "node_modules/wcwidth": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", @@ -7402,60 +6740,20 @@ "defaults": "^1.0.3" } }, - "node_modules/webpack": { - "version": "5.88.2", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.88.2.tgz", - "integrity": "sha512-JmcgNZ1iKj+aiR0OvTYtWQqJwq37Pf683dY9bVORwVbUrDhLhdn/PlO2sHsFHPkj7sHNQF3JwaAkp49V+Sq1tQ==", - "peer": true, - "dependencies": { - "@types/eslint-scope": "^3.7.3", - "@types/estree": "^1.0.0", - "@webassemblyjs/ast": "^1.11.5", - "@webassemblyjs/wasm-edit": "^1.11.5", - "@webassemblyjs/wasm-parser": "^1.11.5", - "acorn": "^8.7.1", - "acorn-import-assertions": "^1.9.0", - "browserslist": "^4.14.5", - "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.15.0", - "es-module-lexer": "^1.2.1", - "eslint-scope": "5.1.1", - "events": "^3.2.0", - "glob-to-regexp": "^0.4.1", - "graceful-fs": "^4.2.9", - "json-parse-even-better-errors": "^2.3.1", - "loader-runner": "^4.2.0", - "mime-types": "^2.1.27", - "neo-async": "^2.6.2", - "schema-utils": "^3.2.0", - "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.3.7", - "watchpack": "^2.4.0", - "webpack-sources": "^3.2.3" - }, - "bin": { - "webpack": "bin/webpack.js" - }, - "engines": { - "node": ">=10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependenciesMeta": { - "webpack-cli": { - "optional": true - } - } + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "optional": true }, - "node_modules/webpack-sources": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", - "integrity": "sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==", - "peer": true, - "engines": { - "node": ">=10.13.0" + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "optional": true, + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" } }, "node_modules/which": { @@ -7469,31 +6767,20 @@ "which": "bin/which" } }, + "node_modules/wide-align": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", + "integrity": "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg==", + "devOptional": true, + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, "node_modules/wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=" }, - "node_modules/worker-loader": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/worker-loader/-/worker-loader-3.0.8.tgz", - "integrity": "sha512-XQyQkIFeRVC7f7uRhFdNMe/iJOdO6zxAaR3EWbDp45v3mDhrTi+++oswKNxShUNjPC/1xUp5DB29YKLhFo129g==", - "peer": true, - "dependencies": { - "loader-utils": "^2.0.0", - "schema-utils": "^3.0.0" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "peerDependencies": { - "webpack": "^4.0.0 || ^5.0.0" - } - }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", diff --git a/package.json b/package.json index 988fe5d19..04fa19a8f 100644 --- a/package.json +++ b/package.json @@ -69,13 +69,13 @@ "ldd": "^1.0.0", "mime": "^2.5.2", "node-7z": "^3.0.0", - "pdfjs-dist": "^2.9.359", + "pdfjs-dist": "^3.8.162", "request": "^2.88.0", "sha1": "^1.1.1", "sharp": "^0.30.6", "tar-fs": "^2.0.0", "unrar": "^0.2.0", - "unzipper": "^0.10.11" + "unzipper": "^0.10.14" }, "devDependencies": { "electron": "^19.0.4", diff --git a/scripts/cache.js b/scripts/cache.js index 045d67347..f17760924 100644 --- a/scripts/cache.js +++ b/scripts/cache.js @@ -13,7 +13,7 @@ function processTheImageQueue() var img = queuedImages[0]; var sha = img.sha; - var realPath = file.realPath(img.file); + var realPath = fileManager.realPath(img.file); sharp(realPath).jpeg({quality: 95}).resize({width: img.size, background: 'white'}).toFile(p.join(cacheFolder, sha+'.jpg'), function(error) { @@ -174,7 +174,6 @@ var data = false; function returnCacheImage(file, sha, callback = false, vars = false) { - if(!data) data = storage.get('cache'); if(!callback) @@ -184,11 +183,11 @@ function returnCacheImage(file, sha, callback = false, vars = false) sha = sha1(file); } - var size = Math.round(window.devicePixelRatio * 150); + let size = Math.round(window.devicePixelRatio * 150); - var imgCache = data[sha]; + let imgCache = data[sha]; - var path = p.join(cacheFolder, sha+'.jpg?size='+size); + let path = p.join(cacheFolder, sha+'.jpg?size='+size); if(typeof imgCache == 'undefined' || !fs.existsSync(p.join(cacheFolder, sha+'.jpg'))) { @@ -213,6 +212,65 @@ function returnCacheImage(file, sha, callback = false, vars = false) } } +async function returnThumbnailsImages(images, callback, file = false) +{ + if(!data) data = storage.get('cache'); + + let size = Math.round(window.devicePixelRatio * 150); + + let thumbnails = {}; + let toGenerateThumbnails = []; + let toGenerateThumbnailsData = {}; + + for(let i = 0, len = images.length; i < len; i++) + { + let image = images[i]; + + let sha = image.sha || sha1(image.path); + let imgCache = data[sha]; + + let path = p.join(cacheFolder, sha+'.jpg?size='+size); + + if(typeof imgCache == 'undefined' || !fs.existsSync(p.join(cacheFolder, sha+'.jpg'))) + { + toGenerateThumbnails.push(image); + toGenerateThumbnailsData[image.path] = {sha: sha, vars: image.vars}; + + thumbnails[sha] = {cache: false, path: '', sha: sha}; + } + else + { + data[sha].lastAccess = time(); + + if(imgCache.size != size) + { + toGenerateThumbnails.push(image); + toGenerateThumbnailsData[image.path] = {sha: sha, vars: image.vars}; + + thumbnails[sha] = {cache: true, path: escapeBackSlash(path), sha: sha}; + } + else + { + thumbnails[sha] = {cache: true, path: escapeBackSlash(path), sha: sha}; + } + } + } + + if(toGenerateThumbnails.length > 0 && file) + { + // Consider adding this to a queue if it causes problems + file.makeAvailable(toGenerateThumbnails, function(image) { + + let data = toGenerateThumbnailsData[image.path]; + addImageToQueue(image.path, size, data.sha, callback, data.vars || false); + + }); + } + + return thumbnails; +} + + function writeFile(name, content) { fs.writeFile(p.join(cacheFolder, name), content, function(){}); @@ -229,6 +287,7 @@ function readFile(name) module.exports = { folder: cacheFolder, returnCacheImage: returnCacheImage, + returnThumbnailsImages: returnThumbnailsImages, cleanQueue: cleanQueue, writeFile: writeFile, readFile: readFile, diff --git a/scripts/dom.js b/scripts/dom.js index 1ab5d1c26..d3c1fb20f 100644 --- a/scripts/dom.js +++ b/scripts/dom.js @@ -182,141 +182,133 @@ function addImageToDom(querySelector, path, animation = true) } } -function loadFilesIndexPage(animation, path, keepScroll, mainPath) +async function loadFilesIndexPage(file, animation, path, keepScroll, mainPath) { - queue.clean('folderThumbnails'); + file.read().then(async function(files){ - if(!path) - { - var sort = config.sortIndex; - var sortInvert = config.sortInvertIndex; - var foldersFirst = config.foldersFirstIndex; - } - else - { - var sort = config.sort; - var sortInvert = config.sortInvert; - var foldersFirst = config.foldersFirst; - } + queue.clean('folderThumbnails'); - var order = ''; + let pathFiles = []; - if(sort == 'name') - order = 'simple'; - else if(sort == 'numeric') - order = 'numeric'; - else - order = 'simple-numeric'; + if(files) + { + let images = []; - let pathFiles = []; + for(let i = 0, len = files.length; i < len; i++) + { + let _file = files[i]; - var files = fs.readdirSync(file.realPath(path)); + if(inArray(mime.getType(_file.path), compatibleMime)) + { + files[i].sha = sha1(_file.path); + images.push(files[i]); + } + } - if(files) - { - for(var i = 0; i < files.length; i++) - { - var fileName = files[i]; - var filePath = p.join(path, fileName); + let thumbnails = await cache.returnThumbnailsImages(images, function(data){ - var realPath = file.realPath(filePath, -1); + addImageToDom(data.sha, data.path); + + }, file); - if(inArray(mime.getType(realPath), compatibleMime)) + for(let i = 0, len = files.length; i < len; i++) { - var sha = sha1(filePath); + let file = files[i]; + let fileName = file.name; + let filePath = file.path; - var thumbnail = cache.returnCacheImage(realPath/*filePath*/, sha, function(data){ + let realPath = fileManager.realPath(filePath, -1); - addImageToDom(data.sha, data.path); + if(inArray(mime.getType(realPath), compatibleMime)) + { + let sha = file.sha; - }); + let thumbnail = thumbnails[file.sha]; - pathFiles.push({ - sha: sha, - name: fileName.replace(/\.[^\.]*$/, ''), - path: filePath, - mainPath: mainPath, - thumbnail: (thumbnail.cache) ? thumbnail.path : '', - folder: false, - }); - } - else if(fs.statSync(realPath).isDirectory() || inArray(fileExtension(filePath), compressedExtensions.all)) - { - var images = getFolderThumbnailsAsync(filePath); + pathFiles.push({ + sha: sha, + name: fileName.replace(/\.[^\.]*$/, ''), + path: filePath, + mainPath: mainPath, + thumbnail: (thumbnail.cache) ? thumbnail.path : '', + folder: false, + }); + } + else if(file.folder || file.compressed) + { + let images = await getFolderThumbnails(filePath); - pathFiles.push({ - name: fileName, - path: filePath, - mainPath: mainPath, - images: images, - folder: true, - }); + pathFiles.push({ + name: fileName, + path: filePath, + mainPath: mainPath, + images: images, + folder: true, + }); + } } } - } - if(!isEmpty(pathFiles)) - { - pathFiles.sort(function (a, b) { - if(foldersFirst && a.folder && !b.folder) return -1; - if(foldersFirst && b.folder && !a.folder) return 1; - return (sortInvert) ? -(orderBy(a, b, order, 'name')) : orderBy(a, b, order, 'name'); - }); - } + handlebarsContext.comics = pathFiles; - handlebarsContext.comics = pathFiles; + // Comic reading progress + let comic = false, _comics = storage.get('comics'); - // Comic reading progress - var comic = false, _comics = storage.get('comics'); - - for(let i in _comics) - { - if(_comics[i].path == mainPath) + for(let i in _comics) { - comic = _comics[i]; - break; + if(_comics[i].path == mainPath) + { + comic = _comics[i]; + break; + } } - } - var readingProgress = storage.get('readingProgress'); + let readingProgress = storage.get('readingProgress'); - if(readingProgress[mainPath] && readingProgress[mainPath].lastReading > 0) - { - var sha = sha1(readingProgress[mainPath].path); + if(readingProgress[mainPath] && readingProgress[mainPath].lastReading > 0) + { + let sha = sha1(readingProgress[mainPath].path); - var realPath = file.realPath(readingProgress[mainPath].path, -1); + let realPath = fileManager.realPath(readingProgress[mainPath].path, -1); - var thumbnail = cache.returnCacheImage(realPath, sha, function(data){ + let thumbnail = cache.returnCacheImage(realPath, sha, function(data){ - addImageToDom(data.sha, data.path); + addImageToDom(data.sha, data.path); - }); + }); - readingProgress[mainPath].sha = sha; - readingProgress[mainPath].thumbnail = (thumbnail.cache) ? thumbnail.path : ''; - readingProgress[mainPath].mainPath = mainPath; - readingProgress[mainPath].pathText = returnTextPath(readingProgress[mainPath].path, mainPath, true); - handlebarsContext.comicsReadingProgress = readingProgress[mainPath]; - } - else - { - handlebarsContext.comicsReadingProgress = false; - } + readingProgress[mainPath].sha = sha; + readingProgress[mainPath].thumbnail = (thumbnail.cache) ? thumbnail.path : ''; + readingProgress[mainPath].mainPath = mainPath; + readingProgress[mainPath].pathText = returnTextPath(readingProgress[mainPath].path, mainPath, true); + handlebarsContext.comicsReadingProgress = readingProgress[mainPath]; + } + else + { + handlebarsContext.comicsReadingProgress = false; + } - if(keepScroll > 1) - template.contentRight().children().html(template.load('index.content.right.'+config.view+'.html')).scrollTop(keepScroll); - else - template.contentRight().children().html(template.load('index.content.right.'+config.view+'.html')); + if(keepScroll > 1) + template.contentRight().children().html(template.load('index.content.right.'+config.view+'.html')).scrollTop(keepScroll); + else + template.contentRight().children().html(template.load('index.content.right.'+config.view+'.html')); - //template.loadContentRight('index.content.right.'+config.view+'.html', animation, keepScroll); - events.events(); - justifyViewModule(); + //template.loadContentRight('index.content.right.'+config.view+'.html', animation, keepScroll); + events.events(); + justifyViewModule(); + + }).catch(function(error){ + + console.error(error); + dom.compressedError(error); + + }); } var currentPath = false, currentPathScrollTop = []; -function loadIndexPage(animation = true, path = false, content = false, keepScroll = false, mainPath = false, fromGoBack = false) +function _loadIndexPage(animation = true, path = false, content = false, keepScroll = false, mainPath = false, fromGoBack = false) { onReading = false; @@ -404,7 +396,7 @@ function loadIndexPage(animation = true, path = false, content = false, keepScro for(let key in comics) { - var images = getFolderThumbnailsAsync(comics[key].path); + var images = getFolderThumbnails(comics[key].path); comics[key].images = images; comics[key].mainPath = config.showFullPathLibrary ? p.parse(comics[key].path).root : comics[key].path; @@ -461,14 +453,14 @@ function loadIndexPage(animation = true, path = false, content = false, keepScro cache.cleanQueue(); - if(!fs.existsSync(file.realPath(path, -1)) && file.containsCompressed(path)) + if(!fs.existsSync(fileManager.realPath(path, -1)) && fileManager.containsCompressed(path)) { fileCompressed.decompressRecursive(path, function(files){ if(checkError(files) && files.error == ERROR_UNZIPPING_THE_FILE) return dom.compressedError(files); - if(!fs.statSync(file.realPath(path, -1)).isDirectory() && inArray(fileExtension(path), compressedExtensions.all)) + if(!fs.statSync(fileManager.realPath(path, -1)).isDirectory() && inArray(fileExtension(path), compressedExtensions.all)) { fileCompressed.returnFiles(path, false, false, function(files){ @@ -488,7 +480,7 @@ function loadIndexPage(animation = true, path = false, content = false, keepScro } else { - if(!fs.statSync(file.realPath(path, -1)).isDirectory() && inArray(fileExtension(path), compressedExtensions.all)) + if(!fs.statSync(fileManager.realPath(path, -1)).isDirectory() && inArray(fileExtension(path), compressedExtensions.all)) { fileCompressed.returnFiles(path, false, false, function(files){ @@ -521,519 +513,322 @@ function loadIndexPage(animation = true, path = false, content = false, keepScro } -function compressedError(error) -{ - //console.log(error); - - electronRemote.dialog.showMessageBox({ - type: 'error', - title: language.error.uncompress.title, - message: language.error.uncompress.message, - detail: error.detail, - }); -} - -function addSepToEnd(path) -{ - if(!new RegExp(pregQuote(p.sep)+'\s*$').test(path)) - path = path + p.sep; - - return path; -} - -function returnTextPath(path, mainPath, image = false) +async function loadIndexPage(animation = true, path = false, content = false, keepScroll = false, mainPath = false, fromGoBack = false) { - mainPathR = addSepToEnd(p.dirname(mainPath)); - - var files = path.replace(new RegExp('^\s*'+pregQuote(mainPathR)), '').split(p.sep); - - var path = []; - - for(let index in files) - { - path.push(image ? htmlEntities(files[index]) : files[index]); - } - - return path.join(image ? 'chevron_right' : ' / '); -} - -function headerPath(path, mainPath) -{ - mainPathR = addSepToEnd(p.dirname(mainPath)); + onReading = false; - var files = path.replace(new RegExp('^\s*'+pregQuote(mainPathR)), '').split(p.sep); + reading.hideContent(); - var path = []; + generateAppMenu(); - var pathJoin = mainPathR; + currentPathScrollTop[currentPath === false ? 0 : currentPath] = template.contentRight().children().scrollTop(); - for(let index in files) + for(let _path in currentPathScrollTop) { - pathJoin = p.join(pathJoin, files[index]); - - path.push({name: files[index], path: p.normalize(pathJoin), mainPath: mainPath}); + if(_path != 0 && !new RegExp('^'+pregQuote(_path)).test(path)) + delete currentPathScrollTop[_path]; } - if(path.length > 0) - path[path.length - 1].last = true; + if(currentPathScrollTop[path === false ? 0 : path]) + keepScroll = currentPathScrollTop[path === false ? 0 : path]; - handlebarsContext.headerTitlePath = path; -} + currentPath = path; -function nextComic(path, mainPath) -{ - var searchPath = p.dirname(path); - - if(p.normalize(mainPath) != p.normalize(path) && p.normalize(searchPath) != p.normalize(path)) + if(!path) { - var files = file.returnFirstWD(searchPath); - - if(checkError(files)) - return files; + indexPathControl(false); - files = file.sort(files); + let sort = config.sortIndex; + let sortInvert = config.sortInvertIndex; + let foldersFirst = config.foldersFirstIndex; - var skipPath = false; + let order = ''; + let orderKey = 'name'; + let orderKey2 = false; - if(files) + if(sort == 'name') { - for(var i = 0; i < files.length; i++) - { - var filePath = files[i].path; - - if((skipPath && files[i].folder) || skipPath && files[i].compressed) - { - var image = folderImagesWD(filePath, 1, 1); - - if(checkError(image) || image) - return image; - } - else if(skipPath) - { - return files[i].path; - } - - if(filePath == path && !skipPath) - skipPath = true; - } + order = 'simple'; + } + else if(sort == 'numeric') + { + order = 'numeric'; + } + else if(sort == 'name-numeric') + { + order = 'simple-numeric'; + } + else if(sort == 'last-add') + { + order = 'real-numeric'; + orderKey = 'added'; + sortInvert = !sortInvert; + } + else + { + order = 'real-numeric'; + orderKey = 'readingProgress'; + orderKey2 = 'lastReading'; + sortInvert = !sortInvert; } - return nextComic(searchPath, mainPath); - } - - return false; -} - -function previousComic(path, mainPath) -{ - var searchPath = p.dirname(path); - - if(p.normalize(mainPath) != p.normalize(path) && p.normalize(searchPath) != p.normalize(path)) - { - var files = file.returnFirstWD(searchPath); - - if(checkError(files)) - return files; - - files = file.sort(files); - - var skipPath = false; + var comicsStorage = storage.get('comics'); + var comics = []; - if(files) + if(!isEmpty(comicsStorage)) { - for(var i = (files.length - 1); i >= 0; i--) + for(let key in comicsStorage) { - var filePath = files[i].path; - - if((skipPath && files[i].folder) || (skipPath && files[i].compressed)) + if(fs.existsSync(comicsStorage[key].path)) { - var image = folderImagesWD(filePath, 1, 2); - - if(checkError(image) || image) - return image; + comics.push(comicsStorage[key]); } - else if(skipPath) + else { - return files[i].path; + //console.log(comicsStorage[key]); } - - if(filePath == path && !skipPath) - skipPath = true; } - } - return previousComic(searchPath, mainPath); - } + for(let key in comics) + { + var images = await getFolderThumbnails(comics[key].path); - return false; -} + comics[key].images = images; + comics[key].mainPath = config.showFullPathLibrary ? p.parse(comics[key].path).root : comics[key].path; + } -function getFolderThumbnailsAsync(path) -{ - var folderSha = sha1(path); + comics.sort(function (a, b) { + return (sortInvert) ? -(orderBy(a, b, order, orderKey, orderKey2)) : orderBy(a, b, order, orderKey, orderKey2); + }); + } - var images = [ - {cache: false, path: '', sha: folderSha+'-0'}, - {cache: false, path: '', sha: folderSha+'-1'}, - {cache: false, path: '', sha: folderSha+'-2'}, - {cache: false, path: '', sha: folderSha+'-3'}, - ]; + handlebarsContext.comics = comics; + handlebarsContext.comicsIndex = true; + handlebarsContext.comicsIndexVar = 'true'; + handlebarsContext.comicsReadingProgress = false; - queue.add('folderThumbnails', function(path, folderSha) { + template.loadContentRight('index.content.right.'+config.viewIndex+'.html', animation, keepScroll); - var images = folderImagesWD(path, 4); + handlebarsContext.headerTitle = false; + handlebarsContext.headerTitlePath = false; + template.loadHeader('index.header.html', animation); - if(checkError(images)) + if(!content) { - var error = images; - - var images = [ - {cache: false, path: '', sha: folderSha+'-0'}, - {cache: false, path: '', sha: folderSha+'-1'}, - {cache: false, path: '', sha: folderSha+'-2'}, - {cache: false, path: '', sha: folderSha+'-3'}, - ]; - - var realPath = file.realPath(error.compressedPath, -1); - - if(file.containsCompressed(error.compressedPath) && fs.existsSync(realPath) && fs.statSync(realPath).size < 52428800) - { - (function(folderSha){ - - addFolderImagesQueue(path, 4, function(images){ - - for(var i = 0; i < images.length; i++) - { - var sha = sha1(images[i]); - - (function(i, sha, folderSha, images){ - - var image = cache.returnCacheImage(images[i], sha, function(data, vars){ - - addImageToDom(data.sha, data.path); - addImageToDom(folderSha+'-'+vars.i, data.path); - - }, {i: i}); + template.loadContentLeft('index.content.left.html', animation); + template.loadGlobalElement('index.elements.menus.html', 'menus'); + floatingActionButton(true, 'dom.addComicButtons();'); + } - if(image.cache) - { - addImageToDom(sha, image.path); - addImageToDom(folderSha+'-'+i, image.path); - } + events.events(); - }(i, sha, folderSha, images)); - } + } + else + { + if(!fromGoBack) + indexPathControl(path, mainPath); - }); + handlebarsContext.comicsIndex = false; + handlebarsContext.comicsIndexVar = 'false'; - })(folderSha) - } + headerPath(path, mainPath); + template.loadHeader('index.header.html', animation); + template.loadContentRight('index.content.right.loading.html', animation, keepScroll); - //Compatibility has to be added to uncompress the file and create the thumbnails - } - else + if(!content) { - for(let i = 0; i < images.length; i++) + if(readingActive) { - var sha = sha1(images[i]); - - images[i] = cache.returnCacheImage(images[i], sha, function(data, vars){ - - addImageToDom(data.sha, data.path); - addImageToDom(vars.folderSha+'-'+vars.i, data.path); - - }, {i: i, folderSha: folderSha}); - - if(images[i].cache) - { - addImageToDom(sha, images[i].path, false); - addImageToDom(folderSha+'-'+i, images[i].path, false); - } + template.loadContentLeft('index.content.left.html', animation); } - } - }, path, folderSha); + template.loadGlobalElement('index.elements.menus.html', 'menus'); + floatingActionButton(false); + } - return images; -} + cache.cleanQueue(); -function getFolderThumbnailsWD(path) -{ - var images = folderImagesWD(path, 4); + let file = fileManager.file(path); + loadFilesIndexPage(file, animation, path, keepScroll, mainPath); + } - if(checkError(images)) + if(readingActive) { - var error = images; - - var folderSha = sha1(path); - - var images = [ - {cache: false, path: '', sha: folderSha+'-0'}, - {cache: false, path: '', sha: folderSha+'-1'}, - {cache: false, path: '', sha: folderSha+'-2'}, - {cache: false, path: '', sha: folderSha+'-3'}, - ]; - - var realPath = file.realPath(error.compressedPath, -1); + readingActive = false; + } - if(file.containsCompressed(path) && fs.existsSync(realPath) && fs.statSync(realPath).size < 52428800) - { - (function(folderSha){ + justifyViewModule(); - addFolderImagesQueue(path, 4, function(images){ + gamepad.updateBrowsableItems(); - for(var i = 0; i < images.length; i++) - { - var sha = sha1(images[i]); + $(window).off('resize').on('resize', function(){ + justifyViewModule(); + }); - (function(i, sha, folderSha, images){ +} - var image = cache.returnCacheImage(images[i], sha, function(data, vars){ +function compressedError(error) +{ + //console.log(error); - addImageToDom(data.sha, data.path); - addImageToDom(folderSha+'-'+vars.i, data.path); + electronRemote.dialog.showMessageBox({ + type: 'error', + title: language.error.uncompress.title, + message: language.error.uncompress.message, + detail: error.detail || error.message, + }); +} - }, {i: i}); +function addSepToEnd(path) +{ + if(!new RegExp(pregQuote(p.sep)+'\s*$').test(path)) + path = path + p.sep; - if(image.cache) - { - addImageToDom(sha, image.path); - addImageToDom(folderSha+'-'+i, image.path); - } + return path; +} - }(i, sha, folderSha, images)); - } +function returnTextPath(path, mainPath, image = false) +{ + mainPathR = addSepToEnd(p.dirname(mainPath)); - }); + var files = path.replace(new RegExp('^\s*'+pregQuote(mainPathR)), '').split(p.sep); - })(folderSha) - } + var path = []; - //Compatibility has to be added to uncompress the file and create the thumbnails - } - else + for(let index in files) { - for(let i = 0; i < images.length; i++) - { - var sha = sha1(images[i]); - - images[i] = cache.returnCacheImage(images[i], sha, function(data){ - - addImageToDom(data.sha, data.path); - - }); - } + path.push(image ? htmlEntities(files[index]) : files[index]); } - return images; + return path.join(image ? 'chevron_right' : ' / '); } -var queuedFolderImages = [], processingFolderImagesQueue = false; - -function addFolderImagesQueue(path, num, callback = false, processQueue = true) +function headerPath(path, mainPath) { - queuedFolderImages.push({path: path, num: num, callback: callback}); - - if(!processingFolderImagesQueue && processQueue) - { - setTimeout(function(){ + mainPathR = addSepToEnd(p.dirname(mainPath)); - process.nextTick(function() { - processFolderImagesQueue(); - }); + var files = path.replace(new RegExp('^\s*'+pregQuote(mainPathR)), '').split(p.sep); - }, 0); - } -} + var path = []; -function processFolderImagesQueue(force = false) -{ + var pathJoin = mainPathR; - if((!processingFolderImagesQueue || force) && typeof queuedFolderImages[0] != 'undefined') + for(let index in files) { - processingFolderImagesQueue = true; - - folderImages(queuedFolderImages[0].path, queuedFolderImages[0].num, function(images){ - - if(queuedFolderImages[0].callback) - queuedFolderImages[0].callback(images); + pathJoin = p.join(pathJoin, files[index]); - queuedFolderImages.splice(0, 1); + path.push({name: files[index], path: p.normalize(pathJoin), mainPath: mainPath}); + } - if(queuedFolderImages.length > 0) - { - process.nextTick(function() { - processFolderImagesQueue(true); - }); - } - else - { - processingFolderImagesQueue = false; - } + if(path.length > 0) + path[path.length - 1].last = true; - }); - } + handlebarsContext.headerTitlePath = path; } -function folderImages(path, num, callback = false, ignore = {}) +async function nextComic(path, mainPath) { + let file = fileManager.file(mainPath); + let image = await file.images(1, path); - (function(path, num, callback, ignore){ - - process.nextTick(function() { + return image && image.path ? image.path : false; +} - var images = folderImagesWD(path, num, false, ignore); +async function previousComic(path, mainPath) +{ + let file = fileManager.file(mainPath); + let image = await file.images(-1, path); - if(checkError(images)) - { - var startPath = images.startPath; + return image && image.path ? image.path : false; +} - (function(error, path, num, callback, ignore, startPath){ +async function _getFolderThumbnails(file, images, _images, path, folderSha, isAsync = false) +{ + let shaIndex = {}; - if(fs.existsSync(error.compressedPath) && fs.statSync(error.compressedPath).size < 52428800) - { - fileCompressed.addCompressedFilesQueue(error.compressedPath, false, function(files){ + for(let i = 0, len = _images.length; i < len; i++) + { + let sha = sha1(_images[i].path); + _images[i].sha = sha; + _images[i].vars = {i: i}; + shaIndex[i] = sha; + } - /*if(checkError(files)) - ignore[p.normalize(startPath)] = true; + _images = await cache.returnThumbnailsImages(_images, function(data, vars) { - dom.folderImages(path, num, callback, ignore);*/ + addImageToDom(data.sha, data.path); + addImageToDom(folderSha+'-'+vars.i, data.path); - if(!checkError(files)) - dom.folderImages(path, num, callback, ignore); - else - callback(files); + }, file); - }); - } - else - { - ignore[p.normalize(startPath)] = true; + for(let i = 0, len = images.length; i < len; i++) + { + let imageCache = _images[shaIndex[i]]; - dom.folderImages(path, num, callback, ignore); - } + if(imageCache && imageCache.cache) + { + images[i].path = imageCache.path; + images[i].cache = true; - })(images, path, num, callback, ignore, startPath) - } - else + if(isAsync) { - if(callback) - callback(images); + addImageToDom(imageCache.sha, imageCache.path); + addImageToDom(folderSha+'-'+i, imageCache.path); } - }); + } + } - })(path, num, callback, ignore); + return images; } -function folderImagesWD(path, num, mode = false, ignore = {}) +async function getFolderThumbnails(path) { - if(!mode) - { - var dirs = []; + let folderSha = sha1(path); - if(!ignore[p.normalize(path)]) - var files = file.returnFirstWD(path); - else - return []; - - if(checkError(files)) + let images = [ + {cache: false, path: '', sha: folderSha+'-0'}, + {cache: false, path: '', sha: folderSha+'-1'}, + {cache: false, path: '', sha: folderSha+'-2'}, + {cache: false, path: '', sha: folderSha+'-3'}, + ]; + + try + { + try { - files.startPath = path; - return files; - } - - files = file.sort(files); + let file = fileManager.file(path); + file.updateConfig({cacheOnly: true}); + let _images = await file.images(4); - if(files) + images = await _getFolderThumbnails(file, images, _images, path, folderSha); + } + catch(error) { - for(var i = 0, len = files.length; i < len; i++) + if(error.message && error.message === 'notCacheOnly') { - var filePath = files[i].path; + queue.add('folderThumbnails', async function(path, folderSha) { - if(files[i].folder || files[i].compressed) - { - if(!ignore[p.normalize(filePath)]) - { - _filePath = filePath; - filePath = folderImagesWD(filePath, 1, 1, ignore); - - if(checkError(filePath)) - { - filePath.startPath = _filePath; - return filePath; - } - - if(filePath) dirs.push(filePath); - } - } - else - { - dirs.push(filePath); - } + let file = fileManager.file(path); + let _images = await file.images(4); - if(dirs.length >= num) break; - } - } + _getFolderThumbnails(file, images, _images, path, folderSha, true); - return dirs; - } - else - { - - if(!ignore[p.normalize(path)]) - var files = file.returnFirstWD(path); - else - return false; - - if(checkError(files)) - { - files.startPath = path; - return files; - } - - files = file.sort(files); - - if(files) - { - if(mode == 2) - i = (files.length - 1); + }, path, folderSha); + } else - i = 0; - - while((mode == 2 && i >= 0) || (mode != 2 && i < files.length)) { - var filePath = files[i].path; - - if(files[i].folder || files[i].compressed) - { - if(!ignore[p.normalize(filePath)]) - { - _filePath = filePath; - filePath = folderImagesWD(filePath, 1, 1, ignore); - - if(checkError(filePath)) - { - filePath.startPath = _filePath; - return filePath; - } - - if(filePath) return filePath; - } - } - else - { - return filePath; - } - - if(mode == 2) - i--; - else - i++; + console.error(error); + dom.compressedError(error); } } - - return false; } + catch(error) + { + console.error(error); + dom.compressedError(error); + } + + return images; } var indexPathControlA = [], indexPathA = false, indexMainPathA = false; @@ -1072,7 +867,8 @@ function indexPathControlUpdateLastComic(path = false) var barBackStatus = false; -function indexPathControl(path = false, mainPath = false, isComic = false) +// This needs to be improved more, if is from fromNextAndPrev, consider changing the previous route/path +function indexPathControl(path = false, mainPath = false, isComic = false, fromNextAndPrev = false) { if(path === false || mainPath === false) { @@ -1085,12 +881,19 @@ function indexPathControl(path = false, mainPath = false, isComic = false) mainPathR = addSepToEnd(p.dirname(mainPath)); - var files = path.replace(new RegExp('^\s*'+pregQuote(mainPathR)), '').split(p.sep); + let files = path.replace(new RegExp('^\s*'+pregQuote(mainPathR)), '').split(p.sep); let index = files.length - 1; + let len = indexPathControlA.length; + if(index >= 0) - indexPathControlA.push({file: files[index], path: path, mainPath: mainPath, isComic: isComic}); + { + if(len > 0 && isComic && fromNextAndPrev && indexPathControlA[len-1].isComic) // + indexPathControlA[len-1] = {file: files[index], path: path, mainPath: mainPath, isComic: isComic}; + else + indexPathControlA.push({file: files[index], path: path, mainPath: mainPath, isComic: isComic}); + } } if(indexPathControlA.length > 0) @@ -1449,14 +1252,23 @@ function removeComic(path, confirm = false) var readingActive = false, skipNextComic = false, skipPreviousComic = false; -function openComic(animation = true, path = true, mainPath = true, end = false, fromGoBack = false) +async function openComic(animation = true, path = true, mainPath = true, end = false, fromGoBack = false, fromNextAndPrev = false) { + + // Show loadign page + handlebarsContext.comics = []; + template.loadContentLeft('reading.content.left.html', true); + template.loadContentRight('reading.content.right.html', true); + template.loadHeader('reading.header.html', true); + headerPath(path, mainPath); + + // Start reading comic currentPathScrollTop[currentPath === false ? 0 : currentPath] = template.contentRight().children().scrollTop(); currentPath = path; - var startImage = false; - var imagePath = path; - var indexStart = 1; + let startImage = false; + let imagePath = path; + let indexStart = 1; if(compatibleMime.indexOf(mime.getType(path)) != -1) { @@ -1464,161 +1276,111 @@ function openComic(animation = true, path = true, mainPath = true, end = false, path = p.dirname(path); } - if(fs.existsSync(file.realPath(path))) - { + let file = fileManager.file(path); + let files = await file.read(); - skipNextComic = nextComic(path, mainPath); - skipPreviousComic = previousComic(path, mainPath); + let compressedFile = fileManager.lastCompressedFile(path); - if(checkError(skipNextComic)) - skipNextComic = false; - - if(checkError(skipPreviousComic)) - skipPreviousComic = false; - - if(!fromGoBack) - indexPathControl(imagePath, mainPath, true); - - readingActive = true; + if(compressedFile) + { + let features = fileManager.fileCompressed(compressedFile); + features = features.getFeatures(); - var sort = config.sort; - var sortInvert = config.sortInvert; - var foldersFirst = config.foldersFirst; + if(features.canvas && false) // Not work yet + { + await file.makeAvailable([{path: compressedFile}]); + } + else + { + await file.makeAvailable(files); + } + } - var order = ''; + skipNextComic = await nextComic(path, mainPath); + skipPreviousComic = await previousComic(path, mainPath); - if(sort == 'name') - order = 'simple'; - else if(sort == 'numeric') - order = 'numeric'; - else - order = 'simple-numeric'; + if(!fromGoBack) + indexPathControl(imagePath, mainPath, true, fromNextAndPrev); - var files = fs.readdirSync(file.realPath(path)); + readingActive = true; - var comics = []; + let comics = []; - if(files) + if(files) + { + for(let i = 0, len = files.length; i < len; i++) { + let file = files[i]; - for(var i = 0; i < files.length; i++) + if(file.folder || file.compressed) { - var fileName = files[i]; - var filePath = p.join(path, fileName); + let fileImage = fileManager.file(file.path); + let images = await fileImage.images(4); - if(compatibleMime.indexOf(mime.getType(filePath)) != -1) + if(images.length > 0) { - var sha = sha1(filePath); - - var thumbnail = cache.returnCacheImage(filePath, sha, function(data){ - - addImageToDom(data.sha, data.path); - - }); - comics.push({ - sha: sha, - name: fileName.replace(/\.[^\.]*$/, ''), - image: file.realPath(filePath), - path: filePath, + name: file.name, + path: file.path, mainPath: mainPath, - thumbnail: (thumbnail.cache) ? thumbnail.path : '', - folder: false, + fristImage: images[0].path, + images: images, + folder: true, }); } - else if(inArray(fileExtension(filePath), compressedExtensions.all) || fs.statSync(file.realPath(filePath)).isDirectory()) - { - var images = folderImagesWD(filePath, 4); - - for(var i2 = 0; i2 < images.length; i2++) - { - var originalPath = images[i2]; - - var sha = sha1(originalPath); - - images[i2] = cache.returnCacheImage(originalPath, sha, function(data){ - - addImageToDom(data.sha, data.path); - - }); - - images[i2].originalPath = originalPath; - } - - if(typeof images[0] != 'undefined') - { - comics.push({ - name: fileName, - path: filePath, - mainPath: mainPath, - fristImage: images[0].originalPath, - images: images, - folder: true, - }); - } - } } - } - - if(!isEmpty(comics)) - { - comics.sort(function (a, b) { - if(foldersFirst && a.folder && !b.folder) return -1; - if(foldersFirst && b.folder && !a.folder) return 1; - return (sortInvert) ? -(orderBy(a, b, order, 'name')) : orderBy(a, b, order, 'name'); - }); - - for(let key in comics) + else { - comics[key].index = parseInt(key) + 1; - if(comics[key].path == imagePath) - { - indexStart = parseInt(key) + 1; - } - } - } - - handlebarsContext.comics = comics; - handlebarsContext.previousComic = skipPreviousComic; - handlebarsContext.nextComic = skipNextComic; - headerPath(path, mainPath); - reading.setCurrentComics(comics); + let sha = sha1(file.path); - template.loadContentLeft('reading.content.left.html', true); - template.loadContentRight('reading.content.right.html', true); - template.loadHeader('reading.header.html', true); - if(template.globalElement('.reading-elements-menus').length == 0) template.loadGlobalElement('reading.elements.menus.html', 'menus'); + let thumbnail = cache.returnCacheImage(file.path, sha, function(data){ - floatingActionButton(false); - - events.events(); + addImageToDom(data.sha, data.path); - reading.read(path, indexStart, end); - reading.hideContent(electronRemote.getCurrentWindow().isFullScreen(), true); + }); - generateAppMenu(); + comics.push({ + sha: sha, + name: file.name.replace(/\.[^\.]*$/, ''), + image: fileManager.realPath(file.path), + path: file.path, + mainPath: mainPath, + thumbnail: (thumbnail.cache) ? thumbnail.path : '', + folder: false, + }); + } + } + } - gamepad.updateBrowsableItems(); + for(let i = 0, len = comics.length; i < len; i++) + { + comics[i].index = i + 1; + if(comics[i].path == imagePath) + indexStart = comics[i].index; } - else if(file.containsCompressed(path)) - { - fileCompressed.decompressRecursive(path, function() { - openComic(animation, path, mainPath, end); + handlebarsContext.comics = comics; + handlebarsContext.previousComic = skipPreviousComic; + handlebarsContext.nextComic = skipNextComic; + headerPath(path, mainPath); + reading.setCurrentComics(comics); - }); - } -} + template.loadContentLeft('reading.content.left.html', true); + template.loadContentRight('reading.content.right.html', true); + template.loadHeader('reading.header.html', true); + if(template.globalElement('.reading-elements-menus').length == 0) template.loadGlobalElement('reading.elements.menus.html', 'menus'); -function skipNextComicF() -{ - return skipNextComic; -} + floatingActionButton(false); + + events.events(); -function skipPreviousComicF() -{ - return skipPreviousComic; + reading.read(path, indexStart, end); + reading.hideContent(electronRemote.getCurrentWindow().isFullScreen(), true); + + generateAppMenu(); + + gamepad.updateBrowsableItems(); } // Gamepad events @@ -1645,12 +1407,10 @@ module.exports = { indexPathControl: indexPathControl, indexPathControlA: function(){return indexPathControlA}, indexPathControlGoBack: indexPathControlGoBack, - folderImages: folderImages, - folderImagesWD: folderImagesWD, selectElement: selectElement, openComic: openComic, - nextComic: skipNextComicF, - previousComic: skipPreviousComicF, + nextComic: function(){return skipNextComic}, + previousComic: function(){return skipPreviousComic}, orderBy: orderBy, nightMode: nightMode, addComicButtons: addComicButtons, diff --git a/scripts/file-compressed.js b/scripts/file-compressed.js deleted file mode 100644 index cf64ac0f3..000000000 --- a/scripts/file-compressed.js +++ /dev/null @@ -1,602 +0,0 @@ -const fs = require('fs'), - p = require('path'); - -var unzip = false, unrar = false, un7z = false, bin7z = false, untar = false, unpdf = false, compressedFiles = {}; - -var fileDocumentsToRender = {}; - -function returnFilesWD(path, all, callback = false) -{ - var sha = sha1(p.normalize(path)); - - var cacheFile = 'compressed-files-'+sha+'.json'; - - var json = cache.readFile(cacheFile); - - if(json) - json = JSON.parse(json); - - var mtime = Date.parse(fs.statSync(file.firstCompressedFile(path)).mtime); - - if(json) - { - if(json.mtime >= mtime) - { - compressedFiles[sha] = json.files; - - if(callback) - callback((all) ? json.files : file.allToFirst(json.files)); - else - return (all) ? json.files : file.allToFirst(json.files); - - return true; - } - } - - if(fs.existsSync(p.join(tempFolder, sha))) - { - var files = file.returnAll(p.join(tempFolder, sha), {from: p.join(tempFolder, sha), to: path}); - compressedFiles[sha] = files; - - if(callback) - callback((all) ? files : file.allToFirst(files)); - else - return (all) ? files : file.allToFirst(files); - - return true; - } - - return {error: NOT_POSSIBLE_WITHOUT_DECOMPRESSING, compressedPath: path}; //If it is not possible to return the files without decompressing -} - -var queuedCompressedFiles = {}, processingCompressedFilesQueue = false; - -function addCompressedFilesQueue(path, all, callback = false, processQueue = true) -{ - var sha = sha1(p.normalize(path)); - - if(typeof queuedCompressedFiles[sha] !== 'undefined') - queuedCompressedFiles[sha].callback.push(callback); - else - queuedCompressedFiles[sha] = {path: path, all: all, callback: [callback]}; - - if(!processingCompressedFilesQueue && processQueue) - { - setTimeout(function(){ - - process.nextTick(function() { - processCompressedFilesQueue(); - }); - - }, 0); - } -} - -function processCompressedFilesQueue(force = false) -{ - - if((!processingCompressedFilesQueue || force) && !$.isEmptyObject(queuedCompressedFiles)) - { - var processingCompressedFilesQueue = true; - - var key = Object.keys(queuedCompressedFiles)[0]; - - returnFiles(queuedCompressedFiles[key].path, queuedCompressedFiles[key].all, false, function(files){ - - var key = Object.keys(queuedCompressedFiles)[0]; - - if(key) - { - for(let i in queuedCompressedFiles[key].callback) - { - if(queuedCompressedFiles[key].callback[i]) - queuedCompressedFiles[key].callback[i](files); - } - - delete queuedCompressedFiles[key]; - - if(!$.isEmptyObject(queuedCompressedFiles)) - { - process.nextTick(function() { - processCompressedFilesQueue(true); - }); - } - else - { - processingCompressedFilesQueue = false; - } - } - - }); - } -} - -function setProgress(progress, contentRightZindex) -{ - $('.content-right .content-right-'+contentRightZindex+' .loading.loading96 svg').css({ - 'animation': 'none', - 'transform': 'rotate(-90deg)', - }); - - $('.content-right .content-right-'+contentRightZindex+' .loading.loading96 circle').css({ - 'animation': 'none', - 'stroke-dashoffset': 225, - 'stroke-dasharray': 226 + ((422 - 226) * progress), - }); -} - -var currentExtracting = false; -var waitingCurrentExtractionCallback = false; - -function waitingCurrentExtraction() -{ - currentExtracting = false; - - if(waitingCurrentExtractionCallback) - { - waitingCurrentExtractionCallback.apply(null, arguments); - waitingCurrentExtractionCallback = false; - } -} - -function extractZip(path, virtualPath, sha, all, json, callback) -{ - let cacheFile = 'compressed-files-'+sha+'.json'; - let mtime = Date.parse(fs.statSync(file.firstCompressedFile(path)).mtime); - let shaExt = 'extracting-'+sha; - let contentRightZindex = template.contentRightZindex(); - - if(unzip === false) unzip = require('unzipper'); - - try - { - currentExtracting = path; - - fs.createReadStream(path).pipe( - - unzip.Extract({path: p.join(tempFolder, shaExt)}).on('close', function () { - - if(fs.existsSync(p.join(tempFolder, shaExt))) fs.renameSync(p.join(tempFolder, shaExt), p.join(tempFolder, sha)); - - var files = file.returnAll(p.join(tempFolder, sha), {from: p.join(tempFolder, sha), to: virtualPath}); - - if(!json || json.mtime != mtime) - cache.writeFile(cacheFile, JSON.stringify({mtime: mtime, files: files}), {}, function(){}); - - compressedFiles[sha] = files; - - callCallbacks([(all) ? files : file.allToFirst(files)], waitingCurrentExtraction, callback); - - }).on('error', function(error){ - - if(/0xafbc7a37/.test(error.message)) // 7zip file - fileCompressed.extractRar(path, virtualPath, sha, all, json, callback); - else if(/0x21726152/.test(error.message)) // rar file - fileCompressed.extractRar(path, virtualPath, sha, all, json, callback); - else - callCallbacks([{error: ERROR_UNZIPPING_THE_FILE, detail: error.message}], waitingCurrentExtraction, callback); - - }) - ); - } - catch(error) - { - console.error(error); - callCallbacks([{error: ERROR_UNZIPPING_THE_FILE, detail: error.message}], waitingCurrentExtraction, callback); - } -} - -function extract7zip(path, virtualPath, sha, all, json, callback) -{ - let cacheFile = 'compressed-files-'+sha+'.json'; - let mtime = Date.parse(fs.statSync(file.firstCompressedFile(path)).mtime); - let shaExt = 'extracting-'+sha; - let contentRightZindex = template.contentRightZindex(); - - if(un7z === false) un7z = require('node-7z'); - if(bin7z === false) bin7z = asarToAsarUnpacked(require('7zip-bin').path7za); - - currentExtracting = path; - - un7z.extractFull(path, p.join(tempFolder, shaExt), {$progress: true, p: false/*'myPassword'*/, $bin: bin7z}).on('progress', function(progress) { - - setProgress(progress.percent / 100, contentRightZindex); - - }).on('end', function (data) { - - try - { - if(fs.existsSync(p.join(tempFolder, shaExt))) fs.renameSync(p.join(tempFolder, shaExt), p.join(tempFolder, sha)); - - var files = file.returnAll(p.join(tempFolder, sha), {from: p.join(tempFolder, sha), to: virtualPath}); - - if(!json || json.mtime != mtime) - cache.writeFile(cacheFile, JSON.stringify({mtime: mtime, files: files}), {}, function(){}); - - compressedFiles[sha] = files; - - callCallbacks([(all) ? files : file.allToFirst(files)], waitingCurrentExtraction, callback); - } - catch(error) - { - console.error(error); - callCallbacks([{error: ERROR_UNZIPPING_THE_FILE, detail: error.message}], waitingCurrentExtraction, callback); - } - - }).on('error', function(error){ - - console.error(error); - callCallbacks([{error: ERROR_UNZIPPING_THE_FILE, detail: error.stderr}], waitingCurrentExtraction, callback); - - }); -} - -function extractRar(path, virtualPath, sha, all, json, callback) -{ - let cacheFile = 'compressed-files-'+sha+'.json'; - let mtime = Date.parse(fs.statSync(file.firstCompressedFile(path)).mtime); - let shaExt = 'extracting-'+sha; - let contentRightZindex = template.contentRightZindex(); - - if(unrar === false) unrar = require('unrar'); - - var bin = false; - - if(process.platform == 'win32' || process.platform == 'win64') - bin = asarToAsarUnpacked(p.join(appDir, 'unrar/UnRAR.exe')); - else if(process.platform == 'darwin') - bin = asarToAsarUnpacked(p.join(appDir, 'unrar/unrar_MacOSX_10.13.2_64bit')); - - var archive = new unrar({ - path: path, - bin: bin, - }); - - currentExtracting = path; - - archive.list(function (error, entries) { - - try - { - if(!error) - { - if(!fs.existsSync(p.join(tempFolder, shaExt))) fs.mkdirSync(p.join(tempFolder, shaExt)); - - var dirs = []; - - for(let i = 0, len = entries.length; i < len; i++) - { - if(entries[i].type !== 'File') - dirs.push({name: entries[i].name, dimensions: entries[i].name.split(p.sep).length}) - } - - dirs.sort(function (a, b) { - - if(a.dimensions == b.dimensions) - return 0; - - return (a.dimensions > b.dimensions) ? 1 : -1; - - }); - - for(let i = 0, len = dirs.length; i < len; i++) - { - if(!fs.existsSync(p.join(tempFolder, shaExt, dirs[i].name))) fs.mkdirSync(p.join(tempFolder, shaExt, dirs[i].name)); - } - - var tasks = []; - - for(let i = 0, len = entries.length; i < len; i++) - { - if(entries[i].type !== 'File') - continue; - - tasks.push(new Promise(function(resolve, reject) { - - var stream = archive.stream(entries[i].name); - stream.on('error', console.error); - stream.on('end', resolve); - stream.pipe(require('fs').createWriteStream(p.join(tempFolder, shaExt, entries[i].name))); - - })); - } - - Promise.all(tasks).then(function(){ - - if(process.platform == 'win32' || process.platform == 'win64') // Fix Windows bug: EPERM: operation not permitted, rename - { - for(let i = 0; i < 100; i++) - { - if(fs.existsSync(p.join(tempFolder, shaExt))) - { - try - { - fs.renameSync(p.join(tempFolder, shaExt), p.join(tempFolder, sha)); - } - catch - { - - } - } - else - { - break; - } - } - } - - if(fs.existsSync(p.join(tempFolder, shaExt))) fs.renameSync(p.join(tempFolder, shaExt), p.join(tempFolder, sha)); - - // Get files - var files = file.returnAll(p.join(tempFolder, sha), {from: p.join(tempFolder, sha), to: virtualPath}); - - if(!json || json.mtime != mtime) - cache.writeFile(cacheFile, JSON.stringify({mtime: mtime, files: files}), {}, function(){}); - - compressedFiles[sha] = files; - - callCallbacks([(all) ? files : file.allToFirst(files)], waitingCurrentExtraction, callback); - - }); - } - else - { - callCallbacks([{error: ERROR_UNZIPPING_THE_FILE, detail: error.message}], waitingCurrentExtraction, callback); - } - } - catch(error) - { - console.error(error); - callCallbacks([{error: ERROR_UNZIPPING_THE_FILE, detail: error.message}], waitingCurrentExtraction, callback); - } - - }); -} - -function extractTar(path, virtualPath, sha, all, json, callback) -{ - let cacheFile = 'compressed-files-'+sha+'.json'; - let mtime = Date.parse(fs.statSync(file.firstCompressedFile(path)).mtime); - let shaExt = 'extracting-'+sha; - let contentRightZindex = template.contentRightZindex(); - - if(untar === false) untar = require('tar-fs'); - - currentExtracting = path; - - var untarP = fs.createReadStream(path).pipe(untar.extract(p.join(tempFolder, shaExt))).on('finish', function () { - - try - { - if(fs.existsSync(p.join(tempFolder, shaExt))) fs.renameSync(p.join(tempFolder, shaExt), p.join(tempFolder, sha)); - - var files = file.returnAll(p.join(tempFolder, sha), {from: p.join(tempFolder, sha), to: virtualPath}); - - if(!json || json.mtime != mtime) - cache.writeFile(cacheFile, JSON.stringify({mtime: mtime, files: files}), {}, function(){}); - - compressedFiles[sha] = files; - - callCallbacks([(all) ? files : file.allToFirst(files)], waitingCurrentExtraction, callback); - } - catch(error) - { - console.error(error); - callCallbacks([{error: ERROR_UNZIPPING_THE_FILE, detail: error.message}], waitingCurrentExtraction, callback); - } - - }).on('error', function(error){ - - callCallbacks([{error: ERROR_UNZIPPING_THE_FILE, detail: error.message}], waitingCurrentExtraction, callback); - - untarP.destroy(); - - }); -} - -function extractPdf(path, virtualPath, sha, all, json, callback) -{ - let cacheFile = 'compressed-files-'+sha+'.json'; - let mtime = Date.parse(fs.statSync(file.firstCompressedFile(path)).mtime); - let shaExt = 'extracting-'+sha; - let contentRightZindex = template.contentRightZindex(); - - if(unpdf === false) - { - unpdf = require('pdfjs-dist/build/pdf'); - unpdf.GlobalWorkerOptions.workerSrc = p.join(appDir, 'node_modules/pdfjs-dist/build/pdf.worker.js'); - } - - currentExtracting = path; - - (async function() { - - try - { - console.time('pdf render'); - - let pdf = await unpdf.getDocument({url: path, nativeImageDecoderSupport: 'none', disableFontFace: true}).promise; - - fileDocumentsToRender[path] = pdf; - - let pages = pdf.numPages; - - if(!fs.existsSync(p.join(tempFolder, shaExt))) fs.mkdirSync(p.join(tempFolder, shaExt)); - - for (let i = 1; i <= pages; i++) - { - setProgress((i - 1) / pages, contentRightZindex); - - // Render page - let page = await pdf.getPage(i); - let viewport = page.getViewport({scale: 1}); // window.devicePixelRatio; - - //let scale = 300 / viewport.width; - //viewport = page.getViewport({scale: scale}); - let scale = template.contentRight().children().width() / viewport.width; - viewport = page.getViewport({scale: scale}); - - let canvas = document.createElement('canvas'); - canvas.width = viewport.width; - canvas.height = viewport.height; - let context = canvas.getContext('2d'); - - await page.render({canvasContext: context, viewport: viewport}).promise; - - let imageData = canvas.toDataURL('image/jpeg', 1); - - fs.writeFileSync(p.join(tempFolder, shaExt, 'page-'+i+'.jpg'), Buffer.from(imageData.replace(/^data:image\/[a-z]+;base64,/, ''), 'base64')); - } - - setProgress(1, contentRightZindex); - - console.timeEnd('pdf render'); - - if(fs.existsSync(p.join(tempFolder, shaExt))) fs.renameSync(p.join(tempFolder, shaExt), p.join(tempFolder, sha)); - var files = file.returnAll(p.join(tempFolder, sha), {from: p.join(tempFolder, sha), to: virtualPath}); - - if(!json || json.mtime != mtime) - cache.writeFile(cacheFile, JSON.stringify({mtime: mtime, files: files}), {}, function(){}); - - compressedFiles[sha] = files; - - callCallbacks([(all) ? files : file.allToFirst(files)], waitingCurrentExtraction, callback); - } - catch(error) - { - console.error(error); - callCallbacks([{error: ERROR_UNZIPPING_THE_FILE, detail: error.message}], waitingCurrentExtraction, callback); - } - - })(); -} - -function returnFiles(path, all, fromCache, callback) -{ - let sha = sha1(p.normalize(path)); - - let cacheFile = 'compressed-files-'+sha+'.json'; - - let json = cache.readFile(cacheFile); - - if(json) - json = JSON.parse(json); - - let virtualPath = path; - path = file.realPath(path, -1); - - let mtime = Date.parse(fs.statSync(file.firstCompressedFile(path)).mtime); - - if(fromCache) - { - if(json) - { - if(json.mtime >= mtime) - { - compressedFiles[sha] = json.files; - callback((all) ? json.files : file.allToFirst(json.files)); - return true; - } - } - } - - if(fs.existsSync(p.join(tempFolder, sha))) - { - var files = file.returnAll(p.join(tempFolder, sha), {from: p.join(tempFolder, sha), to: virtualPath}); - compressedFiles[sha] = files; - callback((all) ? files : file.allToFirst(files)); - return true; - } - else - { - if(path === currentExtracting) - { - console.log('Tried to unzip the same file 2 times', path); - - waitingCurrentExtractionCallback = callback; - } - else - { - if(inArray(fileExtension(path), compressedExtensions.zip)) - { - fileCompressed.extractZip(path, virtualPath, sha, all, json, callback); - } - else if(inArray(fileExtension(path), compressedExtensions['7z'])) - { - fileCompressed.extract7zip(path, virtualPath, sha, all, json, callback); - } - else if(inArray(fileExtension(path), compressedExtensions.rar)) - { - fileCompressed.extractRar(path, virtualPath, sha, all, json, callback); - } - else if(inArray(fileExtension(path), compressedExtensions.tar)) - { - fileCompressed.extractTar(path, virtualPath, sha, all, json, callback); - } - else if(inArray(fileExtension(path), compressedExtensions.pdf)) - { - fileCompressed.extractPdf(path, virtualPath, sha, all, json, callback); - } - } - - return true; - } -} - -function decompressRecursive(path, callback = false, start = 1, virtualPath = false, newPath = false) -{ - let segments = path.split(p.sep); - - var callbackDR = callback; - - if(virtualPath === false) - virtualPath = newPath = (segments.length > 0) ? (isEmpty(segments[0]) ? '/' : segments[0]) : ''; - - let numSegments = segments.length; - - for(let i = start; i < segments.length; i++) - { - virtualPath = p.join(virtualPath, segments[i]); - newPath = p.join(newPath, segments[i]); - - if(i < numSegments) - { - extension = fileExtension(virtualPath); - - if(extension && inArray(extension, compressedExtensions.all) && !fs.statSync(newPath).isDirectory()) - { - var sha = sha1(p.normalize(virtualPath)); - - newPath = p.join(tempFolder, sha); - - fileCompressed.returnFiles(virtualPath, false, false, function(files){ - - i++; - - fileCompressed.decompressRecursive(path, callbackDR, i, virtualPath, newPath); - - }); - - return false; - } - } - } - - if(callbackDR) - callbackDR(path); -} - -module.exports = { - returnFiles: returnFiles, - returnFilesWD: returnFilesWD, - addCompressedFilesQueue: addCompressedFilesQueue, - decompressRecursive: decompressRecursive, - - extractZip: extractZip, - extract7zip: extract7zip, - extractRar: extractRar, - extractTar: extractTar, - extractPdf: extractPdf, - fileDocumentsToRender: function(){return fileDocumentsToRender}, - currentExtracting: function(){return currentExtracting}, -}; diff --git a/scripts/file-manager.js b/scripts/file-manager.js new file mode 100644 index 000000000..5a4b2f99b --- /dev/null +++ b/scripts/file-manager.js @@ -0,0 +1,1757 @@ +errorDialog = 0; + +var unzip = false, unrar = false, un7z = false, bin7z = false, untar = false, unpdf = false; + +var file = function(path) { + + this.path = path; + + this.files = []; + + this.isCompressed = false; + this.isFolder = false; + + this.config = { + cache: true, // Compressed + sort: true, + filtered: true, + only: false, + }; + + this.updateConfig = function(config) { + + for(let key in config) + { + this.config[key] = config[key]; + } + + } + + this.getType = function() { + + if(fs.existsSync(path)) + { + if(fs.statSync(path).isDirectory()) + this.isFolder = true; + else if(inArray(fileExtension(path), compressedExtensions.all)) + this.isCompressed = true; + } + + return {folder: this.isFolder, compressed: this.isCompressed}; + } + + this.alreadyRead = false; + + this.read = async function(config = {}, path = false) { + + path = path || this.path; + let _realPath = realPath(path, -1); + + this.updateConfig(config); + + let files = []; + + if(containsCompressed(path)) + { + if(inArray(fileExtension(path), compressedExtensions.all)) + files = await this.readCompressed(path, _realPath); + else + files = await this.readInsideCompressed(path, _realPath); + } + else + { + if(fs.statSync(_realPath).isDirectory()) + files = this.readDir(path, _realPath); + else if(inArray(fileExtension(path), compressedExtensions.all)) + files = await this.readCompressed(path, _realPath); + } + + if(this.config.sort) + files = sort(files); + + if(this.config.only && typeof this.config.only === 'number') + files = this.only(files); + + if(this.path === path) + { + this.alreadyRead = true; + this.files = files; + } + + return this.config.filtered ? filtered(files) : files; + } + + this.readDir = function(path = false, _realPath = false) { + + path = path || this.path; + _realPath = _realPath || realPath(path, -1); + + let files = []; + let _files = fs.readdirSync(_realPath); + + if(_files) + { + for(let i = 0, len = _files.length; i < len; i++) + { + let filePath = p.join(path, _files[i]); + let retrunPath = filePath; + + if(inArray(mime.getType(filePath), compatibleMime)) + files.push({name: _files[i], path: retrunPath, folder: false, compressed: false}); + else if(fs.statSync(filePath).isDirectory()) + files.push({name: _files[i], path: retrunPath, folder: true, compressed: false}); + else if(inArray(fileExtension(filePath), compressedExtensions.all)) + files.push({name: _files[i], path: retrunPath, folder: false, compressed: true}); + } + } + + return files; + } + + this.compressedOpened = {}; + + this.cleanCompressedOpened = function() { + + let compressed = []; + + for(let path in this.compressedOpened) + { + compressed.push({path: path, lastUsage: this.compressedOpened[path].lastUsage}); + } + + compressed.sort(function(a, b) { + + if(a.lastUsage === b.lastUsage) + return 0; + + return a.lastUsage < b.lastUsage ? 1 : -1; + }); + + let len = compressed.length; + + if(len > 10) // Max only 10 files open at the same time + { + for(let i = 10; i < len; i++) + { + let path = compressed[i].path; + delete this.compressedOpened[path]; + } + } + } + + this.openCompressed = function(path, _realPath = false, mtime = false) { + + _realPath = _realPath || realPath(path, -1); + mtime = mtime || Date.parse(fs.statSync(firstCompressedFile(path)).mtime); + + let now = Date.now(); + + if(!this.compressedOpened[path] || this.compressedOpened[path].mtimeMainCompressed != mtime) // Check if the Compressed file has been modified since the last time it was opened + { + this.compressedOpened[path] = { + lastUsage: now, + mtimeMainCompressed: mtime, + compressed: fileManager.fileCompressed(path, _realPath), + }; + } + else + { + this.compressedOpened[path].lastUsage = now; + } + + this.cleanCompressedOpened(); + + return this.compressedOpened[path].compressed; + + } + + this.readCompressed = async function(path = false, _realPath = false) { + + path = path || this.path; + _realPath = _realPath || realPath(path, -1); + + let mtime = Date.parse(fs.statSync(firstCompressedFile(path)).mtime); + let compressed = this.openCompressed(path, _realPath, mtime); + + let json = cache.readFile(compressed.cacheFile); + + if(json) + json = JSON.parse(json); + + if(this.config.cache) + { + if(json) + { + if(json.mtime == mtime) + return json.files; + } + } + + if(this.config.cacheOnly) + throw new Error('notCacheOnly'); + + await this.extractIfInsideAnotherCompressed(path, _realPath); + + let files = await compressed.read(this.config); + + if(!json || json.mtime != mtime) + cache.writeFile(compressed.cacheFile, JSON.stringify({mtime: mtime, files: files}), {}, function(){}); + + return files; + + } + + this.readInsideCompressed = async function(path = false, _realPath = false) { + + path = path || this.path; + _realPath = _realPath || realPath(path, -1); + + let lastCompressed = lastCompressedFile(path); + + let files = []; + + if(lastCompressed) + { + let _files = await this.readCompressed(lastCompressed); + files = this.readFromFilesList(_files, path, lastCompressed); + } + + return files; + + } + + // If compressed is inside other compressed, decompress here others compressed files (Only compresses files ignoring others files) + this.extractIfInsideAnotherCompressed = async function(path = false, _realPath = false) { + + path = path || this.path; + _realPath = _realPath || realPath(path, -1); + + if(_realPath !== path && !fs.existsSync(_realPath)) + { + let compressedFiles = allCompressedFiles(path); + + for(let i = 0, len = compressedFiles.length - 1; i < len; i++) + { + let path = compressedFiles[i]; + let _realPath = realPath(path, -1); + let _realPathNext = realPath(compressedFiles[i+1], -1); + let only = removePathPart(compressedFiles[i+1], path); + + if(!fs.existsSync(_realPathNext)) + { + let toDecompress = this.openCompressed(path, _realPath); + await toDecompress.extract({only: [only]}); + } + } + } + + return; + } + + this._images = async function(num, files, from = false, fromReached = false) { + + let images = []; + let imagesNum = 0; + + let reverse = num < 0 ? true : false; + let len = files.length; + + let stop = len == 0 ? true : false; + let i = reverse ? len - 1 : 0; + + while(!stop) + { + let file = files[i]; + let image = false; + + if(!from || fromReached || new RegExp('^\s*'+pregQuote(file.path)).test(from)) + { + if(file.folder || file.compressed) + { + _files = file.files || await this.read({}, file.path); + + image = await this._images(reverse ? -1 : 1, _files, from, fromReached); + fromReached = image.fromReached; + image = image.images[0] || false; + } + else if(inArray(mime.getType(file.name), compatibleMime)) + { + image = file.path; + } + + if(image && (!from || fromReached)) + { + images.push(image); + imagesNum++; + + if(imagesNum == Math.abs(num)) + break; + } + } + + if(file.path === from) + fromReached = true; + + if(reverse) + { + i--; + stop = i < 0 ? true : false; + } + else + { + i++; + stop = i >= len ? true : false; + } + } + + return {images: images, fromReached: fromReached}; + } + + this.images = async function(only = 1, from = false) { + + if(!this.alreadyRead) await this.read(); + + let images = (await this._images(only, this.files, from)).images; + + for(let i = 0, len = images.length; i < len; i++) + { + images[i] = {name: p.basename(images[i]), path: images[i], folder: false, compressed: false}; + } + + return (Math.abs(only) == 1) ? (images[0] || false) : images; + } + + this.only = function(files) { + + let only = this.config.only; + let _files = []; + + if(only >= 0) + { + let len = files.length; + let limit = only; + if(limit > len) limit = len; + + for(let i = 0; i < limit; i++) + { + _files.push(files[i]); + } + } + else + { + let len = files.length; + let limit = len + only; + if(limit < 0) limit = 0; + + for(let i = len - 1; i >= limit; i--) + { + _files.push(files[i]); + } + } + + return _files; + } + + this._readFromFilesList = function(segments, files) { + + let segment = segments.shift(); + let remaining = segments.length; + + for(let i = 0, len = files.length; i < len; i++) + { + let file = files[i]; + + if(file.name == segment) + { + if(remaining == 0) + return file.files; + else + return this._readFromFilesList(segments, file.files); + } + } + + } + + this.readFromFilesList = function(files, path, lastCompressed) { + + let segments = removePathPart(path, lastCompressed).split(p.sep); + + return this._readFromFilesList(segments, files); + + } + + this.makeAvailable = async function(files, callbackWhenFileAvailable = false) { + + let filesToDecompress = false; + + for(let i = 0, len = files.length; i < len; i++) + { + let file = files[i]; + + if(fs.existsSync(realPath(file.path, -1))) + { + if(callbackWhenFileAvailable) callbackWhenFileAvailable(file); + } + else + { + let compressedFile = lastCompressedFile(file.path); + + if(!filesToDecompress) filesToDecompress = {}; + if(!filesToDecompress[compressedFile]) filesToDecompress[compressedFile] = []; + + filesToDecompress[compressedFile].push(removePathPart(file.path, compressedFile)); + } + } + + if(filesToDecompress) + { + for(let compressedFile in filesToDecompress) + { + let compressed = this.openCompressed(compressedFile); + + await this.extractIfInsideAnotherCompressed(compressedFile); + + await compressed.extract({only: filesToDecompress[compressedFile]}, function(file) { + + if(callbackWhenFileAvailable) callbackWhenFileAvailable(file); + + }); + } + } + + return; + } +} + + +// Compressed files +var fileCompressed = function(path, _realPath = false) { + + this.path = path; + this.realPath = _realPath || realPath(path, -1); + this.virtualPath = this.path; + this.sha = sha1(p.normalize(path)); + this.cacheFile = 'compressed-files-'+this.sha+'.json'; + this.tmp = p.join(tempFolder, this.sha); + this.tmpPartialExtraction = p.join(this.tmp, this.sha+'-opencomic-partial-extraction.txt'); + // this.tmpExt = p.join(tempFolder, 'extracting-'+sha); + this.contentRightZindex = template.contentRightZindex(); + + this.fullExtracted = false; + + this.files = false; + this.filesStatus = {}; + + this.config = this._config = { + // only: false, + width: window.devicePixelRatio * 150, // Vector width + height: false, // Vector height + force: false, // Forces the extraction even if the file exists + }; + + this._features = { + zip: { + read: true, + single: true, + vector: false, + canvas: false, + html: false, + progress: true, + }, + '7z': { + read: true, + single: true, + vector: false, + canvas: false, + html: false, + progress: true, + }, + rar: { + read: true, + single: true, + vector: false, + canvas: false, + html: false, + progress: true, + }, + tar: { + read: true, + single: true, + vector: false, + canvas: false, + html: false, + progress: false, + }, + pdf: { + read: true, + single: true, + vector: true, + canvas: true, + html: true, + progress: true, + }, + }; + + this.features = false; + + this.updateConfigOnly = function(_only) { + + if(!_only) + return this.config.only = this.config._only = _only; + + let only = {}; + + for(let i = 0, len = _only.length; i < len; i++) + { + only[_only[i]] = true; + } + + this.config._only = _only; + return this.config.only = only; + + } + + this.updateConfig = function(config) { + + for(let key in this._config) + { + if(typeof config[key] === 'undefined') + config[key] = this._config[key]; + } + + this.config = config; + + if(config.only) + this.updateConfigOnly(config.only); + + } + + this.getFeatures = function(force = false) { + + if(this.features && !force) return this.features; + + if(!force) + { + let ext = fileExtension(this.path); + + if(inArray(ext, compressedExtensions.zip)) + force = 'zip'; + else if(inArray(ext, compressedExtensions['7z'])) + force = '7z'; + else if(inArray(ext, compressedExtensions.rar)) + force = 'rar'; + else if(inArray(ext, compressedExtensions.tar)) + force = 'tar'; + else if(inArray(ext, compressedExtensions.pdf)) + force = 'pdf'; + } + + this.features = this._features[force]; + this.features[force] = true; + + return this.features; + + } + + this.readWithoutCache = false; + + this.read = async function(config = {}) { + + this.updateConfig(config); + this.getFeatures(); + + if(this.config.cache && this.files) + return this.files; + + this.readWithoutCache = true; + + if(this.features.zip) + return this.readZip(); + else if(this.features['7z']) + return this.read7z(); + else if(this.features.rar) + return this.readRar(); + else if(this.features.tar) + return this.readTar(); + else if(this.features.pdf) + return this.readPdf(); + + return false; + } + + this.callbackWhenFileExtracted = false; + + this.extract = async function(config = {}, callbackWhenFileExtracted = false) { + + this.updateConfig(config); + this.getFeatures(); + + this.callbackWhenFileExtracted = callbackWhenFileExtracted; + + if(!fs.existsSync(this.tmp)) + { + fs.mkdirSync(this.tmp); + + if(this.config.only) + fs.writeFileSync(this.tmpPartialExtraction, ''); + } + else if(!this.config.only) + { + if(fs.existsSync(this.tmpPartialExtraction)) + fs.unlinkSync(this.tmpPartialExtraction); + } + + if(!this.config.force) + { + let only = await this.checkIfAlreadyExtracted(); + + if(only === null) + return true; + else + this.updateConfigOnly(only); + } + + if(this.features.progress) + this.setProgress(0); + + if(this.features.zip) + return this.extractZip(); + else if(this.features['7z']) + return this.extract7z(); + else if(this.features.rar) + return this.extractRar(); + else if(this.features.tar) + return this.extractTar(); + else if(this.features.pdf) + return this.extractPdf(); + + return false; + } + + this.checkIfAlreadyExtracted = async function() { + + if(this.config.only) + { + let only = []; + + for(let path in this.config.only) + { + if(!fs.existsSync(p.join(this.tmp, path))) + only.push(path); + else + this.whenExtractFile(p.join(this.path, path)); + } + + if(!only.length) + return null; + else + return only; + } + else + { + try + { + let file = fileManager.file(this.path); + let files = await file.read({cacheOnly: true}); + files = this.filesToOnedimension(files); + + let only = []; + let someIsExtracted = false; + + for(let i = 0, len = files.length; i < len; i++) + { + let file = files[i]; + + if(fs.existsSync(p.join(this.tmp, file.pathInCompressed))) + { + this.whenExtractFile(p.join(this.path, file.pathInCompressed)); + someIsExtracted = true; + } + else + { + only.push(file.pathInCompressed); + } + } + + if(!only.length) + return null; + else if(someIsExtracted) + return only; + else + return false; + } + catch(error) + { + console.error(error); + + return false; + } + } + + } + + this.renderCanvas = async function(file, canvas, config = {}, callback = false, callbackError = false) { + + this.updateConfig(config); + this.getFeatures(); + + if(this.features.pdf) + this.renderCanvasPdf(file, canvas, callback); + + } + + this.setFileStatus = function(path, data = {}) { + + if(!this.filesStatus[path]) + { + this.filesStatus[path] = data; + } + else + { + for(let key in data) + { + if(key != 'extracted' || data[key]) + this.filesStatus[path][key] = data[key]; + } + } + + } + + this.getFileStatus = function(file) { + + return this.filesStatus[file] || false; + + } + + this.removeTmp = function(name) { + + return removePathPart(name, this.tmp); + + } + + this.isCompressed = function(name) { + + let ext = fileExtension(name); + + if(inArray(ext, compressedExtensions.all)) + return true; + + return false; + } + + this.isFolder = function(path) { + + if(fs.statSync(realPath(path, -1)).isDirectory()) + return true; + + return false; + } + + this.folderPathRegExp = false; + + this.folderPath = function(path) { + + if(!this.folderPathRegExp) + this.folderPathRegExp = new RegExp(pregQuote(p.sep)+'[^'+pregQuote(p.sep)+']+$'); + + return path.replace(this.folderPathRegExp, ''); + + } + + this._filesToMultidimension = function(files, dimensions, from = false) { + + let _files = []; + + for(let key in dimensions) + { + let value = dimensions[key]; + + if(typeof value === 'number') + { + let file = files[value]; + + let data = { + name: key, + path: file.path, + folder: file.folder ? true : false, + compressed: this.isCompressed(file.name), + }; + + if(file.folder) + data.files = []; + + _files.push(data); + } + else + { + let _name = from ? p.join(from, key) : key; + + _files.push({ + name: key, + path: p.join(this.path, _name), + folder: true, + files: this._filesToMultidimension(files, value, _name), + }); + } + } + + return _files; + } + + this.filesToMultidimension = function(files) { + + files.sort(function(a, b) { + + if(a.name === b.name) // This is technically not possible + return 0; + + return a.name > b.name ? 1 : -1; + }); + + let dimensions = {}; + + let firstFile = files[0]; + + for(let i = 0, len = files.length; i < len; i++) + { + let file = files[i]; + let fileIndex = i; + let segments = file.name.split(p.sep); + + let dimension = dimensions; + + for(let i = 0, len = segments.length; i < len; i++) + { + let segment = segments[i]; + + if(segment) + { + if(!dimension[segment] || typeof dimension[segment] === 'number') dimension[segment] = (i + 1 == len) ? fileIndex : {}; + dimension = dimension[segment]; + } + } + } + + let _files = this._filesToMultidimension(files, dimensions); + + return _files; + } + + this.filesToOnedimension = function(files, _files = [], parentPath = '') { + + for(let i = 0, len = files.length; i < len; i++) + { + let file = files[i]; + + let _parentPath = p.join(parentPath, file.name); + + _files.push({name: file.name, path: file.path, pathInCompressed: _parentPath, folder: file.folder, compressed: file.compressed}) + + if(file.files) + _files = this.filesToOnedimension(file.files, _files, _parentPath); + } + + return _files; + } + + this.whenExtractFile = function(path) { + + if(this.callbackWhenFileExtracted) + { + let name = p.basename(path); + + let file = { + name: name, + path: path, + folder: this.isFolder(path), + compressed: this.isCompressed(name), + }; + + this.callbackWhenFileExtracted(file); + } + + }; + + this.progressIndex = 0; + this.progressPrev = false; + + this.setProgress = function(progress) { + + if(!progress) + this.progressPrev = false; + + let svg = document.querySelector('.content-right .content-right-'+this.contentRightZindex+' .loading.loading96 svg'); + + if(svg) + { + svg.style.animation = 'none'; + svg.style.transform = 'rotate(-90deg)'; + } + + let circle = document.querySelector('.content-right .content-right-'+this.contentRightZindex+' .loading.loading96 circle'); + + if(circle) + { + let now = Date.now(); + + let speed = this.progressPrev ? Math.round(now - this.progressPrev) : 0; + + this.progressPrev = now; + + circle.style.animation = 'none'; + circle.style.transition = speed+'ms stroke-dasharray'; + circle.style.strokeDashoffset = 225; + circle.style.strokeDasharray = 226 + ((422 - 226) * progress); + } + + } + + // ZIP + this.zip = false; + + this.openZip = async function() { + + // Not support this cache + // if(this.zip) return this.zip; + + if(unzip === false) unzip = require('unzipper'); + + this.zip = await unzip.Open.file(this.realPath); + + return this.zip; + + } + + this.checkZipError = async function(extract = false) { + + let _this = this; + + return new Promise(function(resolve, reject) { + + fs.createReadStream(_this.realPath).pipe( + unzip.Extract({path: _this.tmp}).on('close', reject).on('error', async function(error){ + + if(/0xafbc7a37/.test(error.message)) // 7zip file + { + _this.getFeatures('7z'); + + resolve(extract ? _this.extract7z() : _this.read7z()); + } + else if(/0x21726152/.test(error.message)) // rar file + { + _this.getFeatures('rar'); + + resolve(extract ? _this.extractRar() : _this.readRar()); + } + else + { + reject(error); + } + + }) + ); + + }); + + } + + this.readZip = async function(callback = false) { + + let files = []; + + console.time('readZip'); + + try + { + let zip = await this.openZip(); + + for(let i = 0, len = zip.files.length; i < len; i++) + { + let entry = zip.files[i]; + let name = entry.path; + + files.push({name: name, path: p.join(this.path, name), folder: (entry.type === 'Directory' ? true : false)}); + this.setFileStatus(name, {extracted: false}); + } + + files = this.filesToMultidimension(files); + } + catch(error) + { + files = await this.checkZipError(); + } + + console.timeEnd('readZip'); + + return this.files = files; + + } + + this.extractZip = async function(callback = false) { + + console.time('extractZip'); + + try + { + let zip = await this.openZip(); + + this.progressIndex = 0; + + let _this = this; + let only = this.config.only; + + let promises = []; + + for(let i = 0, len = zip.files.length; i < len; i++) + { + let entry = zip.files[i]; + let name = entry.path; + + let extract = !only || only[name] ? true : false; + + if(extract) + { + let path = p.join(this.tmp, name); + let virtualPath = p.join(this.path, name); + + if(entry.type === 'Directory') + { + if(!fs.existsSync(path)) + fs.mkdirSync(path); + } + else + { + let folderPath = this.folderPath(path); + + if(!fs.existsSync(folderPath)) + fs.mkdirSync(folderPath, {recursive: true}); + + this.setFileStatus(name, {extracted: true}); + + promises.push(new Promise(function(resolve, reject) { + entry.stream().pipe(fs.createWriteStream(path)).on('error', reject).on('finish', function() { + + _this.setProgress(_this.progressIndex++ / len); + _this.whenExtractFile(virtualPath); + + resolve(); + }); + })); + } + } + } + + await Promise.all(promises); + } + catch(error) + { + await this.checkZipError(true); + } + + this.setProgress(1); + + console.timeEnd('extractZip'); + + return; + } + + + + + // 7z + this._7z = false; + + this.open7z = async function(extract = false, only = '') { + + // Not support this cache + // if(this._7z) return this._7z; + + if(un7z === false) un7z = require('node-7z'); + if(bin7z === false) bin7z = asarToAsarUnpacked(require('7zip-bin').path7za); + + if(extract) + this._7z = un7z.extractFull(this.realPath, this.tmp, {$bin: bin7z, $progress: true, $cherryPick: only}); + else + this._7z = un7z.list(this.realPath, {$bin: bin7z}); + + return this._7z; + + } + + this.read7z = async function(callback = false) { + + let files = []; + + console.time('read7z'); + let _this = this; + + let _7z = await this.open7z(); + + return new Promise(function(resolve, reject) { + + _7z.on('data', function(data) { + + let name = _this.removeTmp(data.file); + + files.push({name: name, path: p.join(_this.path, name)}); + _this.setFileStatus(name, {extracted: false}); + + }).on('end', function(data) { + + console.timeEnd('read7z'); + + _this.files = _this.filesToMultidimension(files); + resolve(_this.files); + + }).on('error', function(error){ + + reject(error); + + }); + + }); + + } + + this.extract7z = async function(callback = false) { + + console.time('extract7z'); + + let only = this.config.only; + let _this = this; + + let _7z = await this.open7z(true, this.config._only || false); + + return new Promise(function(resolve, reject) { + + _7z.on('data', function(data) { + + let extracted = data.status == 'extracted' ? true : false; + + if(extract) + { + let name = _this.removeTmp(data.file); + + _this.setFileStatus(name, {extracted: extract}); + _this.whenExtractFile(p.join(_this.path, name)); + } + + }).on('progress', function(progress) { + + _this.setProgress(progress.percent / 100); + + }).on('end', function(data) { + + console.timeEnd('extract7z'); + + _this.setProgress(1); + + resolve(); + + }).on('error', function(error) { + + reject(error); + + }); + + }); + + } + + + // RAR + this.rar = false; + + this.openRar = async function(extract = false, only = '') { + + if(this.rar) return this.rar; + + if(unrar === false) unrar = require('unrar'); + + let bin = false; + + if(process.platform == 'win32' || process.platform == 'win64') + bin = asarToAsarUnpacked(p.join(appDir, 'unrar/UnRAR.exe')); + else if(process.platform == 'darwin') + bin = asarToAsarUnpacked(p.join(appDir, 'unrar/unrar_MacOSX_10.13.2_64bit')); + + this.rar = new unrar({ + path: this.realPath, + bin: bin, + }); + + return this.rar; + + } + + this.readRar = async function(callback = false) { + + let files = []; + + console.time('readRar'); + let _this = this; + + let rar = await this.openRar(); + + return new Promise(function(resolve, reject) { + + rar.list(function(error, entries) { + + if(!error) + { + for(let i = 0, len = entries.length; i < len; i++) + { + let entry = entries[i]; + let name = _this.removeTmp(entry.name); + + files.push({name: name, path: p.join(_this.path, name), folder: (entry.type === 'Directory' ? true : false)}); + _this.setFileStatus(name, {extracted: false}); + } + + console.timeEnd('readRar'); + + _this.files = _this.filesToMultidimension(files); + resolve(_this.files); + } + else + { + reject(error); + } + + }); + + }); + + } + + this.extractRar = async function(callback = false) { + + console.time('extractRar'); + + this.progressIndex = 0; + + let only = this.config.only; + let _this = this; + + let rar = await this.openRar(); + + return new Promise(function(resolve, reject) { + + rar.list(async function(error, entries) { + + if(!error) + { + let promises = []; + + for(let i = 0, len = entries.length; i < len; i++) + { + let entry = entries[i]; + let name = entry.name; + let extract = !only || only[name] ? true : false; + + if(extract) + { + let path = p.join(_this.tmp, name); + let virtualPath = p.join(_this.path, name); + + if(entry.type === 'Directory') + { + if(!fs.existsSync(path)) + fs.mkdirSync(path); + } + else + { + let folderPath = _this.folderPath(path); + + if(!fs.existsSync(folderPath)) + fs.mkdirSync(folderPath, {recursive: true}); + + _this.setFileStatus(name, {extracted: true}); + + promises.push(new Promise(function(resolve, reject) { + rar.stream(name).on('error', reject).on('end', function() { + + _this.setProgress(_this.progressIndex++ / len); + _this.whenExtractFile(virtualPath); + + resolve(); + + }).pipe(fs.createWriteStream(path)); + })); + } + } + } + + await Promise.all(promises); + + _this.setProgress(1); + + console.timeEnd('extractRar'); + + resolve(); + } + else + { + reject(error); + } + + }); + + }); + + } + + + // TAR + this.tar = false; + + this.openTar = async function() { + + // Not support this cache + // if(this.tar) return this.tar; + + if(untar === false) untar = require('tar-fs'); + + this.tar = fs.createReadStream(this.realPath); + + return this.tar; + + } + + this.readTar = async function(callback = false) { + + let files = []; + + let tar = await this.openTar(); + let _this = this; + + console.time('readTar'); + + return new Promise(function(resolve, reject) { + + tar.pipe(untar.extract(_this.tmp, { + ignore (name) { + + name = _this.removeTmp(name); + + files.push({name: name, path: p.join(_this.path, name)}); + _this.setFileStatus(name, {extracted: false}); + + return true; + } + })).on('finish', function() { + + console.timeEnd('readTar'); + + _this.files = _this.filesToMultidimension(files); + resolve(_this.files); + + }).on('error', function(error) { + + reject(error); + + }); + + }); + + } + + this.extractTar = async function(callback = false) { + + let tar = await this.openTar(); + + let only = this.config.only; + let _this = this; + + console.time('extractTar'); + + let files = []; + + return new Promise(function(resolve, reject) { + + tar.pipe(untar.extract(_this.tmp, { + ignore (name) { + name = _this.removeTmp(name); + + let extract = !only || only[name] ? true : false; + _this.setFileStatus(name, {extracted: extract}); + + if(extract) + files.push(p.join(_this.path, name)); + + return !extract; + } + })).on('finish', function() { + + console.timeEnd('extractTar'); + + for(let i = 0, len = files.length; i < len; i++) + { + _this.whenExtractFile(files[i]); + } + + resolve(); + + }).on('error', function(error) { + + reject(error); + + }); + + }); + + } + + + + // PDF + this.pdf = false; + + this.openPdf = async function() { + + if(this.pdf) return this.pdf; + + if(unpdf === false) + { + unpdf = require('pdfjs-dist/build/pdf'); + unpdf.GlobalWorkerOptions.workerSrc = p.join(appDir, 'node_modules/pdfjs-dist/build/pdf.worker.js'); + } + + this.pdf = await unpdf.getDocument({url: this.realPath/*, nativeImageDecoderSupport: 'none', disableFontFace: true*/}).promise; + + return this.pdf; + + } + + this.readPdf = async function() { + + let _this = this; + + let files = []; + + console.time('readPdf'); + + let pdf = await this.openPdf(); + let pages = pdf.numPages; + + for(let i = 1; i <= pages; i++) + { + let file = 'page-'+i+'.jpg'; + + let page = await pdf.getPage(i); + let viewport = page.getViewport({scale: 1}); + + let size = {width: viewport.width, height: viewport.height}; + + files.push({name: file, path: p.join(this.path, file), folder: false, compressed: false, size: size}); + this.setFileStatus(file, {page: i, extracted: false, size: size}); + } + + console.timeEnd('readPdf'); + + return this.files = files; + + } + + this.extractPdf = async function() { + + console.time('extractPdf'); + + let pdf = await this.openPdf(); + let pages = pdf.numPages; + + let only = this.config.only; + + for(let i = 1; i <= pages; i++) + { + let file = 'page-'+i+'.jpg'; + let path = p.join(this.tmp, file); + let virtualPath = p.join(this.path, file); + + let status = this.getFileStatus(file); + + if((!only || only[file]) && (this.config.force || !status.extracted || status.width !== this.config.width || !fs.existsSync(path))) + { + // Render page + let page = await pdf.getPage(i); + + let width = (status?.size?.width || page.getViewport({scale: 1}).width); + + let scale = this.config.width / width; + let viewport = page.getViewport({scale: scale}); + + let canvas = document.createElement('canvas'); + canvas.width = viewport.width; + canvas.height = viewport.height; + let context = canvas.getContext('2d'); + + await page.render({canvasContext: context, viewport: viewport}).promise; + + let imageData = canvas.toDataURL('image/jpeg', 1); + + fs.writeFileSync(path, Buffer.from(imageData.replace(/^data:image\/[a-z]+;base64,/, ''), 'base64')); + + this.setFileStatus(file, {page: i, extracted: true, width: this.config.width}); + + this.setProgress((i - 1) / pages); + this.whenExtractFile(virtualPath); + } + } + + this.setProgress(1); + + console.timeEnd('extractPdf'); + + return; + + } + + this.renderCanvasPdf = async function(file, canvas, callback = false, callbackError = false) { + + let pdf = await this.openPdf(); + let pages = pdf.numPages; + + let status = this.getFileStatus(file); + + console.log(file, status); + + if((status && status.widthRendered !== this.config.width) || this.config.force) + { + // Render page + let page = await pdf.getPage(status.page); + + let scale = this.config.width / status.size.width; + let viewport = page.getViewport({scale: scale}); + + canvas.width = viewport.width; + canvas.height = viewport.height; + let context = canvas.getContext('2d'); + + var transform = this.config.scale && this.config.scale !== 1 ? [this.config.scale, 0, 0, this.config.scale, 0, 0] : null; + + await page.render({canvasContext: context, viewport: viewport, transform: transform}).promise; + + this.setFileStatus(file, {rendered: true, widthRendered: this.config.width}); + } + + } + +} + +function realPath(path, index = 0) +{ + let segments = path.split(p.sep); + let len = segments.length; + + let virtualPath; + + let newPath = virtualPath = (len > 0) ? (isEmpty(segments[0]) ? '/' : segments[0]) : ''; + let numSegments = len + index; + + for(let i = 1; i < len; i++) + { + newPath = p.join(newPath, segments[i]); + virtualPath = p.join(virtualPath, segments[i]); + + if(i < numSegments) + { + let extension = fileExtension(newPath); + + if(extension && inArray(extension, compressedExtensions.all)/* && fs.existsSync(newPath) && !fs.statSync(newPath).isDirectory()*/) + { + let sha = sha1(p.normalize(virtualPath)); + + newPath = p.join(tempFolder, sha); + } + } + } + + return newPath; +} + +function firstCompressedFile(path, index = 0) +{ + let segments = path.split(p.sep); + let len = segments.length; + + let newPath = (len > 0) ? (isEmpty(segments[0]) ? '/' : segments[0]) : ''; + let numSegments = len + index; + + for(let i = 1; i < len; i++) + { + newPath = p.join(newPath, segments[i]); + + if(i < numSegments) + { + let extension = fileExtension(newPath); + + if(extension && inArray(extension, compressedExtensions.all) && !fs.statSync(newPath).isDirectory()) + return newPath; + } + } + + return newPath; +} + +function lastCompressedFile(path, index = 0) +{ + let segments = path.split(p.sep); + let len = segments.length; + + let newPath = (len > 0) ? (isEmpty(segments[0]) ? '/' : segments[0]) : ''; + let numSegments = len + index; + + let lastCompressed = false; + + for(let i = 1; i < len; i++) + { + newPath = p.join(newPath, segments[i]); + + if(i < numSegments) + { + let extension = fileExtension(newPath); + + if(extension && inArray(extension, compressedExtensions.all)) + lastCompressed = newPath; + } + } + + return lastCompressed; +} + +function allCompressedFiles(path, index = 0) +{ + let segments = path.split(p.sep); + let len = segments.length; + + let newPath = (len > 0) ? (isEmpty(segments[0]) ? '/' : segments[0]) : ''; + let numSegments = len + index; + + let lastCompressed = false; + + let files = []; + + for(let i = 1; i < len; i++) + { + newPath = p.join(newPath, segments[i]); + + if(i < numSegments) + { + let extension = fileExtension(newPath); + + if(extension && inArray(extension, compressedExtensions.all)) + files.push(newPath); + } + } + + return files; +} + +function containsCompressed(path, index = 0) +{ + let segments = path.split(p.sep); + let len = segments.length; + + var virtualPath = (len > 0) ? (isEmpty(segments[0]) ? '/' : segments[0]) : ''; + let numSegments = len + index; + + for(let i = 1; i < len; i++) + { + virtualPath = p.join(virtualPath, segments[i]); + + if(i < numSegments) + { + var extension = fileExtension(virtualPath); + + if(extension && inArray(extension, compressedExtensions.all) && !fs.statSync(virtualPath).isDirectory()) + { + return true; + } + } + } + + return false; +} + +function removePathPart(path, partToRemove) +{ + path = path.replace(new RegExp('^\s*'+pregQuote(partToRemove)), ''); + path = path.replace(new RegExp('^\s*'+pregQuote(p.sep)), ''); + + return path; +} + +function pathType(path) +{ + if(inArray(mime.getType(path), compatibleMime)) + return {folder: false, compressed: false}; + else if(fs.statSync(path).isDirectory()) + return {folder: true, compressed: false}; + else if(inArray(fileExtension(path), compressedExtensions.all)) + return {folder: false, compressed: true}; + else + return false; +} + +function filtered(files) +{ + let filtered = []; + + if(files) + { + for(let i = 0, len = files.length; i < len; i++) + { + let file = files[i]; + + if(file.folder || file.compressed) + filtered.push(file); + else if(inArray(mime.getType(file.path), compatibleMime)) + filtered.push(file); + } + } + + return filtered; +} + +function sort(files) +{ + if(files) + { + let sort = config.sort; + let sortInvert = config.sortInvert; + let foldersFirst = config.foldersFirst; + + let order = ''; + + if(sort == 'name') + order = 'simple'; + else if(sort == 'numeric') + order = 'numeric'; + else + order = 'simple-numeric'; + + files.sort(function (a, b) { + if(foldersFirst && (a.folder || a.compressed) && !(b.folder || b.compressed)) return -1; + if(foldersFirst && (b.folder || b.compressed) && !(a.folder || a.compressed)) return 1; + return (sortInvert) ? -(dom.orderBy(a, b, order, 'name')) : dom.orderBy(a, b, order, 'name'); + }); + + return files; + } +} + +module.exports = { + file: function(path) { + return new file(path); + }, + fileCompressed: function(path, realPath = false){ // This consider moving it to a separate file + return new fileCompressed(path, realPath); + }, + filtered: filtered, + sort: sort, + realPath: realPath, + pathType: pathType, + firstCompressedFile: firstCompressedFile, + lastCompressedFile: lastCompressedFile, + containsCompressed: containsCompressed, +} \ No newline at end of file diff --git a/scripts/file.js b/scripts/file.js deleted file mode 100644 index 83b79622b..000000000 --- a/scripts/file.js +++ /dev/null @@ -1,275 +0,0 @@ - -function realPath(path, index = 0) -{ - let segments = path.split(p.sep); - - var virtualPath; - - var newPath = virtualPath = (segments.length > 0) ? (isEmpty(segments[0]) ? '/' : segments[0]) : ''; - - let numSegments = segments.length + index; - - for(let i = 1; i < segments.length; i++) - { - newPath = p.join(newPath, segments[i]); - virtualPath = p.join(virtualPath, segments[i]); - - if(i < numSegments) - { - var extension = fileExtension(newPath); - - if(extension && inArray(extension, compressedExtensions.all) && fs.existsSync(newPath) && !fs.statSync(newPath).isDirectory()) - { - var sha = sha1(p.normalize(virtualPath)); - - newPath = p.join(tempFolder, sha); - } - } - } - - return newPath; -} - -function firstCompressedFile(path, index = 0) -{ - let segments = path.split(p.sep); - - var newPath = (segments.length > 0) ? (isEmpty(segments[0]) ? '/' : segments[0]) : ''; - - let numSegments = segments.length + index; - - for(let i = 1; i < segments.length; i++) - { - newPath = p.join(newPath, segments[i]); - - if(i < numSegments) - { - var extension = fileExtension(newPath); - - if(extension && inArray(extension, compressedExtensions.all) && !fs.statSync(newPath).isDirectory()) - { - return newPath; - } - } - } - - return newPath; -} - -function filtered(path, files) -{ - var filtered = []; - - if(files) - { - for(var i = 0; i < files.length; i++) - { - var filePath = p.join(path, files[i]); - - if(inArray(mime.getType(filePath), compatibleMime)) - filtered.push({name: files[i], path: filePath, folder: false, compressed: false}); - else if(fs.statSync(filePath).isDirectory()) - filtered.push({name: files[i], path: filePath, folder: true, compressed: false}); - else if(inArray(fileExtension(filePath), compressedExtensions.all)) - filtered.push({name: files[i], path: filePath, folder: false, compressed: true}); - } - - if(filtered.length > 0) - return filtered; - } -} - -function readdirWD(path, index = 0) -{ - let segments = path.split(p.sep); - - var newPath = (segments.length > 0) ? (isEmpty(segments[0]) ? '/' : segments[0]) : ''; - - let numSegments = segments.length + index; - let files = null; - - var compressed = false; - - eachPaths: - for(let i = 1; i < segments.length; i++) - { - newPath = p.join(newPath, segments[i]); - - if(i < numSegments) - { - var extension = fileExtension(newPath); - - if(extension && inArray(extension, compressedExtensions.all) && (!fs.existsSync(newPath) || !fs.statSync(newPath).isDirectory())) - { - compressed = true; - - files = fileCompressed.returnFilesWD(newPath, true); - - if(checkError(files)) - return files; - } - else if(files) - { - eachFiles: - for(let i2 in files) - { - if(files[i2].name === segments[i]) - { - files = files[i2].files; - break eachFiles; - } - } - } - } - } - - if(!compressed && fs.existsSync(path)) - files = file.filtered(path, fs.readdirSync(path)); - else if(compressed && typeof files == 'undefined') - files = []; - else if(compressed && typeof files.files != 'undefined') - delete files.files; - - return files; -} - -function containsCompressed(path, index = 0) -{ - let segments = path.split(p.sep); - - var virtualPath = (segments.length > 0) ? (isEmpty(segments[0]) ? '/' : segments[0]) : ''; - - let numSegments = segments.length + index; - - for(let i = 1; i < segments.length; i++) - { - virtualPath = p.join(virtualPath, segments[i]); - - if(i < numSegments) - { - var extension = fileExtension(virtualPath); - - if(extension && inArray(extension, compressedExtensions.all) && !fs.statSync(virtualPath).isDirectory()) - { - return true; - } - } - } - - return false; -} - -function pathType(path) -{ - if(inArray(mime.getType(path), compatibleMime)) - return {folder: false, compressed: false}; - else if(fs.statSync(path).isDirectory()) - return {folder: true, compressed: false}; - else if(inArray(fileExtension(path), compressedExtensions.all)) - return {folder: false, compressed: true}; - else - return false; -} - -function returnFirst(path) -{ - var path = file.realPath(path); - - if(fs.existsSync(path)) - { - var files = fs.readdirSync(path); - - return file.filtered(path, files); - } -} - -function returnFirstWD(path) -{ - return file.readdirWD(path); -} - -function returnAll(path, changePath = false) -{ - let returnFiles = []; - - if(fs.existsSync(path)) - { - var files = fs.readdirSync(path); - - if(files) - { - for(var i = 0; i < files.length; i++) - { - var filePath = p.join(path, files[i]); - - if(!changePath) - var retrunPath = filePath; - else - var retrunPath = filePath.replace(new RegExp('^'+pregQuote(changePath.from)), changePath.to); - - if(inArray(mime.getType(filePath), compatibleMime)) - returnFiles.push({name: files[i], path: retrunPath, folder: false, compressed: false}); - else if(fs.statSync(filePath).isDirectory()) - returnFiles.push({name: files[i], path: retrunPath, folder: true, compressed: false, files: returnAll(filePath, changePath)}); - else if(inArray(fileExtension(filePath), compressedExtensions.all)) - returnFiles.push({name: files[i], path: retrunPath, folder: false, compressed: true, files: []}); - - } - } - } - - return returnFiles; -} - -function allToFirst(files) -{ - var returnFiles = []; - - for(let i in files) - { - returnFiles.push({name: files[i].name, path: files[i].path, folder: files[i].folder, compressed: files[i].compressed}); - } - - return returnFiles; -} - -function sort(files) -{ - if(files) - { - var sort = config.sort; - var sortInvert = config.sortInvert; - var foldersFirst = config.foldersFirst; - - var order = ''; - - if(sort == 'name') - order = 'simple'; - else if(sort == 'numeric') - order = 'numeric'; - else - order = 'simple-numeric'; - - files.sort(function (a, b) { - if(foldersFirst && (a.folder || a.compressed) && !(b.folder || b.compressed)) return -1; - if(foldersFirst && (b.folder || b.compressed) && !(a.folder || a.compressed)) return 1; - return (sortInvert) ? -(dom.orderBy(a, b, order, 'name')) : dom.orderBy(a, b, order, 'name'); - }); - - return files; - } -} - -module.exports = { - filtered: filtered, - returnFirst: returnFirst, - returnAll: returnAll, - allToFirst: allToFirst, - sort: sort, - realPath: realPath, - pathType: pathType, - readdirWD: readdirWD, - returnFirstWD: returnFirstWD, - firstCompressedFile: firstCompressedFile, - containsCompressed: containsCompressed, -}; \ No newline at end of file diff --git a/scripts/gamepad.js b/scripts/gamepad.js index 644abc0b9..6a35984fa 100644 --- a/scripts/gamepad.js +++ b/scripts/gamepad.js @@ -250,8 +250,6 @@ function setAxesStepsEvent(key, buttons, callback) if(!axesStepsEvents[button]) axesStepsEvents[button] = {}; axesStepsEvents[button][key] = callback; } - - console.log(axesStepsEvents); } // Use the gamepad to navigate between the items in the content diff --git a/scripts/opencomic.js b/scripts/opencomic.js index e6acdc30f..616fff7d9 100644 --- a/scripts/opencomic.js +++ b/scripts/opencomic.js @@ -205,8 +205,7 @@ const storage = require(p.join(appDir, 'scripts/storage.js')), gamepad = require(p.join(appDir, 'scripts/gamepad.js')), dom = require(p.join(appDir, 'scripts/dom.js')), events = require(p.join(appDir, 'scripts/events.js')), - file = require(p.join(appDir, 'scripts/file.js')), - fileCompressed = require(p.join(appDir, 'scripts/file-compressed.js')), + fileManager = require(p.join(appDir, 'scripts/file-manager.js')), // New file management reading = require(p.join(appDir, 'scripts/reading.js')), settings = require(p.join(appDir, 'scripts/settings.js')), tracking = require(p.join(appDir, 'scripts/tracking.js')), @@ -1030,3 +1029,5 @@ function checkError(value, error = false) const NOT_POSSIBLE_WITHOUT_DECOMPRESSING = 1; const ERROR_UNZIPPING_THE_FILE = 2; +const ERROR_READING_THE_FILE = 3; +const ERROR_RENDERING_THE_FILE = 4; diff --git a/scripts/queue.js b/scripts/queue.js index 26a7234a8..bf698532e 100644 --- a/scripts/queue.js +++ b/scripts/queue.js @@ -1,35 +1,44 @@ -var processingTheQueue = false, queued = []; +var processingTheQueue = {}, queued = {}; -async function processTheQueue() +async function processTheQueue(key) { - var current = queued[0]; - - if(current) + if(queued[key]) { - current.callback.apply(false, current.arguments); - - queued.splice(0, 1); + let current = queued[key].shift(); - if(queued.length > 0) + if(current) { - process.nextTick(function() { + try + { + await current.callback.apply(false, current.arguments); + } + catch(error) + { + if(key == 'folderThumbnails') + dom.compressedError(error); - processTheQueue(); + console.error(error); + } - }); - } - else - { - processingTheQueue = false; + if(queued[key].length > 0) + { + process.nextTick(function() { + + processTheQueue(key); + + }); + + return; + } } } - else - { - processingTheQueue = false; - } + + processingTheQueue[key] = false; + + return; } -function addToQueue(key, callback) +async function addToQueue(key, callback) { _arguments = []; @@ -38,33 +47,31 @@ function addToQueue(key, callback) _arguments.push(arguments[i]); } - queued.push({key: key, callback: callback, arguments: _arguments}); + if(!queued[key]) queued[key] = []; + queued[key].push({key: key, callback: callback, arguments: _arguments}); - if(!processingTheQueue) + if(!processingTheQueue[key]) { - processingTheQueue = true; + processingTheQueue[key] = true; + + process.nextTick(function() { + + processTheQueue(key).catch(function(error){ + + //if(key == 'folderThumbnails') + // dom.compressedError(error); - setTimeout(function(){ + //console.error(error); - process.nextTick(function() { - processTheQueue(); }); - }, 0); + }); } } function cleanQueue(key = false) { - var newQueued = []; - - for(let i = 0, len = queued.length; i < len; i++) - { - if(i == 0 || (queued[i].key != key && key !== false)) - newQueued.push(queued[i]); - } - - queued = newQueued; + queued[key] = []; } module.exports = { diff --git a/scripts/reading.js b/scripts/reading.js index f319dee79..a3efd5b52 100644 --- a/scripts/reading.js +++ b/scripts/reading.js @@ -977,9 +977,9 @@ function showNextComic(mode, animation = true, invert = false) } if(invert) - showComicSkip = setTimeout('dom.openComic(true, "'+escapeQuotes(escapeBackSlash(dom.previousComic()), 'doubles')+'", "'+escapeQuotes(escapeBackSlash(dom.indexMainPathA()), 'doubles')+'", true);', _config.readingDelayComicSkip * 1000); + showComicSkip = setTimeout('dom.openComic(true, "'+escapeQuotes(escapeBackSlash(dom.previousComic()), 'doubles')+'", "'+escapeQuotes(escapeBackSlash(dom.indexMainPathA()), 'doubles')+'", true, false, true);', _config.readingDelayComicSkip * 1000); else - showComicSkip = setTimeout('dom.openComic(true, "'+escapeQuotes(escapeBackSlash(dom.nextComic()), 'doubles')+'", "'+escapeQuotes(escapeBackSlash(dom.indexMainPathA()), 'doubles')+'");', _config.readingDelayComicSkip * 1000); + showComicSkip = setTimeout('dom.openComic(true, "'+escapeQuotes(escapeBackSlash(dom.nextComic()), 'doubles')+'", "'+escapeQuotes(escapeBackSlash(dom.indexMainPathA()), 'doubles')+'", false, false, true);', _config.readingDelayComicSkip * 1000); currentIndex = indexNum + 1; } @@ -1072,9 +1072,9 @@ function showPreviousComic(mode, animation = true, invert = false) } if(invert) - showComicSkip = setTimeout('dom.openComic(true, "'+escapeQuotes(escapeBackSlash(dom.nextComic()), 'doubles')+'", "'+escapeQuotes(escapeBackSlash(dom.indexMainPathA()), 'doubles')+'");', _config.readingDelayComicSkip * 1000); + showComicSkip = setTimeout('dom.openComic(true, "'+escapeQuotes(escapeBackSlash(dom.nextComic()), 'doubles')+'", "'+escapeQuotes(escapeBackSlash(dom.indexMainPathA()), 'doubles')+'", false, false, true);', _config.readingDelayComicSkip * 1000); else - showComicSkip = setTimeout('dom.openComic(true, "'+escapeQuotes(escapeBackSlash(dom.previousComic()), 'doubles')+'", "'+escapeQuotes(escapeBackSlash(dom.indexMainPathA()), 'doubles')+'", true);', _config.readingDelayComicSkip * 1000); + showComicSkip = setTimeout('dom.openComic(true, "'+escapeQuotes(escapeBackSlash(dom.previousComic()), 'doubles')+'", "'+escapeQuotes(escapeBackSlash(dom.indexMainPathA()), 'doubles')+'", true, false, true);', _config.readingDelayComicSkip * 1000); currentIndex = 0; } @@ -3446,4 +3446,5 @@ module.exports = { setShownContentLeft: function(value){shownContentLeft = value}, setShownBarHeader: function(value){shownBarHeader = value}, loadReadingMoreOptions: loadReadingMoreOptions, + currentScale: function(){return currentScale}, }; \ No newline at end of file