* Use ActivityPub outbox for Mastodon (et al.) feed
closes#2754
* Better description for Mastodon bridge
I mean I could rename it to ActivityPub bridge if the maintainer so pleases
* [Mastodon] Please the lint
* [Mastodon] address feedback
* [Mastodon] fix link, address spelling case bug
* refactor
* [Mastodon] add username cache, fix try-catch, rename
* [Mastodon] shorten description to satisfy the lint
* [Mastodon] address feedback
* [Mastodon] support Secure Mode instances
* [Mastodon] add config documentation
* [Mastodon] update docs
Co-authored-by: Dag <me@dvikan.no>
We are setting xmlns attributes at the root element but PHP would
still attach redundant ones to the DOM elements created with `createElementNS`.
That was because PHP reconciles namespace attributes when appending elements to DOM
but since we previously only attached the elements after all children were attached,
the reconciliation algorithm was not able to see the root element’s attributes.
To fix this, let’s attach each element to its parent immediately after it is created.
There is a lot of redundancy. Let’s not repeat ourselves.
Unfortunately, since we do not install PHPUnit as a project dependency on CI,
it does not use the composer’s PSR-4 autoloader and the tests are unable to find
the `BaseFormatTest` class.
Until we resolve that, let’s load the class explicitly.
the date handling
The deal posting date logic was wrong, and leaded to warnings and
notice. Now, only the feed with the deal sorted by date contains date
(the feed sorted by hottest deal does not contain a date anymore,
because there are no deal date in this case).
We cannot yet switch to namespaces for RSS-Bridge itself but for tests we are not limited by BC.
It does not actually do anything since PHPUnit will search for the test files without the help of the autoloader but it still makes the directory cleaner.
* [AtomFormat]: Generate using DomDocument
This will escape the HTML content for us as needed.
* [MrssFormat]: Generate using DomDocument
This will escape the HTML content for us as needed.
With UTF-8 byte-order mark in the file, the `ListActionTest::testOutput`
would fail after converting tests to PSR-4 namespaces:
invalid JSON output: Syntax error
Failed asserting that null is not null.
This is because ListAction::execute tries to create the bridge objects
and, when the files containing the bridge classes are not loaded yet,
the autoloader starts including them. Since this happens after output
buffering has begun, any text in the PHP file before the `<?php` tag
such as the BOM will end up in the buffer to be parsed by `json_decode`.
Previously, it worked by chance thanks to some other test including the file
before `ListActionTest`. With the restructuring, `Actions\ListActionTest`
will run sooner and become responsible for triggering the autoloader.
To prevent this in the future, I also disallowed BOM in the coding style.