邀请页面
This commit is contained in:
18
src/pages/invite/service.ts
Normal file
18
src/pages/invite/service.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
const isLocalhost = Boolean(
|
||||
window.location.hostname === 'localhost' ||
|
||||
// [::1] is the IPv6 localhost address.
|
||||
window.location.hostname === '[::1]' ||
|
||||
// 127.0.0.1/8 is considered localhost for IPv4.
|
||||
window.location.hostname.match(
|
||||
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
|
||||
)
|
||||
);
|
||||
|
||||
export function generateInviteHref(invite: string): string {
|
||||
const postfix = invite ? `/check?inviteCode=${invite}` : '/check';
|
||||
if (isLocalhost) {
|
||||
return `${window.location.origin}${postfix}`
|
||||
}
|
||||
return `https://fivapp.github.io/#${postfix}`;
|
||||
}
|
||||
Reference in New Issue
Block a user