Skip to content

Commit bf67db6

Browse files
committed
Link included feeds to instance feed directory
1 parent b4e62ad commit bf67db6

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

frontend/src/__tests__/App.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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',

frontend/src/components/AppPanels.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff 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"

0 commit comments

Comments
 (0)