From e38aa65dadd95e38b74bb9a75c840f36b52b0064 Mon Sep 17 00:00:00 2001 From: Christian Winther Date: Wed, 6 Mar 2024 19:38:34 +0000 Subject: [PATCH 01/11] keep building for jippi-fork branch --- .github/workflows/docker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 8fdea53a1..0f62ad3bc 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -10,6 +10,7 @@ on: branches: - dev - staging + - jippi-fork tags: - "*" From ae645ddd155d0c632ba0c934141b1d7c30fbd0c8 Mon Sep 17 00:00:00 2001 From: Christian Winther Date: Wed, 6 Mar 2024 20:45:04 +0000 Subject: [PATCH 02/11] Use rsync container image that supports arm64 and amd64 fixes https://github.com/pixelfed/pixelfed/issues/4979 --- docker-compose.migrate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.migrate.yml b/docker-compose.migrate.yml index b31771f27..b7048b5b5 100644 --- a/docker-compose.migrate.yml +++ b/docker-compose.migrate.yml @@ -3,7 +3,7 @@ version: "3" services: migrate: - image: "secoresearch/rsync" + image: "servercontainers/rsync" entrypoint: "" working_dir: /migrate command: 'bash -c "exit 1"' From dd5878b25693e180720be884f910c1a09e772095 Mon Sep 17 00:00:00 2001 From: Christian Winther Date: Wed, 6 Mar 2024 20:49:36 +0000 Subject: [PATCH 03/11] Allow setting the DB root password seperately Fixes https://github.com/pixelfed/pixelfed/issues/4980 --- .env.docker | 8 ++++++++ docker-compose.yml | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.env.docker b/.env.docker index 0d5836745..e524155fd 100644 --- a/.env.docker +++ b/.env.docker @@ -1202,6 +1202,14 @@ DOCKER_DB_HOST_PORT="${DB_PORT:?error}" # @dottie/validate required,number DOCKER_DB_CONTAINER_PORT="${DB_PORT:?error}" +# root password for the database. By default uses DB_PASSWORD +# but can be changed in situations where you are migrating +# to the included docker-compose and have a different password +# set already +# +# @dottie/validate required +DOCKER_DB_ROOT_PASSWORD="${DB_PASSWORD:?error}" + # How often Docker health check should run for [db] service # @dottie/validate required DOCKER_DB_HEALTHCHECK_INTERVAL="${DOCKER_ALL_DEFAULT_HEALTHCHECK_INTERVAL:?error}" diff --git a/docker-compose.yml b/docker-compose.yml index 5df433c83..767a509b2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -166,12 +166,12 @@ services: environment: TZ: "${TZ:?error}" # MySQL (Oracle) - "Environment Variables" at https://hub.docker.com/_/mysql - MYSQL_ROOT_PASSWORD: "${DB_PASSWORD:?error}" + MYSQL_ROOT_PASSWORD: "${DOCKER_DB_ROOT_PASSWORD:?error}" MYSQL_USER: "${DB_USERNAME:?error}" MYSQL_PASSWORD: "${DB_PASSWORD:?error}" MYSQL_DATABASE: "${DB_DATABASE:?error}" # MySQL (MariaDB) - "Start a mariadb server instance with user, password and database" at https://hub.docker.com/_/mariadb - MARIADB_ROOT_PASSWORD: "${DB_PASSWORD:?error}" + MARIADB_ROOT_PASSWORD: "${DOCKER_DB_ROOT_PASSWORD:?error}" MARIADB_USER: "${DB_USERNAME:?error}" MARIADB_PASSWORD: "${DB_PASSWORD:?error}" MARIADB_DATABASE: "${DB_DATABASE:?error}" From 1892f68ebdfc0b75e033e507537abb9a4814527c Mon Sep 17 00:00:00 2001 From: Christian Winther Date: Sun, 10 Mar 2024 14:53:57 +0000 Subject: [PATCH 04/11] Add helper script to check minimum requirements --- docker/check-requirements | 112 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100755 docker/check-requirements diff --git a/docker/check-requirements b/docker/check-requirements new file mode 100755 index 000000000..ad8d0ede4 --- /dev/null +++ b/docker/check-requirements @@ -0,0 +1,112 @@ +#!/bin/bash + +set -e -o errexit -o nounset -o pipefail + +# +# Colors +# + +declare -r RED="\e[31m" +declare -r GREEN="\e[32m" +declare -r YELLOW="\e[33m" +declare -r BLUE="\e[34m" +declare -r NO_COLOR="\e[0m" + +# +# Helper functions +# + +function highlight() { + local reset="${2:-$NO_COLOR}" + echo "${BLUE}$1${reset}" +} + +function action_start() { + echo -en "⚙️ $1: " +} + +function action_start_newline() { + action_start "$1" + echo +} + +function action_ok() { + echo -e "\n\t✅ ${GREEN}${*}${NO_COLOR}\n" +} + +function action_warn() { + echo -e "⚠️ ${YELLOW}${*}${NO_COLOR}" +} + +function action_error() { + echo -e "\n\t❌ ${RED}${*}${NO_COLOR}" >&2 +} + +function action_error_exit() { + action_error "${*}\n\n${RED}Aborting!${NO_COLOR}" + + exit 1 +} + +# +# Configuration +# + +declare -r min_docker_compose_version_arr=(2 17) +min_docker_compose_version=$( + IFS=. + echo "${min_docker_compose_version[*]}" +) + +# +# Help text +# + +DOCKER_HELP=" + +\tWe recommend installing Docker (and Compose) directly from Docker.com instead of your Operation System package registry. +\tPlease see $(highlight "https://docs.docker.com/engine/install/")${RED} for information on how to install Docker on your system. + +\tAlternatively, you can update *JUST* the Compose plugin by following the guide here: +\t$(highlight "https://docs.docker.com/compose/install/linux/#install-the-plugin-manually")${RED}. + +\tLearn more about Docker compose release history here: +\t$(highlight "https://docs.docker.com/compose/release-notes/")${RED}.${NO_COLOR}" +declare -r DOCKER_HELP + +# +# System checks +# + +echo -e "👋 ${GREEN}Hello!" +echo -e "" +echo -e "This script will check your system for the minimum requirements outlined in the Pixelfed Docker install guide" +echo -e "You can find the guide here ${BLUE}https://jippi.github.io/pixelfed-docs-next/pr-preview/pr-1/running-pixelfed/docker/prerequisites.html#software${GREEN}." +echo -e "${NO_COLOR}" + +action_start "Checking if [$(highlight "git")] command is available" +command -v git >/dev/null 2>&1 || { action_error_exit "I require the 'git' command, but it's not installed"; } +action_ok "git is installed" + +action_start "Checking if [$(highlight "docker")] command is available" +command -v docker >/dev/null 2>&1 || { action_error_exit "I require the 'docker' command, but it's not installed. ${DOCKER_HELP}"; } +action_ok "docker is installed" + +action_start "Checking if [$(highlight "docker compose")] command is available" +docker compose >/dev/null 2>&1 || { action_error_exit "I require the 'docker compose' command, but it's not installed. ${DOCKER_HELP}"; } +action_ok "docker compose is installed" + +compose_version=$(docker compose version --short) + +declare -a compose_version_arr +IFS="." read -r -a compose_version_arr <<<"$compose_version" + +action_start "Checking if [$(highlight "docker compose version")] major version (${min_docker_compose_version_arr[0]}) is acceptable" +[[ ${compose_version_arr[0]} -eq ${min_docker_compose_version_arr[0]} ]] || { action_error_exit "I require minimum Docker Compose major version ${min_docker_compose_version_arr[0]}.x.x - found ${compose_version}.${DOCKER_HELP}"; } +action_ok "You're using major version ${compose_version_arr[0]}" + +action_start "Checking if [$(highlight "docker compose version")] minor version (${min_docker_compose_version_arr[1]}) is acceptable" +[[ ${compose_version_arr[1]} -ge ${min_docker_compose_version_arr[1]} ]] || { action_error_exit "I require minimum Docker Compose minor version ${min_docker_compose_version_arr[0]}.${min_docker_compose_version_arr[1]} - found ${compose_version}.${DOCKER_HELP}"; } +action_ok "You're using minor version ${compose_version_arr[1]}" + +echo -e "🎉 ${GREEN}All checks passed, you should be ready to run Pixelfed on this server!${NO_COLOR}" From 56d47dd1bc7c6bb264e908a8b5fec5738ce68b2e Mon Sep 17 00:00:00 2001 From: Christian Winther Date: Sun, 10 Mar 2024 15:00:31 +0000 Subject: [PATCH 05/11] hide jippi-fork --- .github/workflows/docker.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 0f62ad3bc..8fdea53a1 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -10,7 +10,6 @@ on: branches: - dev - staging - - jippi-fork tags: - "*" From cc8c5ccd37c5ef0802846b348115e0df5c3ebd79 Mon Sep 17 00:00:00 2001 From: Christian Winther Date: Sun, 10 Mar 2024 15:11:54 +0000 Subject: [PATCH 06/11] docker: include convenience script reference --- docker/check-requirements | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docker/check-requirements b/docker/check-requirements index ad8d0ede4..2a7c2a478 100755 --- a/docker/check-requirements +++ b/docker/check-requirements @@ -67,11 +67,18 @@ DOCKER_HELP=" \tWe recommend installing Docker (and Compose) directly from Docker.com instead of your Operation System package registry. \tPlease see $(highlight "https://docs.docker.com/engine/install/")${RED} for information on how to install Docker on your system. +\tA convinience script is provided by Docker to automate the installation that should work on all supported platforms: + +\t\t ${GREEN}\$${BLUE} curl -fsSL https://get.docker.com -o get-docker.sh +\t\t ${GREEN}\$${BLUE} sudo sh ./get-docker.sh +${RED} +\tPlease see $(highlight "https://docs.docker.com/engine/install/ubuntu/#install-using-the-convenience-script")${RED} for more information + \tAlternatively, you can update *JUST* the Compose plugin by following the guide here: -\t$(highlight "https://docs.docker.com/compose/install/linux/#install-the-plugin-manually")${RED}. +\t$(highlight "https://docs.docker.com/compose/install/linux/#install-the-plugin-manually")${RED} \tLearn more about Docker compose release history here: -\t$(highlight "https://docs.docker.com/compose/release-notes/")${RED}.${NO_COLOR}" +\t$(highlight "https://docs.docker.com/compose/release-notes/")${RED}${NO_COLOR}" declare -r DOCKER_HELP # From 4942f7fbd4c24ef96c13c22ab966ead8d7ae322d Mon Sep 17 00:00:00 2001 From: Christian Winther Date: Sun, 10 Mar 2024 15:13:45 +0000 Subject: [PATCH 07/11] docker: docs --- docker/check-requirements | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/docker/check-requirements b/docker/check-requirements index 2a7c2a478..6f283711f 100755 --- a/docker/check-requirements +++ b/docker/check-requirements @@ -91,29 +91,46 @@ echo -e "This script will check your system for the minimum requirements outline echo -e "You can find the guide here ${BLUE}https://jippi.github.io/pixelfed-docs-next/pr-preview/pr-1/running-pixelfed/docker/prerequisites.html#software${GREEN}." echo -e "${NO_COLOR}" +# git installed? action_start "Checking if [$(highlight "git")] command is available" -command -v git >/dev/null 2>&1 || { action_error_exit "I require the 'git' command, but it's not installed"; } +command -v git >/dev/null 2>&1 || { + action_error_exit "I require the 'git' command, but it's not installed" +} action_ok "git is installed" +# docker installed? action_start "Checking if [$(highlight "docker")] command is available" -command -v docker >/dev/null 2>&1 || { action_error_exit "I require the 'docker' command, but it's not installed. ${DOCKER_HELP}"; } +command -v docker >/dev/null 2>&1 || { + action_error_exit "I require the 'docker' command, but it's not installed. ${DOCKER_HELP}" +} action_ok "docker is installed" +# docker compose installed? action_start "Checking if [$(highlight "docker compose")] command is available" -docker compose >/dev/null 2>&1 || { action_error_exit "I require the 'docker compose' command, but it's not installed. ${DOCKER_HELP}"; } +docker compose >/dev/null 2>&1 || { + action_error_exit "I require the 'docker compose' command, but it's not installed. ${DOCKER_HELP}" +} action_ok "docker compose is installed" +# docker compose version is acceptable? compose_version=$(docker compose version --short) declare -a compose_version_arr IFS="." read -r -a compose_version_arr <<<"$compose_version" +## major version action_start "Checking if [$(highlight "docker compose version")] major version (${min_docker_compose_version_arr[0]}) is acceptable" -[[ ${compose_version_arr[0]} -eq ${min_docker_compose_version_arr[0]} ]] || { action_error_exit "I require minimum Docker Compose major version ${min_docker_compose_version_arr[0]}.x.x - found ${compose_version}.${DOCKER_HELP}"; } +[[ ${compose_version_arr[0]} -eq ${min_docker_compose_version_arr[0]} ]] || { + action_error_exit "I require minimum Docker Compose major version ${min_docker_compose_version_arr[0]}.x.x - found ${compose_version}.${DOCKER_HELP}" +} action_ok "You're using major version ${compose_version_arr[0]}" +## minor version action_start "Checking if [$(highlight "docker compose version")] minor version (${min_docker_compose_version_arr[1]}) is acceptable" -[[ ${compose_version_arr[1]} -ge ${min_docker_compose_version_arr[1]} ]] || { action_error_exit "I require minimum Docker Compose minor version ${min_docker_compose_version_arr[0]}.${min_docker_compose_version_arr[1]} - found ${compose_version}.${DOCKER_HELP}"; } +[[ ${compose_version_arr[1]} -ge ${min_docker_compose_version_arr[1]} ]] || { + action_error_exit "I require minimum Docker Compose minor version ${min_docker_compose_version_arr[0]}.${min_docker_compose_version_arr[1]} - found ${compose_version}.${DOCKER_HELP}" +} action_ok "You're using minor version ${compose_version_arr[1]}" +# Yay, everything is fine echo -e "🎉 ${GREEN}All checks passed, you should be ready to run Pixelfed on this server!${NO_COLOR}" From 3a1f4789e6e40d93ff8dd9af8b7e8b98c1b87e96 Mon Sep 17 00:00:00 2001 From: Christian Winther Date: Sun, 10 Mar 2024 15:15:08 +0000 Subject: [PATCH 08/11] docker: I => Pixelfed --- docker/check-requirements | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docker/check-requirements b/docker/check-requirements index 6f283711f..250a25c59 100755 --- a/docker/check-requirements +++ b/docker/check-requirements @@ -94,21 +94,21 @@ echo -e "${NO_COLOR}" # git installed? action_start "Checking if [$(highlight "git")] command is available" command -v git >/dev/null 2>&1 || { - action_error_exit "I require the 'git' command, but it's not installed" + action_error_exit "Pixelfed require the 'git' command, but it's not installed" } action_ok "git is installed" # docker installed? action_start "Checking if [$(highlight "docker")] command is available" command -v docker >/dev/null 2>&1 || { - action_error_exit "I require the 'docker' command, but it's not installed. ${DOCKER_HELP}" + action_error_exit "Pixelfed require the 'docker' command, but it's not installed. ${DOCKER_HELP}" } action_ok "docker is installed" # docker compose installed? action_start "Checking if [$(highlight "docker compose")] command is available" docker compose >/dev/null 2>&1 || { - action_error_exit "I require the 'docker compose' command, but it's not installed. ${DOCKER_HELP}" + action_error_exit "Pixelfed require the 'docker compose' command, but it's not installed. ${DOCKER_HELP}" } action_ok "docker compose is installed" @@ -121,14 +121,14 @@ IFS="." read -r -a compose_version_arr <<<"$compose_version" ## major version action_start "Checking if [$(highlight "docker compose version")] major version (${min_docker_compose_version_arr[0]}) is acceptable" [[ ${compose_version_arr[0]} -eq ${min_docker_compose_version_arr[0]} ]] || { - action_error_exit "I require minimum Docker Compose major version ${min_docker_compose_version_arr[0]}.x.x - found ${compose_version}.${DOCKER_HELP}" + action_error_exit "Pixelfed require minimum Docker Compose major version ${min_docker_compose_version_arr[0]}.x.x - found ${compose_version}.${DOCKER_HELP}" } action_ok "You're using major version ${compose_version_arr[0]}" ## minor version action_start "Checking if [$(highlight "docker compose version")] minor version (${min_docker_compose_version_arr[1]}) is acceptable" [[ ${compose_version_arr[1]} -ge ${min_docker_compose_version_arr[1]} ]] || { - action_error_exit "I require minimum Docker Compose minor version ${min_docker_compose_version_arr[0]}.${min_docker_compose_version_arr[1]} - found ${compose_version}.${DOCKER_HELP}" + action_error_exit "Pixelfed require minimum Docker Compose minor version ${min_docker_compose_version_arr[0]}.${min_docker_compose_version_arr[1]} - found ${compose_version}.${DOCKER_HELP}" } action_ok "You're using minor version ${compose_version_arr[1]}" From ad382f8f5596f1a1e50cb1acf99b457db13e67f9 Mon Sep 17 00:00:00 2001 From: Christian Winther Date: Sun, 10 Mar 2024 15:16:25 +0000 Subject: [PATCH 09/11] docker: cleanup script --- docker/check-requirements | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/docker/check-requirements b/docker/check-requirements index 250a25c59..4da1d6427 100755 --- a/docker/check-requirements +++ b/docker/check-requirements @@ -8,7 +8,6 @@ set -e -o errexit -o nounset -o pipefail declare -r RED="\e[31m" declare -r GREEN="\e[32m" -declare -r YELLOW="\e[33m" declare -r BLUE="\e[34m" declare -r NO_COLOR="\e[0m" @@ -25,19 +24,10 @@ function action_start() { echo -en "⚙️ $1: " } -function action_start_newline() { - action_start "$1" - echo -} - function action_ok() { echo -e "\n\t✅ ${GREEN}${*}${NO_COLOR}\n" } -function action_warn() { - echo -e "⚠️ ${YELLOW}${*}${NO_COLOR}" -} - function action_error() { echo -e "\n\t❌ ${RED}${*}${NO_COLOR}" >&2 } From 1eadff9d2ec97a4af80a9ef807e29636a3df5a11 Mon Sep 17 00:00:00 2001 From: Emelia Smith Date: Sun, 17 Mar 2024 21:43:16 +0100 Subject: [PATCH 10/11] Adjust CORS configuration to support API & OAuth Routes Fixes #4411 and #3381 --- app/Http/Kernel.php | 4 ++-- config/cors.php | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 5cc99014b..df39ef60b 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -14,12 +14,12 @@ class Kernel extends HttpKernel * @var array */ protected $middleware = [ + \Illuminate\Http\Middleware\HandleCors::class, \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, + \App\Http\Middleware\TrustProxies::class, \App\Http\Middleware\TrimStrings::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, - \App\Http\Middleware\TrustProxies::class, - \Illuminate\Http\Middleware\HandleCors::class, ]; /** diff --git a/config/cors.php b/config/cors.php index 92b4b8e8c..1e81a015c 100644 --- a/config/cors.php +++ b/config/cors.php @@ -22,7 +22,9 @@ return [ * Example: ['api/*'] */ 'paths' => [ - '.well-known/*' + '.well-known/*', + 'api/*', + 'oauth/*' ], /* @@ -48,7 +50,8 @@ return [ /* * Sets the Access-Control-Expose-Headers response header with these headers. */ - 'exposed_headers' => [], + // TODO: Add support for rate-limit related headers + 'exposed_headers' => ['Link'], /* * Sets the Access-Control-Max-Age response header when > 0. @@ -59,4 +62,4 @@ return [ * Sets the Access-Control-Allow-Credentials header. */ 'supports_credentials' => false, -]; \ No newline at end of file +]; From 8c6936409d1400a8b4000ff9b8875636353c2731 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 5 Apr 2024 22:38:13 -0600 Subject: [PATCH 11/11] Update relationships view, fix unfollow hashtag bug. Fixes #5008 --- .../settings/relationships/home.blade.php | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/resources/views/settings/relationships/home.blade.php b/resources/views/settings/relationships/home.blade.php index b246de49c..fcde2b43e 100644 --- a/resources/views/settings/relationships/home.blade.php +++ b/resources/views/settings/relationships/home.blade.php @@ -6,18 +6,14 @@

Relationships


- -
+ + @if(empty($data))

You are not {{$mode == 'hashtags' ? 'following any hashtags.' : ($mode == 'following' ? 'following anyone.' : 'followed by anyone.')}}

@else @@ -149,9 +145,7 @@ break; case 'unfollowhashtag': - axios.post('/api/local/discover/tag/subscribe', { - name: id - }).then(res => { + axios.post('/api/v1/tags/' + id + '/unfollow').then(res => { swal( 'Unfollow Successful', 'You have successfully unfollowed that hashtag',