mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-28 17:23:17 +00:00
commit
6be21891d5
4 changed files with 169 additions and 90 deletions
78
.env.example
Normal file
78
.env.example
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
APP_NAME="Pixelfed"
|
||||||
|
APP_ENV="production"
|
||||||
|
APP_KEY=
|
||||||
|
APP_DEBUG="false"
|
||||||
|
|
||||||
|
# Instance Configuration
|
||||||
|
OPEN_REGISTRATION="false"
|
||||||
|
ENFORCE_EMAIL_VERIFICATION="false"
|
||||||
|
PF_MAX_USERS="1000"
|
||||||
|
OAUTH_ENABLED="true"
|
||||||
|
|
||||||
|
# Media Configuration
|
||||||
|
PF_OPTIMIZE_IMAGES="true"
|
||||||
|
IMAGE_QUALITY="80"
|
||||||
|
MAX_PHOTO_SIZE="15000"
|
||||||
|
MAX_CAPTION_LENGTH="500"
|
||||||
|
MAX_ALBUM_LENGTH="4"
|
||||||
|
|
||||||
|
# Instance URL Configuration
|
||||||
|
APP_URL="http://localhost"
|
||||||
|
APP_DOMAIN="localhost"
|
||||||
|
ADMIN_DOMAIN="localhost"
|
||||||
|
SESSION_DOMAIN="localhost"
|
||||||
|
TRUST_PROXIES="*"
|
||||||
|
|
||||||
|
# Database Configuration
|
||||||
|
DB_CONNECTION="mysql"
|
||||||
|
DB_HOST="127.0.0.1"
|
||||||
|
DB_PORT="3306"
|
||||||
|
DB_DATABASE="pixelfed"
|
||||||
|
DB_USERNAME="pixelfed"
|
||||||
|
DB_PASSWORD="pixelfed"
|
||||||
|
|
||||||
|
# Redis Configuration
|
||||||
|
REDIS_CLIENT="predis"
|
||||||
|
REDIS_SCHEME="tcp"
|
||||||
|
REDIS_HOST="127.0.0.1"
|
||||||
|
REDIS_PASSWORD="null"
|
||||||
|
REDIS_PORT="6379"
|
||||||
|
|
||||||
|
# Laravel Configuration
|
||||||
|
SESSION_DRIVER="database"
|
||||||
|
CACHE_DRIVER="redis"
|
||||||
|
QUEUE_DRIVER="redis"
|
||||||
|
BROADCAST_DRIVER="log"
|
||||||
|
LOG_CHANNEL="stack"
|
||||||
|
HORIZON_PREFIX="horizon-"
|
||||||
|
|
||||||
|
# ActivityPub Configuration
|
||||||
|
ACTIVITY_PUB="false"
|
||||||
|
AP_REMOTE_FOLLOW="false"
|
||||||
|
AP_INBOX="false"
|
||||||
|
AP_OUTBOX="false"
|
||||||
|
AP_SHAREDINBOX="false"
|
||||||
|
|
||||||
|
# Experimental Configuration
|
||||||
|
EXP_EMC="true"
|
||||||
|
|
||||||
|
## Mail Configuration (Post-Installer)
|
||||||
|
MAIL_DRIVER=log
|
||||||
|
MAIL_HOST=smtp.mailtrap.io
|
||||||
|
MAIL_PORT=2525
|
||||||
|
MAIL_USERNAME=null
|
||||||
|
MAIL_PASSWORD=null
|
||||||
|
MAIL_ENCRYPTION=null
|
||||||
|
MAIL_FROM_ADDRESS="pixelfed@example.com"
|
||||||
|
MAIL_FROM_NAME="Pixelfed"
|
||||||
|
|
||||||
|
## S3 Configuration (Post-Installer)
|
||||||
|
PF_ENABLE_CLOUD=false
|
||||||
|
FILESYSTEM_CLOUD=s3
|
||||||
|
#AWS_ACCESS_KEY_ID=
|
||||||
|
#AWS_SECRET_ACCESS_KEY=
|
||||||
|
#AWS_DEFAULT_REGION=
|
||||||
|
#AWS_BUCKET=<BucketName>
|
||||||
|
#AWS_URL=
|
||||||
|
#AWS_ENDPOINT=
|
||||||
|
#AWS_USE_PATH_STYLE_ENDPOINT=false
|
|
@ -237,7 +237,7 @@ USER ${RUNTIME_UID}:${RUNTIME_GID}
|
||||||
|
|
||||||
# Generate optimized autoloader now that we have all files around
|
# Generate optimized autoloader now that we have all files around
|
||||||
RUN set -ex \
|
RUN set -ex \
|
||||||
&& composer dump-autoload --optimize
|
&& ENABLE_CONFIG_CACHE=false composer dump-autoload --optimize
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
|
|
|
@ -4,26 +4,25 @@ namespace App\Jobs\FollowPipeline;
|
||||||
|
|
||||||
use App\Follower;
|
use App\Follower;
|
||||||
use App\FollowRequest;
|
use App\FollowRequest;
|
||||||
|
use App\Jobs\HomeFeedPipeline\FeedUnfollowPipeline;
|
||||||
use App\Notification;
|
use App\Notification;
|
||||||
use App\Profile;
|
use App\Profile;
|
||||||
|
use App\Services\AccountService;
|
||||||
|
use App\Services\FollowerService;
|
||||||
|
use App\Services\NotificationService;
|
||||||
use Cache;
|
use Cache;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Log;
|
|
||||||
use Illuminate\Support\Facades\Redis;
|
|
||||||
use App\Services\AccountService;
|
|
||||||
use App\Services\FollowerService;
|
|
||||||
use App\Services\NotificationService;
|
|
||||||
use App\Jobs\HomeFeedPipeline\FeedUnfollowPipeline;
|
|
||||||
|
|
||||||
class UnfollowPipeline implements ShouldQueue
|
class UnfollowPipeline implements ShouldQueue
|
||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
protected $actor;
|
protected $actor;
|
||||||
|
|
||||||
protected $target;
|
protected $target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,11 +47,11 @@ class UnfollowPipeline implements ShouldQueue
|
||||||
$target = $this->target;
|
$target = $this->target;
|
||||||
|
|
||||||
$actorProfile = Profile::find($actor);
|
$actorProfile = Profile::find($actor);
|
||||||
if(!$actorProfile) {
|
if (! $actorProfile) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$targetProfile = Profile::find($target);
|
$targetProfile = Profile::find($target);
|
||||||
if(!$targetProfile) {
|
if (! $targetProfile) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,37 +59,37 @@ class UnfollowPipeline implements ShouldQueue
|
||||||
|
|
||||||
FollowerService::remove($actor, $target);
|
FollowerService::remove($actor, $target);
|
||||||
|
|
||||||
$actorProfileSync = Cache::get(FollowerService::FOLLOWING_SYNC_KEY . $actor);
|
$actorProfileSync = Cache::get(FollowerService::FOLLOWING_SYNC_KEY.$actor);
|
||||||
if(!$actorProfileSync) {
|
if (! $actorProfileSync) {
|
||||||
FollowServiceWarmCache::dispatch($actor)->onQueue('low');
|
FollowServiceWarmCache::dispatch($actor)->onQueue('low');
|
||||||
} else {
|
} else {
|
||||||
if($actorProfile->following_count) {
|
if ($actorProfile->following_count) {
|
||||||
$actorProfile->decrement('following_count');
|
$actorProfile->decrement('following_count');
|
||||||
} else {
|
} else {
|
||||||
$count = Follower::whereProfileId($actor)->count();
|
$count = Follower::whereProfileId($actor)->count();
|
||||||
$actorProfile->following_count = $count;
|
$actorProfile->following_count = $count;
|
||||||
$actorProfile->save();
|
$actorProfile->save();
|
||||||
}
|
}
|
||||||
Cache::put(FollowerService::FOLLOWING_SYNC_KEY . $actor, 1, 604800);
|
Cache::put(FollowerService::FOLLOWING_SYNC_KEY.$actor, 1, 604800);
|
||||||
AccountService::del($actor);
|
AccountService::del($actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
$targetProfileSync = Cache::get(FollowerService::FOLLOWERS_SYNC_KEY . $target);
|
$targetProfileSync = Cache::get(FollowerService::FOLLOWERS_SYNC_KEY.$target);
|
||||||
if(!$targetProfileSync) {
|
if (! $targetProfileSync) {
|
||||||
FollowServiceWarmCache::dispatch($target)->onQueue('low');
|
FollowServiceWarmCache::dispatch($target)->onQueue('low');
|
||||||
} else {
|
} else {
|
||||||
if($targetProfile->followers_count) {
|
if ($targetProfile->followers_count) {
|
||||||
$targetProfile->decrement('followers_count');
|
$targetProfile->decrement('followers_count');
|
||||||
} else {
|
} else {
|
||||||
$count = Follower::whereFollowingId($target)->count();
|
$count = Follower::whereFollowingId($target)->count();
|
||||||
$targetProfile->followers_count = $count;
|
$targetProfile->followers_count = $count;
|
||||||
$targetProfile->save();
|
$targetProfile->save();
|
||||||
}
|
}
|
||||||
Cache::put(FollowerService::FOLLOWERS_SYNC_KEY . $target, 1, 604800);
|
Cache::put(FollowerService::FOLLOWERS_SYNC_KEY.$target, 1, 604800);
|
||||||
AccountService::del($target);
|
AccountService::del($target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($targetProfile->domain == null) {
|
if ($targetProfile->domain == null) {
|
||||||
Notification::withTrashed()
|
Notification::withTrashed()
|
||||||
->whereProfileId($target)
|
->whereProfileId($target)
|
||||||
->whereAction('follow')
|
->whereAction('follow')
|
||||||
|
@ -98,20 +97,22 @@ class UnfollowPipeline implements ShouldQueue
|
||||||
->whereItemId($target)
|
->whereItemId($target)
|
||||||
->whereItemType('App\Profile')
|
->whereItemType('App\Profile')
|
||||||
->get()
|
->get()
|
||||||
->each(function($n) {
|
->each(function ($n) {
|
||||||
NotificationService::del($n->profile_id, $n->id);
|
NotificationService::del($n->profile_id, $n->id);
|
||||||
$n->forceDelete();
|
$n->forceDelete();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if($actorProfile->domain == null && config('instance.timeline.home.cached')) {
|
if ($actorProfile->domain == null && config('instance.timeline.home.cached')) {
|
||||||
Cache::forget('pf:timelines:home:' . $actor);
|
Cache::forget('pf:timelines:home:'.$actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
FollowRequest::whereFollowingId($target)
|
FollowRequest::whereFollowingId($target)
|
||||||
->whereFollowerId($actor)
|
->whereFollowerId($actor)
|
||||||
->delete();
|
->delete();
|
||||||
|
|
||||||
return;
|
AccountService::del($target);
|
||||||
|
AccountService::del($actor);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -467,14 +467,14 @@ function await-database-ready()
|
||||||
case "${DB_CONNECTION:-}" in
|
case "${DB_CONNECTION:-}" in
|
||||||
mysql)
|
mysql)
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
while ! echo "SELECT 1" | mysql --user="${DB_USERNAME}" --password="${DB_PASSWORD}" --host="${DB_HOST}" "${DB_DATABASE}" --silent >/dev/null; do
|
while ! echo "SELECT 1" | mysql --user="${DB_USERNAME}" --password="${DB_PASSWORD}" --host="${DB_HOST}" --port="${DOCKER_DB_HOST_PORT}" "${DB_DATABASE}" --silent >/dev/null; do
|
||||||
staggered-sleep
|
staggered-sleep
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
pgsql)
|
pgsql)
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
while ! echo "SELECT 1" | PGPASSWORD="${DB_PASSWORD}" psql --user="${DB_USERNAME}" --host="${DB_HOST}" "${DB_DATABASE}" >/dev/null; do
|
while ! echo "SELECT 1" | PGPASSWORD="${DB_PASSWORD}" psql --user="${DB_USERNAME}" --host="${DB_HOST}" --port="${DOCKER_DB_HOST_PORT}" "${DB_DATABASE}" >/dev/null; do
|
||||||
staggered-sleep
|
staggered-sleep
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue