mirror of
https://github.com/bonfire-networks/bonfire-app.git
synced 2024-05-15 07:32:42 +00:00
federate & misc
This commit is contained in:
parent
37eb1b7079
commit
9951889367
2
Makefile
2
Makefile
|
@ -297,6 +297,8 @@ git.publish:
|
|||
|
||||
test.env:
|
||||
$(eval export MIX_ENV=test)
|
||||
$(eval export SERVER_PORT=4001)
|
||||
$(eval export PUBLIC_PORT=4001)
|
||||
|
||||
test.env.server: test.env
|
||||
$(eval export START_SERVER=true)
|
||||
|
|
|
@ -7,8 +7,9 @@ config :bonfire, :ui,
|
|||
instance_logo: "https://bonfirenetworks.org/img/bonfire.png",
|
||||
instance_image: "https://bonfirenetworks.org/img/4.png",
|
||||
instance_description: "This is a bonfire demo instance for testing purposes",
|
||||
instance_welcome_title: "About",
|
||||
instance_welcome_description: "## 👋 Welcome to the bonfire testing instance
|
||||
instance_welcome: [
|
||||
title: "About",
|
||||
description: "## 👋 Welcome to the bonfire testing instance
|
||||
<div class='shadow-lg alert alert-warning'>
|
||||
<span>Warning: Bonfire is in alpha and some things may not work as expected.</span>
|
||||
</div>
|
||||
|
@ -19,8 +20,14 @@ The bonfire ecosystem will include:
|
|||
3. Bonfire device: A plug-and-play device to have anything you need in your hands (literally).
|
||||
4. Bonfire cloud services: Your public identity in the cloud can receive messages even when your device is offline. Syncs your Bonfire device with the fediverse, and deletes already-synced data from the cloud. Open source so others can host equivalent services.
|
||||
|
||||
More details at https://bonfirenetworks.org"
|
||||
],
|
||||
More details at https://bonfirenetworks.org",
|
||||
links: [
|
||||
"About Bonfire": "https://bonfirenetworks.org/",
|
||||
"Forum": "https://socialhub.activitypub.rocks/g/bonfire/activity/posts",
|
||||
"Community Chat": "https://matrix.to/#/%23bonfire-networks:matrix.org",
|
||||
"Contribute": "https://bonfirenetworks.org/contribute/"
|
||||
]
|
||||
]],
|
||||
sidebar_components: [
|
||||
{Bonfire.UI.Social.SidebarNavigationLive, []},
|
||||
],
|
||||
|
|
|
@ -15,6 +15,7 @@ postgrex = ">= 0.0.0"
|
|||
pointers_ulid = "~> 0.2.2"
|
||||
pointers = "~> 0.5.1"
|
||||
# misc
|
||||
floki = "~> 0.32.1"
|
||||
recase = "~> 0.7" # string recasing
|
||||
faker = "~> 0.16" # fake data generation
|
||||
telemetry = "~> 1.0"
|
||||
|
|
|
@ -7,16 +7,24 @@ config :bonfire, :ui,
|
|||
instance_logo: "https://bonfirenetworks.org/img/bonfire.png",
|
||||
instance_image: "https://bonfirenetworks.org/img/4.png",
|
||||
instance_description: "This is a bonfire demo instance for testing purposes",
|
||||
instance_welcome_title: "👋 Welcome to our first testing instance",
|
||||
instance_welcome_description: "Bonfire is a federated social networking toolkit for communities and individuals to design, operate and control their digital lives, by assembling their own social networks like lego blocks in order to cultivate safe and private spaces while being interconnected with the rest of the 'fediverse' and the internet at wide on their own terms.
|
||||
instance_welcome: [
|
||||
title: "👋 Welcome to our first testing instance",
|
||||
description: "Bonfire is a federated social networking toolkit for communities and individuals to design, operate and control their digital lives, by assembling their own social networks like lego blocks in order to cultivate safe and private spaces while being interconnected with the rest of the 'fediverse' and the internet at wide on their own terms.
|
||||
The bonfire ecosystem will include:
|
||||
1. Bonfire apps/flavours: Open source federated networks that are ready to be installed and used for different purposes. Made up of a set of pre-configured extensions.
|
||||
2. Bonfire extensions: Forkable/customisable modules providing different features or UX, ready to be used within bonfire apps.
|
||||
2. Bonfire extensions: Forkable/customisable modules providing different features or UX, ready to be used within bonfire apps.
|
||||
3. Bonfire device: A plug-and-play device to have anything you need in your hands (literally).
|
||||
4. Bonfire cloud services: Your public identity in the cloud can receive messages even when your device is offline. Syncs your Bonfire device with the fediverse, and deletes already-synced data from the cloud. Open source so others can host equivalent services.
|
||||
4. Bonfire cloud services: Your public identity in the cloud can receive messages even when your device is offline. Syncs your Bonfire device with the fediverse, and deletes already-synced data from the cloud. Open source so others can host equivalent services.
|
||||
|
||||
More details at https://bonfirenetworks.org"
|
||||
],
|
||||
More details at https://bonfirenetworks.org",
|
||||
links: [
|
||||
"About Bonfire": "https://bonfirenetworks.org/",
|
||||
"About ValueFlows": "https://valueflo.ws/",
|
||||
"Forum": "https://socialhub.activitypub.rocks/g/bonfire/activity/posts",
|
||||
"Community Chat": "https://matrix.to/#/%23bonfire-networks:matrix.org",
|
||||
"Contribute": "https://bonfirenetworks.org/contribute/"
|
||||
]
|
||||
]],
|
||||
app_menu_extension_paths: %{ # TODO: make dynamic based on active extensions
|
||||
"Social" => Bonfire.Social.Web.HomeLive,
|
||||
"Breadpub" => Bonfire.Breadpub.Web.HomeLive,
|
||||
|
|
|
@ -14,6 +14,7 @@ postgrex = ">= 0.0.0"
|
|||
pointers_ulid = "~> 0.2.2"
|
||||
pointers = "~> 0.5.1"
|
||||
# misc
|
||||
floki = "~> 0.32.1"
|
||||
recase = "~> 0.7" # string recasing
|
||||
faker = "~> 0.17" # fake data generation
|
||||
telemetry = "~> 1.0"
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
defmodule Bonfire.Repo.Migrations.ImportSettings do
|
||||
use Ecto.Migration
|
||||
require Bonfire.Data.Identity.Settings.Migration
|
||||
|
||||
def change do
|
||||
Bonfire.Data.Identity.Settings.Migration.migrate_settings()
|
||||
end
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
defmodule Bonfire.Repo.Migrations.ImportSettings do
|
||||
use Ecto.Migration
|
||||
require Bonfire.Data.Identity.Settings.Migration
|
||||
|
||||
def change do
|
||||
Bonfire.Data.Identity.Settings.Migration.migrate_settings()
|
||||
end
|
||||
end
|
|
@ -2,6 +2,7 @@ import Config
|
|||
|
||||
config :activity_pub, :adapter, Bonfire.Federate.ActivityPub.Adapter
|
||||
config :activity_pub, :repo, Bonfire.Repo
|
||||
config :activity_pub, :env, Mix.env()
|
||||
|
||||
config :nodeinfo, :adapter, Bonfire.Federate.ActivityPub.NodeinfoAdapter
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ config :activity_pub, Oban,
|
|||
queues: false
|
||||
|
||||
config :activity_pub, :instance,
|
||||
federating: false
|
||||
federating: false #(if System.get_env("TEST_INSTANCE")=="yes", do: true, else: false)
|
||||
# rewrite_policy: [ActivityPub.MRF.SimplePolicy]
|
||||
|
||||
config :tesla, adapter: Tesla.Mock
|
||||
|
|
|
@ -6,7 +6,14 @@ config :bonfire, :ui,
|
|||
instance_name: "Reflow Demo",
|
||||
instance_logo: "https://reflowproject.eu/wp-content/themes/reflow/images/logoWhite.svg",
|
||||
instance_image: "https://reflowproject.eu/wp-content/uploads/2020/06/reflow-blog-1600x900.jpg",
|
||||
instance_description: "This is a Reflow demo instance"
|
||||
instance_description: "This is a Reflow demo instance",
|
||||
instance_welcome: [
|
||||
links: [
|
||||
"About Bonfire": "https://bonfirenetworks.org/",
|
||||
"About Reflow": "https://reflowproject.eu/",
|
||||
"Contribute": "https://bonfirenetworks.org/contribute/"
|
||||
]
|
||||
]
|
||||
],
|
||||
sidebar_components: [
|
||||
{Bonfire.UI.Social.SidebarNavigationLive, []},
|
||||
|
|
|
@ -2,4 +2,4 @@ import Config
|
|||
|
||||
config :bonfire_valueflows,
|
||||
valid_agent_schemas: [Bonfire.Data.Identity.User],
|
||||
preset_boundary: "local"
|
||||
preset_boundary: "public"
|
||||
|
|
|
@ -13,6 +13,7 @@ postgrex = ">= 0.0.0"
|
|||
pointers_ulid = "~> 0.2.2"
|
||||
pointers = "~> 0.5.1"
|
||||
# misc
|
||||
floki = "~> 0.32.1"
|
||||
recase = "~> 0.7" # string recasing
|
||||
faker = "~> 0.16" # fake data generation
|
||||
telemetry = "~> 1.0"
|
||||
|
|
|
@ -29,11 +29,24 @@ config :bonfire, Bonfire.Repo,
|
|||
database: db,
|
||||
slow_query_ms: 500
|
||||
|
||||
# We don't run a server during test. If one is required,
|
||||
# you can enable the server option below.
|
||||
# These defaults are overriden in runtime.exs
|
||||
config :bonfire, Bonfire.Web.Endpoint,
|
||||
http: [port: 4000],
|
||||
server: false
|
||||
http: [port: 4001],
|
||||
server: (if System.get_env("TEST_INSTANCE")=="yes", do: true, else: false)
|
||||
|
||||
# Run a 2nd endpoint for testing federation (not currently used)
|
||||
config :bonfire, Bonfire.Web.FakeRemoteEndpoint,
|
||||
server: true,
|
||||
url: [
|
||||
host: "localhost",
|
||||
port: 4002
|
||||
],
|
||||
http: [
|
||||
port: 4002
|
||||
],
|
||||
secret_key_base: System.get_env("SECRET_KEY_BASE"),
|
||||
live_view: [signing_salt: System.get_env("SIGNING_SALT")],
|
||||
render_errors: [view: Bonfire.UI.Social.Web.ErrorView, accepts: ~w(html json), layout: false]
|
||||
|
||||
config :bonfire, Oban,
|
||||
crontab: false,
|
||||
|
@ -52,3 +65,5 @@ config :paginator, Paginator.Repo,
|
|||
password: System.get_env("POSTGRES_PASSWORD", "postgres"),
|
||||
hostname: System.get_env("POSTGRES_HOST", "localhost"),
|
||||
database: db
|
||||
|
||||
config :tesla, adapter: (if System.get_env("TEST_INSTANCE")=="yes", do: Tesla.Adapter.Hackney, else: Tesla.Mock)
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
defmodule Bonfire.Repo.Migrations.ImportSettings do
|
||||
use Ecto.Migration
|
||||
require Bonfire.Data.Identity.Settings.Migration
|
||||
|
||||
def change do
|
||||
Bonfire.Data.Identity.Settings.Migration.migrate_settings()
|
||||
end
|
||||
end
|
|
@ -14,6 +14,7 @@ postgrex = ">= 0.0.0"
|
|||
pointers_ulid = "~> 0.2.2"
|
||||
pointers = "~> 0.5.1"
|
||||
# misc
|
||||
floki = "~> 0.32.1"
|
||||
recase = "~> 0.7" # string recasing
|
||||
faker = "~> 0.17" # fake data generation
|
||||
telemetry = "~> 1.0"
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
defmodule Bonfire.Repo.Migrations.ImportSettings do
|
||||
use Ecto.Migration
|
||||
require Bonfire.Data.Identity.Settings.Migration
|
||||
|
||||
def change do
|
||||
Bonfire.Data.Identity.Settings.Migration.migrate_settings()
|
||||
end
|
||||
end
|
|
@ -3,9 +3,11 @@ defmodule Bonfire.Application do
|
|||
@sup_name Bonfire.Supervisor
|
||||
@name Mix.Project.config()[:name]
|
||||
@otp_app Bonfire.Common.Config.get!(:otp_app)
|
||||
@env Bonfire.Common.Config.get!(:env)
|
||||
@version Mix.Project.config()[:version]
|
||||
@repository Mix.Project.config()[:source_url]
|
||||
@deps Bonfire.Common.Extend.loaded_deps()
|
||||
@endpoint_module Bonfire.Common.Config.get!(:endpoint_module)
|
||||
|
||||
use Application
|
||||
|
||||
|
@ -16,36 +18,37 @@ defmodule Bonfire.Application do
|
|||
:telemetry.attach("oban-errors", [:oban, :job, :exception], &Bonfire.ObanLogger.handle_event/4, [])
|
||||
Oban.Telemetry.attach_default_logger()
|
||||
|
||||
applications() #|> IO.inspect
|
||||
applications(@env, Bonfire.Common.Extend.module_enabled?(Bonfire.API.GraphQL) and Bonfire.Common.Extend.module_enabled?(Bonfire.API.GraphQL.Schema)) #|> IO.inspect
|
||||
|> Supervisor.start_link(strategy: :one_for_one, name: @sup_name)
|
||||
end
|
||||
|
||||
def applications(with_graphql? \\ Code.ensure_loaded?(Bonfire.API.GraphQL.Schema)) # TODO better
|
||||
|
||||
def applications(true = _with_graphql?) do # include GraphQL API
|
||||
def applications(env, true = _with_graphql?) do # include GraphQL API
|
||||
[
|
||||
{Absinthe.Schema, Bonfire.API.GraphQL.Schema} # use persistent_term backend for Absinthe
|
||||
]
|
||||
++ applications(nil)
|
||||
++ applications(env, :default)
|
||||
++
|
||||
[
|
||||
{Absinthe.Subscription, Bonfire.Web.Endpoint}
|
||||
{Absinthe.Subscription, @endpoint_module}
|
||||
]
|
||||
end
|
||||
|
||||
def applications(_) do # default apps
|
||||
[ Bonfire.Web.Telemetry, # Metrics
|
||||
Bonfire.Repo, # Database
|
||||
EctoSparkles.AutoMigrator,
|
||||
{Phoenix.PubSub, [name: Bonfire.PubSub, adapter: Phoenix.PubSub.PG2]}, # PubSub
|
||||
# Persistent Data Services
|
||||
Pointers.Tables,
|
||||
# Bonfire.Data.AccessControl.Accesses,
|
||||
Bonfire.Common.ContextModules,
|
||||
Bonfire.Common.QueryModules,
|
||||
Bonfire.Federate.ActivityPub.FederationModules,
|
||||
# Stuff that uses all the above
|
||||
Bonfire.Web.Endpoint, # Web app
|
||||
@apps_before [
|
||||
Bonfire.Web.Telemetry, # Metrics
|
||||
Bonfire.Repo, # Database
|
||||
EctoSparkles.AutoMigrator,
|
||||
{Phoenix.PubSub, [name: Bonfire.PubSub, adapter: Phoenix.PubSub.PG2]}, # PubSub
|
||||
# Persistent Data Services
|
||||
Pointers.Tables,
|
||||
# Bonfire.Data.AccessControl.Accesses,
|
||||
Bonfire.Common.ContextModules,
|
||||
Bonfire.Common.QueryModules,
|
||||
Bonfire.Federate.ActivityPub.FederationModules
|
||||
]
|
||||
|
||||
# Stuff that depends on all the above
|
||||
@apps_after [
|
||||
@endpoint_module, # Web app
|
||||
{Oban, Application.fetch_env!(:bonfire, Oban)}, # Job Queue
|
||||
%{
|
||||
id: :cachex_settings,
|
||||
|
@ -56,12 +59,21 @@ defmodule Bonfire.Application do
|
|||
limit: 2500 # increase for instances with more users (at least num. of users*2+1)
|
||||
]]}},
|
||||
]
|
||||
|
||||
def applications(:test, _any) do
|
||||
@apps_before
|
||||
# ++ [Bonfire.Web.FakeRemoteEndpoint]
|
||||
++ @apps_after
|
||||
end
|
||||
|
||||
def applications(_env, _any) do # default apps
|
||||
@apps_before ++ @apps_after
|
||||
end
|
||||
|
||||
# Tell Phoenix to update the endpoint configuration
|
||||
# whenever the application is updated.
|
||||
def config_change(changed, _new, removed) do
|
||||
Bonfire.Web.Endpoint.config_change(changed, removed)
|
||||
@endpoint_module.config_change(changed, removed)
|
||||
:ok
|
||||
end
|
||||
|
||||
|
|
|
@ -1,103 +1,3 @@
|
|||
defmodule Bonfire.Web.Endpoint do
|
||||
use Sentry.PlugCapture
|
||||
use Phoenix.Endpoint, otp_app: :bonfire
|
||||
alias Bonfire.Common.Utils
|
||||
alias Bonfire.Common.Config
|
||||
import Bonfire.Common.Extend
|
||||
|
||||
use_if_enabled Absinthe.Phoenix.Endpoint
|
||||
|
||||
# The session will be stored in the cookie and signed,
|
||||
# this means its contents can be read but not tampered with.
|
||||
# Set :encryption_salt if you would also like to encrypt it.
|
||||
@session_options [
|
||||
store: :cookie,
|
||||
key: "_bonfire_key",
|
||||
signing_salt: Config.get!(:signing_salt),
|
||||
encryption_salt: Config.get!(:encryption_salt)
|
||||
]
|
||||
|
||||
socket "/live", Phoenix.LiveView.Socket,
|
||||
websocket: [connect_info: [session: @session_options]]
|
||||
|
||||
if module_enabled?(Bonfire.API.GraphQL.UserSocket) do
|
||||
socket "/api/socket", Bonfire.API.GraphQL.UserSocket,
|
||||
websocket: true,
|
||||
longpoll: false
|
||||
end
|
||||
|
||||
# plug Plug.Static,
|
||||
# at: "/data/uploads",
|
||||
# from: {:bonfire, "data/uploads"},
|
||||
# gzip: false
|
||||
|
||||
# Serve at "/" the static files from "priv/static" directory.
|
||||
#
|
||||
# You should set gzip to true if you are running phx.digest
|
||||
# when deploying your static files in production.
|
||||
plug Plug.Static,
|
||||
at: "/",
|
||||
from: :bonfire,
|
||||
gzip: true,
|
||||
only: ~w(css fonts images js favicon.ico robots.txt cache_manifest.json favicon.ico source.tar.gz)
|
||||
|
||||
plug Plug.Static,
|
||||
at: "/data/uploads/",
|
||||
from: "data/uploads",
|
||||
gzip: true
|
||||
|
||||
plug Plug.Static,
|
||||
at: "/",
|
||||
from: :livebook,
|
||||
gzip: true,
|
||||
only: ~w(images js)
|
||||
|
||||
plug Plug.Static,
|
||||
at: "/livebook/",
|
||||
from: :livebook,
|
||||
gzip: true,
|
||||
only: ~w(css images js favicon.ico robots.txt cache_manifest.json)
|
||||
|
||||
# Code reloading can be explicitly enabled under the
|
||||
# :code_reloader configuration of your endpoint.
|
||||
if code_reloading? do
|
||||
socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
|
||||
plug Phoenix.LiveReloader
|
||||
plug Phoenix.CodeReloader
|
||||
plug Phoenix.Ecto.CheckRepoStatus, otp_app: :bonfire
|
||||
end
|
||||
|
||||
plug Phoenix.LiveDashboard.RequestLogger,
|
||||
param_key: "request_logger",
|
||||
cookie_key: "request_logger"
|
||||
|
||||
plug Plug.RequestId
|
||||
plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
|
||||
|
||||
plug Plug.Parsers,
|
||||
parsers: [:urlencoded, :multipart, :json],
|
||||
pass: ["*/*"],
|
||||
json_decoder: Phoenix.json_library()
|
||||
plug Sentry.PlugContext
|
||||
|
||||
plug Plug.MethodOverride
|
||||
plug Plug.Head
|
||||
plug Plug.Session, @session_options
|
||||
|
||||
plug Bonfire.Web.Router
|
||||
|
||||
def include_assets(conn) do
|
||||
js = if Utils.e(conn, :assigns, :current_account, nil) || Utils.e(conn, :assigns, :current_user, nil) do
|
||||
static_path("/js/bonfire_live.js")
|
||||
else
|
||||
static_path("/js/bonfire_basic.js")
|
||||
end
|
||||
|
||||
# if Config.get!(:env) == :dev do
|
||||
# "<link phx-track-static rel='stylesheet' href='"<> static_path("/css/bonfire.css") <>"'/> <script defer phx-track-static crossorigin='anonymous' src='"<> js <>"'></script>"
|
||||
# else
|
||||
(PhoenixGon.View.render_gon_script(conn) |> Phoenix.HTML.safe_to_string) <>
|
||||
"<link phx-track-static rel='stylesheet' href='"<> static_path("/css/bonfire.css") <>"'/> <script defer phx-track-static crossorigin='anonymous' src='"<> js <>"'></script> "
|
||||
# end
|
||||
end
|
||||
use Bonfire.Web.EndpointTemplate
|
||||
end
|
||||
|
|
109
lib/web/endpoint_template.ex
Normal file
109
lib/web/endpoint_template.ex
Normal file
|
@ -0,0 +1,109 @@
|
|||
defmodule Bonfire.Web.EndpointTemplate do
|
||||
defmacro __using__(_) do
|
||||
quote do
|
||||
use Phoenix.Endpoint, otp_app: :bonfire
|
||||
use Sentry.PlugCapture
|
||||
alias Bonfire.Common.Utils
|
||||
alias Bonfire.Common.Config
|
||||
import Bonfire.Common.Extend
|
||||
|
||||
use_if_enabled Absinthe.Phoenix.Endpoint
|
||||
|
||||
# The session will be stored in the cookie and signed,
|
||||
# this means its contents can be read but not tampered with.
|
||||
# Set :encryption_salt if you would also like to encrypt it.
|
||||
@session_options [
|
||||
store: :cookie,
|
||||
key: "_bonfire_key",
|
||||
signing_salt: Config.get!(:signing_salt),
|
||||
encryption_salt: Config.get!(:encryption_salt)
|
||||
]
|
||||
|
||||
socket "/live", Phoenix.LiveView.Socket,
|
||||
websocket: [connect_info: [session: @session_options]]
|
||||
|
||||
if module_enabled?(Bonfire.API.GraphQL.UserSocket) do
|
||||
socket "/api/socket", Bonfire.API.GraphQL.UserSocket,
|
||||
websocket: true,
|
||||
longpoll: false
|
||||
end
|
||||
|
||||
# plug Plug.Static,
|
||||
# at: "/data/uploads",
|
||||
# from: {:bonfire, "data/uploads"},
|
||||
# gzip: false
|
||||
|
||||
# Serve at "/" the static files from "priv/static" directory.
|
||||
#
|
||||
# You should set gzip to true if you are running phx.digest
|
||||
# when deploying your static files in production.
|
||||
plug Plug.Static,
|
||||
at: "/",
|
||||
from: :bonfire,
|
||||
gzip: true,
|
||||
only: ~w(css fonts images js favicon.ico robots.txt cache_manifest.json favicon.ico source.tar.gz)
|
||||
|
||||
plug Plug.Static,
|
||||
at: "/data/uploads/",
|
||||
from: "data/uploads",
|
||||
gzip: true
|
||||
|
||||
plug Plug.Static,
|
||||
at: "/",
|
||||
from: :livebook,
|
||||
gzip: true,
|
||||
only: ~w(images js)
|
||||
|
||||
plug Plug.Static,
|
||||
at: "/livebook/",
|
||||
from: :livebook,
|
||||
gzip: true,
|
||||
only: ~w(css images js favicon.ico robots.txt cache_manifest.json)
|
||||
|
||||
# Code reloading can be explicitly enabled under the
|
||||
# :code_reloader configuration of your endpoint.
|
||||
# FIXME: doesn't work when defined in template macro
|
||||
# if code_reloading? do
|
||||
# socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
|
||||
# plug Phoenix.LiveReloader
|
||||
# plug Phoenix.CodeReloader
|
||||
# plug Phoenix.Ecto.CheckRepoStatus, otp_app: :bonfire
|
||||
# end
|
||||
|
||||
plug Phoenix.LiveDashboard.RequestLogger,
|
||||
param_key: "request_logger",
|
||||
cookie_key: "request_logger"
|
||||
|
||||
plug Plug.RequestId
|
||||
plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]
|
||||
|
||||
plug Plug.Parsers,
|
||||
parsers: [:urlencoded, :multipart, :json],
|
||||
pass: ["*/*"],
|
||||
json_decoder: Phoenix.json_library()
|
||||
plug Sentry.PlugContext
|
||||
|
||||
plug Plug.MethodOverride
|
||||
plug Plug.Head
|
||||
plug Plug.Session, @session_options
|
||||
|
||||
plug Bonfire.Web.Router
|
||||
|
||||
def include_assets(conn) do
|
||||
js = if Utils.e(conn, :assigns, :current_account, nil) || Utils.e(conn, :assigns, :current_user, nil) do
|
||||
static_path("/js/bonfire_live.js")
|
||||
else
|
||||
static_path("/js/bonfire_basic.js")
|
||||
end
|
||||
|
||||
# if Config.get!(:env) == :dev do
|
||||
# "<link phx-track-static rel='stylesheet' href='"<> static_path("/css/bonfire.css") <>"'/> <script defer phx-track-static crossorigin='anonymous' src='"<> js <>"'></script>"
|
||||
# else
|
||||
(PhoenixGon.View.render_gon_script(conn) |> Phoenix.HTML.safe_to_string) <>
|
||||
"<link phx-track-static rel='stylesheet' href='"<> static_path("/css/bonfire.css") <>"'/> <script defer phx-track-static crossorigin='anonymous' src='"<> js <>"'></script> "
|
||||
# end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
3
lib/web/fake_remote_endpoint.ex
Normal file
3
lib/web/fake_remote_endpoint.ex
Normal file
|
@ -0,0 +1,3 @@
|
|||
defmodule Bonfire.Web.FakeRemoteEndpoint do
|
||||
use Bonfire.Web.EndpointTemplate
|
||||
end
|
|
@ -1,4 +1,7 @@
|
|||
defmodule Bonfire.Web.HomeLive do
|
||||
@moduledoc """
|
||||
The main instance home page, mainly for guests visiting the instance
|
||||
"""
|
||||
use Bonfire.Web, {:surface_view, [layout: {Bonfire.UI.Social.Web.LayoutView, "without_sidebar.html"}]}
|
||||
alias Bonfire.Web.LivePlugs
|
||||
alias Bonfire.Common.Utils
|
||||
|
@ -14,16 +17,22 @@ defmodule Bonfire.Web.HomeLive do
|
|||
end
|
||||
|
||||
defp mounted(_params, _session, socket) do
|
||||
welcome = Bonfire.Common.Config.get([:ui, :theme, :instance_welcome_description], "Login or register to play around")
|
||||
|> Utils.md
|
||||
welcome_title = Bonfire.Common.Config.get([:ui, :theme, :instance_welcome_title], "About")
|
||||
title = "Recent activity on this instance"
|
||||
instance_name = Bonfire.Common.Config.get([:ui, :theme, :instance_name], l "An instance of Bonfire")
|
||||
links = Bonfire.Common.Config.get([:ui, :theme, :instance_welcome, :links], %{
|
||||
"https://bonfirenetworks.org/"=> l("About Bonfire"),
|
||||
"https://bonfirenetworks.org/contribute/"=> l("Contribute")
|
||||
})
|
||||
welcome_title = Bonfire.Common.Config.get([:ui, :theme, :instance_welcome, :title], l "About")
|
||||
welcome_text = (
|
||||
Bonfire.Common.Config.get([:ui, :theme, :instance_welcome, :description], nil)
|
||||
|| Bonfire.Common.Config.get([:ui, :theme, :instance_description], l "Welcome")
|
||||
) |> Utils.md
|
||||
{:ok, socket
|
||||
|> assign(
|
||||
page_title: "A Bonfire Instance",
|
||||
feed_title: title,
|
||||
page_title: instance_name,
|
||||
welcome_title: welcome_title,
|
||||
welcome: welcome
|
||||
welcome: welcome_text,
|
||||
links: links
|
||||
)}
|
||||
end
|
||||
|
||||
|
|
|
@ -18,7 +18,8 @@
|
|||
widget_title={"Relevant links"}
|
||||
current_user={current_user(assigns)}
|
||||
>
|
||||
<Bonfire.UI.Social.WidgetInstanceLinksLive />
|
||||
<Bonfire.UI.Social.WidgetInstanceLinksLive
|
||||
links={@links} />
|
||||
</Bonfire.UI.Social.WidgetLive>
|
||||
|
||||
</div>
|
||||
|
|
15
mix.lock
15
mix.lock
|
@ -12,11 +12,11 @@
|
|||
"benchee": {:hex, :benchee, "1.1.0", "f3a43817209a92a1fade36ef36b86e1052627fd8934a8b937ac9ab3a76c43062", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}], "hexpm", "7da57d545003165a012b587077f6ba90b89210fd88074ce3c60ce239eb5e6d93"},
|
||||
"benchee_html": {:hex, :benchee_html, "1.0.0", "5b4d24effebd060f466fb460ec06576e7b34a00fc26b234fe4f12c4f05c95947", [:mix], [{:benchee, ">= 0.99.0 and < 2.0.0", [hex: :benchee, repo: "hexpm", optional: false]}, {:benchee_json, "~> 1.0", [hex: :benchee_json, repo: "hexpm", optional: false]}], "hexpm", "5280af9aac432ff5ca4216d03e8a93f32209510e925b60e7f27c33796f69e699"},
|
||||
"benchee_json": {:hex, :benchee_json, "1.0.0", "cc661f4454d5995c08fe10dd1f2f72f229c8f0fb1c96f6b327a8c8fc96a91fe5", [:mix], [{:benchee, ">= 0.99.0 and < 2.0.0", [hex: :benchee, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "da05d813f9123505f870344d68fb7c86a4f0f9074df7d7b7e2bb011a63ec231c"},
|
||||
"bonfire_api_graphql": {:git, "https://github.com/bonfire-networks/bonfire_api_graphql", "5aef151da0e3b0e0963850e93b2f8a3ba180b984", [branch: "main"]},
|
||||
"bonfire_api_graphql": {:git, "https://github.com/bonfire-networks/bonfire_api_graphql", "896742c43dc91329f36cf59881bb3c5e1834f750", [branch: "main"]},
|
||||
"bonfire_boundaries": {:git, "https://github.com/bonfire-networks/bonfire_boundaries", "17577b494213669149f9417411e8461582d5eb24", [branch: "main"]},
|
||||
"bonfire_breadpub": {:git, "https://github.com/bonfire-networks/bonfire_breadpub", "7bab1eebe46c091e9e1d79a485e91c5d94956922", [branch: "main"]},
|
||||
"bonfire_classify": {:git, "https://github.com/bonfire-networks/bonfire_classify", "7084e9704d6ebbc3011e1fb4af365691f8daf0e3", [branch: "main"]},
|
||||
"bonfire_common": {:git, "https://github.com/bonfire-networks/bonfire_common", "1e081d4171151798a9d7e5294606f8f0e634059c", [branch: "main"]},
|
||||
"bonfire_classify": {:git, "https://github.com/bonfire-networks/bonfire_classify", "42a6116995ee792cedf55cb95e73720fedbb9449", [branch: "main"]},
|
||||
"bonfire_common": {:git, "https://github.com/bonfire-networks/bonfire_common", "607812581a54c4223bdba59859ab1f4785e6bd8e", [branch: "main"]},
|
||||
"bonfire_data_access_control": {:git, "https://github.com/bonfire-networks/bonfire_data_access_control", "371c12e51db03dde11219b37ae2b768f6fd8aa2e", [branch: "main"]},
|
||||
"bonfire_data_activity_pub": {:git, "https://github.com/bonfire-networks/bonfire_data_activity_pub", "5522116c8e5b1a6264fe87139c0a0345aa715cd9", [branch: "main"]},
|
||||
"bonfire_data_assort": {:git, "https://github.com/bonfire-networks/bonfire_data_assort", "703fffbde20d49d38f938f1cb7b967af9043bd0f", []},
|
||||
|
@ -33,15 +33,15 @@
|
|||
"bonfire_geolocate": {:git, "https://github.com/bonfire-networks/bonfire_geolocate", "ff16ed7cf8bb0ad60441ef097f0099c8f6dfa1cf", [branch: "main"]},
|
||||
"bonfire_invite_links": {:git, "https://github.com/bonfire-networks/bonfire_invite_links", "518734b7309644e92ff603b1e8e21f59bae253c1", [branch: "main"]},
|
||||
"bonfire_mailer": {:git, "https://github.com/bonfire-networks/bonfire_mailer", "efaa2df39cd3fc121e68dec801f91ccc933479c4", [branch: "main"]},
|
||||
"bonfire_me": {:git, "https://github.com/bonfire-networks/bonfire_me", "cfd2100e2fc17fb8359d282b09ac339d0f8c8011", [branch: "main"]},
|
||||
"bonfire_me": {:git, "https://github.com/bonfire-networks/bonfire_me", "392a2731895bc04c706b727692ee445662a9314b", [branch: "main"]},
|
||||
"bonfire_quantify": {:git, "https://github.com/bonfire-networks/bonfire_quantify", "22359a1ff460bceb5d6e2c19e5ada2d4f529ff28", [branch: "main"]},
|
||||
"bonfire_search": {:git, "https://github.com/bonfire-networks/bonfire_search", "99533436c3277732c55bfca335becb7c9971af3a", [branch: "main"]},
|
||||
"bonfire_social": {:git, "https://github.com/bonfire-networks/bonfire_social", "29e378f9100e3b2ec392a486b7d80511ff80174c", [branch: "main"]},
|
||||
"bonfire_social": {:git, "https://github.com/bonfire-networks/bonfire_social", "1e4c06491e85609309ffe70e8465bdfd43744752", [branch: "main"]},
|
||||
"bonfire_tag": {:git, "https://github.com/bonfire-networks/bonfire_tag", "6d45d1439ccc90e1c3c7f6308f78038439c7a7dd", [branch: "main"]},
|
||||
"bonfire_ui_coordination": {:git, "https://github.com/bonfire-networks/bonfire_ui_coordination", "cf3eb7c77d945be90c977e166f6b73edccfe63b7", [branch: "main"]},
|
||||
"bonfire_ui_kanban": {:git, "https://github.com/bonfire-networks/bonfire_ui_kanban", "ef31831a037924ac5fa5d1f7f38d102bf4b45087", [branch: "main"]},
|
||||
"bonfire_ui_reflow": {:git, "https://github.com/bonfire-networks/bonfire_ui_reflow", "081ae3be59ac8877e5d14699233cb1d31dda6680", [branch: "main"]},
|
||||
"bonfire_ui_social": {:git, "https://github.com/bonfire-networks/bonfire_ui_social", "ff5d8130381cb7729af1060723dd25d13911a2be", [branch: "main"]},
|
||||
"bonfire_ui_social": {:git, "https://github.com/bonfire-networks/bonfire_ui_social", "55b1bbe94ab99e56ac1fe90dd00d1280c9fb7cf5", [branch: "main"]},
|
||||
"bonfire_ui_valueflows": {:git, "https://github.com/bonfire-networks/bonfire_ui_valueflows", "6fc06c2fcfc49730ff6c95d455fe06eda5550a75", [branch: "main"]},
|
||||
"bonfire_upcycle": {:git, "https://gitlab.com/bonfire-networks/bonfire_upcycle", "ac6f28566d96770d7ea97c2cfbc94b0614282aea", []},
|
||||
"bonfire_valueflows": {:git, "https://github.com/bonfire-networks/bonfire_valueflows", "47759d96e875e0ecd25eeffa1911ad92d290418a", [branch: "main"]},
|
||||
|
@ -83,6 +83,7 @@
|
|||
"exsync": {:hex, :exsync, "0.2.4", "5cdc824553e0f4c4bf60018a9a6bbd5d3b51f93ef8401a0d8545f93127281d03", [:mix], [{:file_system, "~> 0.2", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "f7622d8bb98abbe473aa066ae46f91afdf7a5346b8b89728404f7189d2e80896"},
|
||||
"faker": {:hex, :faker, "0.17.0", "671019d0652f63aefd8723b72167ecdb284baf7d47ad3a82a15e9b8a6df5d1fa", [:mix], [], "hexpm", "a7d4ad84a93fd25c5f5303510753789fc2433ff241bf3b4144d3f6f291658a6a"},
|
||||
"fast_ngram": {:hex, :fast_ngram, "1.2.0", "0652c25d3f66e69e6780121cf19200442fe70da689b39ccaa8998da6ee2f65cc", [:mix], [], "hexpm", "90c949c5b00314d8117a5bf2fbf6a05ef945ce4cad66a47bc26f8d9ec30dc1bd"},
|
||||
"fetch_favicon": {:hex, :fetch_favicon, "0.1.3", "379533b622d6a62dfd054dc323b6b4f74f687db412df65867426aaf06edeb5ef", [:mix], [{:floki, "~> 0.20.0", [hex: :floki, repo: "hexpm", optional: false]}, {:httpoison, "~> 1.0", [hex: :httpoison, repo: "hexpm", optional: false]}], "hexpm", "b76f3be52e886cb85684128d002e0044453e6f9832a9a2498d90829229eb3eb1"},
|
||||
"file_info": {:hex, :file_info, "0.0.4", "2e0e77f211e833f38ead22cb29ce53761d457d80b3ffe0ffe0eb93880b0963b2", [:mix], [{:mimetype_parser, "~> 0.1.2", [hex: :mimetype_parser, repo: "hexpm", optional: false]}], "hexpm", "50e7ad01c2c8b9339010675fe4dc4a113b8d6ca7eddce24d1d74fd0e762781a5"},
|
||||
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
|
||||
"flame_on": {:hex, :flame_on, "0.2.1", "71276592dd6bf27657e6f0186f91f7dfbd22cdf9ec3665c05d9b780e0894775b", [:mix], [{:ecto, "~> 3.7", [hex: :ecto, repo: "hexpm", optional: false]}, {:eflambe, "~> 0.2.2", [hex: :eflambe, repo: "hexpm", optional: false]}, {:gettext, "~> 0.19", [hex: :gettext, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:phoenix_ecto, "~> 4.4", [hex: :phoenix_ecto, repo: "hexpm", optional: false]}, {:phoenix_live_dashboard, "~> 0.6.4", [hex: :phoenix_live_dashboard, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.17.6", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}], "hexpm", "f7ac0e9a92053311dcbc2f26fde9c904015a149139646d75047a64aebd6bce82"},
|
||||
|
@ -177,6 +178,6 @@
|
|||
"verbs": {:git, "https://github.com/shannonwells/verbs_ex", "4b27067385390d4d2063ec1a09f9d96b97ed9a73", []},
|
||||
"voodoo": {:git, "https://github.com/bonfire-networks/voodoo", "a1ae5f3afdff7dc3507d160bce55ed9604796c93", [branch: "main"]},
|
||||
"waffle": {:hex, :waffle, "1.1.6", "e944b31f8a3f3b15b8ce5c6ca315cecbcbfab354c2bb83f5980c79728cf422c0", [:mix], [{:ex_aws, "~> 2.1", [hex: :ex_aws, repo: "hexpm", optional: true]}, {:ex_aws_s3, "~> 2.1", [hex: :ex_aws_s3, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: false]}, {:sweet_xml, "~> 0.6", [hex: :sweet_xml, repo: "hexpm", optional: true]}], "hexpm", "deecbf205acc5b6d0bc23d3813fa384486606a50d82b803edbd29e2a46258d4d"},
|
||||
"where": {:git, "https://github.com/bonfire-networks/where", "8e108488d9e491e30e3e2a895e2997c225279e1d", [branch: "main"]},
|
||||
"where": {:git, "https://github.com/bonfire-networks/where", "5293662f1930156f60b827c1a3d2e1dd203d63a2", [branch: "main"]},
|
||||
"zest": {:hex, :zest, "0.1.2", "ddf3a045ee32c6452b8ac050b22da0b2eceae5aaa7d63163fb09e5fbb925fbbe", [:mix], [], "hexpm", "ebe2d6acf615de286e45846a3d6daf72d7c20f2c5eefada6d8a1729256a3974a"},
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ defmodule Bonfire.ChannelCase do
|
|||
import Bonfire.ChannelCase
|
||||
|
||||
# The default endpoint for testing
|
||||
@endpoint Bonfire.Web.Endpoint
|
||||
@endpoint Bonfire.Common.Config.get!(:endpoint_module)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ defmodule Bonfire.ConnCase do
|
|||
alias Bonfire.Web.Router.Helpers, as: Routes
|
||||
|
||||
# The default endpoint for testing
|
||||
@endpoint Bonfire.Web.Endpoint
|
||||
@endpoint Bonfire.Common.Config.get!(:endpoint_module)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue