fix file uploads, serve them properly, put behind auth wall, decrypt secret message in frontend

This commit is contained in:
2022-02-22 00:16:51 -05:00
parent cac3757723
commit 2ac596b8c8
20 changed files with 420 additions and 148 deletions

View File

@@ -5,7 +5,17 @@ defmodule Entendu.Links.Link do
import Ecto.Changeset
@primary_key {:id, Ecto.UUID, autogenerate: true}
@derive {Jason.Encoder,
only: [
:burn_after_reading,
:expires,
:filename,
:filetype,
:text_content,
:file_content,
:recipient,
:service
]}
schema "links" do
field :burn_after_reading, :boolean, default: false
field :expires, :utc_datetime
@@ -30,7 +40,10 @@ defmodule Entendu.Links.Link do
:recipient,
:service
])
|> cast_attachments(attrs, [:text_content, :file_content])
end
def file_changeset(link, attrs) do
link
|> cast_attachments(attrs, [:text_content, :file_content])
end
end