commit 385ba5f309afce3cd24284d54d8c490c652f41e4 Author: worldofiptvcom Date: Fri Dec 12 15:07:46 2025 +0300 Initial commit diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e2c95b4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,78 @@ +# Editor directories and files +.vscode/ +.idea/ +*.swp +*.swo +*~ +.DS_Store + +# OS files +Thumbs.db +Desktop.ini + +# Logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Environment variables (IMPORTANT: Never commit credentials!) +.env +.env.local +.env.*.local +config.local.yaml +secrets.yaml + +# Temporary files +tmp/ +temp/ +*.tmp + +# API keys and credentials (IMPORTANT: Never commit these!) +**/api-keys.txt +**/credentials.json +**/secrets.json + +# Build outputs +dist/ +build/ +out/ + +# Dependency directories +node_modules/ +vendor/ + +# Test coverage +coverage/ +.nyc_output/ + +# Python +__pycache__/ +*.py[cod] +*$py.class +*.so +.Python +env/ +venv/ +ENV/ +.venv + +# Ruby +*.gem +*.rbc +/.config +/coverage/ +/InstalledFiles +/pkg/ +/spec/reports/ +/test/tmp/ +/test/version_tmp/ +/tmp/ + +# PHP +/vendor/ +composer.lock + +# Documentation build +docs/_build/ +site/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b322ddb --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,331 @@ +# Contributing to XUI.ONE API Documentation + +Thank you for your interest in contributing! This documentation is community-driven and we welcome all contributions. + +## ๐ŸŽฏ Ways to Contribute + +- ๐Ÿ› **Report bugs** - Found incorrect information? Let us know! +- ๐Ÿ“ **Improve documentation** - Fix typos, clarify explanations +- ๐Ÿ’ก **Add examples** - Share working code in different languages +- โœจ **Add new endpoints** - Document undocumented API actions +- ๐Ÿ” **Test and verify** - Test endpoints and confirm behavior +- ๐ŸŒ **Translations** - Help translate documentation + +## ๐Ÿ“‹ Before You Start + +1. **Check existing issues** - Someone might already be working on it +2. **Open an issue first** - For major changes, discuss before implementing +3. **Follow the style guide** - Keep documentation consistent +4. **Test your changes** - Verify all code examples work + +## ๐Ÿš€ Quick Start + +### Fork and Clone + +```bash +# Fork the repository on GitHub, then: +git clone https://github.com/YOUR_USERNAME/xui-one-api-docs.git +cd xui-one-api-docs + +# Add upstream remote +git remote add upstream https://github.com/worldofiptvcom/xui-one-api-docs.git +``` + +### Create a Branch + +```bash +# Create a new branch for your contribution +git checkout -b feature/add-streams-api-docs + +# Or for bug fixes: +git checkout -b fix/correct-line-api-example +``` + +### Make Your Changes + +Edit the relevant files following our [Style Guide](#style-guide). + +### Test Your Changes + +```bash +# For OpenAPI changes, validate the spec: +# 1. Open index.html in browser +# 2. Check for validation errors in Swagger UI + +# For code examples, test them: +curl "http://your-server.com/cSbuFLhp/?api_key=YOUR_KEY&action=user_info" +``` + +### Commit Your Changes + +```bash +git add . +git commit -m "Add Streams API documentation with examples" + +# Use clear commit messages: +# โœ… "Add Python examples for Line API" +# โœ… "Fix typo in authentication guide" +# โœ… "Update get_lines endpoint parameters" +# โŒ "Update docs" +# โŒ "Fix stuff" +``` + +### Push and Create Pull Request + +```bash +git push origin feature/add-streams-api-docs +``` + +Then open a Pull Request on GitHub with: +- Clear title describing the change +- Description of what was changed and why +- Screenshots if applicable +- Reference to any related issues + +## ๐Ÿ“ Style Guide + +### OpenAPI Specification + +Follow OpenAPI 3.0.3 standards: + +```yaml +paths: + /?action=example: + get: + summary: Brief one-line description + description: | + Detailed description with examples. + + **Example Request:** + ```bash + curl "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=example" + ``` + operationId: uniqueOperationId + tags: + - CategoryName + parameters: + - $ref: '#/components/parameters/ApiKey' + - name: action + in: query + required: true + schema: + type: string + enum: [example] +``` + +### Markdown Documentation + +- Use clear headers (h1 for title, h2 for sections, h3 for subsections) +- Include code examples for each operation +- Add response examples (both success and error) +- Use tables for parameter documentation +- Include emojis for visual appeal (but don't overuse) + +### Code Examples + +Always provide examples in multiple languages when possible: + +#### cURL +```bash +curl "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=example" +``` + +#### Python +```python +import requests + +response = requests.get( + "http://your-server.com/cSbuFLhp/", + params={ + "api_key": "8D3135D30437F86EAE2FA4A2A8345000", + "action": "example" + } +) +``` + +#### PHP +```php + +``` + +#### JavaScript +```javascript +const response = await fetch( + 'http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=example' +); +const data = await response.json(); +``` + +### Placeholder Values + +Always use consistent placeholder values: + +- **Server**: `your-server.com` +- **Access Code**: `cSbuFLhp` +- **API Key**: `8D3135D30437F86EAE2FA4A2A8345000` +- **IDs**: Use sequential numbers (123, 456, etc.) +- **Usernames**: `testuser`, `user123`, etc. +- **Passwords**: `testpass123`, `securepass`, etc. + +### Security Considerations + +- **Never** include real API keys, passwords, or server IPs +- Always mention security best practices +- Warn about sensitive operations +- Recommend HTTPS for production + +## ๐Ÿ—๏ธ Project Structure + +``` +xui-one-api-docs/ +โ”œโ”€โ”€ openapi.yaml # Main OpenAPI specification +โ”œโ”€โ”€ README.md # Project overview +โ”œโ”€โ”€ LICENSE # License information +โ”œโ”€โ”€ CONTRIBUTING.md # This file +โ”œโ”€โ”€ .gitignore # Git ignore rules +โ”œโ”€โ”€ index.html # Swagger UI viewer +โ”œโ”€โ”€ docs/ # Detailed documentation +โ”‚ โ”œโ”€โ”€ getting-started.md # Setup guide +โ”‚ โ”œโ”€โ”€ authentication.md # Auth details +โ”‚ โ”œโ”€โ”€ categories/ # API by category +โ”‚ โ”‚ โ”œโ”€โ”€ 01-get-info.md +โ”‚ โ”‚ โ”œโ”€โ”€ 02-logs-events.md +โ”‚ โ”‚ โ”œโ”€โ”€ 03-line-api.md +โ”‚ โ”‚ โ””โ”€โ”€ ... +โ”‚ โ””โ”€โ”€ examples/ # Code examples +โ”‚ โ”œโ”€โ”€ curl-examples.md +โ”‚ โ”œโ”€โ”€ python-examples.md +โ”‚ โ”œโ”€โ”€ php-examples.md +โ”‚ โ””โ”€โ”€ javascript-examples.md +โ””โ”€โ”€ postman/ # Postman collection + โ””โ”€โ”€ XUI-ONE-API.postman_collection.json +``` + +## ๐Ÿ“š Documentation Categories + +When adding new API endpoints, place them in the appropriate category: + +1. **GET INFO** - Query operations (get_lines, get_users, etc.) +2. **Logs & Events** - Monitoring (activity_logs, live_connections) +3. **Line API** - Subscription management +4. **User API** - User management +5. **MAG API** - MAG device operations +6. **Enigma API** - Enigma2 STB operations +7. **Streams API** - Live stream management +8. **Channel API** - Channel operations +9. **Station API** - Radio station management +10. **Movie API** - VOD movie management +11. **Series API** - Series management +12. **Episode API** - Episode management +13. **Servers API** - Server and load balancer management +14. **Settings & System** - System configuration + +## โœ… Pull Request Checklist + +Before submitting your PR, ensure: + +- [ ] Code examples are tested and working +- [ ] OpenAPI spec validates without errors +- [ ] Markdown is properly formatted +- [ ] No real credentials are included +- [ ] Commit messages are clear +- [ ] Branch is up to date with main +- [ ] Documentation follows style guide +- [ ] Changes are described in PR description + +## ๐Ÿงช Testing + +### Test OpenAPI Specification + +1. Open `index.html` in a browser +2. Check for validation errors in Swagger UI +3. Verify examples render correctly +4. Test "Try it out" functionality with your credentials + +### Test Code Examples + +Test all code examples with a real XUI.ONE instance: + +```bash +# Test cURL examples +bash docs/examples/test-curl.sh + +# Test Python examples +python docs/examples/test-python.py +``` + +## ๐Ÿ› Reporting Issues + +When reporting bugs or issues: + +1. **Check existing issues first** +2. **Use the issue template** +3. **Provide details:** + - What you expected + - What actually happened + - Steps to reproduce + - XUI.ONE version + - API endpoint affected +4. **Include examples** (sanitize credentials!) + +### Issue Template + +```markdown +## Description +Brief description of the issue + +## Expected Behavior +What should happen + +## Actual Behavior +What actually happens + +## Steps to Reproduce +1. Step one +2. Step two +3. Step three + +## Environment +- XUI.ONE Version: 1.5.13 +- Endpoint: /?action=get_lines +- Request Method: GET + +## Additional Context +Any other relevant information +``` + +## ๐Ÿ’ฌ Communication + +- **GitHub Issues** - Bug reports and feature requests +- **GitHub Discussions** - Questions and general discussion +- **Pull Requests** - Code and documentation contributions + +## ๐Ÿ† Recognition + +Contributors will be: +- Listed in the project README +- Credited in release notes +- Appreciated by the community! ๐Ÿ™ + +## ๐Ÿ“„ License + +By contributing, you agree that your contributions will be licensed under the MIT License (for documentation). See [LICENSE](LICENSE) file for details. + +## โ“ Questions? + +- Check the [README](README.md) +- Read the [Getting Started Guide](docs/getting-started.md) +- Open a [GitHub Discussion](https://github.com/worldofiptvcom/xui-one-api-docs/discussions) +- Ask in the [World of IPTV Forums](https://www.worldofiptv.com) + +--- + +## ๐Ÿ™ Thank You! + +Thank you for contributing to make XUI.ONE API documentation better for everyone! + +**Happy documenting! ๐Ÿ“šโœจ** diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md new file mode 100644 index 0000000..7b1484e --- /dev/null +++ b/DEPLOYMENT.md @@ -0,0 +1,364 @@ +# Deployment Guide + +This guide explains how to upload the documentation to GitHub and deploy it online. + +## Table of Contents + +1. [Automatic Upload (Recommended)](#automatic-upload) +2. [Manual Upload](#manual-upload) +3. [Deploy to GitHub Pages](#deploy-to-github-pages) +4. [Alternative Hosting](#alternative-hosting) + +--- + +## Automatic Upload (Recommended) + +### Prerequisites + +- Git installed on your system +- GitHub account credentials or Personal Access Token + +### Steps + +1. **Navigate to the project directory:** + +```bash +cd /path/to/xui-one-api-docs +``` + +2. **Run the upload script:** + +```bash +./upload-to-github.sh +``` + +3. **Follow the prompts:** + - Enter commit message (or press Enter for default) + - Provide GitHub credentials when prompted + +4. **Done!** Your documentation is now on GitHub. + +--- + +## Manual Upload + +If you prefer manual control or the automatic script doesn't work: + +### Step 1: Initialize Git + +```bash +cd /path/to/xui-one-api-docs +git init +``` + +### Step 2: Add Remote + +```bash +git remote add origin https://github.com/worldofiptvcom/xui-one-api-docs.git +``` + +### Step 3: Stage Files + +```bash +git add . +``` + +### Step 4: Commit + +```bash +git commit -m "Initial commit: Add XUI.ONE API documentation with authentication section" +``` + +### Step 5: Set Branch + +```bash +git branch -M main +``` + +### Step 6: Push to GitHub + +```bash +git push -u origin main +``` + +**Note:** You'll be prompted for GitHub credentials. + +--- + +## Authentication Options + +### Option 1: Personal Access Token (Recommended) + +1. **Generate Token:** + - Go to GitHub: Settings โ†’ Developer settings โ†’ Personal access tokens โ†’ Tokens (classic) + - Click "Generate new token (classic)" + - Select scopes: `repo` (Full control of private repositories) + - Generate and copy the token + +2. **Use Token:** + - When prompted for password, paste your token instead + +### Option 2: GitHub CLI + +```bash +# Install GitHub CLI +# macOS +brew install gh + +# Linux +sudo apt install gh + +# Windows +winget install --id GitHub.cli + +# Authenticate +gh auth login + +# Push repository +git push -u origin main +``` + +### Option 3: SSH Key + +1. **Generate SSH Key:** + +```bash +ssh-keygen -t ed25519 -C "your_email@example.com" +``` + +2. **Add to GitHub:** + - Copy public key: `cat ~/.ssh/id_ed25519.pub` + - Go to GitHub: Settings โ†’ SSH and GPG keys โ†’ New SSH key + - Paste and save + +3. **Change Remote URL:** + +```bash +git remote set-url origin git@github.com:worldofiptvcom/xui-one-api-docs.git +``` + +4. **Push:** + +```bash +git push -u origin main +``` + +--- + +## Deploy to GitHub Pages + +After uploading to GitHub, deploy the documentation website: + +### Step 1: Enable GitHub Pages + +1. Go to your repository on GitHub +2. Click **Settings** tab +3. Scroll to **Pages** section (left sidebar) +4. Under **Source**: + - Branch: `main` + - Folder: `/ (root)` +5. Click **Save** + +### Step 2: Wait for Deployment + +- GitHub will build your site (takes 1-2 minutes) +- Check the Actions tab to see deployment progress + +### Step 3: Access Your Documentation + +Your documentation will be available at: + +``` +https://worldofiptvcom.github.io/xui-one-api-docs/ +``` + +Open `index.html` to view the interactive Swagger UI documentation. + +### Custom Domain (Optional) + +1. **Add CNAME file:** + +```bash +echo "docs.yoursite.com" > CNAME +git add CNAME +git commit -m "Add custom domain" +git push +``` + +2. **Configure DNS:** + - Add CNAME record: `docs.yoursite.com` โ†’ `worldofiptvcom.github.io` + +3. **Update GitHub Pages:** + - Settings โ†’ Pages โ†’ Custom domain + - Enter: `docs.yoursite.com` + - Save + +--- + +## Alternative Hosting + +### Netlify + +1. **Connect Repository:** + - Go to https://netlify.com + - New site from Git + - Select your GitHub repository + +2. **Build Settings:** + - Build command: (leave empty) + - Publish directory: `/` + +3. **Deploy:** + - Click Deploy Site + - Done! Your site is live + +### Vercel + +1. **Import Project:** + - Go to https://vercel.com + - Import Git Repository + - Select your repository + +2. **Deploy:** + - Click Deploy + - Done! Your site is live + +### GitLab Pages + +1. **Create `.gitlab-ci.yml`:** + +```yaml +pages: + stage: deploy + script: + - mkdir .public + - cp -r * .public + - mv .public public + artifacts: + paths: + - public + only: + - main +``` + +2. **Push to GitLab:** + +```bash +git remote add gitlab https://gitlab.com/yourusername/xui-one-api-docs.git +git push gitlab main +``` + +### Self-Hosted + +1. **Copy Files to Web Server:** + +```bash +scp -r xui-one-api-docs/* user@your-server.com:/var/www/html/docs/ +``` + +2. **Configure Nginx:** + +```nginx +server { + listen 80; + server_name docs.yoursite.com; + root /var/www/html/docs; + index index.html; + + location / { + try_files $uri $uri/ =404; + } +} +``` + +3. **Restart Nginx:** + +```bash +sudo systemctl restart nginx +``` + +--- + +## Updating Documentation + +When you make changes: + +```bash +# Stage changes +git add . + +# Commit +git commit -m "Update: Add Streams API documentation" + +# Push +git push origin main +``` + +GitHub Pages will automatically rebuild and deploy. + +--- + +## Troubleshooting + +### "Permission Denied" Error + +**Solution:** +- Use Personal Access Token instead of password +- Or set up SSH key authentication + +### "Repository Not Found" Error + +**Solution:** +- Verify repository URL: `git remote -v` +- Ensure repository exists on GitHub +- Check you have access rights + +### GitHub Pages Not Working + +**Solution:** +- Verify Pages is enabled in repository settings +- Check Actions tab for deployment status +- Ensure `index.html` exists in repository root +- Wait a few minutes for initial deployment + +### Changes Not Appearing + +**Solution:** +- Clear browser cache +- Wait 1-2 minutes for GitHub Pages rebuild +- Check if git push was successful + +--- + +## Viewing Locally + +Before deploying, test locally: + +```bash +# Using Python +python3 -m http.server 8000 + +# Using Node.js +npx http-server + +# Using PHP +php -S localhost:8000 +``` + +Then open: `http://localhost:8000/index.html` + +--- + +## Support + +- **GitHub Issues:** Report deployment problems +- **GitHub Discussions:** Ask deployment questions +- **World of IPTV:** Community support + +--- + +**Need help?** Open an issue on GitHub with: +- What you tried +- Error messages +- Your operating system +- Screenshots if applicable diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b738f6b --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 worldofiptvcom + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..d914c6b --- /dev/null +++ b/README.md @@ -0,0 +1,339 @@ +# XUI.ONE Admin API Documentation + +
+ +![XUI.ONE](https://img.shields.io/badge/XUI.ONE-v1.5.13-blue) +![OpenAPI](https://img.shields.io/badge/OpenAPI-3.0.3-green) +![License](https://img.shields.io/badge/License-Proprietary-red) + +**Complete API Documentation for XUI.ONE IPTV Panel Administration** + +[View Documentation](#documentation) โ€ข [Quick Start](#quick-start) โ€ข [Examples](#examples) โ€ข [Contributing](#contributing) + +
+ +--- + +## ๐Ÿ“š Overview + +This repository contains comprehensive API documentation for **XUI.ONE**, a professional IPTV/OTT panel for managing live streams, VOD content, subscriptions, and more. + +### Features + +- โœ… **180+ API Endpoints** - Complete coverage of all XUI.ONE Admin API actions +- โœ… **Interactive Documentation** - Swagger/OpenAPI 3.0 specification +- โœ… **Code Examples** - cURL, Python, PHP, and JavaScript examples +- โœ… **Detailed Guides** - Step-by-step authentication and usage instructions +- โœ… **Response Examples** - Real-world request/response samples + +--- + +## ๐Ÿš€ Quick Start + +### Prerequisites + +1. XUI.ONE panel installed and running (v1.5.5+) +2. Admin account with appropriate permissions +3. Admin API access code created +4. API key generated + +### Authentication Setup + +#### Step 1: Create Admin API Access Code + +1. Log into your XUI.ONE admin panel +2. Navigate to **Management โ†’ Access Control โ†’ Access Codes** +3. Click **Add Access Code** +4. Select **Access Type: Admin API** +5. Assign to **Administrators** group +6. Save the access code (e.g., `cSbuFLhp`) + +#### Step 2: Generate API Key + +1. Log into admin panel +2. Click your profile (top right) +3. Select **Edit Profile** +4. Click **Generate API Key** +5. Copy and save your API key + +#### Step 3: Test Connection + +```bash +curl "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=user_info" +``` + +**Expected Response:** +```json +{ + "status": "STATUS_SUCCESS", + "data": { + "username": "admin", + "member_group_id": "1", + ... + } +} +``` + +--- + +## ๐Ÿ“– Documentation + +### View Interactive Documentation + +**Option 1: Swagger UI (Recommended)** + +1. Download this repository +2. Open `index.html` in your browser +3. Interactive API documentation with testing capability + +**Option 2: Online Swagger Editor** + +1. Go to https://editor.swagger.io/ +2. Import the `openapi.yaml` file +3. Explore the API interactively + +**Option 3: VS Code** + +Install the "OpenAPI (Swagger) Editor" extension and open `openapi.yaml` + +### Documentation Structure + +``` +xui-one-api-docs/ +โ”œโ”€โ”€ openapi.yaml # Main OpenAPI 3.0 specification +โ”œโ”€โ”€ README.md # This file +โ”œโ”€โ”€ docs/ # Detailed documentation +โ”‚ โ”œโ”€โ”€ getting-started.md # Setup and authentication guide +โ”‚ โ”œโ”€โ”€ authentication.md # Detailed authentication docs +โ”‚ โ”œโ”€โ”€ categories/ # API organized by category +โ”‚ โ”‚ โ”œโ”€โ”€ 01-get-info.md +โ”‚ โ”‚ โ”œโ”€โ”€ 02-logs-events.md +โ”‚ โ”‚ โ”œโ”€โ”€ 03-line-api.md +โ”‚ โ”‚ โ””โ”€โ”€ ... +โ”‚ โ””โ”€โ”€ examples/ # Code examples +โ”‚ โ”œโ”€โ”€ curl-examples.md +โ”‚ โ”œโ”€โ”€ python-examples.md +โ”‚ โ”œโ”€โ”€ php-examples.md +โ”‚ โ””โ”€โ”€ javascript-examples.md +โ”œโ”€โ”€ postman/ # Postman collection +โ”‚ โ””โ”€โ”€ XUI-ONE-API.postman_collection.json +โ””โ”€โ”€ index.html # Swagger UI for local viewing +``` + +--- + +## ๐ŸŽฏ API Categories + +### 1. **Authentication** โœ… +- `user_info` - Get current user information + +### 2. **GET INFO / Query Actions** ๐Ÿ”„ (Coming Soon) +- `get_lines` - Retrieve all subscription lines +- `get_users` - Retrieve all users +- `get_streams` - Retrieve all live streams +- `get_channels` - Retrieve all channels +- `get_movies` - Retrieve all movies +- `get_series_list` - Retrieve all series +- And more... + +### 3. **Line API** ๐Ÿ”„ (Coming Soon) +- `create_line` - Create new subscription +- `edit_line` - Edit existing line +- `delete_line` - Delete subscription +- `enable_line` / `disable_line` - Toggle line status +- `ban_line` / `unban_line` - Ban/unban subscription + +### 4. **User API** ๐Ÿ”„ (Coming Soon) +- `create_user` - Create new user +- `edit_user` - Edit user details +- `delete_user` - Delete user +- And more... + +### 5. **MAG API** ๐Ÿ”„ (Coming Soon) +- MAG device management + +### 6. **Enigma API** ๐Ÿ”„ (Coming Soon) +- Enigma2 STB management + +### 7. **Streams API** ๐Ÿ”„ (Coming Soon) +- Live stream management + +### 8. **Movies/Series/Episodes API** ๐Ÿ”„ (Coming Soon) +- VOD content management + +### 9. **Servers API** ๐Ÿ”„ (Coming Soon) +- Server and load balancer management + +### 10. **Logs & Events** ๐Ÿ”„ (Coming Soon) +- Activity monitoring + +--- + +## ๐Ÿ’ก Examples + +### cURL Example + +```bash +# Get all lines +curl "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=get_lines" + +# Create a new line +curl -X POST "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=create_line" \ + -d "username=testuser" \ + -d "password=testpass" \ + -d "max_connections=1" \ + -d "exp_date=2025-12-31" + +# Edit existing line (ID: 123) +curl "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=edit_line&id=123&password=newpassword" +``` + +### Python Example + +```python +import requests + +# API Configuration +BASE_URL = "http://your-server.com/cSbuFLhp/" +API_KEY = "8D3135D30437F86EAE2FA4A2A8345000" + +# Get all lines +response = requests.get( + BASE_URL, + params={ + "api_key": API_KEY, + "action": "get_lines" + } +) + +data = response.json() +if data["status"] == "STATUS_SUCCESS": + print(f"Found {len(data['data'])} lines") +else: + print(f"Error: {data['error']}") +``` + +### PHP Example + +```php + +``` + +### JavaScript Example + +```javascript +// API Configuration +const BASE_URL = 'http://your-server.com/cSbuFLhp/'; +const API_KEY = '8D3135D30437F86EAE2FA4A2A8345000'; + +// Get all lines +async function getLines() { + const url = `${BASE_URL}?api_key=${API_KEY}&action=get_lines`; + + const response = await fetch(url); + const data = await response.json(); + + if (data.status === 'STATUS_SUCCESS') { + console.log(`Found ${data.data.length} lines`); + return data.data; + } else { + console.error(`Error: ${data.error}`); + return null; + } +} + +getLines(); +``` + +--- + +## ๐Ÿ”’ Security Best Practices + +1. **Use HTTPS** - Always use port 9000 with SSL in production +2. **IP Whitelisting** - Restrict API access to specific IPs +3. **Rotate Keys** - Regenerate API keys periodically +4. **Never Expose Keys** - Don't commit API keys to version control +5. **Monitor Usage** - Check activity logs regularly +6. **HMAC Authentication** - Use HMAC for enhanced security + +--- + +## ๐Ÿค Contributing + +We welcome contributions! Here's how you can help: + +1. **Report Issues** - Found a bug or error? [Open an issue](https://github.com/worldofiptvcom/xui-one-api-docs/issues) +2. **Suggest Improvements** - Have ideas? Create a feature request +3. **Submit Pull Requests** - Fixed something? Submit a PR +4. **Share Examples** - Have working code examples? Share them! + +### Contribution Guidelines + +- Follow the existing documentation style +- Test all code examples before submitting +- Update the OpenAPI specification for API changes +- Provide clear commit messages + +--- + +## ๐Ÿ“‹ Roadmap + +- [x] Initial repository setup +- [x] Authentication documentation +- [ ] Complete all API categories (2-14) +- [ ] Add Postman collection +- [ ] Add more code examples (Ruby, Go, Node.js) +- [ ] Create video tutorials +- [ ] Add troubleshooting guide +- [ ] HMAC authentication detailed guide + +--- + +## ๐Ÿ“„ License + +This documentation is provided for XUI.ONE users. XUI.ONE itself is proprietary software. + +Documentation: MIT License +XUI.ONE Software: Proprietary (https://xui.one) + +--- + +## ๐Ÿ†˜ Support + +- **Documentation Issues**: [GitHub Issues](https://github.com/worldofiptvcom/xui-one-api-docs/issues) +- **XUI.ONE Support**: Contact official support +- **Community**: [World of IPTV Forums](https://www.worldofiptv.com) +- **API Questions**: Open a discussion on GitHub + +--- + +## ๐Ÿ™ Acknowledgments + +- XUI.ONE development team for creating the API +- World of IPTV community for testing and feedback +- All contributors to this documentation project + +--- + +
+ +**โญ Star this repo if you find it helpful!** + +Made with โค๏ธ by [World of IPTV](https://www.worldofiptv.com) + +
diff --git a/UPLOAD_INSTRUCTIONS.md b/UPLOAD_INSTRUCTIONS.md new file mode 100644 index 0000000..91c7c06 --- /dev/null +++ b/UPLOAD_INSTRUCTIONS.md @@ -0,0 +1,299 @@ +# ๐Ÿš€ Upload Instructions for XUI.ONE API Documentation + +## ๐Ÿ“ฆ What You Have + +I've created a complete documentation structure for XUI.ONE API with: + +- โœ… OpenAPI 3.0.3 specification (openapi.yaml) +- โœ… Interactive Swagger UI (index.html) +- โœ… Comprehensive README +- โœ… Getting Started guide +- โœ… Contributing guidelines +- โœ… Deployment instructions +- โœ… Automated upload script +- โœ… MIT License +- โœ… .gitignore file + +**Current Status:** Category 1 (Authentication & Getting Started) is **COMPLETE** โœ… + +--- + +## ๐ŸŽฏ Quick Start (2 Options) + +### Option A: Automatic Upload (Easiest) โญ + +1. **Open Terminal in the project folder** +2. **Run the script:** + ```bash + cd xui-one-api-docs + ./upload-to-github.sh + ``` +3. **Follow prompts and enter GitHub credentials** +4. **Done!** ๐ŸŽ‰ + +### Option B: Manual Upload + +1. **Open Terminal in the project folder** +2. **Run these commands:** + +```bash +cd xui-one-api-docs + +# Initialize git +git init + +# Add remote +git remote add origin https://github.com/worldofiptvcom/xui-one-api-docs.git + +# Stage all files +git add . + +# Commit +git commit -m "Initial commit: Add XUI.ONE API documentation with authentication section" + +# Set branch name +git branch -M main + +# Push to GitHub +git push -u origin main +``` + +3. **Enter GitHub credentials when prompted** +4. **Done!** ๐ŸŽ‰ + +--- + +## ๐Ÿ” GitHub Authentication + +You'll need to authenticate when pushing. Here are your options: + +### Recommended: Personal Access Token + +1. **Go to GitHub:** + - Settings โ†’ Developer settings โ†’ Personal access tokens โ†’ Tokens (classic) + +2. **Generate new token:** + - Click "Generate new token (classic)" + - Give it a name: "XUI API Docs" + - Select scope: โœ… `repo` (Full control of private repositories) + - Click "Generate token" + - **Copy the token immediately** (you won't see it again!) + +3. **Use token when pushing:** + - Username: `worldofiptvcom` + - Password: `` + +### Alternative: GitHub CLI + +```bash +# Install GitHub CLI (if not installed) +# macOS: +brew install gh + +# Linux: +sudo apt install gh + +# Windows: +winget install --id GitHub.cli + +# Authenticate +gh auth login + +# Then push normally +git push -u origin main +``` + +--- + +## ๐ŸŒ Deploy Documentation Website + +After uploading to GitHub: + +### Step 1: Enable GitHub Pages + +1. Go to: https://github.com/worldofiptvcom/xui-one-api-docs +2. Click **Settings** tab +3. Scroll to **Pages** (left sidebar) +4. Under **Build and deployment**: + - **Source:** Deploy from a branch + - **Branch:** main + - **Folder:** / (root) +5. Click **Save** + +### Step 2: Wait for Deployment + +- GitHub will automatically build your site (1-2 minutes) +- Check progress in **Actions** tab + +### Step 3: Access Your Live Documentation + +Your documentation will be available at: + +``` +https://worldofiptvcom.github.io/xui-one-api-docs/ +``` + +Open `index.html` for the interactive Swagger UI! ๐ŸŽŠ + +--- + +## ๐Ÿ“ What's Included + +``` +xui-one-api-docs/ +โ”œโ”€โ”€ ๐Ÿ“„ openapi.yaml # Main API specification (OpenAPI 3.0.3) +โ”œโ”€โ”€ ๐ŸŒ index.html # Interactive Swagger UI +โ”œโ”€โ”€ ๐Ÿ“– README.md # Project overview and documentation +โ”œโ”€โ”€ ๐Ÿš€ DEPLOYMENT.md # Detailed deployment guide +โ”œโ”€โ”€ ๐Ÿค CONTRIBUTING.md # Contribution guidelines +โ”œโ”€โ”€ ๐Ÿ“„ LICENSE # MIT License +โ”œโ”€โ”€ ๐Ÿ™ˆ .gitignore # Git ignore rules +โ”œโ”€โ”€ ๐Ÿ“œ upload-to-github.sh # Automated upload script +โ”œโ”€โ”€ docs/ +โ”‚ โ”œโ”€โ”€ ๐Ÿ“˜ getting-started.md # Complete setup guide +โ”‚ โ”œโ”€โ”€ categories/ +โ”‚ โ”‚ โ””โ”€โ”€ ๐Ÿ“‹ 01-get-info.md # Placeholder for next category +โ”‚ โ””โ”€โ”€ examples/ # (Empty - for future code examples) +โ””โ”€โ”€ postman/ # (Empty - for future Postman collection) +``` + +--- + +## โœ… Completed in This Release + +### 1. Authentication & Setup โœ… +- `user_info` endpoint fully documented +- Complete OpenAPI specification +- Authentication guide +- Security best practices +- Example code in cURL, Python, PHP, JavaScript + +### 2. Project Infrastructure โœ… +- GitHub repository structure +- Contributing guidelines +- Deployment instructions +- Automated upload script +- Interactive Swagger UI + +--- + +## ๐Ÿ”„ Next Steps (Future Categories) + +After uploading, we'll add documentation for: + +2. **GET INFO** - Query operations (get_lines, get_users, get_streams, etc.) +3. **Line API** - Subscription management +4. **Logs & Events** - Monitoring +5. **User API** - User management +6. **MAG API** - MAG devices +7. **Enigma API** - Enigma2 STBs +8. **Streams API** - Live streams +9. **Channel API** - Channels +10. **Station API** - Radio stations +11. **Movie API** - VOD movies +12. **Series API** - Series +13. **Episode API** - Episodes +14. **Servers API** - Server management + +Each category will include: +- Complete endpoint documentation +- All parameters +- Response examples +- Code examples in multiple languages +- Use cases and best practices + +--- + +## ๐Ÿงช Test Locally Before Uploading + +Want to preview the documentation first? + +```bash +cd xui-one-api-docs + +# Option 1: Python +python3 -m http.server 8000 + +# Option 2: Node.js +npx http-server + +# Option 3: PHP +php -S localhost:8000 +``` + +Then open: http://localhost:8000/index.html + +--- + +## ๐Ÿ†˜ Troubleshooting + +### Problem: "Permission denied" when running script + +**Solution:** +```bash +chmod +x upload-to-github.sh +./upload-to-github.sh +``` + +### Problem: "Authentication failed" + +**Solution:** +- Use Personal Access Token instead of password +- Make sure token has `repo` scope +- Or use GitHub CLI: `gh auth login` + +### Problem: "Repository not found" + +**Solution:** +- Verify you created the repository on GitHub +- Check the URL is correct: https://github.com/worldofiptvcom/xui-one-api-docs +- Ensure you're logged in to GitHub + +### Problem: Changes not showing on GitHub Pages + +**Solution:** +- Clear browser cache +- Wait 1-2 minutes for rebuild +- Check Actions tab for deployment status + +--- + +## ๐Ÿ“ž Need Help? + +1. **Check DEPLOYMENT.md** - Detailed deployment guide +2. **Check CONTRIBUTING.md** - How to contribute +3. **Open GitHub Issue** - Report problems +4. **World of IPTV Forums** - Community support + +--- + +## ๐ŸŽ‰ You're All Set! + +Once uploaded, you'll have: + +- โœ… Professional API documentation +- โœ… Interactive testing interface (Swagger UI) +- โœ… Live website on GitHub Pages +- โœ… Version controlled documentation +- โœ… Community contribution ready +- โœ… Foundation for remaining categories + +**Ready to upload? Run:** `./upload-to-github.sh` + +--- + +## ๐Ÿ“ After Upload Checklist + +- [ ] Repository uploaded successfully +- [ ] GitHub Pages enabled +- [ ] Documentation website accessible +- [ ] Swagger UI working correctly +- [ ] Update repository description on GitHub +- [ ] Add topics/tags to repository (api, documentation, iptv, xuione, openapi) +- [ ] Share with community! + +--- + +**Made with โค๏ธ for the XUI.ONE community** + +Questions? Open an issue on GitHub! diff --git a/docs/categories/01-get-info.md b/docs/categories/01-get-info.md new file mode 100644 index 0000000..d5bdb20 --- /dev/null +++ b/docs/categories/01-get-info.md @@ -0,0 +1,39 @@ +# GET INFO / Query Actions + +> ๐Ÿ“‹ **Status:** Coming Soon +> +> This section will document all query and information retrieval endpoints. + +## Overview + +GET INFO endpoints allow you to retrieve information about your XUI.ONE panel resources without making modifications. + +## Available Endpoints + +- `mysql_query` - Execute custom MySQL queries +- `user_info` - Get current user information โœ… (Documented in openapi.yaml) +- `get_lines` - Retrieve all subscription lines +- `get_mags` - Retrieve all MAG devices +- `get_enigmas` - Retrieve all Enigma2 devices +- `get_users` - Retrieve all users +- `get_streams` - Retrieve all live streams +- `get_channels` - Retrieve all channels +- `get_stations` - Retrieve all radio stations +- `get_movies` - Retrieve all movies +- `get_series_list` - Retrieve all series +- `get_episodes` - Retrieve all episodes +- `get_packages` - Retrieve all subscription packages + +## Coming Soon + +Detailed documentation for each endpoint will include: +- Complete parameter list +- Response structure +- Code examples (cURL, Python, PHP, JavaScript) +- Use cases +- Pagination support +- Filtering options + +--- + +**Want to help?** Check our [Contributing Guide](../../CONTRIBUTING.md) to add documentation for these endpoints! diff --git a/docs/getting-started.md b/docs/getting-started.md new file mode 100644 index 0000000..3464907 --- /dev/null +++ b/docs/getting-started.md @@ -0,0 +1,403 @@ +# Getting Started with XUI.ONE Admin API + +Welcome to the XUI.ONE Admin API! This guide will help you get up and running quickly. + +## Table of Contents + +1. [Prerequisites](#prerequisites) +2. [Authentication Setup](#authentication-setup) +3. [Making Your First API Call](#making-your-first-api-call) +4. [Understanding Responses](#understanding-responses) +5. [Common Operations](#common-operations) +6. [Troubleshooting](#troubleshooting) +7. [Next Steps](#next-steps) + +--- + +## Prerequisites + +Before you begin, ensure you have: + +- โœ… **XUI.ONE Panel Installed** - Version 1.5.5 or higher +- โœ… **Admin Access** - Full administrator privileges +- โœ… **Server Access** - Ability to access your XUI.ONE server +- โœ… **API Client** - cURL, Postman, or programming language of choice + +### Check Your XUI.ONE Version + +SSH into your server and run: + +```bash +cat /home/xui/config/config.ini | grep version +``` + +Or check in the admin panel footer. + +--- + +## Authentication Setup + +### Step 1: Create Admin API Access Code + +The access code is a unique identifier that protects your API endpoint. + +1. **Log into XUI.ONE Admin Panel** + - Navigate to your panel URL: `http://your-server.com:25500/your-access-code` + +2. **Navigate to Access Codes** + - Click **Management** (left sidebar) + - Select **Access Control** + - Click **Access Codes** + +3. **Create New Access Code** + - Click **Add Access Code** button + - Fill in the form: + - **Access Type**: Select `Admin API` + - **Group**: Select `Administrators` + - **IP Restriction** (Optional but recommended): + - Add your IP address for security + - Leave empty to allow all IPs (not recommended for production) + +4. **Save and Note Your Access Code** + - After saving, note your access code (e.g., `cSbuFLhp`) + - This will be part of your API URL + +### Step 2: Generate API Key + +The API key authenticates your requests. + +1. **Access Your Profile** + - Click your username (top right corner) + - Select **Edit Profile** + +2. **Generate API Key** + - Scroll to the API section + - Click the blue **Generate API Key** button + - Your API key will be displayed (e.g., `8D3135D30437F86EAE2FA4A2A8345000`) + +3. **Save Your API Key Securely** + - Copy the API key immediately + - Store it in a password manager or secure location + - **Never commit this to version control!** + +### Step 3: Construct Your Base URL + +Your API base URL follows this format: + +``` +http://your-server.com//?api_key= +``` + +**Example:** +``` +http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000 +``` + +**For HTTPS (Recommended for Production):** +``` +https://your-server.com:9000/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000 +``` + +--- + +## Making Your First API Call + +### Test Authentication + +Let's verify everything is set up correctly by getting your user information. + +#### Using cURL + +```bash +curl "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=user_info" +``` + +#### Using Python + +```python +import requests + +response = requests.get( + "http://your-server.com/cSbuFLhp/", + params={ + "api_key": "8D3135D30437F86EAE2FA4A2A8345000", + "action": "user_info" + } +) + +print(response.json()) +``` + +#### Using PHP + +```php + +``` + +#### Using JavaScript (Node.js) + +```javascript +const fetch = require('node-fetch'); + +async function getUserInfo() { + const url = 'http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=user_info'; + + const response = await fetch(url); + const data = await response.json(); + + console.log(data); +} + +getUserInfo(); +``` + +### Expected Success Response + +```json +{ + "status": "STATUS_SUCCESS", + "data": { + "id": "1", + "username": "admin", + "member_group_id": "1", + "email": "admin@example.com", + "date_registered": "1609459200", + "last_login": "1734048000", + "status": "1" + } +} +``` + +โœ… **Success!** If you see this response, your authentication is working correctly. + +--- + +## Understanding Responses + +### Success Response Structure + +All successful API calls return: + +```json +{ + "status": "STATUS_SUCCESS", + "data": { + // Response data here + } +} +``` + +- **status**: Always `"STATUS_SUCCESS"` for successful requests +- **data**: Contains the requested information (structure varies by endpoint) + +### Error Response Structure + +Failed API calls return: + +```json +{ + "status": "STATUS_FAILURE", + "error": "Error message description" +} +``` + +- **status**: Always `"STATUS_FAILURE"` for failed requests +- **error**: Human-readable error message + +### Common Error Messages + +| Error Message | Meaning | Solution | +|--------------|---------|----------| +| `Invalid API key` | API key is wrong or expired | Regenerate API key in profile | +| `Access denied` | Access code is incorrect | Verify access code | +| `Missing required parameters` | Required field not provided | Check API documentation | +| `Invalid action` | Action name misspelled | Verify action name | +| `Permission denied` | Insufficient privileges | Check access code group assignment | +| `Resource not found` | ID doesn't exist | Verify the resource ID | + +--- + +## Common Operations + +### 1. Get All Subscription Lines + +```bash +curl "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=get_lines" +``` + +### 2. Get Specific Line Details + +First, get the line ID from `get_lines`, then: + +```bash +curl "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=get_line&id=123" +``` + +### 3. Create New Subscription Line + +```bash +curl -X POST "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=create_line" \ + -d "username=testuser" \ + -d "password=testpass123" \ + -d "max_connections=1" \ + -d "exp_date=2025-12-31" +``` + +### 4. Edit Existing Line + +```bash +curl "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=edit_line&id=123&password=newpassword&max_connections=2" +``` + +### 5. Get All Streams + +```bash +curl "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=get_streams" +``` + +### 6. Get Live Connections + +```bash +curl "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=live_connections" +``` + +### 7. Get Activity Logs + +```bash +curl "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=activity_logs" +``` + +--- + +## Troubleshooting + +### Problem: "Invalid API key" Error + +**Solution:** +1. Regenerate your API key in admin profile +2. Ensure you're using the complete key without spaces +3. Check for special characters that need URL encoding + +### Problem: "Access denied" Error + +**Solution:** +1. Verify your access code is correct +2. Check that the access code is assigned to Administrators group +3. If using IP restriction, verify your current IP is whitelisted + +### Problem: Connection Timeout + +**Solution:** +1. Check if XUI.ONE service is running: `service xuione status` +2. Verify firewall allows the port (80, 8000, or 9000) +3. Check if nginx is running: `systemctl status nginx` + +### Problem: SSL/HTTPS Not Working + +**Solution:** +1. Verify SSL certificate is installed in XUI.ONE +2. Use port 9000 for HTTPS: `https://your-server.com:9000/...` +3. Check certificate validity in panel settings + +### Problem: Empty Response Data + +**Solution:** +1. Check if the resource exists (e.g., lines, streams) +2. Verify you're using the correct action name +3. Check if pagination is needed for large datasets + +--- + +## Best Practices + +### Security + +1. **Use HTTPS in Production** + ``` + https://your-server.com:9000/cSbuFLhp/?api_key=... + ``` + +2. **IP Whitelist Your API Access** + - Restrict access code to your application server IPs + +3. **Rotate API Keys Regularly** + - Regenerate keys every 90 days + +4. **Never Log API Keys** + - Sanitize logs to remove sensitive data + +5. **Use Environment Variables** + ```bash + export XUI_API_KEY="8D3135D30437F86EAE2FA4A2A8345000" + export XUI_ACCESS_CODE="cSbuFLhp" + export XUI_SERVER="your-server.com" + ``` + +### Performance + +1. **Cache Responses** + - Cache data that doesn't change frequently (streams, movies) + +2. **Implement Rate Limiting** + - Limit to 100 requests per minute + +3. **Use Pagination** + - For large datasets, use limit/offset parameters + +4. **Batch Operations** + - When possible, batch multiple updates + +### Error Handling + +1. **Always Check Response Status** + ```python + if data['status'] != 'STATUS_SUCCESS': + handle_error(data['error']) + ``` + +2. **Implement Retry Logic** + - Use exponential backoff for transient errors + +3. **Log All Errors** + - Keep detailed logs for debugging + +--- + +## Next Steps + +Now that you're set up, explore more API capabilities: + +1. ๐Ÿ“– **Read Full API Reference** - Check `openapi.yaml` for all endpoints +2. ๐Ÿ” **Explore Categories** - Browse `/docs/categories/` for detailed guides +3. ๐Ÿ’ป **Try Code Examples** - See `/docs/examples/` for language-specific examples +4. ๐Ÿ“ฆ **Use Postman** - Import the Postman collection for easy testing +5. ๐ŸŽฏ **Build Your Application** - Start integrating XUI.ONE into your project + +### Recommended Reading Order + +1. **Line API** - Manage subscriptions +2. **Streams API** - Control live streams +3. **Logs & Events** - Monitor your platform +4. **Movies/Series API** - Manage VOD content +5. **Servers API** - Configure load balancers + +--- + +## Support + +Need help? + +- ๐Ÿ“– **Documentation**: Check the full API reference +- ๐Ÿ› **Issues**: [Report bugs on GitHub](https://github.com/worldofiptvcom/xui-one-api-docs/issues) +- ๐Ÿ’ฌ **Community**: [World of IPTV Forums](https://www.worldofiptv.com) +- ๐Ÿ“ง **Official Support**: Contact XUI.ONE team + +--- + +**Happy coding! ๐Ÿš€** diff --git a/index.html b/index.html new file mode 100644 index 0000000..5ce8ead --- /dev/null +++ b/index.html @@ -0,0 +1,158 @@ + + + + + + + XUI.ONE Admin API Documentation + + + + +
+

๐ŸŽฌ XUI.ONE Admin API

+

Complete API Documentation for IPTV Panel Administration

+ +
+ +
+ ๐Ÿ“ข Note: This documentation is for XUI.ONE v1.5.13+. + Replace placeholder values (your-server.com, <API-KEY>, <Access-Code>) with your actual credentials. +
+ +
+ + + + + +
+

+ XUI.ONE Admin API Documentation +

+

+ Made with โค๏ธ by World of IPTV +

+

+ Documentation licensed under MIT | XUI.ONE software is proprietary +

+
+ + diff --git a/openapi.yaml b/openapi.yaml new file mode 100644 index 0000000..194397f --- /dev/null +++ b/openapi.yaml @@ -0,0 +1,479 @@ +openapi: 3.0.3 +info: + title: XUI.ONE Admin API + description: | + # XUI.ONE Admin API Documentation + + Comprehensive API documentation for XUI.ONE IPTV Panel Administration. + + ## Overview + + The XUI.ONE Admin API provides programmatic access to manage your IPTV platform. With over 180+ endpoints, you can: + + - Manage subscriptions (Lines, MAG devices, Enigma2 devices) + - Control streams, channels, movies, and series + - Monitor connections and logs + - Configure servers and load balancers + - Administer users and resellers + + ## Base URL Structure + + All API requests follow this pattern: + + ``` + http://YOUR_SERVER:PORT//?api_key=&action=ACTION_NAME + ``` + + **Components:** + - `YOUR_SERVER` - Your XUI.ONE server IP or domain + - `PORT` - API port (default: 80 for HTTP, 8000 for HTTP explicit, 9000 for HTTPS) + - `` - Unique access code for API access + - `` - Your generated API key + - `ACTION_NAME` - The API action to perform + + ## Authentication + + XUI.ONE API uses **API Key authentication** combined with **Access Codes** for secure access. + + ### Prerequisites + + Before using the API, you need: + + 1. โœ… XUI.ONE panel installed and running + 2. โœ… Admin account with appropriate permissions + 3. โœ… Admin API access code created + 4. โœ… API key generated + + ### Step 1: Create Admin API Access Code + + 1. Log into your XUI.ONE admin panel + 2. Navigate to **Management โ†’ Access Control โ†’ Access Codes** + 3. Click **Add Access Code** + 4. Select **Access Type: Admin API** + 5. Assign to **Administrators** group + 6. (Optional) Restrict to specific IP address for security + 7. Save the access code (e.g., `cSbuFLhp`) + + ### Step 2: Generate API Key + + 1. Log into admin panel + 2. Click your profile (top right) + 3. Select **Edit Profile** + 4. Click the blue **Generate API Key** button + 5. Copy and save your API key (e.g., `8D3135D30437F86EAE2FA4A2A8345000`) + + โš ๏ธ **Security Warning:** Keep your API key secure. If compromised, regenerate immediately. + + ### Step 3: Test Authentication + + Test your credentials with a simple API call: + + ```bash + curl "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=user_info" + ``` + + Successful response: + ```json + { + "status": "STATUS_SUCCESS", + "data": { + "username": "admin", + "member_group_id": "1", + ... + } + } + ``` + + ## Request Methods + + The API supports both **GET** and **POST** methods: + + ### GET Requests + + Pass parameters in the URL query string: + + ``` + http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=get_lines&limit=10 + ``` + + ### POST Requests + + Send parameters as form data or JSON in request body: + + ```bash + curl -X POST "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=create_line" \ + -d "username=testuser" \ + -d "password=testpass" \ + -d "max_connections=1" + ``` + + ## Response Format + + All API responses return JSON with a consistent structure: + + ### Success Response + + ```json + { + "status": "STATUS_SUCCESS", + "data": { + // Response data here + } + } + ``` + + ### Error Response + + ```json + { + "status": "STATUS_FAILURE", + "error": "Error message description" + } + ``` + + ## Common Error Messages + + | Error Message | Cause | Solution | + |--------------|-------|----------| + | `Invalid API key` | Wrong or expired API key | Regenerate API key in admin profile | + | `Access denied` | Invalid access code | Verify access code is correct | + | `Missing required parameters` | Required field not provided | Check API documentation for required fields | + | `Invalid action` | Action name is incorrect | Verify action name spelling | + | `Permission denied` | Insufficient privileges | Ensure API access code is assigned to Administrators group | + + ## Rate Limiting + + XUI.ONE implements rate limiting to prevent abuse: + + - Default: No strict rate limit + - Recommended: Max 100 requests per minute per IP + - Heavy operations (database queries): Use sparingly + + If you experience rate limiting, implement exponential backoff in your application. + + ## Security Best Practices + + 1. ๐Ÿ”’ **Use HTTPS** - Always use port 9000 with SSL enabled in production + 2. ๐Ÿ” **IP Whitelisting** - Restrict API access to specific IPs + 3. ๐Ÿ”‘ **Rotate Keys** - Regenerate API keys periodically + 4. ๐Ÿ“ **Audit Logs** - Monitor API usage via activity logs + 5. ๐Ÿšซ **Never Expose Keys** - Don't commit API keys to version control + 6. ๐Ÿ›ก๏ธ **HMAC Authentication** - Use HMAC for enhanced security (advanced) + + ## HMAC Authentication (Advanced) + + For enhanced security, XUI.ONE supports HMAC-based authentication: + + 1. Generate HMAC key: `action=create_hmac` + 2. Sign each request with HMAC-SHA256 + 3. Include signature in request header + + See detailed HMAC documentation for implementation details. + + ## Getting Help + + - ๐Ÿ“– Documentation: https://github.com/worldofiptvcom/xui-one-api-docs + - ๐Ÿ’ฌ Community: World of IPTV Forums (https://www.worldofiptv.com) + - ๐Ÿ› Issues: Report bugs via GitHub Issues + - ๐Ÿ“ง Support: Contact XUI.ONE support team + + ## API Version + + Current API Version: **v1.5.13** + + Compatible with XUI.ONE versions 1.5.5+ + + version: 1.5.13 + contact: + name: XUI.ONE API Support + url: https://xui.one + license: + name: Proprietary + url: https://xui.one + +servers: + - url: http://{server}:{port}/{accessCode} + description: XUI.ONE API Server (HTTP) + variables: + server: + default: your-server.com + description: Your XUI.ONE server IP or domain + port: + default: '80' + description: API port + enum: + - '80' + - '8000' + accessCode: + default: cSbuFLhp + description: Your unique access code for API access + - url: https://{server}:9000/{accessCode} + description: XUI.ONE API Server (HTTPS - Recommended) + variables: + server: + default: your-server.com + description: Your XUI.ONE server IP or domain + accessCode: + default: cSbuFLhp + description: Your unique access code for API access + +security: + - ApiKeyAuth: [] + +tags: + - name: Authentication + description: Authentication and authorization operations + - name: GET INFO + description: Query and retrieve information + - name: Logs & Events + description: Activity logs, connections, and monitoring + - name: Line API + description: Subscription line management + - name: User API + description: User account management + - name: MAG API + description: MAG device management + - name: Enigma API + description: Enigma2 STB management + - name: Streams API + description: Live stream management + - name: Channel API + description: Channel management + - name: Station API + description: Radio station management + - name: Movie API + description: VOD movie management + - name: Series API + description: Series management + - name: Episode API + description: Episode management + - name: Servers API + description: Server and load balancer management + - name: Settings & System + description: System settings and administrative functions + +paths: + /: + get: + summary: API Base Endpoint + description: | + Base endpoint for all API requests. All actions are performed by adding the `action` parameter. + + **Usage:** + ``` + /?api_key=&action=ACTION_NAME¶m1=value1¶m2=value2 + ``` + operationId: apiBase + tags: + - Authentication + parameters: + - $ref: '#/components/parameters/ApiKey' + - $ref: '#/components/parameters/Action' + responses: + '200': + description: Successful response + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/SuccessResponse' + - $ref: '#/components/schemas/ErrorResponse' + '401': + $ref: '#/components/responses/Unauthorized' + '500': + $ref: '#/components/responses/ServerError' + + /?action=user_info: + get: + summary: Get Current User Info + description: | + Retrieves information about the currently authenticated admin user. + + **Use Case:** Verify authentication and check admin privileges. + + **Example Request:** + ```bash + curl "http://your-server.com/cSbuFLhp/?api_key=8D3135D30437F86EAE2FA4A2A8345000&action=user_info" + ``` + + **Example Response:** + ```json + { + "status": "STATUS_SUCCESS", + "data": { + "id": "1", + "username": "admin", + "member_group_id": "1", + "email": "admin@example.com", + "date_registered": "1609459200", + "last_login": "1734048000", + "status": "1" + } + } + ``` + operationId: getUserInfo + tags: + - Authentication + parameters: + - $ref: '#/components/parameters/ApiKey' + - name: action + in: query + required: true + schema: + type: string + enum: [user_info] + example: user_info + responses: + '200': + description: Current user information + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/SuccessResponse' + - type: object + properties: + data: + $ref: '#/components/schemas/UserInfo' + example: + status: "STATUS_SUCCESS" + data: + id: "1" + username: "admin" + member_group_id: "1" + email: "admin@example.com" + date_registered: "1609459200" + last_login: "1734048000" + status: "1" + '401': + $ref: '#/components/responses/Unauthorized' + +components: + securitySchemes: + ApiKeyAuth: + type: apiKey + in: query + name: api_key + description: | + API key for authentication. Generate from your admin profile in the XUI.ONE panel. + + **Example:** `8D3135D30437F86EAE2FA4A2A8345000` + + parameters: + ApiKey: + name: api_key + in: query + required: true + description: Your API key for authentication + schema: + type: string + example: "8D3135D30437F86EAE2FA4A2A8345000" + + Action: + name: action + in: query + required: true + description: The API action to perform + schema: + type: string + example: user_info + + schemas: + SuccessResponse: + type: object + required: + - status + - data + properties: + status: + type: string + enum: [STATUS_SUCCESS] + description: Response status indicator + data: + type: object + description: Response data (structure varies by endpoint) + example: + status: "STATUS_SUCCESS" + data: {} + + ErrorResponse: + type: object + required: + - status + - error + properties: + status: + type: string + enum: [STATUS_FAILURE] + description: Error status indicator + error: + type: string + description: Error message describing what went wrong + example: + status: "STATUS_FAILURE" + error: "Invalid API key" + + UserInfo: + type: object + properties: + id: + type: string + description: User ID + example: "1" + username: + type: string + description: Username + example: "admin" + member_group_id: + type: string + description: Member group ID (1 = Administrator) + example: "1" + email: + type: string + format: email + description: User email address + example: "admin@example.com" + date_registered: + type: string + description: Unix timestamp of registration date + example: "1609459200" + last_login: + type: string + description: Unix timestamp of last login + example: "1734048000" + status: + type: string + description: User status (1 = Active, 0 = Inactive) + enum: ["0", "1"] + example: "1" + + responses: + Unauthorized: + description: Authentication failed - Invalid API key or access code + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + status: "STATUS_FAILURE" + error: "Invalid API key" + + ServerError: + description: Internal server error + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + status: "STATUS_FAILURE" + error: "Internal server error" + + NotFound: + description: Resource not found + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' + example: + status: "STATUS_FAILURE" + error: "Resource not found" diff --git a/upload-to-github.sh b/upload-to-github.sh new file mode 100644 index 0000000..a651d44 --- /dev/null +++ b/upload-to-github.sh @@ -0,0 +1,113 @@ +#!/bin/bash + +# XUI.ONE API Documentation - Git Upload Script +# This script will initialize git and push all files to GitHub + +echo "================================================" +echo " XUI.ONE API Documentation - Git Upload" +echo "================================================" +echo "" + +# Colors for output +GREEN='\033[0;32m' +BLUE='\033[0;34m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# Configuration +REPO_URL="https://github.com/worldofiptvcom/xui-one-api-docs.git" +BRANCH="main" + +# Step 1: Initialize Git (if not already initialized) +echo -e "${BLUE}Step 1: Initializing Git repository...${NC}" +if [ ! -d ".git" ]; then + git init + echo -e "${GREEN}โœ“ Git initialized${NC}" +else + echo -e "${GREEN}โœ“ Git already initialized${NC}" +fi +echo "" + +# Step 2: Add remote +echo -e "${BLUE}Step 2: Setting up remote repository...${NC}" +if git remote | grep -q "origin"; then + echo -e "${YELLOW}โš  Remote 'origin' already exists. Updating URL...${NC}" + git remote set-url origin $REPO_URL +else + git remote add origin $REPO_URL +fi +echo -e "${GREEN}โœ“ Remote configured: $REPO_URL${NC}" +echo "" + +# Step 3: Add all files +echo -e "${BLUE}Step 3: Adding files to git...${NC}" +git add . +echo -e "${GREEN}โœ“ Files staged for commit${NC}" +echo "" + +# Step 4: Show what will be committed +echo -e "${BLUE}Files to be committed:${NC}" +git status --short +echo "" + +# Step 5: Commit +echo -e "${BLUE}Step 4: Creating commit...${NC}" +read -p "Enter commit message (or press Enter for default): " COMMIT_MSG +if [ -z "$COMMIT_MSG" ]; then + COMMIT_MSG="Initial commit: Add XUI.ONE API documentation with authentication section" +fi +git commit -m "$COMMIT_MSG" +echo -e "${GREEN}โœ“ Commit created${NC}" +echo "" + +# Step 6: Set branch name +echo -e "${BLUE}Step 5: Setting branch name...${NC}" +git branch -M $BRANCH +echo -e "${GREEN}โœ“ Branch set to: $BRANCH${NC}" +echo "" + +# Step 7: Push to GitHub +echo -e "${BLUE}Step 6: Pushing to GitHub...${NC}" +echo -e "${YELLOW}You may be prompted for your GitHub username and password/token${NC}" +git push -u origin $BRANCH + +# Check if push was successful +if [ $? -eq 0 ]; then + echo "" + echo -e "${GREEN}================================================${NC}" + echo -e "${GREEN} โœ“ Successfully uploaded to GitHub!${NC}" + echo -e "${GREEN}================================================${NC}" + echo "" + echo -e "View your repository at:" + echo -e "${BLUE}https://github.com/worldofiptvcom/xui-one-api-docs${NC}" + echo "" + echo -e "Next steps:" + echo "1. Visit the repository URL above" + echo "2. Enable GitHub Pages (Settings โ†’ Pages โ†’ Source: main branch)" + echo "3. Your documentation will be live at:" + echo " https://worldofiptvcom.github.io/xui-one-api-docs/" + echo "" +else + echo "" + echo -e "${YELLOW}================================================${NC}" + echo -e "${YELLOW} โš  Push failed or requires authentication${NC}" + echo -e "${YELLOW}================================================${NC}" + echo "" + echo "If you're having authentication issues:" + echo "" + echo "Option 1: Use Personal Access Token (Recommended)" + echo " 1. Go to GitHub Settings โ†’ Developer settings โ†’ Personal access tokens" + echo " 2. Generate new token (classic) with 'repo' scope" + echo " 3. Use token as password when prompted" + echo "" + echo "Option 2: Use GitHub CLI" + echo " 1. Install: https://cli.github.com/" + echo " 2. Run: gh auth login" + echo " 3. Re-run this script" + echo "" + echo "Option 3: Use SSH" + echo " 1. Add SSH key to GitHub" + echo " 2. Change remote: git remote set-url origin git@github.com:worldofiptvcom/xui-one-api-docs.git" + echo " 3. Re-run: git push -u origin main" + echo "" +fi