|
|
@ -21,9 +21,13 @@ const MAX_PAYLOAD_SIZE = 5e6 // bytes
|
|
|
|
function verifyPayloadSize(str) {
|
|
|
|
function verifyPayloadSize(str) {
|
|
|
|
if (typeof str !== 'string') return true
|
|
|
|
if (typeof str !== 'string') return true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (typeof window !== 'undefined') {
|
|
|
|
return new Blob([str]).size < MAX_PAYLOAD_SIZE
|
|
|
|
return new Blob([str]).size < MAX_PAYLOAD_SIZE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Buffer.byteLength(str, 'utf8')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const CopyEmbed = withRouter(({ router: { asPath }, mapper, title, margin }) => {
|
|
|
|
const CopyEmbed = withRouter(({ router: { asPath }, mapper, title, margin }) => {
|
|
|
|
const text = React.useMemo(() => mapper(asPath), [mapper, asPath])
|
|
|
|
const text = React.useMemo(() => mapper(asPath), [mapper, asPath])
|
|
|
|
const { onClick, copied } = useCopyTextHandler(text)
|
|
|
|
const { onClick, copied } = useCopyTextHandler(text)
|
|
|
|