Initial commit
This commit is contained in:
commit
a589741ec6
33 changed files with 4388 additions and 0 deletions
11
src/util/isLocalhost.js
Normal file
11
src/util/isLocalhost.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
const isLocalhost = Boolean(
|
||||
window.location.hostname === 'localhost' ||
|
||||
// [::1] is the IPv6 localhost address.
|
||||
window.location.hostname === '[::1]' ||
|
||||
// 127.0.0.0/8 are considered localhost for IPv4.
|
||||
window.location.hostname.match(
|
||||
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
|
||||
)
|
||||
);
|
||||
|
||||
export default isLocalhost;
|
||||
Loading…
Add table
Add a link
Reference in a new issue