Skip to content

Commit

Permalink
#126 and #1031
Browse files Browse the repository at this point in the history
  • Loading branch information
mayel committed Oct 3, 2024
1 parent 492a0fc commit 8390458
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 20 deletions.
8 changes: 7 additions & 1 deletion flavours/classic/config/activity_pub.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion flavours/classic/config/bonfire_search.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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 };
30 changes: 16 additions & 14 deletions flavours/classic/config/flavour_assets/hooks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions flavours/classic/config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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) ####
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 8390458

Please sign in to comment.