From ca97a2af623b41f62a017e2e77f46527209831b8 Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Fri, 29 Apr 2022 15:22:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20b64u=20=E7=9A=84=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=EF=BC=8C=E7=94=A8=20.=20=E4=BB=A3=E6=9B=BF=20-?= =?UTF-8?q?=EF=BC=8C=E5=9B=A0=E4=B8=BA=20-=20=E5=92=8C=E7=A9=BA=E6=A0=BC?= =?UTF-8?q?=E4=B8=80=E6=A0=B7=E5=AF=BC=E8=87=B4=20css=20white-space=20?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=8D=A2=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ucColorText/ucColorText.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ucColorText/ucColorText.vue b/ucColorText/ucColorText.vue index 442a765..d4905d1 100644 --- a/ucColorText/ucColorText.vue +++ b/ucColorText/ucColorText.vue @@ -52,14 +52,14 @@ export default { } return [] }, - address2colorB64u(address){ // TIC address should be in b64u format, i.e. base64 for url (+ to -, / to _) - if (/^[0-9a-zA-Z\-_]+$/.test(address)){ + address2colorB64u(address){ // TIC address should be in b64u format, i.e. base64 for url (+ to ., / to _) + if (/^[0-9a-zA-Z\._]+$/.test(address)){ // TIC地址被精心设计为24字节,32个b64字符,不需要填充 // let len=address.length // let rest = len % 4 // let fullLength = len + (4-(rest?rest:4)) // address = address.padEnd(fullLength, 'A') // 在 b64 里,'00'字节是A. - let colorArray = address.match(/[0-9A-Za-z\-_]{4}/g) + let colorArray = address.match(/[0-9A-Za-z\._]{4}/g) switch(this.block){ case "2": colorArray.splice(1, colorArray.length-2) case "4": colorArray.splice(2, colorArray.length-4) @@ -72,8 +72,8 @@ export default { return [] }, b64u2hex(b64u){ - if (/^[0-9a-zA-Z\-_]+$/.test(b64u)){ - let b64 = b64u.replace(/\-/g, '+').replace(/_/g, '/') + if (/^[0-9a-zA-Z\._]+$/.test(b64u)){ + let b64 = b64u.replace(/\./g, '+').replace(/_/g, '/') return Buffer.from(b64, 'base64').toString('hex') } return null