refactor: eslint and prettier conflict will be resolved and formatted

This commit is contained in:
Enes Köksal
2026-04-23 17:05:43 +03:00
parent 385b61f29b
commit 3cfea40fbd
219 changed files with 16638 additions and 13663 deletions
+49 -10
View File
@@ -23,10 +23,7 @@ export interface ShareLinkAccessResult {
link: ShareLink | null;
}
function hasRequiredPermission(
actual: SharePermission,
required: SharePermission
): boolean {
function hasRequiredPermission(actual: SharePermission, required: SharePermission): boolean {
if (required === 'VIEW') return actual === 'VIEW' || actual === 'COMMENT';
return actual === 'COMMENT';
}
@@ -67,7 +64,14 @@ export async function validateShareLinkAccess({
});
if (!link) {
return { hasAccess: false, canComment: false, canDownload: false, allowGuests: false, requiresPassword: false, link: null };
return {
hasAccess: false,
canComment: false,
canDownload: false,
allowGuests: false,
requiresPassword: false,
link: null,
};
}
const projectMatches = link.projectId === projectId;
@@ -76,25 +80,60 @@ export async function validateShareLinkAccess({
const permissionMatches = hasRequiredPermission(link.permission, requiredPermission);
if (!projectMatches || !videoMatches || !permissionMatches || isLinkExpired(link)) {
return { hasAccess: false, canComment: false, canDownload: false, allowGuests: false, requiresPassword: false, link };
return {
hasAccess: false,
canComment: false,
canDownload: false,
allowGuests: false,
requiresPassword: false,
link,
};
}
if (!link.project?.workspace.owner || !hasBillingAccess(link.project.workspace.owner)) {
return { hasAccess: false, canComment: false, canDownload: false, allowGuests: false, requiresPassword: false, link };
return {
hasAccess: false,
canComment: false,
canDownload: false,
allowGuests: false,
requiresPassword: false,
link,
};
}
if (link.passwordHash && !passwordVerified) {
if (!presentedPassword) {
return { hasAccess: false, canComment: false, canDownload: false, allowGuests: false, requiresPassword: true, link };
return {
hasAccess: false,
canComment: false,
canDownload: false,
allowGuests: false,
requiresPassword: true,
link,
};
}
if (presentedPassword.length > MAX_SHARE_PASSWORD_LENGTH) {
return { hasAccess: false, canComment: false, canDownload: false, allowGuests: false, requiresPassword: true, link };
return {
hasAccess: false,
canComment: false,
canDownload: false,
allowGuests: false,
requiresPassword: true,
link,
};
}
const isPasswordValid = await bcrypt.compare(presentedPassword, link.passwordHash);
if (!isPasswordValid) {
return { hasAccess: false, canComment: false, canDownload: false, allowGuests: false, requiresPassword: true, link };
return {
hasAccess: false,
canComment: false,
canDownload: false,
allowGuests: false,
requiresPassword: true,
link,
};
}
}