mirror of
https://github.com/YunoHost-Apps/pixelfed_ynh.git
synced 2024-09-03 20:06:04 +02:00
commit
092c3ecaca
13 changed files with 87 additions and 14 deletions
7
.ddev/commands/redis/redis-cli
Executable file
7
.ddev/commands/redis/redis-cli
Executable file
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#ddev-generated
|
||||||
|
## Description: Run redis-cli inside the redis container
|
||||||
|
## Usage: redis-cli [flags] [args]
|
||||||
|
## Example: "redis-cli KEYS *" or "ddev redis-cli INFO" or "ddev redis-cli --version"
|
||||||
|
|
||||||
|
redis-cli -p 6379 -h redis $@
|
32
.ddev/config.yaml
Normal file
32
.ddev/config.yaml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
type: laravel
|
||||||
|
docroot: public
|
||||||
|
php_version: "8.1"
|
||||||
|
webserver_type: nginx-fpm
|
||||||
|
database:
|
||||||
|
type: mariadb
|
||||||
|
version: "10.4"
|
||||||
|
disable_settings_management: true
|
||||||
|
web_environment:
|
||||||
|
- DB_CONNECTION=mysql
|
||||||
|
- DB_HOST=ddev-pixelfed-db
|
||||||
|
- DB_DATABASE=db
|
||||||
|
- DB_USERNAME=db
|
||||||
|
- DB_PASSWORD=db
|
||||||
|
- REDIS_HOST=ddev-pixelfed-redis
|
||||||
|
- MAIL_DRIVER=smtp
|
||||||
|
- MAIL_HOST=localhost
|
||||||
|
- MAIL_PORT=1025
|
||||||
|
- MAIL_USERNAME=null
|
||||||
|
- MAIL_PASSWORD=null
|
||||||
|
- MAIL_ENCRYPTION=null
|
||||||
|
- APP_KEY=placeholder
|
||||||
|
- APP_NAME=PixelfedTest
|
||||||
|
- APP_ENV=local
|
||||||
|
- APP_KEY=base64:lwX95GbNWX3XsucdMe0XwtOKECta3h/B+p9NbH2jd0E=
|
||||||
|
- APP_DEBUG=true
|
||||||
|
- APP_URL=https://pixelfed.ddev.site
|
||||||
|
- APP_DOMAIN=pixelfed.ddev.site
|
||||||
|
- ADMIN_DOMAIN=pixelfed.ddev.site
|
||||||
|
- SESSION_DOMAIN=pixelfed.ddev.site
|
||||||
|
- "TRUST_PROXIES=*"
|
||||||
|
- LOG_CHANNEL=stack
|
14
.ddev/docker-compose.redis.yaml
Normal file
14
.ddev/docker-compose.redis.yaml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#ddev-generated
|
||||||
|
version: '3.6'
|
||||||
|
services:
|
||||||
|
redis:
|
||||||
|
container_name: ddev-${DDEV_SITENAME}-redis
|
||||||
|
image: redis:6
|
||||||
|
# These labels ensure this service is discoverable by ddev.
|
||||||
|
labels:
|
||||||
|
com.ddev.site-name: ${DDEV_SITENAME}
|
||||||
|
com.ddev.approot: $DDEV_APPROOT
|
||||||
|
volumes:
|
||||||
|
- ".:/mnt/ddev_config"
|
||||||
|
- "./redis:/usr/local/etc/redis"
|
||||||
|
command: ["redis-server", "/usr/local/etc/redis/redis.conf"]
|
8
.ddev/redis/redis.conf
Normal file
8
.ddev/redis/redis.conf
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Redis configuration.
|
||||||
|
# #ddev-generated
|
||||||
|
# Example configuration files for reference:
|
||||||
|
# http://download.redis.io/redis-stable/redis.conf
|
||||||
|
# http://download.redis.io/redis-stable/sentinel.conf
|
||||||
|
|
||||||
|
maxmemory 2048mb
|
||||||
|
maxmemory-policy allkeys-lfu
|
|
@ -64,6 +64,7 @@
|
||||||
- Update StatusReplyPipeline, remove expensive reply count re-calculation query ([a2f8aad1](https://github.com/pixelfed/pixelfed/commit/a2f8aad1))
|
- Update StatusReplyPipeline, remove expensive reply count re-calculation query ([a2f8aad1](https://github.com/pixelfed/pixelfed/commit/a2f8aad1))
|
||||||
- Update CommentPipeline, remove expensive reply count re-calculation query ([b457a446](https://github.com/pixelfed/pixelfed/commit/b457a446))
|
- Update CommentPipeline, remove expensive reply count re-calculation query ([b457a446](https://github.com/pixelfed/pixelfed/commit/b457a446))
|
||||||
- Update FederationController, improve inbox/sharedInbox delete handling ([2180a2de](https://github.com/pixelfed/pixelfed/commit/2180a2de))
|
- Update FederationController, improve inbox/sharedInbox delete handling ([2180a2de](https://github.com/pixelfed/pixelfed/commit/2180a2de))
|
||||||
|
- Update HashtagController, improve trending hashtag endpoint ([4873c7dd](https://github.com/pixelfed/pixelfed/commit/4873c7dd))
|
||||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||||
|
|
||||||
## [v0.11.4 (2022-10-04)](https://github.com/pixelfed/pixelfed/compare/v0.11.3...v0.11.4)
|
## [v0.11.4 (2022-10-04)](https://github.com/pixelfed/pixelfed/compare/v0.11.3...v0.11.4)
|
||||||
|
|
|
@ -181,22 +181,32 @@ class DiscoverController extends Controller
|
||||||
{
|
{
|
||||||
abort_if(!$request->user(), 403);
|
abort_if(!$request->user(), 403);
|
||||||
|
|
||||||
$res = Cache::remember('api:discover:v1.1:trending:hashtags', 3600, function() {
|
$res = Cache::remember('api:discover:v1.1:trending:hashtags', 43200, function() {
|
||||||
|
$minId = StatusHashtag::where('created_at', '>', now()->subDays(14))->first();
|
||||||
|
if(!$minId) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
return StatusHashtag::select('hashtag_id', \DB::raw('count(*) as total'))
|
return StatusHashtag::select('hashtag_id', \DB::raw('count(*) as total'))
|
||||||
|
->where('id', '>', $minId->id)
|
||||||
->groupBy('hashtag_id')
|
->groupBy('hashtag_id')
|
||||||
->orderBy('total','desc')
|
->orderBy('total','desc')
|
||||||
->where('created_at', '>', now()->subDays(90))
|
->take(20)
|
||||||
->take(9)
|
|
||||||
->get()
|
->get()
|
||||||
->map(function($h) {
|
->map(function($h) {
|
||||||
$hashtag = $h->hashtag;
|
$hashtag = Hashtag::find($h->hashtag_id);
|
||||||
|
if(!$hashtag) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
return [
|
return [
|
||||||
'id' => $hashtag->id,
|
'id' => $h->hashtag_id,
|
||||||
'total' => $h->total,
|
'total' => $h->total,
|
||||||
'name' => '#'.$hashtag->name,
|
'name' => '#'.$hashtag->name,
|
||||||
|
'hashtag' => $hashtag->name,
|
||||||
'url' => $hashtag->url()
|
'url' => $hashtag->url()
|
||||||
];
|
];
|
||||||
});
|
})
|
||||||
|
->filter()
|
||||||
|
->values();
|
||||||
});
|
});
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ class FederationController extends Controller
|
||||||
'orderedItems' => []
|
'orderedItems' => []
|
||||||
];
|
];
|
||||||
|
|
||||||
return response(json_encode($res, JSON_UNESCAPED_SLASHES))->header('Content-Type', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"');
|
return response(json_encode($res, JSON_UNESCAPED_SLASHES))->header('Content-Type', 'application/activity+json');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function userInbox(Request $request, $username)
|
public function userInbox(Request $request, $username)
|
||||||
|
|
|
@ -14,7 +14,7 @@ class InstanceActorController extends Controller
|
||||||
$res = (new InstanceActor())->first()->getActor();
|
$res = (new InstanceActor())->first()->getActor();
|
||||||
return json_encode($res, JSON_UNESCAPED_SLASHES);
|
return json_encode($res, JSON_UNESCAPED_SLASHES);
|
||||||
});
|
});
|
||||||
return response($res)->header('Content-Type', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"');
|
return response($res)->header('Content-Type', 'application/activity+json');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function inbox()
|
public function inbox()
|
||||||
|
@ -32,6 +32,6 @@ class InstanceActorController extends Controller
|
||||||
'first' => config('app.url') . '/i/actor/outbox?page=true',
|
'first' => config('app.url') . '/i/actor/outbox?page=true',
|
||||||
'last' => config('app.url') . '/i/actor/outbox?min_id=0page=true'
|
'last' => config('app.url') . '/i/actor/outbox?min_id=0page=true'
|
||||||
], JSON_UNESCAPED_SLASHES);
|
], JSON_UNESCAPED_SLASHES);
|
||||||
return response($res)->header('Content-Type', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"');
|
return response($res)->header('Content-Type', 'application/activity+json');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ class ProfileController extends Controller
|
||||||
$fractal = new Fractal\Manager();
|
$fractal = new Fractal\Manager();
|
||||||
$resource = new Fractal\Resource\Item($user, new ProfileTransformer);
|
$resource = new Fractal\Resource\Item($user, new ProfileTransformer);
|
||||||
$res = $fractal->createData($resource)->toArray();
|
$res = $fractal->createData($resource)->toArray();
|
||||||
return response(json_encode($res['data']))->header('Content-Type', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"');
|
return response(json_encode($res['data']))->header('Content-Type', 'application/activity+json');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,7 @@ class StatusController extends Controller
|
||||||
$resource = new Fractal\Resource\Item($status, $object);
|
$resource = new Fractal\Resource\Item($status, $object);
|
||||||
$res = $fractal->createData($resource)->toArray();
|
$res = $fractal->createData($resource)->toArray();
|
||||||
|
|
||||||
return response()->json($res['data'], 200, ['Content-Type' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'], JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
return response()->json($res['data'], 200, ['Content-Type' => 'application/activity+json'], JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit(Request $request, $username, $id)
|
public function edit(Request $request, $username, $id)
|
||||||
|
|
|
@ -17,7 +17,7 @@ class ActivityPubFetchService
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = HttpSignature::instanceActorSign($url, false);
|
$headers = HttpSignature::instanceActorSign($url, false);
|
||||||
$headers['Accept'] = 'application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"';
|
$headers['Accept'] = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"';
|
||||||
$headers['User-Agent'] = '(Pixelfed/'.config('pixelfed.version').'; +'.config('app.url').')';
|
$headers['User-Agent'] = '(Pixelfed/'.config('pixelfed.version').'; +'.config('app.url').')';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -48,9 +48,11 @@ class WebfingerService
|
||||||
$link = collect($webfinger['links'])
|
$link = collect($webfinger['links'])
|
||||||
->filter(function($link) {
|
->filter(function($link) {
|
||||||
return $link &&
|
return $link &&
|
||||||
|
isset($link['rel']) &&
|
||||||
isset($link['type']) &&
|
isset($link['type']) &&
|
||||||
isset($link['href']) &&
|
isset($link['href']) &&
|
||||||
$link['type'] == 'application/activity+json';
|
$link['rel'] == 'self' &&
|
||||||
|
$link['type'] == 'application/activity+json' || $link['type'] == 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"';
|
||||||
})
|
})
|
||||||
->pluck('href')
|
->pluck('href')
|
||||||
->first();
|
->first();
|
||||||
|
|
|
@ -132,7 +132,6 @@ class HttpSignature {
|
||||||
'(request-target)' => 'post '.parse_url($url, PHP_URL_PATH),
|
'(request-target)' => 'post '.parse_url($url, PHP_URL_PATH),
|
||||||
'Date' => $date->format('D, d M Y H:i:s \G\M\T'),
|
'Date' => $date->format('D, d M Y H:i:s \G\M\T'),
|
||||||
'Host' => parse_url($url, PHP_URL_HOST),
|
'Host' => parse_url($url, PHP_URL_HOST),
|
||||||
'Accept' => 'application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if($digest) {
|
if($digest) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue