2424use OCP \AppFramework \Http \Attribute \PublicPage ;
2525use OCP \AppFramework \Http \DataResponse ;
2626use OCP \IRequest ;
27+ use Psr \Log \LoggerInterface ;
2728
2829/**
2930 * @psalm-suppress UndefinedClass
@@ -39,6 +40,7 @@ public function __construct(
3940 private WhiteboardContentService $ contentService ,
4041 private ExceptionService $ exceptionService ,
4142 private ConfigService $ configService ,
43+ private LoggerInterface $ logger ,
4244 ) {
4345 parent ::__construct ($ appName , $ request );
4446 }
@@ -69,9 +71,9 @@ public function show(int $fileId): DataResponse {
6971 #[PublicPage]
7072 public function update (int $ fileId , array $ data ): DataResponse {
7173 try {
72- $ this ->validateBackendSharedToken ( $ fileId );
74+ $ jwt = $ this ->getJwtFromRequest ( );
7375
74- $ userId = $ this ->getUserIdFromRequest ( );
76+ $ userId = $ this ->jwtService -> getUserIdFromJWT ( $ jwt );
7577
7678 $ user = $ this ->getUserFromIdServiceFactory ->create ($ userId )->getUser ();
7779
@@ -81,6 +83,8 @@ public function update(int $fileId, array $data): DataResponse {
8183
8284 return new DataResponse (['status ' => 'success ' ]);
8385 } catch (Exception $ e ) {
86+ $ this ->logger ->error ('Error syncing whiteboard data: ' . $ e ->getMessage ());
87+
8488 return $ this ->exceptionService ->handleException ($ e );
8589 }
8690 }
0 commit comments