Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Castopod
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ad Aures
Castopod
Commits
e12f95ac
Unverified
Commit
e12f95ac
authored
3 years ago
by
Yassine Doghri
Browse files
Options
Downloads
Patches
Plain Diff
feat: allow cross origin requests on episode comments
parent
797c96c1
No related branches found
No related tags found
1 merge request
!149
feat: allow cross origin requests on episode comments
Pipeline
#986
passed
3 years ago
Stage: prepare
Stage: quality
Stage: release
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/Config/Routes.php
+1
-0
1 addition, 0 deletions
app/Config/Routes.php
app/Controllers/EpisodeController.php
+14
-0
14 additions, 0 deletions
app/Controllers/EpisodeController.php
with
15 additions
and
0 deletions
app/Config/Routes.php
+
1
−
0
View file @
e12f95ac
...
...
@@ -736,6 +736,7 @@ $routes->group('@(:podcastName)', function ($routes): void {
],
],
]);
$routes
->
options
(
'comments'
,
'EpisodeController::commentsPreflight/$1/$2'
);
$routes
->
get
(
'comments'
,
'EpisodeController::comments/$1/$2'
,
[
'as'
=>
'episode-comments'
,
'application/activity+json'
=>
[
...
...
This diff is collapsed.
Click to expand it.
app/Controllers/EpisodeController.php
+
14
−
0
View file @
e12f95ac
...
...
@@ -210,6 +210,19 @@ class EpisodeController extends BaseController
->
setBody
(
$podcastObject
->
toJSON
());
}
/**
* @noRector ReturnTypeDeclarationRector
*/
public
function
commentsPreflight
():
Response
{
return
$this
->
response
->
setHeader
(
'Access-Control-Allow-Origin'
,
'*'
)
// for allowing any domain, insecure
->
setHeader
(
'Access-Control-Allow-Headers'
,
'*'
)
// for allowing any headers, insecure
->
setHeader
(
'Access-Control-Allow-Methods'
,
'GET, OPTIONS'
)
// allows GET and OPTIONS methods only
->
setHeader
(
'Access-Control-Max-Age'
,
'86400'
)
->
setHeader
(
'Cache-Control'
,
'public, max-age=86400'
)
->
setStatusCode
(
200
);
}
/**
* @noRector ReturnTypeDeclarationRector
*/
...
...
@@ -250,6 +263,7 @@ class EpisodeController extends BaseController
return
$this
->
response
->
setContentType
(
'application/activity+json'
)
->
setHeader
(
'Access-Control-Allow-Origin'
,
'*'
)
->
setBody
(
$collection
->
toJSON
());
}
}
This diff is collapsed.
Click to expand it.
Yassine Doghri
@yassinedoghri
mentioned in commit
af7d6254
·
3 years ago
mentioned in commit
af7d6254
mentioned in commit af7d625462ff679d32560ba2f8067680813ce9c1
Toggle commit list
Yassine Doghri
@yassinedoghri
mentioned in commit
d807ab97
·
3 years ago
mentioned in commit
d807ab97
mentioned in commit d807ab9732d8e4ad1eae956f0b728f8a5c0f868d
Toggle commit list
Yassine Doghri
@yassinedoghri
mentioned in commit
f9572e41
·
2 years ago
mentioned in commit
f9572e41
mentioned in commit f9572e4125ed53c215cc4a3c4d1a32708e6febe3
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment