From 1f161cdb4889d586fc4540d1d07098aac132501b Mon Sep 17 00:00:00 2001 From: Adam Daley Date: Mon, 11 May 2026 21:53:42 +0100 Subject: [PATCH 1/2] Refactor Header layout and responsive styles --- src/components/starlight/Header.astro | 136 +++++++++++--------------- 1 file changed, 57 insertions(+), 79 deletions(-) diff --git a/src/components/starlight/Header.astro b/src/components/starlight/Header.astro index 3313364..3cb420f 100644 --- a/src/components/starlight/Header.astro +++ b/src/components/starlight/Header.astro @@ -4,79 +4,72 @@ import Search from 'virtual:starlight/components/Search'; import SiteTitle from 'virtual:starlight/components/SiteTitle'; import SocialIcons from 'virtual:starlight/components/SocialIcons'; import ThemeSelect from 'virtual:starlight/components/ThemeSelect'; - -const navLinks = [ - { label: 'Documentation', href: '/' }, - { label: 'Downloads', href: 'https://fossbilling.org/downloads' }, - { label: 'Demo', href: 'https://fossbilling.org/demo' }, - { label: 'Translate', href: 'https://translate.fossbilling.org/' }, - { - label: 'Donate', - href: 'https://opencollective.com/fossbilling', - cta: true, - }, -]; - -const currentPath = Astro.url.pathname.replace(/\/+$/, '') || '/'; ---
+ Docs
- - - +
+ -
-
From f8d6db06f6e163306371e1ea414269ecacb43c16 Mon Sep 17 00:00:00 2001 From: Adam Daley Date: Mon, 11 May 2026 22:29:41 +0100 Subject: [PATCH 2/2] Docs: clarify config, update examples, footer Improve documentation clarity and example code across the site: clarify maintenance and API config options, standardize config arrays, remove placeholder comments from PHP examples, tighten the license validation example (require host and return it), add concrete JS success/error logging and spinner CSS, and simplify module permission notes. Also update footer social label to "X" and point docs license link to the Creative Commons license in the docs repo. These changes are editorial and aim to make examples more actionable and the docs more accurate. --- src/components/starlight/Footer.astro | 6 ++--- .../docs/customizing-fossbilling/config.mdoc | 24 +++++++++---------- .../developing-fossbilling/event-hooks.mdoc | 2 -- .../guides/creating-a-module.mdoc | 6 +++-- .../guides/creating-a-payment-gateway.mdoc | 1 - .../creating-a-registrar-integration.mdoc | 3 --- .../developing-fossbilling/javascript.mdoc | 19 +++++++-------- .../admin-manual-reset.mdoc | 2 +- src/content/docs/product-types/license.mdoc | 10 +++----- .../docs/security/securing-fossbilling.mdoc | 2 -- 10 files changed, 32 insertions(+), 43 deletions(-) diff --git a/src/components/starlight/Footer.astro b/src/components/starlight/Footer.astro index 33715bf..f9e59aa 100644 --- a/src/components/starlight/Footer.astro +++ b/src/components/starlight/Footer.astro @@ -8,7 +8,7 @@ const footerLinks = [ { label: 'hello@fossbilling.org', href: 'mailto:hello@fossbilling.org' }, { label: 'Discord', href: 'https://fossbilling.org/discord' }, { label: 'Mastodon', href: 'https://fosstodon.org/@fossbilling' }, - { label: 'X (Twitter)', href: 'https://twitter.com/FOSSBilling' }, + { label: 'X', href: 'https://x.com/FOSSBilling' }, { label: 'Status page', href: 'https://status.fossbilling.org/' }, ]; --- @@ -34,8 +34,8 @@ const footerLinks = [
diff --git a/src/content/docs/customizing-fossbilling/config.mdoc b/src/content/docs/customizing-fossbilling/config.mdoc index a8c757f..1b99d88 100644 --- a/src/content/docs/customizing-fossbilling/config.mdoc +++ b/src/content/docs/customizing-fossbilling/config.mdoc @@ -46,13 +46,13 @@ Control security behavior: ### Maintenance Mode -Temporarily disable public access: +Temporarily disable public access. Use `allowed_urls` for endpoints that must stay reachable and `allowed_ips` for trusted networks that should bypass maintenance mode. ```php 'maintenance_mode' => [ 'enabled' => true, - 'allowed_urls' => ['/api/guest/*'], // URLs that stay accessible - 'allowed_ips' => ['192.168.1.0/24'], // IPs that bypass maintenance + 'allowed_urls' => ['/api/guest/*'], + 'allowed_ips' => ['192.168.1.0/24'], ], ``` @@ -101,18 +101,18 @@ Temporarily disable public access: ### API Settings -Control API access and rate limiting: +Control API access and rate limiting. Use `require_referrer_header` to lock browser-originated requests to your install URL, `allowed_ips` for explicit allowlists, and the `rate_*` values to tune throttling. ```php 'api' => [ - 'require_referrer_header' => true, // Must match FOSSBilling URL - 'allowed_ips' => [], // Empty = allow all - 'rate_span' => 60, // Rate limit window (seconds) - 'rate_limit' => 100, // Max requests per window - 'throttle_delay' => 2, // Delay when rate limited - 'rate_span_login' => 60, // Login rate limit window - 'rate_limit_login' => 20, // Max login attempts - 'CSRFPrevention' => true, // Enable CSRF protection + 'require_referrer_header' => true, + 'allowed_ips' => [], + 'rate_span' => 60, + 'rate_limit' => 100, + 'throttle_delay' => 2, + 'rate_span_login' => 60, + 'rate_limit_login' => 20, + 'CSRFPrevention' => true, ], ``` diff --git a/src/content/docs/developing-fossbilling/event-hooks.mdoc b/src/content/docs/developing-fossbilling/event-hooks.mdoc index 8f0aa0e..0a73dd0 100644 --- a/src/content/docs/developing-fossbilling/event-hooks.mdoc +++ b/src/content/docs/developing-fossbilling/event-hooks.mdoc @@ -187,13 +187,11 @@ class Service public static function onAfterAdminOrderCreate(\Box_Event $event): void { $order = $event->getSubject(); - // Do something with the new order error_log('New order created: ' . $order->id); } public static function onBeforeAdminCronRun(\Box_Event $event): void { - // Run before cron executes } } ``` diff --git a/src/content/docs/developing-fossbilling/guides/creating-a-module.mdoc b/src/content/docs/developing-fossbilling/guides/creating-a-module.mdoc index 1dfb8d8..a15e20d 100644 --- a/src/content/docs/developing-fossbilling/guides/creating-a-module.mdoc +++ b/src/content/docs/developing-fossbilling/guides/creating-a-module.mdoc @@ -64,12 +64,14 @@ public function getModulePermissions(): array 'display_name' => __trans('Delete something'), 'description' => __trans('Allows the staff member to delete "something"'), ], - 'can_always_access' => true, // Staff always has basic access - 'manage_settings' => [], // Opt-in to settings page restriction + 'can_always_access' => true, + 'manage_settings' => [], ]; } ``` +`can_always_access` grants baseline access to the module, while `manage_settings` limits the settings page to the listed permissions. + ### Checking Permissions **Quick check:** diff --git a/src/content/docs/developing-fossbilling/guides/creating-a-payment-gateway.mdoc b/src/content/docs/developing-fossbilling/guides/creating-a-payment-gateway.mdoc index e56474d..bcb9b5e 100644 --- a/src/content/docs/developing-fossbilling/guides/creating-a-payment-gateway.mdoc +++ b/src/content/docs/developing-fossbilling/guides/creating-a-payment-gateway.mdoc @@ -109,7 +109,6 @@ class Payment_Adapter_MyGateway implements FOSSBilling\InjectionAwareInterface $invoiceId = $data['get']['invoice_id'] ?? $data['post']['invoice_id']; $invoice = $this->di['db']->getExistingModelById('Invoice', $invoiceId); - // Verify with your gateway's API $paymentId = $data['post']['payment_id']; $payment = $this->verifyPaymentWithGateway($paymentId); diff --git a/src/content/docs/developing-fossbilling/guides/creating-a-registrar-integration.mdoc b/src/content/docs/developing-fossbilling/guides/creating-a-registrar-integration.mdoc index 24f80f9..fa25587 100644 --- a/src/content/docs/developing-fossbilling/guides/creating-a-registrar-integration.mdoc +++ b/src/content/docs/developing-fossbilling/guides/creating-a-registrar-integration.mdoc @@ -65,14 +65,12 @@ class Registrar_Adapter_YourRegistrar extends Registrar_AdapterAbstract public function isAvailable($domain): bool { - // Check if domain is available for registration $response = $this->apiRequest('check', ['domain' => $domain]); return $response['available'] ?? false; } public function register($domain, array $contact): bool { - // Register the domain $params = [ 'domain' => $domain, 'period' => $this->getPeriod(), @@ -85,7 +83,6 @@ class Registrar_Adapter_YourRegistrar extends Registrar_AdapterAbstract private function apiRequest($action, array $params = []): array { - // Your API communication logic $ch = curl_init($this->config['api_url'] . '/' . $action); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params)); diff --git a/src/content/docs/developing-fossbilling/javascript.mdoc b/src/content/docs/developing-fossbilling/javascript.mdoc index b840d14..e3c440f 100644 --- a/src/content/docs/developing-fossbilling/javascript.mdoc +++ b/src/content/docs/developing-fossbilling/javascript.mdoc @@ -84,12 +84,12 @@ API.admin.post( "client/get_list", {}, function(response) { - // Handle success + console.log(response.list); }, function(error) { - // Handle error + console.error(error.message); }, - false // No spinner + false ); ``` @@ -102,7 +102,7 @@ The wrapper automatically shows a spinner for requests taking longer than 250ms. ```css .spinner-border { - /* Your spinner styles */ + display: inline-block; animation: spin 1s linear infinite; } ``` @@ -119,19 +119,20 @@ Either: ### Success Response +The success callback receives the decoded API response object: + ```javascript function(response) { - // response contains the API result - // Access data like response.result or response.id + console.log(response.result); } ``` ### Error Response +The error callback receives the API error payload: + ```javascript function(error) { - // error contains error details - // Usually: error.message and error.code console.error(error.message); } ``` @@ -139,7 +140,6 @@ function(error) { ## Complete Example ```javascript -// Load client profile function loadProfile() { API.client.get( "client/profile", @@ -154,7 +154,6 @@ function loadProfile() { ); } -// Call it when the page loads document.addEventListener('DOMContentLoaded', loadProfile); ``` diff --git a/src/content/docs/maintaining-fossbilling/admin-manual-reset.mdoc b/src/content/docs/maintaining-fossbilling/admin-manual-reset.mdoc index 10e4240..67d31c9 100644 --- a/src/content/docs/maintaining-fossbilling/admin-manual-reset.mdoc +++ b/src/content/docs/maintaining-fossbilling/admin-manual-reset.mdoc @@ -22,7 +22,7 @@ Choose the database you installed FOSSBilling on. If you're not sure which one, 'type' => 'mysql', 'host' => 'localhost', 'port' => '3306', - 'name' => 'fossbilling', // This is your database name + 'name' => 'fossbilling', 'user' => 'fossbilling_user', 'password' => 'fossbilling_password', ], diff --git a/src/content/docs/product-types/license.mdoc b/src/content/docs/product-types/license.mdoc index affc467..5e13a95 100644 --- a/src/content/docs/product-types/license.mdoc +++ b/src/content/docs/product-types/license.mdoc @@ -102,20 +102,16 @@ class License_YourPlugin { public function generate(array $data): string { - // Generate and return a license key return 'YOUR-KEY-HERE'; } public function validate(\Model_ServiceLicense $service, array $data): array { - // Custom validation logic - // Throw LogicException if validation fails - if (!$valid) { - throw new \LogicException('Validation failed', 1020); + if (empty($data['host'])) { + throw new \LogicException('Host is required', 1020); } - // Return extra data to include in the API response - return ['extraKey' => 'extraValue']; + return ['host' => $data['host']]; } } ``` diff --git a/src/content/docs/security/securing-fossbilling.mdoc b/src/content/docs/security/securing-fossbilling.mdoc index c04a373..fb5d012 100644 --- a/src/content/docs/security/securing-fossbilling.mdoc +++ b/src/content/docs/security/securing-fossbilling.mdoc @@ -18,7 +18,6 @@ These settings live in your `config.php` file and control FOSSBilling's built-in | `session_lifespan` | `7200` | `int` | How long sessions remain valid (in seconds). Default is 2 hours. After this, sessions expire and are destroyed. | ```php -// Example configuration 'security' => [ 'mode' => 'strict', 'force_https' => true, @@ -33,7 +32,6 @@ These settings live in your `config.php` file and control FOSSBilling's built-in | `CSRFPrevention` | `true` | `bool` | Enables CSRF protection. Keep this enabled unless it's causing specific issues. | ```php -// Example configuration 'api' => [ 'CSRFPrevention' => true, ],