some more fixes
This commit is contained in:
parent
853961f53c
commit
ccdf7d9b29
@ -192,4 +192,4 @@ WantedBy=multi-user.target
|
|||||||
|
|
||||||
## TODO:
|
## TODO:
|
||||||
|
|
||||||
For a list of planned features and improvements, please refer to the [TODO](TODO) file.
|
For a list of planned features and improvements, please refer to the [TODO](TODO.md) file.
|
||||||
|
6
TODO.md
6
TODO.md
@ -17,6 +17,7 @@
|
|||||||
- [ ] Local Boost
|
- [ ] Local Boost
|
||||||
- [x] Tags
|
- [x] Tags
|
||||||
- [ ] Pinned Posts
|
- [ ] Pinned Posts
|
||||||
|
- [ ] Nodeinfo
|
||||||
|
|
||||||
- [-] Social features
|
- [-] Social features
|
||||||
- [x] Profile
|
- [x] Profile
|
||||||
@ -52,8 +53,9 @@
|
|||||||
|
|
||||||
- [ ] Fixes
|
- [ ] Fixes
|
||||||
- [x] Fix that weird json encoding in the object field of an activity
|
- [x] Fix that weird json encoding in the object field of an activity
|
||||||
- [ ] The profile attachments are not working, they are not being federalised somehow (the interests thingy)
|
- [x] The profile attachments are not working, they are not being federalised somehow (the interests thingy)
|
||||||
- [ ] Endpoints for getting notes (/ap/v1/note/{note})
|
- [x] Endpoints for getting notes (/ap/v1/note/{note})
|
||||||
- [ ] Fix hashtags on post update
|
- [ ] Fix hashtags on post update
|
||||||
- [x] Use jobs when posting activities
|
- [x] Use jobs when posting activities
|
||||||
- [ ] Sign the get activities for mastodon when secure mode is enable
|
- [ ] Sign the get activities for mastodon when secure mode is enable
|
||||||
|
- [x] Set a minimum font size for the tags cloud
|
||||||
|
@ -5,6 +5,7 @@ namespace App\Http\Controllers\AP;
|
|||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\Actor;
|
use App\Models\Actor;
|
||||||
use App\Models\Activity;
|
use App\Models\Activity;
|
||||||
|
use App\Models\Follow;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
@ -15,6 +16,10 @@ class APActorController extends Controller
|
|||||||
{
|
{
|
||||||
public function user (User $user)
|
public function user (User $user)
|
||||||
{
|
{
|
||||||
|
if (str_contains (request ()->header ("Accept"), "text/html")) {
|
||||||
|
return redirect (route ("users.show", ["user_name" => $user->name]));
|
||||||
|
}
|
||||||
|
|
||||||
$actor = $user->actor ()->get ();
|
$actor = $user->actor ()->get ();
|
||||||
$response = Actor::build_response ($actor->first ());
|
$response = Actor::build_response ($actor->first ());
|
||||||
return response ()->json ($response)->header ("Content-Type", "application/activity+json");
|
return response ()->json ($response)->header ("Content-Type", "application/activity+json");
|
||||||
@ -22,8 +27,9 @@ class APActorController extends Controller
|
|||||||
|
|
||||||
public function followers (User $user)
|
public function followers (User $user)
|
||||||
{
|
{
|
||||||
// TODO: Rewrite this using the follow model
|
$follower_ids = Follow::where ("object", $user->actor->id)->get ();
|
||||||
$followers = Activity::where ("type", "Follow")->where ("object", $user->actor->actor_id);
|
$followers = Actor::whereIn ("id", $follower_ids->pluck ("actor")->toArray ());
|
||||||
|
|
||||||
$ordered_collection = new TypeOrderedCollection ();
|
$ordered_collection = new TypeOrderedCollection ();
|
||||||
$ordered_collection->collection = $followers->get ()->pluck ("actor")->toArray ();
|
$ordered_collection->collection = $followers->get ()->pluck ("actor")->toArray ();
|
||||||
$ordered_collection->url = route ("ap.followers", $user->name);
|
$ordered_collection->url = route ("ap.followers", $user->name);
|
||||||
@ -39,8 +45,9 @@ class APActorController extends Controller
|
|||||||
|
|
||||||
public function following (User $user)
|
public function following (User $user)
|
||||||
{
|
{
|
||||||
// TODO: Rewrite this using the follow model
|
$following_ids = Follow::where ("actor", $user->actor->id)->get ();
|
||||||
$following = Activity::where ("type", "Follow")->where ("actor", $user->actor->actor_id);
|
$following = Actor::whereIn ("id", $following_ids->pluck ("object")->toArray ());
|
||||||
|
|
||||||
$ordered_collection = new TypeOrderedCollection ();
|
$ordered_collection = new TypeOrderedCollection ();
|
||||||
$ordered_collection->collection = $following->get ()->pluck ("object")->toArray ();
|
$ordered_collection->collection = $following->get ()->pluck ("object")->toArray ();
|
||||||
$ordered_collection->url = route ("ap.following", $user->name);
|
$ordered_collection->url = route ("ap.following", $user->name);
|
||||||
|
23
app/Http/Controllers/AP/APGeneralController.php
Normal file
23
app/Http/Controllers/AP/APGeneralController.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\AP;
|
||||||
|
|
||||||
|
use App\Models\Note;
|
||||||
|
|
||||||
|
use App\Types\TypeNote;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class APGeneralController extends Controller
|
||||||
|
{
|
||||||
|
public function note (Note $note)
|
||||||
|
{
|
||||||
|
if (str_contains (request ()->header ("Accept"), "text/html")) {
|
||||||
|
return redirect (route ("posts.show", ["note" => $note]));
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = TypeNote::build_response ($note);
|
||||||
|
return response ()->json ($response)->header ("Content-Type", "application/activity+json");
|
||||||
|
}
|
||||||
|
}
|
@ -95,10 +95,6 @@ class APOutboxController extends Controller
|
|||||||
{
|
{
|
||||||
Storage::disk ("public")->delete ($processed_path);
|
Storage::disk ("public")->delete ($processed_path);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Log::error ("Attachment not found: " . $attachment->url . " " . $processed_path);
|
|
||||||
}
|
|
||||||
|
|
||||||
$attachment->delete ();
|
$attachment->delete ();
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ class Note extends Model
|
|||||||
"actor_id",
|
"actor_id",
|
||||||
|
|
||||||
"note_id",
|
"note_id",
|
||||||
|
"private_id",
|
||||||
"in_reply_to",
|
"in_reply_to",
|
||||||
"type",
|
"type",
|
||||||
"summary",
|
"summary",
|
||||||
|
@ -62,10 +62,13 @@ class TypeNote
|
|||||||
public static function craft_from_outbox (Actor $actor, $request)
|
public static function craft_from_outbox (Actor $actor, $request)
|
||||||
{
|
{
|
||||||
// TODO: url should be route ('posts.show', $note->id)
|
// TODO: url should be route ('posts.show', $note->id)
|
||||||
|
$private_id = uniqid ();
|
||||||
|
|
||||||
$note = Note::create ([
|
$note = Note::create ([
|
||||||
"actor_id" => $actor->id,
|
"actor_id" => $actor->id,
|
||||||
"summary" => $request ["summary"],
|
"summary" => $request ["summary"],
|
||||||
"note_id" => env ("APP_URL") . "/ap/v1/note/" . uniqid (),
|
"note_id" => env ("APP_URL") . "/ap/v1/note/" . $private_id,
|
||||||
|
"private_id" => $private_id,
|
||||||
"in_reply_to" => $request ["inReplyTo"] ?? null,
|
"in_reply_to" => $request ["inReplyTo"] ?? null,
|
||||||
"type" => "Note",
|
"type" => "Note",
|
||||||
"summary" => $request ["summary"] ?? null,
|
"summary" => $request ["summary"] ?? null,
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('notes', function (Blueprint $table) {
|
||||||
|
$table->string ("private_id")->nullable ();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('notes', function (Blueprint $table) {
|
||||||
|
$table->dropColumn ("private_id");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
@ -67,7 +67,9 @@
|
|||||||
|
|
||||||
links.forEach ((link) => {
|
links.forEach ((link) => {
|
||||||
const weight = parseInt (link.getAttribute ("data-weight"));
|
const weight = parseInt (link.getAttribute ("data-weight"));
|
||||||
const size = Math.round ((weight / max_weight) * 210);
|
// set a minimum size
|
||||||
|
const min_size = 100;
|
||||||
|
const size = min_size + (weight / max_weight) * 100;
|
||||||
|
|
||||||
link.style.fontSize = `${size}%`;
|
link.style.fontSize = `${size}%`;
|
||||||
});
|
});
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
use App\Http\Controllers\AP\APActorController;
|
use App\Http\Controllers\AP\APActorController;
|
||||||
|
use App\Http\Controllers\AP\APGeneralController;
|
||||||
use App\Http\Controllers\AP\APInboxController;
|
use App\Http\Controllers\AP\APInboxController;
|
||||||
|
|
||||||
use App\Http\Controllers\AP\APInstanceInboxController;
|
use App\Http\Controllers\AP\APInstanceInboxController;
|
||||||
@ -13,11 +14,15 @@ use App\Http\Controllers\AP\APWebfingerController;
|
|||||||
Route::get ("/.well-known/webfinger", [ APWebfingerController::class, "webfinger" ])->name ("ap.webfinger");
|
Route::get ("/.well-known/webfinger", [ APWebfingerController::class, "webfinger" ])->name ("ap.webfinger");
|
||||||
|
|
||||||
Route::prefix ("/ap/v1")->group (function () {
|
Route::prefix ("/ap/v1")->group (function () {
|
||||||
|
// users
|
||||||
Route::post ("/user/{user:name}/inbox", [ APInboxController::class, "inbox" ])->name ("ap.inbox");
|
Route::post ("/user/{user:name}/inbox", [ APInboxController::class, "inbox" ])->name ("ap.inbox");
|
||||||
Route::post ("/user/{user:name}/outbox", [ APOutboxController::class, "outbox" ])->name ("ap.outbox");
|
Route::post ("/user/{user:name}/outbox", [ APOutboxController::class, "outbox" ])->name ("ap.outbox");
|
||||||
Route::get ("/user/{user:name}/followers", [ APActorController::class, "followers" ])->name ("ap.followers");
|
Route::get ("/user/{user:name}/followers", [ APActorController::class, "followers" ])->name ("ap.followers");
|
||||||
Route::get ("/user/{user:name}/following", [ APActorController::class, "following" ])->name ("ap.following");
|
Route::get ("/user/{user:name}/following", [ APActorController::class, "following" ])->name ("ap.following");
|
||||||
Route::get ("/user/{user:name}", [ APActorController::class, "user" ])->name ("ap.user");
|
Route::get ("/user/{user:name}", [ APActorController::class, "user" ])->name ("ap.user");
|
||||||
|
|
||||||
|
// notes
|
||||||
|
Route::get ("/note/{note:private_id}", [ APGeneralController::class, "note" ])->name ("ap.note");
|
||||||
|
|
||||||
Route::post ("/inbox", [ APInstanceInboxController::class, "inbox" ])->name ("ap.inbox");
|
Route::post ("/inbox", [ APInstanceInboxController::class, "inbox" ])->name ("ap.inbox");
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user