From 67e007c2890cef50935ce128687c0dbf668edff6 Mon Sep 17 00:00:00 2001 From: Danilo Bargen Date: Tue, 19 Jan 2021 15:14:55 +0100 Subject: [PATCH] Vendor angular-qrcode library --- .licenses/qrcode-generator | 12 + LICENSE-3RD-PARTY.txt | 20 ++ dist/package.sh | 1 - gather-licenses.sh | 3 +- index.html | 2 +- package-lock.json | 15 +- package.json | 2 +- public/libs/angular-qrcode/LICENCE.txt | 21 ++ public/libs/angular-qrcode/README.md | 3 + public/libs/angular-qrcode/angular-qrcode.js | 233 +++++++++++++++++++ public/libs/angular-qrcode/bower.json | 15 ++ public/libs/angular-qrcode/index.html | 161 +++++++++++++ public/libs/angular-qrcode/package.json | 31 +++ 13 files changed, 503 insertions(+), 16 deletions(-) create mode 100644 .licenses/qrcode-generator create mode 100644 public/libs/angular-qrcode/LICENCE.txt create mode 100644 public/libs/angular-qrcode/README.md create mode 100644 public/libs/angular-qrcode/angular-qrcode.js create mode 100644 public/libs/angular-qrcode/bower.json create mode 100644 public/libs/angular-qrcode/index.html create mode 100644 public/libs/angular-qrcode/package.json diff --git a/.licenses/qrcode-generator b/.licenses/qrcode-generator new file mode 100644 index 000000000..17b6e958f --- /dev/null +++ b/.licenses/qrcode-generator @@ -0,0 +1,12 @@ +QR Code Generator for JavaScript - TypeScript Declaration File + +Copyright (c) 2016 Kazuhiko Arase + +URL: http://www.d-project.com/ + +Licensed under the MIT license: + http://www.opensource.org/licenses/mit-license.php + +The word 'QR Code' is registered trademark of +DENSO WAVE INCORPORATED + http://www.denso-wave.com/qrcode/faqpatent-e.html diff --git a/LICENSE-3RD-PARTY.txt b/LICENSE-3RD-PARTY.txt index 881cab0f2..4f83a21bd 100644 --- a/LICENSE-3RD-PARTY.txt +++ b/LICENSE-3RD-PARTY.txt @@ -550,6 +550,26 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +---------- +License for qrcode-generator +---------- + +QR Code Generator for JavaScript - TypeScript Declaration File + +Copyright (c) 2016 Kazuhiko Arase + +URL: http://www.d-project.com/ + +Licensed under the MIT license: + http://www.opensource.org/licenses/mit-license.php + +The word 'QR Code' is registered trademark of +DENSO WAVE INCORPORATED + http://www.denso-wave.com/qrcode/faqpatent-e.html + + + + ---------- License for saltyrtc-client ---------- diff --git a/dist/package.sh b/dist/package.sh index 2d8b21453..607186b35 100755 --- a/dist/package.sh +++ b/dist/package.sh @@ -73,7 +73,6 @@ targets=( webrtc-adapter/out/adapter.js qrcode-generator/qrcode.js qrcode-generator/qrcode_UTF8.js - angular-qrcode/angular-qrcode.js angularjs-scroll-glue/src/scrollglue.js angular-material/angular-material.min.js angular-material/angular-material.min.css diff --git a/gather-licenses.sh b/gather-licenses.sh index 4cc7a66fe..da2190e87 100644 --- a/gather-licenses.sh +++ b/gather-licenses.sh @@ -9,7 +9,7 @@ LICENSE_FILES=( 'angular-inview' 'public/libs/angular-inview/LICENSE' 'angular-material' 'node_modules/angular-material/LICENSE' 'angular-messages' 'node_modules/angular-messages/LICENSE.md' - 'angular-qrcode' 'node_modules/angular-qrcode/LICENCE.txt' + 'angular-qrcode' 'public/libs/angular-qrcode/LICENCE.txt' 'angular-route' 'node_modules/angular-route/LICENSE.md' 'angular-sanitize' 'node_modules/angular-sanitize/LICENSE.md' 'angular-translate' 'node_modules/angular-translate/LICENSE' @@ -23,6 +23,7 @@ LICENSE_FILES=( 'messageformat' 'node_modules/messageformat/LICENSE' 'msgpack-lite' 'node_modules/msgpack-lite/LICENSE' 'node-sass' 'node_modules/node-sass/LICENSE' + 'qrcode-generator' '.licenses/qrcode-generator' 'saltyrtc-client' 'node_modules/@saltyrtc/client/LICENSE.md' 'saltyrtc-task-relayed-data' 'node_modules/@saltyrtc/task-relayed-data/LICENSE.md' 'saltyrtc-task-webrtc' 'node_modules/@saltyrtc/task-webrtc/LICENSE.md' diff --git a/index.html b/index.html index 953ca8353..87c02916e 100644 --- a/index.html +++ b/index.html @@ -143,7 +143,7 @@

- + diff --git a/package-lock.json b/package-lock.json index 3b029bd08..2f160c378 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1617,15 +1617,6 @@ "integrity": "sha512-I5L3P0l21HPdVsP4A4qWmENt4ePjjbkDFdAzOaM7QiibFySbt14DptPbt2IjeG4vFBr4vSLbhIz8Fk03DISl8Q==", "dev": true }, - "angular-qrcode": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/angular-qrcode/-/angular-qrcode-7.2.0.tgz", - "integrity": "sha1-xueeGwbGcqWaBrZbSrRl3SnmP8Y=", - "requires": { - "angular": ">=1.0.6", - "qrcode-generator": "^1.1.0" - } - }, "angular-route": { "version": "1.8.2", "resolved": "https://registry.npmjs.org/angular-route/-/angular-route-1.8.2.tgz", @@ -7488,9 +7479,9 @@ "dev": true }, "qrcode-generator": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/qrcode-generator/-/qrcode-generator-1.4.0.tgz", - "integrity": "sha512-sjjYaKTviJVps3xlnaDBx4xGEqVL0f6bRCd0Q2pPwCUzbrMZ5dXYOJAT7DqXGqXpb1p+vPV3nc122fAsAj6wug==" + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/qrcode-generator/-/qrcode-generator-1.4.4.tgz", + "integrity": "sha512-HM7yY8O2ilqhmULxGMpcHSF1EhJJ9yBj8gvDEuZ6M+KGJ0YY2hKpnXvRD+hZPLrDVck3ExIGhmPtSdcjC+guuw==" }, "qs": { "version": "6.5.2", diff --git a/package.json b/package.json index 726a028fe..5a95ca2d9 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,6 @@ "angular-aria": "^1.8.2", "angular-material": "=1.1.11", "angular-messages": "^1.8.2", - "angular-qrcode": "~7.2", "angular-route": "^1.8.2", "angular-sanitize": "^1.8.2", "angular-translate": "~2.18.2", @@ -72,6 +71,7 @@ "messageformat": "^2.3.0", "msgpack-lite": "~0.1.26", "node-sass": "^5.0.0", + "qrcode-generator": "^1.4.4", "sdp": "~2.12.0", "ts-events": "~3.4.0", "ts-loader": "~6.2.1", diff --git a/public/libs/angular-qrcode/LICENCE.txt b/public/libs/angular-qrcode/LICENCE.txt new file mode 100644 index 000000000..a9b18529a --- /dev/null +++ b/public/libs/angular-qrcode/LICENCE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017 Monospaced + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/public/libs/angular-qrcode/README.md b/public/libs/angular-qrcode/README.md new file mode 100644 index 000000000..d32217516 --- /dev/null +++ b/public/libs/angular-qrcode/README.md @@ -0,0 +1,3 @@ +angular-qrcode library with changes from pull request 10 applied (commit 84dcf083b12d0a71759091ea849ae982f389848a) + +https://github.com/monospaced/angular-qrcode/pull/10 diff --git a/public/libs/angular-qrcode/angular-qrcode.js b/public/libs/angular-qrcode/angular-qrcode.js new file mode 100644 index 000000000..df667003d --- /dev/null +++ b/public/libs/angular-qrcode/angular-qrcode.js @@ -0,0 +1,233 @@ +/* + * angular-qrcode + * (c) 2017 Monospaced http://monospaced.com + * License: MIT + */ + +if (typeof module !== 'undefined' && + typeof exports !== 'undefined' && + module.exports === exports){ + module.exports = 'monospaced.qrcode'; +} + +angular.module('monospaced.qrcode', []) + .directive('qrcode', ['$window', function($window) { + + var canvas2D = !!$window.CanvasRenderingContext2D, + levels = { + 'L': 'Low', + 'M': 'Medium', + 'Q': 'Quartile', + 'H': 'High' + }, + draw = function(context, qr, modules, tile, color) { + for (var row = 0; row < modules; row++) { + for (var col = 0; col < modules; col++) { + var w = (Math.ceil((col + 1) * tile) - Math.floor(col * tile)), + h = (Math.ceil((row + 1) * tile) - Math.floor(row * tile)); + + context.fillStyle = qr.isDark(row, col) ? color.foreground : color.background; + context.fillRect(Math.round(col * tile), + Math.round(row * tile), w, h); + } + } + }; + + return { + restrict: 'E', + template: '', + link: function(scope, element, attrs) { + var domElement = element[0], + $canvas = element.find('canvas'), + canvas = $canvas[0], + context = canvas2D ? canvas.getContext('2d') : null, + download = 'download' in attrs, + href = attrs.href, + link = download || href ? document.createElement('a') : '', + trim = /^\s+|\s+$/g, + error, + version, + errorCorrectionLevel, + data, + size, + modules, + tile, + qr, + $img, + color = { + foreground: '#000', + background: '#fff' + }, + setColor = function(value) { + color.foreground = value || color.foreground; + }, + setBackground = function(value) { + color.background = value || color.background; + }, + setVersion = function(value) { + version = Math.max(1, Math.min(parseInt(value, 10), 40)) || 5; + }, + setErrorCorrectionLevel = function(value) { + errorCorrectionLevel = value in levels ? value : 'M'; + }, + setData = function(value) { + if (!value) { + return; + } + + data = value.replace(trim, ''); + qr = qrcode(version, errorCorrectionLevel); + qr.addData(data); + + try { + qr.make(); + } catch (e) { + var newVersion; + if (version >= 40) { + throw new Error('Data is too long', e); + } + newVersion = version + 1; + setVersion(newVersion); + console.warn('qrcode version is too low and has been incremented to', newVersion) + setData(value); + return; + } + + error = false; + modules = qr.getModuleCount(); + }, + setSize = function(value) { + size = parseInt(value, 10) || modules * 2; + tile = size / modules; + canvas.width = canvas.height = size; + }, + render = function() { + if (!qr) { + return; + } + + if (error) { + if (link) { + link.removeAttribute('download'); + link.title = ''; + link.href = '#_'; + } + if (!canvas2D) { + domElement.innerHTML = ''; + } + scope.$emit('qrcode:error', error); + return; + } + + if (download) { + domElement.download = 'qrcode.png'; + domElement.title = 'Download QR code'; + } + + if (canvas2D) { + draw(context, qr, modules, tile, color); + + if (download) { + domElement.href = canvas.toDataURL('image/png'); + return; + } + } else { + domElement.innerHTML = qr.createImgTag(tile, 0); + $img = element.find('img'); + $img.addClass('qrcode'); + + if (download) { + domElement.href = $img[0].src; + return; + } + } + + if (href) { + domElement.href = href; + } + }; + + if (link) { + link.className = 'qrcode-link'; + $canvas.wrap(link); + domElement = domElement.firstChild; + } + + setColor(attrs.color); + setBackground(attrs.background); + setVersion(attrs.version); + setErrorCorrectionLevel(attrs.errorCorrectionLevel); + setSize(attrs.size); + + attrs.$observe('version', function(value) { + if (!value) { + return; + } + + setVersion(value); + setData(data); + setSize(size); + render(); + }); + + attrs.$observe('errorCorrectionLevel', function(value) { + if (!value) { + return; + } + + setErrorCorrectionLevel(value); + setData(data); + setSize(size); + render(); + }); + + attrs.$observe('data', function(value) { + if (!value) { + return; + } + + setData(value); + setSize(size); + render(); + }); + + attrs.$observe('size', function(value) { + if (!value) { + return; + } + + setSize(value); + render(); + }); + + attrs.$observe('color', function(value) { + if (!value) { + return; + } + + setColor(value); + render(); + }); + + attrs.$observe('background', function(value) { + if (!value) { + return; + } + + setBackground(value); + render(); + }); + + attrs.$observe('href', function(value) { + if (!value) { + return; + } + + href = value; + render(); + }); + } + }; + }]); diff --git a/public/libs/angular-qrcode/bower.json b/public/libs/angular-qrcode/bower.json new file mode 100644 index 000000000..cfeaa1699 --- /dev/null +++ b/public/libs/angular-qrcode/bower.json @@ -0,0 +1,15 @@ +{ + "name": "angular-qrcode", + "version": "7.2.0", + "main": "angular-qrcode.js", + "license" : "MIT", + "ignore": [ + "**/.*", + "node_modules", + "components" + ], + "dependencies": { + "angular": ">=1.0.6", + "qrcode-generator": "git://github.com/monospaced/bower-qrcode-generator.git#v0.2.0" + } +} diff --git a/public/libs/angular-qrcode/index.html b/public/libs/angular-qrcode/index.html new file mode 100644 index 000000000..49b1b999f --- /dev/null +++ b/public/libs/angular-qrcode/index.html @@ -0,0 +1,161 @@ + + + + + Angular QR Code + + + + + + + +

Angular QR Code

+ +
<qrcode></qrcode>
+ + + +
+

+ + +

+

+ + +

+

+ + +

+
+ +

Downloadable

+ + + +

Linked

+ + + +
+

+ + +

+
+ + + + + + + + diff --git a/public/libs/angular-qrcode/package.json b/public/libs/angular-qrcode/package.json new file mode 100644 index 000000000..a7941be44 --- /dev/null +++ b/public/libs/angular-qrcode/package.json @@ -0,0 +1,31 @@ +{ + "name": "angular-qrcode", + "version": "7.2.0", + "description": "QR Code elements for AngularJS.", + "keywords": [ + "angular", + "angularjs", + "qrcode" + ], + "homepage": "http://monospaced.github.io/angular-qrcode/", + "main": "angular-qrcode.js", + "bugs": "http://github.com/monospaced/angular-qrcode/issues", + "license": "MIT", + "repository": { + "type": "git", + "url": "http://github.com/monospaced/angular-qrcode" + }, + "author": { + "name": "Scott Boyle", + "email": "scott@monospaced.com", + "url": "https://scottboyle.co.uk" + }, + "files": [ + "angular-qrcode.js", + "package.json" + ], + "dependencies": { + "angular": ">=1.0.6", + "qrcode-generator": "^1.1.0" + } +}