File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -400,6 +400,7 @@ describe('App', () => {
400400 } ) ;
401401
402402 it ( 'shows the utility links in a user-focused order' , ( ) => {
403+ window . history . replaceState ( { } , '' , 'http://localhost:3000/#result' ) ;
403404 render ( < App /> ) ;
404405
405406 fireEvent . click ( screen . getByRole ( 'button' , { name : 'More' } ) ) ;
@@ -419,7 +420,7 @@ describe('App', () => {
419420 ) ;
420421 expect ( screen . getByRole ( 'link' , { name : 'Try included feeds' } ) ) . toHaveAttribute (
421422 'href' ,
422- 'https://html2rss.github.io/web-application/how-to/use-included-configs/ '
423+ 'https://html2rss.github.io/feed-directory/#!url=http%3A%2F%2Flocalhost%3A3000%2F '
423424 ) ;
424425 expect ( screen . getByRole ( 'link' , { name : 'Install from Docker Hub' } ) ) . toHaveAttribute (
425426 'href' ,
Original file line number Diff line number Diff line change @@ -255,6 +255,16 @@ export function UtilityStrip({
255255 onClearToken,
256256} : UtilityStripProps ) {
257257 const [ isOpen , setIsOpen ] = useState ( false ) ;
258+ const includedFeedsHref = ( ( ) => {
259+ const directoryUrl = new URL ( 'https://html2rss.github.io/feed-directory/' ) ;
260+ if ( typeof window === 'undefined' ) return directoryUrl . toString ( ) ;
261+
262+ const instanceUrl = new URL ( window . location . href ) ;
263+ instanceUrl . search = '' ;
264+ instanceUrl . hash = '' ;
265+ directoryUrl . hash = `!url=${ encodeURIComponent ( instanceUrl . toString ( ) ) } ` ;
266+ return directoryUrl . toString ( ) ;
267+ } ) ( ) ;
258268
259269 if ( hidden ) return null ;
260270
@@ -271,7 +281,7 @@ export function UtilityStrip({
271281 { isOpen && (
272282 < div class = "utility-strip__items" >
273283 < a
274- href = "https://html2rss.github.io/web-application/how-to/use-included-configs/"
284+ href = { includedFeedsHref }
275285 target = "_blank"
276286 rel = "noopener noreferrer"
277287 class = "utility-link"
You can’t perform that action at this time.
0 commit comments