Mod for TikTok 47.1.3 (arm64) in Material 3 style: bottom bar, profile menu, TikTok settings and comments; downloads without the watermark; switches for ads, live streams and the Shop tab; badges of other mods next to names and the niche mod badge (members service); app icons; mod settings screen. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
70 lines
3.2 KiB
Python
70 lines
3.2 KiB
Python
import os
|
|
import urllib.request
|
|
import urllib.parse
|
|
import http.cookiejar
|
|
|
|
ADMIN_USER = os.environ["LIHONT2_ADMIN_USER"]
|
|
ADMIN_PASSWORD = os.environ["LIHONT2_ADMIN_PASSWORD"]
|
|
|
|
cookie_jar = http.cookiejar.CookieJar()
|
|
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cookie_jar))
|
|
|
|
# 1. Test unauthenticated download redirect
|
|
try:
|
|
req = urllib.request.Request('http://127.0.0.1:18750/lihont2/download')
|
|
resp = opener.open(req)
|
|
print('Unauth download redirected to:', resp.geturl())
|
|
except Exception as e:
|
|
print('Unauth download error:', e)
|
|
|
|
# 2. Test login
|
|
data = urllib.parse.urlencode({'username': ADMIN_USER, 'password': ADMIN_PASSWORD}).encode()
|
|
req = urllib.request.Request('http://127.0.0.1:18750/lihont2/login', data=data)
|
|
resp = opener.open(req)
|
|
print('Login URL after redirect:', resp.geturl())
|
|
body = resp.read().decode('utf-8', errors='replace')
|
|
print('Admin panel present in HTML:', 'Панель управления' in body)
|
|
print('Admin username in HTML:', ADMIN_USER in body)
|
|
print('APK SHA present in HTML:', '6b55df52477e0c60' in body)
|
|
|
|
# 3. Test authenticated download
|
|
req = urllib.request.Request('http://127.0.0.1:18750/lihont2/download')
|
|
resp = opener.open(req)
|
|
print('Auth download Content-Disposition:', resp.headers.get('Content-Disposition'))
|
|
print('Auth download Content-Length:', resp.headers.get('Content-Length'))
|
|
print('Auth download Content-Type:', resp.headers.get('Content-Type'))
|
|
first_bytes = resp.read(4)
|
|
print('PK zip header valid:', first_bytes == b'PK\x03\x04')
|
|
|
|
# 4. Test creating a tester user
|
|
create_data = urllib.parse.urlencode({'username': 'tester_alpha', 'password': 'TesterPassword123!', 'note': 'First QA Tester'}).encode()
|
|
req = urllib.request.Request('http://127.0.0.1:18750/lihont2/admin/create-user', data=create_data)
|
|
resp = opener.open(req)
|
|
body_after_create = resp.read().decode('utf-8', errors='replace')
|
|
print('Tester user created successfully:', 'tester_alpha' in body_after_create)
|
|
|
|
# 5. Test logging in as the tester user
|
|
tester_jar = http.cookiejar.CookieJar()
|
|
tester_opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(tester_jar))
|
|
tester_login_data = urllib.parse.urlencode({'username': 'tester_alpha', 'password': 'TesterPassword123!'}).encode()
|
|
req = urllib.request.Request('http://127.0.0.1:18750/lihont2/login', data=tester_login_data)
|
|
resp = tester_opener.open(req)
|
|
tester_body = resp.read().decode('utf-8', errors='replace')
|
|
print('Tester dashboard loaded:', 'Release v2.0 Native' in tester_body)
|
|
print('Tester CANNOT see admin panel:', 'Панель управления' not in tester_body)
|
|
print('Tester CAN see download button:', 'Скачать lihont2.apk' in tester_body)
|
|
|
|
# 6. Test tester download
|
|
req = urllib.request.Request('http://127.0.0.1:18750/lihont2/download')
|
|
resp = tester_opener.open(req)
|
|
print('Tester download size:', resp.headers.get('Content-Length'))
|
|
|
|
# 7. Clean up tester user
|
|
del_data = urllib.parse.urlencode({'user_id': 2}).encode()
|
|
req = urllib.request.Request('http://127.0.0.1:18750/lihont2/admin/delete-user', data=del_data)
|
|
resp = opener.open(req)
|
|
body_after_del = resp.read().decode('utf-8', errors='replace')
|
|
print('Tester user deleted successfully:', 'tester_alpha' not in body_after_del)
|
|
|
|
print('\nALL VERIFICATION TESTS COMPLETED SUCCESSFULLY!')
|