@plattar/plattar-qrcode
Advanced tools
Comparing version 1.148.2 to 1.150.1
@@ -235,3 +235,3 @@ const QRCodeStyling = require("qr-code-styling"); | ||
_IsFetchAPISupported() { | ||
return 'fetch' in window; | ||
return "fetch" in window; | ||
} | ||
@@ -246,6 +246,19 @@ | ||
try { | ||
const b64 = btoa(url); | ||
const endpoint = "https://c2.plattar.space/api/v2/shorten?base64=" + b64; | ||
const b64Link = new Buffer(url).toString("base64"); | ||
fetch(endpoint).then((response) => { | ||
fetch("https://c.plattar.com/shorten", { | ||
cache: "no-store", | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
body: JSON.stringify({ | ||
data: { | ||
attributes: { | ||
url: b64Link, | ||
isBase64: true | ||
} | ||
} | ||
}) | ||
}).then((response) => { | ||
if (!response.ok) { | ||
@@ -255,5 +268,5 @@ throw new Error("PlattarQR._ShortenURL() - response was invalid"); | ||
return response.text(); | ||
}).then((text) => { | ||
return accept(text); | ||
return response.json(); | ||
}).then((json) => { | ||
return accept(json.data.attributes.url); | ||
}).catch(() => { | ||
@@ -260,0 +273,0 @@ return reject(new Error("PlattarQR._ShortenURL() - there was an unexpected issue generating short url")); |
{ | ||
"name": "@plattar/plattar-qrcode", | ||
"version": "1.148.2", | ||
"version": "1.150.1", | ||
"description": "Allows embedding Plattar-Style QR Codes for existing websites.", | ||
@@ -47,4 +47,4 @@ "main": "index.js", | ||
"@babel/cli": "^7.21.0", | ||
"@babel/core": "^7.21.3", | ||
"@babel/preset-env": "^7.20.2", | ||
"@babel/core": "^7.21.4", | ||
"@babel/preset-env": "^7.21.4", | ||
"browserify": "^17.0.0", | ||
@@ -51,0 +51,0 @@ "uglify-es": "^3.3.9" |
@@ -1,1 +0,1 @@ | ||
module.exports = "1.148.2"; | ||
module.exports = "1.150.1"; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
716294
7799
2