diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..531d3cc04 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,66 @@ +# Update the VARIANT arg in docker-compose.yml to pick an Elixir version: 1.9, 1.10, 1.10.4 +ARG VARIANT="1.12.3" +FROM elixir:${VARIANT} + +# This Dockerfile adds a non-root user with sudo access. Update the “remoteUser” property in +# devcontainer.json to use it. More info: https://aka.ms/vscode-remote/containers/non-root-user. +ARG USERNAME=vscode +ARG USER_UID=1000 +ARG USER_GID=$USER_UID + +# Options for common package install script +ARG INSTALL_ZSH="true" +ARG UPGRADE_PACKAGES="true" +ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/v0.209.6/script-library/common-debian.sh" +ARG COMMON_SCRIPT_SHA="d35dd1711454156c9a59cc41ebe04fbff681ca0bd304f10fd5b13285d0de13b2" + +# Optional Settings for Phoenix +ARG PHOENIX_VERSION="1.6.2" + +# [Optional] Setup nodejs +ARG NODE_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/main/script-library/node-debian.sh" +ARG NODE_SCRIPT_SHA="dev-mode" +ARG NODE_VERSION="none" +ENV NVM_DIR=/usr/local/share/nvm +ENV NVM_SYMLINK_CURRENT=true +ENV PATH=${NVM_DIR}/current/bin:${PATH} + +# [Optional, Choice] Node.js version: none, lts/*, 16, 14, 12, 10 +ARG NODE_VERSION="none" + +# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies. +RUN apt-get update \ + && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends curl ca-certificates 2>&1 \ + && curl -sSL ${COMMON_SCRIPT_SOURCE} -o /tmp/common-setup.sh \ + && ([ "${COMMON_SCRIPT_SHA}" = "dev-mode" ] || (echo "${COMMON_SCRIPT_SHA} */tmp/common-setup.sh" | sha256sum -c -)) \ + && /bin/bash /tmp/common-setup.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" \ + # + # [Optional] Install Node.js for use with web applications + && if [ "$NODE_VERSION" != "none" ]; then \ + curl -sSL ${NODE_SCRIPT_SOURCE} -o /tmp/node-setup.sh \ + && ([ "${NODE_SCRIPT_SHA}" = "dev-mode" ] || (echo "${NODE_SCRIPT_SHA} */tmp/node-setup.sh" | sha256sum -c -)) \ + && /bin/bash /tmp/node-setup.sh "${NVM_DIR}" "${NODE_VERSION}" "${USERNAME}"; \ + fi \ + # + # Install dependencies + && apt-get install -y build-essential \ + # + # Clean up + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* /tmp/common-setup.sh /tmp/node-setup.sh + +RUN su ${USERNAME} -c "mix local.hex --force \ + && mix local.rebar --force \ + && mix archive.install --force hex phx_new ${PHOENIX_VERSION}" + +RUN apt-get update \ + && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends cmake webp bash libncurses6 git python3 inotify-tools \ + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* + +# [Optional] Uncomment this line to install additional package. +# RUN mix ... diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..7ed7bedd6 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,44 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/elixir-phoenix-postgres +{ + "name": "Elixir, Phoenix, Node.js & PostgresSQL (Community)", + "dockerComposeFile": "docker-compose.yml", + "service": "elixir", + "workspaceFolder": "/workspace", + + // Set *default* container specific settings.json values on container create. + "settings": { + "sqltools.connections": [{ + "name": "Container database", + "driver": "PostgreSQL", + "previewLimit": 50, + "server": "localhost", + "port": 5432, + "database": "postgres", + "username": "postgres", + "password": "postgres" + }] + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "jakebecker.elixir-ls", + "mtxr.sqltools", + "mtxr.sqltools-driver-pg" + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [4000, 4001, 5432], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "mix deps.get", + // "runArgs": ["--userns=keep-id", "--privileged"], + // "containerUser": "vscode", + // "containerEnv": { + // "HOME": "/home/vscode", + // }, + // "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,Z", + + // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode" +} diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 000000000..bf922850a --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,46 @@ +version: "3.8" + +services: + elixir: + build: + context: . + dockerfile: Dockerfile + args: + # Elixir Version: 1.9, 1.10, 1.10.4, ... + VARIANT: "1.13.1" + # Phoenix Version: 1.4.17, 1.5.4, ... + PHOENIX_VERSION: "1.6.6" + # Node Version: 10, 11, ... + NODE_VERSION: "16" + + volumes: + - ..:/workspace:z + # Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function. + network_mode: service:db + + # Overrides default command so things don't shut down after the process ends. + command: sleep infinity + environment: + MOBILIZON_INSTANCE_NAME: My Mobilizon Instance + MOBILIZON_INSTANCE_HOST: localhost + MOBILIZON_INSTANCE_HOST_PORT: 4000 + MOBILIZON_INSTANCE_PORT: 4000 + MOBILIZON_INSTANCE_EMAIL: noreply@mobilizon.me + MOBILIZON_INSTANCE_REGISTRATIONS_OPEN: "true" + MOBILIZON_DATABASE_PASSWORD: postgres + MOBILIZON_DATABASE_USERNAME: postgres + MOBILIZON_DATABASE_DBNAME: mobilizon + MOBILIZON_DATABASE_HOST: db + + db: + image: postgis/postgis:latest + restart: unless-stopped + volumes: + - postgres-data:/var/lib/postgresql/data + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: app + +volumes: + postgres-data: null diff --git a/.env.template b/.env.template index e49bfb2b3..203f7e5c1 100644 --- a/.env.template +++ b/.env.template @@ -19,7 +19,6 @@ MOBILIZON_REPLY_EMAIL=contact@mobilizon.lan # Email settings MOBILIZON_SMTP_SERVER=localhost MOBILIZON_SMTP_PORT=25 -MOBILIZON_SMTP_HOSTNAME=localhost MOBILIZON_SMTP_USERNAME=noreply@mobilizon.lan MOBILIZON_SMTP_PASSWORD=password MOBILIZON_SMTP_SSL=false diff --git a/.formatter.exs b/.formatter.exs index 023562bf3..deac09627 100644 --- a/.formatter.exs +++ b/.formatter.exs @@ -1,3 +1,4 @@ [ - inputs: ["{mix,.formatter}.exs", "{config,lib,test,priv}/**/*.{ex,exs}"] + plugins: [Phoenix.LiveView.HTMLFormatter], + inputs: ["{mix,.formatter}.exs", "{config,lib,test,priv}/**/*.{ex,exs,heex}"] ] diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 38f75c481..66a805a23 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -59,8 +59,11 @@ lint-elixir: - mix deps.get script: - export EXITVALUE=0 + - git fetch origin ${CI_DEFAULT_BRANCH} + - TARGET_SHA1=$(git show-ref -s ${CI_DEFAULT_BRANCH}) + - echo "$TARGET_SHA1" - mix format --check-formatted --dry-run || export EXITVALUE=1 - - mix credo --strict -a || export EXITVALUE=1 + - mix credo diff --from-git-merge-base $TARGET_SHA1 --strict -a || export EXITVALUE=1 - mix sobelow --config || export EXITVALUE=1 - exit $EXITVALUE @@ -107,7 +110,7 @@ deps: exunit: stage: test services: - - name: postgis/postgis:13-3.1 + - name: postgis/postgis:14-3.2 alias: postgres variables: MIX_ENV: test @@ -180,7 +183,7 @@ pages: .docker: &docker stage: docker - image: docker:stable + image: docker:20.10.12 variables: DOCKER_TLS_CERTDIR: "/certs" DOCKER_HOST: tcp://docker:2376 @@ -188,13 +191,13 @@ pages: DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client" DOCKER_DRIVER: overlay2 services: - - docker:stable-dind + - docker:20.10.12-dind cache: {} before_script: # Install buildx - - wget https://github.com/docker/buildx/releases/download/v0.6.3/buildx-v0.6.3.linux-amd64 + - wget https://github.com/docker/buildx/releases/download/v0.8.1/buildx-v0.8.1.linux-amd64 - mkdir -p ~/.docker/cli-plugins/ - - mv buildx-v0.6.3.linux-amd64 ~/.docker/cli-plugins/docker-buildx + - mv buildx-v0.8.1.linux-amd64 ~/.docker/cli-plugins/docker-buildx - chmod a+x ~/.docker/cli-plugins/docker-buildx # Create env - docker context create tls-environment @@ -205,16 +208,8 @@ pages: # Login to DockerHub - mkdir -p ~/.docker - echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$CI_REGISTRY_AUTH\",\"email\":\"$CI_REGISTRY_EMAIL\"}}}" > ~/.docker/config.json - script: - - > - docker buildx build - --push - --platform linux/amd64,linux/arm64,linux/arm - -t $DOCKER_IMAGE_NAME - -f docker/production/Dockerfile . tags: - "privileged" - timeout: 3 hours build-docker-main: <<: *docker @@ -222,8 +217,8 @@ build-docker-main: - if: '$CI_PROJECT_NAMESPACE != "framasoft"' when: never - if: '$CI_PIPELINE_SOURCE == "schedule"' - variables: - DOCKER_IMAGE_NAME: framasoft/mobilizon:main + script: + - docker buildx build --push --platform linux/amd64 -t framasoft/mobilizon:main -f docker/production/Dockerfile . build-docker-tag: <<: *docker @@ -231,14 +226,25 @@ build-docker-tag: - if: '$CI_PROJECT_NAMESPACE != "framasoft"' when: never - if: $CI_COMMIT_TAG - variables: - DOCKER_IMAGE_NAME: framasoft/mobilizon:$CI_COMMIT_TAG + timeout: 3 hours + script: + - > + docker buildx build + --push + --platform linux/amd64,linux/arm64,linux/arm + -t framasoft/mobilizon:$CI_COMMIT_TAG + -t framasoft/mobilizon:latest + -f docker/production/Dockerfile . # Packaging app for amd64 package-app: + image: mobilizon/buildpack:1.13.4-erlang-24.3.3-debian-buster stage: package variables: &release-variables MIX_ENV: "prod" + DEBIAN_FRONTEND: noninteractive + TZ: Etc/UTC + APP_ASSET: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${ARCH}.tar.gz" script: &release-script - mix local.hex --force - mix local.rebar --force @@ -254,7 +260,7 @@ package-app: only: - tags@framasoft/mobilizon artifacts: - expire_in: 30 days + expire_in: 2 days paths: - ${APP_ASSET} @@ -272,7 +278,7 @@ package-app-dev: # Packaging app for multi-arch multi-arch-release: stage: package - image: docker:stable + image: docker:20.10.12 variables: DOCKER_TLS_CERTDIR: "/certs" DOCKER_HOST: tcp://docker:2376 @@ -280,14 +286,15 @@ multi-arch-release: DOCKER_CERT_PATH: "$DOCKER_TLS_CERTDIR/client" DOCKER_DRIVER: overlay2 APP_ASSET: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${ARCH}.tar.gz" + OS: debian-buster services: - - docker:stable-dind + - docker:20.10.12-dind cache: {} before_script: # Install buildx - - wget https://github.com/docker/buildx/releases/download/v0.6.3/buildx-v0.6.3.linux-amd64 + - wget https://github.com/docker/buildx/releases/download/v0.8.1/buildx-v0.8.1.linux-amd64 - mkdir -p ~/.docker/cli-plugins/ - - mv buildx-v0.6.3.linux-amd64 ~/.docker/cli-plugins/docker-buildx + - mv buildx-v0.8.1.linux-amd64 ~/.docker/cli-plugins/docker-buildx - chmod a+x ~/.docker/cli-plugins/docker-buildx # Create env - docker context create tls-environment @@ -303,7 +310,7 @@ multi-arch-release: tags: - "privileged" artifacts: - expire_in: 30 days + expire_in: 2 days paths: - ${APP_ASSET} parallel: @@ -319,7 +326,7 @@ multi-arch-release: # Release release-upload: stage: upload - image: framasoft/yakforms-assets-deploy:latest + image: framasoft/upload-packages:latest variables: APP_ASSET: "${CI_PROJECT_NAME}_${CI_COMMIT_REF_NAME}_${ARCH}.tar.gz" rules: *tag-rules diff --git a/.sobelow-conf b/.sobelow-conf index 8cd2246e6..56b7c740e 100644 --- a/.sobelow-conf +++ b/.sobelow-conf @@ -8,5 +8,5 @@ out: "", threshold: "medium", ignore: ["Config.HTTPS", "Config.CSP"], - ignore_files: ["config/dev.1.secret.exs", "config/dev.2.secret.exs", "config/dev.3.secret.exs", "config/dev.secret.exs", "config/e2e.secret.exs", "config/prod.secret.exs", "config/test.secret.exs", "config/runtime.1.secret.exs", "config/runtime.2.secret.exs", "config/runtime.3.secret.exs", "config/runtime.exs"] + ignore_files: ["config/runtime.exs"] ] diff --git a/.sobelow-skips b/.sobelow-skips index 0dda374a6..3eabeecae 100644 --- a/.sobelow-skips +++ b/.sobelow-skips @@ -1,12 +1,16 @@ -5048AE33D6269B15E21CF28C6F545AB6 - -752C0E897CA81ACD81F4BB215FA5F8E4 -23412CF16549E4E88366DC9DECF39071 -81C1F600C5809C7029EE32DE4818CD7D +02CE4963DFD1B0D6D5C567357CAFFE97 155A1FB53DE39EC8EFCFD7FB94EA823D -73B351E4CB3AF715AD450A085F5E6304 -BBACD7F0BACD4A6D3010C26604671692 -6D4D4A4821B93BCFAC9CDBB367B34C4B -5674F0D127852889ED0132DC2F442AAB -1600B7206E47F630D94AB54C360906F0 \ No newline at end of file +2262742E5C8944D5BF6698EC61F5DE50 +25BEE162A99754480967216281E9EF33 +2A6F71CD6F1246F0B152C2376E2E398A +30552A09D485A6AA73401C1D54F63C21 +52900CE4EE3598F6F178A651FB256770 +6151F44368FC19F2394274F513C29151 +765526195D4C6D770EAF4DC944A8CBF4 +B2FF1A12F13B873507C85091688C1D6D +B9AF8A342CD7FF39E10CC10A408C28E1 +C042E87389F7BDCFF4E076E95731AE69 +C42BFAEF7100F57BED75998B217C857A +D11958E86F1B6D37EF656B63405CA8A4 +F16F054F2628609A726B9FF2F089D484 \ No newline at end of file diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 000000000..3162337da --- /dev/null +++ b/.tool-versions @@ -0,0 +1,2 @@ +elixir 1.13.4-otp-24 +erlang 24.3.3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6bb7c785b..60543e9cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,373 @@ # Changelog + All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 2.1.0 - 2022-05-16 + +### Added + +- Added an event category field. Administrators can extend the pre-configured list of categories through configuration. +- Added possibility for administrators to have analytics (Matomo, Plausible supported) and error handling (Sentry supported) on front-end. +- Redesigned federation admin section with dedicated instance pages +- Allow to filter moderation reports by domain +- Added a button to go to past events of a group if it has no upcoming events +- Add Überauth CAS Strategy +- Add a CLI command to delete actors + +### Changed + +- Changed mailer library from Bamboo to Swoosh, should fix emails being considered spam. **Some configuration changes are required, see below.** +- Expose some fields to ActivityStreams event representation: `isOnline`, `remainingAttendeeCapacity` and `participantCount` +- Expose a new field to ActivityStreams group representation: `memberCount` +- Improve group creation errors feedback +- Only display locality in event card +- Stale groups are now excluded from group search +- Event default visibility is now set according to group privacy setting +- Remove Koena Connect button +- Hide the whole metadata block if group has no description +- Increase task timeout in Refresher to 60 seconds +- Allow webfinger to be fetched over http (not https) in dev mode +- Improve reactions when approving/rejecting an instance follow +- Improve instance admin view for mobile +- Allow to reject instance following +- Allow instance to have non-standard ports +- Add pagination to the instances list +- Eventually fetch actors in mentions +- Improve IdentityPicker, JoinGroupWithAccount and ActorInline components +- Various group and posts improvements +- Update schema.graphql file +- Add "Accept-Language" header to sentry request metadata +- Hide address blocks when address has no real data +- Remove obsolete attribute type="text/css" from - - diff --git a/js/src/components/Account/ActorInline.vue b/js/src/components/Account/ActorInline.vue index 29fa40359..4857b8607 100644 --- a/js/src/components/Account/ActorInline.vue +++ b/js/src/components/Account/ActorInline.vue @@ -1,28 +1,33 @@ diff --git a/js/src/components/Admin/Followers.vue b/js/src/components/Admin/Followers.vue deleted file mode 100644 index d05b6d606..000000000 --- a/js/src/components/Admin/Followers.vue +++ /dev/null @@ -1,262 +0,0 @@ - - diff --git a/js/src/components/Admin/Followings.vue b/js/src/components/Admin/Followings.vue deleted file mode 100644 index 6739aba01..000000000 --- a/js/src/components/Admin/Followings.vue +++ /dev/null @@ -1,311 +0,0 @@ - - diff --git a/js/src/components/Editor.vue b/js/src/components/Editor.vue index 6645de3ac..a4628b39e 100644 --- a/js/src/components/Editor.vue +++ b/js/src/components/Editor.vue @@ -195,10 +195,18 @@ diff --git a/js/src/views/Admin/AdminProfile.vue b/js/src/views/Admin/AdminProfile.vue index 58f88b16a..227cc0a88 100644 --- a/js/src/views/Admin/AdminProfile.vue +++ b/js/src/views/Admin/AdminProfile.vue @@ -1,32 +1,21 @@ - - diff --git a/js/src/views/Admin/AdminUserProfile.vue b/js/src/views/Admin/AdminUserProfile.vue index e3da9277e..d6a6da772 100644 --- a/js/src/views/Admin/AdminUserProfile.vue +++ b/js/src/views/Admin/AdminUserProfile.vue @@ -1,85 +1,359 @@ - - diff --git a/js/src/views/Admin/Dashboard.vue b/js/src/views/Admin/Dashboard.vue index d2894f0c1..75adc8e9f 100644 --- a/js/src/views/Admin/Dashboard.vue +++ b/js/src/views/Admin/Dashboard.vue @@ -1,19 +1,11 @@