Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stricter requirements to existing routes #1150

Merged
merged 6 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions config/kbin_routes/ajax.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,40 @@ ajax_fetch_post_comments:
defaults: { _format: json }
path: /ajax/fetch_post_comments/{id}
methods: [GET]
requirements:
id: \d+

ajax_fetch_entry:
controller: App\Controller\AjaxController::fetchEntry
defaults: { _format: json }
path: /ajax/fetch_entry/{id}
methods: [GET]
requirements:
id: \d+

ajax_fetch_entry_comment:
controller: App\Controller\AjaxController::fetchEntryComment
defaults: { _format: json }
path: /ajax/fetch_entry_comment/{id}
methods: [GET]
requirements:
id: \d+

ajax_fetch_post:
controller: App\Controller\AjaxController::fetchPost
defaults: { _format: json }
path: /ajax/fetch_post/{id}
methods: [GET]
requirements:
id: \d+

ajax_fetch_post_comment:
controller: App\Controller\AjaxController::fetchPostComment
defaults: { _format: json }
path: /ajax/fetch_post_comment/{id}
methods: [GET]
requirements:
id: \d+

ajax_fetch_online:
controller: App\Controller\AjaxController::fetchOnline
Expand Down
92 changes: 86 additions & 6 deletions config/kbin_routes/entry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,73 +3,109 @@ entry_comment_create:
defaults: { slug: -, parent_comment_id: null }
path: /m/{magazine_name}/t/{entry_id}/{slug}/comment/create/{parent_comment_id}
methods: [ GET, POST ]
requirements:
entry_id: \d+
parent_comment_id: \d+

entry_comment_view:
controller: App\Controller\Entry\Comment\EntryCommentViewController
defaults: { slug: -, comment_id: null }
path: /m/{magazine_name}/t/{entry_id}/{slug}/comment/{comment_id}
methods: [ GET ]
controller: App\Controller\Entry\Comment\EntryCommentViewController
defaults: { slug: -, comment_id: null }
path: /m/{magazine_name}/t/{entry_id}/{slug}/comment/{comment_id}
methods: [ GET ]
requirements:
entry_id: \d+
comment_id: \d+

entry_comment_edit:
controller: App\Controller\Entry\Comment\EntryCommentEditController
defaults: { slug: -, }
path: /m/{magazine_name}/t/{entry_id}/{slug}/comment/{comment_id}/edit
methods: [ GET, POST ]
requirements:
entry_id: \d+
comment_id: \d+

entry_comment_delete:
controller: App\Controller\Entry\Comment\EntryCommentDeleteController::delete
defaults: { slug: -, }
path: /m/{magazine_name}/t/{entry_id}/{slug}/comments/{comment_id}/delete
methods: [ POST ]
requirements:
entry_id: \d+
comment_id: \d+

entry_comment_restore:
controller: App\Controller\Entry\Comment\EntryCommentDeleteController::restore
defaults: { slug: -, }
path: /m/{magazine_name}/t/{entry_id}/{slug}/comments/{comment_id}/restore
methods: [ POST ]
requirements:
entry_id: \d+
comment_id: \d+

entry_comment_purge:
controller: App\Controller\Entry\Comment\EntryCommentDeleteController::purge
defaults: { slug: -, }
path: /m/{magazine_name}/t/{entry_id}/{slug}/comments/{comment_id}/purge
methods: [ POST ]
requirements:
entry_id: \d+
comment_id: \d+

entry_comment_change_lang:
controller: App\Controller\Entry\Comment\EntryCommentChangeLangController
defaults: { slug: - }
path: /m/{magazine_name}/t/{entry_id}/{slug}/comments/{comment_id}/change_lang
methods: [ POST ]
requirements:
entry_id: \d+
comment_id: \d+

entry_comment_change_adult:
controller: App\Controller\Entry\Comment\EntryCommentChangeAdultController
defaults: { slug: - }
path: /m/{magazine_name}/t/{entry_id}/{slug}/comments/{comment_id}/change_adult
methods: [ POST ]
requirements:
entry_id: \d+
comment_id: \d+

entry_comment_image_delete:
controller: App\Controller\Entry\Comment\EntryCommentDeleteImageController
defaults: { slug: -, }
path: /m/{magazine_name}/t/{entry_id}/{slug}/comments/{comment_id}/delete_image
methods: [ POST ]
requirements:
entry_id: \d+
comment_id: \d+

entry_comment_voters:
controller: App\Controller\Entry\Comment\EntryCommentVotersController
defaults: { slug: -, }
requirements: { type: 'up' }
path: /m/{magazine_name}/t/{entry_id}/{slug}/comment/{comment_id}/votes/{type}
methods: [ GET ]
requirements:
type: 'up'
entry_id: \d+
comment_id: \d+

entry_comment_favourites:
controller: App\Controller\Entry\Comment\EntryCommentFavouriteController
defaults: { slug: -, }
path: /m/{magazine_name}/t/{entry_id}/{slug}/comment/{comment_id}/favourites
methods: [ GET ]
requirements:
entry_id: \d+
comment_id: \d+

entry_comment_moderate:
controller: App\Controller\Entry\Comment\EntryCommentModerateController
defaults: { slug: -, }
path: /m/{magazine_name}/t/{entry_id}/{slug}/comment/{comment_id}/moderate
methods: [ GET ]
requirements:
entry_id: \d+
comment_id: \d+

entry_comments_front:
controller: App\Controller\Entry\Comment\EntryCommentFrontController::front
Expand Down Expand Up @@ -121,24 +157,32 @@ entry_comment_vote:
defaults: { entityClass: App\Entity\EntryComment }
path: /ecv/{id}/{choice}
methods: [ POST ]
requirements:
id: \d+

entry_comment_report:
controller: App\Controller\ReportController
defaults: { entityClass: App\Entity\EntryComment }
path: /ecr/{id}
methods: [ GET, POST ]
requirements:
id: \d+

entry_comment_favourite:
controller: App\Controller\FavouriteController
defaults: { entityClass: App\Entity\EntryComment }
path: /ecf/{id}
methods: [ POST ]
requirements:
id: \d+

entry_comment_boost:
controller: App\Controller\BoostController
defaults: { entityClass: App\Entity\EntryComment }
path: /ecb/{id}
methods: [ POST ]
requirements:
id: \d+

entry_create:
controller: App\Controller\Entry\EntryCreateController
Expand All @@ -157,79 +201,105 @@ entry_edit:
defaults: { slug: -, sortBy: hot }
path: /m/{magazine_name}/t/{entry_id}/{slug}/edit
methods: [ GET, POST ]
requirements:
entry_id: \d+

entry_moderate:
controller: App\Controller\Entry\EntryModerateController
defaults: { slug: -, sortBy: hot }
path: /m/{magazine_name}/t/{entry_id}/{slug}/moderate
methods: [ GET ]
requirements:
entry_id: \d+

entry_delete:
controller: App\Controller\Entry\EntryDeleteController::delete
defaults: { slug: -, sortBy: hot }
path: /m/{magazine_name}/t/{entry_id}/{slug}/delete
methods: [ POST ]
requirements:
entry_id: \d+

entry_restore:
controller: App\Controller\Entry\EntryDeleteController::restore
defaults: { slug: -, sortBy: hot }
path: /m/{magazine_name}/t/{entry_id}/{slug}/restore
methods: [ POST ]
requirements:
entry_id: \d+

entry_purge:
controller: App\Controller\Entry\EntryDeleteController::purge
defaults: { slug: -, sortBy: hot }
path: /m/{magazine_name}/t/{entry_id}/{slug}/purge
methods: [ POST ]
requirements:
entry_id: \d+

entry_image_delete:
controller: App\Controller\Entry\EntryDeleteImageController
defaults: { slug: -, }
path: /m/{magazine_name}/e/{entry_id}/{slug}/delete_image
methods: [ POST ]
requirements:
entry_id: \d+

entry_change_magazine:
controller: App\Controller\Entry\EntryChangeMagazineController
defaults: { slug: - }
path: /m/{magazine_name}/e/{entry_id}/{slug}/change_magazine
methods: [ POST ]
requirements:
entry_id: \d+

entry_change_lang:
controller: App\Controller\Entry\EntryChangeLangController
defaults: { slug: - }
path: /m/{magazine_name}/e/{entry_id}/{slug}/change_lang
methods: [ POST ]
requirements:
entry_id: \d+

entry_change_adult:
controller: App\Controller\Entry\EntryChangeAdultController
defaults: { slug: - }
path: /m/{magazine_name}/e/{entry_id}/{slug}/change_adult
methods: [ POST ]
requirements:
entry_id: \d+

entry_pin:
controller: App\Controller\Entry\EntryPinController
defaults: { slug: -, sortBy: hot }
path: /m/{magazine_name}/t/{entry_id}/{slug}/pin
methods: [ POST ]
requirements:
entry_id: \d+

entry_voters:
controller: App\Controller\Entry\EntryVotersController
defaults: { slug: -, sortBy: hot }
requirements: { type: 'up' }
path: /m/{magazine_name}/t/{entry_id}/{slug}/votes/{type}
methods: [ GET ]
requirements:
type: 'up'
entry_id: \d+

entry_fav:
controller: App\Controller\Entry\EntryFavouriteController
defaults: { slug: -, sortBy: hot }
path: /m/{magazine_name}/t/{entry_id}/{slug}/favourites
methods: [ GET ]
requirements:
entry_id: \d+

entry_tips:
controller: App\Controller\Entry\EntryTipController
defaults: { slug: -, sortBy: hot }
path: /m/{magazine_name}/t/{entry_id}/{slug}/tips
methods: [ GET ]
requirements:
entry_id: \d+

entry_single:
controller: App\Controller\Entry\EntrySingleController
Expand All @@ -238,6 +308,7 @@ entry_single:
methods: [ GET ]
requirements:
sortBy: "%comment_sort_options%"
entry_id: \d+

entry_single_comments:
controller: App\Controller\Entry\EntrySingleController
Expand All @@ -246,27 +317,36 @@ entry_single_comments:
methods: [ GET ]
requirements:
sortBy: "%comment_sort_options%"
entry_id: \d+

entry_vote:
controller: App\Controller\VoteController
defaults: { entityClass: App\Entity\Entry }
path: /ev/{id}/{choice}
methods: [ POST ]
requirements:
id: \d+

entry_report:
controller: App\Controller\ReportController
defaults: { entityClass: App\Entity\Entry }
path: /er/{id}
methods: [ GET, POST ]
requirements:
id: \d+

entry_favourite:
controller: App\Controller\FavouriteController
defaults: { entityClass: App\Entity\Entry }
path: /ef/{id}
methods: [ POST ]
requirements:
id: \d+

entry_boost:
controller: App\Controller\BoostController
defaults: { entityClass: App\Entity\Entry }
path: /eb/{id}
methods: [ POST ]
requirements:
id: \d+
2 changes: 2 additions & 0 deletions config/kbin_routes/message.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ messages_single:
controller: App\Controller\Message\MessageThreadController
path: /profile/messages/{id}
methods: [ GET, POST ]
requirements:
id: \d+

messages_create:
controller: App\Controller\Message\MessageCreateThreadController
Expand Down
Loading
Loading