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