Implement 'Add Password' and 'Change Permissions' tools in V2 (#4195)

# Description of Changes
Implement Add Password and Change Permissions tools in V2 (both in one
because Change Permissions is a fake endpoint which just calls Add
Password behind the scenes).

---------

Co-authored-by: James <james@crosscourtanalytics.com>
This commit is contained in:
James Brunton
2025-08-14 14:27:23 +01:00
committed by GitHub
parent 0ea4410dd3
commit ecf30d1028
31 changed files with 1936 additions and 88 deletions

View File

@@ -0,0 +1,35 @@
import { useTranslation } from 'react-i18next';
import { TooltipContent } from '../../types/tips';
export const useAddPasswordTips = (): TooltipContent => {
const { t } = useTranslation();
return {
header: {
title: t("addPassword.tooltip.header.title", "Password Protection Overview")
},
tips: [
{
title: t("addPassword.tooltip.passwords.title", "Password Types"),
description: t("addPassword.tooltip.passwords.text", "User passwords restrict opening the document, while owner passwords control what can be done with the document once opened. You can set both or just one."),
bullets: [
t("addPassword.tooltip.passwords.bullet1", "User Password: Required to open the PDF"),
t("addPassword.tooltip.passwords.bullet2", "Owner Password: Controls document permissions (not supported by all PDF viewers)")
]
},
{
title: t("addPassword.tooltip.encryption.title", "Encryption Levels"),
description: t("addPassword.tooltip.encryption.text", "Higher encryption levels provide better security but may not be supported by older PDF viewers."),
bullets: [
t("addPassword.tooltip.encryption.bullet1", "40-bit: Basic security, compatible with older viewers"),
t("addPassword.tooltip.encryption.bullet2", "128-bit: Standard security, widely supported"),
t("addPassword.tooltip.encryption.bullet3", "256-bit: Maximum security, requires modern viewers")
]
},
{
title: t("addPassword.tooltip.restrictions.title", "Document Restrictions"),
description: t("addPassword.tooltip.restrictions.text", "These restrictions control what users can do with the PDF. Most effective when combined with an owner password."),
}
]
};
};

View File

@@ -0,0 +1,18 @@
import { useTranslation } from 'react-i18next';
import { TooltipContent } from '../../types/tips';
export const useChangePermissionsTips = (): TooltipContent => {
const { t } = useTranslation();
return {
header: {
title: t("changePermissions.tooltip.header.title", "Change Permissions")
},
tips: [
{
title: t("changePermissions.tooltip.description.title", "Description"),
description: t("changePermissions.tooltip.description.text", "Changes document permissions. Warning: To make these restrictions unchangeable, use the Add Password tool to set an owner password.")
}
]
};
};

View File

@@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next';
import { TooltipContent } from '../../types/tips';
export const CompressTips = (): TooltipContent => {
export const useCompressTips = (): TooltipContent => {
const { t } = useTranslation();
return {
@@ -27,4 +27,4 @@ export const CompressTips = (): TooltipContent => {
}
]
};
};
};

View File

@@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next';
import { TooltipContent } from '../../types/tips';
export const OcrTips = (): TooltipContent => {
export const useOCRTips = (): TooltipContent => {
const { t } = useTranslation();
return {
@@ -33,4 +33,4 @@ export const OcrTips = (): TooltipContent => {
}
]
};
};
};