This commit is contained in:
itqop 2025-12-30 18:16:59 +03:00
parent 67b4400d99
commit 6106a0e397
2 changed files with 27 additions and 3 deletions

View File

@ -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

View File

@ -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('');