sebsel / kirby-micropub Goto Github PK
View Code? Open in Web Editor NEWA Micropub Endpoint for Kirby 2
A Micropub Endpoint for Kirby 2
Just 'slug' is now deprecated.
Hi Sebastian,
I am having a hard time wrapping my head around how to format new posts.
By default the plugin creates:
Text: Testing MicroPub posting from the micro.blog iOS app.
----
Client: https://micro.blog/
----
Updated: 2017-07-10 11:35:18
----
Date: 2017-07-10 11:35:18
what I want/need is this though:
Title: โ
----
Text: Testing MicroPub posting from the micro.blog iOS app.
----
Date: 10.07.2017
----
Time: 2017-07-10-11-35-18
----
Client: https://micro.blog/
----
Updated: 2017-07-10 11:35:18
So it's mainly the two different data formats and the extra (mandatory) title field, which I use for RSS purposes.
Can you point me in the right direction?
My Kirby config file looks like so:
/* micropub */
c::set('micropub.page-creator', function($uid, $template, $data) {
// Rename fields (you can also rename Kirby's fields)
if (isset($data['name'])) $data['title'] = "-";
$data['date'] = $data['published'];
// No double fields
unset($data['name'], $data['published']);
// Add new entry to the blog
$newEntry = page('microblog')->children()->create($uid, 'microblog', $data);
// Make it visible
$newEntry->sort(date('Ymd', strtotime($data['date'])));
// Return the new entry
return $newEntry;
});
Hi Sebastian,
I noticed that posts created with your plugin have the wrong the creation time.
Where does the plugin get the publish time from and can I set an offset somewhere?
Probably add two options for this:
c::set('indieauth.token-lifetime', 7776000); // Three months
c::set('indieauth.token-reset', 1498770106); // Revoke tokens before 2017-06-29 21:01:46
Should go in endpoint::fetchUrl()
, check for supported image-types and then download.
Especially:
Hi Sebastian,
me again. :)
I see that you at least took a look at the Auto-Git plugin. Do you know of a way to make your plugin trigger the Auto-Git routine?
Pedro the developer mentions something that looks to be a simple line of code to make it work. I have just no idea where to put it. :)
Auto Git uses Kirby hooks to detect changes:
kirby()->set('hook', 'panel.page.create', function ($page) {
autogit()->save('page.create', $page);
});
The save method runs git add -all content/ followed by a git commit -m 'Message goes here'.
So yes, it would get committed on the next change done via the panel.
Other plugins could call the save method as well.
Maybe I can make that even easier and more customisable.
So you need to be able to do:
$inReplyTo = $page->inReplyTo()->toMf();
echo html::a($inReplyTo->url(), $inReplyTo->name());
echo html::a($inReplyTo->author->url(), $inReplyTo->author()->name());
Or something like that.
<link rel="authorization_endpoint" href="https://indieauth.com/auth">
<link rel="token_endpoint" href="https://tokens.indieauth.com/token">
<link rel="micropub" href="https://your.url/micropub">
And then with site()->url()
and c::get()
endpoint::fillFields()
-loop: check for mp-
-fields (or before that?)See https://micropub.net/draft/#nested-microformats-objects
So:
$weight = $page->weight()->toMf2Obj();
echo $weight->num() . ' ' . $weight->unit();
Do all fields come through nicely? Arrays to CSV or YAML-objects.
Hi,
I tried to install the Micropub plugin and run the https://micropub.rocks test suite on it. Discovery of the endpoint works and everything looks peachy. But then when running the actual tests nothing works. I always get an error 500:
HTTP/1.1 500 Internal Server Error
Date: Thu, 29 Jun 2017 12:46:31 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: __cfduid=xxx; expires=Fri, 29-Jun-18 12:46:31 GMT; path=/; domain=.alexanderkucera.com; HttpOnly
Vary: Accept-Encoding
Server: cloudflare-nginx
CF-RAY: 3768fd3612305134-SJC
{
"error": "error",
"error_description": "Non-static method IndieWeb\\IndieAuth::requireMe() should not be called statically, assuming $this from incompatible context"
}
Any idea what might be wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.