diff --git a/README.md b/README.md
index 096f2f8..2b30747 100644
--- a/README.md
+++ b/README.md
@@ -6,6 +6,7 @@
- make sure that you have `pdo_sqlite`
- oonix `chmod +x ./dev.sh` and then `./dev.sh`
- uindos `cat ./dev.sh | iex` in poersel
+ - for production generate dist with `./bundle.sh`
### IMPORTANT
@@ -14,5 +15,7 @@
- dx4dashboard
- change `base` in `vite.config.ts`
- change `API_BASE_URL` and `CLIENT_FRONTEND_URL` in `src/App.jsx`
-- backend
- - change `ADMIN_PASS` and `API_PATH` in `admin_api.php`
\ No newline at end of file
+- **backend !!**
+ - change `ADMIN_PASS` and `API_PATH` in `admin_api.php`
+ - change `$password` in `adm/phpliteadmin.config.php`
+ - **block http requests to `data.db`!!!**
\ No newline at end of file
diff --git a/backend-php/.gitignore b/backend-php/.gitignore
index 0af5d57..0700963 100644
--- a/backend-php/.gitignore
+++ b/backend-php/.gitignore
@@ -1,4 +1,6 @@
api.lock
_api.lock
-data.db
\ No newline at end of file
+data.db
+dist
+k-api.updates.php
\ No newline at end of file
diff --git a/backend-php/admin_api.php b/backend-php/admin_api.php
index c58ef19..4473500 100644
--- a/backend-php/admin_api.php
+++ b/backend-php/admin_api.php
@@ -13,7 +13,7 @@ function db()
};
-function relativePathToUrl($rel)
+function relativePathToUrl(string $rel)
{
$parts = explode('/', dirname($_SERVER['SCRIPT_NAME']) . '/' . $rel);
$norm = [];
@@ -37,7 +37,7 @@ function FastDBReq(PDO $db, string $sql, array $params = []): array
}
}
-function Login($req)
+function Login(mixed $req)
{
return isset($req->data['pass']) && $req->data['pass'] == ADMIN_PASS;
}
@@ -46,7 +46,7 @@ CreateApi(function ($api) {
$api->on('/', 'GET', function ($req) {
return 'hi';
});
- $api->on('/phpliteadmin', 'GET', function ($req) {
+ $api->on('/phpliteadmin', 'GET', function () {
header('Location: ./adm/phpliteadmin.php');
return "";
});
diff --git a/backend-php/api.php b/backend-php/api.php
index aa99092..fa27072 100644
--- a/backend-php/api.php
+++ b/backend-php/api.php
@@ -99,6 +99,8 @@ CreateApi(function ($api) {
die($cnt);
}
+ $api->useUpdates(db());
+
$api->on('/', 'GET', function () {
return 'dengi';
});
diff --git a/backend-php/bundle.sh b/backend-php/bundle.sh
new file mode 100755
index 0000000..487f90e
--- /dev/null
+++ b/backend-php/bundle.sh
@@ -0,0 +1,23 @@
+set -e
+# copy only nessesary files
+
+echo "Copying files..."
+mkdir -p dist
+cp -r *.php sql-updates/ adm/ dist/
+
+set +e
+echo "Downloading phpLiteAdmin"
+wget -nc https://bitbucket.org/phpliteadmin/public/downloads/phpLiteAdmin_v1-9-8-2.zip
+unzip phpLiteAdmin_v1-9-8-2.zip phpliteadmin.php
+mv phpliteadmin.php dist/adm
+
+echo "Cleaning up"
+
+rm -f phpLiteAdmin_v1-9-8-2.zip
+set -e
+rm -f dist/k-api.updates-status.php
+
+echo "
+
+
+Done."
\ No newline at end of file
diff --git a/backend-php/k-api.php b/backend-php/k-api.php
index 36d024c..3bbee44 100644
--- a/backend-php/k-api.php
+++ b/backend-php/k-api.php
@@ -1,4 +1,6 @@
$currentVersion) {
+ $db->exec(file_get_contents($file));
+ $updateVersion = $version;
+ }
+ }
+ if ($updateVersion !== null) {
+ file_put_contents(
+ UPDATES_STATUS_FILE,
+ "has_exec) {
diff --git a/backend-php/k-api.updates-status.php b/backend-php/k-api.updates-status.php
new file mode 100644
index 0000000..2d64f23
--- /dev/null
+++ b/backend-php/k-api.updates-status.php
@@ -0,0 +1 @@
+ = {
class: "классы",
- admin: "админы",
server: "сервер",
};
@@ -85,8 +84,6 @@ export default function DashPage({
setRoute={(p: string) => setsetRoute(setRoute, p)}
/>
);
- case "admin":
- return
e.preventDefault()} />
- {/*
e.preventDefault()}/> */}
- | имя | -//
-// |
-//
| id | -//
-// |
-//
| class | -//
-// {classId ? classId : |
-//