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:
|
||||
|
||||
Reference in New Issue
Block a user