Fixes and refactoring
This commit is contained in:
parent
99e6523f0c
commit
e0cfb144a3
23
api/php/cors.php
Normal file
23
api/php/cors.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
// Allow from any origin
|
||||
if (isset($_SERVER['HTTP_ORIGIN'])) {
|
||||
// Decide if the origin in $_SERVER['HTTP_ORIGIN'] is one
|
||||
// you want to allow, and if so:
|
||||
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
|
||||
header('Access-Control-Allow-Credentials: true');
|
||||
header('Access-Control-Max-Age: 86400'); // cache for 1 day
|
||||
}
|
||||
|
||||
// Access-Control headers are received during OPTIONS requests
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
|
||||
|
||||
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
|
||||
// may also be using PUT, PATCH, HEAD etc
|
||||
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
|
||||
|
||||
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
|
||||
header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
|
||||
|
||||
exit(0);
|
||||
}
|
@ -1,28 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Allow from any origin
|
||||
if (isset($_SERVER['HTTP_ORIGIN'])) {
|
||||
// Decide if the origin in $_SERVER['HTTP_ORIGIN'] is one
|
||||
// you want to allow, and if so:
|
||||
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
|
||||
header('Access-Control-Allow-Credentials: true');
|
||||
header('Access-Control-Max-Age: 86400'); // cache for 1 day
|
||||
}
|
||||
|
||||
// Access-Control headers are received during OPTIONS requests
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
|
||||
|
||||
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
|
||||
// may also be using PUT, PATCH, HEAD etc
|
||||
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
|
||||
|
||||
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
|
||||
header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
header('Content-type: text/plain');
|
||||
require_once 'cors.php';
|
||||
|
||||
$input = json_decode(file_get_contents('php://input'), true);
|
||||
|
||||
|
@ -1,26 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Allow from any origin
|
||||
if (isset($_SERVER['HTTP_ORIGIN'])) {
|
||||
// Decide if the origin in $_SERVER['HTTP_ORIGIN'] is one
|
||||
// you want to allow, and if so:
|
||||
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
|
||||
header('Access-Control-Allow-Credentials: true');
|
||||
header('Access-Control-Max-Age: 86400'); // cache for 1 day
|
||||
}
|
||||
|
||||
// Access-Control headers are received during OPTIONS requests
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
|
||||
|
||||
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
|
||||
// may also be using PUT, PATCH, HEAD etc
|
||||
header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
|
||||
|
||||
if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
|
||||
header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
|
||||
|
||||
exit(0);
|
||||
}
|
||||
require_once 'cors.php';
|
||||
|
||||
$input = json_decode(file_get_contents('php://input'), true);
|
||||
|
||||
|
@ -10,6 +10,12 @@ input[type=text], input[type=number], textarea {
|
||||
@apply appearance-none border leading-tight focus:outline-none;
|
||||
}
|
||||
|
||||
input:disabled, textarea:disabled {
|
||||
background-color: #ddd;
|
||||
color: linen;
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tools
|
||||
*/
|
||||
|
@ -34,9 +34,11 @@ export default {
|
||||
'str_sort_lines': 'Str sort lines',
|
||||
'str_to_lower_upper': 'Str to lower/upper',
|
||||
'str_remove_duplicate_lines': 'Str remove duplicate lines',
|
||||
'url_encode_decode': 'URL encode/decode',
|
||||
},
|
||||
'PHP': {
|
||||
'str_to_php_array': 'Str to PHP array',
|
||||
'php_array_to_json': 'PHP array to Json',
|
||||
'url_encode_decode': 'URL encode/decode',
|
||||
},
|
||||
'SQL': {
|
||||
'sql_split_in': 'SQL split IN',
|
||||
|
@ -40,7 +40,6 @@ export default {
|
||||
axios.post(`${config.APP_URL}/api/php/php_array_to_json.php`, {
|
||||
data: this.toolData.data,
|
||||
minify_json: this.toolData.minifyJson ? true : false,
|
||||
transformResponse: x => x
|
||||
})
|
||||
.then((response) => {
|
||||
this.toolResult = response.data.data;
|
||||
|
@ -34,7 +34,7 @@ export default {
|
||||
toolData: {
|
||||
data: '',
|
||||
dataDelimiter: '',
|
||||
dataIsJson: '',
|
||||
dataIsJson: false,
|
||||
},
|
||||
toolResult: '',
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user