Fix CI deps, MSK tax hour, portable /status uptime, configurable admin token path
- requirements-dev: add pytest-asyncio (async tests were failing in CI) - nightly tax: compute MSK hour explicitly instead of host-local time - /status: uptime via psutil instead of shell 'uptime' - IISHKO_ADMIN_TOKEN_FILE overrides the admin token path - Mini App: API base derived from location.origin - dedupe repeated ticket tags; bounded dependency versions Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+12
-10
@@ -1483,7 +1483,7 @@ def bump_token_quota(db_path, name, amount):
|
||||
|
||||
class NewAPI:
|
||||
def __init__(self): self.at = None; self.exp = 0; self._lock = asyncio.Lock()
|
||||
ADMIN_TOKEN_FILE = "/root/.secrets/newapi_admin_token"
|
||||
ADMIN_TOKEN_FILE = os.environ.get("IISHKO_ADMIN_TOKEN_FILE", "/root/.secrets/newapi_admin_token")
|
||||
|
||||
def _permanent_admin_token(self):
|
||||
try:
|
||||
@@ -5651,7 +5651,7 @@ async def econ_worker(bot):
|
||||
if econ_mint(uid, 50_000_000, "subbonus", ref="subbonus:%d" % uid):
|
||||
_persona_kv("ec_sub:%d" % uid, "1")
|
||||
# --- ночной налог 0.5% на остатки > $3000 (04:00-05:00 MSK, раз в сутки)
|
||||
hr = datetime.datetime.now().hour
|
||||
hr = time.gmtime(time.time() + 3 * 3600).tm_hour # MSK, independent of host TZ
|
||||
if hr == 4:
|
||||
_econ_nightly_tax(today)
|
||||
# Bounty expiry releases attempts/refunds transactionally; submitted work stays for review.
|
||||
@@ -5700,10 +5700,10 @@ async def econ_worker(bot):
|
||||
# Директива владельца: лимиты запросов в ДЕНЬ (новичок 1500 / актив 3000 / профи 5000 / легенда 10000),
|
||||
# на gpt (gpt-6-luna) и sol (gpt-6.1-sol) у легенды 200/200 в день, ниже — придуманная лестница.
|
||||
PM_DAY_CAPS = { # модель -> {ранг: запросов/день}; сброс 00:00 MSK [RANK-LIMITS 2026-10-17]
|
||||
"gpt-6-luna": {0: 200, 1: 500, 2: 1500, 3: 5000, 4: 10000}, # [LIMIT-BOOST2 2510] # [LIMIT-BOOST2 2510] # [LIMIT-BOOST2 2510] # [LUNA-BOOST 2510] daily request caps per rank
|
||||
"gpt-6.1-sol": {0: 100, 1: 250, 2: 800, 3: 2000, 4: 5000}, # [LIMIT-BOOST2 2510] # [LIMIT-BOOST2 2510] # [LIMIT-BOOST2 2510]
|
||||
"opus": {0: 100, 1: 250, 2: 800, 3: 2000, 4: 5000}, # [LIMIT-BOOST2 2510] # [LIMIT-BOOST2 2510] # [LIMIT-BOOST2 2510]
|
||||
"fable": {0: 100, 1: 250, 2: 800, 3: 2000, 4: 5000}, # [LIMIT-BOOST2 2510] # [LIMIT-BOOST2 2510] # [LIMIT-BOOST2 2510]
|
||||
"gpt-6-luna": {0: 200, 1: 500, 2: 1500, 3: 5000, 4: 10000}, # [LIMIT-BOOST2 2510] # [LUNA-BOOST 2510] daily request caps per rank
|
||||
"gpt-6.1-sol": {0: 100, 1: 250, 2: 800, 3: 2000, 4: 5000}, # [LIMIT-BOOST2 2510]
|
||||
"opus": {0: 100, 1: 250, 2: 800, 3: 2000, 4: 5000}, # [LIMIT-BOOST2 2510]
|
||||
"fable": {0: 100, 1: 250, 2: 800, 3: 2000, 4: 5000}, # [LIMIT-BOOST2 2510]
|
||||
"astra": {0: 10, 1: 20, 2: 50, 3: 500, 4: 500}
|
||||
}
|
||||
|
||||
@@ -12215,15 +12215,17 @@ def _top24_lines():
|
||||
|
||||
@router.callback_query(F.data == "status")
|
||||
async def cb_status(c: CallbackQuery):
|
||||
import subprocess
|
||||
try:
|
||||
await c.answer() # гасим спиннер сразу: пробы шлюза/моделей могут занять 20с+
|
||||
except Exception:
|
||||
pass
|
||||
lang = (db_get(c.from_user.id) or {}).get("lang") or "ru"
|
||||
_up = await asyncio.to_thread(subprocess.run, "uptime -p 2>/dev/null || uptime",
|
||||
shell=True, capture_output=True, text=True)
|
||||
up = _up.stdout.strip().replace("up ", "")
|
||||
try:
|
||||
import psutil
|
||||
_secs = int(time.time() - psutil.boot_time())
|
||||
up = "%dd %dh %dm" % (_secs // 86400, _secs % 86400 // 3600, _secs % 3600 // 60)
|
||||
except Exception:
|
||||
up = "?"
|
||||
t0 = time.time()
|
||||
try:
|
||||
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(force_close=True)) as s:
|
||||
|
||||
@@ -3471,7 +3471,7 @@ if(event.target&&event.target.id==='msearch'){mSearch=event.target.value||'';upd
|
||||
});
|
||||
window.addEventListener('hashchange',()=>{window.scrollTo(0,0);render()});
|
||||
function supportView(){
|
||||
const B='https://api.reformboss.com/v1';
|
||||
const B=location.origin+'/v1';
|
||||
return intro('Поддержка.','Сохрани обращение и получи квитанцию. Доставка уведомления оператору — отдельный статус, не отметка о прочтении.',false)+`<div class="sup-grid">
|
||||
<section class="sup-card"><h2>Приватный баг-репорт</h2><p class="small muted">Воспроизводимая ошибка или проблема безопасности — в закрытый приём заявок. Текст и доказательство видят только автор и администрация; публикации в общей ленте нет.</p><button class="button ghost" type="button" data-tab="activities">Открыть вклад и приватные баги</button></section>
|
||||
<section class="sup-card" id="support-report">${supportReportHtml()}</section>
|
||||
|
||||
@@ -198,11 +198,11 @@ async def gate_check(api_key):
|
||||
# A single write transaction serializes main/pm/sol/additional request counters.
|
||||
RL_TOTAL = {0: 5000, 1: 5000, 2: 10000, 3: 20000, 4: 30000}
|
||||
RL_PREM = {
|
||||
"gpt-6-luna": {0: 200, 1: 500, 2: 1500, 3: 5000, 4: 10000}, # [LIMIT-BOOST2 2510] # [LIMIT-BOOST2 2510] # [LIMIT-BOOST2 2510] # [LUNA-BOOST 2510] daily request caps per rank
|
||||
"gpt-6.1-sol": {0: 100, 1: 250, 2: 800, 3: 2000, 4: 5000}, # [LIMIT-BOOST2 2510] # [LIMIT-BOOST2 2510] # [LIMIT-BOOST2 2510]
|
||||
"opus": {0: 100, 1: 250, 2: 800, 3: 2000, 4: 5000}, # [LIMIT-BOOST2 2510] # [LIMIT-BOOST2 2510] # [LIMIT-BOOST2 2510]
|
||||
"fable": {0: 100, 1: 250, 2: 800, 3: 2000, 4: 5000}, # [LIMIT-BOOST2 2510] # [LIMIT-BOOST2 2510] # [LIMIT-BOOST2 2510]
|
||||
"astra": {0: 100, 1: 250, 2: 800, 3: 2000, 4: 5000}, # [LIMIT-BOOST2 2510] # [LIMIT-BOOST2 2510] # [LIMIT-BOOST2 2510]
|
||||
"gpt-6-luna": {0: 200, 1: 500, 2: 1500, 3: 5000, 4: 10000}, # [LIMIT-BOOST2 2510] # [LUNA-BOOST 2510] daily request caps per rank
|
||||
"gpt-6.1-sol": {0: 100, 1: 250, 2: 800, 3: 2000, 4: 5000}, # [LIMIT-BOOST2 2510]
|
||||
"opus": {0: 100, 1: 250, 2: 800, 3: 2000, 4: 5000}, # [LIMIT-BOOST2 2510]
|
||||
"fable": {0: 100, 1: 250, 2: 800, 3: 2000, 4: 5000}, # [LIMIT-BOOST2 2510]
|
||||
"astra": {0: 100, 1: 250, 2: 800, 3: 2000, 4: 5000}, # [LIMIT-BOOST2 2510]
|
||||
}
|
||||
RL_NAMES = {0: "Новичок", 1: "Новичок", 2: "Актив", 3: "Профи", 4: "Легенда"}
|
||||
|
||||
@@ -1080,7 +1080,7 @@ async def brand_asset(req):
|
||||
# Provision: new-api user "tg<id>" via admin API, password kept in skin-local store (0600).
|
||||
# Login: server-side POST /api/user/login, Set-Cookie forwarded to the browser.
|
||||
TG_BOT_CONFIG = bot_config_path()
|
||||
TG_ADMIN_TOKEN_FILE = "/root/.secrets/newapi_admin_token"
|
||||
TG_ADMIN_TOKEN_FILE = os.environ.get("IISHKO_ADMIN_TOKEN_FILE", "/root/.secrets/newapi_admin_token")
|
||||
TG_PROVISION_DB = skin_db_path()
|
||||
TG_AUTH_MAX_AGE = 900
|
||||
TG_SID_SECRET_FILE = os.environ.get("TG_SID_SECRET_FILE", "/root/.secrets/iishko_tg_sid_secret")
|
||||
|
||||
@@ -3,4 +3,6 @@
|
||||
# python -m pytest -q # root suite (see pytest.ini)
|
||||
# python scripts/selfcheck.py --source-only # no imports, no credentials
|
||||
-r requirements.txt
|
||||
pytest>=8.0
|
||||
pytest>=8.0,<10
|
||||
# async def test_* in tests/test_admin_ban_targets.py, tests/test_moderation_bridge.py
|
||||
pytest-asyncio>=0.23,<2
|
||||
|
||||
+10
-10
@@ -1,24 +1,24 @@
|
||||
# iishko legacy runtime (bot/ + gateway/ + bot/webapp/). Python 3.11+
|
||||
# Bounds are the lowest versions this tree is known to work with; do not relax
|
||||
# without re-running scripts/selfcheck.py and the root pytest suite.
|
||||
# Lower bounds = versions the test suite runs against; upper bounds = next major.
|
||||
# Do not relax without re-running scripts/selfcheck.py and the root pytest suite.
|
||||
|
||||
# Telegram bot (aiogram 3.x; 4.x is not supported by this code)
|
||||
aiogram>=3.0,<4
|
||||
aiogram>=3.26,<4
|
||||
# HTTP client/server: bot, Mini App backend and gateway skin
|
||||
aiohttp>=3.9
|
||||
aiohttp>=3.14,<4
|
||||
# aiohttp companions, imported directly by gateway/skin and transparent_api
|
||||
multidict>=6.0
|
||||
yarl>=1.9
|
||||
multidict>=6.7,<7
|
||||
yarl>=1.23,<2
|
||||
# process/self limits in the bot watchdogs
|
||||
psutil>=5.9
|
||||
psutil>=7.0,<8
|
||||
# password hashing for account bootstrap paths
|
||||
bcrypt>=4.0
|
||||
bcrypt>=4.0,<6
|
||||
# Explicit .env loading by scripts/run.py (never executes shell statements)
|
||||
python-dotenv>=1.0,<2
|
||||
|
||||
# --- optional features (install only if you use them) ---
|
||||
# Web search in chat replies. Upstream package was renamed
|
||||
# duckduckgo_search -> ddgs; the bot imports either name.
|
||||
ddgs>=9.0
|
||||
ddgs>=9.0,<10
|
||||
# Text extraction from uploaded PDF documents (bot/file_intake.py)
|
||||
pypdf>=4.0
|
||||
pypdf>=4.0,<7
|
||||
|
||||
Reference in New Issue
Block a user