From cac224ce7ef4616dc16dacfa1e85f47baf5427b7 Mon Sep 17 00:00:00 2001 From: Daft Bot Date: Mon, 7 Aug 2023 18:50:22 +0200 Subject: [PATCH 1/7] Update dependency gettext to ~> 0.23 --- mix.exs | 2 +- mix.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mix.exs b/mix.exs index 57b0c84..64f72f4 100644 --- a/mix.exs +++ b/mix.exs @@ -40,7 +40,7 @@ defmodule Chiya.MixProject do {:ecto_sql, "~> 3.6"}, {:finch, "~> 0.16"}, {:floki, ">= 0.30.0", only: :test}, - {:gettext, "~> 0.22"}, + {:gettext, "~> 0.23"}, {:jason, "~> 1.2"}, {:oban, "~> 2.14"}, {:phoenix, "~> 1.7.1"}, diff --git a/mix.lock b/mix.lock index 63c27fb..0ad86d0 100644 --- a/mix.lock +++ b/mix.lock @@ -20,7 +20,7 @@ "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, "finch": {:hex, :finch, "0.16.0", "40733f02c89f94a112518071c0a91fe86069560f5dbdb39f9150042f44dcfb1a", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.6 or ~> 1.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "f660174c4d519e5fec629016054d60edd822cdfe2b7270836739ac2f97735ec5"}, "floki": {:hex, :floki, "0.34.3", "5e2dcaec5d7c228ce5b1d3501502e308b2d79eb655e4191751a1fe491c37feac", [:mix], [], "hexpm", "9577440eea5b97924b4bf3c7ea55f7b8b6dce589f9b28b096cc294a8dc342341"}, - "gettext": {:hex, :gettext, "0.22.3", "c8273e78db4a0bb6fba7e9f0fd881112f349a3117f7f7c598fa18c66c888e524", [:mix], [{:expo, "~> 0.4.0", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "935f23447713954a6866f1bb28c3a878c4c011e802bcd68a726f5e558e4b64bd"}, + "gettext": {:hex, :gettext, "0.23.0", "8065a6eb5a6c94ef3909b23178ffc064cd43a51d977b6c80babc8bb0c5ebfd6f", [:mix], [{:expo, "~> 0.4.0", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "09ca27284fe5a82449eb252f2877e551a46b1c9c7d10d72d087211f0bfed9638"}, "hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~> 2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"}, "hpax": {:hex, :hpax, "0.1.2", "09a75600d9d8bbd064cdd741f21fc06fc1f4cf3d0fcc335e5aa19be1a7235c84", [:mix], [], "hexpm", "2c87843d5a23f5f16748ebe77969880e29809580efdaccd615cd3bed628a8c13"}, "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, From 677e2b8019b83fbbe475ef2828f33603f7f7437c Mon Sep 17 00:00:00 2001 From: Daft Bot Date: Wed, 16 Aug 2023 21:40:18 +0200 Subject: [PATCH 2/7] Update dependency kbar to v0.1.0-beta.43 --- assets/package-lock.json | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/assets/package-lock.json b/assets/package-lock.json index cf35ac1..c4bbcde 100644 --- a/assets/package-lock.json +++ b/assets/package-lock.json @@ -8,14 +8,14 @@ "classnames": "^2.3.2", "glightbox": "^3.2.0", "highlight.js": "^11.8.0", - "kbar": "^0.1.0-beta.40", + "kbar": "^0.1.0-beta.43", "phoenix": "file:../deps/phoenix", "phoenix_html": "file:../deps/phoenix_html", "phoenix_live_view": "file:../deps/phoenix_live_view", "tablesort": "^5.3.0" }, "devDependencies": { - "esbuild": "^0.18.17" + "esbuild": "^0.18.0" }, "peerDependencies": { "react": "^18.0", @@ -487,11 +487,6 @@ "resolved": "https://registry.npmjs.org/classnames/-/classnames-2.3.2.tgz", "integrity": "sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw==" }, - "node_modules/command-score": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/command-score/-/command-score-0.1.2.tgz", - "integrity": "sha512-VtDvQpIJBvBatnONUsPzXYFVKQQAhuf3XTNOAsdBxCNO/QCtUUd8LSgjn0GVarBkCad6aJCZfXgrjYbl/KRr7w==" - }, "node_modules/esbuild": { "version": "0.18.17", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.17.tgz", @@ -534,6 +529,14 @@ "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-2.0.4.tgz", "integrity": "sha512-caj/ZmjHljPrZtbzJ3kfH5ia/k4mTJe/qSiXAGzxZWRZgsgDV0cvNaQULqUX8t0/JVlzzEdYOwCN5DmzTxoD4w==" }, + "node_modules/fuse.js": { + "version": "6.6.2", + "resolved": "https://registry.npmjs.org/fuse.js/-/fuse.js-6.6.2.tgz", + "integrity": "sha512-cJaJkxCCxC8qIIcPBF9yGxY0W/tVZS3uEISDxhYIdtk8OL93pe+6Zj7LjCqVV4dzbqcriOZ+kQ/NE4RXZHsIGA==", + "engines": { + "node": ">=10" + } + }, "node_modules/glightbox": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/glightbox/-/glightbox-3.2.0.tgz", @@ -554,13 +557,13 @@ "peer": true }, "node_modules/kbar": { - "version": "0.1.0-beta.41", - "resolved": "https://registry.npmjs.org/kbar/-/kbar-0.1.0-beta.41.tgz", - "integrity": "sha512-rxVcKz6pN9YOIInby63t/1LW8J1CpPDf2X1/s+YSTeCbfM160a2/mlPi5ncx0vOY7DyThCHyrWxgjgwScWC3kA==", + "version": "0.1.0-beta.43", + "resolved": "https://registry.npmjs.org/kbar/-/kbar-0.1.0-beta.43.tgz", + "integrity": "sha512-MmhhvGuZfmA616X9wuy/iaWCPFmlEi6kGkvce/7GlatWmCSkHZhD8glxUruFUpxSN0HZvW/6e/jvSgpRGnC76w==", "dependencies": { "@radix-ui/react-portal": "^1.0.1", - "command-score": "^0.1.2", "fast-equals": "^2.0.3", + "fuse.js": "^6.6.2", "react-virtual": "^2.8.2", "tiny-invariant": "^1.2.0" }, From 3ad472b5c44b565b5aa85fb42c4cf53fbbc7f0b6 Mon Sep 17 00:00:00 2001 From: Inhji Date: Wed, 16 Aug 2023 22:34:06 +0200 Subject: [PATCH 3/7] fix filtering --- lib/chiya_web/indie/micropub_handler.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/chiya_web/indie/micropub_handler.ex b/lib/chiya_web/indie/micropub_handler.ex index 01562f1..3de31d3 100644 --- a/lib/chiya_web/indie/micropub_handler.ex +++ b/lib/chiya_web/indie/micropub_handler.ex @@ -91,7 +91,7 @@ defmodule ChiyaWeb.Indie.MicropubHandler do } filtered_note = - Map.filter(note, fn {key, _val} -> + Map.filter(properties, fn {key, _val} -> Enum.member?(filter_properties, to_string(key)) end) From dd88829544396630247354c11aa73e8f8cb5432e Mon Sep 17 00:00:00 2001 From: Inhji Date: Wed, 16 Aug 2023 22:39:35 +0200 Subject: [PATCH 4/7] update npm deps --- assets/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/package-lock.json b/assets/package-lock.json index c4bbcde..aaa7e68 100644 --- a/assets/package-lock.json +++ b/assets/package-lock.json @@ -8,7 +8,7 @@ "classnames": "^2.3.2", "glightbox": "^3.2.0", "highlight.js": "^11.8.0", - "kbar": "^0.1.0-beta.43", + "kbar": "^0.1.0-beta.40", "phoenix": "file:../deps/phoenix", "phoenix_html": "file:../deps/phoenix_html", "phoenix_live_view": "file:../deps/phoenix_live_view", @@ -23,14 +23,14 @@ } }, "../deps/phoenix": { - "version": "1.7.6", + "version": "1.7.7", "license": "MIT" }, "../deps/phoenix_html": { "version": "3.3.1" }, "../deps/phoenix_live_view": { - "version": "0.19.3", + "version": "0.19.5", "license": "MIT" }, "node_modules/@babel/runtime": { From a09dd582e5433e0bdc34b907b73e62ec8cdb4bae Mon Sep 17 00:00:00 2001 From: Inhji Date: Wed, 16 Aug 2023 22:39:46 +0200 Subject: [PATCH 5/7] fix bookmarks --- lib/chiya/notes.ex | 2 +- lib/chiya_web/controllers/page_html/bookmarks.html.heex | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/chiya/notes.ex b/lib/chiya/notes.ex index ed0af2b..0b14264 100644 --- a/lib/chiya/notes.ex +++ b/lib/chiya/notes.ex @@ -12,7 +12,7 @@ defmodule Chiya.Notes do :images, :links_from, :links_to, - :tags, + tags: [:notes], comments: from(c in NoteComment, order_by: [ diff --git a/lib/chiya_web/controllers/page_html/bookmarks.html.heex b/lib/chiya_web/controllers/page_html/bookmarks.html.heex index c37f34b..9024402 100644 --- a/lib/chiya_web/controllers/page_html/bookmarks.html.heex +++ b/lib/chiya_web/controllers/page_html/bookmarks.html.heex @@ -2,7 +2,7 @@
<.header> Bookmarks - <:subtitle><%= Enum.count(@notes) in total %> + <:subtitle><%= Enum.count(@notes) %> in total
From f1c333acec39b249c15a083a5d645fc4e5011d7b Mon Sep 17 00:00:00 2001 From: Inhji Date: Wed, 16 Aug 2023 22:46:13 +0200 Subject: [PATCH 6/7] fix tags --- lib/chiya_web/controllers/page_html/bookmarks.html.heex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/chiya_web/controllers/page_html/bookmarks.html.heex b/lib/chiya_web/controllers/page_html/bookmarks.html.heex index 9024402..8f906db 100644 --- a/lib/chiya_web/controllers/page_html/bookmarks.html.heex +++ b/lib/chiya_web/controllers/page_html/bookmarks.html.heex @@ -24,7 +24,7 @@ href={~p"/tagged-with/#{tag.slug}"} class="border border-theme-background1 rounded font-sm px-2 py-1 inline-block mb-2 hover:bg-theme-background1 transition" > - <%= tag.name %> <%= Enum.count(tag.notes) %> + <%= tag.name %> <%= Enum.count(tag.notes) %> <% end %> From 0267ae07d8b120e5976c02f7178fa4b8e0117087 Mon Sep 17 00:00:00 2001 From: Inhji Date: Wed, 16 Aug 2023 22:54:57 +0200 Subject: [PATCH 7/7] add like and repost as supported types --- lib/chiya_web/indie/micropub_handler.ex | 8 ++++++++ lib/chiya_web/indie/properties.ex | 19 ++++++++----------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/lib/chiya_web/indie/micropub_handler.ex b/lib/chiya_web/indie/micropub_handler.ex index 3de31d3..4b6e6fb 100644 --- a/lib/chiya_web/indie/micropub_handler.ex +++ b/lib/chiya_web/indie/micropub_handler.ex @@ -25,6 +25,14 @@ defmodule ChiyaWeb.Indie.MicropubHandler do %{ "type" => "bookmark", "name" => "Bookmark" + }, + %{ + "type" => "like", + "name" => "Like" + }, + %{ + "type" => "repost", + "name" => "Repost" } ] diff --git a/lib/chiya_web/indie/properties.ex b/lib/chiya_web/indie/properties.ex index a93df30..41875d5 100644 --- a/lib/chiya_web/indie/properties.ex +++ b/lib/chiya_web/indie/properties.ex @@ -1,17 +1,14 @@ defmodule ChiyaWeb.Indie.Properties do def get_post_type(properties) do cond do - Map.has_key?(properties, "like-of") -> - {:ok, :like} - - Map.has_key?(properties, "bookmark-of") -> - {:ok, :bookmark} - - Map.has_key?(properties, "content") -> - {:ok, :note} - - true -> - {:error, :unsupported_posttype} + Map.has_key?(properties, "like-of") -> {:ok, :like} + Map.has_key?(properties, "bookmark-of") -> {:ok, :bookmark} + Map.has_key?(properties, "content") -> {:ok, :note} + Map.has_key?(properties, "repost-of") -> {:ok, :repost} + Map.has_key?(properties, "read-of") -> {:ok, :read} + Map.has_key?(properties, "watch-of") -> {:ok, :watch} + Map.has_key?(properties, "listen-of") -> {:ok, :listen} + true -> {:error, :unsupported_posttype} end end