add haha academy flavour

This commit is contained in:
Mayel 2021-09-26 15:04:07 +13:00
parent 97d925fbbe
commit 7c85a4d151
69 changed files with 1588 additions and 26 deletions

1
.gitignore vendored
View file

@ -50,6 +50,7 @@ config/prod
flavours/*/config/dev/
flavours/*/config/prod/
/config
priv/seed_data
# user-local overrides for mess
deps.path

View file

@ -108,12 +108,19 @@ else
ps au | grep beam
endif
db.migrate: mix~ecto.migrate ## Run latest database migrations (eg. after adding/upgrading an app/extension)
db.seeds: mix~ecto.migrate mix~ecto.seeds ## Run latest database seeds (eg. inserting required data after adding/upgrading an app/extension)
db.reset: dev.search.reset db.pre-migrations mix~ecto.reset ## Reset the DB (caution: this means DATA LOSS)
dev.search.reset:
ifeq ($(WITH_DOCKER), total)
ifeq ($(WITH_DOCKER), no)
echo ...
else
@docker-compose rm -s -v search
endif
rm -rf data/search/dev
db.rollback: mix~ecto.rollback ## Rollback previous DB migration (caution: this means DATA LOSS)

View file

@ -1,15 +0,0 @@
defmodule Bonfire.Repo.Migrations.TaxonomySeeder do
use Ecto.Migration
# def up do
# Bonfire.TaxonomySeeder.Migrations.up()
# Bonfire.TaxonomySeeder.Migrations.add_category()
# end
# def down do
# Bonfire.TaxonomySeeder.Migrations.down()
# end
def change, do: nil
end

View file

@ -6,7 +6,7 @@ config :bonfire, :ui,
instance_name: "Bonfire",
instance_logo: "https://bonfirenetworks.org/img/bonfire.png",
instance_image: "https://bonfirenetworks.org/img/brand2.png",
instance_description: "This is a bonfire demo instance for testing purpose"
instance_description: "This is a bonfire demo instance for testing purposes"
],
sidebar_components: [
{Bonfire.UI.Social.SidebarNavigationLive, []},

View file

@ -1,15 +1,15 @@
defmodule Bonfire.Repo.Migrations.TaxonomySeeder do
use Ecto.Migration
# def up do
# Bonfire.TaxonomySeeder.Migrations.up()
# Bonfire.TaxonomySeeder.Migrations.add_category()
# end
def up do
Bonfire.TaxonomySeeder.Migrations.up()
Bonfire.TaxonomySeeder.Migrations.add_category()
end
# def down do
# Bonfire.TaxonomySeeder.Migrations.down()
# end
def down do
Bonfire.TaxonomySeeder.Migrations.down()
end
def change, do: nil
# def change, do: nil
end

View file

@ -0,0 +1,113 @@
| Package | License | Version | Link |
|------------------------------|------------------------------------|-----------|------------------------------------------------------------------|
| activity_pub | AGPL v3 | 0.1.0 | https://github.com/bonfire-networks/activity_pub |
| argon2_elixir | Apache 2.0 | ~> 2.3.0 | https://hex.pm/packages/argon2_elixir |
| bamboo | MIT | 1.7.1 | https://hex.pm/packages/bamboo |
| bamboo_smtp | MIT | 3.0.0 | https://hex.pm/packages/bamboo_smtp |
| bonfire_boundaries | MPL 2.0 | 0.1.0 | https://github.com/bonfire-networks/bonfire_boundaries |
| bonfire_common | MPL 2.0 | 0.1.0 | https://github.com/bonfire-networks/bonfire_common |
| bonfire_data_access_control | MPL 2.0 | 0.1.0 | https://github.com/bonfire-networks/bonfire_data_access_control |
| bonfire_data_activity_pub | MPL 2.0 | 0.1.0 | https://github.com/bonfire-networks/bonfire_data_activity_pub |
| bonfire_data_identity | MPL 2.0 | 0.1.0 | https://github.com/bonfire-networks/bonfire_data_identity |
| bonfire_data_shared_user | MPL 2.0 | 0.1.0 | https://github.com/bonfire-networks/bonfire_data_shared_user |
| bonfire_data_social | MPL 2.0 | 0.1.0 | https://github.com/bonfire-networks/bonfire_data_social |
| bonfire_federate_activitypub | AGPL v3 | 0.1.0 | https://github.com/bonfire-networks/bonfire_federate_activitypub |
| bonfire_files | AGPL v3 | 0.1.0 | https://github.com/bonfire-networks/bonfire_files |
| bonfire_mailer | MPL 2.0 | 0.1.0 | https://github.com/bonfire-networks/bonfire_mailer |
| bonfire_me | AGPL v3 | 0.1.0 | https://github.com/bonfire-networks/bonfire_me |
| bonfire_social | AGPL v3 | 0.1.0 | https://github.com/bonfire-networks/bonfire_social |
| bonfire_tag | AGPL v3 | 0.1.0 | https://github.com/bonfire-networks/bonfire_tag |
| bonfire_ui_social | AGPL v3 | 0.1.0 | https://github.com/bonfire-networks/bonfire_ui_social |
| cachex | MIT | 3.3.0 | https://hex.pm/packages/cachex |
| certifi | BSD | 2.6.1 | https://hex.pm/packages/certifi |
| combine | MIT | 0.10.0 | https://hex.pm/packages/combine |
| comeonin | BSD-3-Clause; Unrecognized license | 5.3.2 | https://hex.pm/packages/comeonin |
| connection | Apache 2.0 | 1.1.0 | https://hex.pm/packages/connection |
| cowboy | ISC | 2.8.0 | https://hex.pm/packages/cowboy |
| cowboy_telemetry | Apache 2.0 | 0.3.1 | https://hex.pm/packages/cowboy_telemetry |
| cowlib | ISC | 2.9.1 | https://hex.pm/packages/cowlib |
| db_connection | Apache 2.0 | 2.4.0 | https://hex.pm/packages/db_connection |
| decimal | Apache 2.0 | 2.0.0 | https://hex.pm/packages/decimal |
| earmark | Apache 2.0 | 1.4.15 | https://hex.pm/packages/earmark |
| earmark_parser | Apache 2.0 | 1.4.13 | https://hex.pm/packages/earmark_parser |
| ecto | Apache 2.0 | 3.6.1 | https://hex.pm/packages/ecto |
| ecto_materialized_path | Apache 2.0 | 0.3.0 | https://github.com/mayel/ecto_materialized_path |
| ecto_sql | Apache 2.0 | 3.6.1 | https://hex.pm/packages/ecto_sql |
| elixir_make | Apache 2.0 | ~> 0.6 | https://hex.pm/packages/elixir_make |
| email_checker | MIT | 0.1.4 | https://hex.pm/packages/email_checker |
| eternal | MIT | 1.2.2 | https://hex.pm/packages/eternal |
| ex_machina | MIT | ~> 2.4 | https://hex.pm/packages/ex_machina |
| exsync | BSD 3-Clause; Unrecognized license | 0.2.4 | https://hex.pm/packages/exsync |
| faker | MIT | 0.16.0 | https://hex.pm/packages/faker |
| file_system | WTFPL | 0.2.10 | https://hex.pm/packages/file_system |
| flexto | Apache 2.0 | 0.2.2 | https://github.com/bonfire-networks/flexto |
| floki | MIT | 0.30.1 | https://hex.pm/packages/floki |
| gen_smtp | BSD 2-clause; Unrecognized license | 0.15.0 | https://hex.pm/packages/gen_smtp |
| geo | MIT | 3.4.2 | https://hex.pm/packages/geo |
| geo_postgis | MIT | 3.4.0 | https://hex.pm/packages/geo_postgis |
| geocoder | MIT | 1.1.0 | https://hex.pm/packages/geocoder |
| geohash | Apache 2.0 | 1.2.1 | https://hex.pm/packages/geohash |
| gettext | Apache 2.0 | 0.18.2 | https://hex.pm/packages/gettext |
| git_diff | MIT | 0.6.3 | https://hex.pm/packages/git_diff |
| hackney | Apache 2.0 | 1.17.4 | https://hex.pm/packages/hackney |
| html_entities | MIT | 0.5.2 | https://hex.pm/packages/html_entities |
| http_signatures | GPL v3 | 0.1.0 | https://git.pleroma.social/pleroma/http_signatures.git |
| httpoison | MIT | 1.8.0 | https://hex.pm/packages/httpoison |
| idna | MIT | 6.1.1 | https://hex.pm/packages/idna |
| jason | Apache 2.0 | 1.2.2 | https://hex.pm/packages/jason |
| jumper | MIT | 1.0.1 | https://hex.pm/packages/jumper |
| licensir | MIT | 0.6.2 | https://github.com/mayel/licensir |
| linkify | MIT | 0.2.0 | https://github.com/bonfire-networks/linkify |
| makeup | BSD; Unrecognized license | 1.0.5 | https://hex.pm/packages/makeup |
| makeup_elixir | BSD; Unrecognized license | 0.15.1 | https://hex.pm/packages/makeup_elixir |
| meck | Apache 2.0 | ~> 0.8.13 | https://hex.pm/packages/meck |
| metrics | BSD | 1.0.1 | https://hex.pm/packages/metrics |
| mime | Apache 2.0 | 1.6.0 | https://hex.pm/packages/mime |
| mimerl | MIT | 1.2.0 | https://hex.pm/packages/mimerl |
| mock | MIT | ~> 0.3.0 | https://hex.pm/packages/mock |
| nimble_parsec | Apache 2.0 | 1.1.0 | https://hex.pm/packages/nimble_parsec |
| nodeinfo | AGPL v3 | 0.1.0 | https://github.com/bonfire-networks/nodeinfo |
| oban | Apache 2.0 | 2.0.0 | https://hex.pm/packages/oban |
| ok | Apache 2.0 | 2.3.0 | https://hex.pm/packages/ok |
| paginator | MIT | 1.0.4 | https://hex.pm/packages/paginator |
| parse_trans | Apache 2.0 | 3.3.1 | https://hex.pm/packages/parse_trans |
| pbkdf2_elixir | BSD; Unrecognized license | 1.2.1 | https://hex.pm/packages/pbkdf2_elixir |
| phoenix | MIT | 1.5.8 | https://hex.pm/packages/phoenix |
| phoenix_ecto | MIT | 4.2.1 | https://hex.pm/packages/phoenix_ecto |
| phoenix_html | MIT | 2.14.3 | https://hex.pm/packages/phoenix_html |
| phoenix_live_dashboard | MIT | 0.2.10 | https://hex.pm/packages/phoenix_live_dashboard |
| phoenix_live_reload | MIT | 1.3.1 | https://hex.pm/packages/phoenix_live_reload |
| phoenix_live_view | MIT | 0.15.4 | https://hex.pm/packages/phoenix_live_view |
| phoenix_pubsub | MIT | 2.0.0 | https://hex.pm/packages/phoenix_pubsub |
| plug | Apache 2.0 | 1.11.1 | https://hex.pm/packages/plug |
| plug_cowboy | Apache 2.0 | 2.5.0 | https://hex.pm/packages/plug_cowboy |
| plug_crypto | Apache 2.0 | 1.2.2 | https://hex.pm/packages/plug_crypto |
| pointers | Apache 2.0 | 0.5.1 | https://github.com/bonfire-networks/pointers |
| pointers_ulid | MIT | 0.2.2 | https://github.com/bonfire-networks/pointers_ulid |
| poolboy | Unlicense; Apache 2.0; ISC | 1.5.2 | https://hex.pm/packages/poolboy |
| postgrex | Apache 2.0 | 0.15.8 | https://hex.pm/packages/postgrex |
| query_elf | Apache 2.0 | 0.3.0 | https://github.com/bonfire-networks/query_elf |
| ranch | ISC | 1.7.1 | https://hex.pm/packages/ranch |
| recase | MIT | 0.7.0 | https://hex.pm/packages/recase |
| rustler | MIT; Apache 2.0 | 0.21.0 | https://hex.pm/packages/rustler |
| sleeplocks | MIT | 1.1.1 | https://hex.pm/packages/sleeplocks |
| sobelow | Apache 2.0 | 0.11.1 | https://hex.pm/packages/sobelow |
| socket | WTFPL | 0.3.13 | https://hex.pm/packages/socket |
| ssl_verify_fun | MIT | 1.1.6 | https://hex.pm/packages/ssl_verify_fun |
| telemetry | Apache 2.0 | 0.4.3 | https://hex.pm/packages/telemetry |
| telemetry_metrics | Apache 2.0 | 0.6.0 | https://hex.pm/packages/telemetry_metrics |
| telemetry_poller | Apache 2.0 | 0.5.1 | https://hex.pm/packages/telemetry_poller |
| tesla | MIT | 1.4.1 | https://hex.pm/packages/tesla |
| timex | MIT | 3.7.5 | https://hex.pm/packages/timex |
| toml | Apache 2.0 | 0.5.2 | https://hex.pm/packages/toml |
| towel | MIT | 0.2.1 | https://hex.pm/packages/towel |
| tree_magic | GPL v3 | 0.1.1 | https://github.com/commonspub/tree_magic.ex |
| twinkle_star | GPL v3 | 0.1.0 | https://github.com/bonfire-ecosystem/twinkle_star |
| tzdata | MIT | 1.1.0 | https://hex.pm/packages/tzdata |
| unicode_util_compat | Apache 2.0 | 0.7.0 | https://hex.pm/packages/unicode_util_compat |
| unsafe | MIT | 1.0.1 | https://hex.pm/packages/unsafe |
| verbs | MIT | 0.1.0 | https://github.com/shannonwells/verbs_ex |
| waffle | Apache 2.0 | 1.1.4 | https://hex.pm/packages/waffle |
| zest | Apache 2.0 | 0.1.2 | https://hex.pm/packages/zest |
|------------------------------|------------------------------------|-----------|------------------------------------------------------------------|

18
flavours/haha/README.md Normal file
View file

@ -0,0 +1,18 @@
## Haha Academy powered by Bonfire
This app is part of the [Bonfire](https://bonfirenetworks.org/) ecosystem and bundles the following extensions:
- [Bonfire:Common](https://github.com/bonfire-networks/bonfire_common) - common utils
- [Bonfire:Me](https://github.com/bonfire-networks/bonfire_me) - accounts, user profiles...
- [Bonfire:Social](https://github.com/bonfire-networks/bonfire_social) - feeds, activities, posts, boosting, flagging, etc...
- [Bonfire:UI:Social](https://github.com/bonfire-ecosystem/bonfire_ui_social) - interface for basic social activities
- [Bonfire:Boundaries](https://github.com/bonfire-networks/bonfire_boundaries) - define circles and associated privacy or permissions
- [Bonfire:Federate:ActivityPub](https://github.com/bonfire-networks/bonfire_federate_activitypub) - federates activities with ActivityPub to participate in the fediverse
- [Bonfire:Tag](https://github.com/bonfire-ecosystem/bonfire_tag) - @ mentions, hashtags, and tagging using topics/categories from Bonfire:Classify
- [Bonfire:Classify](https://github.com/bonfire-ecosystem/bonfire_classify) - categories & classifications in taxonomies
- [Bonfire:Geolocate](https://github.com/bonfire-ecosystem/bonfire_geolocate) - places
## More information
See the [main docs](../../README.md).

View file

@ -0,0 +1,34 @@
import Config
config :activity_pub, :adapter, Bonfire.Federate.ActivityPub.Adapter
config :activity_pub, :repo, Bonfire.Repo
config :nodeinfo, :adapter, Bonfire.Federate.ActivityPub.NodeinfoAdapter
config :activity_pub, :mrf_simple,
media_removal: [],
media_nsfw: [],
report_removal: [],
accept: [],
avatar_removal: [],
banner_removal: []
config :activity_pub, :instance,
hostname: "localhost",
federation_publisher_modules: [ActivityPubWeb.Publisher],
federation_reachability_timeout_days: 7,
federating: true,
rewrite_policy: [],
handle_unknown_activities: true
config :activity_pub, :http,
proxy_url: nil,
send_user_agent: true,
adapter: [
ssl_options: [
# Workaround for remote server certificate chain issues
partial_chain: &:hackney_connect.partial_chain/1,
# We don't support TLS v1.3 yet
versions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"]
]
]

View file

@ -0,0 +1,31 @@
import Config
config :activity_pub, ActivityPub.TestRepo,
adapter: Ecto.Adapters.Postgres,
username: "postgres",
password: System.get_env("POSTGRES_PASSWORD", "postgres"),
database: "bonfire_test#{System.get_env("MIX_TEST_PARTITION")}",
hostname: System.get_env("POSTGRES_HOST") || "localhost",
pool: Ecto.Adapters.SQL.Sandbox,
pool_size: 60
config :activity_pub, ActivityPubWeb.Endpoint,
http: [port: 4002],
server: false
config :activity_pub, :adapter, Bonfire.Federate.ActivityPub.Adapter
config :activity_pub, :repo, Bonfire.Repo
config :activity_pub, ecto_repos: [Bonfire.Repo]
config :activity_pub, Oban,
repo: Bonfire.Repo,
queues: false
config :activity_pub, :instance, federating: false
config :tesla, adapter: Tesla.Mock
# Print only warnings and errors during test
config :logger, level: :warn

View file

@ -0,0 +1,9 @@
import Config
schema = Bonfire.GraphQL.Schema
config :bonfire_api_graphql,
graphql_schema_module: schema
config :absinthe,
schema: schema

View file

@ -0,0 +1,31 @@
import Config
config :bonfire_boundaries,
enabled: true
config :bonfire,
verbs: %{
read: "0EAD1NGSVTTER1YFVNDAMENTA1",
see: "0BSERV1NG11ST1NGSEX1STENCE",
create: "4REATE0RP0STBRANDNEW0BJECT",
edit: "4HANG1NGVA1VES0FPR0PERT1ES",
delete: "4AKESTVFFG0AWAYPERMANENT1Y",
follow: "20SVBSCR1BET0THE0VTPVT0F1T",
like: "11KES1ND1CATEAM11DAPPR0VA1",
boost: "300ST0R0RANN0VCEANACT1V1TY",
flag: "71AGSPAM0RVNACCEPTAB1E1TEM",
mention: "0EFERENC1NGTH1NGSE1SEWHERE",
tag: "4ATEG0R1S1NGNGR0VP1NGSTVFF",
},
default_circles: %{
guest: "0AND0MSTRANGERS0FF1NTERNET",
local: "3SERSFR0MY0VR10CA11NSTANCE",
activity_pub: "7EDERATEDW1THANACT1V1TYPVB",
admin: "2DM1NRESP0NS1B1E0F1NSTANCE"
},
circle_names: %{
guest: "Public",
local: "Local Users",
activity_pub: "Federate for Remote Users",
admin: "Instance Admins"
}

View file

@ -0,0 +1,14 @@
import Config
config :bonfire_classify,
templates_path: "lib"
config :bonfire_classify, Bonfire.Classify.Category,
# for categories to be follow-able and federate activities
has_one: [character: {Bonfire.Data.Identity.Character, references: :id, foreign_key: :id}],
has_one: [actor: {Bonfire.Data.ActivityPub.Actor, references: :id, foreign_key: :id}],
has_one: [follow_count: {Bonfire.Data.Social.FollowCount, references: :id, foreign_key: :id}],
# for likeability
has_one: [like_count: {Bonfire.Data.Social.LikeCount, references: :id, foreign_key: :id}],
# name/description
has_one: [profile: {Bonfire.Data.Social.Profile, references: :id, foreign_key: :id}]

View file

@ -0,0 +1,4 @@
import Config
config :bonfire_common,
otp_app: :bonfire

View file

@ -0,0 +1,382 @@
import Config
#### Base configuration
# Choose password hashing backend
# Note that this corresponds with our dependencies in mix.exs
hasher = if config_env() in [:dev, :test], do: Pbkdf2, else: Argon2
config :bonfire_data_identity, Bonfire.Data.Identity.Credential,
hasher_module: hasher
#### Sentinel Data Services
# Search these apps/extensions for Pointable ecto schema definitions to index
pointable_schema_extensions = [
:bonfire_data_access_control,
:bonfire_data_activity_pub,
:bonfire_data_identity,
:bonfire_data_social,
:bonfire,
:bonfire_quantify,
:bonfire_geolocate,
:bonfire_valueflows,
:bonfire_tag,
:bonfire_classify,
:bonfire_data_shared_users,
:bonfire_files
]
config :pointers, :search_path, pointable_schema_extensions
# Search these apps/extensions for context or queries modules to index (i.e. they contain modules with a queries_module/0 or context_modules/0 function)
context_and_queries_extensions = pointable_schema_extensions ++ [
:bonfire_common,
:bonfire_me,
:bonfire_social,
:bonfire_valueflows
]
config :bonfire, :query_modules_search_path, context_and_queries_extensions
config :bonfire, :context_modules_search_path, context_and_queries_extensions
# Search these apps/extensions for Verbs to index (i.e. they contain modules with a declare_verbs/0 function)
config :bonfire_data_access_control,
search_path: [
# :bonfire_me,
:bonfire_boundaries,
# :bonfire_social,
# :bonfire,
]
#### Alias modules for readability
alias Pointers.{Pointer, Table}
alias Bonfire.Data.AccessControl.{
Access, Acl, Controlled, InstanceAdmin, Grant, Interact, Verb
}
alias Bonfire.Data.ActivityPub.{Actor, Peer, Peered}
alias Bonfire.Data.Identity.{
Account, Accounted, Caretaker, Character, Credential, Email, Self, User, Named
}
alias Bonfire.Data.Social.{
Activity, Article, Block, Bookmark, Circle, Created, Encircle, Feed, FeedPublish, Inbox, Message, Follow, FollowCount, Boost, BoostCount, Like, LikeCount, Flag, FlagCount, Mention, Post, PostContent, Profile, Replied
}
#### Flexto Stitching
## WARNING: This is the flaky magic bit. We use configuration to
## compile extra stuff into modules. If you add new fields or
## relations to ecto models in a dependency, you must recompile that
## dependency for it to show up! You will probably find you need to
## `rm -Rf _build/*/lib/bonfire_data_*` a lot.
## Note: This does not apply to configuration for
## `Pointers.Changesets`, which is read at runtime, not compile time
# first up, pointers could have all the mixins we're using. TODO
config :pointers, Pointer,
has_one: [controlled: {Controlled, foreign_key: :id}],
has_one: [created: {Created, foreign_key: :id}],
has_one: [activity: {Activity, foreign_key: :object_id, references: :id}], # needs ON clause
has_one: [post_content: {PostContent, foreign_key: :id}],
has_one: [like_count: {LikeCount, foreign_key: :id}],
has_many: [likes: {Like, foreign_key: :liked_id, references: :id}],
has_one: [my_like: {Like, foreign_key: :liked_id, references: :id}],
has_one: [my_flag: {Flag, foreign_key: :flagged_id, references: :id}],
has_one: [replied: {Replied, foreign_key: :id}],
has_many: [direct_replies: {Replied, foreign_key: :reply_to_id}],
has_one: [profile: {Profile, foreign_key: :id}],
has_one: [character: {Character, foreign_key: :id}],
has_one: [actor: {Actor, foreign_key: :id}],
# add references of tags to any tagged Pointer
many_to_many: [
tags: {
Bonfire.Tag,
join_through: "bonfire_tagged",
unique: true,
join_keys: [pointer_id: :id, tag_id: :id],
on_replace: :delete
}
]
config :pointers, Table, []
# now let's weave everything else together for convenience
# bonfire_data_access_control
config :bonfire_data_access_control, Access,
has_one: [named: {Named, foreign_key: :id}],
has_one: [caretaker: {Caretaker, foreign_key: :id}]
config :bonfire_data_access_control, Acl,
has_one: [named: {Named, foreign_key: :id}],
has_one: [caretaker: {Caretaker, foreign_key: :id}]
config :bonfire_data_access_control, Controlled, []
config :bonfire_data_access_control, Grant,
belongs_to: [subject_character: {Character, foreign_key: :subject_id, define_field: false}],
belongs_to: [subject_profile: {Profile, foreign_key: :subject_id, define_field: false}],
belongs_to: [subject_circle: {Circle, foreign_key: :subject_id, define_field: false}],
belongs_to: [subject_named: {Named, foreign_key: :subject_id, define_field: false}]
config :bonfire_data_access_control, Interact, []
config :bonfire_data_access_control, Verb, []
# bonfire_data_activity_pub
config :bonfire_data_activity_pub, Actor,
belongs_to: [character: {Character, foreign_key: :id, define_field: false}],
has_one: [peered: {Peered, references: :id, foreign_key: :id}],
belongs_to: [user: {User, foreign_key: :id, define_field: false}]
config :bonfire_data_activity_pub, Peer, []
config :bonfire_data_activity_pub, Peered, []
# bonfire_data_identity
config :bonfire_data_identity, Account,
has_one: [credential: {Credential, foreign_key: :id}],
has_one: [email: {Email, foreign_key: :id}],
has_one: [inbox: {Inbox, foreign_key: :id}],
many_to_many: [users: {User, join_through: "bonfire_data_identity_accounted", join_keys: [account_id: :id, id: :id]}],
many_to_many: [shared_users: {User, join_through: "bonfire_data_shared_user_accounts", join_keys: [account_id: :id, shared_user_id: :id]}]
config :bonfire_data_identity, Accounted,
belongs_to: [user: {User, foreign_key: :id, define_field: false}]
config :bonfire_data_identity, Caretaker, []
config :bonfire_data_identity, Character,
has_one: [peered: {Peered, references: :id, foreign_key: :id}],
has_one: [actor: {Actor, foreign_key: :id}],
has_one: [profile: {Profile, foreign_key: :id}],
has_one: [user: {User, foreign_key: :id}],
has_one: [feed: {Feed, foreign_key: :id}],
has_one: [inbox: {Inbox, foreign_key: :id}],
has_many: [feed_publishes: {FeedPublish, references: :id, foreign_key: :feed_id}],
has_many: [followers: {Follow, foreign_key: :following_id, references: :id}],
has_many: [followings: {Follow, foreign_key: :follower_id, references: :id}],
has_one: [follow_count: {FollowCount, foreign_key: :id}]
config :bonfire_data_identity, Credential,
belongs_to: [account: {Account, foreign_key: :id, define_field: false}]
config :bonfire_data_identity, Email,
must_confirm: true,
belongs_to: [account: {Account, foreign_key: :id, define_field: false}]
config :bonfire_data_identity, Self, []
config :bonfire_data_identity, User,
has_one: [accounted: {Accounted, foreign_key: :id}],
has_one: [profile: {Profile, foreign_key: :id}],
has_one: [character: {Character, foreign_key: :id}],
has_one: [actor: {Actor, foreign_key: :id}],
has_one: [instance_admin: {InstanceAdmin, foreign_key: :id}],
has_many: [likes: {Like, foreign_key: :liker_id, references: :id}],
has_one: [self: {Self, foreign_key: :id}],
has_one: [peered: {Peered, references: :id, foreign_key: :id}],
has_many: [encircles: {Encircle, foreign_key: :subject_id}],
has_one: [shared_user: {Bonfire.Data.SharedUser, foreign_key: :id}],
many_to_many: [caretaker_accounts: {Account, join_through: "bonfire_data_shared_user_accounts", join_keys: [shared_user_id: :id, account_id: :id]}]
# has_one: [geolocation: {Bonfire.Geolocate.Geolocation}]
# bonfire_data_social
config :bonfire_data_social, Activity,
belongs_to: [subject_user: {User, foreign_key: :subject_id, define_field: false}],
belongs_to: [subject_character: {Character, foreign_key: :subject_id, define_field: false}],
belongs_to: [subject_profile: {Profile, foreign_key: :subject_id, define_field: false}],
belongs_to: [object_peered: {Peered, foreign_key: :object_id, define_field: false}],
belongs_to: [object_post: {Post, foreign_key: :object_id, define_field: false}],
# belongs_to: [object_post_content: {PostContent, foreign_key: :object_id, define_field: false}],
belongs_to: [object_message: {Message, foreign_key: :object_id, define_field: false}],
has_one: [boost_count: {BoostCount, foreign_key: :id, references: :object_id}],
has_one: [like_count: {LikeCount, foreign_key: :id, references: :object_id}],
has_many: [boosts: {Boost, foreign_key: :boosted_id, references: :object_id}],
has_many: [likes: {Like, foreign_key: :liked_id, references: :object_id}],
has_one: [my_like: {Like, foreign_key: :liked_id, references: :object_id}],
has_one: [my_boost: {Boost, foreign_key: :boosted_id, references: :object_id}],
has_one: [my_flag: {Flag, foreign_key: :flagged_id, references: :object_id}],
has_one: [replied: {Replied, foreign_key: :id, references: :object_id}],
# has_one: [reply_to: {[through: [:replied, :reply_to]]}],
# has_one: [reply_to_post: {[through: [:replied, :reply_to_post]]}],
# has_one: [reply_to_post_content: {[through: [:replied, :reply_to_post_content]]}],
# has_one: [reply_to_creator_character: {[through: [:replied, :reply_to_creator_character]]}],
# has_one: [reply_to_creator_profile: {[through: [:replied, :reply_to_creator_profile]]}],
# has_one: [thread_post: {[through: [:replied, :thread_post]]}],
# has_one: [thread_post_content: {[through: [:replied, :thread_post_content]]}],
has_one: [object_created: {Created, foreign_key: :id, references: :object_id}],
# has_one: [object_creator_user: {[through: [:object_created, :creator_user]]}],
# has_one: [object_creator_character: {[through: [:object_created, :creator_character]]}],
# has_one: [object_creator_profile: {[through: [:object_created, :creator_profile]]}],
has_one: [controlled: {Controlled, foreign_key: :id, references: :object_id}],
many_to_many: [
tags: {
Bonfire.Tag,
join_through: "bonfire_tagged",
unique: true,
join_keys: [pointer_id: :object_id, tag_id: :id],
on_replace: :delete
}
]
config :bonfire_data_social, Circle,
has_one: [caretaker: {Caretaker, foreign_key: :id}],
has_one: [named: {Named, foreign_key: :id}]
# has_many: [encircles: {Encircle, foreign_key: :circle_id}]
config :bonfire_data_social, Encircle,
belongs_to: [subject_user: {User, foreign_key: :subject_id, define_field: false}],
belongs_to: [subject_character: {Character, foreign_key: :subject_id, define_field: false}],
belongs_to: [subject_profile: {Profile, foreign_key: :subject_id, define_field: false}]
config :bonfire_data_social, Feed,
belongs_to: [character: {Character, foreign_key: :id, define_field: false}],
belongs_to: [user: {User, foreign_key: :id, define_field: false}]
config :bonfire_data_social, FeedPublish, []
config :bonfire_data_social, Follow,
belongs_to: [follower_character: {Character, foreign_key: :follower_id, define_field: false}],
belongs_to: [follower_profile: {Profile, foreign_key: :follower_id, define_field: false}],
belongs_to: [followed_character: {Character, foreign_key: :followed_id, define_field: false}],
belongs_to: [followed_profile: {Profile, foreign_key: :followed_id, define_field: false}]
config :bonfire_data_social, FollowCount, []
config :bonfire_data_social, Block, []
config :bonfire_data_social, Like,
has_one: [activity: {Activity, foreign_key: :object_id, references: :liked_id}] # requires an ON clause
config :bonfire_data_social, LikeCount, []
config :bonfire_data_social, Bookmark, []
config :bonfire_data_social, Message,
has_one: [post_content: {PostContent, foreign_key: :id}],
has_one: [created: {Created, foreign_key: :id}],
has_one: [peered: {Peered, references: :id, foreign_key: :id}],
has_many: [activities: {Activity, foreign_key: :object_id, references: :id}],
has_one: [activity: {Activity, foreign_key: :object_id, references: :id}], # requires an ON clause
has_one: [like_count: {LikeCount, foreign_key: :id}],
has_many: [likes: {Like, foreign_key: :liked_id, references: :id}],
has_one: [my_like: {Like, foreign_key: :liked_id, references: :id}],
has_one: [my_flag: {Flag, foreign_key: :flagged_id, references: :id}],
has_one: [replied: {Replied, foreign_key: :id}],
has_many: [direct_replies: {Replied, foreign_key: :reply_to_id}],
has_one: [controlled: {Controlled, foreign_key: :id}]
config :bonfire_data_social, Mention, []
config :bonfire_data_social, Named, []
config :bonfire_data_social, Post,
has_one: [post_content: {PostContent, foreign_key: :id}],
has_one: [created: {Created, foreign_key: :id}],
has_one: [peered: {Peered, references: :id, foreign_key: :id}],
# has_one: [creator_user: {[through: [:created, :creator_user]]}],
# has_one: [creator_character: {[through: [:created, :creator_character]]}],
# has_one: [creator_profile: {[through: [:created, :creator_profile]]}],
has_many: [activities: {Activity, foreign_key: :object_id, references: :id}],
has_one: [activity: {Activity, foreign_key: :object_id, references: :id}], # requires an ON clause
has_one: [like_count: {LikeCount, foreign_key: :id}],
has_many: [likes: {Like, foreign_key: :liked_id, references: :id}],
has_one: [my_like: {Like, foreign_key: :liked_id, references: :id}],
has_one: [my_boost: {Boost, foreign_key: :boosted_id, references: :id}],
has_one: [my_flag: {Flag, foreign_key: :flagged_id, references: :id}],
has_one: [replied: {Replied, foreign_key: :id}],
# has_one: [reply_to: {[through: [:replied, :reply_to]]}],
# has_one: [reply_to_post: {[through: [:replied, :reply_to_post]]}],
# has_one: [reply_to_post_content: {[through: [:replied, :reply_to_post_content]]}],
# has_one: [reply_to_creator_character: {[through: [:replied, :reply_to_creator_character]]}],
# has_one: [reply_to_creator_profile: {[through: [:replied, :reply_to_creator_profile]]}],
has_many: [direct_replies: {Replied, foreign_key: :reply_to_id}],
# has_one: [thread_post: {[through: [:replied, :thread_post]]}],
# has_one: [thread_post_content: {[through: [:replied, :thread_post_content]]}],
has_one: [controlled: {Controlled, foreign_key: :id}]
config :bonfire_data_social, PostContent, []
config :bonfire_data_social, Replied,
belongs_to: [post: {Post, foreign_key: :id, define_field: false}],
belongs_to: [post_content: {PostContent, foreign_key: :id, define_field: false}],
has_many: [activities: {Activity, foreign_key: :object_id, references: :id}],
has_one: [activity: {Activity, foreign_key: :object_id, references: :id}],
has_one: [reply_to_post: {Post, foreign_key: :id, references: :reply_to_id}],
has_one: [reply_to_post_content: {PostContent, foreign_key: :id, references: :reply_to_id}],
has_one: [reply_to_created: {Created, foreign_key: :id, references: :reply_to_id}],
# has_one: [reply_to_creator_user: {[through: [:reply_to_created, :creator_user]]}],
# has_one: [reply_to_creator_character: {[through: [:reply_to_created, :creator_character]]}],
# has_one: [reply_to_creator_profile: {[through: [:reply_to_created, :creator_profile]]}],
# has_one: [like_count: {LikeCount, foreign_key: :id}],
has_many: [direct_replies: {Replied, foreign_key: :reply_to_id, references: :id}],
has_many: [thread_replies: {Replied, foreign_key: :thread_id, references: :id}],
has_one: [thread_post: {Post, foreign_key: :id, references: :thread_id}],
has_one: [thread_post_content: {PostContent, foreign_key: :id, references: :thread_id}],
has_one: [controlled: {Controlled, foreign_key: :id, references: :id}]
config :bonfire_data_social, Created,
has_one: [peered: {Peered, references: :id, foreign_key: :id}],
belongs_to: [creator_user: {User, foreign_key: :creator_id, define_field: false}],
belongs_to: [creator_character: {Character, foreign_key: :creator_id, define_field: false}],
belongs_to: [creator_profile: {Profile, foreign_key: :creator_id, define_field: false}]
config :bonfire_data_social, Profile,
belongs_to: [user: {User, foreign_key: :id, define_field: false}],
has_one: [controlled: {Controlled, foreign_key: :id, references: :id}]
######### other extensions
# optional mixin relations for tags that are characters (eg Category) or any other type of objects
config :bonfire_tag, Bonfire.Tag,
# for objects that are follow-able and can federate activities
has_one: [character: {Bonfire.Data.Identity.Character, references: :id, foreign_key: :id}],
has_one: [peered: {Peered, references: :id, foreign_key: :id}],
# has_one: [actor: {Bonfire.Data.ActivityPub.Actor, references: :id, foreign_key: :id}],
has_one: [follow_count: {Bonfire.Data.Social.FollowCount, references: :id, foreign_key: :id}],
# for likeable objects
has_one: [like_count: {Bonfire.Data.Social.LikeCount, references: :id, foreign_key: :id}],
# name/description
has_one: [profile: {Bonfire.Data.Social.Profile, references: :id, foreign_key: :id}],
# for taxonomy categories/topics
has_one: [category: {Bonfire.Classify.Category, references: :id, foreign_key: :id}],
# for locations
has_one: [geolocation: {Bonfire.Geolocate.Geolocation, references: :id, foreign_key: :id}]
# add references of tagged objects to any Category
config :bonfire_classify, Bonfire.Classify.Category,
many_to_many: [
tags: {
Bonfire.Tag,
join_through: "bonfire_tagged",
unique: true,
join_keys: [tag_id: :id, pointer_id: :id],
on_replace: :delete
}
]
# add references of tagged objects to any Geolocation
config :bonfire_geolocate, Bonfire.Geolocate.Geolocation,
many_to_many: [
tags: {
Bonfire.Tag,
join_through: "bonfire_tagged",
unique: true,
join_keys: [tag_id: :id, pointer_id: :id],
on_replace: :delete
}
]
# all data types included in federation
config :bonfire, :all_types, [User, Post]
config :bonfire_files, Bonfire.Files.Media,
field: [
url: {:string, virtual: true}
]
config :bonfire_valueflows, ValueFlows.Planning.Intent,
has_one: [like_count: {LikeCount, foreign_key: :id}]

View file

@ -0,0 +1,23 @@
import Config
config :bonfire_fail,
common_errors: %{
unauthorized: {403, "You do not have permission to %s."},
not_found: {404, "%s Not Found."},
unauthenticated: {401, "You need to log in first."},
needs_login: {401, "You need to log in first."},
invalid_credentials: {401, "We couldn't find an account with the details you provided."},
deletion_error: {400, "Could not delete:"},
bad_header: {400, "Bad request: malformed header."},
no_access: {403, "This site is by invitation only."},
token_expired: {403, "This link or token has expired, please request a fresh one."},
already_claimed: {403, "This link or token was already used, please request a fresh one if necessary."},
token_not_found: {403, "This token was not found, please request a fresh one."},
user_disabled: {403, "This user account is disabled. Please contact the instance administrator."},
email_not_confirmed: {403, "Please confirm your email address first."},
unknown_resource: {400, "Unknown resource."},
invalid_argument: {400, "Invalid arguments passed."},
password_hash_missing: {401, "Reset your password to login."},
user_not_found: {404, "User not found."},
unknown: {500, "Something went wrong."}
}

View file

@ -0,0 +1,22 @@
import Config
alias Bonfire.Federate.ActivityPub.Adapter
actor_types = ["Person", "Group", "Application", "Service", "Organization"]
config :bonfire,
federation_search_path: [
:bonfire_common,
:bonfire_me,
:bonfire_social,
:bonfire_valueflows
],
log_federation: true, # enable/disable logging of federation logic
federation_fallback_module: Bonfire.Social.APActivities
config :bonfire, Adapter,
actor_types: actor_types
# config :bonfire, Bonfire.Instance,
# hostname: hostname,
# description: desc

View file

@ -0,0 +1,48 @@
use Mix.Config
# where do you want to store files? supports local storage, s3-compatible services, and more
# see https://hexdocs.pm/waffle/Waffle.html#module-setup-a-storage-provider
config :waffle,
storage: Waffle.Storage.Local,
asset_host: "/" # or {:system, "ASSET_HOST"}
image_media_types = ["image/png", "image/jpeg", "image/gif", "image/svg+xml", "image/tiff"]
all_media_types = image_media_types ++ [
"text/plain",
# doc
"text/csv",
"application/pdf",
"application/rtf",
"application/msword",
"application/vnd.ms-excel",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"application/vnd.oasis.opendocument.presentation",
"application/vnd.oasis.opendocument.spreadsheet",
"application/vnd.oasis.opendocument.text",
"application/epub+zip",
# archives
"application/x-tar",
"application/x-bzip",
"application/x-bzip2",
"application/gzip",
"application/zip",
"application/rar",
"application/x-7z-compressed",
# audio
"audio/mpeg",
"audio/ogg",
"audio/wav",
"audio/webm",
"audio/opus",
# video
"video/mp4",
"video/mpeg",
"video/ogg",
"video/webm",
]
config :bonfire, Bonfire.Files.IconUploader, allowed_media_types: image_media_types
config :bonfire, Bonfire.Files.ImageUploader, allowed_media_types: image_media_types
config :bonfire, Bonfire.Files.DocumentUploader, allowed_media_types: all_media_types

View file

@ -0,0 +1,5 @@
use Mix.Config
config :bonfire_me,
validate_name_min: 1,
validate_name_max: 250 # needed for taxonomy

View file

@ -0,0 +1,4 @@
import Config
config :bonfire_geolocate,
templates_path: "lib"

View file

@ -0,0 +1,8 @@
import Config
# config :bonfire, :hooks,
# %{
# {Bonfire.Social.Posts, :publish} => %{
# after: {IO, :inspect}
# }
# }

View file

@ -0,0 +1,10 @@
import Config
config :bonfire_mailer,
check_mx: true,
check_format: true
config :bonfire, Bonfire.Mailer,
# what service you want to use to send emails, from these: https://github.com/thoughtbot/bamboo#available-adapters
# we recommend leaving LocalAdapter (which is just a fallback which won't actually send emails) and setting the actual adapter in runtime.exs
adapter: Bamboo.LocalAdapter

View file

@ -0,0 +1,13 @@
import Config
config :bonfire_me,
templates_path: "lib"
config :bonfire_me, Bonfire.Me.Identity.Mails,
confirm_email: [subject: "Confirm your email - Bonfire"],
forgot_password: [subject: "Reset your password - Bonfire"]
#### Pointer class configuration
config :bonfire_me, Bonfire.Me.Follows,
followable_types: [Bonfire.Data.Identity.User]

View file

@ -0,0 +1,7 @@
use Mix.Config
config :bonfire_quantify,
templates_path: "lib"
# specify what types a unit can have as context
config :bonfire_quantify, Bonfire.Quantify.Units, valid_contexts: [Bonfire.Quantify.Units]

View file

@ -0,0 +1,25 @@
import Config
config :bonfire_search,
disable_indexing: System.get_env("SEARCH_INDEXING_DISABLED", "false"),
adapter: Bonfire.Search.Meili,
instance: System.get_env("SEARCH_MEILI_INSTANCE", "http://search:7700"), # protocol, hostname and port
api_key: System.get_env("MEILI_MASTER_KEY", "make-sure-to-change-me") # secret key
# for use by API client
config :tesla, adapter: Tesla.Adapter.Hackney
config :phoenix, :format_encoders, json: Jason
config :phoenix, :json_library, Jason
config :http_signatures, adapter: ActivityPub.Signature
# Configures http settings, upstream proxy etc.
config :activity_pub, :http,
proxy_url: nil,
send_user_agent: true,
adapter: [
ssl_options: [
# Workaround for remote server certificate chain issues
partial_chain: &:hackney_connect.partial_chain/1,
# We don't support TLS v1.3 yet
versions: [:tlsv1, :"tlsv1.1", :"tlsv1.2"]
]
]

View file

@ -0,0 +1,4 @@
import Config
config :bonfire_social,
enabled: true

View file

@ -0,0 +1,4 @@
import Config
config :bonfire_tag,
templates_path: "lib"

View file

@ -0,0 +1,48 @@
import Config
config :bonfire, :ui,
theme: [
instance_name: "HAHA Academy",
instance_logo: "https://bonfirenetworks.org/img/bonfire.png",
instance_image: "https://haha.academy/images/wheel.png",
instance_description: "Community roadmaps for learning every branch of human knowledge"
],
sidebar_components: [
{Bonfire.UI.Social.SidebarNavigationLive, []},
],
smart_input: [
post: true,
cw: true,
summary: true
],
profile: [
sections: [
timeline: Bonfire.UI.Social.ProfileTimelineLive,
private: Bonfire.UI.Social.PrivateLive,
posts: Bonfire.UI.Social.ProfilePostsLive,
boosts: Bonfire.UI.Social.ProfileBoostsLive,
followers: Bonfire.UI.Social.ProfileFollowsLive,
followed: Bonfire.UI.Social.ProfileFollowsLive,
],
navigation: [
timeline: "timeline",
posts: "posts",
boosts: "boosts",
# private: "private",
],
widgets: [
],
],
smart_input_activities: [
# offer: "Publish an offer",
# need: "Publish a need",
# transfer_resource: "Transfer a resource",
# produce_resource: "Add a resource",
# intent: "Indicate an itent",
# economic_event: "Record an economic event",
# process: "Define a process"
],
smart_input_forms: [
post: Bonfire.UI.Social.CreateActivityLive,
]

View file

@ -0,0 +1,87 @@
import Config
default_flavour = "classic"
flavour = System.get_env("FLAVOUR", default_flavour)
flavour_path = System.get_env("FLAVOUR_PATH", "flavours/"<>flavour)
#### Basic configuration
# You probably won't want to touch these. You might override some in
# other config files.
config :bonfire,
otp_app: :bonfire,
env: config_env(),
flavour: flavour,
flavour_path: flavour_path,
app_name: System.get_env("APP_NAME", "Bonfire"),
repo_module: Bonfire.Repo,
web_module: Bonfire.Web,
endpoint_module: Bonfire.Web.Endpoint,
mailer_module: Bonfire.Mailer,
default_web_namespace: Bonfire.UI.Social.Web,
default_layout_module: Bonfire.UI.Social.Web.LayoutView,
graphql_schema_module: Bonfire.GraphQL.Schema,
user_schema: Bonfire.Data.Identity.User,
org_schema: Bonfire.Data.Identity.User,
home_page: Bonfire.Web.HomeLive,
localisation_path: "priv/localisation",
ap_base_path: System.get_env("AP_BASE_PATH", "/pub"),
signing_salt: "this-will-be-overriden-by-a-secure-string-in-runtime.exs",
encryption_salt: "this-will-be-overriden-by-a-secure-string-in-runtime.exs"
config :bonfire, Bonfire.Web.Endpoint,
url: [host: "localhost"],
http: [
port: String.to_integer(System.get_env("SERVER_PORT", "4000")), # this gets overriden in runtime.exs
transport_options: [socket_opts: [:inet6]]
],
render_errors: [view: Bonfire.UI.Social.Web.ErrorView, accepts: ~w(html json), layout: false],
pubsub_server: Bonfire.PubSub
config :phoenix, :json_library, Jason
config :bonfire, :ecto_repos, [Bonfire.Repo]
config :bonfire, Bonfire.Repo,
types: Bonfire.PostgresTypes,
priv: flavour_path <> "/repo"
# ecto query filtering
# config :query_elf, :id_types, [:id, :binary_id, Pointers.ULID]
config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:request_id]
config :bonfire, Oban,
repo: Bonfire.Repo,
plugins: [Oban.Plugins.Pruner],
queues: [
federator_incoming: 50,
federator_outgoing: 50,
ap_incoming: 15,
ap_publish: 15
]
config :mime, :types, %{
"application/activity+json" => ["activity+json"],
"application/jrd+json" => ["jrd+json"]
}
config :sentry,
dsn: "this-will-be-overriden-by-a-secure-string-in-runtime.exs",
environment_name: Mix.env,
included_environments: [:prod]
# include config for all used Bonfire extensions
for config <- "bonfire_*.exs" |> Path.expand(__DIR__) |> Path.wildcard() do
# IO.inspect(include_config: config)
import_config config
end
import_config "activity_pub.exs"
# finally, append/override config based on env, which will override any config set above (including from imported files)
import_config "#{config_env()}.exs"

View file

@ -0,0 +1 @@
../../coordination/config/config_basics.exs

View file

@ -0,0 +1,42 @@
activity_pub = "https://github.com/bonfire-networks/activity_pub#develop"
bonfire_common = "https://github.com/bonfire-networks/bonfire_common#main"
bonfire_data_access_control = "https://github.com/bonfire-networks/bonfire_data_access_control#main"
bonfire_data_activity_pub = "https://github.com/bonfire-networks/bonfire_data_activity_pub#main"
bonfire_data_identity = "https://github.com/bonfire-networks/bonfire_data_identity#main"
bonfire_data_social = "https://github.com/bonfire-networks/bonfire_data_social#main"
bonfire_me = "https://github.com/bonfire-networks/bonfire_me#main"
bonfire_social = "https://github.com/bonfire-networks/bonfire_social#main"
bonfire_mailer = "https://github.com/bonfire-networks/bonfire_mailer#main"
# bonfire_web_phoenix = "https://github.com/bonfire-networks/bonfire_web_phoenix#main"
pointers = "https://github.com/bonfire-networks/pointers#main"
pointers_ulid = "https://github.com/bonfire-networks/pointers_ulid#main"
nodeinfo = "https://github.com/bonfire-networks/nodeinfo#main"
# surface = "https://github.com/bonfire-networks/surface"
bonfire_ui_social = "https://github.com/bonfire-networks/bonfire_ui_social#main"
# bonfire_quantify = "https://github.com/bonfire-networks/bonfire_quantify#main"
bonfire_geolocate = "https://github.com/bonfire-networks/bonfire_geolocate#main"
# bonfire_valueflows = "https://github.com/bonfire-networks/bonfire_valueflows#main"
# bonfire_api_graphql = "https://github.com/bonfire-networks/bonfire_api_graphql#main"
# bonfire_ui_valueflows = "https://github.com/bonfire-networks/bonfire_ui_valueflows#main"
# bonfire_ui_reflow = "https://github.com/bonfire-networks/bonfire_ui_reflow#main"
# bonfire_ui_coordination = "https://github.com/bonfire-networks/bonfire_ui_coordination#main"
# bonfire_breadpub = "https://github.com/bonfire-networks/bonfire_breadpub#main"
# bonfire_recyclapp = "https://github.com/bonfire-networks/bonfire_recyclapp#main"
bonfire_website = "https://github.com/bonfire-networks/bonfire_website#main"
bonfire_tag = "https://github.com/bonfire-networks/bonfire_tag#main"
bonfire_classify = "https://github.com/bonfire-networks/bonfire_classify#main"
bonfire_taxonomy_seeder = "https://github.com/bonfire-networks/bonfire_taxonomy_seeder#main"
bonfire_search = "https://github.com/bonfire-networks/bonfire_search#main"
# bonfire_data_shared_user = "https://github.com/bonfire-networks/bonfire_data_shared_user#main"
# bonfire_valueflows_observe = "https://github.com/bonfire-networks/bonfire_valueflows_observe"
# absinthe_client = "https://github.com/mayel/absinthe_client.git#master"
flexto = "https://github.com/bonfire-networks/flexto#support-through"
bonfire_federate_activitypub = "https://github.com/bonfire-networks/bonfire_federate_activitypub#main"
bonfire_boundaries = "https://github.com/bonfire-networks/bonfire_boundaries#main"
bonfire_files = "https://github.com/bonfire-networks/bonfire_files#main"
#twinkle_star = "https://github.com/bonfire-networks/twinkle_star"
voodoo = "https://github.com/bonfire-networks/voodoo#main"
ecto_shorts = "https://github.com/bonfire-networks/ecto_shorts#main"
ecto_sparkles = "https://github.com/bonfire-networks/ecto_sparkles#main"
emote = "https://github.com/bonfire-networks/emote"
paginator = "https://github.com/bonfire-networks/paginator"

View file

@ -0,0 +1,37 @@
# web
phoenix = "~> 1.5.0"
phoenix_live_view = "~> 0.15.7"
surface = "~> 0.5.0"
phoenix_html = "~> 3.0"
phoenix_ecto = "~> 4.4"
phoenix_live_dashboard = "~> 0.4.0"
plug_cowboy = "~> 2.5"
gettext = "~> 0.18"
jason = "~> 1.0"
# poison = "~> 4.0"
# db
ecto_sql = "~> 3.7"
flexto = "~> 0.2.2"
postgrex = ">= 0.0.0"
oban = "~> 2.8.0" # job queueing
pointers_ulid = "~> 0.2.2"
pointers = "~> 0.5.1"
# email
bamboo = "~> 1.5"
bamboo_smtp = "~> 3.0.0"
# misc
recase = "~> 0.7" # string recasing
faker = "~> 0.16" # fake data generation
telemetry = "~> 1.0"
telemetry_metrics = "~> 0.6"
telemetry_poller = "~> 1.0"
ok = "~> 2.3"
sentry = "~> 8.0"
# Data Schemas
# bonfire_data_access_control = "~> 0.1"
# bonfire_data_activity_pub = "~> 0.1"
# bonfire_data_identity = "~> 0.1"
# bonfire_data_social = "~> 0.1"
# ecto_psql_extras = "~> 0.2"
# surface_catalogue = "~> 0.1.0" # Testing a UI component library
phil_columns = "~> 3.1" # for inserting seed data in the DB

View file

@ -0,0 +1,9 @@
#!/bin/bash
# DEPS="bonfire_geolocate"
# for dep in $DEPS
# do
# echo "Install JS deps from $dep"
# cd "forks/$dep/assets" && pnpm install || cd "deps/$dep/assets" && pnpm install || echo "Extension $dep not available"
# done

View file

@ -0,0 +1,64 @@
import Config
config :bonfire, Bonfire.Repo,
database: System.get_env("POSTGRES_DB", "bonfire_dev"),
# show_sensitive_data_on_connection_error: true,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
path_dep_dirs =
Mess.deps([path: "deps.path"], [])
|> Enum.map(&(Keyword.fetch!(elem(&1, 1), :path) <> "/lib"))
config :phoenix_live_reload,
dirs: path_dep_dirs ++ ["lib/"] # watch the app's lib/ dir + the dep/lib/ dir of every locally-cloned dep
path_dep_patterns = path_dep_dirs |> Enum.map(&(String.slice(&1, 2..1000) <>".*ex")) # to include cloned code in patterns
path_dep_patterns = path_dep_patterns ++ path_dep_dirs |> Enum.map(&(String.slice(&1, 2..1000) <>".*sface")) # Surface views
# Watch static and templates for browser reloading.
config :bonfire, Bonfire.Web.Endpoint,
server: true,
debug_errors: true,
check_origin: false,
code_reloader: true,
watchers: [
pnpm: [
"watch.js",
cd: Path.expand("assets", File.cwd!())
],
pnpm: [
"watch.postcss",
cd: Path.expand("assets", File.cwd!())
],
# pnpm: [
# "watch.assets",
# cd: Path.expand("assets", File.cwd!())
# ]
],
live_reload: [
patterns: [
# ~r"^priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
# ~r"^priv/gettext/.*(po)$",
# ~r"^web/(live|views)/.*ex$",
# ~r"^lib/.*_live\.ex$",
# ~r".*leex$",
~r"lib/.*ex$",
~r".*sface$",
~r"priv/catalogue/.*(ex)$",
] ++ path_dep_patterns
]
# defp elixirc_paths(:dev), do: ["lib"] ++ catalogues()
config :logger, :console,
level: :debug,
# truncate: :infinity,
format: "[$level] $message\n" # Do not include metadata or timestamps
config :phoenix, :stacktrace_depth, 30
config :phoenix, :plug_init_mode, :runtime
config :exsync,
src_monitor: true,
extra_extensions: [".leex", ".js", ".css", ".sface"]

View file

@ -0,0 +1,21 @@
import Config
# We include the path to a cache manifest
# containing the digested version of static files. This
# manifest is generated by the `mix phx.digest` task,
# which you should run after static files are built and
# before starting your production server.
config :bonfire, Bonfire.Web.Endpoint,
cache_static_manifest: "priv/static/cache_manifest.json"
config :logger,
backends: [:console, Sentry.LoggerBackend]
# Do not print debug messages in production
config :logger, level: :info
config :bonfire, Bonfire.Web.Endpoint, server: true
config :bonfire, Bonfire.Repo,
priv: "priv/repo" # in releases migrations are not in a flavour-specific directory

View file

@ -0,0 +1,218 @@
# In this file, we load production configuration and secrets
# from environment variables. You can also hardcode secrets,
# although such is generally not recommended and you have to
# remember to add this file to your .gitignore.
import Config
host = System.get_env("HOSTNAME", "localhost")
server_port = String.to_integer(System.get_env("SERVER_PORT", "4000"))
public_port = String.to_integer(System.get_env("PUBLIC_PORT", "4000"))
System.get_env("DATABASE_URL") || System.get_env("POSTGRES_PASSWORD") || System.get_env("CI") ||
raise """
Environment variables for database are missing.
For example: DATABASE_URL=ecto://USER:PASS@HOST/DATABASE
You can also set POSTGRES_PASSWORD (required),
and POSTGRES_USER (default: postgres) and POSTGRES_HOST (default: localhost)
"""
if System.get_env("DATABASE_URL") do
config :bonfire, Bonfire.Repo,
url: System.get_env("DATABASE_URL")
else
config :bonfire, Bonfire.Repo,
# ssl: true,
username: System.get_env("POSTGRES_USER", "postgres"),
password: System.get_env("POSTGRES_PASSWORD", "postgres"),
hostname: System.get_env("POSTGRES_HOST", "localhost")
end
secret_key_base =
System.get_env("SECRET_KEY_BASE") ||System.get_env("CI") ||
raise """
environment variable SECRET_KEY_BASE is missing.
You can generate one by calling: mix phx.gen.secret
"""
signing_salt = System.get_env("SIGNING_SALT") || System.get_env("CI") ||
raise """
environment variable SIGNING_SALT is missing.
"""
encryption_salt = System.get_env("ENCRYPTION_SALT") || System.get_env("CI") ||
raise """
environment variable ENCRYPTION_SALT is missing.
"""
config :bonfire,
host: host,
app_name: System.get_env("APP_NAME", "Bonfire"),
ap_base_path: System.get_env("AP_BASE_PATH", "/pub"),
github_token: System.get_env("GITHUB_TOKEN"),
encryption_salt: encryption_salt,
signing_salt: signing_salt
config :bonfire, Bonfire.Web.Endpoint,
url: [
host: host,
port: public_port
],
http: [
port: server_port
],
secret_key_base: secret_key_base,
live_view: [signing_salt: signing_salt]
# start prod-only config
if config_env() == :prod do
config :bonfire, Bonfire.Repo,
# ssl: true,
database: System.get_env("POSTGRES_DB", "bonfire"),
pool_size: String.to_integer(System.get_env("POOL_SIZE", "10")),
log: String.to_atom(System.get_env("DB_QUERIES_LOG_LEVEL", "debug"))
config :sentry,
dsn: System.get_env("SENTRY_DSN")
if System.get_env("SENTRY_NAME") do
config :sentry, server_name: System.get_env("SENTRY_NAME")
end
end # prod only config
# start prod and dev only config
if config_env() != :test do
config :bonfire, Bonfire.Repo,
slow_query_ms: String.to_integer(System.get_env("SLOW_QUERY_MS", "100"))
# transactional emails
mail_blackhole = fn var ->
IO.puts(
"WARNING: The environment variable #{var} was not set or was set incorrectly, mail will NOT be sent."
)
config :bonfire, Bonfire.Mailer, adapter: Bamboo.LocalAdapter
end
mail_mailgun = fn ->
# API URI depends on whether you're registered with Mailgun in EU, US, etc (defaults to EU)
base_uri = System.get_env("MAIL_BASE_URI", "https://api.eu.mailgun.net/v3")
case System.get_env("MAIL_KEY") do
nil ->
mail_blackhole.("MAIL_KEY")
key ->
case System.get_env("MAIL_DOMAIN") do
nil ->
mail_blackhole.("MAIL_DOMAIN")
domain ->
case System.get_env("MAIL_FROM") do
nil ->
mail_blackhole.("MAIL_FROM")
from ->
IO.puts("NOTE: Transactional emails will be sent through Mailgun.")
config :bonfire, Bonfire.Mailer,
adapter: Bamboo.MailgunAdapter,
api_key: key,
base_uri: base_uri,
domain: domain,
reply_to: from
end
end
end
end
mail_smtp = fn ->
case System.get_env("MAIL_SERVER") do
nil ->
mail_blackhole.("MAIL_SERVER")
server ->
case System.get_env("MAIL_DOMAIN") do
nil ->
mail_blackhole.("MAIL_DOMAIN")
domain ->
case System.get_env("MAIL_USER") do
nil ->
mail_blackhole.("MAIL_USER")
user ->
case System.get_env("MAIL_PASSWORD") do
nil ->
mail_blackhole.("MAIL_PASSWORD")
password ->
case System.get_env("MAIL_FROM") do
nil ->
mail_blackhole.("MAIL_FROM")
from ->
IO.puts("NOTE: Transactional emails will be sent through SMTP.")
config :bonfire, Bonfire.Mailer,
adapter: Bamboo.SMTPAdapter,
server: server,
hostname: domain,
port: String.to_integer(System.get_env("MAIL_PORT", "587")),
username: user,
password: password,
tls: :always,
allowed_tls_versions: [:"tlsv1.2"],
ssl: false,
retries: 1,
auth: :always,
reply_to: from
end
end
end
end
end
end
case System.get_env("MAIL_BACKEND") do
"mailgun" -> mail_mailgun.()
"smtp" -> mail_smtp.()
_ -> mail_blackhole.("MAIL_BACKEND")
end
end
### copy-paste Bonfire extension configs that need to read env at runtime
## bonfire_search
config :bonfire_search,
disable_indexing: System.get_env("SEARCH_INDEXING_DISABLED", "false"),
instance: System.get_env("SEARCH_MEILI_INSTANCE", "http://localhost:7700"), # protocol, hostname and port
api_key: System.get_env("MEILI_MASTER_KEY", "make-sure-to-change-me") # secret key
## bonfire_livebook
if Code.ensure_loaded?(Livebook.Config) do
config :livebook, :root_path, Livebook.Config.root_path!("LIVEBOOK_ROOT_PATH")
if password = Livebook.Config.password!("LIVEBOOK_PASSWORD") do
config :livebook, authentication_mode: :password, password: password
else
config :livebook, authentication_mode: :token
config :livebook, token: System.get_env("LIVEBOOK_TOKEN", Livebook.Utils.random_id())
end
config :livebook,
:cookie,
Livebook.Config.cookie!("LIVEBOOK_COOKIE") || Livebook.Utils.random_cookie()
config :livebook,
:default_runtime,
Livebook.Config.default_runtime!("LIVEBOOK_DEFAULT_RUNTIME") ||
{Livebook.Runtime.Embedded, []}
end

View file

@ -0,0 +1,38 @@
# COPY this file to /config/{dev|prod}/secrets.env and change ALL the values
# make sure you change everything to your own secrets!
# and do not check this into git or any public host
# for sessions/cookies, you can generate strings for these by running: make secrets
SECRET_KEY_BASE="you-should-put-a-secure-string-here"
SIGNING_SALT="you-should-put-a-different-secure-string-here"
ENCRYPTION_SALT="you-should-put-yet-another-secure-string-here"
# sentry client key
SENTRY_DSN=put-your-sentry-dsn-here
# database access
POSTGRES_USER=postgres
POSTGRES_DB=bonfire_db
POSTGRES_PASSWORD=put_a_secure_db_pw_here
# signup to mailgun.com and edit with your domain and API key
MAIL_DOMAIN=mailg.example.com
MAIL_KEY=123
MAIL_FROM=bonfire@example.com
# password for the search index
MEILI_MASTER_KEY=key-to-protect-search-indexing-here
# password for the default admin user if you run the seeds
SEEDS_USER=root
SEEDS_PW=password
# backend stuff
ERLANG_COOKIE=bonfire_cookie
# Bonfire extensions configs
WEB_PUSH_SUBJECT=mailto:administrator@mydomain.net
WEB_PUSH_PUBLIC_KEY=xyz
WEB_PUSH_PRIVATE_KEY=abc
GEOLOCATE_OPENCAGEDATA=
GITHUB_TOKEN=xyz

View file

@ -0,0 +1,28 @@
FLAVOUR=haha
# COPY this file to /config/{dev|prod}/public.env and change any values as required
# server domain name:
HOSTNAME=localhost
# server port:
SERVER_PORT=4000
# port your visitors will access (typically 80 or 443, will be different than SERVER_PORT only if using a reverse proxy)
PUBLIC_PORT=4000
# what service to use for sending out emails (eg. smtp, mailgun, none) NOTE: you should also set the corresponding keys in secrets.env
MAIL_BACKEND=none
# hostname and port of meili search index
SEARCH_MEILI_INSTANCE=http://localhost:7700
# require an email address to be invited before being able to sign up
INVITE_ONLY=true
# a name and tagline for your instance
INSTANCE_DESCRIPTION="An instance of Bonfire, a federated app ecosystem for open and cooperative networks"
# uncomment in order to NOT automatically change the database schema when you upgrade the app
# DISABLE_DB_AUTOMIGRATION=true
# max file upload size (default is 20 meg)
UPLOAD_LIMIT=20000000
# ====================================
# You should not have to edit any of the following ones:
POSTGRES_HOST=localhost
LANG=en_US.UTF-8
REPLACE_OS_VARS=true
LIVEVIEW_ENABLED=true
ACME_AGREE=true

View file

@ -0,0 +1,54 @@
import Config
## Import or set test configs for extensions
import_config "activity_pub_test.exs"
config :bonfire, Bonfire.Mailer, adapter: Bamboo.TestAdapter
config :bonfire_search,
disabled: true,
disable_indexing: true
## Other general test config
config :logger, level: :warn
# config :logger, level: :notice
# Configure your database
db = "bonfire_test#{System.get_env("MIX_TEST_PARTITION")}"
#
# The MIX_TEST_PARTITION environment variable can be used
# to provide built-in test partitioning in CI environment.
# Run `mix help test` for more information.
config :bonfire, Bonfire.Repo,
pool: Ecto.Adapters.SQL.Sandbox,
pool_size: 60,
# show_sensitive_data_on_connection_error: true,
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.
config :bonfire, Bonfire.Web.Endpoint,
http: [port: 4002],
server: false
config :bonfire, Oban,
crontab: false,
plugins: false,
queues: false
config :pbkdf2_elixir, :rounds, 1
config :mix_test_interactive,
clear: true
config :paginator, ecto_repos: [Bonfire.Repo]
config :paginator, Paginator.Repo,
pool: Ecto.Adapters.SQL.Sandbox,
username: System.get_env("POSTGRES_USER", "postgres"),
password: System.get_env("POSTGRES_PASSWORD", "postgres"),
hostname: System.get_env("POSTGRES_HOST", "localhost"),
database: db

View file

@ -0,0 +1,4 @@
[
import_deps: [:ecto_sql],
inputs: ["*.exs"]
]

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20200523081010_hello_world.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20200523081012_init_pointers.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20200523081013_init_pointers_ulid.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20200805090401_create_ap_tables.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20200817072952_create_oban_tables.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20200818094943_import_ap.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20200820094941_import_boundaries.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20200828094943_add_files.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20200828094944_import_me.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20200828094945_import_social.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20200829004946_boundaries_fixtures.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20200924084501_tagged.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20201205094942_import_classify.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20201208094940_import_geolocation.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20210201094944_import_replied.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20210302094944_import_boost.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20210302094945_import_flag.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20210302094946_import_inbox.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20210401094942_count_functions.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20210402105128_ap_test_table.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20210407094946_message.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20210410094945_profile_images.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20210412094946_fp.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20210618094945_peered_uri.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20210831134330_update_oban_jobs_table.exs

View file

@ -0,0 +1 @@
../../../classic/repo/migrations/20210923093415_import_ap_activity.exs

View file

@ -0,0 +1,15 @@
defmodule Bonfire.Repo.Migrations.TaxonomySeeder do
use Ecto.Migration
def up do
Bonfire.TaxonomySeeder.Migrations.up()
Bonfire.TaxonomySeeder.Migrations.add_category()
end
def down do
Bonfire.TaxonomySeeder.Migrations.down()
end
# def change, do: nil
end

View file

@ -0,0 +1,7 @@
defmodule Bonfire.Repo.Seeds.TaxonomySeeds do
use Bonfire.Seeder
envs [:dev, :prod, :test]
def up(repo), do: Bonfire.TaxonomySeeder.IndexingBatch.batch(repo)
end

View file

@ -0,0 +1,62 @@
# Script for populating the database. You can run it with `mix ecto.seeds`
#
import Bonfire.Me.Fake
System.put_env("INVITE_ONLY", "false")
System.put_env("SEARCH_INDEXING_DISABLED", "true")
%{
preferred_username: System.get_env("SEEDS_USER", "root"),
name: System.get_env("SEEDS_USER", "Seed User")
}
|> fake_user!(%{confirm_email: true})
# create some users
users = for _ <- 1..3, do: fake_user!()
random_user = fn -> Faker.Util.pick(users) end
# start fake threads
#for _ <- 1..3 do
# user = random_user.()
# thread = fake_thread!(user)
# comment = fake_comment!(user, thread)
# # reply to it
# reply = fake_comment!(random_user.(), thread, %{in_reply_to_id: comment.id})
# subreply = fake_comment!(random_user.(), thread, %{in_reply_to_id: reply.id})
# subreply2 = fake_comment!(random_user.(), thread, %{in_reply_to_id: subreply.id})
#end
#
## more fake threads
#for _ <- 1..2 do
# user = random_user.()
# thread = fake_thread!(user)
# comment = fake_comment!(user, thread)
#end
# define some tags/categories
if(Bonfire.Common.Extend.extension_enabled?(Bonfire.Classify.Simulate)) do
for _ <- 1..2 do
category = Bonfire.Classify.Simulate.fake_category!(random_user.())
_subcategory = Bonfire.Classify.Simulate.fake_category!(random_user.(), category)
end
end
# define some geolocations
if(Bonfire.Common.Extend.extension_enabled?(Bonfire.Geolocate.Simulate)) do
for _ <- 1..2,
do: Bonfire.Geolocate.Simulate.fake_geolocation!(random_user.())
for _ <- 1..2,
do: Bonfire.Geolocate.Simulate.fake_geolocation!(random_user.())
end
# define some units
if(Bonfire.Common.Extend.extension_enabled?(Bonfire.Quantify.Simulate)) do
for _ <- 1..2 do
_unit1 = Bonfire.Quantify.Simulate.fake_unit!(random_user.())
_unit2 = Bonfire.Quantify.Simulate.fake_unit!(random_user.())
end
end

View file

@ -1 +0,0 @@
../../../coordination/repo/migrations/20200902084500_taxonomy_seeder.exs