mirror of
https://github.com/plebbit/seedit.git
synced 2026-08-01 10:26:49 -04:00
feat(share): use s.seedit.app subdomain for share links
Generate post share URLs on s.seedit.app and recognize the subdomain when parsing external Seedit links.
This commit is contained in:
@@ -71,8 +71,8 @@ describe('community route builders', () => {
|
||||
expect(getCommunityPostPath(PUBLIC_KEY, 'bafy-post-cid')).toBe(`/s/${PUBLIC_KEY}/comments/bafy-post-cid`);
|
||||
});
|
||||
|
||||
it('builds the exact seedit.app external post URL', () => {
|
||||
expect(getCommunityPostUrl('aww.bso', 'bafy-post-cid')).toBe('https://seedit.app/s/aww.bso/comments/bafy-post-cid');
|
||||
it('builds the exact s.seedit.app external post URL', () => {
|
||||
expect(getCommunityPostUrl('aww.bso', 'bafy-post-cid')).toBe('https://s.seedit.app/s/aww.bso/comments/bafy-post-cid');
|
||||
});
|
||||
|
||||
it('keeps explicit directory paths separate from exact community paths', () => {
|
||||
|
||||
@@ -39,7 +39,7 @@ export const getCommunityPostPath = (communityAddress: string, cid: string): str
|
||||
export const getCommunityReferencePostPath = (communityReference: string, cid: string): string =>
|
||||
`${getCommunityReferencePath(communityReference)}/comments/${encodeURIComponent(cid)}`;
|
||||
|
||||
export const getCommunityPostUrl = (communityAddress: string, cid: string): string => `https://seedit.app${getCommunityPostPath(communityAddress, cid)}`;
|
||||
export const getCommunityPostUrl = (communityAddress: string, cid: string): string => `https://s.seedit.app${getCommunityPostPath(communityAddress, cid)}`;
|
||||
|
||||
export const getExactCommunityActionRedirectPath = (
|
||||
pathname: string,
|
||||
|
||||
@@ -6,12 +6,14 @@ const CID = 'bafybeigdyrzt5sfp7udm7hu76uh7y26nf3fteh2v6q2f6x2w4g3q';
|
||||
describe('Seedit comments permalinks', () => {
|
||||
it('recognizes direct, hash-routed, and short-host comments URLs', () => {
|
||||
expect(isSeeditLink(`https://seedit.app/s/aww/comments/${CID}`)).toBe(true);
|
||||
expect(isSeeditLink(`https://s.seedit.app/s/aww/comments/${CID}`)).toBe(true);
|
||||
expect(isSeeditLink(`https://seedit.app/#/s/aww/comments/${CID}`)).toBe(true);
|
||||
expect(isSeeditLink(`https://pleb.bz/s/aww/comments/${CID}`)).toBe(true);
|
||||
});
|
||||
|
||||
it('transforms external comments URLs to the matching internal route', () => {
|
||||
expect(transformSeeditLinkToInternal(`https://seedit.app/s/aww/comments/${CID}`)).toBe(`/s/aww/comments/${CID}`);
|
||||
expect(transformSeeditLinkToInternal(`https://s.seedit.app/s/aww/comments/${CID}`)).toBe(`/s/aww/comments/${CID}`);
|
||||
expect(transformSeeditLinkToInternal(`https://seedit.app/#/s/aww/comments/${CID}`)).toBe(`/s/aww/comments/${CID}`);
|
||||
});
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ export const copyShareLinkToClipboard = async (communityAddress: string, cid: st
|
||||
await copyToClipboard(shareLink);
|
||||
};
|
||||
|
||||
const SEEDIT_HOSTNAMES = ['seedit.app', 'seedit.eth.limo', 'seedit.eth.link', 'seedit.eth.sucks', 'seedit.netlify.app', 'pleb.bz'];
|
||||
const SEEDIT_HOSTNAMES = ['seedit.app', 's.seedit.app', 'seedit.eth.limo', 'seedit.eth.link', 'seedit.eth.sucks', 'seedit.netlify.app', 'pleb.bz'];
|
||||
|
||||
// Check if a URL is a valid seedit link that should be handled internally
|
||||
export const isSeeditLink = (url: string): boolean => {
|
||||
|
||||
Reference in New Issue
Block a user