File tree Expand file tree Collapse file tree 5 files changed +26532
-6
lines changed
Expand file tree Collapse file tree 5 files changed +26532
-6
lines changed Original file line number Diff line number Diff line change 2727 ],
2828 "dependencies" : {
2929 "@microlink/hover-react" : " ^5.5.22" ,
30- "localhost-url-regex " : " ~1 .0.4 "
30+ "is-local-address " : " ~2 .0.0 "
3131 },
3232 "devDependencies" : {
3333 "@rollup/plugin-commonjs" : " latest" ,
Original file line number Diff line number Diff line change 11import MicrolinkHover from '@microlink/hover-react'
2- import localhostUrl from 'localhost-url-regex '
2+ import isLocalAddress from 'is-local-address '
33import { createRoot } from 'react-dom'
44import styled from 'styled-components'
55import React from 'react'
@@ -16,7 +16,10 @@ function toArray (input) {
1616 el . href = new URL ( el . href ) . toString ( )
1717 return el
1818 } )
19- . filter ( el => el . href . startsWith ( 'http' ) && ! localhostUrl ( ) . test ( el . href ) )
19+ . filter ( el => {
20+ const { protocol, hostname } = new URL ( el . href )
21+ return protocol === 'http:' && ! isLocalAddress ( hostname )
22+ } )
2023}
2124
2225function parseJSON ( value ) {
Original file line number Diff line number Diff line change 2525 ],
2626 "dependencies" : {
2727 "@microlink/mql" : " ~0.13.4" ,
28- "localhost-url-regex " : " ~1 .0.4 " ,
28+ "is-local-address " : " ~2 .0.0 " ,
2929 "nanoclamp" : " ~2.0.4"
3030 },
3131 "devDependencies" : {
Original file line number Diff line number Diff line change 11import { fetchFromApi , getApiUrl as createApiUrl } from '@microlink/mql'
2- import localhostUrl from 'localhost-url-regex '
2+ import isLocalAddress from 'is-local-address '
33import { css } from 'styled-components'
44
55export const isSSR = typeof window === 'undefined'
@@ -81,7 +81,7 @@ export const isLarge = cardSize => cardSize === 'large'
8181export const isSmall = cardSize => cardSize === 'small'
8282
8383export const imageProxy = url =>
84- localhostUrl ( ) . test ( url )
84+ isLocalAddress ( new URL ( url ) . hostname )
8585 ? url
8686 : `https://images.weserv.nl/?${ new URLSearchParams ( {
8787 url,
You can’t perform that action at this time.
0 commit comments