<% content_for :title, "Settings" %>

Settings

<%= form_with url: admin_settings_path, method: :patch, class: "card card-body max-w-xl space-y-4" do |f| %> <% if @errors.present? %> <% end %>

Uploads

<% upload = Setting::INTEGERS["max_upload_mb"] %>
<%= label_tag "settings[max_upload_mb]", upload[:label], class: "label" %> <%= number_field_tag "settings[max_upload_mb]", @values["max_upload_mb"], id: "settings_max_upload_mb", min: upload[:in].min, max: upload[:in].max, step: 1, required: true, class: "input w-32" %>

The largest single file anyone can upload: documents, squawk photos and bulk uploads. Default <%= upload[:default] %> MB, up to <%= upload[:in].max %> MB.

A proxy in front of the app can have its own, smaller limit. Cloudflare's proxy stops at 100 MB on its free plan; nginx needs client_max_body_size. Logbook transcription with Claude reads PDFs up to <%= LogbookTranscriber::MAX_PDF_BYTES / 1.megabyte %> MB and images up to <%= LogbookTranscriber::MAX_IMAGE_BYTES / 1.megabyte %> MB, whatever this is set to.

Backups

<% kept = Setting::INTEGERS["backups_kept"] %>
<%= label_tag "settings[backups_kept]", kept[:label], class: "label" %> <%= number_field_tag "settings[backups_kept]", @values["backups_kept"], id: "settings_backups_kept", min: kept[:in].min, max: kept[:in].max, step: 1, required: true, class: "input w-32" %>

A verified copy of the database is made nightly in storage/backups; this many of the newest are kept. Back up off the server too: <%= link_to "Off-site Backup", admin_offsite_backup_path, class: "link" %>.

<% okept = Setting::INTEGERS["offsite_backups_kept"] %>
<%= label_tag "settings[offsite_backups_kept]", okept[:label], class: "label" %> <%= number_field_tag "settings[offsite_backups_kept]", @values["offsite_backups_kept"], id: "settings_offsite_backups_kept", min: okept[:in].min, max: okept[:in].max, step: 1, required: true, class: "input w-32" %>

With off-site backup to Google Drive, this many of the newest nightly database copies are kept there. Uploaded files are copied once and kept.

Document search

<%= label_tag "settings[documents_claude_text]", "Read scanned documents with", class: "label" %> <%= select_tag "settings[documents_claude_text]", options_for_select([ [ "Tesseract (free, on this server)", 0 ], [ "Claude (better on handwriting; uses the Anthropic API)", 1 ] ], @values["documents_claude_text"].to_i), id: "settings_documents_claude_text", class: "input" %>

Text in documents is read so search can find it. PDFs that contain text are read directly either way. Claude is used only when an ANTHROPIC_API_KEY is set<%= " (it isn't)" if ENV["ANTHROPIC_API_KEY"].blank? %>, and costs API credit per page.

<%= f.submit "Save Settings", class: "btn-primary" %><%= link_to "Cancel", admin_about_path, class: "btn-secondary" %>
<% end %>