1414using Refresh . Interfaces . APIv3 . Endpoints . DataTypes . Response . Playlists ;
1515using Refresh . Interfaces . APIv3 . Extensions ;
1616using Refresh . Core . RateLimits . Playlists ;
17+ using Refresh . Core . Configuration ;
1718
1819namespace Refresh . Interfaces . APIv3 . Endpoints ;
1920
@@ -54,8 +55,11 @@ public class PlaylistApiEndpoints : EndpointGroup
5455 [ DocQueryParam ( "parentId" , "If set, the new playlist will be added to the playlist specified by ID here instead of the root playlist. "
5556 + "If the specified playlist doesn't exist or is not owned by the user calling this endpoint, nothing will happen." ) ]
5657 public ApiResponse < ApiGamePlaylistResponse > CreatePlaylist ( RequestContext context , DataContext dataContext ,
57- GameUser user , ApiPlaylistCreationRequest body )
58+ GameUser user , ApiPlaylistCreationRequest body , GameServerConfig config )
5859 {
60+ if ( user . IsWriteBlocked ( config ) )
61+ return ApiAuthenticationError . ReadOnlyError ;
62+
5963 ApiError ? error = this . ValidatePlaylist ( body , dataContext ) ;
6064 if ( error != null ) return error ;
6165
@@ -96,8 +100,11 @@ public ApiResponse<ApiGamePlaylistResponse> CreatePlaylist(RequestContext contex
96100 [ RateLimitSettings ( PlaylistCreationEndpointLimits . UploadTimeoutDuration , PlaylistCreationEndpointLimits . MaxCreateAmount ,
97101 PlaylistCreationEndpointLimits . UploadBlockDuration , PlaylistCreationEndpointLimits . CreateBucket ) ]
98102 public ApiResponse < ApiGamePlaylistResponse > UpdatePlaylist ( RequestContext context , DataContext dataContext ,
99- GameUser user , ApiPlaylistCreationRequest body , int id )
103+ GameUser user , ApiPlaylistCreationRequest body , int id , GameServerConfig config )
100104 {
105+ if ( user . IsWriteBlocked ( config ) )
106+ return ApiAuthenticationError . ReadOnlyError ;
107+
101108 GamePlaylist ? playlist = dataContext . Database . GetPlaylistById ( id ) ;
102109 if ( playlist == null ) return ApiNotFoundError . PlaylistMissingError ;
103110
@@ -149,8 +156,11 @@ public ApiResponse<ApiGamePlaylistResponse> GetPlaylistById(RequestContext conte
149156 [ RateLimitSettings ( PlaylistModificationEndpointLimits . TimeoutDuration , PlaylistModificationEndpointLimits . RequestAmount ,
150157 PlaylistModificationEndpointLimits . BlockDuration , PlaylistModificationEndpointLimits . RequestBucket ) ]
151158 public ApiOkResponse AddLevelToPlaylist ( RequestContext context , DataContext dataContext ,
152- GameUser user , int playlistId , int levelId )
159+ GameUser user , int playlistId , int levelId , GameServerConfig config )
153160 {
161+ if ( user . IsWriteBlocked ( config ) )
162+ return ApiAuthenticationError . ReadOnlyError ;
163+
154164 GamePlaylist ? playlist = dataContext . Database . GetPlaylistById ( playlistId ) ;
155165 if ( playlist == null ) return ApiNotFoundError . ParentPlaylistMissingError ;
156166
@@ -172,8 +182,11 @@ public ApiOkResponse AddLevelToPlaylist(RequestContext context, DataContext data
172182 [ RateLimitSettings ( PlaylistModificationEndpointLimits . TimeoutDuration , PlaylistModificationEndpointLimits . RequestAmount ,
173183 PlaylistModificationEndpointLimits . BlockDuration , PlaylistModificationEndpointLimits . RequestBucket ) ]
174184 public ApiOkResponse RemoveLevelFromPlaylist ( RequestContext context , DataContext dataContext ,
175- GameUser user , int playlistId , int levelId )
185+ GameUser user , int playlistId , int levelId , GameServerConfig config )
176186 {
187+ if ( user . IsWriteBlocked ( config ) )
188+ return ApiAuthenticationError . ReadOnlyError ;
189+
177190 GamePlaylist ? playlist = dataContext . Database . GetPlaylistById ( playlistId ) ;
178191 if ( playlist == null ) return ApiNotFoundError . ParentPlaylistMissingError ;
179192
@@ -195,8 +208,11 @@ public ApiOkResponse RemoveLevelFromPlaylist(RequestContext context, DataContext
195208 [ RateLimitSettings ( PlaylistModificationEndpointLimits . TimeoutDuration , PlaylistModificationEndpointLimits . RequestAmount ,
196209 PlaylistModificationEndpointLimits . BlockDuration , PlaylistModificationEndpointLimits . RequestBucket ) ]
197210 public ApiOkResponse AddPlaylistToPlaylist ( RequestContext context , DataContext dataContext ,
198- GameUser user , int playlistId , int subPlaylistId )
211+ GameUser user , int playlistId , int subPlaylistId , GameServerConfig config )
199212 {
213+ if ( user . IsWriteBlocked ( config ) )
214+ return ApiAuthenticationError . ReadOnlyError ;
215+
200216 GamePlaylist ? parent = dataContext . Database . GetPlaylistById ( playlistId ) ;
201217 if ( parent == null ) return ApiNotFoundError . ParentPlaylistMissingError ;
202218
@@ -218,8 +234,11 @@ public ApiOkResponse AddPlaylistToPlaylist(RequestContext context, DataContext d
218234 [ RateLimitSettings ( PlaylistModificationEndpointLimits . TimeoutDuration , PlaylistModificationEndpointLimits . RequestAmount ,
219235 PlaylistModificationEndpointLimits . BlockDuration , PlaylistModificationEndpointLimits . RequestBucket ) ]
220236 public ApiOkResponse RemovePlaylistFromPlaylist ( RequestContext context , DataContext dataContext ,
221- GameUser user , int playlistId , int subPlaylistId )
237+ GameUser user , int playlistId , int subPlaylistId , GameServerConfig config )
222238 {
239+ if ( user . IsWriteBlocked ( config ) )
240+ return ApiAuthenticationError . ReadOnlyError ;
241+
223242 GamePlaylist ? parent = dataContext . Database . GetPlaylistById ( playlistId ) ;
224243 if ( parent == null ) return ApiNotFoundError . ParentPlaylistMissingError ;
225244
0 commit comments