Skip to content

Commit 4603e1f

Browse files
Merge pull request #2 from hind-sagar-biswas/1-problem-with-setup
1 problem with setup
2 parents af09032 + 2bade50 commit 4603e1f

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

exec/setup.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
function get_input($prompt, $default = null)
44
{
5-
$default = ($default) ? "[$default]" : '';
6-
$input = readline("$prompt $default: ");
5+
$default_show = ($default) ? "[$default]" : '';
6+
$input = readline("$prompt $default_show: ");
77
return (trim($input) == "") ? $default : $input;
88
}
99

@@ -60,6 +60,23 @@ function print_line($text, int $multiplier = 1)
6060
$fp = fopen($file, "w");
6161
fwrite($fp, $template);
6262
fclose($fp);
63+
// Set to .htaccess
64+
$file = __DIR__ . "/../.htaccess";
65+
$fp = fopen($file, "w");
66+
fwrite($fp, "RewriteEngine On
67+
RewriteBase " . $vars['APP_ROOT'] . "/
68+
69+
RewriteCond %{DOCUMENT_ROOT}/assets/$1 -f
70+
RewriteRule ^(.*)$ assets/$1 [L]
71+
72+
RewriteCond %{DOCUMENT_ROOT}/node_modules/$1 -f
73+
RewriteRule ^(.*)$ node_modules/$1 [L]
74+
75+
RewriteCond %{THE_REQUEST} \s/assets/ [NC,OR]
76+
RewriteCond %{THE_REQUEST} \s/node_modules/ [NC,OR]
77+
RewriteCond %{REQUEST_FILENAME} !-f
78+
RewriteRule ^ index.php [L,QSA]");
79+
fclose($fp);
6380

6481
// Set variable values
6582

scripts/functions/router.script.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ private static function api_route($path)
4646
{
4747
$routes = API_ROUTES[REQUEST['method']];
4848
if (array_key_exists($path, $routes)) {
49+
header("Access-Control-Allow-Origin: *");
4950
header("Content-Type: application/json");
5051
require API_VIEW . $routes[$path][0];
5152
} else require APP_ERROR_PAGES . API_ROUTES['err']['404'];

0 commit comments

Comments
 (0)