2018-11-18 19:44:50 +00:00
|
|
|
import { BLOCKED_PAGES } from 'next-server/constants'
|
|
|
|
|
2018-10-01 22:55:31 +00:00
|
|
|
const internalPrefixes = [
|
|
|
|
/^\/_next\//,
|
2018-12-31 13:44:27 +00:00
|
|
|
/^\/static\//,
|
2018-10-01 22:55:31 +00:00
|
|
|
]
|
|
|
|
|
2018-12-31 13:44:27 +00:00
|
|
|
export function isInternalUrl(url: string): boolean {
|
2018-10-01 22:55:31 +00:00
|
|
|
for (const prefix of internalPrefixes) {
|
|
|
|
if (prefix.test(url)) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
|
|
|
}
|
2018-11-18 19:44:50 +00:00
|
|
|
|
2018-12-31 13:44:27 +00:00
|
|
|
export function isBlockedPage(pathname: string): boolean {
|
2018-11-18 19:44:50 +00:00
|
|
|
return (BLOCKED_PAGES.indexOf(pathname) !== -1)
|
|
|
|
}
|