mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-30 02:03:16 +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);
|
abort_if(!Auth::check(), 403);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// deprecated, remove in 0.10
|
||||||
public function authorizeFollow(Request $request)
|
public function authorizeFollow(Request $request)
|
||||||
{
|
{
|
||||||
$this->authCheck();
|
abort(404);
|
||||||
$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'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// deprecated, remove in 0.10
|
||||||
public function remoteFollow()
|
public function remoteFollow()
|
||||||
{
|
{
|
||||||
$this->authCheck();
|
abort(404);
|
||||||
|
|
||||||
return view('federation.remotefollow');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// deprecated, remove in 0.10
|
||||||
public function remoteFollowStore(Request $request)
|
public function remoteFollowStore(Request $request)
|
||||||
{
|
{
|
||||||
return;
|
abort(404);
|
||||||
|
|
||||||
$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]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function nodeinfoWellKnown()
|
public function nodeinfoWellKnown()
|
||||||
|
@ -98,20 +73,20 @@ class FederationController extends Controller
|
||||||
abort_if(!config('federation.nodeinfo.enabled'), 404);
|
abort_if(!config('federation.nodeinfo.enabled'), 404);
|
||||||
|
|
||||||
$res = Cache::remember('api:nodeinfo', now()->addMinutes(15), function () {
|
$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([]);
|
$count = collect([]);
|
||||||
// $likes = Like::select('profile_id')->where('created_at', '>', now()->subMonths(6)->toDateTimeString())->groupBy('profile_id')->pluck('profile_id')->toArray();
|
$likes = Like::select('profile_id')->where('created_at', '>', now()->subMonths(6)->toDateTimeString())->groupBy('profile_id')->pluck('profile_id')->toArray();
|
||||||
// $count = $count->merge($likes);
|
$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();
|
$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);
|
$count = $count->merge($statuses);
|
||||||
$profiles = Profile::select('id')->whereNull('domain')->where('created_at', '>', now()->subMonths(6)->toDateTimeString())->groupBy('id')->pluck('id')->toArray();
|
$profiles = Profile::select('id')->whereNull('domain')->where('created_at', '>', now()->subMonths(6)->toDateTimeString())->groupBy('id')->pluck('id')->toArray();
|
||||||
$count = $count->merge($profiles);
|
$count = $count->merge($profiles);
|
||||||
return $count->unique()->count();
|
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([]);
|
$count = collect([]);
|
||||||
// $likes = Like::select('profile_id')->where('created_at', '>', now()->subMonths(1)->toDateTimeString())->groupBy('profile_id')->pluck('profile_id')->toArray();
|
$likes = Like::select('profile_id')->where('created_at', '>', now()->subMonths(1)->toDateTimeString())->groupBy('profile_id')->pluck('profile_id')->toArray();
|
||||||
// $count = $count->merge($likes);
|
$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();
|
$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);
|
$count = $count->merge($statuses);
|
||||||
$profiles = Profile::select('id')->whereNull('domain')->where('created_at', '>', now()->subMonths(1)->toDateTimeString())->groupBy('id')->pluck('id')->toArray();
|
$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']);
|
$this->validate($request, ['resource'=>'required|string|min:3|max:255']);
|
||||||
|
|
||||||
$resource = $request->input('resource');
|
$resource = $request->input('resource');
|
||||||
$hash = hash('sha256', $resource);
|
|
||||||
$parsed = Nickname::normalizeProfileUrl($resource);
|
$parsed = Nickname::normalizeProfileUrl($resource);
|
||||||
|
if($parsed['domain'] !== config('pixelfed.domain.app')) {
|
||||||
|
abort(404);
|
||||||
|
}
|
||||||
$username = $parsed['username'];
|
$username = $parsed['username'];
|
||||||
$profile = Profile::whereUsername($username)->firstOrFail();
|
$profile = Profile::whereNull('domain')->whereUsername($username)->firstOrFail();
|
||||||
if($profile->status != null) {
|
if($profile->status != null) {
|
||||||
return ProfileController::accountCheck($profile);
|
return ProfileController::accountCheck($profile);
|
||||||
}
|
}
|
||||||
|
@ -315,19 +292,16 @@ class FederationController extends Controller
|
||||||
->whereIsPrivate(false)
|
->whereIsPrivate(false)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
|
||||||
return [];
|
|
||||||
|
|
||||||
if($profile->status != null) {
|
if($profile->status != null) {
|
||||||
return [];
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj = [
|
$obj = [
|
||||||
'@context' => 'https://www.w3.org/ns/activitystreams',
|
'@context' => 'https://www.w3.org/ns/activitystreams',
|
||||||
'id' => $request->getUri(),
|
'id' => $request->getUri(),
|
||||||
'type' => 'OrderedCollectionPage',
|
'type' => 'OrderedCollectionPage',
|
||||||
'totalItems' => $profile->following()->count(),
|
'totalItems' => 0,
|
||||||
'orderedItems' => $profile->following->map(function($f) {
|
'orderedItems' => []
|
||||||
return $f->permalink();
|
|
||||||
})
|
|
||||||
];
|
];
|
||||||
return response()->json($obj);
|
return response()->json($obj);
|
||||||
}
|
}
|
||||||
|
@ -341,20 +315,18 @@ class FederationController extends Controller
|
||||||
->whereIsPrivate(false)
|
->whereIsPrivate(false)
|
||||||
->firstOrFail();
|
->firstOrFail();
|
||||||
|
|
||||||
return [];
|
|
||||||
|
|
||||||
if($profile->status != null) {
|
if($profile->status != null) {
|
||||||
return [];
|
abort(404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj = [
|
$obj = [
|
||||||
'@context' => 'https://www.w3.org/ns/activitystreams',
|
'@context' => 'https://www.w3.org/ns/activitystreams',
|
||||||
'id' => $request->getUri(),
|
'id' => $request->getUri(),
|
||||||
'type' => 'OrderedCollectionPage',
|
'type' => 'OrderedCollectionPage',
|
||||||
'totalItems' => $profile->followers()->count(),
|
'totalItems' => 0,
|
||||||
'orderedItems' => $profile->followers->map(function($f) {
|
'orderedItems' => []
|
||||||
return $f->permalink();
|
|
||||||
})
|
|
||||||
];
|
];
|
||||||
|
|
||||||
return response()->json($obj);
|
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 */
|
/* Using an echo tag here so the `<? ... ?>` won't get parsed as short tags */
|
||||||
'<?xml version="1.0" encoding="UTF-8"?>'.PHP_EOL
|
'<?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>
|
<id>{{$profile->permalink('.atom')}}</id>
|
||||||
<title>{{$profile->username}}</title>
|
<title>{{$profile->username}} on Pixelfed</title>
|
||||||
<subtitle>{{$profile->bio}}</subtitle>
|
<subtitle>{{$profile->bio}}</subtitle>
|
||||||
<updated>{{$profile->updated_at->toAtomString()}}</updated>
|
<updated>{{$profile->updated_at->toAtomString()}}</updated>
|
||||||
<logo></logo>
|
<logo></logo>
|
||||||
<author>
|
<author>
|
||||||
<id>{{$profile->permalink()}}</id>
|
<id>{{$profile->permalink()}}</id>
|
||||||
<activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type>
|
|
||||||
<uri>{{$profile->permalink()}}</uri>
|
<uri>{{$profile->permalink()}}</uri>
|
||||||
<name>{{$profile->permalink()}}</name>
|
<name>{{$profile->permalink()}}</name>
|
||||||
<email>{{$profile->emailUrl()}}</email>
|
|
||||||
<summary type="html">{{$profile->bio}}</summary>
|
<summary type="html">{{$profile->bio}}</summary>
|
||||||
<link rel="alternate" type="text/html" href="{{$profile->url()}}"/>
|
<link rel="alternate" type="text/html" href="{{$profile->url()}}"/>
|
||||||
<link rel="avatar" type="image/jpeg" media:width="120" media:height="120" href="{{$profile->avatarUrl()}}"/>
|
<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>
|
</author>
|
||||||
<link rel="alternate" type="text/html" href="{{$profile->url()}}"/>
|
<link rel="alternate" type="text/html" href="{{$profile->url()}}"/>
|
||||||
<link rel="self" type="application/atom+xml" href="{{$profile->permalink('.atom')}}"/>
|
<link rel="self" type="application/atom+xml" href="{{$profile->permalink('.atom')}}"/>
|
||||||
|
|
Loading…
Reference in a new issue