first commit symfony 6

This commit is contained in:
2022-07-25 17:16:08 +02:00
parent 2bba3d5695
commit 8181ca1c39
53 changed files with 754 additions and 116 deletions

View File

@ -9,11 +9,26 @@ use Symfony\Component\Mercure\Update;
class PublishController extends AbstractController
{
public function sample($id){
return $this->render('Home/publishsample.html.twig',[
'id'=>$id
]);
}
public function publish($channel, $id, Request $request, HubInterface $hub): Response
{
$ret=$request->get("msg");
$ret["from"]=[];
$ret["from"]["id"]="tot";
$ret["from"]["id"]=$this->getUser()->getId();
$ret["from"]["username"]=$this->getUser()->getUsername();
$ret["from"]["displayname"]=$this->getUser()->getDisplayname();
if(stripos($this->getUser()->getAvatar(),"http")===0)
$ret["from"]["avatar"]=$this->getUser()->getAvatar();
else
$ret["from"]["avatar"]=$this->getParameter('appAlias')."uploads/avatar/".$this->getUser()->getAvatar();
$update = new Update(
$channel."-".$id,
json_encode(