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
@@ -41,7 +41,7 @@ const fetchLatestVersionInfo = async (t: (key: string, opts?: Record<string, unk
if (!updateAvailable) {
alert(
commitRef
? `${t('latest_development_version', { commit: commitRef.slice(0, 7), link: 'https://5chan.app/#/', interpolation: { escapeValue: false } })}`
? `${t('latest_development_version', { commit: commitRef.slice(0, 7), link: `${window.location.origin}/#/`, interpolation: { escapeValue: false } })}`
: `${t('latest_stable_version', { version: packageJson.version })}`,
);
}
+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 {
+10
View File
@@ -37,6 +37,9 @@ const FAQ = () => {
<li>
<HashLink to='#what5chan'>What is 5chan?</HashLink>
</li>
<li>
<HashLink to='#justwebsite'>Is 5chan just this website?</HashLink>
</li>
<ul>
<li>
<HashLink to='#howaccess'>How do I access the boards?</HashLink>
@@ -93,6 +96,13 @@ const FAQ = () => {
it's all text including links from which media is embedded, shared peer-to-peer. Users do not need to register an account before participating in the
community.
</dd>
<dt id='justwebsite'>Is 5chan just this website?</dt>
<dd>
No. 5chan is a client app for the Bitsocial protocol. This website is just one place to open it the domain could change, disappear, or be blocked
without affecting the Bitsocial network or any boards. We recommend installing the app when your browser offers it, so you keep a local copy that works
independently. You can also <a href='https://github.com/bitsocialhq/5chan/releases/latest'>download a desktop or Android release</a> from GitHub. If you
know a board's address, you can connect from any host or installed copy.
</dd>
<dt id='howaccess'>How do I access the boards?</dt>
<dd>
Anyone can access any board at a any time by simply knowing its address. Paste it in the search box, located in the homepage or at the top of the board
+7 -1
View File
@@ -67,7 +67,13 @@ const InfoBox = () => {
/>
<br />
<br />
{t('no_global_rules_info')}
<Trans
i18nKey='no_global_rules_info'
shouldUnescape={true}
components={{
1: <a key='releases-link' href='https://github.com/bitsocialhq/5chan/releases/latest' target='_blank' rel='noopener noreferrer' />,
}}
/>
</div>
</div>
);