diff --git a/app/Http/Controllers/FeedsController.php b/app/Http/Controllers/FeedsController.php
index a30c89dc..9aeb4abb 100644
--- a/app/Http/Controllers/FeedsController.php
+++ b/app/Http/Controllers/FeedsController.php
@@ -7,66 +7,13 @@ namespace App\Http\Controllers;
use App\Models\Article;
use App\Models\Note;
use Illuminate\Http\JsonResponse;
-use Illuminate\Http\Response;
class FeedsController extends Controller
{
- /**
- * Returns the blog RSS feed.
- */
- public function blogRss(): Response
- {
- $articles = Article::where('published', '1')->latest('updated_at')->take(20)->get();
- $buildDate = $articles->first()->updated_at->toRssString();
-
- return response()
- ->view('articles.rss', compact('articles', 'buildDate'))
- ->header('Content-Type', 'application/rss+xml; charset=utf-8');
- }
-
- /**
- * Returns the blog Atom feed.
- */
- public function blogAtom(): Response
- {
- $articles = Article::where('published', '1')->latest('updated_at')->take(20)->get();
-
- return response()
- ->view('articles.atom', compact('articles'))
- ->header('Content-Type', 'application/atom+xml; charset=utf-8');
- }
-
- /**
- * Returns the notes RSS feed.
- */
- public function notesRss(): Response
- {
- $notes = Note::latest()->take(20)->get();
- $buildDate = $notes->first()->updated_at->toRssString();
-
- return response()
- ->view('notes.rss', compact('notes', 'buildDate'))
- ->header('Content-Type', 'application/rss+xml; charset=utf-8');
- }
-
- /**
- * Returns the notes Atom feed.
- */
- public function notesAtom(): Response
- {
- $notes = Note::latest()->take(20)->get();
-
- return response()
- ->view('notes.atom', compact('notes'))
- ->header('Content-Type', 'application/atom+xml; charset=utf-8');
- }
-
- /** @todo sort out return type for json responses */
-
/**
* Returns the blog JSON feed.
*/
- public function blogJson(): array
+ public function blogJson(): JsonResponse
{
$articles = Article::where('published', '1')->latest('updated_at')->take(20)->get();
$data = [
@@ -94,13 +41,15 @@ class FeedsController extends Controller
];
}
- return $data;
+ return response()->json($data, 200, [
+ 'Content-Type' => 'application/feed+json',
+ ]);
}
/**
* Returns the notes JSON feed.
*/
- public function notesJson(): array
+ public function notesJson(): JsonResponse
{
$notes = Note::latest()->with('media', 'place', 'tags')->take(20)->get();
$data = [
@@ -130,7 +79,9 @@ class FeedsController extends Controller
}
}
- return $data;
+ return response()->json($data, 200, [
+ 'Content-Type' => 'application/feed+json',
+ ]);
}
/**
diff --git a/app/Services/ArticleService.php b/app/Services/ArticleService.php
index 3d5dcc56..2372ffb7 100644
--- a/app/Services/ArticleService.php
+++ b/app/Services/ArticleService.php
@@ -13,7 +13,7 @@ class ArticleService
return Article::create([
'title' => $data['name'],
'main' => $data['content'],
- 'published' => true,
+ 'published' => ($data['post-status'] ?? null) !== 'draft',
]);
}
}
diff --git a/app/Services/Micropub/Data/EntryData.php b/app/Services/Micropub/Data/EntryData.php
index 52dde72d..192c50f7 100644
--- a/app/Services/Micropub/Data/EntryData.php
+++ b/app/Services/Micropub/Data/EntryData.php
@@ -24,6 +24,7 @@ class EntryData extends MicropubData
public readonly mixed $checkin,
public readonly mixed $syndication,
public readonly ?array $photos,
+ public readonly ?string $postStatus,
) {}
public static function fromRequest(Request $request): static
@@ -49,6 +50,7 @@ class EntryData extends MicropubData
checkin: Arr::get($data, 'properties.checkin.0'),
syndication: Arr::get($data, 'properties.syndication.0'),
photos: Arr::get($data, 'properties.photo'),
+ postStatus: Arr::get($data, 'properties.post-status.0'),
);
}
@@ -67,6 +69,7 @@ class EntryData extends MicropubData
checkin: $request->input('checkin'),
syndication: $request->input('syndication'),
photos: $request->input('photos'),
+ postStatus: $request->input('post-status'),
);
}
@@ -100,6 +103,7 @@ class EntryData extends MicropubData
checkin: $data['checkin'] ?? null,
syndication: $data['syndication'] ?? null,
photos: $data['photos'] ?? null,
+ postStatus: $data['post-status'] ?? null,
);
}
@@ -120,6 +124,7 @@ class EntryData extends MicropubData
'checkin' => $this->checkin,
'syndication' => $this->syndication,
'photos' => $this->photos,
+ 'post-status' => $this->postStatus,
];
}
}
diff --git a/resources/views/articles/atom.blade.php b/resources/views/articles/atom.blade.php
deleted file mode 100644
index 9892bcfb..00000000
--- a/resources/views/articles/atom.blade.php
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
- Atom feed for {{ config('user.display_name') }}’s blog
-
- {{ config('app.url')}}/blog
- {{ $articles[0]->updated_at->toAtomString() }}
-
-@foreach($articles as $article)
-
- {{ $article->title }}
-
- {{ config('app.url') }}{{ $article->link }}
- {{ $article->updated_at->toAtomString() }}
- {{ $article->main }}
-
- {{ config('user.display_name') }}
-
-
-@endforeach
-
diff --git a/resources/views/articles/rss.blade.php b/resources/views/articles/rss.blade.php
deleted file mode 100644
index 00268681..00000000
--- a/resources/views/articles/rss.blade.php
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
- {{ config('user.display_name') }}
-
- An RSS feed of the blog posts found on {{ config('app.url') }}
- {{ config('app.url') }}/blog
- {{ $buildDate }}
- 1800
-
-@foreach($articles as $article)
- -
- {{ strip_tags($article->title) }}
-
- main }}
- @if($article->url)
Permalink
@endif
- ]]>
-
- @if($article->url != ''){{ $article->url }}@else{{ config('app.url') }}{{ $article->link }}@endif
- {{ config('app.url') }}{{ $article->link }}
- {{ $article->pubdate }}
-
-@endforeach
-
-
diff --git a/resources/views/icons/json-feed.blade.php b/resources/views/icons/json-feed.blade.php
new file mode 100644
index 00000000..7b8df856
--- /dev/null
+++ b/resources/views/icons/json-feed.blade.php
@@ -0,0 +1,11 @@
+@php
+if (isset($title)) {
+ $uniqueId = bin2hex(random_bytes(6));
+}
+@endphp
+
diff --git a/resources/views/master.blade.php b/resources/views/master.blade.php
index 2e5c6b5a..3c82845b 100644
--- a/resources/views/master.blade.php
+++ b/resources/views/master.blade.php
@@ -7,13 +7,9 @@
@yield('title'){{ config('app.name') }}
-
-
-
+
-
-
-
+
@@ -40,7 +36,7 @@
Likes
Contacts
Projects
-
+