init coors for playt2.com

This commit is contained in:
Anthony Mineo 2020-04-26 11:14:05 -04:00
parent b1bf08267e
commit 43c15e1649
4 changed files with 98 additions and 2 deletions

87
app/webapp/config/cors.js Normal file
View file

@ -0,0 +1,87 @@
'use strict'
module.exports = {
/*
|--------------------------------------------------------------------------
| Origin
|--------------------------------------------------------------------------
|
| Set a list of origins to be allowed. The value can be one of the following
|
| Boolean: true - Allow current request origin
| Boolean: false - Disallow all
| String - Comma seperated list of allowed origins
| Array - An array of allowed origins
| String: * - A wildcard to allow current request origin
| Function - Receives the current origin and should return one of the above values.
|
*/
origin: ['playt2.com'],
/*
|--------------------------------------------------------------------------
| Methods
|--------------------------------------------------------------------------
|
| HTTP methods to be allowed. The value can be one of the following
|
| String - Comma seperated list of allowed methods
| Array - An array of allowed methods
|
*/
methods: ['GET', 'PUT', 'POST', 'OPTIONS', 'HEAD'],
/*
|--------------------------------------------------------------------------
| Headers
|--------------------------------------------------------------------------
|
| List of headers to be allowed via Access-Control-Request-Headers header.
| The value can be on of the following.
|
| Boolean: true - Allow current request headers
| Boolean: false - Disallow all
| String - Comma seperated list of allowed headers
| Array - An array of allowed headers
| String: * - A wildcard to allow current request headers
| Function - Receives the current header and should return one of the above values.
|
*/
headers: true,
/*
|--------------------------------------------------------------------------
| Expose Headers
|--------------------------------------------------------------------------
|
| A list of headers to be exposed via `Access-Control-Expose-Headers`
| header. The value can be on of the following.
|
| Boolean: false - Disallow all
| String: Comma seperated list of allowed headers
| Array - An array of allowed headers
|
*/
exposeHeaders: false,
/*
|--------------------------------------------------------------------------
| Credentials
|--------------------------------------------------------------------------
|
| Define Access-Control-Allow-Credentials header. It should always be a
| boolean.
|
*/
credentials: false,
/*
|--------------------------------------------------------------------------
| MaxAge
|--------------------------------------------------------------------------
|
| Define Access-Control-Max-Age
|
*/
maxAge: 90
}

View file

@ -3,7 +3,6 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Access-Control-Allow-Origin" content="https://www.playt2.com"/>
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Tribes 2 Stats</title>
@ -49,6 +48,12 @@
function closePopUp(){
document.getElementById("popup").remove();
};
if(top != self){
setInterval(() => {
parent.postMessage(document.getElementById('app').clientHeight, '*');
}, 1000);
}
</script>
</body>

View file

@ -14,6 +14,7 @@ const providers = [
'@adonisjs/framework/providers/AppProvider',
'@adonisjs/framework/providers/ViewProvider',
'@adonisjs/lucid/providers/LucidProvider',
'@adonisjs/cors/providers/CorsProvider',
'inertia-adonis/providers/InertiaProvider'
]

View file

@ -38,4 +38,7 @@ const namedMiddleware = {}
Server
.registerGlobal(globalMiddleware)
.registerNamed(namedMiddleware)
.use(['Adonis/Middleware/Static'])
.use([
'Adonis/Middleware/Static',
'Adonis/Middleware/Cors'
])