generovane subory apilite,

fix globalnych $_SERVER v konfiguracii
This commit is contained in:
2026-02-09 07:48:07 +01:00
parent d9a283cfdf
commit e59bfc26a0
8 changed files with 46 additions and 9 deletions

View File

@ -22,6 +22,7 @@
"tpsoft/dbmodel": "^1.1" "tpsoft/dbmodel": "^1.1"
}, },
"scripts": { "scripts": {
"model": "php scripts/createModel.php" "model": "php scripts/createModel.php",
"build": "php scripts/buildTypeScript.php"
} }
} }

11
backend/composer.lock generated
View File

@ -4,19 +4,22 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "9b92dc81ccf6b0cc7f350c56793c6523", "content-hash": "a71cf25cd9eac873c72969207706f3c8",
"packages": [ "packages": [
{ {
"name": "tpsoft/apilite", "name": "tpsoft/apilite",
"version": "v1.0.3", "version": "v1.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://gitea.tpsoft.org/TPsoft.org/APIlite.git", "url": "https://gitea.tpsoft.org/TPsoft.org/APIlite.git",
"reference": "c0fd7b3fe5270ee44a84a92e9255ada2438812b7" "reference": "fab8efd780ede046ced076f237351cdba5a8a51f"
}, },
"require": { "require": {
"php": ">=8.2" "php": ">=8.2"
}, },
"bin": [
"bin/apilite-files"
],
"type": "library", "type": "library",
"autoload": { "autoload": {
"psr-4": { "psr-4": {
@ -49,7 +52,7 @@
"type": "other" "type": "other"
} }
], ],
"time": "2025-10-13T21:36:34+00:00" "time": "2026-02-09T06:33:17+00:00"
}, },
{ {
"name": "tpsoft/dbmodel", "name": "tpsoft/dbmodel",

View File

@ -25,7 +25,7 @@ if (!$loaded) {
} }
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https://" : "http://"; $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https://" : "http://";
$host = $_SERVER['HTTP_HOST']; $host = $_SERVER['HTTP_HOST'] ?? 'localhost';
$uri = $_SERVER['REQUEST_URI']; // obsahuje aj query string $uri = $_SERVER['REQUEST_URI'] ?? ''; // obsahuje aj query string
define('URL_PREFIX', $protocol.$host.str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME'])); define('URL_PREFIX', $protocol.$host.str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']));

4
backend/public/API.php Normal file
View File

@ -0,0 +1,4 @@
<?php
require_once __DIR__.'/../src/API.php';
new \TPsoft\Nutrio\API();

View File

@ -0,0 +1,19 @@
<?php
require __DIR__ . '/../vendor/autoload.php';
ob_start();
$backend_api = new TPsoft\BugreportBackend\API('typescript', 'import.meta.env.VITE_BACKENDAPI_URL', 'backend');
$output = ob_get_contents();
ob_end_clean();
$ts_path = realpath(__DIR__ . '/../../frontend/src').'/backend.js';
$suc = file_put_contents($ts_path, $output);
if ($suc === false) {
echo "✗ TypeScript store into file failed\n";
exit(2);
}
echo "✓ TypeScript backend script created\n";

11
backend/src/API.php Normal file
View File

@ -0,0 +1,11 @@
<?php
namespace TPsoft\Nutrio;
require_once __DIR__.'/Init.php';
use TPsoft\APIlite\APIlite;
class API extends APIlite {
}

View File

@ -2,7 +2,6 @@
require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/../vendor/autoload.php';
use \Exception;
use \TPsoft\DBmodel\DBmodel; use \TPsoft\DBmodel\DBmodel;
use \TPsoft\Nutrio\Maintenance; use \TPsoft\Nutrio\Maintenance;

View File

@ -1,6 +1,6 @@
<?php <?php
namespace TPsoft\Nutrio\; namespace TPsoft\Nutrio;
class Maintenance extends \TPsoft\DBmodel\Maintenance class Maintenance extends \TPsoft\DBmodel\Maintenance
{ {