feat(home): clarify 5chan is serverless app, use current hostname for share links

- Homepage infobox: merged copy into single line explaining app nature and download link
- Share links (Copy direct link): use window.location.origin instead of hardcoded 5chan.app
- Settings version link: use current origin
- FAQ: add 'Is 5chan just this website?' entry under Basics
- Remove pleb.bz from CHAN_5_HOSTNAMES
This commit is contained in:
plebeius
2026-03-04 18:49:06 +08:00
parent 0637a65ef3
commit 5fe2024a49
39 changed files with 66 additions and 41 deletions
+13 -4
View File
@@ -19,6 +19,17 @@ export const isValidURL = (url: string) => {
}
};
const CHAN_5_HOSTNAMES = ['5chan.app', '5chan.eth.limo', '5chan.eth.link', '5chan.eth.sucks', '5chan.netlify.app'];
function getShareBaseUrl(): string {
const { protocol, hostname, origin } = window.location;
if ((protocol === 'https:' || protocol === 'http:') && hostname !== 'localhost' && hostname !== '127.0.0.1') {
return origin;
}
// Electron / Capacitor / local dev fallback
return `https://${CHAN_5_HOSTNAMES[0]}`;
}
export type ShareLinkType = 'thread' | 'catalog';
// Copies a share link to clipboard for a board, thread, description, or rules page
@@ -29,17 +40,15 @@ export async function copyShareLinkToClipboard(boardIdentifier: string, linkType
if (!cid) {
throw new Error('copyShareLinkToClipboard: thread links require a cid');
}
const shareLink = `https://5chan.app/#/${boardIdentifier}/thread/${cid}`;
const shareLink = `${getShareBaseUrl()}/#/${boardIdentifier}/thread/${cid}`;
await copyToClipboard(shareLink);
return;
}
const shareLink = `https://5chan.app/#/${boardIdentifier}/${linkType}`;
const shareLink = `${getShareBaseUrl()}/#/${boardIdentifier}/${linkType}`;
await copyToClipboard(shareLink);
}
const CHAN_5_HOSTNAMES = ['pleb.bz', '5chan.app', '5chan.eth.limo', '5chan.eth.link', '5chan.eth.sucks', '5chan.netlify.app'];
// Check if a URL is a valid 5chan link that should be handled internally
export const is5chanLink = (url: string): boolean => {
try {