mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-27 15:33:17 +00:00
Merge pull request #1510 from pixelfed/frontend-ui-refactor
Remove OStatus legacy code
This commit is contained in:
commit
730997a2e6
4 changed files with 55 additions and 71 deletions
|
@ -34,47 +34,22 @@ class FederationController extends Controller
|
|||
abort_if(!Auth::check(), 403);
|
||||
}
|
||||
|
||||
// deprecated, remove in 0.10
|
||||
public function authorizeFollow(Request $request)
|
||||
{
|
||||
$this->authCheck();
|
||||
$this->validate($request, [
|
||||
'acct' => 'required|string|min:3|max:255',
|
||||
]);
|
||||
$acct = $request->input('acct');
|
||||
$nickname = Nickname::normalizeProfileUrl($acct);
|
||||
|
||||
return view('federation.authorizefollow', compact('acct', 'nickname'));
|
||||
abort(404);
|
||||
}
|
||||
|
||||
// deprecated, remove in 0.10
|
||||
public function remoteFollow()
|
||||
{
|
||||
$this->authCheck();
|
||||
|
||||
return view('federation.remotefollow');
|
||||
abort(404);
|
||||
}
|
||||
|
||||
// deprecated, remove in 0.10
|
||||
public function remoteFollowStore(Request $request)
|
||||
{
|
||||
return;
|
||||
|
||||
$this->authCheck();
|
||||
$this->validate($request, [
|
||||
'url' => 'required|string',
|
||||
]);
|
||||
|
||||
abort_if(!config('federation.activitypub.remoteFollow'), 403);
|
||||
|
||||
$follower = Auth::user()->profile;
|
||||
$url = $request->input('url');
|
||||
$url = Helpers::validateUrl($url);
|
||||
|
||||
if(!$url) {
|
||||
return;
|
||||
}
|
||||
|
||||
RemoteFollowPipeline::dispatch($follower, $url);
|
||||
|
||||
return response(['success' => true, 'follower' => $follower]);
|
||||
abort(404);
|
||||
}
|
||||
|
||||
public function nodeinfoWellKnown()
|
||||
|
@ -98,20 +73,20 @@ class FederationController extends Controller
|
|||
abort_if(!config('federation.nodeinfo.enabled'), 404);
|
||||
|
||||
$res = Cache::remember('api:nodeinfo', now()->addMinutes(15), function () {
|
||||
$activeHalfYear = Cache::remember('api:nodeinfo:ahy', now()->addHours(12), function() {
|
||||
$activeHalfYear = Cache::remember('api:nodeinfo:ahy', now()->addHours(6), function() {
|
||||
$count = collect([]);
|
||||
// $likes = Like::select('profile_id')->where('created_at', '>', now()->subMonths(6)->toDateTimeString())->groupBy('profile_id')->pluck('profile_id')->toArray();
|
||||
// $count = $count->merge($likes);
|
||||
$likes = Like::select('profile_id')->where('created_at', '>', now()->subMonths(6)->toDateTimeString())->groupBy('profile_id')->pluck('profile_id')->toArray();
|
||||
$count = $count->merge($likes);
|
||||
$statuses = Status::select('profile_id')->whereLocal(true)->where('created_at', '>', now()->subMonths(6)->toDateTimeString())->groupBy('profile_id')->pluck('profile_id')->toArray();
|
||||
$count = $count->merge($statuses);
|
||||
$profiles = Profile::select('id')->whereNull('domain')->where('created_at', '>', now()->subMonths(6)->toDateTimeString())->groupBy('id')->pluck('id')->toArray();
|
||||
$count = $count->merge($profiles);
|
||||
return $count->unique()->count();
|
||||
});
|
||||
$activeMonth = Cache::remember('api:nodeinfo:am', now()->addHours(12), function() {
|
||||
$activeMonth = Cache::remember('api:nodeinfo:am', now()->addHours(6), function() {
|
||||
$count = collect([]);
|
||||
// $likes = Like::select('profile_id')->where('created_at', '>', now()->subMonths(1)->toDateTimeString())->groupBy('profile_id')->pluck('profile_id')->toArray();
|
||||
// $count = $count->merge($likes);
|
||||
$likes = Like::select('profile_id')->where('created_at', '>', now()->subMonths(1)->toDateTimeString())->groupBy('profile_id')->pluck('profile_id')->toArray();
|
||||
$count = $count->merge($likes);
|
||||
$statuses = Status::select('profile_id')->whereLocal(true)->where('created_at', '>', now()->subMonths(1)->toDateTimeString())->groupBy('profile_id')->pluck('profile_id')->toArray();
|
||||
$count = $count->merge($statuses);
|
||||
$profiles = Profile::select('id')->whereNull('domain')->where('created_at', '>', now()->subMonths(1)->toDateTimeString())->groupBy('id')->pluck('id')->toArray();
|
||||
|
@ -162,10 +137,12 @@ class FederationController extends Controller
|
|||
$this->validate($request, ['resource'=>'required|string|min:3|max:255']);
|
||||
|
||||
$resource = $request->input('resource');
|
||||
$hash = hash('sha256', $resource);
|
||||
$parsed = Nickname::normalizeProfileUrl($resource);
|
||||
if($parsed['domain'] !== config('pixelfed.domain.app')) {
|
||||
abort(404);
|
||||
}
|
||||
$username = $parsed['username'];
|
||||
$profile = Profile::whereUsername($username)->firstOrFail();
|
||||
$profile = Profile::whereNull('domain')->whereUsername($username)->firstOrFail();
|
||||
if($profile->status != null) {
|
||||
return ProfileController::accountCheck($profile);
|
||||
}
|
||||
|
@ -315,19 +292,16 @@ class FederationController extends Controller
|
|||
->whereIsPrivate(false)
|
||||
->firstOrFail();
|
||||
|
||||
return [];
|
||||
|
||||
if($profile->status != null) {
|
||||
return [];
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$obj = [
|
||||
'@context' => 'https://www.w3.org/ns/activitystreams',
|
||||
'id' => $request->getUri(),
|
||||
'type' => 'OrderedCollectionPage',
|
||||
'totalItems' => $profile->following()->count(),
|
||||
'orderedItems' => $profile->following->map(function($f) {
|
||||
return $f->permalink();
|
||||
})
|
||||
'totalItems' => 0,
|
||||
'orderedItems' => []
|
||||
];
|
||||
return response()->json($obj);
|
||||
}
|
||||
|
@ -341,20 +315,18 @@ class FederationController extends Controller
|
|||
->whereIsPrivate(false)
|
||||
->firstOrFail();
|
||||
|
||||
return [];
|
||||
|
||||
if($profile->status != null) {
|
||||
return [];
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$obj = [
|
||||
'@context' => 'https://www.w3.org/ns/activitystreams',
|
||||
'id' => $request->getUri(),
|
||||
'type' => 'OrderedCollectionPage',
|
||||
'totalItems' => $profile->followers()->count(),
|
||||
'orderedItems' => $profile->followers->map(function($f) {
|
||||
return $f->permalink();
|
||||
})
|
||||
'totalItems' => 0,
|
||||
'orderedItems' => []
|
||||
];
|
||||
|
||||
return response()->json($obj);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class WebSub extends Model
|
||||
{
|
||||
//
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class RemoveWebSubsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::dropIfExists('web_subs');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('web_subs');
|
||||
}
|
||||
}
|
|
@ -2,25 +2,19 @@
|
|||
/* Using an echo tag here so the `<? ... ?>` won't get parsed as short tags */
|
||||
'<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL
|
||||
?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:activity="http://activitystrea.ms/spec/1.0/" xmlns:poco="http://portablecontacts.net/spec/1.0" xmlns:media="http://purl.org/syndication/atommedia" xmlns:ostatus="http://ostatus.org/schema/1.0" xmlns:mastodon="http://mastodon.social/schema/1.0">
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<id>{{$profile->permalink('.atom')}}</id>
|
||||
<title>{{$profile->username}}</title>
|
||||
<title>{{$profile->username}} on Pixelfed</title>
|
||||
<subtitle>{{$profile->bio}}</subtitle>
|
||||
<updated>{{$profile->updated_at->toAtomString()}}</updated>
|
||||
<logo></logo>
|
||||
<author>
|
||||
<id>{{$profile->permalink()}}</id>
|
||||
<activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type>
|
||||
<uri>{{$profile->permalink()}}</uri>
|
||||
<name>{{$profile->permalink()}}</name>
|
||||
<email>{{$profile->emailUrl()}}</email>
|
||||
<summary type="html">{{$profile->bio}}</summary>
|
||||
<link rel="alternate" type="text/html" href="{{$profile->url()}}"/>
|
||||
<link rel="avatar" type="image/jpeg" media:width="120" media:height="120" href="{{$profile->avatarUrl()}}"/>
|
||||
<poco:preferredUsername>{{$profile->username}}</poco:preferredUsername>
|
||||
<poco:displayName>{{$profile->name}}</poco:displayName>
|
||||
<poco:note>{{$profile->bio}}</poco:note>
|
||||
<mastodon:scope>public</mastodon:scope>
|
||||
</author>
|
||||
<link rel="alternate" type="text/html" href="{{$profile->url()}}"/>
|
||||
<link rel="self" type="application/atom+xml" href="{{$profile->permalink('.atom')}}"/>
|
||||
|
|
Loading…
Reference in a new issue