fixes
This commit is contained in:
parent
67b4400d99
commit
6106a0e397
|
|
@ -118,6 +118,12 @@ class ShareRepository:
|
|||
"""
|
||||
if share.revoked_at:
|
||||
return False
|
||||
if share.expires_at and share.expires_at < datetime.now(timezone.utc):
|
||||
return False
|
||||
if share.expires_at:
|
||||
# Ensure both datetimes are timezone-aware for comparison
|
||||
now = datetime.now(timezone.utc)
|
||||
expires_at = share.expires_at
|
||||
if expires_at.tzinfo is None:
|
||||
expires_at = expires_at.replace(tzinfo=timezone.utc)
|
||||
if expires_at < now:
|
||||
return False
|
||||
return True
|
||||
|
|
|
|||
|
|
@ -102,7 +102,25 @@ export default function LibraryPage() {
|
|||
};
|
||||
|
||||
const handleCopyShareLink = () => {
|
||||
navigator.clipboard.writeText(shareLink);
|
||||
// Fallback for HTTP (clipboard API requires HTTPS)
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
navigator.clipboard.writeText(shareLink);
|
||||
} else {
|
||||
// Fallback method for HTTP
|
||||
const textArea = document.createElement('textarea');
|
||||
textArea.value = shareLink;
|
||||
textArea.style.position = 'fixed';
|
||||
textArea.style.left = '-999999px';
|
||||
document.body.appendChild(textArea);
|
||||
textArea.focus();
|
||||
textArea.select();
|
||||
try {
|
||||
document.execCommand('copy');
|
||||
} catch (err) {
|
||||
console.error('Failed to copy:', err);
|
||||
}
|
||||
document.body.removeChild(textArea);
|
||||
}
|
||||
showSnackbar('Ссылка скопирована');
|
||||
setShareDialogOpen(false);
|
||||
setShareLink('');
|
||||
|
|
|
|||
Loading…
Reference in New Issue