- contact@ / legal@ / privacy@ / security@ / takedown@poli0981.dev (Google Workspace aliases) replace the @freeitchgames.win addresses in the policies (EN + VI), READMEs, issue templates, security.txt and the installer EULA. - Privacy Policy: Google Workspace replaces Cloudflare Email Routing as the email processor (provider table, transfers, contact section). - About page: website, contact email and the poli0981.dev/links hub; mailto: links open without a blank tab; the apps may open mailto:. - LEGAL_VERSION 2026-09-29, so the legal gate asks once more. - Version 4.1.1 (about.ts, package.json, tauri.conf.json, Cargo.toml/lock). Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { forwardRef, type AnchorHTMLAttributes, type MouseEvent } from 'react'
|
|
import { isTauri } from '@/lib/runtime'
|
|
import { openExternal } from '@/lib/external-link'
|
|
|
|
export interface ExtLinkProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'target' | 'rel'> {
|
|
href: string
|
|
}
|
|
|
|
export const ExtLink = forwardRef<HTMLAnchorElement, ExtLinkProps>(
|
|
({ href, onClick, children, ...rest }, ref) => {
|
|
const handleClick = (e: MouseEvent<HTMLAnchorElement>) => {
|
|
onClick?.(e)
|
|
if (e.defaultPrevented) return
|
|
if (!isTauri()) return
|
|
if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return
|
|
e.preventDefault()
|
|
void openExternal(href)
|
|
}
|
|
// mailto: hands off to the mail client; a new tab would just stay blank.
|
|
const newTab = !href.startsWith('mailto:')
|
|
return (
|
|
<a
|
|
ref={ref}
|
|
href={href}
|
|
target={newTab ? '_blank' : undefined}
|
|
rel={newTab ? 'noopener noreferrer' : undefined}
|
|
onClick={handleClick}
|
|
{...rest}
|
|
>
|
|
{children}
|
|
</a>
|
|
)
|
|
},
|
|
)
|
|
ExtLink.displayName = 'ExtLink'
|