synod/bug-report

Matrix客户端Synod.im / Element(Android和iOS)的bug报告接收器

dev-main 2021-09-16 12:50 UTC

This package is auto-updated.

Last update: 2024-09-16 19:51:20 UTC


README

本项目实现了PHP端点,用于处理来自Element的Android和iOS应用([https://github.com/vector-im/element-android](https://github.com/vector-im/element-android) 和 [https://github.com/vector-im/element-ios](https://github.com/vector-im/element-ios))的bug报告。它为Synod.im品牌的这些应用的分支([https://github.com/luki-ev/synod-android](https://github.com/luki-ev/synod-android) 和 [https://github.com/luki-ev/synod-ios](https://github.com/luki-ev/synod-ios))开发,尽管它完全兼容上游协议。

提供了不同的bug报告处理器。可以通过实现BugReportHandlerInterface轻松开发额外的处理器。

使用方法

运行 composer require synod/bug-report。然后创建一个PHP文件,用于处理以 /submit 为后缀的URL的 POST 请求,并包含以下内容

<?php
use Synod\BugReport\BugReportRequest;
use Synod\BugReport\Controller\BugReportController;

require_once '/path/to/vendor/autoload.php';

$handler = <Implementation of Synod\BugReport\Handler\BugReportHandlerInterface>;
$logger = <Implementation of Psr\Log\LoggerInterface>; // optional
$bugReportController = new BugReportController($handler, $logger);

$request = BugReportRequest::createFromGlobals();
$response = $bugReportController->handleRequest($request);
$response->send();

Element使用相同的字段名多次发送多部分表单。这不受PHP内置解析器支持,因此必须通过设置php.ini指令enable_post_data_readingOff来禁用。如何操作取决于web服务器(例如.user.ini.htaccess)。

您可以考虑通过使用RateLimitingBugReportController来启用速率限制。

最后,更改Android和iOS应用发送bug报告的URL。对于Android,在config.xml中执行此操作。对于iOS,在BuildSettings.swift中执行此操作。请注意,路径 /submit 是由iOS Matrix SDK 添加的。