From fd324db67e62adfab91e03c855a20e968b4130b4 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Mon, 20 Jun 2022 21:04:30 +0530 Subject: [PATCH 1/9] chore!: remove deprecated quaggajs based barcode scanner (#17248) --- frappe/public/js/barcode_scanner.bundle.js | 1 - frappe/public/js/desk.bundle.js | 1 - .../public/js/frappe/barcode_scanner/index.js | 23 --- .../js/frappe/barcode_scanner/quagga.js | 94 ------------- package.json | 1 - yarn.lock | 133 +----------------- 6 files changed, 3 insertions(+), 250 deletions(-) delete mode 100644 frappe/public/js/barcode_scanner.bundle.js delete mode 100644 frappe/public/js/frappe/barcode_scanner/index.js delete mode 100644 frappe/public/js/frappe/barcode_scanner/quagga.js diff --git a/frappe/public/js/barcode_scanner.bundle.js b/frappe/public/js/barcode_scanner.bundle.js deleted file mode 100644 index 294f20c08f..0000000000 --- a/frappe/public/js/barcode_scanner.bundle.js +++ /dev/null @@ -1 +0,0 @@ -import "./frappe/barcode_scanner/quagga"; diff --git a/frappe/public/js/desk.bundle.js b/frappe/public/js/desk.bundle.js index e056a34be2..735860635e 100644 --- a/frappe/public/js/desk.bundle.js +++ b/frappe/public/js/desk.bundle.js @@ -108,5 +108,4 @@ import "./frappe/ui/chart.js"; import "./frappe/ui/datatable.js"; import "./frappe/ui/driver.js"; import "./frappe/ui/plyr.js"; -import "./frappe/barcode_scanner/index.js"; import "./frappe/scanner"; diff --git a/frappe/public/js/frappe/barcode_scanner/index.js b/frappe/public/js/frappe/barcode_scanner/index.js deleted file mode 100644 index fa3975b578..0000000000 --- a/frappe/public/js/frappe/barcode_scanner/index.js +++ /dev/null @@ -1,23 +0,0 @@ -frappe.provide('frappe.barcode'); - -frappe.barcode.scan_barcode = function() { - return new Promise((resolve, reject) => { - if ( - window.cordova && - window.cordova.plugins && - window.cordova.plugins.barcodeScanner - ) { - window.cordova.plugins.barcodeScanner.scan(result => { - if (!result.cancelled) { - resolve(result.text); - } - }, reject); - } else { - frappe.require('barcode_scanner.bundle.js', () => { - frappe.barcode.get_barcode().then(barcode => { - resolve(barcode); - }); - }); - } - }); -}; diff --git a/frappe/public/js/frappe/barcode_scanner/quagga.js b/frappe/public/js/frappe/barcode_scanner/quagga.js deleted file mode 100644 index fcab3b4dbe..0000000000 --- a/frappe/public/js/frappe/barcode_scanner/quagga.js +++ /dev/null @@ -1,94 +0,0 @@ -import Quagga from 'quagga/dist/quagga'; -frappe.provide('frappe.barcode'); - -Quagga.onProcessed(function(result) { - let drawingCtx = Quagga.canvas.ctx.overlay, - drawingCanvas = Quagga.canvas.dom.overlay; - - if (result) { - if (result.boxes) { - drawingCtx.clearRect( - 0, - 0, - parseInt(drawingCanvas.getAttribute('width')), - parseInt(drawingCanvas.getAttribute('height')) - ); - result.boxes - .filter(function(box) { - return box !== result.box; - }) - .forEach(function(box) { - Quagga.ImageDebug.drawPath(box, { x: 0, y: 1 }, drawingCtx, { - color: 'green', - lineWidth: 2 - }); - }); - } - - if (result.box) { - Quagga.ImageDebug.drawPath(result.box, { x: 0, y: 1 }, drawingCtx, { - color: '#00F', - lineWidth: 2 - }); - } - - if (result.codeResult && result.codeResult.code) { - Quagga.ImageDebug.drawPath(result.line, { x: 'x', y: 'y' }, drawingCtx, { - color: 'red', - lineWidth: 3 - }); - } - } -}); - -frappe.barcode.get_barcode = function() { - return new Promise(resolve => { - let d = new frappe.ui.Dialog({ - title: __('Scan Barcode'), - fields: [ - { - fieldtype: 'HTML', - fieldname: 'scan_area' - } - ], - on_page_show() { - let $scan_area = d.get_field('scan_area').$wrapper; - $scan_area.addClass('barcode-scanner'); - - Quagga.init( - { - inputStream: { - name: 'Live', - type: 'LiveStream', - target: $scan_area.get(0) - }, - decoder: { - readers: ['code_128_reader'] - } - }, - function(err) { - if (err) { - // eslint-disable-next-line - console.log(err); - return; - } - // eslint-disable-next-line - console.log('Initialization finished. Ready to start'); - Quagga.start(); - } - ); - - Quagga.onDetected(function(result) { - let code = result.codeResult.code; - if (code) { - Quagga.stop(); - d.hide(); - resolve(code); - } - }); - } - }); - - d.show(); - }); -}; diff --git a/package.json b/package.json index e144c76e89..f4dc2cb3f0 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,6 @@ "node-sass": "^7.0.0", "plyr": "^3.7.2", "popper.js": "^1.16.0", - "quagga": "^0.12.1", "quill": "2.0.0-dev.4", "quill-image-resize": "^3.0.9", "quill-magic-url": "^3.0.0", diff --git a/yarn.lock b/yarn.lock index ec908cbb11..bd14584723 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1059,13 +1059,6 @@ cwd@^0.10.0: find-pkg "^0.1.2" fs-exists-sync "^0.1.0" -cwise-compiler@^1.1.2: - version "1.1.3" - resolved "https://registry.yarnpkg.com/cwise-compiler/-/cwise-compiler-1.1.3.tgz#f4d667410e850d3a313a7d2db7b1e505bb034cc5" - integrity sha1-9NZnQQ6FDToxOn0tt7HlBbsDTMU= - dependencies: - uniq "^1.0.0" - dashdash@^1.12.0: version "1.14.1" resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.1.tgz#853cfa0f7cbe2fed5de20326b8dd581035f6e2f0" @@ -1073,11 +1066,6 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" -data-uri-to-buffer@0.0.3: - version "0.0.3" - resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-0.0.3.tgz#18ae979a6a0ca994b0625853916d2662bbae0b1a" - integrity sha1-GK6XmmoMqZSwYlhTkW0mYruuCxo= - de-indent@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d" @@ -1905,23 +1893,6 @@ get-intrinsic@^1.0.2: has "^1.0.3" has-symbols "^1.0.1" -get-pixels@^3.2.3: - version "3.3.2" - resolved "https://registry.yarnpkg.com/get-pixels/-/get-pixels-3.3.2.tgz#3f62fb8811932c69f262bba07cba72b692b4ff03" - integrity sha512-6ar+8yPxRd1pskEcl2GSEu1La0+xYRjjnkby6AYiRDDwZ0tJbPQmHnSeH9fGLskT8kvR0OukVgtZLcsENF9YKQ== - dependencies: - data-uri-to-buffer "0.0.3" - jpeg-js "^0.3.2" - mime-types "^2.0.1" - ndarray "^1.0.13" - ndarray-pack "^1.1.1" - node-bitmap "0.0.1" - omggif "^1.0.5" - parse-data-uri "^0.2.0" - pngjs "^3.3.3" - request "^2.44.0" - through "^2.3.4" - get-stdin@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" @@ -1934,21 +1905,6 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" -gl-mat2@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/gl-mat2/-/gl-mat2-1.0.1.tgz#142505730a5c2fe1e9f25d9ece3d0d6cc2710a30" - integrity sha1-FCUFcwpcL+Hp8l2ezj0NbMJxCjA= - -gl-vec2@^1.0.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/gl-vec2/-/gl-vec2-1.3.0.tgz#83d472ed46034de8e09cbc857123fb6c81c51199" - integrity sha512-YiqaAuNsheWmUV0Sa8k94kBB0D6RWjwZztyO+trEYS8KzJ6OQB/4686gdrf59wld4hHFIvaxynO3nRxpk1Ij/A== - -gl-vec3@^1.0.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/gl-vec3/-/gl-vec3-1.1.3.tgz#a47c62f918774a06cbed1b65bcd0288ecbb03826" - integrity sha512-jduKUqT0SGH02l8Yl+mV1yVsDfYgQAJyXGxkJQGyxPLHRiW25DwVIRPt6uvhrEMHftJfqhqKthRcyZqNEl9Xdw== - glob-parent@^5.1.0, glob-parent@~5.1.0: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" @@ -2278,11 +2234,6 @@ ini@^1.3.4: resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== -iota-array@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/iota-array/-/iota-array-1.0.0.tgz#81ef57fe5d05814cd58c2483632a99c30a0e8087" - integrity sha1-ge9X/l0FgUzVjCSDYyqZwwoOgIc= - ipaddr.js@1.9.1: version "1.9.1" resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3" @@ -2320,7 +2271,7 @@ is-boolean-object@^1.0.0: resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.0.1.tgz#10edc0900dd127697a92f6f9807c7617d68ac48e" integrity sha512-TqZuVwa/sppcrhUCAYkGBk7w0yxfQQnxq28fjkO53tnK9FQXmdwz2JS5+GjsWQ6RByES1K40nI+yDic5c9/aAQ== -is-buffer@^1.0.2, is-buffer@^1.1.5, is-buffer@~1.1.6: +is-buffer@^1.1.5, is-buffer@~1.1.6: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== @@ -2535,11 +2486,6 @@ isstream@~0.1.2: resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= -jpeg-js@^0.3.2: - version "0.3.6" - resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.3.6.tgz#c40382aac9506e7d1f2d856eb02f6c7b2a98b37c" - integrity sha512-MUj2XlMB8kpe+8DJUGH/3UJm4XpI8XEgZQ+CiHDeyrGoKPdW/8FJv6ku+3UiYm5Fz3CWaL+iXmD8Q4Ap6aC1Jw== - jquery@3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.6.0.tgz#c72a09f15c1bdce142f49dbf1170bdf8adac2470" @@ -2904,11 +2850,6 @@ micromatch@^4.0.2: braces "^3.0.1" picomatch "^2.0.5" -mime-db@1.40.0: - version "1.40.0" - resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.40.0.tgz#a65057e998db090f732a68f6c276d387d4126c32" - integrity sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA== - mime-db@1.43.0: version "1.43.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.43.0.tgz#0a12e0502650e473d735535050e7c8f4eb4fae58" @@ -2919,13 +2860,6 @@ mime-db@1.44.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.44.0.tgz#fa11c5eb0aca1334b4233cb4d52f10c5a6272f92" integrity sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg== -mime-types@^2.0.1: - version "2.1.24" - resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.24.tgz#b6f8d0b3e951efb77dedeca194cff6d16f676f81" - integrity sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ== - dependencies: - mime-db "1.40.0" - mime-types@^2.1.12, mime-types@~2.1.19: version "2.1.27" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.27.tgz#47949f98e279ea53119f5722e0f34e529bec009f" @@ -3038,27 +2972,6 @@ native-request@^1.0.5: resolved "https://registry.yarnpkg.com/native-request/-/native-request-1.0.8.tgz#8f66bf606e0f7ea27c0e5995eb2f5d03e33ae6fb" integrity sha512-vU2JojJVelUGp6jRcLwToPoWGxSx23z/0iX+I77J3Ht17rf2INGjrhOoQnjVo60nQd8wVsgzKkPfRXBiVdD2ag== -ndarray-linear-interpolate@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/ndarray-linear-interpolate/-/ndarray-linear-interpolate-1.0.0.tgz#78bc92b85b9abc15b6e67ee65828f9e2137ae72b" - integrity sha1-eLySuFuavBW25n7mWCj54hN65ys= - -ndarray-pack@^1.1.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/ndarray-pack/-/ndarray-pack-1.2.1.tgz#8caebeaaa24d5ecf70ff86020637977da8ee585a" - integrity sha1-jK6+qqJNXs9w/4YCBjeXfajuWFo= - dependencies: - cwise-compiler "^1.1.2" - ndarray "^1.0.13" - -ndarray@^1.0.13, ndarray@^1.0.18: - version "1.0.18" - resolved "https://registry.yarnpkg.com/ndarray/-/ndarray-1.0.18.tgz#b60d3a73224ec555d0faa79711e502448fd3f793" - integrity sha1-tg06cyJOxVXQ+qeXEeUCRI/T95M= - dependencies: - iota-array "^1.0.0" - is-buffer "^1.0.2" - needle@^2.5.2: version "2.6.0" resolved "https://registry.yarnpkg.com/needle/-/needle-2.6.0.tgz#24dbb55f2509e2324b4a99d61f413982013ccdbe" @@ -3086,11 +2999,6 @@ node-addon-api@^3.0.0: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-3.1.0.tgz#98b21931557466c6729e51cb77cd39c965f42239" integrity sha512-flmrDNB06LIl5lywUz7YlNGZH/5p0M7W28k8hzd9Lshtdh1wshD2Y+U4h9LD6KObOy1f+fEVdgprPrEymjM5uw== -node-bitmap@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/node-bitmap/-/node-bitmap-0.0.1.tgz#180eac7003e0c707618ef31368f62f84b2a69091" - integrity sha1-GA6scAPgxwdhjvMTaPYvhLKmkJE= - node-gyp-build@^4.2.2: version "4.2.3" resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.2.3.tgz#ce6277f853835f718829efb47db20f3e4d9c4739" @@ -3267,11 +3175,6 @@ object.assign@^4.1.0: has-symbols "^1.0.0" object-keys "^1.0.11" -omggif@^1.0.5: - version "1.0.10" - resolved "https://registry.yarnpkg.com/omggif/-/omggif-1.0.10.tgz#ddaaf90d4a42f532e9e7cb3a95ecdd47f17c7b19" - integrity sha512-LMJTtvgc/nugXj0Vcrrs68Mn2D1r0zf630VNtqtpI1FEO7e+O9FP4gqs9AcnBaSEeoHIPm28u6qgPR0oyEpGSw== - on-finished@~2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.3.0.tgz#20f1336481b083cd75337992a16971aa2d906947" @@ -3353,13 +3256,6 @@ parent-module@^1.0.0: dependencies: callsites "^3.0.0" -parse-data-uri@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/parse-data-uri/-/parse-data-uri-0.2.0.tgz#bf04d851dd5c87b0ab238e5d01ace494b604b4c9" - integrity sha1-vwTYUd1ch7CrI45dAazklLYEtMk= - dependencies: - data-uri-to-buffer "0.0.3" - parse-json@^5.0.0: version "5.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd" @@ -3477,11 +3373,6 @@ plyr@^3.7.2: rangetouch "^2.0.1" url-polyfill "^1.1.12" -pngjs@^3.3.3: - version "3.4.0" - resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-3.4.0.tgz#99ca7d725965fb655814eaf65f38f12bbdbf555f" - integrity sha512-NCrCHhWmnQklfH4MtJMRjZ2a8c80qXeMlQMv2uVp9ISJMTt562SbGd6n2oq0PaPgKm7Z6pL9E2UlLIhC+SHL3w== - popper.js@^1.16.0: version "1.16.1" resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.16.1.tgz#2a223cb3dc7b6213d740e40372be40de43e65b1b" @@ -3998,19 +3889,6 @@ qs@~6.5.2: resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" integrity sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA== -quagga@^0.12.1: - version "0.12.1" - resolved "https://registry.yarnpkg.com/quagga/-/quagga-0.12.1.tgz#6f48c56ed992dc5fdeb90dbee7069c2e1cdde8b7" - integrity sha1-b0jFbtmS3F/euQ2+5wacLhzd6Lc= - dependencies: - get-pixels "^3.2.3" - gl-mat2 "^1.0.0" - gl-vec2 "^1.0.0" - gl-vec3 "^1.0.3" - lodash "^4.17.4" - ndarray "^1.0.18" - ndarray-linear-interpolate "^1.0.0" - queue-microtask@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" @@ -4237,7 +4115,7 @@ repeat-string@^1.5.2: resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= -request@^2.44.0, request@^2.88.0, request@^2.88.2: +request@^2.88.0, request@^2.88.2: version "2.88.2" resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== @@ -4942,11 +4820,6 @@ tar@^6.0.2: mkdirp "^1.0.3" yallist "^4.0.0" -through@^2.3.4: - version "2.3.8" - resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" - integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= - timsort@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/timsort/-/timsort-0.3.0.tgz#405411a8e7e6339fe64db9a234de11dc31e02bd4" @@ -5075,7 +4948,7 @@ uglify-to-browserify@~1.0.0: resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" integrity sha1-bgkk1r2mta/jSeOabWMoUKD4grc= -uniq@^1.0.0, uniq@^1.0.1: +uniq@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" integrity sha1-sxxa6CVIRKOoKBVBzisEuGWnNP8= From 4811c51ecc4795f3aeba1597cf7a64de7a465f91 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Jun 2022 18:40:31 +0000 Subject: [PATCH 2/9] build(deps): bump pre-commit/action from 2.0.3 to 3.0.0 Bumps [pre-commit/action](https://github.com/pre-commit/action) from 2.0.3 to 3.0.0. - [Release notes](https://github.com/pre-commit/action/releases) - [Commits](https://github.com/pre-commit/action/compare/v2.0.3...v3.0.0) --- updated-dependencies: - dependency-name: pre-commit/action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/linters.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 7a17648ff0..ce7ffb7de7 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -17,7 +17,7 @@ jobs: python-version: 3.8 - name: Install and Run Pre-commit - uses: pre-commit/action@v2.0.3 + uses: pre-commit/action@v3.0.0 - name: Download Semgrep rules run: git clone --depth 1 https://github.com/frappe/semgrep-rules.git frappe-semgrep-rules From e12d37a9433c9370e15273b5b2ff843e17eb5dbe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Jun 2022 18:40:35 +0000 Subject: [PATCH 3/9] build(deps): bump actions/checkout from 2 to 3 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/docs-checker.yml | 2 +- .github/workflows/linters.yml | 2 +- .github/workflows/patch-mariadb-tests.yml | 2 +- .github/workflows/publish-assets-develop.yml | 2 +- .github/workflows/publish-assets-releases.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/server-mariadb-tests.yml | 2 +- .github/workflows/server-postgres-tests.yml | 2 +- .github/workflows/ui-tests.yml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docs-checker.yml b/.github/workflows/docs-checker.yml index 80b2469c0c..dade810b64 100644 --- a/.github/workflows/docs-checker.yml +++ b/.github/workflows/docs-checker.yml @@ -18,7 +18,7 @@ jobs: python-version: 3.8 - name: 'Clone repo' - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Validate Docs env: diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 7a17648ff0..477195b53a 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -9,7 +9,7 @@ jobs: name: Frappe Linter runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python 3.8 uses: actions/setup-python@v4 diff --git a/.github/workflows/patch-mariadb-tests.yml b/.github/workflows/patch-mariadb-tests.yml index ae5802a8e1..60d0ce60af 100644 --- a/.github/workflows/patch-mariadb-tests.yml +++ b/.github/workflows/patch-mariadb-tests.yml @@ -28,7 +28,7 @@ jobs: steps: - name: Clone - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python uses: actions/setup-python@v4 diff --git a/.github/workflows/publish-assets-develop.yml b/.github/workflows/publish-assets-develop.yml index 6cd3af78f2..037c8c26eb 100644 --- a/.github/workflows/publish-assets-develop.yml +++ b/.github/workflows/publish-assets-develop.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: path: 'frappe' - uses: actions/setup-node@v3 diff --git a/.github/workflows/publish-assets-releases.yml b/.github/workflows/publish-assets-releases.yml index f242a363b4..594229a156 100644 --- a/.github/workflows/publish-assets-releases.yml +++ b/.github/workflows/publish-assets-releases.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: path: 'frappe' - uses: actions/setup-node@v3 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 32c5d53831..f73bed09c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Entire Repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 persist-credentials: false diff --git a/.github/workflows/server-mariadb-tests.yml b/.github/workflows/server-mariadb-tests.yml index f7f3aae8d0..51d379d5db 100644 --- a/.github/workflows/server-mariadb-tests.yml +++ b/.github/workflows/server-mariadb-tests.yml @@ -37,7 +37,7 @@ jobs: steps: - name: Clone - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python uses: actions/setup-python@v4 diff --git a/.github/workflows/server-postgres-tests.yml b/.github/workflows/server-postgres-tests.yml index 5116d4198e..d93edad0ec 100644 --- a/.github/workflows/server-postgres-tests.yml +++ b/.github/workflows/server-postgres-tests.yml @@ -40,7 +40,7 @@ jobs: steps: - name: Clone - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python uses: actions/setup-python@v4 diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 72fe3e67bb..09b2a3caf8 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -36,7 +36,7 @@ jobs: steps: - name: Clone - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Python uses: actions/setup-python@v4 From d7fe7ae39cae03c1c073897f92c92d5f33e1b95a Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Tue, 21 Jun 2022 07:02:58 +0530 Subject: [PATCH 4/9] perf(UX): Load splash screen immediately after login --- frappe/templates/includes/login/login.js | 1 + frappe/templates/includes/splash_screen.html | 4 ++++ frappe/www/app.html | 5 +---- 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 frappe/templates/includes/splash_screen.html diff --git a/frappe/templates/includes/login/login.js b/frappe/templates/includes/login/login.js index 3af48b4b53..8365947e6c 100644 --- a/frappe/templates/includes/login/login.js +++ b/frappe/templates/includes/login/login.js @@ -195,6 +195,7 @@ login.login_handlers = (function () { 200: function (data) { if (data.message == 'Logged In') { login.set_status('{{ _("Success") }}', 'green'); + document.body.innerHTML = `{% include "templates/includes/splash_screen.html" %}`; window.location.href = frappe.utils.sanitise_redirect(frappe.utils.get_url_arg("redirect-to")) || data.home_page; } else if (data.message == 'Password Reset') { window.location.href = frappe.utils.sanitise_redirect(data.redirect_to); diff --git a/frappe/templates/includes/splash_screen.html b/frappe/templates/includes/splash_screen.html new file mode 100644 index 0000000000..0cbd118dcd --- /dev/null +++ b/frappe/templates/includes/splash_screen.html @@ -0,0 +1,4 @@ +
+ +
\ No newline at end of file diff --git a/frappe/www/app.html b/frappe/www/app.html index 4402dbb481..f4de074d32 100644 --- a/frappe/www/app.html +++ b/frappe/www/app.html @@ -26,10 +26,7 @@ {% include "public/icons/timeless/symbol-defs.svg" %} -
- -
+ {% include "templates/includes/splash_screen.html" %}
From d6f2d34bf4b9e214c8dff273ba05302766ff9a10 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Sat, 18 Jun 2022 22:20:49 +0530 Subject: [PATCH 5/9] perf: send boot string instead of JSON literal changes: - compact boot info in /app HTML /app size went from 451kb to 393kb - ~13% less Verified that regex applied on this JSON aren't affecting perf, infact found them to be faster with compact JSON. - Send json string instead of placing JSON literal in code using Jinja. JS takes more time to pass object literal than parsing a plain JSON string. Overall content transfer size remains roughly same (albeit slightly lower) since double escaping ends up adding extra `\` around quotes. Co-authored-by: Suraj Shetty --- frappe/www/app.html | 2 +- frappe/www/app.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frappe/www/app.html b/frappe/www/app.html index f4de074d32..9189570674 100644 --- a/frappe/www/app.html +++ b/frappe/www/app.html @@ -42,7 +42,7 @@ if (!window.frappe) window.frappe = {}; - frappe.boot = {{ boot }}; + frappe.boot = JSON.parse({{ boot }}); frappe._messages = frappe.boot["__messages"]; frappe.csrf_token = "{{ csrf_token }}"; diff --git a/frappe/www/app.py b/frappe/www/app.py index 9a8c80d6b1..0447d00f89 100644 --- a/frappe/www/app.py +++ b/frappe/www/app.py @@ -2,6 +2,7 @@ # License: MIT. See LICENSE no_cache = 1 +import json import os import re @@ -32,13 +33,14 @@ def get_context(context): frappe.db.commit() - boot_json = frappe.as_json(boot) + boot_json = frappe.as_json(boot, indent=None, separators=(",", ":")) # remove script tags from boot boot_json = SCRIPT_TAG_PATTERN.sub("", boot_json) # TODO: Find better fix boot_json = CLOSING_SCRIPT_TAG_PATTERN.sub("", boot_json) + boot_json = json.dumps(boot_json) context.update( { From 64cc07227eaac493865a851bde90ca5ca0480b7d Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Mon, 20 Jun 2022 07:53:41 +0530 Subject: [PATCH 6/9] refactor: Replace usage of deprecated attribute --- .../print_format_builder_column_selector.html | 2 +- .../print_format_builder_field.html | 6 +++--- .../print_format_builder_layout.html | 4 ++-- .../print_format_builder_section.html | 4 ++-- .../print_format_builder_sidebar.html | 2 +- frappe/public/icons/social/fair.svg | 4 ++-- frappe/public/icons/social/office_365.svg | 4 ++-- frappe/public/images/leaflet/spritesheet.svg | 4 ++-- frappe/public/js/frappe/file_uploader/FileUploader.vue | 2 +- .../public/js/frappe/form/templates/print_layout.html | 2 +- .../js/frappe/form/templates/timeline_message_box.html | 2 +- frappe/public/js/frappe/list/list_sidebar.html | 4 ++-- frappe/public/js/frappe/ui/group_by/group_by.html | 2 +- frappe/public/js/frappe/ui/page.html | 10 +++++----- frappe/public/js/frappe/ui/sort_selector.html | 2 +- frappe/public/js/frappe/ui/toolbar/navbar.html | 2 +- .../public/js/frappe/views/kanban/kanban_column.html | 2 +- frappe/public/js/frappe/widgets/chart_widget.js | 2 +- .../js/print_format_builder/ConfigureColumns.vue | 4 ++-- frappe/public/js/print_format_builder/Field.vue | 4 ++-- .../js/print_format_builder/PrintFormatSection.vue | 2 +- frappe/templates/discussions/reply_card.html | 2 +- .../section_with_cta/section_with_cta.html | 2 +- .../section_with_small_cta/section_with_small_cta.html | 2 +- frappe/www/me.html | 8 ++++---- 25 files changed, 42 insertions(+), 42 deletions(-) diff --git a/frappe/printing/page/print_format_builder/print_format_builder_column_selector.html b/frappe/printing/page/print_format_builder/print_format_builder_column_selector.html index 15d029704b..5292531e4c 100644 --- a/frappe/printing/page/print_format_builder/print_format_builder_column_selector.html +++ b/frappe/printing/page/print_format_builder/print_format_builder_column_selector.html @@ -13,7 +13,7 @@
- +
@@ -23,7 +23,7 @@
diff --git a/frappe/printing/page/print_format_builder/print_format_builder_section.html b/frappe/printing/page/print_format_builder/print_format_builder_section.html index 70a97a15f0..108e5ff01c 100644 --- a/frappe/printing/page/print_format_builder/print_format_builder_section.html +++ b/frappe/printing/page/print_format_builder/print_format_builder_section.html @@ -1,10 +1,10 @@ diff --git a/frappe/public/icons/social/fair.svg b/frappe/public/icons/social/fair.svg index 4cfc77a71f..60c00dc7af 100644 --- a/frappe/public/icons/social/fair.svg +++ b/frappe/public/icons/social/fair.svg @@ -4,11 +4,11 @@ - + - + diff --git a/frappe/public/icons/social/office_365.svg b/frappe/public/icons/social/office_365.svg index d93167741d..77c3559408 100644 --- a/frappe/public/icons/social/office_365.svg +++ b/frappe/public/icons/social/office_365.svg @@ -35,11 +35,11 @@ - + - + diff --git a/frappe/public/images/leaflet/spritesheet.svg b/frappe/public/images/leaflet/spritesheet.svg index 3c00f30314..05feda62df 100644 --- a/frappe/public/images/leaflet/spritesheet.svg +++ b/frappe/public/images/leaflet/spritesheet.svg @@ -134,14 +134,14 @@ transform="translate(120,0)" style="fill:#bbbbbb"> diff --git a/frappe/public/js/frappe/form/templates/print_layout.html b/frappe/public/js/frappe/form/templates/print_layout.html index 366a771218..f65eb86bd4 100644 --- a/frappe/public/js/frappe/form/templates/print_layout.html +++ b/frappe/public/js/frappe/form/templates/print_layout.html @@ -25,7 +25,7 @@ {%= __("Settings") %} - + diff --git a/frappe/public/js/frappe/form/templates/timeline_message_box.html b/frappe/public/js/frappe/form/templates/timeline_message_box.html index a38e36c7b5..ad7ddc37e5 100644 --- a/frappe/public/js/frappe/form/templates/timeline_message_box.html +++ b/frappe/public/js/frappe/form/templates/timeline_message_box.html @@ -68,7 +68,7 @@
@@ -41,7 +41,7 @@ - + @@ -55,7 +55,7 @@ diff --git a/frappe/public/js/frappe/ui/sort_selector.html b/frappe/public/js/frappe/ui/sort_selector.html index 81288f305e..6f79f986a1 100644 --- a/frappe/public/js/frappe/ui/sort_selector.html +++ b/frappe/public/js/frappe/ui/sort_selector.html @@ -5,7 +5,7 @@ title="{{ sort_order==="desc" ? "descending" : "ascending" }}"> - + diff --git a/frappe/public/js/frappe/ui/toolbar/navbar.html b/frappe/public/js/frappe/ui/toolbar/navbar.html index 73767d2019..3276ca302a 100644 --- a/frappe/public/js/frappe/ui/toolbar/navbar.html +++ b/frappe/public/js/frappe/ui/toolbar/navbar.html @@ -15,7 +15,7 @@ aria-haspopup="true" > - +
diff --git a/frappe/public/js/frappe/views/kanban/kanban_column.html b/frappe/public/js/frappe/views/kanban/kanban_column.html index f2b537aca4..9c9f1eede0 100644 --- a/frappe/public/js/frappe/views/kanban/kanban_column.html +++ b/frappe/public/js/frappe/views/kanban/kanban_column.html @@ -7,7 +7,7 @@