File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed
Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " nodepress" ,
3- "version" : " 5.3.0 " ,
3+ "version" : " 5.3.1 " ,
44 "description" : " RESTful API service for Surmon.me blog" ,
55 "author" : " Surmon" ,
66 "license" : " MIT" ,
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import { GUESTBOOK_POST_ID } from '@app/constants/biz.constant'
1010
1111export const DISQUS_OAUTH_CALLBACK_URL = isProdEnv
1212 ? `${ APP_BIZ . URL } /disqus/oauth-callback`
13- : `http://localhost:8000 /disqus/oauth-callback`
13+ : `http://localhost:${ APP_BIZ . PORT } /disqus/oauth-callback`
1414
1515// extends
1616export const COMMENT_POST_ID_EXTEND_KEY = 'disqus-post-id'
Original file line number Diff line number Diff line change @@ -41,6 +41,11 @@ export class DisqusController {
4141 }
4242 }
4343
44+ @Get ( 'close-window.js' )
45+ closeWindowScript ( @Response ( ) response : FastifyReply ) {
46+ response . type ( 'application/javascript' ) . send ( 'window.close();' )
47+ }
48+
4449 @Get ( 'oauth-callback' )
4550 async oauthCallback ( @Query ( ) query : CallbackCodeDTO , @Response ( ) response : FastifyReply ) {
4651 const accessToken = await this . disqusPublicService . getAccessToken ( query . code )
@@ -57,9 +62,10 @@ export class DisqusController {
5762 secure : 'auto'
5863 } )
5964 // Close the popup window
60- response . header ( 'content-security-policy' , "script-src 'unsafe-inline'" )
6165 response . header ( 'content-type' , 'text/html' )
62- response . send ( `<script>window.close();</script>` )
66+ response . send ( `<!DOCTYPE html><html><script src="/disqus/close-window.js"></script></html>` )
67+ // To maintain a secure `content-security-policy`, inline JavaScript is not used here.
68+ // response.send(`<script>window.close();</script>`)
6369 }
6470
6571 @Post ( 'oauth-logout' )
You can’t perform that action at this time.
0 commit comments