License Server API Documentation

This document provides details on the API endpoints for the self-hosted Flask license server.

Core Concepts

The license system works by pairing a unique license_key (the user's machine ID) with a specific tool_name. A license is only considered valid if both the key and the tool name sent by the client application exist as a matching pair in the database.

Base URL

The public API endpoint for the license server is: http://technodepc.xyz/licenseserver


Admin Endpoints

These endpoints are used by the admin dashboard and are intended for administrative use only.

1. Admin Login

Authenticates the admin user.

2. Get All Licenses

Retrieves a list of all licenses in the database.

3. Add a New License

Creates a new license entry.

4. Delete a License

Removes a license from the database.


Public Client Endpoint

This is the public-facing endpoint that your Windows applications will use to validate their licenses.

5. Check a License

Validates a license for a given tool and machine ID.


Integration Guide for Windows Applications

This guide explains how to integrate the license checker into your Windows application.

Core Concept

Your application (the "client") will make a web request to the /api/check endpoint on this server at startup. The server's response will determine if the application should run or exit.

Step 1: Get a Unique Machine ID

Your application must be able to generate a consistent, unique identifier for the machine it's running on. The MAC address is a common and reliable method.

Step 2: Make the API Request

When your application starts, before loading the main user interface, it must perform the following action:

CRITICAL NOTE: The value of the TOOL_NAME variable in your application's code must exactly match the value you enter in the "Tool Name" field in the admin dashboard. The check is case-sensitive. For example, "MyTool" and "mytool" are considered different names.

Step 3: Handle the API Response

Your application must check the HTTP status code of the response from the server.

Python Example Integration

If your Windows application is written in Python, you can use the provided license_client.py module, which handles these steps for you.

```python

main.py (Example for your target Windows Application)

import sys from license_client import LicenseClient

--- Configuration ---

IMPORTANT: Change this to your public server URL before distributing your application.

LICENSE_SERVER_URL = "http://technodepc.xyz/licenseserver"

This name must be an exact match for the "Tool Name" in the admin dashboard.

TOOL_NAME = "YourToolName"

def run_main_app(): """Placeholder for your app's main entry point.""" print("License is valid. Starting main application...") # Your application's main code goes here. # For a GUI app, you would initialize your main window here.

if name == "main": client = LicenseClient(LICENSE_SERVER_URL) is_valid, message = client.check_license(TOOL_NAME)

if is_valid:
    run_main_app()
else:
    # In a real GUI app, you would display this message in a popup dialog.
    print(f"LICENSE VALIDATION FAILED: {message}")
    input("Press Enter to exit.") # Pause to allow user to read the message
    sys.exit(1)