diff --git a/.github/agent.md b/.github/agent.md new file mode 100644 index 00000000..558c2550 --- /dev/null +++ b/.github/agent.md @@ -0,0 +1,157 @@ +# GSP (GameServerPanel) – Copilot Instructions + +**Repo of truth:** `GameServerPanel/GSP`, branch `Panel-unstable`. +**Prime directive:** Read this document first. Keep `.github/agent.md` identical to this file—any edit here must be mirrored there in the same commit. + +## Deployment model & paths +- `modules/billing/` houses the public storefront. Those files are always present inside the panel repo and get deployed either (a) as the root of a dedicated virtual host or (b) through the panel module loader (`home.php?m=billing`). +- Because the storefront and the control panel live in the same tree, you may include panel helpers when needed. Use the dedicated bridge include (`modules/billing/includes/panel_bridge.php`) instead of sprinkling ad-hoc `../../includes/...` calls. +- We keep Apache/Nginx vhosts pointed at `modules/billing/`, so every storefront URL must look root-relative (see critical section below). Never expose `/modules/billing` in any URL sent to a browser or external service. +- Before touching billing logic or module wiring, skim `.github/module-map.md` to remember how the panel modules depend on each other. + +## CRITICAL: Website file paths and URLs (modules/billing) +- **The billing website files in `modules/billing/` are deployed at the WEBSITE ROOT when live.** +- **Never output `/modules/billing/` in any link, redirect, script tag, or webhook URL. All user-facing URLs must be root-relative**, e.g. `/payment_success.php`, `/cart.php`. +- Continue to use root-relative URLs inside HTML/JS and when building PayPal return/cancel links. The deployment tooling rewrites the document root; hardcoding `/modules/billing` breaks both standalone hosting and module embedding. + +### Examples of CORRECT usage +```php +$returnUrl = $siteBase . '/payment_success.php'; +header('Location: /order.php'); +