landrok / activitypub Goto Github PK
View Code? Open in Web Editor NEWA PHP implementation of ActivityPub protocol based upon the ActivityStreams 2.0 data format.
License: MIT License
A PHP implementation of ActivityPub protocol based upon the ActivityStreams 2.0 data format.
License: MIT License
Bonjour
Nous cherchons un developpeur pour intégré AP dans un projet open source en PHP
c'est une bouteille à la mer , on sait jamais
merci et désolé si c'est pas le bon endroit
The signature pattern is quite strict on the padding signs at the end. I'm getting signatures now and then with one or sometimes without equal signs in the end. So something like underneath makes the preg match work fine. Unless there's a requirement for having two there, but I don't think so :)
/^
keyId="(?P<keyId>
(https?:\/\/[\w\-\.]+[\w]+)
(:[\d]+)?
([\w\-\.#\/@]+)
)",
(headers="\(request-target\) (?P<headers>[\w\s]+)",)?
signature="(?P<signature>[\w+\/]+={0,2})"
/x
I've started verifying incoming activities now in the Drupal module. However, most are failing. As a consequence, incoming messages (even from followers) are unpublished and not visible on the timeline.
This is probably due to mastodon/mastodon#14556 - I had to change the creation of the signature because of this change when sending out activities to my followers.
Tricky stuff :) I'll dig in deeper myself first to figure out what needs to change and run it in my environment for a few days once I got something.
It looks like, even though cache is written to the file system, the cache is missed on the next request.
Some sample code; Note: the functions return ttl and the actual path which are configurable in the drupal module, but it also happens with the default cache settings.
$config += [
'cache' => [
'ttl' => activitypub_cache_ttl(),
'stream' => activitypub_cache_path()
],
];
$config['instance']['types'] = 'ignore';
return new Server($config);
...
$server->actor($target)->get('inbox')
I did some naive debugging in Request.php to find out it didn't get into the ::has statement
print_r("CHECKING $url");
if (CacheHelper::has($url)) {
print_r("FOUND");
return CacheHelper::get($url);
}
try {
print_r("DAMN");
$content = $this->client->get($url)->getBody()->getContents();
} catch (\GuzzleHttp\Exception\ClientException $exception) {
throw new Exception($exception->getMessage());
}
CacheHelper::set($url, $content);
return $content;
When using following code:
$webfinger = $server->actor($handle)->webfinger();
The call to the webfinger url happens twice
There's a property webfingers, but a quick debug by adding in the get() method of the factory doesn't help, because well, it's static (unless I miss something very stupid here).
Not sure what the most elegant way would be to handle it.
Hi. I'm not an expert in using my brain :P I've tried from the documentation to understand how the code works (+ ActivityPub from online texts), but I don't know how to use these projects realistically, and I wouldn't want to create my own protocol. Can you write different simple examples of different functions?
For example:
And so on.
If possible, of course.
Hi,
I start to play with webfinger and webrtc and would like to use your ActivityPub library because my small project could be extended with activitypub features later...
So I know it's a little bit of topic, but I hope you could help me to be compatible with your project 😅
Two questions about how to use it.
It looks like webfinger would be nice to store a public key used for signature verification and optional encryption.
Is it possible to add a public key to the webfinger user "file" and is it possible to get that attribute with your webfinger implementation?
Content should be signed / encrypted client side. So how to do it with JavaScript to be compatible to HttpSignature::verify()
?
Client side encryption library examples:
In https://github.com/landrok/activitypub/blob/master/docs/index.md#more the url https://cybre.space/@landrok is referenced and gives a 404, according to https://cybre.space/ this server is no longer in use.
As of January 1, 2024, the mastodon instance at cybre.space is no longer available. Thanks for everything <3.
Please update with current contact information or remove the section.
Thanks for your work!
What I want to do is create a server that will be federated with Lemmy instances and will receive pings to the inbox like Lemmy instances do. I can't find any documentation about anything similar. Is it supported? If so, how?
This is just a thank you issue :)
I've just tagged alpha 1 of the Drupal module at https://www.drupal.org/project/activitypub.
I don't even use the full power yet of your library, but that's slowly coming, thanks for all the work already!
🎉 🤘 💪
So this is less a problem with the library and more of a problem with my use of it. But when trying to validate signatures coming from a mastodon Follow request, the httpsignature->verify fails every time.
I'm following the examples and I don't know where things are going sideways on this. Any information to help clear this up would be great.
Thanks
I've been trying to run https://landrok.github.io/activitypub/fetch-peertube-outbox-activities.html but I can't get a result from the various Peertube accounts. For example: [email protected].
Could you check if the documentation is still correct? Could you maybe look at some sample profiles that work with the script?
The first issues their about undefined properties, but event after defining them I still ran into issues.
Thanks again for all your work and documentation!
The signature field in the request was keyId="https://domain/path#main-key",algorithm="rsa-sha256",headers="(request-target) host date digest content-type",signature="zRbQw......0MUqA=="
, and I suspect that the algorithm="rsa-sha256" field has caused this problem. (By the way, requests from both Mastodon and Pleroma seem to be using rsa-sha256.)
Can this be fixed somehow? Thanks!
landrok/activitypub 0.5.6 requires psr/cache ^1.0 -> found psr/cache[1.0.0, 1.0.1] but the package is fixed to 3.0.0
Hi,
I'm (finally) working on ActivityPub for Drupal using your library, and it's coming along well.
I was wondering whether you have an ETA to tag a new release? That would allow me to set a stable tag in my composer file, instead of having to rely on dev/master branch.
Thanks!
I'm not a programmer / developer, so I don't think I could design or realize such a project in needed quality...
I searched for a universal solution for a multi user / multi domain blog (one user can have different author names and blog domains) as alternative to multiple blog installations (plume, writefreely or some other solution).
I found https://github.com/autogestion/pubgate which looks like a activitypub headless cms (database + api). I really like that way and would ask if there is a project like that build on top of that library with php?
Who uses landrok/acticitypub?
Hey @landrok , I am the author of the WordPress ActivityPub Plugin (https://github.com/pfefferle/wordpress-activitypub) and @mediaformat and I investigated if it is possible to use your lib in the plugin, so I have some questions.
fromJson
method for the Activity Objects, so that we will be able to init the objects, using the JSON request?Depending on the context, it might be necessary to pass on a different user agent.
In my case, this is because the tests in Drupal spawn a separate Drupal which is only accessible if the right user agent is passed on in guzzle user agents.
Change composer dependency to "monolog/monolog": "^1.12|^2.0",
Hi,
looks like a client api is planned, but not ready?
And which clients should be compatible to the client api (mastodon web client, mastodon apps)?
Hi, I'm founder of minds.com, an open source social net with a few million users. I tried to reach out on cybre.space but couldn't get in. Pls let me know if we can connect. We are very interested in funding dev here.
Since #35 , WebFinger call supports non-filled attributes. In some cases, these should be required (Ontologies, authentication, translation from username to URLs).
Some server configurations may be implemented.
I am trying to build out Mastodon support for an application, and running into a validation error I cannot explain.
Here's the code:
$server new Server([
'ontologies' => [
// I'm building out the ontology class based on the error messages I get.
'mastodon' => MastodonOntology::class,
]
]);
// This works (after I create an extended Person and a PropertyValue)
$actor = $this->server->actor('[email protected]');
$outbox = $this->server->outbox('[email protected]');
$pages = [];
// This fails.
$page = $outbox->getPage($outbox->get()->first);
Specifically, the error comes from Util::hasProperties()
, which is called with an array for $item
instead of an object. (The method really needs better native types.) That makes the property_exists()
call fail with a type error. After some debugging, I have determined it's being called with this array:
[
'type' => 'CollectionPage',
'next' => 'https://phpc.social/users/Crell/statuses/...',
'partOf' => 'https://phpc.social/users/Crell/statuses/...',
'items' => [],
]
Which... doesn't make sense, as CollectionPage
is a built-in supported type, so I have no idea how it's still an array at that point.
I've hit a wall on debugging at this point. Any help on what's going on? There's like 10 stack layers between my code and where the error is, and I have on idea where the issue is.
(I'm quite open to submitting the Mastodon ontology as a PR once I have it working, if there would be interest.)
There's validation when trying to create an object, which is great.
However, it looks like mastodon added a 'featured' property, so trying to get the webfinger info from say [email protected] results now in
In AbstractObject.php line 137:
Property "featured" is not defined. Type="Service", Class="ActivityPhp\Type\Extended\Actor\Service"
I haven't fully dived into the code yet, and I can probably add it the feature/property myself with custom code. However, it still means we'd have to keep an eye on the logs in case some service decided to add another one which would break everything again.
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.