forked from potsda.mn/mobilizon
Rename project to Mobilizon
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
3b48ac957f
commit
559c889f1b
|
@ -6,11 +6,11 @@ services:
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
MIX_ENV: "test"
|
MIX_ENV: "test"
|
||||||
POSTGRES_DB: eventos_test
|
POSTGRES_DB: mobilizon_test
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
POSTGRES_PASSWORD: ""
|
POSTGRES_PASSWORD: ""
|
||||||
POSTGRES_HOST: postgres
|
POSTGRES_HOST: postgres
|
||||||
GEOLITE_CITIES_PATH: "/builds/tcit/eventos/priv/data/GeoLite2-City.mmdb"
|
GEOLITE_CITIES_PATH: "/builds/tcit/mobilizon/priv/data/GeoLite2-City.mmdb"
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
key: "$CI_JOB_NAME"
|
key: "$CI_JOB_NAME"
|
||||||
|
|
2
LICENSE
2
LICENSE
|
@ -629,7 +629,7 @@ to attach them to the start of each source file to most effectively
|
||||||
state the exclusion of warranty; and each file should have at least
|
state the exclusion of warranty; and each file should have at least
|
||||||
the "copyright" line and a pointer to where the full notice is found.
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
eventos
|
Mobilizon
|
||||||
Copyright (C) 2018 Thomas Citharel
|
Copyright (C) 2018 Thomas Citharel
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Eventos
|
# Mobilizon
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ to start a database container, an API container and the front-end dev container
|
||||||
* Fetch dependencies with `mix deps.get`.
|
* Fetch dependencies with `mix deps.get`.
|
||||||
* Create your database with `mix ecto.create`.
|
* Create your database with `mix ecto.create`.
|
||||||
* Create the postgis extension on the database with a postgres user that has
|
* Create the postgis extension on the database with a postgres user that has
|
||||||
superuser capabilities: `psql eventos_dev`
|
superuser capabilities: `psql mobilizon_dev`
|
||||||
|
|
||||||
``` create extension if not exists postgis; ```
|
``` create extension if not exists postgis; ```
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
use Mix.Config
|
use Mix.Config
|
||||||
|
|
||||||
# General application configuration
|
# General application configuration
|
||||||
config :eventos,
|
config :mobilizon,
|
||||||
ecto_repos: [Eventos.Repo]
|
ecto_repos: [Mobilizon.Repo]
|
||||||
|
|
||||||
config :eventos, :instance,
|
config :mobilizon, :instance,
|
||||||
name: "Localhost",
|
name: "Localhost",
|
||||||
version: "1.0.0-dev",
|
version: "1.0.0-dev",
|
||||||
registrations_open: true
|
registrations_open: true
|
||||||
|
@ -20,11 +20,11 @@ config :mime, :types, %{
|
||||||
}
|
}
|
||||||
|
|
||||||
# Configures the endpoint
|
# Configures the endpoint
|
||||||
config :eventos, EventosWeb.Endpoint,
|
config :mobilizon, MobilizonWeb.Endpoint,
|
||||||
url: [host: "localhost"],
|
url: [host: "localhost"],
|
||||||
secret_key_base: "1yOazsoE0Wqu4kXk3uC5gu3jDbShOimTCzyFL3OjCdBmOXMyHX87Qmf3+Tu9s0iM",
|
secret_key_base: "1yOazsoE0Wqu4kXk3uC5gu3jDbShOimTCzyFL3OjCdBmOXMyHX87Qmf3+Tu9s0iM",
|
||||||
render_errors: [view: EventosWeb.ErrorView, accepts: ~w(html json)],
|
render_errors: [view: MobilizonWeb.ErrorView, accepts: ~w(html json)],
|
||||||
pubsub: [name: Eventos.PubSub, adapter: Phoenix.PubSub.PG2],
|
pubsub: [name: Mobilizon.PubSub, adapter: Phoenix.PubSub.PG2],
|
||||||
instance: "localhost",
|
instance: "localhost",
|
||||||
email_from: "noreply@localhost",
|
email_from: "noreply@localhost",
|
||||||
email_to: "noreply@localhost"
|
email_to: "noreply@localhost"
|
||||||
|
@ -38,12 +38,12 @@ config :logger, :console,
|
||||||
# of this file so it overrides the configuration defined above.
|
# of this file so it overrides the configuration defined above.
|
||||||
import_config "#{Mix.env()}.exs"
|
import_config "#{Mix.env()}.exs"
|
||||||
|
|
||||||
config :eventos, EventosWeb.Guardian,
|
config :mobilizon, MobilizonWeb.Guardian,
|
||||||
issuer: "eventos",
|
issuer: "mobilizon",
|
||||||
secret_key: "ty0WM7YBE3ojvxoUQxo8AERrNpfbXnIJ82ovkPdqbUFw31T5LcK8wGjaOiReVQjo"
|
secret_key: "ty0WM7YBE3ojvxoUQxo8AERrNpfbXnIJ82ovkPdqbUFw31T5LcK8wGjaOiReVQjo"
|
||||||
|
|
||||||
config :guardian, Guardian.DB,
|
config :guardian, Guardian.DB,
|
||||||
repo: Eventos.Repo,
|
repo: Mobilizon.Repo,
|
||||||
# default
|
# default
|
||||||
schema_name: "guardian_tokens",
|
schema_name: "guardian_tokens",
|
||||||
# store all token types if not set
|
# store all token types if not set
|
||||||
|
|
|
@ -6,7 +6,7 @@ use Mix.Config
|
||||||
# The watchers configuration can be used to run external
|
# The watchers configuration can be used to run external
|
||||||
# watchers to your application. For example, we use it
|
# watchers to your application. For example, we use it
|
||||||
# with brunch.io to recompile .js and .css sources.
|
# with brunch.io to recompile .js and .css sources.
|
||||||
config :eventos, EventosWeb.Endpoint,
|
config :mobilizon, MobilizonWeb.Endpoint,
|
||||||
http: [port: System.get_env("PORT") || 4001],
|
http: [port: System.get_env("PORT") || 4001],
|
||||||
debug_errors: true,
|
debug_errors: true,
|
||||||
code_reloader: true,
|
code_reloader: true,
|
||||||
|
@ -30,13 +30,13 @@ config :eventos, EventosWeb.Endpoint,
|
||||||
# different ports.
|
# different ports.
|
||||||
|
|
||||||
# Watch static and templates for browser reloading.
|
# Watch static and templates for browser reloading.
|
||||||
config :eventos, EventosWeb.Endpoint,
|
config :mobilizon, MobilizonWeb.Endpoint,
|
||||||
live_reload: [
|
live_reload: [
|
||||||
patterns: [
|
patterns: [
|
||||||
~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$},
|
~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$},
|
||||||
~r{priv/gettext/.*(po)$},
|
~r{priv/gettext/.*(po)$},
|
||||||
~r{lib/eventos_web/views/.*(ex)$},
|
~r{lib/mobilizon_web/views/.*(ex)$},
|
||||||
~r{lib/eventos_web/templates/.*(eex)$}
|
~r{lib/mobilizon_web/templates/.*(eex)$}
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -47,14 +47,14 @@ config :logger, :console, format: "[$level] $message\n", level: :debug
|
||||||
# in production as building large stacktraces may be expensive.
|
# in production as building large stacktraces may be expensive.
|
||||||
config :phoenix, :stacktrace_depth, 20
|
config :phoenix, :stacktrace_depth, 20
|
||||||
|
|
||||||
config :eventos, Eventos.Mailer, adapter: Bamboo.LocalAdapter
|
config :mobilizon, Mobilizon.Mailer, adapter: Bamboo.LocalAdapter
|
||||||
|
|
||||||
# Configure your database
|
# Configure your database
|
||||||
config :eventos, Eventos.Repo,
|
config :mobilizon, Mobilizon.Repo,
|
||||||
adapter: Ecto.Adapters.Postgres,
|
adapter: Ecto.Adapters.Postgres,
|
||||||
types: Eventos.PostgresTypes,
|
types: Mobilizon.PostgresTypes,
|
||||||
username: System.get_env("POSTGRES_USER") || "elixir",
|
username: System.get_env("POSTGRES_USER") || "elixir",
|
||||||
password: System.get_env("POSTGRES_PASSWORD") || "elixir",
|
password: System.get_env("POSTGRES_PASSWORD") || "elixir",
|
||||||
database: System.get_env("POSTGRES_DATABASE") || "eventos_dev",
|
database: System.get_env("POSTGRES_DATABASE") || "mobilizon_dev",
|
||||||
hostname: System.get_env("POSTGRES_HOST") || "localhost",
|
hostname: System.get_env("POSTGRES_HOST") || "localhost",
|
||||||
pool_size: 10
|
pool_size: 10
|
||||||
|
|
|
@ -3,7 +3,7 @@ use Mix.Config
|
||||||
# For production, we often load configuration from external
|
# For production, we often load configuration from external
|
||||||
# sources, such as your system environment. For this reason,
|
# sources, such as your system environment. For this reason,
|
||||||
# you won't find the :http configuration below, but set inside
|
# you won't find the :http configuration below, but set inside
|
||||||
# EventosWeb.Endpoint.init/2 when load_from_system_env is
|
# MobilizonWeb.Endpoint.init/2 when load_from_system_env is
|
||||||
# true. Any dynamic configuration should be done there.
|
# true. Any dynamic configuration should be done there.
|
||||||
#
|
#
|
||||||
# Don't forget to configure the url host to something meaningful,
|
# Don't forget to configure the url host to something meaningful,
|
||||||
|
@ -13,12 +13,12 @@ use Mix.Config
|
||||||
# containing the digested version of static files. This
|
# containing the digested version of static files. This
|
||||||
# manifest is generated by the mix phx.digest task
|
# manifest is generated by the mix phx.digest task
|
||||||
# which you typically run after static files are built.
|
# which you typically run after static files are built.
|
||||||
config :eventos, EventosWeb.Endpoint,
|
config :mobilizon, MobilizonWeb.Endpoint,
|
||||||
load_from_system_env: true,
|
load_from_system_env: true,
|
||||||
url: [host: "example.com", port: 80],
|
url: [host: "example.com", port: 80],
|
||||||
cache_static_manifest: "priv/static/cache_manifest.json"
|
cache_static_manifest: "priv/static/cache_manifest.json"
|
||||||
|
|
||||||
config :eventos, Eventos.Mailer,
|
config :mobilizon, Mobilizon.Mailer,
|
||||||
adapter: Bamboo.SMTPAdapter,
|
adapter: Bamboo.SMTPAdapter,
|
||||||
server: "localhost",
|
server: "localhost",
|
||||||
hostname: "localhost",
|
hostname: "localhost",
|
||||||
|
@ -45,7 +45,7 @@ config :logger, level: :info
|
||||||
# To get SSL working, you will need to add the `https` key
|
# To get SSL working, you will need to add the `https` key
|
||||||
# to the previous section and set your `:url` port to 443:
|
# to the previous section and set your `:url` port to 443:
|
||||||
#
|
#
|
||||||
# config :eventos, EventosWeb.Endpoint,
|
# config :mobilizon, MobilizonWeb.Endpoint,
|
||||||
# ...
|
# ...
|
||||||
# url: [host: "example.com", port: 443],
|
# url: [host: "example.com", port: 443],
|
||||||
# https: [:inet6,
|
# https: [:inet6,
|
||||||
|
@ -60,7 +60,7 @@ config :logger, level: :info
|
||||||
# We also recommend setting `force_ssl`, ensuring no data is
|
# We also recommend setting `force_ssl`, ensuring no data is
|
||||||
# ever sent via http, always redirecting to https:
|
# ever sent via http, always redirecting to https:
|
||||||
#
|
#
|
||||||
# config :eventos, EventosWeb.Endpoint,
|
# config :mobilizon, MobilizonWeb.Endpoint,
|
||||||
# force_ssl: [hsts: true]
|
# force_ssl: [hsts: true]
|
||||||
#
|
#
|
||||||
# Check `Plug.SSL` for all available options in `force_ssl`.
|
# Check `Plug.SSL` for all available options in `force_ssl`.
|
||||||
|
@ -75,7 +75,7 @@ config :logger, level: :info
|
||||||
# Alternatively, you can configure exactly which server to
|
# Alternatively, you can configure exactly which server to
|
||||||
# start per endpoint:
|
# start per endpoint:
|
||||||
#
|
#
|
||||||
# config :eventos, EventosWeb.Endpoint, server: true
|
# config :mobilizon, MobilizonWeb.Endpoint, server: true
|
||||||
#
|
#
|
||||||
|
|
||||||
# Finally import the config/prod.secret.exs
|
# Finally import the config/prod.secret.exs
|
||||||
|
|
|
@ -2,7 +2,7 @@ use Mix.Config
|
||||||
|
|
||||||
# We don't run a server during test. If one is required,
|
# We don't run a server during test. If one is required,
|
||||||
# you can enable the server option below.
|
# you can enable the server option below.
|
||||||
config :eventos, EventosWeb.Endpoint,
|
config :mobilizon, MobilizonWeb.Endpoint,
|
||||||
http: [port: 4001],
|
http: [port: 4001],
|
||||||
server: false
|
server: false
|
||||||
|
|
||||||
|
@ -13,13 +13,13 @@ config :logger,
|
||||||
level: :info
|
level: :info
|
||||||
|
|
||||||
# Configure your database
|
# Configure your database
|
||||||
config :eventos, Eventos.Repo,
|
config :mobilizon, Mobilizon.Repo,
|
||||||
adapter: Ecto.Adapters.Postgres,
|
adapter: Ecto.Adapters.Postgres,
|
||||||
username: System.get_env("POSTGRES_USER") || "elixir",
|
username: System.get_env("POSTGRES_USER") || "elixir",
|
||||||
password: System.get_env("POSTGRES_PASSWORD") || "elixir",
|
password: System.get_env("POSTGRES_PASSWORD") || "elixir",
|
||||||
database: "eventos_test",
|
database: "mobilizon_test",
|
||||||
hostname: System.get_env("POSTGRES_HOST") || "localhost",
|
hostname: System.get_env("POSTGRES_HOST") || "localhost",
|
||||||
pool: Ecto.Adapters.SQL.Sandbox,
|
pool: Ecto.Adapters.SQL.Sandbox,
|
||||||
types: Eventos.PostgresTypes
|
types: Mobilizon.PostgresTypes
|
||||||
|
|
||||||
config :eventos, Eventos.Mailer, adapter: Bamboo.TestAdapter
|
config :mobilizon, Mobilizon.Mailer, adapter: Bamboo.TestAdapter
|
||||||
|
|
|
@ -3,15 +3,15 @@ version: '3'
|
||||||
services:
|
services:
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
container_name: eventos_db
|
container_name: mobilizon_db
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
image: mdillon/postgis:10
|
image: mdillon/postgis:10
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_PASSWORD: postgres
|
POSTGRES_PASSWORD: postgres
|
||||||
POSTGRES_DB: eventos_dev
|
POSTGRES_DB: mobilizon_dev
|
||||||
|
|
||||||
front:
|
front:
|
||||||
container_name: eventos_front
|
container_name: mobilizon_front
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
build: ./js
|
build: ./js
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -21,7 +21,7 @@ services:
|
||||||
entrypoint: entrypoint
|
entrypoint: entrypoint
|
||||||
|
|
||||||
api:
|
api:
|
||||||
container_name: eventos_api
|
container_name: mobilizon_api
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
build: .
|
build: .
|
||||||
volumes:
|
volumes:
|
||||||
|
@ -33,7 +33,7 @@ services:
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_PASSWORD: postgres
|
POSTGRES_PASSWORD: postgres
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
POSTGRES_DATABASE: eventos_dev
|
POSTGRES_DATABASE: mobilizon_dev
|
||||||
POSTGRES_HOST: postgres
|
POSTGRES_HOST: postgres
|
||||||
PORT: 4000
|
PORT: 4000
|
||||||
entrypoint: entrypoint
|
entrypoint: entrypoint
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
API_HOST=eventos.tld
|
API_HOST=mobilizon.tld
|
||||||
API_ORIGIN=https://eventos.tld
|
API_ORIGIN=https://mobilizon.tld
|
||||||
API_PATH=/api/v1
|
API_PATH=/api/v1
|
||||||
|
|
2
js/package-lock.json
generated
2
js/package-lock.json
generated
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "eventos",
|
"name": "mobilizon",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "eventos",
|
"name": "mobilizon",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||||
<title>eventos</title>
|
<title>mobilizon</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>
|
<noscript>
|
||||||
<strong>We're sorry but eventos doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
<strong>We're sorry but mobilizon doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||||
</noscript>
|
</noscript>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<!-- built files will be auto injected -->
|
<!-- built files will be auto injected -->
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "eventos",
|
"name": "mobilizon",
|
||||||
"short_name": "eventos",
|
"short_name": "mobilizon",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "/img/icons/android-chrome-192x192.png",
|
"src": "/img/icons/android-chrome-192x192.png",
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<v-layout align-center>
|
<v-layout align-center>
|
||||||
<v-flex text-xs-center>
|
<v-flex text-xs-center>
|
||||||
<h1 class="display-3">Find events you like</h1>
|
<h1 class="display-3">Find events you like</h1>
|
||||||
<h2>Share it with Eventos</h2>
|
<h2>Share it with Mobilizon</h2>
|
||||||
<v-btn :to="{ name: 'Register' }">{{ $t("home.register") }}</v-btn>
|
<v-btn :to="{ name: 'Register' }">{{ $t("home.register") }}</v-btn>
|
||||||
</v-flex>
|
</v-flex>
|
||||||
</v-layout>
|
</v-layout>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
>
|
>
|
||||||
<v-toolbar-title style="width: 300px" class="ml-0 pl-3 white--text">
|
<v-toolbar-title style="width: 300px" class="ml-0 pl-3 white--text">
|
||||||
<v-toolbar-side-icon @click.stop="toggleDrawer()"></v-toolbar-side-icon>
|
<v-toolbar-side-icon @click.stop="toggleDrawer()"></v-toolbar-side-icon>
|
||||||
<router-link :to="{ name: 'Home' }" class="hidden-sm-and-down white--text">Eventos
|
<router-link :to="{ name: 'Home' }" class="hidden-sm-and-down white--text">Mobilizon
|
||||||
</router-link>
|
</router-link>
|
||||||
</v-toolbar-title>
|
</v-toolbar-title>
|
||||||
<v-autocomplete
|
<v-autocomplete
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
export default {
|
export default {
|
||||||
home: {
|
home: {
|
||||||
welcome: 'Welcome on Eventos, {username}',
|
welcome: 'Welcome on Mobilizon, {username}',
|
||||||
welcome_off: 'Welcome on Eventos',
|
welcome_off: 'Welcome on Mobilizon',
|
||||||
events: 'Events',
|
events: 'Events',
|
||||||
groups: 'Groups',
|
groups: 'Groups',
|
||||||
login: 'Login',
|
login: 'Login',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
export default {
|
export default {
|
||||||
home: {
|
home: {
|
||||||
welcome: 'Bienvenue sur Eventos, {username}!',
|
welcome: 'Bienvenue sur Mobilizon, {username}!',
|
||||||
welcome_off: 'Bienvenue sur Eventos',
|
welcome_off: 'Bienvenue sur Mobilizon',
|
||||||
events: 'Événements',
|
events: 'Événements',
|
||||||
groups: 'Groupes',
|
groups: 'Groupes',
|
||||||
login: 'Se connecter',
|
login: 'Se connecter',
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
defmodule Eventos do
|
defmodule Mobilizon do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Eventos is a decentralized and federated Meetup-like using [ActivityPub](http://activitypub.rocks/).
|
Mobilizon is a decentralized and federated Meetup-like using [ActivityPub](http://activitypub.rocks/).
|
||||||
|
|
||||||
It consists of an API server build with [Elixir](http://elixir-lang.github.io/) and the [Phoenix Framework](https://hexdocs.pm/phoenix).
|
It consists of an API server build with [Elixir](http://elixir-lang.github.io/) and the [Phoenix Framework](https://hexdocs.pm/phoenix).
|
||||||
|
|
||||||
Eventos relies on `Guardian` for auth and `Geo`/Postgis for geographical informations.
|
Mobilizon relies on `Guardian` for auth and `Geo`/Postgis for geographical informations.
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
defmodule Eventos.Mailer do
|
|
||||||
@moduledoc """
|
|
||||||
Mailer
|
|
||||||
"""
|
|
||||||
use Bamboo.Mailer, otp_app: :eventos
|
|
||||||
end
|
|
|
@ -1,12 +1,12 @@
|
||||||
defmodule EventosWeb do
|
defmodule MobilizonWeb do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
The entrypoint for defining your web interface, such
|
The entrypoint for defining your web interface, such
|
||||||
as controllers, views, channels and so on.
|
as controllers, views, channels and so on.
|
||||||
|
|
||||||
This can be used in your application as:
|
This can be used in your application as:
|
||||||
|
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
use EventosWeb, :view
|
use MobilizonWeb, :view
|
||||||
|
|
||||||
The definitions below will be executed for every view,
|
The definitions below will be executed for every view,
|
||||||
controller, etc, so keep them short and clean, focused
|
controller, etc, so keep them short and clean, focused
|
||||||
|
@ -19,18 +19,18 @@ defmodule EventosWeb do
|
||||||
|
|
||||||
def controller do
|
def controller do
|
||||||
quote do
|
quote do
|
||||||
use Phoenix.Controller, namespace: EventosWeb
|
use Phoenix.Controller, namespace: MobilizonWeb
|
||||||
import Plug.Conn
|
import Plug.Conn
|
||||||
import EventosWeb.Router.Helpers
|
import MobilizonWeb.Router.Helpers
|
||||||
import EventosWeb.Gettext
|
import MobilizonWeb.Gettext
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def view do
|
def view do
|
||||||
quote do
|
quote do
|
||||||
use Phoenix.View,
|
use Phoenix.View,
|
||||||
root: "lib/eventos_web/templates",
|
root: "lib/mobilizon_web/templates",
|
||||||
namespace: EventosWeb
|
namespace: MobilizonWeb
|
||||||
|
|
||||||
# Import convenience functions from controllers
|
# Import convenience functions from controllers
|
||||||
import Phoenix.Controller, only: [get_flash: 2, view_module: 1]
|
import Phoenix.Controller, only: [get_flash: 2, view_module: 1]
|
||||||
|
@ -38,9 +38,9 @@ defmodule EventosWeb do
|
||||||
# Use all HTML functionality (forms, tags, etc)
|
# Use all HTML functionality (forms, tags, etc)
|
||||||
use Phoenix.HTML
|
use Phoenix.HTML
|
||||||
|
|
||||||
import EventosWeb.Router.Helpers
|
import MobilizonWeb.Router.Helpers
|
||||||
import EventosWeb.ErrorHelpers
|
import MobilizonWeb.ErrorHelpers
|
||||||
import EventosWeb.Gettext
|
import MobilizonWeb.Gettext
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ defmodule EventosWeb do
|
||||||
def channel do
|
def channel do
|
||||||
quote do
|
quote do
|
||||||
use Phoenix.Channel
|
use Phoenix.Channel
|
||||||
import EventosWeb.Gettext
|
import MobilizonWeb.Gettext
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
defmodule EventosWeb.InboxesController do
|
|
||||||
use EventosWeb, :controller
|
|
||||||
|
|
||||||
def create(conn) do
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,10 +0,0 @@
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<link rel="stylesheet" href="<%= static_url(EventosWeb.Endpoint, "/css/email.css") %>">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<%= render @view_module, @view_template, assigns %>
|
|
||||||
|
|
||||||
<p><%= gettext "An email sent by Eventos on %{instance}.", instance: @instance %></p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,3 +0,0 @@
|
||||||
<%= render @view_module, @view_template, assigns %>
|
|
||||||
|
|
||||||
<%= gettext "An email sent by Eventos on %{instance}.", instance: @instance %>
|
|
|
@ -1,3 +0,0 @@
|
||||||
defmodule Eventos.EmailView do
|
|
||||||
use EventosWeb, :view
|
|
||||||
end
|
|
|
@ -1,6 +0,0 @@
|
||||||
defmodule EventosWeb.PageView do
|
|
||||||
@moduledoc """
|
|
||||||
View for our webapp
|
|
||||||
"""
|
|
||||||
use EventosWeb, :view
|
|
||||||
end
|
|
|
@ -1,10 +0,0 @@
|
||||||
defmodule EventosWeb.UserSessionView do
|
|
||||||
@moduledoc """
|
|
||||||
View for user Sessions
|
|
||||||
"""
|
|
||||||
use EventosWeb, :view
|
|
||||||
|
|
||||||
def render("token.json", %{token: token, user: user}) do
|
|
||||||
%{token: token, user: render_one(user, EventosWeb.UserView, "user_simple.json")}
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -4,10 +4,10 @@ defmodule Mix.Tasks.CreateBot do
|
||||||
"""
|
"""
|
||||||
|
|
||||||
use Mix.Task
|
use Mix.Task
|
||||||
alias Eventos.Actors
|
alias Mobilizon.Actors
|
||||||
alias Eventos.Actors.Bot
|
alias Mobilizon.Actors.Bot
|
||||||
alias Eventos.Repo
|
alias Mobilizon.Repo
|
||||||
alias Eventos.Actors.User
|
alias Mobilizon.Actors.User
|
||||||
import Logger
|
import Logger
|
||||||
|
|
||||||
@shortdoc "Register user"
|
@shortdoc "Register user"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule Eventos.Activity do
|
defmodule Mobilizon.Activity do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Represents an activity
|
Represents an activity
|
||||||
"""
|
"""
|
|
@ -1,6 +1,6 @@
|
||||||
import EctoEnum
|
import EctoEnum
|
||||||
|
|
||||||
defenum(Eventos.Actors.ActorTypeEnum, :actor_type, [
|
defenum(Mobilizon.Actors.ActorTypeEnum, :actor_type, [
|
||||||
:Person,
|
:Person,
|
||||||
:Application,
|
:Application,
|
||||||
:Group,
|
:Group,
|
||||||
|
@ -8,19 +8,19 @@ defenum(Eventos.Actors.ActorTypeEnum, :actor_type, [
|
||||||
:Service
|
:Service
|
||||||
])
|
])
|
||||||
|
|
||||||
defmodule Eventos.Actors.Actor do
|
defmodule Mobilizon.Actors.Actor do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Represents an actor (local and remote actors)
|
Represents an actor (local and remote actors)
|
||||||
"""
|
"""
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
alias Eventos.Actors
|
alias Mobilizon.Actors
|
||||||
alias Eventos.Actors.{Actor, User, Follower, Member}
|
alias Mobilizon.Actors.{Actor, User, Follower, Member}
|
||||||
alias Eventos.Events.Event
|
alias Mobilizon.Events.Event
|
||||||
alias Eventos.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
|
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
alias Eventos.Repo
|
alias Mobilizon.Repo
|
||||||
|
|
||||||
import Logger
|
import Logger
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ defmodule Eventos.Actors.Actor do
|
||||||
field(:following_url, :string)
|
field(:following_url, :string)
|
||||||
field(:followers_url, :string)
|
field(:followers_url, :string)
|
||||||
field(:shared_inbox_url, :string)
|
field(:shared_inbox_url, :string)
|
||||||
field(:type, Eventos.Actors.ActorTypeEnum, default: :Person)
|
field(:type, Mobilizon.Actors.ActorTypeEnum, default: :Person)
|
||||||
field(:name, :string)
|
field(:name, :string)
|
||||||
field(:domain, :string)
|
field(:domain, :string)
|
||||||
field(:summary, :string)
|
field(:summary, :string)
|
||||||
|
@ -73,7 +73,7 @@ defmodule Eventos.Actors.Actor do
|
||||||
:banner_url,
|
:banner_url,
|
||||||
:user_id
|
:user_id
|
||||||
])
|
])
|
||||||
|> put_change(:url, "#{EventosWeb.Endpoint.url()}/@#{attrs["preferred_username"]}")
|
|> put_change(:url, "#{MobilizonWeb.Endpoint.url()}/@#{attrs["preferred_username"]}")
|
||||||
|> validate_required([:preferred_username, :keys, :suspended, :url])
|
|> validate_required([:preferred_username, :keys, :suspended, :url])
|
||||||
|> unique_constraint(:preferred_username, name: :actors_preferred_username_domain_index)
|
|> unique_constraint(:preferred_username, name: :actors_preferred_username_domain_index)
|
||||||
end
|
end
|
||||||
|
@ -94,10 +94,10 @@ defmodule Eventos.Actors.Actor do
|
||||||
:user_id
|
:user_id
|
||||||
])
|
])
|
||||||
|> unique_constraint(:preferred_username, name: :actors_preferred_username_domain_index)
|
|> unique_constraint(:preferred_username, name: :actors_preferred_username_domain_index)
|
||||||
|> put_change(:url, "#{EventosWeb.Endpoint.url()}/@#{attrs.preferred_username}")
|
|> put_change(:url, "#{MobilizonWeb.Endpoint.url()}/@#{attrs.preferred_username}")
|
||||||
|> put_change(:inbox_url, "#{EventosWeb.Endpoint.url()}/@#{attrs.preferred_username}/inbox")
|
|> put_change(:inbox_url, "#{MobilizonWeb.Endpoint.url()}/@#{attrs.preferred_username}/inbox")
|
||||||
|> put_change(:outbox_url, "#{EventosWeb.Endpoint.url()}/@#{attrs.preferred_username}/outbox")
|
|> put_change(:outbox_url, "#{MobilizonWeb.Endpoint.url()}/@#{attrs.preferred_username}/outbox")
|
||||||
|> put_change(:shared_inbox_url, "#{EventosWeb.Endpoint.url()}/inbox")
|
|> put_change(:shared_inbox_url, "#{MobilizonWeb.Endpoint.url()}/inbox")
|
||||||
|> validate_required([:preferred_username, :keys, :suspended, :url, :type])
|
|> validate_required([:preferred_username, :keys, :suspended, :url, :type])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -160,14 +160,14 @@ defmodule Eventos.Actors.Actor do
|
||||||
])
|
])
|
||||||
|> put_change(
|
|> put_change(
|
||||||
:outbox_url,
|
:outbox_url,
|
||||||
"#{EventosWeb.Endpoint.url()}/@#{params["preferred_username"]}/outbox"
|
"#{MobilizonWeb.Endpoint.url()}/@#{params["preferred_username"]}/outbox"
|
||||||
)
|
)
|
||||||
|> put_change(
|
|> put_change(
|
||||||
:inbox_url,
|
:inbox_url,
|
||||||
"#{EventosWeb.Endpoint.url()}/@#{params["preferred_username"]}/inbox"
|
"#{MobilizonWeb.Endpoint.url()}/@#{params["preferred_username"]}/inbox"
|
||||||
)
|
)
|
||||||
|> put_change(:shared_inbox_url, "#{EventosWeb.Endpoint.url()}/inbox")
|
|> put_change(:shared_inbox_url, "#{MobilizonWeb.Endpoint.url()}/inbox")
|
||||||
|> put_change(:url, "#{EventosWeb.Endpoint.url()}/@#{params["preferred_username"]}")
|
|> put_change(:url, "#{MobilizonWeb.Endpoint.url()}/@#{params["preferred_username"]}")
|
||||||
|> put_change(:domain, nil)
|
|> put_change(:domain, nil)
|
||||||
|> put_change(:type, :Group)
|
|> put_change(:type, :Group)
|
||||||
|> validate_required([:url, :outbox_url, :inbox_url, :type, :name, :preferred_username])
|
|> validate_required([:url, :outbox_url, :inbox_url, :type, :name, :preferred_username])
|
||||||
|
@ -180,7 +180,7 @@ defmodule Eventos.Actors.Actor do
|
||||||
def get_public_key_for_url(url) do
|
def get_public_key_for_url(url) do
|
||||||
with {:ok, %Actor{} = actor} <- Actors.get_or_fetch_by_url(url) do
|
with {:ok, %Actor{} = actor} <- Actors.get_or_fetch_by_url(url) do
|
||||||
actor.keys
|
actor.keys
|
||||||
|> Eventos.Service.ActivityPub.Utils.pem_to_public_key()
|
|> Mobilizon.Service.ActivityPub.Utils.pem_to_public_key()
|
||||||
else
|
else
|
||||||
_ -> :error
|
_ -> :error
|
||||||
end
|
end
|
|
@ -1,15 +1,15 @@
|
||||||
defmodule Eventos.Actors do
|
defmodule Mobilizon.Actors do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
The Actors context.
|
The Actors context.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import Ecto.Query, warn: false
|
import Ecto.Query, warn: false
|
||||||
alias Eventos.Repo
|
alias Mobilizon.Repo
|
||||||
|
|
||||||
alias Eventos.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Eventos.Actors
|
alias Mobilizon.Actors
|
||||||
|
|
||||||
alias Eventos.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns the list of actors.
|
Returns the list of actors.
|
||||||
|
@ -147,7 +147,7 @@ defmodule Eventos.Actors do
|
||||||
|> Repo.insert()
|
|> Repo.insert()
|
||||||
end
|
end
|
||||||
|
|
||||||
alias Eventos.Actors.User
|
alias Mobilizon.Actors.User
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns the list of users.
|
Returns the list of users.
|
||||||
|
@ -361,7 +361,7 @@ defmodule Eventos.Actors do
|
||||||
case Comeonin.Argon2.checkpw(password, user.password_hash) do
|
case Comeonin.Argon2.checkpw(password, user.password_hash) do
|
||||||
true ->
|
true ->
|
||||||
# Yes, create and return the token
|
# Yes, create and return the token
|
||||||
EventosWeb.Guardian.encode_and_sign(user)
|
MobilizonWeb.Guardian.encode_and_sign(user)
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
# No, return an error
|
# No, return an error
|
||||||
|
@ -391,7 +391,7 @@ defmodule Eventos.Actors do
|
||||||
end
|
end
|
||||||
|
|
||||||
actor =
|
actor =
|
||||||
Eventos.Actors.Actor.registration_changeset(%Eventos.Actors.Actor{}, %{
|
Mobilizon.Actors.Actor.registration_changeset(%Mobilizon.Actors.Actor{}, %{
|
||||||
preferred_username: username,
|
preferred_username: username,
|
||||||
domain: nil,
|
domain: nil,
|
||||||
keys: pem,
|
keys: pem,
|
||||||
|
@ -399,7 +399,7 @@ defmodule Eventos.Actors do
|
||||||
})
|
})
|
||||||
|
|
||||||
user =
|
user =
|
||||||
Eventos.Actors.User.registration_changeset(%Eventos.Actors.User{}, %{
|
Mobilizon.Actors.User.registration_changeset(%Mobilizon.Actors.User{}, %{
|
||||||
email: email,
|
email: email,
|
||||||
password: password
|
password: password
|
||||||
})
|
})
|
||||||
|
@ -407,7 +407,7 @@ defmodule Eventos.Actors do
|
||||||
actor_with_user = Ecto.Changeset.put_assoc(actor, :user, user)
|
actor_with_user = Ecto.Changeset.put_assoc(actor, :user, user)
|
||||||
|
|
||||||
try do
|
try do
|
||||||
Eventos.Repo.insert!(actor_with_user)
|
Mobilizon.Repo.insert!(actor_with_user)
|
||||||
find_by_email(email)
|
find_by_email(email)
|
||||||
rescue
|
rescue
|
||||||
e in Ecto.InvalidChangesetError ->
|
e in Ecto.InvalidChangesetError ->
|
||||||
|
@ -421,7 +421,7 @@ defmodule Eventos.Actors do
|
||||||
pem = [entry] |> :public_key.pem_encode() |> String.trim_trailing()
|
pem = [entry] |> :public_key.pem_encode() |> String.trim_trailing()
|
||||||
|
|
||||||
actor =
|
actor =
|
||||||
Eventos.Actors.Actor.registration_changeset(%Eventos.Actors.Actor{}, %{
|
Mobilizon.Actors.Actor.registration_changeset(%Mobilizon.Actors.Actor{}, %{
|
||||||
preferred_username: name,
|
preferred_username: name,
|
||||||
domain: nil,
|
domain: nil,
|
||||||
keys: pem,
|
keys: pem,
|
||||||
|
@ -430,7 +430,7 @@ defmodule Eventos.Actors do
|
||||||
})
|
})
|
||||||
|
|
||||||
try do
|
try do
|
||||||
Eventos.Repo.insert!(actor)
|
Mobilizon.Repo.insert!(actor)
|
||||||
rescue
|
rescue
|
||||||
e in Ecto.InvalidChangesetError ->
|
e in Ecto.InvalidChangesetError ->
|
||||||
{:error, e.changeset}
|
{:error, e.changeset}
|
||||||
|
@ -520,7 +520,7 @@ defmodule Eventos.Actors do
|
||||||
User.changeset(user, %{})
|
User.changeset(user, %{})
|
||||||
end
|
end
|
||||||
|
|
||||||
alias Eventos.Actors.Member
|
alias Mobilizon.Actors.Member
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Gets a single member.
|
Gets a single member.
|
||||||
|
@ -626,7 +626,7 @@ defmodule Eventos.Actors do
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
alias Eventos.Actors.Bot
|
alias Mobilizon.Actors.Bot
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns the list of bots.
|
Returns the list of bots.
|
||||||
|
@ -727,7 +727,7 @@ defmodule Eventos.Actors do
|
||||||
Bot.changeset(bot, %{})
|
Bot.changeset(bot, %{})
|
||||||
end
|
end
|
||||||
|
|
||||||
alias Eventos.Actors.Follower
|
alias Mobilizon.Actors.Follower
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Gets a single follower.
|
Gets a single follower.
|
|
@ -1,10 +1,10 @@
|
||||||
defmodule Eventos.Actors.Bot do
|
defmodule Mobilizon.Actors.Bot do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Represents a local bot
|
Represents a local bot
|
||||||
"""
|
"""
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
alias Eventos.Actors.{Actor, User, Bot}
|
alias Mobilizon.Actors.{Actor, User, Bot}
|
||||||
|
|
||||||
schema "bots" do
|
schema "bots" do
|
||||||
field(:source, :string)
|
field(:source, :string)
|
|
@ -1,11 +1,11 @@
|
||||||
defmodule Eventos.Actors.Follower do
|
defmodule Mobilizon.Actors.Follower do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Represents the following of an actor to another actor
|
Represents the following of an actor to another actor
|
||||||
"""
|
"""
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
alias Eventos.Actors.Follower
|
alias Mobilizon.Actors.Follower
|
||||||
alias Eventos.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
|
|
||||||
schema "followers" do
|
schema "followers" do
|
||||||
field(:approved, :boolean, default: false)
|
field(:approved, :boolean, default: false)
|
|
@ -1,11 +1,11 @@
|
||||||
defmodule Eventos.Actors.Member do
|
defmodule Mobilizon.Actors.Member do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Represents the membership of an actor to a group
|
Represents the membership of an actor to a group
|
||||||
"""
|
"""
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
alias Eventos.Actors.Member
|
alias Mobilizon.Actors.Member
|
||||||
alias Eventos.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
|
|
||||||
schema "members" do
|
schema "members" do
|
||||||
field(:approved, :boolean, default: true)
|
field(:approved, :boolean, default: true)
|
|
@ -1,8 +1,8 @@
|
||||||
defmodule Eventos.Actors.Service.Activation do
|
defmodule Mobilizon.Actors.Service.Activation do
|
||||||
@moduledoc false
|
@moduledoc false
|
||||||
|
|
||||||
alias Eventos.{Mailer, Repo, Actors.User, Actors}
|
alias Mobilizon.{Mailer, Repo, Actors.User, Actors}
|
||||||
alias Eventos.Email.User, as: UserEmail
|
alias Mobilizon.Email.User, as: UserEmail
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
defmodule Eventos.Actors.Service.ResetPassword do
|
defmodule Mobilizon.Actors.Service.ResetPassword do
|
||||||
@moduledoc false
|
@moduledoc false
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
alias Eventos.{Mailer, Repo, Actors.User}
|
alias Mobilizon.{Mailer, Repo, Actors.User}
|
||||||
alias Eventos.Email.User, as: UserEmail
|
alias Mobilizon.Email.User, as: UserEmail
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Check that the provided token is correct and update provided password
|
Check that the provided token is correct and update provided password
|
|
@ -1,10 +1,10 @@
|
||||||
defmodule Eventos.Actors.User do
|
defmodule Mobilizon.Actors.User do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Represents a local user
|
Represents a local user
|
||||||
"""
|
"""
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
alias Eventos.Actors.{Actor, User}
|
alias Mobilizon.Actors.{Actor, User}
|
||||||
|
|
||||||
schema "users" do
|
schema "users" do
|
||||||
field(:email, :string)
|
field(:email, :string)
|
|
@ -1,11 +1,11 @@
|
||||||
defmodule Eventos.Addresses.Address do
|
defmodule Mobilizon.Addresses.Address do
|
||||||
@moduledoc "An address for an event or a group"
|
@moduledoc "An address for an event or a group"
|
||||||
|
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
alias Eventos.Addresses.Address
|
alias Mobilizon.Addresses.Address
|
||||||
alias Eventos.Events.Event
|
alias Mobilizon.Events.Event
|
||||||
alias Eventos.Groups.Group
|
alias Mobilizon.Groups.Group
|
||||||
|
|
||||||
schema "addresses" do
|
schema "addresses" do
|
||||||
field(:addressCountry, :string)
|
field(:addressCountry, :string)
|
|
@ -1,12 +1,12 @@
|
||||||
defmodule Eventos.Addresses do
|
defmodule Mobilizon.Addresses do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
The Addresses context.
|
The Addresses context.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import Ecto.Query, warn: false
|
import Ecto.Query, warn: false
|
||||||
alias Eventos.Repo
|
alias Mobilizon.Repo
|
||||||
|
|
||||||
alias Eventos.Addresses.Address
|
alias Mobilizon.Addresses.Address
|
||||||
|
|
||||||
import Logger
|
import Logger
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
defmodule Eventos.Application do
|
defmodule Mobilizon.Application do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
The Eventos application
|
The Mobilizon application
|
||||||
"""
|
"""
|
||||||
use Application
|
use Application
|
||||||
|
|
||||||
|
@ -12,25 +12,25 @@ defmodule Eventos.Application do
|
||||||
# Define workers and child supervisors to be supervised
|
# Define workers and child supervisors to be supervised
|
||||||
children = [
|
children = [
|
||||||
# Start the Ecto repository
|
# Start the Ecto repository
|
||||||
supervisor(Eventos.Repo, []),
|
supervisor(Mobilizon.Repo, []),
|
||||||
# Start the endpoint when the application starts
|
# Start the endpoint when the application starts
|
||||||
supervisor(EventosWeb.Endpoint, []),
|
supervisor(MobilizonWeb.Endpoint, []),
|
||||||
# Start your own worker by calling: Eventos.Worker.start_link(arg1, arg2, arg3)
|
# Start your own worker by calling: Mobilizon.Worker.start_link(arg1, arg2, arg3)
|
||||||
# worker(Eventos.Worker, [arg1, arg2, arg3]),
|
# worker(Mobilizon.Worker, [arg1, arg2, arg3]),
|
||||||
worker(Guardian.DB.Token.SweeperServer, []),
|
worker(Guardian.DB.Token.SweeperServer, []),
|
||||||
worker(Eventos.Service.Federator, [])
|
worker(Mobilizon.Service.Federator, [])
|
||||||
]
|
]
|
||||||
|
|
||||||
# See https://hexdocs.pm/elixir/Supervisor.html
|
# See https://hexdocs.pm/elixir/Supervisor.html
|
||||||
# for other strategies and supported options
|
# for other strategies and supported options
|
||||||
opts = [strategy: :one_for_one, name: Eventos.Supervisor]
|
opts = [strategy: :one_for_one, name: Mobilizon.Supervisor]
|
||||||
Supervisor.start_link(children, opts)
|
Supervisor.start_link(children, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Tell Phoenix to update the endpoint configuration
|
# Tell Phoenix to update the endpoint configuration
|
||||||
# whenever the application is updated.
|
# whenever the application is updated.
|
||||||
def config_change(changed, _new, removed) do
|
def config_change(changed, _new, removed) do
|
||||||
EventosWeb.Endpoint.config_change(changed, removed)
|
MobilizonWeb.Endpoint.config_change(changed, removed)
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,13 +1,13 @@
|
||||||
defmodule Eventos.Email.User do
|
defmodule Mobilizon.Email.User do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Handles emails sent to users
|
Handles emails sent to users
|
||||||
"""
|
"""
|
||||||
alias Eventos.Actors.User
|
alias Mobilizon.Actors.User
|
||||||
|
|
||||||
import Bamboo.Email
|
import Bamboo.Email
|
||||||
import Bamboo.Phoenix
|
import Bamboo.Phoenix
|
||||||
use Bamboo.Phoenix, view: Eventos.EmailView
|
use Bamboo.Phoenix, view: Mobilizon.EmailView
|
||||||
import EventosWeb.Gettext
|
import MobilizonWeb.Gettext
|
||||||
|
|
||||||
def confirmation_email(%User{} = user, locale \\ "en") do
|
def confirmation_email(%User{} = user, locale \\ "en") do
|
||||||
Gettext.put_locale(locale)
|
Gettext.put_locale(locale)
|
||||||
|
@ -45,13 +45,13 @@ defmodule Eventos.Email.User do
|
||||||
defp base_email do
|
defp base_email do
|
||||||
# Here you can set a default from, default headers, etc.
|
# Here you can set a default from, default headers, etc.
|
||||||
new_email()
|
new_email()
|
||||||
|> from(Application.get_env(:eventos, EventosWeb.Endpoint)[:email_from])
|
|> from(Application.get_env(:mobilizon, MobilizonWeb.Endpoint)[:email_from])
|
||||||
|> put_html_layout({Eventos.EmailView, "email.html"})
|
|> put_html_layout({Mobilizon.EmailView, "email.html"})
|
||||||
|> put_text_layout({Eventos.EmailView, "email.text"})
|
|> put_text_layout({Mobilizon.EmailView, "email.text"})
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec get_config(atom()) :: any()
|
@spec get_config(atom()) :: any()
|
||||||
defp get_config(key) do
|
defp get_config(key) do
|
||||||
_config = Application.get_env(:eventos, EventosWeb.Endpoint) |> Keyword.get(key)
|
_config = Application.get_env(:mobilizon, MobilizonWeb.Endpoint) |> Keyword.get(key)
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,10 +1,10 @@
|
||||||
defmodule Eventos.Events.Category do
|
defmodule Mobilizon.Events.Category do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Represents a category for events
|
Represents a category for events
|
||||||
"""
|
"""
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
alias Eventos.Events.Category
|
alias Mobilizon.Events.Category
|
||||||
|
|
||||||
schema "categories" do
|
schema "categories" do
|
||||||
field(:description, :string)
|
field(:description, :string)
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule Eventos.Events.Comment do
|
defmodule Mobilizon.Events.Comment do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
An actor comment (for instance on an event or on a group)
|
An actor comment (for instance on an event or on a group)
|
||||||
"""
|
"""
|
||||||
|
@ -6,9 +6,9 @@ defmodule Eventos.Events.Comment do
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
|
|
||||||
alias Eventos.Events.Event
|
alias Mobilizon.Events.Event
|
||||||
alias Eventos.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Eventos.Actors.Comment
|
alias Mobilizon.Actors.Comment
|
||||||
|
|
||||||
schema "comments" do
|
schema "comments" do
|
||||||
field(:text, :string)
|
field(:text, :string)
|
||||||
|
@ -32,7 +32,7 @@ defmodule Eventos.Events.Comment do
|
||||||
url =
|
url =
|
||||||
if Map.has_key?(attrs, "url"),
|
if Map.has_key?(attrs, "url"),
|
||||||
do: attrs["url"],
|
do: attrs["url"],
|
||||||
else: "#{EventosWeb.Endpoint.url()}/comments/#{uuid}"
|
else: "#{MobilizonWeb.Endpoint.url()}/comments/#{uuid}"
|
||||||
|
|
||||||
comment
|
comment
|
||||||
|> cast(attrs, [:url, :text, :actor_id, :event_id, :in_reply_to_comment_id, :attributed_to_id])
|
|> cast(attrs, [:url, :text, :actor_id, :event_id, :in_reply_to_comment_id, :attributed_to_id])
|
|
@ -1,15 +1,15 @@
|
||||||
import EctoEnum
|
import EctoEnum
|
||||||
defenum(AddressTypeEnum, :address_type, [:physical, :url, :phone, :other])
|
defenum(AddressTypeEnum, :address_type, [:physical, :url, :phone, :other])
|
||||||
|
|
||||||
defmodule Eventos.Events.Event do
|
defmodule Mobilizon.Events.Event do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Represents an event
|
Represents an event
|
||||||
"""
|
"""
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
alias Eventos.Events.{Event, Participant, Tag, Category, Session, Track}
|
alias Mobilizon.Events.{Event, Participant, Tag, Category, Session, Track}
|
||||||
alias Eventos.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Eventos.Addresses.Address
|
alias Mobilizon.Addresses.Address
|
||||||
|
|
||||||
schema "events" do
|
schema "events" do
|
||||||
field(:url, :string)
|
field(:url, :string)
|
||||||
|
@ -58,7 +58,7 @@ defmodule Eventos.Events.Event do
|
||||||
url =
|
url =
|
||||||
if Map.has_key?(attrs, "url"),
|
if Map.has_key?(attrs, "url"),
|
||||||
do: attrs["url"],
|
do: attrs["url"],
|
||||||
else: "#{EventosWeb.Endpoint.url()}/@#{actor_url}/#{uuid}"
|
else: "#{MobilizonWeb.Endpoint.url()}/@#{actor_url}/#{uuid}"
|
||||||
|
|
||||||
event
|
event
|
||||||
|> Ecto.Changeset.cast(attrs, [
|
|> Ecto.Changeset.cast(attrs, [
|
|
@ -1,15 +1,15 @@
|
||||||
defmodule Eventos.Events do
|
defmodule Mobilizon.Events do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
The Events context.
|
The Events context.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import Ecto.Query, warn: false
|
import Ecto.Query, warn: false
|
||||||
alias Eventos.Repo
|
alias Mobilizon.Repo
|
||||||
|
|
||||||
alias Eventos.Events.Event
|
alias Mobilizon.Events.Event
|
||||||
alias Eventos.Events.Comment
|
alias Mobilizon.Events.Comment
|
||||||
alias Eventos.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Eventos.Addresses.Address
|
alias Mobilizon.Addresses.Address
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns the list of events.
|
Returns the list of events.
|
||||||
|
@ -263,7 +263,7 @@ defmodule Eventos.Events do
|
||||||
Event.changeset(event, %{})
|
Event.changeset(event, %{})
|
||||||
end
|
end
|
||||||
|
|
||||||
alias Eventos.Events.Category
|
alias Mobilizon.Events.Category
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns the list of categories.
|
Returns the list of categories.
|
||||||
|
@ -364,7 +364,7 @@ defmodule Eventos.Events do
|
||||||
Category.changeset(category, %{})
|
Category.changeset(category, %{})
|
||||||
end
|
end
|
||||||
|
|
||||||
alias Eventos.Events.Tag
|
alias Mobilizon.Events.Tag
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns the list of tags.
|
Returns the list of tags.
|
||||||
|
@ -460,7 +460,7 @@ defmodule Eventos.Events do
|
||||||
Tag.changeset(tag, %{})
|
Tag.changeset(tag, %{})
|
||||||
end
|
end
|
||||||
|
|
||||||
alias Eventos.Events.Participant
|
alias Mobilizon.Events.Participant
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns the list of participants.
|
Returns the list of participants.
|
||||||
|
@ -562,7 +562,7 @@ defmodule Eventos.Events do
|
||||||
Repo.all(from(p in Participant, where: p.actor_id == ^actor.id and p.approved == false))
|
Repo.all(from(p in Participant, where: p.actor_id == ^actor.id and p.approved == false))
|
||||||
end
|
end
|
||||||
|
|
||||||
alias Eventos.Events.Session
|
alias Mobilizon.Events.Session
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns the list of sessions.
|
Returns the list of sessions.
|
||||||
|
@ -679,7 +679,7 @@ defmodule Eventos.Events do
|
||||||
Session.changeset(session, %{})
|
Session.changeset(session, %{})
|
||||||
end
|
end
|
||||||
|
|
||||||
alias Eventos.Events.Track
|
alias Mobilizon.Events.Track
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns the list of tracks.
|
Returns the list of tracks.
|
||||||
|
@ -775,7 +775,7 @@ defmodule Eventos.Events do
|
||||||
Track.changeset(track, %{})
|
Track.changeset(track, %{})
|
||||||
end
|
end
|
||||||
|
|
||||||
alias Eventos.Events.Comment
|
alias Mobilizon.Events.Comment
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Returns the list of comments.
|
Returns the list of comments.
|
|
@ -1,11 +1,11 @@
|
||||||
defmodule Eventos.Events.Participant do
|
defmodule Mobilizon.Events.Participant do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Represents a participant, an actor participating to an event
|
Represents a participant, an actor participating to an event
|
||||||
"""
|
"""
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
alias Eventos.Events.{Participant, Event}
|
alias Mobilizon.Events.{Participant, Event}
|
||||||
alias Eventos.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
|
|
||||||
@primary_key false
|
@primary_key false
|
||||||
schema "participants" do
|
schema "participants" do
|
|
@ -1,10 +1,10 @@
|
||||||
defmodule Eventos.Events.Session do
|
defmodule Mobilizon.Events.Session do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Represents a session for an event (such as a talk at a conference)
|
Represents a session for an event (such as a talk at a conference)
|
||||||
"""
|
"""
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
alias Eventos.Events.{Session, Event, Track}
|
alias Mobilizon.Events.{Session, Event, Track}
|
||||||
|
|
||||||
schema "sessions" do
|
schema "sessions" do
|
||||||
field(:audios_urls, :string)
|
field(:audios_urls, :string)
|
|
@ -1,10 +1,10 @@
|
||||||
defmodule Eventos.Events.Tag.TitleSlug do
|
defmodule Mobilizon.Events.Tag.TitleSlug do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Generates slugs for tags
|
Generates slugs for tags
|
||||||
"""
|
"""
|
||||||
alias Eventos.Events.Tag
|
alias Mobilizon.Events.Tag
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
alias Eventos.Repo
|
alias Mobilizon.Repo
|
||||||
use EctoAutoslugField.Slug, from: :title, to: :slug
|
use EctoAutoslugField.Slug, from: :title, to: :slug
|
||||||
|
|
||||||
def build_slug(sources, changeset) do
|
def build_slug(sources, changeset) do
|
||||||
|
@ -25,20 +25,20 @@ defmodule Eventos.Events.Tag.TitleSlug do
|
||||||
|
|
||||||
_story ->
|
_story ->
|
||||||
slug
|
slug
|
||||||
|> Eventos.Slug.increment_slug()
|
|> Mobilizon.Slug.increment_slug()
|
||||||
|> build_unique_slug(changeset)
|
|> build_unique_slug(changeset)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defmodule Eventos.Events.Tag do
|
defmodule Mobilizon.Events.Tag do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Represents a tag for events
|
Represents a tag for events
|
||||||
"""
|
"""
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
alias Eventos.Events.Tag
|
alias Mobilizon.Events.Tag
|
||||||
alias Eventos.Events.Tag.TitleSlug
|
alias Mobilizon.Events.Tag.TitleSlug
|
||||||
|
|
||||||
schema "tags" do
|
schema "tags" do
|
||||||
field(:title, :string)
|
field(:title, :string)
|
|
@ -1,10 +1,10 @@
|
||||||
defmodule Eventos.Events.Track do
|
defmodule Mobilizon.Events.Track do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Represents a track for an event (such as a theme) having multiple sessions
|
Represents a track for an event (such as a theme) having multiple sessions
|
||||||
"""
|
"""
|
||||||
use Ecto.Schema
|
use Ecto.Schema
|
||||||
import Ecto.Changeset
|
import Ecto.Changeset
|
||||||
alias Eventos.Events.{Track, Event, Session}
|
alias Mobilizon.Events.{Track, Event, Session}
|
||||||
|
|
||||||
schema "tracks" do
|
schema "tracks" do
|
||||||
field(:color, :string)
|
field(:color, :string)
|
|
@ -1,9 +1,9 @@
|
||||||
defmodule Eventos.Export.ICalendar do
|
defmodule Mobilizon.Export.ICalendar do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Export an event to iCalendar format
|
Export an event to iCalendar format
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Eventos.Events.Event
|
alias Mobilizon.Events.Event
|
||||||
|
|
||||||
@spec export_event(%Event{}) :: String
|
@spec export_event(%Event{}) :: String
|
||||||
def export_event(%Event{} = event) do
|
def export_event(%Event{} = event) do
|
6
lib/mobilizon/mailer.ex
Normal file
6
lib/mobilizon/mailer.ex
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
defmodule Mobilizon.Mailer do
|
||||||
|
@moduledoc """
|
||||||
|
Mailer
|
||||||
|
"""
|
||||||
|
use Bamboo.Mailer, otp_app: :mobilizon
|
||||||
|
end
|
|
@ -1,5 +1,5 @@
|
||||||
Postgrex.Types.define(
|
Postgrex.Types.define(
|
||||||
Eventos.PostgresTypes,
|
Mobilizon.PostgresTypes,
|
||||||
[Geo.PostGIS.Extension] ++ Ecto.Adapters.Postgres.extensions(),
|
[Geo.PostGIS.Extension] ++ Ecto.Adapters.Postgres.extensions(),
|
||||||
json: Poison
|
json: Poison
|
||||||
)
|
)
|
|
@ -1,8 +1,8 @@
|
||||||
defmodule Eventos.Repo do
|
defmodule Mobilizon.Repo do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Eventos Repo
|
Mobilizon Repo
|
||||||
"""
|
"""
|
||||||
use Ecto.Repo, otp_app: :eventos
|
use Ecto.Repo, otp_app: :mobilizon
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Dynamically loads the repository url from the
|
Dynamically loads the repository url from the
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule Eventos.Slug do
|
defmodule Mobilizon.Slug do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Common functions for slug generation
|
Common functions for slug generation
|
||||||
"""
|
"""
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule EventosWeb.AuthErrorHandler do
|
defmodule MobilizonWeb.AuthErrorHandler do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
In case we have an auth error
|
In case we have an auth error
|
||||||
"""
|
"""
|
|
@ -1,12 +1,12 @@
|
||||||
defmodule EventosWeb.AuthPipeline do
|
defmodule MobilizonWeb.AuthPipeline do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Handles the app sessions
|
Handles the app sessions
|
||||||
"""
|
"""
|
||||||
|
|
||||||
use Guardian.Plug.Pipeline,
|
use Guardian.Plug.Pipeline,
|
||||||
otp_app: :eventos,
|
otp_app: :mobilizon,
|
||||||
module: EventosWeb.Guardian,
|
module: MobilizonWeb.Guardian,
|
||||||
error_handler: EventosWeb.AuthErrorHandler
|
error_handler: MobilizonWeb.AuthErrorHandler
|
||||||
|
|
||||||
plug(Guardian.Plug.VerifyHeader, claims: %{"typ" => "access"})
|
plug(Guardian.Plug.VerifyHeader, claims: %{"typ" => "access"})
|
||||||
plug(Guardian.Plug.EnsureAuthenticated)
|
plug(Guardian.Plug.EnsureAuthenticated)
|
|
@ -1,11 +1,11 @@
|
||||||
defmodule EventosWeb.UserSocket do
|
defmodule MobilizonWeb.UserSocket do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Channel for User
|
Channel for User
|
||||||
"""
|
"""
|
||||||
use Phoenix.Socket
|
use Phoenix.Socket
|
||||||
|
|
||||||
# Channels
|
# Channels
|
||||||
# channel "room:*", EventosWeb.RoomChannel
|
# channel "room:*", MobilizonWeb.RoomChannel
|
||||||
|
|
||||||
# Transports
|
# Transports
|
||||||
transport(:websocket, Phoenix.Transports.WebSocket)
|
transport(:websocket, Phoenix.Transports.WebSocket)
|
||||||
|
@ -33,7 +33,7 @@ defmodule EventosWeb.UserSocket do
|
||||||
# Would allow you to broadcast a "disconnect" event and terminate
|
# Would allow you to broadcast a "disconnect" event and terminate
|
||||||
# all active sockets and channels for a given user:
|
# all active sockets and channels for a given user:
|
||||||
#
|
#
|
||||||
# EventosWeb.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{})
|
# MobilizonWeb.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{})
|
||||||
#
|
#
|
||||||
# Returning `nil` makes this socket anonymous.
|
# Returning `nil` makes this socket anonymous.
|
||||||
def id(_socket), do: nil
|
def id(_socket), do: nil
|
|
@ -1,9 +1,9 @@
|
||||||
defmodule EventosWeb.ActivityPubController do
|
defmodule MobilizonWeb.ActivityPubController do
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
alias Eventos.{Actors, Actors.Actor, Events, Events.Event}
|
alias Mobilizon.{Actors, Actors.Actor, Events, Events.Event}
|
||||||
alias EventosWeb.ActivityPub.{ObjectView, ActorView}
|
alias MobilizonWeb.ActivityPub.{ObjectView, ActorView}
|
||||||
alias Eventos.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
alias Eventos.Service.Federator
|
alias Mobilizon.Service.Federator
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
defmodule EventosWeb.ActorController do
|
defmodule MobilizonWeb.ActorController do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Controller for Actors
|
Controller for Actors
|
||||||
"""
|
"""
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
alias Eventos.Actors
|
alias Mobilizon.Actors
|
||||||
alias Eventos.Actors.{Actor, User}
|
alias Mobilizon.Actors.{Actor, User}
|
||||||
alias Eventos.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
|
|
||||||
action_fallback(EventosWeb.FallbackController)
|
action_fallback(MobilizonWeb.FallbackController)
|
||||||
|
|
||||||
def index(conn, _params) do
|
def index(conn, _params) do
|
||||||
actors = Actors.list_actors()
|
actors = Actors.list_actors()
|
|
@ -1,14 +1,14 @@
|
||||||
defmodule EventosWeb.AddressController do
|
defmodule MobilizonWeb.AddressController do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
A controller for addresses
|
A controller for addresses
|
||||||
"""
|
"""
|
||||||
|
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
alias Eventos.Addresses
|
alias Mobilizon.Addresses
|
||||||
alias Eventos.Addresses.Address
|
alias Mobilizon.Addresses.Address
|
||||||
|
|
||||||
action_fallback(EventosWeb.FallbackController)
|
action_fallback(MobilizonWeb.FallbackController)
|
||||||
|
|
||||||
def index(conn, _params) do
|
def index(conn, _params) do
|
||||||
addresses = Addresses.list_addresses()
|
addresses = Addresses.list_addresses()
|
|
@ -1,10 +1,10 @@
|
||||||
defmodule EventosWeb.BotController do
|
defmodule MobilizonWeb.BotController do
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
alias Eventos.Actors
|
alias Mobilizon.Actors
|
||||||
alias Eventos.Actors.{Bot, Actor}
|
alias Mobilizon.Actors.{Bot, Actor}
|
||||||
|
|
||||||
action_fallback(EventosWeb.FallbackController)
|
action_fallback(MobilizonWeb.FallbackController)
|
||||||
|
|
||||||
def index(conn, _params) do
|
def index(conn, _params) do
|
||||||
bots = Actors.list_bots()
|
bots = Actors.list_bots()
|
|
@ -1,13 +1,13 @@
|
||||||
defmodule EventosWeb.CategoryController do
|
defmodule MobilizonWeb.CategoryController do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Controller for Categories
|
Controller for Categories
|
||||||
"""
|
"""
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
alias Eventos.Events
|
alias Mobilizon.Events
|
||||||
alias Eventos.Events.Category
|
alias Mobilizon.Events.Category
|
||||||
|
|
||||||
action_fallback(EventosWeb.FallbackController)
|
action_fallback(MobilizonWeb.FallbackController)
|
||||||
|
|
||||||
def index(conn, _params) do
|
def index(conn, _params) do
|
||||||
categories = Events.list_categories()
|
categories = Events.list_categories()
|
|
@ -1,10 +1,10 @@
|
||||||
defmodule EventosWeb.CommentController do
|
defmodule MobilizonWeb.CommentController do
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
alias Eventos.Events
|
alias Mobilizon.Events
|
||||||
alias Eventos.Events.Comment
|
alias Mobilizon.Events.Comment
|
||||||
|
|
||||||
action_fallback(EventosWeb.FallbackController)
|
action_fallback(MobilizonWeb.FallbackController)
|
||||||
|
|
||||||
def index(conn, _params) do
|
def index(conn, _params) do
|
||||||
comments = Events.list_comments()
|
comments = Events.list_comments()
|
|
@ -1,16 +1,16 @@
|
||||||
defmodule EventosWeb.EventController do
|
defmodule MobilizonWeb.EventController do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Controller for Events
|
Controller for Events
|
||||||
"""
|
"""
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
alias Eventos.Events
|
alias Mobilizon.Events
|
||||||
alias Eventos.Events.Event
|
alias Mobilizon.Events.Event
|
||||||
alias Eventos.Export.ICalendar
|
alias Mobilizon.Export.ICalendar
|
||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
action_fallback(EventosWeb.FallbackController)
|
action_fallback(MobilizonWeb.FallbackController)
|
||||||
|
|
||||||
def index(conn, _params) do
|
def index(conn, _params) do
|
||||||
ip = "88.161.154.97"
|
ip = "88.161.154.97"
|
||||||
|
@ -70,7 +70,7 @@ defmodule EventosWeb.EventController do
|
||||||
|
|
||||||
Map.has_key?(event, "physical_address") ->
|
Map.has_key?(event, "physical_address") ->
|
||||||
address = event["physical_address"]
|
address = event["physical_address"]
|
||||||
geom = EventosWeb.AddressController.process_geom(address["geom"])
|
geom = MobilizonWeb.AddressController.process_geom(address["geom"])
|
||||||
|
|
||||||
address =
|
address =
|
||||||
case geom do
|
case geom do
|
|
@ -1,13 +1,13 @@
|
||||||
# defmodule EventosWeb.EventRequestController do
|
# defmodule MobilizonWeb.EventRequestController do
|
||||||
# @moduledoc """
|
# @moduledoc """
|
||||||
# Controller for Event requests
|
# Controller for Event requests
|
||||||
# """
|
# """
|
||||||
# use EventosWeb, :controller
|
# use MobilizonWeb, :controller
|
||||||
#
|
#
|
||||||
# alias Eventos.Events
|
# alias Mobilizon.Events
|
||||||
# alias Eventos.Events.{Event, Request}
|
# alias Mobilizon.Events.{Event, Request}
|
||||||
#
|
#
|
||||||
# action_fallback EventosWeb.FallbackController
|
# action_fallback MobilizonWeb.FallbackController
|
||||||
#
|
#
|
||||||
# def index_for_user(conn, _params) do
|
# def index_for_user(conn, _params) do
|
||||||
# actor = Guardian.Plug.current_resource(conn).actor
|
# actor = Guardian.Plug.current_resource(conn).actor
|
|
@ -1,26 +1,26 @@
|
||||||
defmodule EventosWeb.FallbackController do
|
defmodule MobilizonWeb.FallbackController do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Translates controller action results into valid `Plug.Conn` responses.
|
Translates controller action results into valid `Plug.Conn` responses.
|
||||||
|
|
||||||
See `Phoenix.Controller.action_fallback/1` for more details.
|
See `Phoenix.Controller.action_fallback/1` for more details.
|
||||||
"""
|
"""
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
def call(conn, {:error, %Ecto.Changeset{} = changeset}) do
|
def call(conn, {:error, %Ecto.Changeset{} = changeset}) do
|
||||||
conn
|
conn
|
||||||
|> put_status(:unprocessable_entity)
|
|> put_status(:unprocessable_entity)
|
||||||
|> render(EventosWeb.ChangesetView, "error.json", changeset: changeset)
|
|> render(MobilizonWeb.ChangesetView, "error.json", changeset: changeset)
|
||||||
end
|
end
|
||||||
|
|
||||||
def call(conn, {:error, nil}) do
|
def call(conn, {:error, nil}) do
|
||||||
conn
|
conn
|
||||||
|> put_status(:unprocessable_entity)
|
|> put_status(:unprocessable_entity)
|
||||||
|> render(EventosWeb.ErrorView, "invalid_request.json")
|
|> render(MobilizonWeb.ErrorView, "invalid_request.json")
|
||||||
end
|
end
|
||||||
|
|
||||||
def call(conn, {:error, :not_found}) do
|
def call(conn, {:error, :not_found}) do
|
||||||
conn
|
conn
|
||||||
|> put_status(:not_found)
|
|> put_status(:not_found)
|
||||||
|> render(EventosWeb.ErrorView, :"404")
|
|> render(MobilizonWeb.ErrorView, :"404")
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,10 +1,10 @@
|
||||||
defmodule EventosWeb.FollowerController do
|
defmodule MobilizonWeb.FollowerController do
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
alias Eventos.Actors
|
alias Mobilizon.Actors
|
||||||
alias Eventos.Actors.Follower
|
alias Mobilizon.Actors.Follower
|
||||||
|
|
||||||
action_fallback(EventosWeb.FallbackController)
|
action_fallback(MobilizonWeb.FallbackController)
|
||||||
|
|
||||||
def index(conn, _params) do
|
def index(conn, _params) do
|
||||||
followers = Actors.list_followers()
|
followers = Actors.list_followers()
|
|
@ -1,17 +1,17 @@
|
||||||
defmodule EventosWeb.GroupController do
|
defmodule MobilizonWeb.GroupController do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Controller for Groups
|
Controller for Groups
|
||||||
"""
|
"""
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
alias Eventos.Actors
|
alias Mobilizon.Actors
|
||||||
alias Eventos.Actors.{Actor, Member}
|
alias Mobilizon.Actors.{Actor, Member}
|
||||||
|
|
||||||
action_fallback(EventosWeb.FallbackController)
|
action_fallback(MobilizonWeb.FallbackController)
|
||||||
|
|
||||||
def index(conn, _params) do
|
def index(conn, _params) do
|
||||||
groups = Actors.list_groups()
|
groups = Actors.list_groups()
|
||||||
render(conn, EventosWeb.ActorView, "index.json", actors: groups)
|
render(conn, MobilizonWeb.ActorView, "index.json", actors: groups)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create(conn, %{"group" => group_params}) do
|
def create(conn, %{"group" => group_params}) do
|
||||||
|
@ -25,7 +25,7 @@ defmodule EventosWeb.GroupController do
|
||||||
conn
|
conn
|
||||||
|> put_status(:created)
|
|> put_status(:created)
|
||||||
|> put_resp_header("location", actor_path(conn, :show, group))
|
|> put_resp_header("location", actor_path(conn, :show, group))
|
||||||
|> render(EventosWeb.ActorView, "actor_basic.json", actor: group)
|
|> render(MobilizonWeb.ActorView, "actor_basic.json", actor: group)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -36,12 +36,12 @@ defmodule EventosWeb.GroupController do
|
||||||
Actors.create_member(%{"parent_id" => group.id, "actor_id" => actor.id}) do
|
Actors.create_member(%{"parent_id" => group.id, "actor_id" => actor.id}) do
|
||||||
conn
|
conn
|
||||||
|> put_status(:created)
|
|> put_status(:created)
|
||||||
|> render(EventosWeb.MemberView, "member.json", member: member)
|
|> render(MobilizonWeb.MemberView, "member.json", member: member)
|
||||||
else
|
else
|
||||||
nil ->
|
nil ->
|
||||||
conn
|
conn
|
||||||
|> put_status(:not_found)
|
|> put_status(:not_found)
|
||||||
|> render(EventosWeb.ErrorView, "not_found.json", details: "group or actor doesn't exist")
|
|> render(MobilizonWeb.ErrorView, "not_found.json", details: "group or actor doesn't exist")
|
||||||
|
|
||||||
err ->
|
err ->
|
||||||
require Logger
|
require Logger
|
6
lib/mobilizon_web/controllers/inboxes_controller.ex
Normal file
6
lib/mobilizon_web/controllers/inboxes_controller.ex
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
defmodule MobilizonWeb.InboxesController do
|
||||||
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
|
def create(conn) do
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,17 +1,17 @@
|
||||||
defmodule EventosWeb.NodeinfoController do
|
defmodule MobilizonWeb.NodeinfoController do
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
alias EventosWeb
|
alias MobilizonWeb
|
||||||
alias Eventos.{Actors, Events}
|
alias Mobilizon.{Actors, Events}
|
||||||
|
|
||||||
@instance Application.get_env(:eventos, :instance)
|
@instance Application.get_env(:mobilizon, :instance)
|
||||||
|
|
||||||
def schemas(conn, _params) do
|
def schemas(conn, _params) do
|
||||||
response = %{
|
response = %{
|
||||||
links: [
|
links: [
|
||||||
%{
|
%{
|
||||||
rel: "http://nodeinfo.diaspora.software/ns/schema/2.0",
|
rel: "http://nodeinfo.diaspora.software/ns/schema/2.0",
|
||||||
href: EventosWeb.Router.Helpers.nodeinfo_url(EventosWeb.Endpoint, :nodeinfo, "2.0")
|
href: MobilizonWeb.Router.Helpers.nodeinfo_url(MobilizonWeb.Endpoint, :nodeinfo, "2.0")
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ defmodule EventosWeb.NodeinfoController do
|
||||||
response = %{
|
response = %{
|
||||||
version: "2.0",
|
version: "2.0",
|
||||||
software: %{
|
software: %{
|
||||||
name: "eventos",
|
name: "mobilizon",
|
||||||
version: Keyword.get(@instance, :version)
|
version: Keyword.get(@instance, :version)
|
||||||
},
|
},
|
||||||
protocols: ["activitypub"],
|
protocols: ["activitypub"],
|
|
@ -1,5 +1,5 @@
|
||||||
defmodule EventosWeb.OutboxesController do
|
defmodule MobilizonWeb.OutboxesController do
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
def show(conn) do
|
def show(conn) do
|
||||||
actor = Guardian.Plug.current_resource(conn).actor
|
actor = Guardian.Plug.current_resource(conn).actor
|
|
@ -1,8 +1,8 @@
|
||||||
defmodule EventosWeb.PageController do
|
defmodule MobilizonWeb.PageController do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Controller to load our webapp
|
Controller to load our webapp
|
||||||
"""
|
"""
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
plug(:put_layout, false)
|
plug(:put_layout, false)
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
defmodule EventosWeb.ParticipantController do
|
defmodule MobilizonWeb.ParticipantController do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Controller for participants to an event
|
Controller for participants to an event
|
||||||
"""
|
"""
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
alias Eventos.Events
|
alias Mobilizon.Events
|
||||||
|
|
||||||
def join(conn, %{"uuid" => uuid}) do
|
def join(conn, %{"uuid" => uuid}) do
|
||||||
with event <- Events.get_event_by_uuid(uuid),
|
with event <- Events.get_event_by_uuid(uuid),
|
|
@ -1,13 +1,13 @@
|
||||||
defmodule EventosWeb.SearchController do
|
defmodule MobilizonWeb.SearchController do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Controller for Search
|
Controller for Search
|
||||||
"""
|
"""
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
alias Eventos.Events
|
alias Mobilizon.Events
|
||||||
alias Eventos.Actors
|
alias Mobilizon.Actors
|
||||||
|
|
||||||
action_fallback(EventosWeb.FallbackController)
|
action_fallback(MobilizonWeb.FallbackController)
|
||||||
|
|
||||||
def search(conn, %{"name" => name}) do
|
def search(conn, %{"name" => name}) do
|
||||||
events = Events.find_events_by_name(name)
|
events = Events.find_events_by_name(name)
|
|
@ -1,13 +1,13 @@
|
||||||
defmodule EventosWeb.SessionController do
|
defmodule MobilizonWeb.SessionController do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Controller for (event) Sessions
|
Controller for (event) Sessions
|
||||||
"""
|
"""
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
alias Eventos.Events
|
alias Mobilizon.Events
|
||||||
alias Eventos.Events.Session
|
alias Mobilizon.Events.Session
|
||||||
|
|
||||||
action_fallback(EventosWeb.FallbackController)
|
action_fallback(MobilizonWeb.FallbackController)
|
||||||
|
|
||||||
def index(conn, _params) do
|
def index(conn, _params) do
|
||||||
sessions = Events.list_sessions()
|
sessions = Events.list_sessions()
|
|
@ -1,13 +1,13 @@
|
||||||
defmodule EventosWeb.TagController do
|
defmodule MobilizonWeb.TagController do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Controller for Tags
|
Controller for Tags
|
||||||
"""
|
"""
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
alias Eventos.Events
|
alias Mobilizon.Events
|
||||||
alias Eventos.Events.Tag
|
alias Mobilizon.Events.Tag
|
||||||
|
|
||||||
action_fallback(EventosWeb.FallbackController)
|
action_fallback(MobilizonWeb.FallbackController)
|
||||||
|
|
||||||
def index(conn, _params) do
|
def index(conn, _params) do
|
||||||
tags = Events.list_tags()
|
tags = Events.list_tags()
|
|
@ -1,13 +1,13 @@
|
||||||
defmodule EventosWeb.TrackController do
|
defmodule MobilizonWeb.TrackController do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Controller for Tracks
|
Controller for Tracks
|
||||||
"""
|
"""
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
alias Eventos.Events
|
alias Mobilizon.Events
|
||||||
alias Eventos.Events.Track
|
alias Mobilizon.Events.Track
|
||||||
|
|
||||||
action_fallback(EventosWeb.FallbackController)
|
action_fallback(MobilizonWeb.FallbackController)
|
||||||
|
|
||||||
def index(conn, _params) do
|
def index(conn, _params) do
|
||||||
tracks = Events.list_tracks()
|
tracks = Events.list_tracks()
|
|
@ -1,15 +1,15 @@
|
||||||
defmodule EventosWeb.UserController do
|
defmodule MobilizonWeb.UserController do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Controller for Users
|
Controller for Users
|
||||||
"""
|
"""
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
alias Eventos.Actors
|
alias Mobilizon.Actors
|
||||||
alias Eventos.Actors.User
|
alias Mobilizon.Actors.User
|
||||||
alias Eventos.Repo
|
alias Mobilizon.Repo
|
||||||
alias Eventos.Actors.Service.{Activation, ResetPassword}
|
alias Mobilizon.Actors.Service.{Activation, ResetPassword}
|
||||||
|
|
||||||
action_fallback(EventosWeb.FallbackController)
|
action_fallback(MobilizonWeb.FallbackController)
|
||||||
|
|
||||||
def index(conn, _params) do
|
def index(conn, _params) do
|
||||||
users = Actors.list_users_with_actors()
|
users = Actors.list_users_with_actors()
|
||||||
|
@ -29,7 +29,7 @@ defmodule EventosWeb.UserController do
|
||||||
|
|
||||||
def validate(conn, %{"token" => token}) do
|
def validate(conn, %{"token" => token}) do
|
||||||
with {:ok, %User{} = user} <- Activation.check_confirmation_token(token) do
|
with {:ok, %User{} = user} <- Activation.check_confirmation_token(token) do
|
||||||
{:ok, token, _claims} = EventosWeb.Guardian.encode_and_sign(user)
|
{:ok, token, _claims} = MobilizonWeb.Guardian.encode_and_sign(user)
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_resp_header("location", user_path(conn, :show_current_actor))
|
|> put_resp_header("location", user_path(conn, :show_current_actor))
|
||||||
|
@ -88,7 +88,7 @@ defmodule EventosWeb.UserController do
|
||||||
|
|
||||||
def reset_password(conn, %{"password" => password, "token" => token}) do
|
def reset_password(conn, %{"password" => password, "token" => token}) do
|
||||||
with {:ok, %User{} = user} <- ResetPassword.check_reset_password_token(password, token) do
|
with {:ok, %User{} = user} <- ResetPassword.check_reset_password_token(password, token) do
|
||||||
{:ok, token, _claims} = EventosWeb.Guardian.encode_and_sign(user)
|
{:ok, token, _claims} = MobilizonWeb.Guardian.encode_and_sign(user)
|
||||||
render(conn, "show_with_token.json", %{user: user, token: token})
|
render(conn, "show_with_token.json", %{user: user, token: token})
|
||||||
else
|
else
|
||||||
{:error, :invalid_token} ->
|
{:error, :invalid_token} ->
|
||||||
|
@ -99,7 +99,7 @@ defmodule EventosWeb.UserController do
|
||||||
{:error, %Ecto.Changeset{} = changeset} ->
|
{:error, %Ecto.Changeset{} = changeset} ->
|
||||||
conn
|
conn
|
||||||
|> put_status(:unprocessable_entity)
|
|> put_status(:unprocessable_entity)
|
||||||
|> render(EventosWeb.ChangesetView, "error.json", changeset: changeset)
|
|> render(MobilizonWeb.ChangesetView, "error.json", changeset: changeset)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
defmodule EventosWeb.UserSessionController do
|
defmodule MobilizonWeb.UserSessionController do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Controller for user sessions
|
Controller for user sessions
|
||||||
"""
|
"""
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
alias Eventos.Actors.User
|
alias Mobilizon.Actors.User
|
||||||
alias Eventos.Actors
|
alias Mobilizon.Actors
|
||||||
|
|
||||||
def sign_in(conn, %{"email" => email, "password" => password}) do
|
def sign_in(conn, %{"email" => email, "password" => password}) do
|
||||||
with {:ok, %User{} = user} <- Actors.find_by_email(email),
|
with {:ok, %User{} = user} <- Actors.find_by_email(email),
|
||||||
|
@ -35,7 +35,7 @@ defmodule EventosWeb.UserSessionController do
|
||||||
|
|
||||||
def sign_out(conn, _params) do
|
def sign_out(conn, _params) do
|
||||||
conn
|
conn
|
||||||
|> EventosWeb.Guardian.Plug.sign_out()
|
|> MobilizonWeb.Guardian.Plug.sign_out()
|
||||||
|> send_resp(204, "")
|
|> send_resp(204, "")
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,7 +1,7 @@
|
||||||
defmodule EventosWeb.WebFingerController do
|
defmodule MobilizonWeb.WebFingerController do
|
||||||
use EventosWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
|
||||||
alias Eventos.Service.WebFinger
|
alias Mobilizon.Service.WebFinger
|
||||||
|
|
||||||
def host_meta(conn, _params) do
|
def host_meta(conn, _params) do
|
||||||
xml = WebFinger.host_meta()
|
xml = WebFinger.host_meta()
|
|
@ -1,10 +1,10 @@
|
||||||
defmodule EventosWeb.Endpoint do
|
defmodule MobilizonWeb.Endpoint do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Endpoint for Eventos app
|
Endpoint for Mobilizon app
|
||||||
"""
|
"""
|
||||||
use Phoenix.Endpoint, otp_app: :eventos
|
use Phoenix.Endpoint, otp_app: :mobilizon
|
||||||
|
|
||||||
socket("/socket", EventosWeb.UserSocket)
|
socket("/socket", MobilizonWeb.UserSocket)
|
||||||
|
|
||||||
# Serve at "/" the static files from "priv/static" directory.
|
# Serve at "/" the static files from "priv/static" directory.
|
||||||
#
|
#
|
||||||
|
@ -13,7 +13,7 @@ defmodule EventosWeb.Endpoint do
|
||||||
plug(
|
plug(
|
||||||
Plug.Static,
|
Plug.Static,
|
||||||
at: "/",
|
at: "/",
|
||||||
from: :eventos,
|
from: :mobilizon,
|
||||||
gzip: false,
|
gzip: false,
|
||||||
only: ~w(css fonts images js favicon.ico robots.txt index.html)
|
only: ~w(css fonts images js favicon.ico robots.txt index.html)
|
||||||
)
|
)
|
||||||
|
@ -46,11 +46,11 @@ defmodule EventosWeb.Endpoint do
|
||||||
plug(
|
plug(
|
||||||
Plug.Session,
|
Plug.Session,
|
||||||
store: :cookie,
|
store: :cookie,
|
||||||
key: "_eventos_key",
|
key: "_mobilizon_key",
|
||||||
signing_salt: "F9CCTF22"
|
signing_salt: "F9CCTF22"
|
||||||
)
|
)
|
||||||
|
|
||||||
plug(EventosWeb.Router)
|
plug(MobilizonWeb.Router)
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Callback invoked for dynamically configuring the endpoint.
|
Callback invoked for dynamically configuring the endpoint.
|
|
@ -1,11 +1,11 @@
|
||||||
defmodule EventosWeb.Gettext do
|
defmodule MobilizonWeb.Gettext do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
A module providing Internationalization with a gettext-based API.
|
A module providing Internationalization with a gettext-based API.
|
||||||
|
|
||||||
By using [Gettext](https://hexdocs.pm/gettext),
|
By using [Gettext](https://hexdocs.pm/gettext),
|
||||||
your module gains a set of macros for translations, for example:
|
your module gains a set of macros for translations, for example:
|
||||||
|
|
||||||
import EventosWeb.Gettext
|
import MobilizonWeb.Gettext
|
||||||
|
|
||||||
# Simple translation
|
# Simple translation
|
||||||
gettext "Here is the string to translate"
|
gettext "Here is the string to translate"
|
||||||
|
@ -20,5 +20,5 @@ defmodule EventosWeb.Gettext do
|
||||||
|
|
||||||
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
|
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
|
||||||
"""
|
"""
|
||||||
use Gettext, otp_app: :eventos
|
use Gettext, otp_app: :mobilizon
|
||||||
end
|
end
|
|
@ -1,16 +1,16 @@
|
||||||
defmodule EventosWeb.Guardian do
|
defmodule MobilizonWeb.Guardian do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Handles the JWT tokens encoding and decoding
|
Handles the JWT tokens encoding and decoding
|
||||||
"""
|
"""
|
||||||
use Guardian,
|
use Guardian,
|
||||||
otp_app: :eventos,
|
otp_app: :mobilizon,
|
||||||
permissions: %{
|
permissions: %{
|
||||||
superuser: [:moderate, :super],
|
superuser: [:moderate, :super],
|
||||||
user: [:base]
|
user: [:base]
|
||||||
}
|
}
|
||||||
|
|
||||||
alias Eventos.Actors
|
alias Mobilizon.Actors
|
||||||
alias Eventos.Actors.User
|
alias Mobilizon.Actors.User
|
||||||
|
|
||||||
def subject_for_token(%User{} = user, _claims) do
|
def subject_for_token(%User{} = user, _claims) do
|
||||||
{:ok, "User:" <> to_string(user.id)}
|
{:ok, "User:" <> to_string(user.id)}
|
|
@ -1,11 +1,11 @@
|
||||||
defmodule EventosWeb.HTTPSignaturePlug do
|
defmodule MobilizonWeb.HTTPSignaturePlug do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
# HTTPSignaturePlug
|
# HTTPSignaturePlug
|
||||||
|
|
||||||
Plug to check HTTP Signatures on every incoming request
|
Plug to check HTTP Signatures on every incoming request
|
||||||
"""
|
"""
|
||||||
|
|
||||||
alias Eventos.Service.HTTPSignatures
|
alias Mobilizon.Service.HTTPSignatures
|
||||||
import Plug.Conn
|
import Plug.Conn
|
||||||
require Logger
|
require Logger
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
defmodule EventosWeb.Router do
|
defmodule MobilizonWeb.Router do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Router for eventos app
|
Router for mobilizon app
|
||||||
"""
|
"""
|
||||||
use EventosWeb, :router
|
use MobilizonWeb, :router
|
||||||
|
|
||||||
pipeline :api do
|
pipeline :api do
|
||||||
plug(:accepts, ["json"])
|
plug(:accepts, ["json"])
|
||||||
|
@ -14,12 +14,12 @@ defmodule EventosWeb.Router do
|
||||||
|
|
||||||
pipeline :activity_pub do
|
pipeline :activity_pub do
|
||||||
plug(:accepts, ["activity-json", "text/html"])
|
plug(:accepts, ["activity-json", "text/html"])
|
||||||
plug(EventosWeb.HTTPSignaturePlug)
|
plug(MobilizonWeb.HTTPSignaturePlug)
|
||||||
end
|
end
|
||||||
|
|
||||||
pipeline :api_auth do
|
pipeline :api_auth do
|
||||||
plug(:accepts, ["json"])
|
plug(:accepts, ["json"])
|
||||||
plug(EventosWeb.AuthPipeline)
|
plug(MobilizonWeb.AuthPipeline)
|
||||||
end
|
end
|
||||||
|
|
||||||
pipeline :browser do
|
pipeline :browser do
|
||||||
|
@ -34,7 +34,7 @@ defmodule EventosWeb.Router do
|
||||||
plug(:accepts, ["html", "application/json"])
|
plug(:accepts, ["html", "application/json"])
|
||||||
end
|
end
|
||||||
|
|
||||||
scope "/api", EventosWeb do
|
scope "/api", MobilizonWeb do
|
||||||
pipe_through(:api)
|
pipe_through(:api)
|
||||||
|
|
||||||
scope "/v1" do
|
scope "/v1" do
|
||||||
|
@ -81,7 +81,7 @@ defmodule EventosWeb.Router do
|
||||||
end
|
end
|
||||||
|
|
||||||
# Authentificated API
|
# Authentificated API
|
||||||
scope "/api", EventosWeb do
|
scope "/api", MobilizonWeb do
|
||||||
pipe_through(:api_auth)
|
pipe_through(:api_auth)
|
||||||
|
|
||||||
scope "/v1" do
|
scope "/v1" do
|
||||||
|
@ -112,7 +112,7 @@ defmodule EventosWeb.Router do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scope "/.well-known", EventosWeb do
|
scope "/.well-known", MobilizonWeb do
|
||||||
pipe_through(:well_known)
|
pipe_through(:well_known)
|
||||||
|
|
||||||
get("/host-meta", WebFingerController, :host_meta)
|
get("/host-meta", WebFingerController, :host_meta)
|
||||||
|
@ -120,7 +120,7 @@ defmodule EventosWeb.Router do
|
||||||
get("/nodeinfo", NodeinfoController, :schemas)
|
get("/nodeinfo", NodeinfoController, :schemas)
|
||||||
end
|
end
|
||||||
|
|
||||||
scope "/", EventosWeb do
|
scope "/", MobilizonWeb do
|
||||||
pipe_through(:activity_pub)
|
pipe_through(:activity_pub)
|
||||||
|
|
||||||
get("/@:name", ActivityPubController, :actor)
|
get("/@:name", ActivityPubController, :actor)
|
||||||
|
@ -138,7 +138,7 @@ defmodule EventosWeb.Router do
|
||||||
forward("/sent_emails", Bamboo.SentEmailViewerPlug)
|
forward("/sent_emails", Bamboo.SentEmailViewerPlug)
|
||||||
end
|
end
|
||||||
|
|
||||||
scope "/", EventosWeb do
|
scope "/", MobilizonWeb do
|
||||||
pipe_through(:browser)
|
pipe_through(:browser)
|
||||||
|
|
||||||
get("/*path", PageController, :index)
|
get("/*path", PageController, :index)
|
10
lib/mobilizon_web/templates/email/email.html.eex
Normal file
10
lib/mobilizon_web/templates/email/email.html.eex
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<link rel="stylesheet" href="<%= static_url(MobilizonWeb.Endpoint, "/css/email.css") %>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<%= render @view_module, @view_template, assigns %>
|
||||||
|
|
||||||
|
<p><%= gettext "An email sent by Mobilizon on %{instance}.", instance: @instance %></p>
|
||||||
|
</body>
|
||||||
|
</html>
|
3
lib/mobilizon_web/templates/email/email.text.eex
Normal file
3
lib/mobilizon_web/templates/email/email.text.eex
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<%= render @view_module, @view_template, assigns %>
|
||||||
|
|
||||||
|
<%= gettext "An email sent by Mobilizon on %{instance}.", instance: @instance %>
|
|
@ -2,4 +2,4 @@
|
||||||
<p><%= gettext "You requested a new password for your account on %{host}.", host: @instance %></p>
|
<p><%= gettext "You requested a new password for your account on %{host}.", host: @instance %></p>
|
||||||
<p><%= gettext "If you didn't request this, please ignore this email. Your password won't change until you access the link below and create a new one." %></p>
|
<p><%= gettext "If you didn't request this, please ignore this email. Your password won't change until you access the link below and create a new one." %></p>
|
||||||
|
|
||||||
<p><%= link "Change password", to: EventosWeb.Endpoint.url() <> "/password-reset/#{@token}", target: "_blank" %></p>
|
<p><%= link "Change password", to: MobilizonWeb.Endpoint.url() <> "/password-reset/#{@token}", target: "_blank" %></p>
|
|
@ -6,6 +6,6 @@
|
||||||
|
|
||||||
<%= gettext "If you didn't request this, please ignore this email. Your password won't change until you access the link below and create a new one." %>
|
<%= gettext "If you didn't request this, please ignore this email. Your password won't change until you access the link below and create a new one." %>
|
||||||
|
|
||||||
<%= EventosWeb.Endpoint.url() <> "/password-reset/#{@token}" %>
|
<%= MobilizonWeb.Endpoint.url() <> "/password-reset/#{@token}" %>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<h1><%= gettext "Confirm the email address" %></h1>
|
<h1><%= gettext "Confirm the email address" %></h1>
|
||||||
<p><%= gettext "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email.", host: @instance %></p>
|
<p><%= gettext "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email.", host: @instance %></p>
|
||||||
|
|
||||||
<p><%= link "Confirm your email address", to: EventosWeb.Endpoint.url() <> "/validate/#{@token}", target: "_blank" %></p>
|
<p><%= link "Confirm your email address", to: MobilizonWeb.Endpoint.url() <> "/validate/#{@token}", target: "_blank" %></p>
|
|
@ -4,6 +4,6 @@
|
||||||
|
|
||||||
<%= gettext "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email.", host: @instance %>
|
<%= gettext "You created an account on %{host} with this email address. You are one click away from activating it. If this wasn't you, please ignore this email.", host: @instance %>
|
||||||
|
|
||||||
<%= EventosWeb.Endpoint.url() <> "/validate/#{@token}" %>
|
<%= MobilizonWeb.Endpoint.url() <> "/validate/#{@token}" %>
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
defmodule EventosWeb.ActivityPub.ActorView do
|
defmodule MobilizonWeb.ActivityPub.ActorView do
|
||||||
use EventosWeb, :view
|
use MobilizonWeb, :view
|
||||||
|
|
||||||
alias EventosWeb.ActivityPub.ActorView
|
alias MobilizonWeb.ActivityPub.ActorView
|
||||||
alias EventosWeb.ActivityPub.ObjectView
|
alias MobilizonWeb.ActivityPub.ObjectView
|
||||||
alias EventosWeb.WebFinger
|
alias MobilizonWeb.WebFinger
|
||||||
alias Eventos.Actors.Actor
|
alias Mobilizon.Actors.Actor
|
||||||
alias Eventos.Repo
|
alias Mobilizon.Repo
|
||||||
alias Eventos.Service.ActivityPub
|
alias Mobilizon.Service.ActivityPub
|
||||||
alias Eventos.Service.ActivityPub.Transmogrifier
|
alias Mobilizon.Service.ActivityPub.Transmogrifier
|
||||||
alias Eventos.Service.ActivityPub.Utils
|
alias Mobilizon.Service.ActivityPub.Utils
|
||||||
alias Eventos.Activity
|
alias Mobilizon.Activity
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
|
|
||||||
def render("actor.json", %{actor: actor}) do
|
def render("actor.json", %{actor: actor}) do
|
||||||
public_key = Eventos.Service.ActivityPub.Utils.pem_to_public_key_pem(actor.keys)
|
public_key = Mobilizon.Service.ActivityPub.Utils.pem_to_public_key_pem(actor.keys)
|
||||||
|
|
||||||
%{
|
%{
|
||||||
"id" => actor.url,
|
"id" => actor.url,
|
|
@ -1,7 +1,7 @@
|
||||||
defmodule EventosWeb.ActivityPub.ObjectView do
|
defmodule MobilizonWeb.ActivityPub.ObjectView do
|
||||||
use EventosWeb, :view
|
use MobilizonWeb, :view
|
||||||
alias EventosWeb.ActivityPub.ObjectView
|
alias MobilizonWeb.ActivityPub.ObjectView
|
||||||
alias Eventos.Service.ActivityPub.Transmogrifier
|
alias Mobilizon.Service.ActivityPub.Transmogrifier
|
||||||
|
|
||||||
@base %{
|
@base %{
|
||||||
"@context" => [
|
"@context" => [
|
|
@ -1,10 +1,10 @@
|
||||||
defmodule EventosWeb.ActorView do
|
defmodule MobilizonWeb.ActorView do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
View for Actors
|
View for Actors
|
||||||
"""
|
"""
|
||||||
use EventosWeb, :view
|
use MobilizonWeb, :view
|
||||||
alias EventosWeb.{ActorView, EventView, MemberView}
|
alias MobilizonWeb.{ActorView, EventView, MemberView}
|
||||||
alias Eventos.Actors
|
alias Mobilizon.Actors
|
||||||
|
|
||||||
def render("index.json", %{actors: actors}) do
|
def render("index.json", %{actors: actors}) do
|
||||||
%{data: render_many(actors, ActorView, "actor_basic.json")}
|
%{data: render_many(actors, ActorView, "actor_basic.json")}
|
|
@ -1,10 +1,10 @@
|
||||||
defmodule EventosWeb.AddressView do
|
defmodule MobilizonWeb.AddressView do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
View for addresses
|
View for addresses
|
||||||
"""
|
"""
|
||||||
|
|
||||||
use EventosWeb, :view
|
use MobilizonWeb, :view
|
||||||
alias EventosWeb.AddressView
|
alias MobilizonWeb.AddressView
|
||||||
|
|
||||||
def render("index.json", %{addresses: addresses}) do
|
def render("index.json", %{addresses: addresses}) do
|
||||||
%{data: render_many(addresses, AddressView, "address.json")}
|
%{data: render_many(addresses, AddressView, "address.json")}
|
|
@ -1,6 +1,6 @@
|
||||||
defmodule EventosWeb.BotView do
|
defmodule MobilizonWeb.BotView do
|
||||||
use EventosWeb, :view
|
use MobilizonWeb, :view
|
||||||
alias EventosWeb.BotView
|
alias MobilizonWeb.BotView
|
||||||
|
|
||||||
def render("index.json", %{bots: bots}) do
|
def render("index.json", %{bots: bots}) do
|
||||||
%{data: render_many(bots, BotView, "bot.json")}
|
%{data: render_many(bots, BotView, "bot.json")}
|
|
@ -1,9 +1,9 @@
|
||||||
defmodule EventosWeb.CategoryView do
|
defmodule MobilizonWeb.CategoryView do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
View for Categories
|
View for Categories
|
||||||
"""
|
"""
|
||||||
use EventosWeb, :view
|
use MobilizonWeb, :view
|
||||||
alias EventosWeb.CategoryView
|
alias MobilizonWeb.CategoryView
|
||||||
|
|
||||||
def render("index.json", %{categories: categories}) do
|
def render("index.json", %{categories: categories}) do
|
||||||
%{data: render_many(categories, CategoryView, "category.json")}
|
%{data: render_many(categories, CategoryView, "category.json")}
|
|
@ -1,14 +1,14 @@
|
||||||
defmodule EventosWeb.ChangesetView do
|
defmodule MobilizonWeb.ChangesetView do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
View for changesets in case of errors
|
View for changesets in case of errors
|
||||||
"""
|
"""
|
||||||
use EventosWeb, :view
|
use MobilizonWeb, :view
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Traverses and translates changeset errors.
|
Traverses and translates changeset errors.
|
||||||
|
|
||||||
See `Ecto.Changeset.traverse_errors/2` and
|
See `Ecto.Changeset.traverse_errors/2` and
|
||||||
`EventosWeb.ErrorHelpers.translate_error/1` for more details.
|
`MobilizonWeb.ErrorHelpers.translate_error/1` for more details.
|
||||||
"""
|
"""
|
||||||
def translate_errors(changeset) do
|
def translate_errors(changeset) do
|
||||||
Ecto.Changeset.traverse_errors(changeset, &translate_error/1)
|
Ecto.Changeset.traverse_errors(changeset, &translate_error/1)
|
|
@ -1,6 +1,6 @@
|
||||||
defmodule EventosWeb.CommentView do
|
defmodule MobilizonWeb.CommentView do
|
||||||
use EventosWeb, :view
|
use MobilizonWeb, :view
|
||||||
alias EventosWeb.CommentView
|
alias MobilizonWeb.CommentView
|
||||||
|
|
||||||
def render("index.json", %{comments: comments}) do
|
def render("index.json", %{comments: comments}) do
|
||||||
%{data: render_many(comments, CommentView, "comment.json")}
|
%{data: render_many(comments, CommentView, "comment.json")}
|
3
lib/mobilizon_web/views/email_view.ex
Normal file
3
lib/mobilizon_web/views/email_view.ex
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
defmodule Mobilizon.EmailView do
|
||||||
|
use MobilizonWeb, :view
|
||||||
|
end
|
|
@ -1,4 +1,4 @@
|
||||||
defmodule EventosWeb.ErrorHelpers do
|
defmodule MobilizonWeb.ErrorHelpers do
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Conveniences for translating and building error messages.
|
Conveniences for translating and building error messages.
|
||||||
"""
|
"""
|
||||||
|
@ -32,9 +32,9 @@ defmodule EventosWeb.ErrorHelpers do
|
||||||
# dgettext "errors", "is invalid"
|
# dgettext "errors", "is invalid"
|
||||||
#
|
#
|
||||||
if count = opts[:count] do
|
if count = opts[:count] do
|
||||||
Gettext.dngettext(EventosWeb.Gettext, "errors", msg, msg, count, opts)
|
Gettext.dngettext(MobilizonWeb.Gettext, "errors", msg, msg, count, opts)
|
||||||
else
|
else
|
||||||
Gettext.dgettext(EventosWeb.Gettext, "errors", msg, opts)
|
Gettext.dgettext(MobilizonWeb.Gettext, "errors", msg, opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue