Merge pull request #5031 from pixelfed/staging

Staging
This commit is contained in:
daniel 2024-04-06 00:49:02 -06:00 committed by GitHub
commit 142db2c41e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 154 additions and 23 deletions

View file

@ -1202,6 +1202,14 @@ DOCKER_DB_HOST_PORT="${DB_PORT:?error}"
# @dottie/validate required,number # @dottie/validate required,number
DOCKER_DB_CONTAINER_PORT="${DB_PORT:?error}" 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 # How often Docker health check should run for [db] service
# @dottie/validate required # @dottie/validate required
DOCKER_DB_HEALTHCHECK_INTERVAL="${DOCKER_ALL_DEFAULT_HEALTHCHECK_INTERVAL:?error}" DOCKER_DB_HEALTHCHECK_INTERVAL="${DOCKER_ALL_DEFAULT_HEALTHCHECK_INTERVAL:?error}"

View file

@ -14,12 +14,12 @@ class Kernel extends HttpKernel
* @var array * @var array
*/ */
protected $middleware = [ protected $middleware = [
\Illuminate\Http\Middleware\HandleCors::class,
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class, \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrustProxies::class,
\App\Http\Middleware\TrimStrings::class, \App\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\TrustProxies::class,
\Illuminate\Http\Middleware\HandleCors::class,
]; ];
/** /**

View file

@ -22,7 +22,9 @@ return [
* Example: ['api/*'] * Example: ['api/*']
*/ */
'paths' => [ 'paths' => [
'.well-known/*' '.well-known/*',
'api/*',
'oauth/*'
], ],
/* /*
@ -48,7 +50,8 @@ return [
/* /*
* Sets the Access-Control-Expose-Headers response header with these headers. * 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. * Sets the Access-Control-Max-Age response header when > 0.

View file

@ -3,7 +3,7 @@ version: "3"
services: services:
migrate: migrate:
image: "secoresearch/rsync" image: "servercontainers/rsync"
entrypoint: "" entrypoint: ""
working_dir: /migrate working_dir: /migrate
command: 'bash -c "exit 1"' command: 'bash -c "exit 1"'

View file

@ -166,12 +166,12 @@ services:
environment: environment:
TZ: "${TZ:?error}" TZ: "${TZ:?error}"
# MySQL (Oracle) - "Environment Variables" at https://hub.docker.com/_/mysql # 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_USER: "${DB_USERNAME:?error}"
MYSQL_PASSWORD: "${DB_PASSWORD:?error}" MYSQL_PASSWORD: "${DB_PASSWORD:?error}"
MYSQL_DATABASE: "${DB_DATABASE:?error}" MYSQL_DATABASE: "${DB_DATABASE:?error}"
# MySQL (MariaDB) - "Start a mariadb server instance with user, password and database" at https://hub.docker.com/_/mariadb # 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_USER: "${DB_USERNAME:?error}"
MARIADB_PASSWORD: "${DB_PASSWORD:?error}" MARIADB_PASSWORD: "${DB_PASSWORD:?error}"
MARIADB_DATABASE: "${DB_DATABASE:?error}" MARIADB_DATABASE: "${DB_DATABASE:?error}"

126
docker/check-requirements Executable file
View file

@ -0,0 +1,126 @@
#!/bin/bash
set -e -o errexit -o nounset -o pipefail
#
# Colors
#
declare -r RED="\e[31m"
declare -r GREEN="\e[32m"
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_ok() {
echo -e "\n\t✅ ${GREEN}${*}${NO_COLOR}\n"
}
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.
\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}
\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}"
# git installed?
action_start "Checking if [$(highlight "git")] command is available"
command -v git >/dev/null 2>&1 || {
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 "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 "Pixelfed 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 "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 "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]}"
# Yay, everything is fine
echo -e "🎉 ${GREEN}All checks passed, you should be ready to run Pixelfed on this server!${NO_COLOR}"

View file

@ -6,18 +6,14 @@
<h3 class="font-weight-bold">Relationships</h3> <h3 class="font-weight-bold">Relationships</h3>
</div> </div>
<hr> <hr>
<ul class="nav nav-pills"> <div class="form-group pb-1">
<li class="nav-item"> <p>
<a class="nav-link font-weight-bold {{!request()->has('mode') || $mode == 'followers' ? 'active' : ''}}" href="?mode=followers&page=1">Followers</a> <a class="btn py-0 btn-link {{!request()->has('mode') || $mode == 'followers' ? 'font-weight-bold' : 'text-muted'}}" href="?mode=followers&page=1">Followers</a>
</li> <a class="btn btn-link py-0 {{$mode == 'following' ? 'font-weight-bold' : 'text-muted'}}" href="?mode=following&page=1">Following</a>
<li class="nav-item"> <a class="btn btn-link py-0 {{$mode == 'hashtags' ? 'font-weight-bold' : 'text-muted'}}" href="?mode=hashtags&page=1">Hashtags</a>
<a class="nav-link font-weight-bold {{$mode == 'following' ? 'active' : ''}}" href="?mode=following&page=1">Following</a> </p>
</li> </div>
<li class="nav-item">
<a class="nav-link font-weight-bold {{$mode == 'hashtags' ? 'active' : ''}}" href="?mode=hashtags&page=1">Hashtags</a>
</li>
</ul>
<hr>
@if(empty($data)) @if(empty($data))
<p class="text-center lead pt-5 mt-5">You are not {{$mode == 'hashtags' ? 'following any hashtags.' : ($mode == 'following' ? 'following anyone.' : 'followed by anyone.')}}</p> <p class="text-center lead pt-5 mt-5">You are not {{$mode == 'hashtags' ? 'following any hashtags.' : ($mode == 'following' ? 'following anyone.' : 'followed by anyone.')}}</p>
@else @else
@ -149,9 +145,7 @@
break; break;
case 'unfollowhashtag': case 'unfollowhashtag':
axios.post('/api/local/discover/tag/subscribe', { axios.post('/api/v1/tags/' + id + '/unfollow').then(res => {
name: id
}).then(res => {
swal( swal(
'Unfollow Successful', 'Unfollow Successful',
'You have successfully unfollowed that hashtag', 'You have successfully unfollowed that hashtag',