57 lines
1.9 KiB
Markdown
57 lines
1.9 KiB
Markdown
|
|
# cowl-licensing
|
||
|
|
|
||
|
|
Cloudflare Workers + D1 replacement for the ComponentOwl PHP/MySQL licensing server.
|
||
|
|
|
||
|
|
## Structure
|
||
|
|
|
||
|
|
```
|
||
|
|
cowl-licensing/
|
||
|
|
├── wrangler.toml # Worker config (fill in database_id)
|
||
|
|
├── schema.sql # D1 table definitions
|
||
|
|
├── seed.sql # Data import (637 serials, 976 licenses, 11 products)
|
||
|
|
└── src/
|
||
|
|
└── index.js # Single-file Worker — all 8 endpoints
|
||
|
|
```
|
||
|
|
|
||
|
|
## Deploy
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# 1. Create the D1 database
|
||
|
|
wrangler d1 create cowl-licensing
|
||
|
|
# Copy the database_id into wrangler.toml
|
||
|
|
|
||
|
|
# 2. Create tables
|
||
|
|
wrangler d1 execute cowl-licensing --file=schema.sql
|
||
|
|
|
||
|
|
# 3. Import data
|
||
|
|
wrangler d1 execute cowl-licensing --file=seed.sql
|
||
|
|
|
||
|
|
# 4. Deploy
|
||
|
|
wrangler deploy
|
||
|
|
```
|
||
|
|
|
||
|
|
## Endpoints
|
||
|
|
|
||
|
|
All endpoints mirror the original PHP API exactly (`.php` URLs preserved).
|
||
|
|
|
||
|
|
| Method | Path | Description |
|
||
|
|
|--------|------|-------------|
|
||
|
|
| POST | `/v1/activate.php` | Activate a license |
|
||
|
|
| GET/POST | `/v1/check_update.php` | Check for product update |
|
||
|
|
| POST | `/v1/get_licenses.php` | List licenses for a product |
|
||
|
|
| GET/POST | `/v1/get_products.php` | List all products + editions |
|
||
|
|
| POST | `/v1/get_serial_numbers.php` | List serial numbers for a product |
|
||
|
|
| POST | `/v1/keygen.php` | Generate new serial numbers |
|
||
|
|
| POST | `/v1/renew_license.php` | Renew license expiration |
|
||
|
|
| POST | `/v1/update_product.php` | Update product version |
|
||
|
|
|
||
|
|
All requests/responses use XML. Request body: `<request>...</request>`. Response: `<?xml version="1.0" encoding="utf-8"?><response>...</response>`.
|
||
|
|
|
||
|
|
## Notes
|
||
|
|
|
||
|
|
- Special serials `FREE` (edition 1) and `TRIAL` (edition 2) bypass the serial_numbers table
|
||
|
|
- Activation limit of `0` = unlimited activations
|
||
|
|
- Version limit of `0` = all versions allowed
|
||
|
|
- `keygen` caps at 100 keys per call; generated serials are 16-char uppercase alphanumeric (BMT Micro compatible)
|
||
|
|
- All queries use parameterized statements (SQL injection safe)
|