mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 20:27:23 +00:00
Add loading spinner to Cloudflare popup during Turnstile verification
This commit is contained in:
@@ -274,8 +274,17 @@ function FileTile({file}: { file: RFile }) {
|
|||||||
function CloudflarePopup({file}: { file: RFile }) {
|
function CloudflarePopup({file}: { file: RFile }) {
|
||||||
const closePopup = useClosePopup()
|
const closePopup = useClosePopup()
|
||||||
|
|
||||||
return <div className={"menu bg-base-100 rounded-box z-1 w-80 p-2 shadow-sm h-20"}>
|
const [isLoading, setLoading] = useState(false)
|
||||||
<Turnstile siteKey={app.cloudflareTurnstileSiteKey!} onSuccess={(token) => {
|
|
||||||
|
return <div className={"menu bg-base-100 rounded-box z-1 w-80 p-2 shadow-sm h-20 relative"}>
|
||||||
|
{
|
||||||
|
isLoading ? <div className={"absolute top-0 bottom-0 left-0 right-0 flex items-center justify-center"}>
|
||||||
|
<span className={"loading loading-spinner loading-lg"}></span>
|
||||||
|
</div> : null
|
||||||
|
}
|
||||||
|
<Turnstile siteKey={app.cloudflareTurnstileSiteKey!} onLoad={() => {
|
||||||
|
setLoading(false)
|
||||||
|
}} onSuccess={(token) => {
|
||||||
closePopup();
|
closePopup();
|
||||||
const link = network.getFileDownloadLink(file.id, token);
|
const link = network.getFileDownloadLink(file.id, token);
|
||||||
window.open(link, "_blank");
|
window.open(link, "_blank");
|
||||||
|
Reference in New Issue
Block a user