Skip to content

Commit e817110

Browse files
author
roomhackerfrom100
committed
Initial sanitized public GPTAdmin release
0 parents  commit e817110

148 files changed

Lines changed: 30040 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: Bug report
3+
about: Report a bug in GPT‑Админ
4+
title: "[BUG] "
5+
labels: bug
6+
---
7+
## Describe the bug
8+
A clear description of what's wrong.
9+
10+
## To reproduce
11+
Steps to trigger the behavior:
12+
1.
13+
2.
14+
3.
15+
16+
## Expected behavior
17+
What you expected to happen.
18+
19+
## Environment
20+
- OS:
21+
- Python version:
22+
- GPT‑Админ version (`cat VERSION` or `gptadmin --version`):
23+
- How you connect (MCP client / browser extension / Custom GPT):
24+
25+
## Logs
26+
Paste relevant logs (redact secrets!):
27+
```
28+
```
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
name: Feature request
3+
about: Suggest a feature
4+
title: "[FEAT] "
5+
labels: enhancement
6+
---
7+
## What
8+
What feature would you like?
9+
10+
## Why
11+
Why is it useful? What problem does it solve?
12+
13+
## How (optional)
14+
Any ideas on implementation?

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## What
2+
Brief description of what this PR changes.
3+
4+
## Why
5+
Why is this change needed?
6+
7+
## How
8+
Key implementation details.
9+
10+
## Testing
11+
- [ ] `pytest tests/ -v` passes
12+
- [ ] Manually tested on (OS):
13+
14+
## Checklist
15+
- [ ] No secrets/tokens in the diff
16+
- [ ] Commit messages follow `feat:`/`fix:`/`docs:` convention
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Build and Sync Binaries
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags: [ 'v*' ]
7+
workflow_dispatch:
8+
9+
jobs:
10+
build-and-sync:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout private repo
14+
uses: actions/checkout@v4
15+
16+
- name: Setup uv
17+
uses: astral-sh/setup-uv@v3
18+
with:
19+
enable-cache: true
20+
21+
- name: Install dependencies and test
22+
run: |
23+
uv sync
24+
uv run pytest tests/ -v
25+
26+
- name: Build binaries
27+
run: |
28+
chmod +x tools/build.sh
29+
./tools/build.sh
30+
31+
- name: Checkout opensource repo
32+
uses: actions/checkout@v4
33+
with:
34+
repository: megamen32/gptadmin_opensource
35+
token: ${{ secrets.OPENSOURCE_PAT }}
36+
path: gptadmin_opensource
37+
38+
- name: Sync binaries to opensource repo
39+
run: |
40+
rm -rf gptadmin_opensource/binaries/*
41+
mkdir -p gptadmin_opensource/binaries
42+
cp -r build/* gptadmin_opensource/binaries/
43+
44+
cd gptadmin_opensource
45+
git config user.name "github-actions[bot]"
46+
git config user.email "github-actions[bot]@users.noreply.github.com"
47+
git add binaries/
48+
git commit -m "chore: update binaries from private repo [skip ci]" || echo "No changes to commit"
49+
git push

.github/workflows/release.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Setup Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.11'
21+
22+
- name: Install dependencies
23+
run: pip install fastapi uvicorn pydantic psutil requests httpx
24+
25+
- name: Run tests
26+
run: python -m pytest tests/ -v || true
27+
28+
- name: Build package
29+
run: |
30+
mkdir -p build
31+
tar -czf build/gptadmin-${{ github.ref_name }}.tar.gz \
32+
hub_proxy.py hub_watchdog.py server_for_installer.py \
33+
gptadmin_security.py cli.py telegram_logs_bot.py \
34+
client/ public/ deploy/ tests/ \
35+
--exclude='*.pyc' --exclude='__pycache__' || true
36+
37+
- name: Create GitHub Release
38+
uses: softprops/action-gh-release@v2
39+
with:
40+
generate_release_notes: true
41+
files: build/*.tar.gz
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# --- Python ---
2+
/.venv
3+
__pycache__/
4+
*.pyc
5+
*.pyo
6+
*.pyd
7+
*.egg-info/
8+
9+
# --- Node ---
10+
node_modules/
11+
package-lock.json.bak*
12+
13+
# --- Build artifacts ---
14+
build/
15+
*.spec
16+
.buildcache/
17+
18+
# --- Runtime data & config ---
19+
config/
20+
logs/
21+
logs_config.json
22+
*.log
23+
*.db
24+
router_cookies.json
25+
26+
# --- Backup files ---
27+
*.bak*
28+
requirements.txt.bak*
29+
services/main_package/client.bak.*/
30+
31+
# --- Apps (separate projects) ---
32+
apps/
33+
34+
# --- Private deploy configs ---
35+
deploy/nginx/became.bezrabotnyi.com.conf
36+
deploy/systemd/
37+
38+
# --- Tunnels & tokens ---
39+
ngrok_url.txt
40+
.cloudflared/
41+
# Local mac tunnel matrix secrets
42+
scripts/check_mac_tunnel_matrix.env
43+
44+
# --- AI assistant settings (private) ---
45+
.claude/
46+
.serena/
47+
48+
# --- Archives belong in releases, not the repo ---
49+
*.tar.gz
50+
*.zip
51+
52+
# --- Misc scratch ---
53+
1.html

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "website"]
2+
path = website
3+
url = https://github.com/megamen32/adminchatgpt_website/

AGENTS.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# AGENTS instructions
2+
3+
## Обзор
4+
В репозитории два основных Python‑сервиса:
5+
6+
1. **services/shellmcp.py** – небольшой FastAPI сервер, который запускается от имени root и выполняет низкоуровневые задачи.
7+
2. **services/gptadmin_hub.py** – прокси, через который клиенты могут обращаться к нескольким экземплярам shellmcp. Он хранит их метаданные и маршрутизирует вызовы.
8+
9+
`public/openapi.yaml` содержит полное описание API gptadmin_hub (и через него – shellmcp). Скрипты `deploy/install_*.sh` и systemd‑юниты демонстрируют развёртывание сервисов. `deploy/setup_nginx.sh` настраивает доступ по HTTPS.
10+
11+
Тесты (`tests/test_shellmcp.py`, `tests/test_hub.py`) отправляют простые HTTP‑запросы и служат примером использования.
12+
13+
## services/shellmcp.py
14+
- Эндпоинты: `/exec`, `/file`, `/dir`, `/systemd/...`, `/venv/...`, `/system/info`, `/system/health`, `/heartbeat`.
15+
- Аутентификация – Bearer token (`SHELLMCP_TOKEN`).
16+
- Параметры логирования и тайм‑аутов задаются через переменные окружения (`LOG_LIMIT_B`, `EXEC_TIMEOUT`, и др.).
17+
- Функция `heartbeat()` периодически отправляет POST на `HUB_URL` для регистрации в gptadmin_hub.
18+
- Все операции логируются через `logging` в файл `shellmcp.log` и stdout.
19+
20+
## services/gptadmin_hub.py
21+
- Принимает `POST /heartbeat` от shellmcp и сохраняет информацию о сервере (URL, токен, время).
22+
- `GET /servers` возвращает список зарегистрированных shellmcp с флагом `alive`.
23+
- Все клиентские вызовы имеют форму `/srv/{path}?server=name` и перенаправляются к нужному shellmcp с подстановкой его токена.
24+
- Проверяет авторизацию через `CTL_TOKEN`.
25+
26+
## Команда "обнови сайт"
27+
Полный цикл обновления website (Next.js):
28+
```bash
29+
bash scripts/update-website.sh
30+
```
31+
Что делает:
32+
1. `git pull` в `website/`
33+
2. `bun run build`
34+
3. `sudo systemctl restart gptadminwebsite-next.service`
35+
36+
## Работа c кодом
37+
- Соблюдайте уже используемый стиль (f‑строки, явное логирование).
38+
- Логи пишутся через `logging.getLogger('shellmcp')` и `logging.basicConfig(...)`.
39+
- Перед отправкой изменений запускайте простые тесты:
40+
```bash
41+
python tests/test_shellmcp.py
42+
python tests/test_hub.py
43+
```
44+
При необходимости добавьте полноценные тесты на `pytest` и запускайте `pytest -q`.

CHANGELOG.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Changelog
2+
3+
All notable changes to GPT‑Админ are documented here.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
- AGPL-3.0 license
12+
- SECURITY.md (responsible disclosure policy)
13+
- CONTRIBUTING.md (dev setup, code style, PR process)
14+
- CODE_OF_CONDUCT.md (Contributor Covenant v2.1)
15+
- Open-core launch plan (`docs/OPEN_CORE_PLAN.md`)
16+
- New README with vision, architecture diagram, quickstart, 3 adapters, use-cases
17+
- pyproject.toml: license metadata, classifiers, keywords
18+
19+
### Changed
20+
- `.gitignore`: fixed broken merge conflict markers, merged duplicates, added
21+
`.claude/`, `.serena/`, `*.tar.gz`, `*.zip`, `ngrok_url.txt`, `.cloudflared/`,
22+
`scripts/check_mac_tunnel_matrix.env`
23+
24+
### Removed
25+
- `gptadmin_refactor_2026-05-11_15-18-03.tar.gz` (repo junk)
26+
- `root_hub_license_refactor.zip` (repo junk)
27+
- `.claude/`, `.serena/` (private AI-assistant settings)
28+
29+
### Security
30+
- Scrubbed leaked `MCP_AUTH_TOKEN` from git history via `git filter-repo`
31+
- Scrubbed leaked `CTL_TOKEN` / `ADMIN_PASSWORD` from git history
32+
33+
## [0.1.0] - 2025-05-01
34+
35+
### Added
36+
- Initial release of GPT‑Админ
37+
- `gptadmin_hub` — MCP hub, proxies commands to agents
38+
- `shellmcp` — shell agent (Python + Go) for target machines
39+
- Three adapters: OpenAI Action, MCP remote SSE, browser extension (userscript)
40+
- CLI (`gptadmin`): setup, tunnel (FRP/Cloudflare), status, logs
41+
- Web panel at `/admin` (queue, agent/MCP health, logs)
42+
- OAuth for OpenAI SDK
43+
- Auto-tunnel via FRP and Cloudflare
44+
- Install scripts for Linux/macOS/Windows (user-mode and system-mode)

CODE_OF_CONDUCT.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment:
18+
19+
* Demonstrating empathy and kindness toward other people
20+
* Being respectful of differing opinions, viewpoints, and experiences
21+
* Giving and gracefully accepting constructive feedback
22+
* Accepting responsibility and apologizing to those affected by mistakes
23+
* Focusing on what is best for the overall community
24+
25+
Examples of unacceptable behavior:
26+
27+
* The use of sexualized language or imagery, and sexual attention or advances
28+
* Trolling, insulting or derogatory comments, and personal or political attacks
29+
* Public or private harassment
30+
* Publishing others' private information without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate
32+
33+
## Enforcement Responsibilities
34+
35+
Community leaders are responsible for clarifying and enforcing our standards
36+
and will take appropriate and fair corrective action in response to any
37+
behavior they deem inappropriate, threatening, offensive, or harmful.
38+
39+
## Scope
40+
41+
This Code of Conduct applies within all community spaces, and also applies
42+
when an individual is officially representing the community in public spaces.
43+
44+
## Enforcement
45+
46+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
47+
reported to the community leaders responsible for enforcement via Telegram
48+
[@careviolan](https://t.me/careviolan). All complaints will be reviewed and
49+
investigated promptly and fairly.
50+
51+
## Attribution
52+
53+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
54+
version 2.1, available at
55+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).
56+
57+
[homepage]: https://www.contributor-covenant.org
58+
59+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).

0 commit comments

Comments
 (0)