From 9e26d44303ce7b3d5842649041b4bb9ef1bbc5c2 Mon Sep 17 00:00:00 2001 From: aaronjaworski710 Date: Thu, 15 Oct 2026 14:19:40 +0300 Subject: [PATCH] =?UTF-8?q?v1.4:=20mail=20for=20people=20=E2=80=94=20domai?= =?UTF-8?q?n=20allowlist=20scan=20(yahoo/icloud/proton/gmx/web.de/mail.ru?= =?UTF-8?q?=20ALLOWED,=20gmail/outlook/temp-mail=20BLOCKED),=20yahoo=20das?= =?UTF-8?q?h-alias=20unlimited=20provider,=20imap=5Fpool=20multi-inbox=20p?= =?UTF-8?q?rovider,=20HOST=5FMAP=20auto-detect,=20start=5Fall=20auto-insta?= =?UTF-8?q?lls=20OpenCode=20provider,=20mail=20chain=20badge=20in=20dashbo?= =?UTF-8?q?ard,=20robust=20home=20resolve=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 36 +++++++++++++- autoreg/config.example.json | 11 +++++ autoreg/dashboard.py | 38 +++++++++++++- autoreg/imap_pool.example.txt | 15 ++++++ autoreg/index.html | 12 ++++- autoreg/mail_providers.py | 93 +++++++++++++++++++++++++++++++++-- autoreg/start_all.py | 26 +++++++++- 7 files changed, 223 insertions(+), 8 deletions(-) create mode 100644 autoreg/imap_pool.example.txt diff --git a/README.md b/README.md index 54005b1..8631b42 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ cd gateway && npm install && node server.mjs ### Почтовые вариации (mail_providers.py + config.json) Цепочка провайдеров в `config.json → mail.providers` (первый исчерпан → следующий): -- **catchall** — свой домен с catch-all forwarding (ForwardEmail/Cloudflare) → код читается из Gmail IMAP. Безлимит адресов `lg@yourdomain.com`. Clerk НЕ блокирует собственные домены. E2E проверено: vortexio-style домен → org активирован → auto-import 201. +- **catchall** — свой домен с catch-all forwarding (ForwardEmail/Cloudflare) → код читается из Gmail IMAP. Безлимит адресов `lg@yourdomain.com`. Clerk НЕ блокирует собственные домены. E2E проверено: свой catch-all домен → org активирован → auto-import 201. - **imap** — любой свой ящик (Gmail app-password / Outlook / свой сервер), plus/dot-алиасы. - **tonline** — пул `email:pass` файл, IMAP secureimap.t-online.de. - Temp-mail (voidash и т.п.) — **заблокирован Clerk** ("temporary email services are not allowed"), не использовать. @@ -181,3 +181,37 @@ opencode run -m logicc/gpt-6-luna "hello" - Промпт >50KB дамвится в `data/last_prompt.txt` для отладки WAF-триггеров. Проверено E2E: `opencode run` gpt-6-luna → `OC-FARM-OK` (exit 0), claude-5.5-sonnet → арифметика OK. + + +## v1.4 — Почта «для людей» + авто-установка OpenCode + +### Какие почтовые домены пропускает Logicc (проверено live-сканом Clerk, 15.10) +| Статус | Домены | +|---|---| +| ALLOWED | yahoo.com, icloud.com, proton.me, gmx.de, web.de, mail.ru (+ inbox.ru/bk.ru/list.ru), t-online.de, свои домены | +| BLOCKED (`not_allowed_access`) | gmail.com (включая +алиасы), outlook.com, hotmail.com | +| BLOCKED (`form_email_address_blocked`) | все temp-mail: mail.tm, guerrillamail, voidash и т.п. | + +### Провайдер `imap` — БЕЗЛИМИТ с одного ящика +- **Yahoo** (`"alias": "dash"`): disposable-адреса `base-@yahoo.com` — один бесплатный yahoo-ящик + app password = неограниченно аккаунтов. Проверено: dash-алиас ACCEPTED Clerk'ом. +- **Proton** (`"alias": "plus"`): `base+@proton.me` — ACCEPTED (чтение кода через Proton Bridge). +- IMAP-хост определяется автоматически по домену (HOST_MAP), можно переопределить `imap_host`. + +### Провайдер `imap_pool` — пул ящиков +Файл `imap_pool.txt`, построчно `email:pass[:host[:port]]` (шаблон: `imap_pool.example.txt`). +1 ящик = 1 аккаунт Logicc. Люди без своего домена: нарегать бесплатных mail.ru / yahoo / gmx / web.de ящиков (у всех бесплатный IMAP + app-пароли) и закинуть в пул. + +```json +"mail": { "providers": ["catchall", "imap_pool", "imap", "tonline"], + "imap_pool": { "pool_file": "imap_pool.txt" }, + "imap": { "user": "you@yahoo.com", "password_env": "YAHOO_APP_PW", "alias": "dash" } } +``` + +### OpenCode: софт САМ ставит провайдера +- `python start_all.py` — при каждом запуске стека автоматически пишет провайдера `logicc` в `~/.config/opencode/opencode.json` (если gateway поднят). +- Кнопка **⚡ OpenCode 1-click** в дашборде — то же самое вручную. +- Фикс: детached-процессы без `USERPROFILE` больше не пишут конфиг в мусорную папку `~` (robust home-резолв). + +### Дашборд +- Badge **Mail pool** теперь показывает живую цепочку из config: `catchall(N dom) → imap_pool(N) → tonline`. +- `/api/status → mail`: провайдеры, размер imap_pool, число catchall-доменов, alias-ящик (маскируется). diff --git a/autoreg/config.example.json b/autoreg/config.example.json index ea0c9f9..5b762ca 100644 --- a/autoreg/config.example.json +++ b/autoreg/config.example.json @@ -2,6 +2,8 @@ "mail": { "providers": [ "catchall", + "imap_pool", + "imap", "tonline" ], "catchall": { @@ -14,6 +16,15 @@ }, "tonline": { "pool_file": "path/to/working_mails.txt" + }, + "imap_pool": { + "pool_file": "imap_pool.txt" + }, + "imap": { + "user": "your-inbox@yahoo.com", + "password_env": "YAHOO_APP_PW", + "alias": "dash", + "_comment": "dash=yahoo disposable (безлимит с 1 ящика), plus=proton/gmail-style, dot=gmail; host авто по домену. ALLOWED-домены: yahoo/mail.ru/gmx.de/web.de/icloud/proton.me. BLOCKED: gmail/outlook/hotmail/temp-mail." } }, "gateway": { diff --git a/autoreg/dashboard.py b/autoreg/dashboard.py index ba43cb9..d9b21cd 100644 --- a/autoreg/dashboard.py +++ b/autoreg/dashboard.py @@ -105,6 +105,30 @@ def captcha_balances(): return out +def mail_info(): + """Почтовая цепочка: провайдеры из config + размеры пулов.""" + try: + import mail_providers as MP + cfg = MP.load_cfg() + mail = cfg.get("mail", {}) + names = mail.get("providers", ["tonline"]) + info = {"providers": names} + try: + pool = MP.ImapPool(mail.get("imap_pool", {})) + info["imap_pool"] = pool.count() + except Exception: + info["imap_pool"] = 0 + ca = mail.get("catchall", {}) + info["catchall_domains"] = len(ca.get("domains", [])) + im = mail.get("imap", {}) + if im.get("user"): + u = im["user"] + info["imap_alias"] = u[:3] + "***@" + u.split("@")[-1] + " (" + im.get("alias", "plus") + ")" + return info + except Exception as e: + return {"err": str(e)[:80]} + + def pc_stats(): """CPU/RAM через ctypes (Windows) с фолбэком на /proc (Linux). stdlib-only.""" out = {"cpu_pct": None, "ram_used_gb": None, "ram_total_gb": None} @@ -223,6 +247,7 @@ def status_all(): "gateway": {"up": gw_code == 200, "code": gw_code, "models": gw_models}, "pool_left": pool_left, "disk_free_gb": round(disk.free / 2**30, 1), + "mail": mail_info(), "pc": pc_stats(), "services": services_ping(), "captcha": captcha_balances(), @@ -351,9 +376,20 @@ def opencode_snippet(base=None): } +def _user_home(): + """expanduser('~') ломается в detached-процессах без USERPROFILE — резолвим надёжно.""" + h = os.environ.get("USERPROFILE") or os.environ.get("HOME") or "" + e = os.path.expanduser("~") + if e and not e.startswith("~"): + return e + if h: + return h + return "C:/Users/User" if os.name == "nt" else "/root" + + def opencode_install(): """1-click: merge logicc provider into the user's global opencode config.""" - home = os.path.expanduser("~") + home = _user_home() cfg_dir = os.path.join(home, ".config", "opencode") os.makedirs(cfg_dir, exist_ok=True) path = os.path.join(cfg_dir, "opencode.json") diff --git a/autoreg/imap_pool.example.txt b/autoreg/imap_pool.example.txt new file mode 100644 index 0000000..27a1229 --- /dev/null +++ b/autoreg/imap_pool.example.txt @@ -0,0 +1,15 @@ +# Пул ящиков для imap_pool провайдера. Формат: email:pass[:host[:port]] +# 1 ящик = 1 аккаунт Logicc (без алиасов). Хост авто-определяется по домену: +# yahoo.com -> imap.mail.yahoo.com mail.ru/inbox.ru/bk.ru -> imap.mail.ru +# gmx.de/gmx.com -> imap.gmx.net web.de -> imap.web.de +# icloud.com -> imap.mail.me.com t-online.de -> secureimap.t-online.de +# ВАЖНО: Logicc Clerk BLOCKS: gmail.com, outlook.com, hotmail.com и все temp-mail +# (mail.tm, guerrilla, voidash = form_email_address_blocked). +# ALLOWED: yahoo.com, mail.ru, gmx.de, web.de, icloud.com, proton.me, yandex? (не тестирован) +# Yahoo: включите "app password" (Account Security) — обычный пароль по IMAP не работает. +# mail.ru: включите IMAP в настройках почты, используйте «пароль для внешних приложений». +# +# Примеры строк (скопировать в imap_pool.txt без #): +# mybox123@yahoo.com:abcdefghijklmno +# mybox456@mail.ru:MyAppPassword123 +# custom@mydomain.com:pass:imap.mydomain.com:993 diff --git a/autoreg/index.html b/autoreg/index.html index 587181c..c164c59 100644 --- a/autoreg/index.html +++ b/autoreg/index.html @@ -222,7 +222,7 @@
-

Mail pool

catchall + t-online
+

Mail pool

...
—addresses available
@@ -457,6 +457,16 @@ function renderSystem(S) { const sv = S.services || {}; + const mi = S.mail || {}; + const mc = $('mail-chain'); + if (mc) { + const parts = (mi.providers || []).map(p => { + if (p === 'imap_pool') return 'imap_pool(' + (mi.imap_pool || 0) + ')'; + if (p === 'catchall') return 'catchall(' + (mi.catchall_domains || 0) + ' dom)'; + return p; + }); + mc.textContent = parts.length ? parts.join(' → ') : 'no mail config'; + } const waveUp = !!(S.wave && S.wave.running); const items = [ ['Captcha sidecar', ':8877 free turnstile', !!sv.sidecar], diff --git a/autoreg/mail_providers.py b/autoreg/mail_providers.py index 94abdb5..3e2cf75 100644 --- a/autoreg/mail_providers.py +++ b/autoreg/mail_providers.py @@ -7,7 +7,10 @@ mail_providers.py — сменные почтовые провайдеры дл catchall — СВОЙ домен с catch-all forwarding (ForwardEmail/Cloudflare) → Gmail IMAP. Clerk НЕ блокирует собственные домены (temporary-email blocklist не срабатывает). Безлимит адресов: lg@domain - imap — произвольный ящик (Gmail/Outlook/свой сервер) с plus- или dot-алиасами + imap — произвольный ящик с plus/dot/dash-алиасами (dash = yahoo disposable: + один yahoo-ящик = БЕЗЛИМИТ адресов; host авто по домену) + imap_pool — пул ящиков из файла email:pass[:host[:port]] (mail.ru/yahoo/gmx/web.de — + бесплатные домены, которые Clerk ПРОПУСКАЕТ; gmail/outlook/hotmail/temp-mail — БЛОК) voidash — temp-mail (ВНИМАНИЕ: Clerk логирует «temporary email services are not allowed», все voidash-домены заблокированы на sign_up; провайдер оставлен для других целей) @@ -42,6 +45,31 @@ def _secret(cfg_block, key): return cfg_block.get(key, "") +# авто-хосты IMAP для популярных ALLOWED-доменов (проверено Clerk-allowlist 15.10: +# icloud/yahoo/proton/gmx.de/web.de/mail.ru = ALLOWED; gmail/outlook/hotmail = BLOCKED not_allowed; +# temp-mail сервисы (mail.tm/guerrilla/voidash) = BLOCKED temporary) +HOST_MAP = { + "yahoo.com": ("imap.mail.yahoo.com", 993), + "ymail.com": ("imap.mail.yahoo.com", 993), + "mail.ru": ("imap.mail.ru", 993), + "inbox.ru": ("imap.mail.ru", 993), + "list.ru": ("imap.mail.ru", 993), + "bk.ru": ("imap.mail.ru", 993), + "gmx.de": ("imap.gmx.net", 993), + "gmx.com": ("imap.gmx.net", 993), + "gmx.net": ("imap.gmx.net", 993), + "web.de": ("imap.web.de", 993), + "icloud.com": ("imap.mail.me.com", 993), + "me.com": ("imap.mail.me.com", 993), + "t-online.de": ("secureimap.t-online.de", 993), +} + + +def _host_for(email): + dom = email.split("@")[-1].lower() + return HOST_MAP.get(dom) + + # ───────────────────────── readers (ждут код письма) ───────────────────────── def _imap_read_code(host, port, user, pw, target_email, since_ts, timeout, use_ssl=True, @@ -179,7 +207,11 @@ class GenericIMAP(Provider): self.port = int(cfg.get("imap_port", 993)) self.user = cfg.get("user", "") self.pw = _secret(cfg, "password") - self.mode = cfg.get("alias", "plus") # plus | dot | none + self.mode = cfg.get("alias", "plus") # plus | dot | dash | none + if not self.host: # авто-определение по домену ящика + hm = _host_for(self.user) if self.user else None + if hm: + self.host, self.port = hm[0], hm[1] def next_address(self): if not (self.host and self.user and self.pw): @@ -190,6 +222,8 @@ class GenericIMAP(Provider): addr = "%s+%s@%s" % (base, tag, dom) elif self.mode == "dot": addr = base + "." + tag[:6] + "@" + dom + elif self.mode == "dash": # yahoo disposable: base-tag@yahoo.com + addr = "%s-%s@%s" % (base, tag, dom) else: addr = self.user h, p, u, pw = self.host, self.port, self.user, self.pw @@ -200,7 +234,60 @@ class GenericIMAP(Provider): return addr, None, wait_code -BUILDERS = {"tonline": TOnline, "catchall": CatchAll, "imap": GenericIMAP} +class ImapPool(Provider): + """ПУЛ любых ящиков (файл email:pass[:host[:port]], по строке на ящик). + Хост авто по домену (HOST_MAP) или явный в строке. 1 ящик = 1 аккаунт Logicc. + Для людей: набейте пул бесплатными mail.ru/yahoo/gmx/web.de ящиками.""" + name = "imap_pool" + + def __init__(self, cfg): + pf = cfg.get("pool_file", "imap_pool.txt") + self.pool_file = pf if os.path.isabs(pf) else os.path.join(HERE, pf) + + def _load(self): + out = [] + if not os.path.exists(self.pool_file): + return out + with open(self.pool_file, encoding="utf-8", errors="replace") as f: + for ln in f: + ln = ln.strip() + if not ln or ln.startswith("#") or ":" not in ln: + continue + parts = ln.split(":") + em, pw = parts[0].strip(), parts[1].strip() + host = parts[2].strip() if len(parts) > 2 and parts[2].strip() else None + port = int(parts[3]) if len(parts) > 3 and parts[3].strip() else 993 + if not host: + hm = _host_for(em) + if hm: + host, port = hm[0], hm[1] + if not host: + continue + out.append((em, pw, host, port)) + return out + + def count(self): + return len(self._load()) + + def next_address(self): + rows = self._load() + if not rows: + return None + st = _load_state() + idx = st.get("imap_pool_idx", 0) + if idx >= len(rows): + return None + em, pw, host, port = rows[idx] + st["imap_pool_idx"] = idx + 1 + _save_state(st) + + def wait_code(since_ts, timeout=420): + return _imap_read_code(host, port, em, pw, em, since_ts, timeout) + + return em, pw, wait_code + + +BUILDERS = {"tonline": TOnline, "catchall": CatchAll, "imap": GenericIMAP, "imap_pool": ImapPool} class MailChain: diff --git a/autoreg/start_all.py b/autoreg/start_all.py index 0e60370..878aa2b 100644 --- a/autoreg/start_all.py +++ b/autoreg/start_all.py @@ -14,6 +14,7 @@ import os import subprocess import sys import time +import urllib.error import urllib.request HERE = os.path.dirname(os.path.abspath(__file__)) @@ -31,8 +32,10 @@ def ping(url, timeout=3): try: with urllib.request.urlopen(url, timeout=timeout) as r: return r.status < 500 - except Exception as e: - return getattr(e, "code", 0) is not None and getattr(e, "code", 0) < 500 + except urllib.error.HTTPError as e: + return e.code < 500 + except Exception: + return False def py(): @@ -81,6 +84,24 @@ def start_gateway(): print("[gateway] node not installed — skip") +def install_opencode(): + """Софт САМ дописывает провайдера logicc в ~/.config/opencode/opencode.json.""" + if not ping("http://127.0.0.1:18789/health"): + print("[opencode] gateway down — skip auto-install") + return + port = os.environ.get("LG_DASH_PORT", "8560") + try: + req = urllib.request.Request("http://127.0.0.1:%s/api/opencode/install" % port, + data=b"{}", method="POST", + headers={"Content-Type": "application/json"}) + with urllib.request.urlopen(req, timeout=15) as r: + d = json.loads(r.read()) + m = d.get("models") + print("[opencode] provider auto-installed:", d.get("ok"), "| models:", m if isinstance(m, int) else len(m or [])) + except Exception as e: + print("[opencode] auto-install failed:", str(e)[:100]) + + def check_sidecar(): ok = ping("http://127.0.0.1:8877/health") print("[sidecar] free captcha :8877 %s" % ("UP" if ok else "DOWN (2captcha fallback only)")) @@ -119,5 +140,6 @@ if __name__ == "__main__": else: start_dashboard() start_gateway() + install_opencode() check_sidecar() print("\nUI: http://127.0.0.1:8560 | LLM: http://127.0.0.1:18789/v1 | MCP: python mcp_server.py")