8 lines
218 B
TypeScript
8 lines
218 B
TypeScript
const PREFIX_INDEX = 1
|
|
const getIPFSPrefix = () => {
|
|
const ipfsPathRegExp = /^(\/(?:ipfs|ipns)\/[^/]+)/
|
|
return (window.location.pathname.match(ipfsPathRegExp) ?? [])[PREFIX_INDEX] || ''
|
|
}
|
|
|
|
export { getIPFSPrefix }
|