diff --git a/.credo.exs b/.credo.exs index f349c380d..83f7dd28f 100644 --- a/.credo.exs +++ b/.credo.exs @@ -100,7 +100,7 @@ # {Credo.Check.Refactor.CondStatements, []}, {Credo.Check.Refactor.CyclomaticComplexity, []}, - {Credo.Check.Refactor.FunctionArity, []}, + {Credo.Check.Refactor.FunctionArity, [max_arity: 9]}, {Credo.Check.Refactor.LongQuoteBlocks, []}, {Credo.Check.Refactor.MatchInCondition, []}, {Credo.Check.Refactor.NegatedConditionsInUnless, []}, diff --git a/.gitignore b/.gitignore index ecd29e357..da8c3986e 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,8 @@ priv/data/* !priv/data/.gitkeep .vscode/ cover/ +test/fixtures/image_tmp.jpg +test/uploads/ uploads/* !uploads/.gitkeep .idea diff --git a/.graphqlconfig.yaml b/.graphqlconfig.yaml index 6058dcaba..e8956f772 100644 --- a/.graphqlconfig.yaml +++ b/.graphqlconfig.yaml @@ -4,5 +4,5 @@ projects: extensions: endpoints: dev: - url: 'http://localhost:4001/api' + url: 'http://localhost:4000/api' introspect: true diff --git a/Dockerfile b/Dockerfile index 8685ad386..a37e586dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM bitwalker/alpine-elixir:latest RUN apk add inotify-tools postgresql-client yarn -RUN apk add --no-cache make gcc libc-dev argon2 +RUN apk add --no-cache make gcc libc-dev argon2 imagemagick RUN mix local.hex --force && mix local.rebar --force diff --git a/config/config.exs b/config/config.exs index 8d65f58c9..db5c38732 100644 --- a/config/config.exs +++ b/config/config.exs @@ -14,7 +14,11 @@ config :mobilizon, :instance, description: System.get_env("MOBILIZON_INSTANCE_DESCRIPTION") || "This is a Mobilizon instance", version: "1.0.0-dev", registrations_open: System.get_env("MOBILIZON_INSTANCE_REGISTRATIONS_OPEN") || false, - repository: Mix.Project.config()[:source_url] + repository: Mix.Project.config()[:source_url], + remote_limit: 100_000, + upload_limit: 16_000_000, + avatar_upload_limit: 2_000_000, + banner_upload_limit: 4_000_000 config :mime, :types, %{ "application/activity+json" => ["activity-json"], @@ -31,6 +35,34 @@ config :mobilizon, MobilizonWeb.Endpoint, email_from: "noreply@localhost", email_to: "noreply@localhost" +# Upload configuration +config :mobilizon, MobilizonWeb.Upload, + uploader: MobilizonWeb.Uploaders.Local, + filters: [MobilizonWeb.Upload.Filter.Dedupe], + link_name: true, + proxy_remote: false, + proxy_opts: [ + redirect_on_failure: false, + max_body_length: 25 * 1_048_576, + http: [ + follow_redirect: true, + pool: :upload + ] + ] + +config :mobilizon, MobilizonWeb.Uploaders.Local, uploads: "uploads" + +config :mobilizon, :media_proxy, + enabled: false, + proxy_opts: [ + redirect_on_failure: false, + max_body_length: 25 * 1_048_576, + http: [ + follow_redirect: true, + pool: :media + ] + ] + # Configures Elixir's Logger config :logger, :console, format: "$time $metadata[$level] $message\n", @@ -62,9 +94,6 @@ config :geolix, } ] -config :arc, - storage: Arc.Storage.Local - config :phoenix, :format_encoders, json: Jason, "activity-json": Jason config :mobilizon, Mobilizon.Service.Geospatial.Nominatim, diff --git a/config/dev.exs b/config/dev.exs index 723a4a449..41fb0f730 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -8,11 +8,10 @@ use Mix.Config # with brunch.io to recompile .js and .css sources. config :mobilizon, MobilizonWeb.Endpoint, http: [ - port: System.get_env("MOBILIZON_INSTANCE_PORT") || 4001 + port: System.get_env("MOBILIZON_INSTANCE_PORT") || 4000 ], url: [ - host: System.get_env("MOBILIZON_INSTANCE_HOST") || "mobilizon.local", - port: System.get_env("MOBILIZON_INSTANCE_PORT") || 4001 + host: System.get_env("MOBILIZON_INSTANCE_HOST") || "mobilizon.local" ], debug_errors: true, code_reloader: true, diff --git a/config/prod.exs b/config/prod.exs index ad21683b1..cdbf50a39 100644 --- a/config/prod.exs +++ b/config/prod.exs @@ -1,28 +1,10 @@ use Mix.Config -# For production, we often load configuration from external -# sources, such as your system environment. For this reason, -# you won't find the :http configuration below, but set inside -# MobilizonWeb.Endpoint.init/2 when load_from_system_env is -# true. Any dynamic configuration should be done there. -# -# Don't forget to configure the url host to something meaningful, -# Phoenix uses this information when generating URLs. -# -# Finally, we also include the path to a cache manifest -# containing the digested version of static files. This -# manifest is generated by the mix phx.digest task -# which you typically run after static files are built. config :mobilizon, MobilizonWeb.Endpoint, - load_from_system_env: true, + http: [:inet6, port: System.get_env("MOBILIZON_INSTANCE_PORT") || 4000], url: [ host: System.get_env("MOBILIZON_INSTANCE_HOST") || "mobilizon.me", - scheme: "https", - port: 443 - ], - http: [ - ip: {127, 0, 0, 1}, - port: System.get_env("MOBILIZON_INSTANCE_PORT") || 4000 + port: 80 ], secret_key_base: System.get_env("MOBILIZON_SECRET") || "ThisShouldBeAVeryStrongStringPleaseReplaceMe", diff --git a/config/test.exs b/config/test.exs index 9e1c31306..21432393b 100644 --- a/config/test.exs +++ b/config/test.exs @@ -33,6 +33,10 @@ config :mobilizon, Mobilizon.Repo, config :mobilizon, Mobilizon.Mailer, adapter: Bamboo.TestAdapter +config :mobilizon, MobilizonWeb.Upload, filters: [], link_name: false + +config :mobilizon, MobilizonWeb.Uploaders.Local, uploads: "test/uploads" + config :exvcr, vcr_cassette_library_dir: "test/fixtures/vcr_cassettes" diff --git a/js/package.json b/js/package.json index 68e15d393..58a014302 100644 --- a/js/package.json +++ b/js/package.json @@ -14,7 +14,7 @@ "dependencies": { "apollo-absinthe-upload-link": "^1.5.0", "apollo-cache-inmemory": "^1.5.1", - "apollo-client": "^2.5.1", + "apollo-client": "2.5.1", "apollo-link": "^1.2.11", "apollo-link-http": "^1.5.14", "apollo-link-state": "^0.4.2", diff --git a/js/src/App.vue b/js/src/App.vue index 1ec44790b..76e35f9d4 100644 --- a/js/src/App.vue +++ b/js/src/App.vue @@ -91,6 +91,7 @@ export default class App extends Vue { @import "~buefy/src/scss/components/form"; @import "~buefy/src/scss/components/modal"; @import "~buefy/src/scss/components/tag"; + @import "~buefy/src/scss/components/upload"; @import "~buefy/src/scss/utils/_all"; .router-enter-active, diff --git a/js/src/components/Account/Identities.vue b/js/src/components/Account/Identities.vue index d1337db96..c81771b1c 100644 --- a/js/src/components/Account/Identities.vue +++ b/js/src/components/Account/Identities.vue @@ -8,8 +8,8 @@
  • -
    - +
    +
    diff --git a/js/src/components/Event/EventCard.vue b/js/src/components/Event/EventCard.vue index e551cbcca..52d565029 100644 --- a/js/src/components/Event/EventCard.vue +++ b/js/src/components/Event/EventCard.vue @@ -2,7 +2,7 @@
    -
    +
    {{ tag.title }}
    diff --git a/js/src/components/Group/GroupCard.vue b/js/src/components/Group/GroupCard.vue index cb8137624..6f6531ee8 100644 --- a/js/src/components/Group/GroupCard.vue +++ b/js/src/components/Group/GroupCard.vue @@ -1,6 +1,6 @@