feat(ext/popup): add attachment cap setting to vault settings

Dropdown with 5/10/25/50 MB presets for per_attachment_max_bytes.
Other caps remain at defaults.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
adlee-was-taken
2026-04-27 00:37:43 -04:00
parent 2fa54e2144
commit b55c59bd35

View File

@@ -145,6 +145,19 @@ export function renderVaultSettings(app: HTMLElement): void {
`).join('')}
</div>
<div class="settings-section">
<div class="settings-section__title">attachments</div>
<div class="settings-row">
<span class="settings-row__label">max file size</span>
<select id="attachment-cap">
<option value="5242880">5 MB</option>
<option value="10485760">10 MB</option>
<option value="26214400">25 MB</option>
<option value="52428800">50 MB</option>
</select>
</div>
</div>
<div class="settings-footer">
<button class="btn" id="discard-btn">discard</button>
<button class="btn btn-primary" id="save-btn" disabled>save changes</button>
@@ -157,6 +170,8 @@ export function renderVaultSettings(app: HTMLElement): void {
trashRetentionToValue(pendingSettings.trash_retention);
(document.getElementById('history-retention') as HTMLSelectElement).value =
historyRetentionToValue(pendingSettings.field_history_retention);
const capValue = pendingSettings.attachment_caps?.per_attachment_max_bytes ?? 10485760;
(document.getElementById('attachment-cap') as HTMLSelectElement).value = String(capValue);
wireHandlers();
updateSaveEnabled();
@@ -185,6 +200,16 @@ export function renderVaultSettings(app: HTMLElement): void {
updateSaveEnabled();
});
document.getElementById('attachment-cap')?.addEventListener('change', (e) => {
if (!pendingSettings) return;
const bytes = Number((e.target as HTMLSelectElement).value);
pendingSettings.attachment_caps = {
...pendingSettings.attachment_caps,
per_attachment_max_bytes: bytes,
};
updateSaveEnabled();
});
document.querySelectorAll<HTMLButtonElement>('[data-revoke]').forEach((btn) => {
btn.addEventListener('click', () => {
if (!pendingSettings) return;