diff --git a/flavours/classic/config/activity_pub.exs b/flavours/classic/config/activity_pub.exs index ffc170c6fb..28dde1b9a5 100644 --- a/flavours/classic/config/activity_pub.exs +++ b/flavours/classic/config/activity_pub.exs @@ -35,7 +35,13 @@ config :activity_pub, :mrf_simple, config :http_signatures, adapter: ActivityPub.Safety.Signatures # config :tesla, adapter: Tesla.Adapter.Hackney -config :tesla, :adapter, {Tesla.Adapter.Finch, name: Bonfire.Finch} +config :tesla, + :adapter, + {Tesla.Adapter.Finch, + name: Bonfire.Finch, + pools: %{ + :default => [conn_opts: [case_sensitive_headers: true]] + }} config :activity_pub, :http, proxy_url: nil, diff --git a/flavours/classic/config/bonfire_search.exs b/flavours/classic/config/bonfire_search.exs index b4fad2f74a..d27ff76f17 100644 --- a/flavours/classic/config/bonfire_search.exs +++ b/flavours/classic/config/bonfire_search.exs @@ -5,7 +5,7 @@ config :bonfire_search, adapter: Bonfire.Search.Meili # for use by API client -config :tesla, :adapter, {Tesla.Adapter.Finch, name: Bonfire.Finch} +# config :tesla, :adapter, {Tesla.Adapter.Finch, name: Bonfire.Finch} # config :tesla, adapter: Tesla.Adapter.Hackney config :phoenix, :format_encoders, json: Jason config :phoenix, :json_library, Jason diff --git a/flavours/classic/config/flavour_assets/hooks/Bonfire.UI.Common.OpenExternalLinkLive.hooks.js b/flavours/classic/config/flavour_assets/hooks/Bonfire.UI.Common.OpenExternalLinkLive.hooks.js new file mode 100644 index 0000000000..40b2e3f330 --- /dev/null +++ b/flavours/classic/config/flavour_assets/hooks/Bonfire.UI.Common.OpenExternalLinkLive.hooks.js @@ -0,0 +1,38 @@ +/* +This file was generated by the Surface compiler. +*/ + + +let LinksClickPrompt = { + mounted() { + this.el.addEventListener("click", e => { + const link = e.target.closest('a'); + if (!link) return; + + e.preventDefault(); + const url = window.prompt("Confirm or edit URL to follow:", link.href); + + if (url) { + window.location.href = url; + } + }); + } +}; + +let LinksDangerModal = { + mounted() { + this.el.addEventListener("click", e => { + const link = e.target.closest('a'); + if (!link) return; + + const url = link.href; + + if (url && url.indexOf("/") != 0) { + e.preventDefault(); + this.pushEvent("Bonfire.UI.Common.ReusableModalLive:prompt_external_link", { url: url }) + } + }); + } +}; + +export { LinksClickPrompt, LinksDangerModal }; diff --git a/flavours/classic/config/flavour_assets/hooks/index.js b/flavours/classic/config/flavour_assets/hooks/index.js index 287625429c..db828fd486 100644 --- a/flavours/classic/config/flavour_assets/hooks/index.js +++ b/flavours/classic/config/flavour_assets/hooks/index.js @@ -13,25 +13,27 @@ function ns(hooks, nameSpace) { import * as c1 from "./Bonfire.Editor.Milkdown.hooks.js" import * as c2 from "./Bonfire.UI.Common.ViewCodeLive.hooks.js" import * as c3 from "./Bonfire.UI.Common.LazyImage.hooks.js" -import * as c4 from "./Bonfire.UI.Common.PreviewContentLive.hooks.js" -import * as c5 from "./Bonfire.UI.Common.NotificationLive.hooks.js" -import * as c6 from "./Bonfire.UI.Common.LoadMoreLive.hooks.js" -import * as c7 from "./Bonfire.UI.Common.ChangeLocaleLive.hooks.js" -import * as c8 from "./Bonfire.UI.Common.ChangeThemesLive.hooks.js" -import * as c9 from "./Bonfire.UI.Common.ComposerLive.hooks.js" -import * as c10 from "./Bonfire.UI.Social.Activity.DateAgoLive.hooks.js" +import * as c4 from "./Bonfire.UI.Common.OpenExternalLinkLive.hooks.js" +import * as c5 from "./Bonfire.UI.Common.PreviewContentLive.hooks.js" +import * as c6 from "./Bonfire.UI.Common.NotificationLive.hooks.js" +import * as c7 from "./Bonfire.UI.Common.LoadMoreLive.hooks.js" +import * as c8 from "./Bonfire.UI.Common.ChangeLocaleLive.hooks.js" +import * as c9 from "./Bonfire.UI.Common.ChangeThemesLive.hooks.js" +import * as c10 from "./Bonfire.UI.Common.ComposerLive.hooks.js" +import * as c11 from "./Bonfire.UI.Social.Activity.DateAgoLive.hooks.js" let hooks = Object.assign( ns(c1, "Bonfire.Editor.Milkdown"), ns(c2, "Bonfire.UI.Common.ViewCodeLive"), ns(c3, "Bonfire.UI.Common.LazyImage"), - ns(c4, "Bonfire.UI.Common.PreviewContentLive"), - ns(c5, "Bonfire.UI.Common.NotificationLive"), - ns(c6, "Bonfire.UI.Common.LoadMoreLive"), - ns(c7, "Bonfire.UI.Common.ChangeLocaleLive"), - ns(c8, "Bonfire.UI.Common.ChangeThemesLive"), - ns(c9, "Bonfire.UI.Common.ComposerLive"), - ns(c10, "Bonfire.UI.Social.Activity.DateAgoLive") + ns(c4, "Bonfire.UI.Common.OpenExternalLinkLive"), + ns(c5, "Bonfire.UI.Common.PreviewContentLive"), + ns(c6, "Bonfire.UI.Common.NotificationLive"), + ns(c7, "Bonfire.UI.Common.LoadMoreLive"), + ns(c8, "Bonfire.UI.Common.ChangeLocaleLive"), + ns(c9, "Bonfire.UI.Common.ChangeThemesLive"), + ns(c10, "Bonfire.UI.Common.ComposerLive"), + ns(c11, "Bonfire.UI.Social.Activity.DateAgoLive") ) export default hooks diff --git a/flavours/classic/config/test.exs b/flavours/classic/config/test.exs index 7e5b5e08b2..14cad7c80c 100644 --- a/flavours/classic/config/test.exs +++ b/flavours/classic/config/test.exs @@ -66,8 +66,10 @@ config :bonfire_umbrella, Bonfire.Common.Repo, log: false, stacktrace: true -config :tesla, - adapter: if(federate?, do: {Tesla.Adapter.Finch, name: Bonfire.Finch}, else: Tesla.Mock) +if !federate? do + config :tesla, + adapter: Tesla.Mock +end #  enable federation in tests, since we're either using mocks or integration testing with TEST_INSTANCE config :activity_pub, :instance, federating: true diff --git a/justfile b/justfile index 306d6f5feb..7f908d1ebd 100644 --- a/justfile +++ b/justfile @@ -611,11 +611,11 @@ test-federation-in-extensions *args=ap_ext: test-federation-dance-positions just test-watch $@ test-federation-dance *args='': test-federation-dance-positions - TEST_INSTANCE=yes just test --only test_instance $@ + TEST_INSTANCE=yes HOSTNAME=localhost just test --only test_instance $@ just test-federation-dance-positions test-federation-dance-unsigned *args='': test-federation-dance-positions - ACCEPT_UNSIGNED_ACTIVITIES=1 TEST_INSTANCE=yes just test --only test_instance $@ + ACCEPT_UNSIGNED_ACTIVITIES=1 TEST_INSTANCE=yes HOSTNAME=localhost just test --only test_instance $@ just test-federation-dance-positions test-federation-dance-positions: @@ -633,6 +633,7 @@ load_testing: # Create or reset the test DB test-db-reset: init db-pre-migrations {{ if WITH_DOCKER == "total" { "just docker-compose run -e MIX_ENV=test web mix ecto.drop --force" } else { "MIX_ENV=test just mix ecto.drop --force" } }} + {{ if WITH_DOCKER == "total" { "just docker-compose run -e MIX_ENV=test web mix ecto.drop --force -r Bonfire.Common.TestInstanceRepo" } else { "MIX_ENV=test just mix ecto.drop --force -r Bonfire.Common.TestInstanceRepo" } }} #### RELEASE RELATED COMMANDS (Docker-specific for now) #### @@ -970,6 +971,7 @@ nix-db-init: (nix-db "start") tunnel: tunnel-localhost-run @tunnel-localhost-run: + echo "NOTE: you'll need to copy the generated domain name that will be printed below into HOSTNAME in your .env" ssh -R 80:localhost:4000 localhost.run # this requires `cargo install tunnelto` (the homebrew version of tunnelto doesn't work)