mirror of
https://github.com/JGH0/Todo-App-Backend.git
synced 2026-06-03 13:28:47 +02:00
Compare commits
9 Commits
3615d029ea
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b30c66307 | ||
|
|
d038ebc2e3 | ||
|
|
e19828868f | ||
|
|
bf05b5d295 | ||
|
|
3b65f482c7 | ||
|
|
7cea9e5ea4 | ||
|
|
43f0a742b6 | ||
|
|
3438888314 | ||
|
|
af21317040 |
@@ -68,7 +68,7 @@ class Cors extends BaseConfig
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers
|
||||
*/
|
||||
'allowedHeaders' => ['Content-Type', 'Authorization', 'X-API-Key'],
|
||||
'allowedHeaders' => ['Content-Type', 'Authorization', 'X-API-Key', 'Accept', 'Fetch'],
|
||||
|
||||
/**
|
||||
* Set headers to expose.
|
||||
@@ -93,7 +93,7 @@ class Cors extends BaseConfig
|
||||
*
|
||||
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods
|
||||
*/
|
||||
'allowedMethods' => ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
|
||||
'allowedMethods' => ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS', 'FETCH'],
|
||||
|
||||
/**
|
||||
* Set how many seconds the results of a preflight request can be cached.
|
||||
|
||||
@@ -5,7 +5,9 @@ use CodeIgniter\Router\RouteCollection;
|
||||
/**
|
||||
* @var RouteCollection $routes
|
||||
*/
|
||||
$routes->get('/', 'Home::index');
|
||||
$routes->get('/', static function () {
|
||||
return redirect()->to('/themes');
|
||||
});
|
||||
$routes->get('/themes', 'ThemeStore::index');
|
||||
$routes->post('/themes/upload', 'ThemeStore::upload');
|
||||
$routes->get('/themes/preview/(:segment)', 'ThemeStore::preview/$1');
|
||||
@@ -96,18 +98,20 @@ $routes->group('api/v1', ['namespace' => 'App\Controllers\Api\V1', 'filter' => [
|
||||
});
|
||||
$routes->get('/themes', 'ThemeStore::index');
|
||||
$routes->options('/themes', static function () {
|
||||
header('Access-Control-Allow-Origin: http://localhost:5173');
|
||||
$origin = service('request')->getHeaderLine('Origin') ?: '*';
|
||||
header('Access-Control-Allow-Origin: ' . $origin);
|
||||
header('Access-Control-Allow-Methods: GET, OPTIONS');
|
||||
header('Access-Control-Allow-Headers: Content-Type, Accept, Fetch');
|
||||
header('Access-Control-Allow-Credentials: true');
|
||||
header('Access-Control-Allow-Headers: Content-Type, Accept');
|
||||
header('Vary: Origin');
|
||||
return response()->setStatusCode(204);
|
||||
});
|
||||
$routes->post('/themes/upload', 'ThemeStore::upload');
|
||||
$routes->options('/themes/upload', static function () {
|
||||
header('Access-Control-Allow-Origin: http://localhost:5173');
|
||||
$origin = service('request')->getHeaderLine('Origin') ?: '*';
|
||||
header('Access-Control-Allow-Origin: ' . $origin);
|
||||
header('Access-Control-Allow-Methods: POST, OPTIONS');
|
||||
header('Access-Control-Allow-Headers: Content-Type, Accept, Fetch');
|
||||
header('Access-Control-Allow-Credentials: true');
|
||||
header('Access-Control-Allow-Headers: Content-Type, Accept');
|
||||
header('Vary: Origin');
|
||||
return response()->setStatusCode(204);
|
||||
});
|
||||
$routes->get('/themes/preview/(:segment)', 'ThemeStore::preview/$1');
|
||||
|
||||
@@ -24,8 +24,9 @@ class ThemeStore extends BaseController
|
||||
}
|
||||
|
||||
if ($this->request->isAJAX() || $this->request->hasHeader('Fetch') || str_contains($this->request->getHeaderLine('Accept'), 'application/json')) {
|
||||
header('Access-Control-Allow-Origin: http://localhost:5173');
|
||||
header('Access-Control-Allow-Credentials: true');
|
||||
$origin = $this->request->getHeaderLine('Origin') ?: '*';
|
||||
header('Access-Control-Allow-Origin: ' . $origin);
|
||||
header('Vary: Origin');
|
||||
return $this->response->setJSON($themes);
|
||||
}
|
||||
|
||||
@@ -38,8 +39,9 @@ class ThemeStore extends BaseController
|
||||
|
||||
public function upload(): Response
|
||||
{
|
||||
header('Access-Control-Allow-Origin: http://localhost:5173');
|
||||
header('Access-Control-Allow-Credentials: true');
|
||||
$origin = $this->request->getHeaderLine('Origin') ?: '*';
|
||||
header('Access-Control-Allow-Origin: ' . $origin);
|
||||
header('Vary: Origin');
|
||||
|
||||
$file = $this->request->getFile('theme_css');
|
||||
$displayName = trim($this->request->getPost('display_name') ?? '');
|
||||
|
||||
0
public/themes/2341342134-1441f7.css
Executable file → Normal file
0
public/themes/2341342134-1441f7.css
Executable file → Normal file
0
public/themes/arctic-frost.css
Executable file → Normal file
0
public/themes/arctic-frost.css
Executable file → Normal file
38
public/themes/dine-mera-3652ad.css
Normal file
38
public/themes/dine-mera-3652ad.css
Normal file
File diff suppressed because one or more lines are too long
0
public/themes/extract-test-theme-5fae6e.css
Executable file → Normal file
0
public/themes/extract-test-theme-5fae6e.css
Executable file → Normal file
0
public/themes/forest-grove.css
Executable file → Normal file
0
public/themes/forest-grove.css
Executable file → Normal file
0
public/themes/manual-game-update-2-e1a77a.css
Executable file → Normal file
0
public/themes/manual-game-update-2-e1a77a.css
Executable file → Normal file
0
public/themes/manual-game-update-7cc79d.css
Executable file → Normal file
0
public/themes/manual-game-update-7cc79d.css
Executable file → Normal file
0
public/themes/midnight-void.css
Executable file → Normal file
0
public/themes/midnight-void.css
Executable file → Normal file
0
public/themes/obsidian-rose.css
Executable file → Normal file
0
public/themes/obsidian-rose.css
Executable file → Normal file
0
public/themes/ocean-breeze.css
Executable file → Normal file
0
public/themes/ocean-breeze.css
Executable file → Normal file
0
public/themes/red-extract-theme-a3aabe.css
Executable file → Normal file
0
public/themes/red-extract-theme-a3aabe.css
Executable file → Normal file
0
public/themes/sunset-ember.css
Executable file → Normal file
0
public/themes/sunset-ember.css
Executable file → Normal file
0
public/themes/test-theme-103fb1.css
Executable file → Normal file
0
public/themes/test-theme-103fb1.css
Executable file → Normal file
0
public/themes/test-theme-6fcabb.css
Executable file → Normal file
0
public/themes/test-theme-6fcabb.css
Executable file → Normal file
0
public/themes/themestore-theme-by-came-0da6fd.css
Executable file → Normal file
0
public/themes/themestore-theme-by-came-0da6fd.css
Executable file → Normal file
Reference in New Issue
Block a user