first commit symfony 6
This commit is contained in:
@ -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(
|
||||
|
Reference in New Issue
Block a user