LihonT 2 Serena alpha

Themes as data: the settings and the rest of TikTok take a look (Stickers, Windows 95, or a theme a plugin brings with the
right ui.theme); the DEBUG recovery mode (Clear cache in Android resets the look and puts the plugins in safe mode); new
plugin functions (name.style, confetti and buzz on a tap); a few memory trims in the chat bubbles; the person list for bubbles
no longer shows screen labels.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
cheb0chik
2026-11-02 12:32:37 +03:00
parent 273d1d8d9c
commit 8b7fa5ff57
54 changed files with 2392 additions and 441 deletions

View File

@@ -80,6 +80,7 @@ python scripts/make_ltp.py plugins/my.plugin
| `ui.sound` | Проигрывать звук плагина, когда вы нажимаете на его картинку. |
| `feed.like` | Ставить лайк видео на главной ленте, когда вы нажимаете на картинку плагина. |
| `net.download` | Скачивать картинки и звуки с сайтов, названных в `net` (см. ниже). Нужен ещё переключатель «Интернет» у плагина. |
| `ui.theme` | Менять оформление экранов мода и TikTok: цвета, формы, рамки (см. «Тема»). Ничего не скрывает и не двигает. |
## Правило
@@ -199,6 +200,34 @@ python scripts/make_ltp.py plugins/my.plugin
предупреждение, что сайт может его подменить. Вместо «Плагин не может: выходить в интернет» он пишет, что плагин ходит
только на названные сайты и только за файлами.
## Тема (`theme`)
Плагин с правом `ui.theme` может принести тему оформления. Это только цвета и несколько чисел, поэтому тема красит, но
не прячет и не двигает ничего на экране. Правила в таком плагине можно не писать вовсе.
```json
"permissions": ["ui.theme"],
"theme": {"name": "Закат", "dark": true, "page": "#2b1d3a", "card": "#3d2b52", "text": "#fbe9ff",
"accent": "#ff8a5b", "on_accent": "#2b1d3a", "radius": 20, "outline": 2, "shadow": 4}
```
| Поле | Что это |
| --- | --- |
| `name` | Название темы, до 24 знаков (обязательно). |
| `page`, `card`, `text`, `accent` | Цвета страницы, карточек, текста и акцента (обязательно). Пишутся `#rrggbb` маленькими буквами. |
| `muted`, `on_accent`, `line`, `title_from`, `title_to` | Второй текст, текст на акценте (по умолчанию `#ffffff`), линии, начало и конец полосы заголовка. По умолчанию: `text`, `#ffffff`, `text`, `accent`, `accent`. |
| `dark` | Тёмная тема (`true`/`false`). |
| `radius` | Скругление углов, 0–40. 0 даёт квадратные углы везде. |
| `outline`, `shadow` | Толщина контура 0–6 и смещение жёсткой тени 0–12. |
| `bevel` | Объёмные рамки, как у окон Windows 95. |
| `tick_box` | Переключатели рисуются квадратной галочкой. |
| `title_bars` | Заголовки разделов становятся цветной полосой. |
Защитник проверяет контраст текста на карточках и на акценте. Если он ниже 3.0, он честно напишет, что текст будет плохо
читаться, но тему не запретит. Если тема всё-таки сломала экран, вернуть вид можно режимом DEBUG (Настройки мода →
«Восстановление»): включите его заранее, потом очистите кэш приложения в настройках Android. Выбирается тема в настройках
мода, строка «Оформление». В SDK: `plugin.theme("Закат", page="#2b1d3a", card="#3d2b52", text="#fbe9ff", accent="#ff8a5b")`.
## Как установить
В настройках мода откройте раздел «Плагины» → «Установить плагин» → выберите `.ltp`. Мод покажет, кто автор, какие
@@ -210,3 +239,19 @@ python scripts/make_ltp.py plugins/my.plugin
Не читают чаты и личные данные, не запускают код, не пишут сообщения от вашего имени, не меняют файлы. В сеть выходит
только плагин с правом `net.download`: он скачивает файлы с названных сайтов, когда вы включили ему интернет и
подтвердили адрес, и ничего не отправляет. Картинка плагина может поставить лайк только вашим нажатием на неё и только на главной ленте. Если захочется такого, это будет отдельным правом, которое вы увидите и одобрите при установке.
## Что плагинам закрыто навсегда
Это не настройка, а граница формата. Права на это нет в списке, поэтому плагин не может его запросить, а файл, где такое
право названо, мод отклоняет как неизвестное. Если ограничение когда-нибудь пересматривать, то только отдельным решением,
которое видно в этом документе, а не тихим добавлением поля.
- пароли, коды входа и данные для входа;
- токены, ключи и любые секреты приложения;
- **куки** и сохранённые сессии (по ним можно войти в аккаунт без пароля);
- тексты сообщений и содержимое чатов, комментариев и личных данных;
- запуск кода и изменение файлов.
Что плагин видит сейчас: описание, хэштеги и автора видео, имена на экране и время. Любое новое поле данных появляется
только вместе с отдельным правом, которое защитник показывает, и с тестом, который проверяет, что в этом поле нет ничего
из списка выше.

View File

@@ -0,0 +1,19 @@
{
"ltp": 1,
"id": "lihont.fun-names",
"name": "Весёлые имена",
"version": "1.0",
"author": "LihonT",
"description": "Твоё имя на твоём экране волной, а у друзей из списка с пробелами между буквами. Только у вас на экране.",
"license": "VCBFU-2",
"ai": ["Claude Sonnet 5.5 (Claude Code)"],
"permissions": ["names"],
"rules": [
{
"title": "Моё имя волной",
"when": "name.show",
"if": {"uid": ["self"]},
"do": [{"name.style": "wave"}]
}
]
}

View File

@@ -0,0 +1,25 @@
{
"ltp": 1,
"id": "lihont.theme-sunset",
"name": "Закат",
"version": "1.0",
"author": "LihonT",
"description": "Тёмно-лиловый фон, тёплый оранжевый акцент, толстые контуры и мягкие тени.",
"license": "VCBFU-2",
"ai": ["Claude Sonnet 5.5 (Claude Code)"],
"permissions": ["ui.theme"],
"theme": {
"name": "Закат",
"dark": true,
"page": "#2b1d3a",
"card": "#3d2b52",
"text": "#fbe9ff",
"muted": "#cdb4e0",
"accent": "#ff8a5b",
"on_accent": "#2b1d3a",
"line": "#fbe9ff",
"radius": 20,
"outline": 2,
"shadow": 4
}
}

View File

@@ -0,0 +1,27 @@
{
"ltp": 1,
"id": "lihont.theme-win95",
"name": "Windows 95",
"version": "1.0",
"author": "LihonT",
"description": "Серые окна на бирюзовом рабочем столе, объёмные рамки, синие заголовки и квадратные галочки.",
"license": "VCBFU-2",
"ai": ["Claude Sonnet 5.5 (Claude Code)"],
"permissions": ["ui.theme"],
"theme": {
"name": "Windows 95",
"page": "#008080",
"card": "#c0c0c0",
"text": "#000000",
"muted": "#404040",
"accent": "#000080",
"on_accent": "#ffffff",
"line": "#808080",
"title_from": "#000080",
"title_to": "#1084d0",
"radius": 0,
"bevel": true,
"tick_box": true,
"title_bars": true
}
}

View File

@@ -80,7 +80,7 @@ def main(argv) -> int:
parser.add_argument("folders", nargs="*", help="plugin folders (default: every folder of plugins/)")
parser.add_argument("-o", "--out", default=str(ROOT / "ComplectAPK" / "plugins"))
args = parser.parse_args(argv)
folders = [Path(f) for f in args.folders] or sorted(p for p in (ROOT / "plugins").iterdir() if p.is_dir())
folders = [Path(f) for f in args.folders] or sorted(p for p in (ROOT / "plugins").iterdir() if p.is_dir() and (p / "plugin.json").is_file())
for folder in folders:
out = pack(folder, Path(args.out))
print("%s %d bytes" % (out, out.stat().st_size))

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Cards for the Telegram post about LihonT 2 Luna: the settled frames of the sticker-style promo video
(make_luna_promo2.py), 1080x1920, one per scene, no screenshots.
usage: py -X utf8 -B scripts/make_luna_cards.py # writes work/luna-cards/card_01.png ...
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
import make_luna_promo2 as V # noqa: E402
OUT = V.ROOT / "work" / "luna-cards"
# the moment of each scene when everything has landed and nothing is half-way
MOMENTS = [("intro", 2.9), ("flame", 7.4), ("keeper", 12.2), ("bubbles", 17.4), ("ghost", 21.8),
("photos", 26.4), ("plugins", 31.4), ("shapes", 35.4), ("settings", 40.0), ("outro", 44.2)]
def main() -> None:
OUT.mkdir(parents=True, exist_ok=True)
for n, (name, t) in enumerate(MOMENTS, 1):
path = OUT / ("card_%02d_%s.png" % (n, name))
V.frame_at(t).convert("RGB").save(path)
print(path.name)
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,364 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
LihonT 2 «Serena alpha» promo in the sticker style of make_luna_promo2.py: 1080x1920, 30 fps, about 36 seconds.
Everything is drawn here (no screenshots): the settings card that changes theme, the Windows 95 windows, the plugin code that
types itself, the wave name, the confetti and the recovery mode. The look helpers come from make_luna_promo2.py.
usage (from the repository root):
py -X utf8 -B scripts/make_serena_promo.py # work/serena-promo/serena_promo.mp4
py -X utf8 -B scripts/make_serena_promo.py --still 9.0 # one frame
"""
from __future__ import annotations
import argparse
import math
import shutil
import subprocess
import sys
from multiprocessing import Pool
from pathlib import Path
from PIL import Image, ImageDraw
sys.path.insert(0, str(Path(__file__).resolve().parent))
import make_luna_promo2 as V # noqa: E402
import make_lihont_promo as P # noqa: E402
W, H, FPS = V.W, V.H, V.FPS
ROOT = V.ROOT
OUT = ROOT / "work" / "serena-promo" / "serena_promo.mp4"
AUDIO = ROOT / "work" / "serena-promo" / "serena_audio.wav"
INK, CREAM, CORAL, YELLOW, MINT, VIOLET, SKY, PINK, WHITE = V.INK, V.CREAM, V.CORAL, V.YELLOW, V.MINT, V.VIOLET, V.SKY, V.PINK, V.WHITE
clamp, ease_out_cubic, ease_out_back, pop = V.clamp, V.ease_out_cubic, V.ease_out_back, V.pop
SCENES = [
("intro", 0.0, 3.6, CREAM),
("themes", 3.6, 9.6, (255, 226, 200)),
("win95", 9.6, 14.4, (0, 128, 128)),
("plugin", 14.4, 20.4, (255, 236, 150)),
("fun", 20.4, 25.6, (215, 200, 255)),
("debug", 25.6, 31.0, (190, 240, 220)),
("outro", 31.0, 35.4, (255, 196, 176)),
]
DURATION = SCENES[-1][2]
FRAMES = int(round(DURATION * FPS))
WIPE = V.WIPE
# the looks a settings card can have: (page, card, ink, radius, outline, shadow, bevel, tick box, title bars, accent, on accent)
LOOKS = {
"md3": dict(page=(254, 247, 255), card=(243, 237, 247), ink=(29, 27, 32), radius=34, outline=0, shadow=0, bevel=False,
tick=False, bars=False, accent=(103, 80, 164), on=(255, 255, 255), name="Material 3"),
"sticker": dict(page=(255, 244, 224), card=(255, 255, 255), ink=INK, radius=30, outline=6, shadow=10, bevel=False,
tick=False, bars=False, accent=VIOLET, on=WHITE, name="Стикеры"),
"win95": dict(page=(0, 128, 128), card=(192, 192, 192), ink=(0, 0, 0), radius=0, outline=0, shadow=0, bevel=True,
tick=True, bars=True, accent=(0, 0, 128), on=WHITE, name="Windows 95"),
"sunset": dict(page=(43, 29, 58), card=(61, 43, 82), ink=(251, 233, 255), radius=34, outline=5, shadow=8, bevel=False,
tick=False, bars=False, accent=(255, 138, 91), on=(43, 29, 58), name="Закат (плагин)"),
}
def bevel(d, box, raised=True, edge=3, face=(192, 192, 192)):
x0, y0, x1, y1 = [int(v) for v in box]
d.rectangle([x0, y0, x1, y1], fill=face + (255,))
light, mid, dark, black = (255, 255, 255), (223, 223, 223), (128, 128, 128), (0, 0, 0)
tl1, br1, tl2, br2 = (light, black, mid, dark) if raised else (dark, light, black, mid)
for k, (tl, br) in enumerate(((tl1, br1), (tl2, br2))):
o = k * edge
d.rectangle([x0 + o, y0 + o, x1 - o - edge, y0 + o + edge - 1], fill=tl + (255,))
d.rectangle([x0 + o, y0 + o, x0 + o + edge - 1, y1 - o - edge], fill=tl + (255,))
d.rectangle([x0 + o + edge, y1 - o - edge + 1, x1 - o, y1 - o], fill=br + (255,))
d.rectangle([x1 - o - edge + 1, y0 + o + edge, x1 - o, y1 - o], fill=br + (255,))
def settings_card(layer, look, box, lt=0.0, rows=None):
"""A mock of the mod's settings screen in a given look: a page, a title strip and four rows with switches."""
L = LOOKS[look] if isinstance(look, str) else look
x0, y0, x1, y1 = box
d = ImageDraw.Draw(layer, "RGBA")
d.rectangle([x0 - 30, y0 - 30, x1 + 30, y1 + 30], fill=L["page"] + (255,))
inner = (x0, y0 + 70, x1 - L["shadow"], y1 - L["shadow"])
if L["shadow"]:
d.rounded_rectangle([inner[0] + L["shadow"], inner[1] + L["shadow"], inner[2] + L["shadow"], inner[3] + L["shadow"]],
radius=L["radius"], fill=(0, 0, 0, 255) if look == "sunset" else INK + (255,))
if L["bevel"]:
bevel(d, inner, True)
else:
d.rounded_rectangle(inner, radius=L["radius"], fill=L["card"] + (255,),
outline=L["ink"] + (255,) if L["outline"] else None, width=L["outline"] or 0)
# section title
if L["bars"]:
for i in range(x1 - x0):
k = i / max(1, x1 - x0)
d.line([(x0 + i, y0 + 8), (x0 + i, y0 + 62)], fill=(int(0 + 16 * k), int(0 + 132 * k), int(128 + 80 * k), 255))
P.draw_text(layer, (x0 + 24, y0 + 35), "Функции", 36, L["on"] + (255,), anchor="lm")
else:
P.draw_text(layer, (x0 + 28, y0 + 35), "Функции", 38, (L["accent"] if look != "sticker" else L["ink"]) + (255,), anchor="lm")
names = rows or ["Призрак: истории", "Свои пузыри", "Несколько фото", "Автопродление"]
step = (inner[3] - inner[1]) / len(names)
for n, text in enumerate(names):
cy = inner[1] + step * (n + 0.5)
P.draw_text(layer, (x0 + 40, cy), text, 40, L["ink"] + (255,), anchor="lm")
on = clamp((lt - 0.2 - n * 0.25) / 0.3) if lt >= 0 else 1.0
cx = x1 - 90 - L["shadow"]
if L["tick"]:
bevel(d, (cx - 24, cy - 24, cx + 24, cy + 24), False, 3, (255, 255, 255))
if on > 0.5:
d.line([(cx - 13, cy), (cx - 4, cy + 11), (cx + 14, cy - 12)], fill=(0, 0, 0, 255), width=7)
else:
track = tuple(int(L["card"][i] * (1 - on) + L["accent"][i] * on) for i in range(3))
d.rounded_rectangle([cx - 56, cy - 30, cx + 56, cy + 30], radius=30, fill=track + (255,), outline=L["ink"] + (255,),
width=4 if L["outline"] else 2)
kx = cx - 26 + 52 * on
d.ellipse([kx - 20, cy - 20, kx + 20, cy + 20], fill=(L["on"] if on > 0.5 else L["ink"]) + (255,))
def scene_intro(layer, lt):
k = ease_out_back(lt / 0.9)
V.place(layer, V.ASSETS["logo"], W / 2, 760, 0.5 * k * (1 + 0.04 * math.sin(lt * 5)), math.sin(lt * 2.4) * 8 + (1 - k) * 360)
V.burst(layer, W / 2, 760, lt, 0.6, seed=14)
V.title(layer, max(0.0, lt - 0.9), "LihonT 2", "Serena alpha", y=1230)
V.label(layer, W / 2, 1480, "темы · приколы · восстановление", pop(lt, 1.8), size=44, fill=YELLOW)
def scene_themes(layer, lt):
V.title(layer, lt, "Темы оформления", "Выбери вид, как хочешь")
order = ["md3", "sticker", "win95"]
idx = min(len(order) - 1, int(lt / 1.55))
part = (lt % 1.55) / 1.55
look = order[idx]
settings_card(layer, look, (150, 620, 930, 1240), lt=lt - idx * 1.55)
# the name of the look flies in on a sticker
V.label(layer, W / 2, 1400, LOOKS[look]["name"], pop(part, 0.0, 0.4), size=64, fill=YELLOW)
for n, key in enumerate(order):
V.label(layer, 220 + n * 320, 1560, LOOKS[key]["name"], pop(lt, 4.2 + n * 0.2), size=32,
fill=WHITE if key != look else MINT)
V.label(layer, W / 2, 1700, "И свои темы из плагинов", pop(lt, 4.8), size=40, fill=PINK)
if part < 0.08:
V.ring(layer, W / 2, 930, part, 0.0, color=INK, size=420)
def scene_win95(layer, lt):
d = ImageDraw.Draw(layer, "RGBA")
P.draw_text(layer, (W / 2, 190), "Windows 95 везде", 100, WHITE + (255,))
P.draw_text(layer, (W / 2, 290), "не только в настройках", 46, (230, 255, 255, 255), bold=False)
# a phone-ish screen: windows with navy title bars
px0, py0, px1, py1 = 170, 400, 910, 1700
d.rectangle([px0 - 14, py0 - 14, px1 + 14, py1 + 14], fill=(20, 20, 20, 255))
d.rectangle([px0, py0, px1, py1], fill=(0, 128, 128, 255))
for n, (title, lines) in enumerate((("Комментарии", ["anna: смотрите, вайб!", "luna: нашёл своих"]),
("Профиль", ["подписчики: 5 095", "лайки: 21,2 тыс."]))):
k = ease_out_back((lt - 0.3 - n * 0.4) / 0.5)
if k <= 0.02:
continue
y0 = py0 + 50 + n * 480 + (1 - k) * 300
bevel(d, (px0 + 40, y0, px1 - 40, y0 + 420), True, 4)
for i in range(px1 - px0 - 100):
kk = i / max(1, px1 - px0 - 100)
d.line([(px0 + 52 + i, y0 + 12), (px0 + 52 + i, y0 + 62)], fill=(int(16 * kk), int(132 * kk), int(128 + 80 * kk), 255))
P.draw_text(layer, (px0 + 70, y0 + 38), title, 36, WHITE + (255,), anchor="lm")
bevel(d, (px1 - 130, y0 + 16, px1 - 100, y0 + 58), True, 2)
for i, text in enumerate(lines):
bevel(d, (px0 + 66, y0 + 96 + i * 150, px1 - 66, y0 + 216 + i * 150), False, 3, (255, 255, 255))
P.draw_text(layer, (px0 + 90, y0 + 156 + i * 150), text, 34, (0, 0, 0, 255), anchor="lm")
# the bottom bar: square tabs, the chosen one pressed in
by = py1 - 170
bevel(d, (px0, by, px1, py1), True, 4)
for i in range(5):
x = px0 + 20 + i * 140
pressed = i == 1
bevel(d, (x, by + 22, x + 120, by + 130), not pressed, 3)
d.rectangle([x + 40, by + 52, x + 80, by + 92], outline=(0, 0, 0, 255), width=5)
V.label(layer, W / 2, 1810, "Панель, комментарии, профиль, меню", pop(lt, 1.8), size=36, fill=YELLOW)
TYPED = [
'plugin = Plugin("Закат", author="Вася")',
"plugin.theme(",
' page="#2b1d3a", card="#3d2b52",',
' text="#fbe9ff", accent="#ff8a5b",',
" radius=20, outline=2, shadow=4)",
"plugin.save()",
]
def scene_plugin(layer, lt):
V.title(layer, lt, "Тема из плагина", "Пять строк на Python")
d = ImageDraw.Draw(layer, "RGBA")
box = (90, 470, 990, 1010)
d.rounded_rectangle([box[0] + 10, box[1] + 10, box[2] + 10, box[3] + 10], radius=36, fill=INK + (255,))
d.rounded_rectangle(box, radius=36, fill=(34, 28, 46, 255), outline=INK + (255,), width=6)
for i, c in enumerate((CORAL, YELLOW, MINT)):
d.ellipse([130 + i * 44, 505, 160 + i * 44, 535], fill=c + (255,))
total = sum(len(t) + 1 for t in TYPED)
shown = int(clamp((lt - 0.5) / 3.0) * total)
y = 580
for line in TYPED:
part = line[:max(0, shown)]
shown -= len(line) + 1
color = (255, 205, 60, 255) if line.startswith("plugin.") else (251, 233, 255, 255)
P.draw_text(layer, (130, y), part, 36, color, bold=False, anchor="lm")
y += 64
if shown < 0:
break
# the result appears as a card in the new theme
k = pop(lt, 3.8, 0.6)
if k > 0.02:
V.place(layer, _card_image("sunset", 780, 520), W / 2, 1380 + (1 - k) * 200, 0.85 * k)
V.label(layer, W / 2, 1720, "Защитник проверит контраст", pop(lt, 4.4), size=36, fill=WHITE)
_cache = {}
def _card_image(look, w, h):
key = (look, w, h)
if key not in _cache:
img = Image.new("RGBA", (w + 80, h + 80), (0, 0, 0, 0))
settings_card(img, look, (40, 40, 40 + w, 40 + h), lt=-1)
_cache[key] = img
return _cache[key]
def scene_fun(layer, lt):
V.title(layer, lt, "Приколы", "Имя, конфетти, вибрация")
d = ImageDraw.Draw(layer, "RGBA")
# a name that turns into a wave, letter by letter
word = "Привет, мир"
f = P.font(110)
total = d.textlength(word, font=f)
x = W / 2 - total / 2
done = int(clamp((lt - 0.6) / 1.4) * len(word))
for n, ch in enumerate(word):
shown = ch.upper() if (n % 2 == 1 and n < done) else ch.lower()
w = d.textlength(ch, font=f)
bob = math.sin(lt * 5 + n * 0.7) * 10 if n < done else 0
P.draw_text(layer, (x + w / 2, 700 + bob), shown, 110, INK + (255,))
x += w
V.label(layer, W / 2, 840, "name.style: wave", pop(lt, 1.0), size=40, fill=YELLOW)
# a star sticker that is tapped and throws confetti
cx, cy = W / 2, 1230
k = pop(lt, 2.4)
pts = []
for i in range(10):
r = 130 if i % 2 == 0 else 58
a = -math.pi / 2 + i * math.pi / 5
pts.append((cx + math.cos(a) * r * k, cy + math.sin(a) * r * k))
if k > 0.02:
d.polygon([(x + 8, y + 8) for x, y in pts], fill=INK + (255,))
d.polygon(pts, fill=YELLOW + (255,), outline=INK + (255,))
d.line(pts + [pts[0]], fill=INK + (255,), width=6)
tap = 3.4
if lt > tap:
V.burst(layer, cx, cy, lt, tap, seed=3, count=60, power=1100)
V.ring(layer, cx, cy, lt, tap, color=INK, size=260)
for i in range(3): # little buzz marks beside the star
off = 170 + i * 26
a = int(255 * clamp(1 - (lt - tap) / 0.8))
d.arc([cx - off, cy - off, cx + off, cy + off], 150, 210, fill=INK + (a,), width=6)
d.arc([cx - off, cy - off, cx + off, cy + off], -30, 30, fill=INK + (a,), width=6)
V.label(layer, W / 2, 1480, "tap: confetti + buzz", pop(lt, 2.8), size=40, fill=PINK)
V.label(layer, W / 2, 1620, "Всё безопасно: только у вас на экране", pop(lt, 3.6), size=34, fill=WHITE)
def scene_debug(layer, lt):
V.title(layer, lt, "Режим DEBUG", "Если тема всё сломала")
d = ImageDraw.Draw(layer, "RGBA")
# the switch
V.sticker(layer, (110, 480, 970, 640), WHITE, radius=44)
P.draw_text(layer, (160, 560), "Режим DEBUG", 48, INK + (255,), anchor="lm")
V.switch(layer, 850, 560, ease_out_cubic((lt - 0.6) / 0.4))
# Android: Clear cache
pressed = clamp((lt - 2.2) / 0.3)
V.sticker(layer, (110, 740, 970, 900), (230, 230, 240), radius=44, shadow=int(10 * (1 - pressed)))
P.draw_text(layer, (160, 820), "Android → TikTok → Очистить кэш", 38, INK + (255,), anchor="lm")
d.ellipse([850 - 36, 820 - 36, 850 + 36, 820 + 36], fill=CORAL + (255,), outline=INK + (255,), width=5)
# the card: Windows 95 for a moment, then back to Material 3 with a burst
back = lt > 3.0
look = "md3" if back else "win95"
if lt > 1.0:
settings_card(layer, look, (150, 1030, 930, 1560), lt=-1)
if back:
V.burst(layer, W / 2, 1300, lt, 3.0, seed=9, count=50, power=900)
V.ring(layer, W / 2, 1300, lt, 3.0, color=INK, size=380)
V.label(layer, W / 2, 1690, "Оформление и плагины сброшены", pop(lt, 3.3), size=38, fill=YELLOW)
V.label(layer, W / 2, 1790, "Файлы плагинов остаются", pop(lt, 3.8), size=34, fill=WHITE)
def scene_outro(layer, lt):
k = ease_out_back(lt / 0.8)
V.place(layer, V.ASSETS["logo"], W / 2, 620, 0.46 * k * (1 + 0.04 * math.sin(lt * 5)), math.sin(lt * 2.4) * 8 + (1 - k) * 300)
V.burst(layer, W / 2, 620, lt, 0.5, seed=19, count=60, power=1000)
V.title(layer, max(0.0, lt - 0.5), "Serena alpha", "Открытый код · лицензия VCBFU v2", y=1000)
bounce = lambda t0: abs(math.sin((lt - t0) * 3)) * 14 if lt > t0 else 0 # noqa: E731
V.label(layer, W / 2, 1290 - bounce(1.2), "git.lihont.space", pop(lt, 1.2), size=60, fill=YELLOW)
V.label(layer, W / 2, 1440 - bounce(1.5), "Telegram · @lihont", pop(lt, 1.5), size=60, fill=WHITE)
V.label(layer, W / 2, 1580, "Это альфа: может быть шероховато", pop(lt, 2.2), size=34, fill=PINK)
SCENE_DRAW = {name: globals()["scene_" + name] for name, _, _, _ in SCENES}
def frame_at(t: float) -> Image.Image:
V.init_assets()
index = 0
for n, (name, start, end, color) in enumerate(SCENES):
if t >= start:
index = n
name, start, end, color = SCENES[index]
img = Image.new("RGBA", (W, H), color + (255,))
if index > 0 and t - start < WIPE:
prev = SCENES[index - 1][3]
img = Image.new("RGBA", (W, H), prev + (255,))
r = 1700 * ease_out_cubic((t - start) / WIPE)
mask = Image.new("L", (W, H), 0)
ImageDraw.Draw(mask).ellipse([W / 2 - r, H / 2 - r, W / 2 + r, H / 2 + r], fill=255)
img.paste(Image.new("RGBA", (W, H), color + (255,)), (0, 0), mask)
if name != "win95":
ox, oy = int(t * 30) % 80, int(t * 18) % 80
img.alpha_composite(V.ASSETS["dots"], (-ox, -oy))
layer = Image.new("RGBA", (W, H), (0, 0, 0, 0))
SCENE_DRAW[name](layer, t - start)
out = clamp((end - t) / 0.25) if index < len(SCENES) - 1 else 1.0
if out < 1.0:
layer.putalpha(layer.getchannel("A").point(lambda v, a=out: int(v * a)))
img.alpha_composite(layer)
return img
def render_frame(index: int) -> bytes:
return frame_at(index / FPS).convert("RGB").tobytes()
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("--still", type=float)
parser.add_argument("--out", default=str(OUT))
parser.add_argument("--jobs", type=int, default=6)
args = parser.parse_args()
OUT.parent.mkdir(parents=True, exist_ok=True)
if args.still is not None:
path = OUT.parent / ("still_%.2f.png" % args.still)
frame_at(args.still).convert("RGB").save(path)
print(path)
return
import make_lihont_music
make_lihont_music.generate(AUDIO, DURATION, tuple(s[1] for s in SCENES[1:]))
command = [shutil.which("ffmpeg") or "ffmpeg", "-y", "-loglevel", "error", "-f", "rawvideo", "-pix_fmt", "rgb24",
"-s", "%dx%d" % (W, H), "-r", str(FPS), "-i", "-", "-i", str(AUDIO), "-c:v", "libx264", "-preset", "medium",
"-crf", "18", "-pix_fmt", "yuv420p", "-c:a", "aac", "-b:a", "160k", "-shortest", args.out]
proc = subprocess.Popen(command, stdin=subprocess.PIPE)
with Pool(args.jobs, initializer=V.init_assets) as pool:
for n, data in enumerate(pool.imap(render_frame, range(FRAMES), chunksize=4)):
proc.stdin.write(data)
if n % 60 == 0:
print("frame %d/%d" % (n, FRAMES), flush=True)
proc.stdin.close()
proc.wait()
print("done:", args.out)
if __name__ == "__main__":
main()

View File

@@ -27,6 +27,7 @@ PAYLOAD = [
("src/web/assets/site/md3.css", "assets/site/md3.css"),
("src/web/assets/site/md3.js", "assets/site/md3.js"),
("src/web/assets/site/icons.svg", "assets/site/icons.svg"),
("src/web/assets/site/plugin_howto.svg", "assets/site/plugin_howto.svg"),
]

View File

@@ -0,0 +1,9 @@
# Пример 7: тема оформления. Тема только красит экраны мода и TikTok: она ничего не прячет и не двигает.
from lihont_ltp import *
plugin = Plugin("Закат", author="Вася", description="Тёмно-лиловый фон и тёплый акцент", license="MIT")
plugin.theme("Закат", page="#2b1d3a", card="#3d2b52", text="#fbe9ff", accent="#ff8a5b",
on_accent="#2b1d3a", dark=True, radius=20, outline=2, shadow=4)
plugin.save()

View File

@@ -0,0 +1,10 @@
# Пример 8: приколы. Твоё имя волной (только у тебя на экране) и картинка, которая сыплет конфетти и жужжит по нажатию.
from lihont_ltp import *
plugin = Plugin("Приколы", author="Вася", description="Имя волной и конфетти из картинки", license="MIT")
plugin.name(me, style("wave"), title="Моё имя волной")
plugin.screen(picture("star.png", size=100, right=16, bottom=120, on_tap=[wiggle, confetti, buzz]),
title="Звезда с конфетти")
plugin.save()

View File

@@ -9,7 +9,7 @@
from .core import (Plugin, account, after, all_of, always, any_of, author, before, between, bounce, day, download, evening,
friday, hashtag, hide, like, me, morning, night, person, picture, rename, say, sound, wander, weekday,
weekend, wiggle, word)
weekend, wiggle, word, style, confetti, buzz)
from .errors import LtpError
__version__ = "0.1.0"
@@ -18,5 +18,6 @@ __all__ = [
"Plugin", "LtpError",
"word", "hashtag", "author", "person", "account", "between", "weekday", "all_of", "any_of",
"me", "always", "morning", "day", "evening", "night", "friday", "weekend",
"hide", "say", "before", "after", "rename", "picture", "sound", "like", "wiggle", "download", "bounce", "wander",
"hide", "say", "before", "after", "rename", "style", "picture", "sound", "like", "wiggle", "confetti", "buzz",
"download", "bounce", "wander",
]

View File

@@ -219,6 +219,8 @@ class Tap:
hide = Action("feed.hide", True, "hide")
wiggle = Tap("animate")
like = Tap("like")
confetti = Tap("confetti")
buzz = Tap("buzz")
def say(text):
@@ -241,6 +243,12 @@ def rename(text):
return Action("name.replace", text, "rename")
def style(kind):
"""Вид имени на твоём экране: style("upper") — ЗАГЛАВНЫМИ, "lower" — строчными, "reverse" — наоборот,
"wave" — пРиВеТ, "spaced" — п р и в е т. Только у тебя на экране; лучше с условием (me, person(...))."""
return Action("name.style", kind, "style")
def sound(file):
"""Играть звук при нажатии на картинку: picture("cat.gif", on_tap=[sound("meow.ogg")])."""
return Tap("sound", file)
@@ -275,7 +283,7 @@ def picture(file, size=140, right=16, bottom=16, opacity=100, movable=True, on_t
walk=None):
"""Картинка в углу приложения. Файл лежит рядом со скриптом (png, gif или webp).
on_tap=[wiggle, sound("мяу.ogg"), like] — что делать, когда на неё нажали.
on_tap=[wiggle, sound("мяу.ogg"), like] — что делать, когда на неё нажали (ещё confetti — конфетти и buzz — вибрация).
pet="погладили.gif" — вторая картинка, когда водишь пальцем по верхней половине.
walk=bounce(speed=40) или wander() — картинка сама ходит по экрану (двигать её пальцем тогда нельзя).
"""
@@ -284,7 +292,7 @@ def picture(file, size=140, right=16, bottom=16, opacity=100, movable=True, on_t
keys = []
for tap in taps:
if not isinstance(tap, Tap):
raise LtpError("picture(..., on_tap=[...]): внутри можно wiggle, sound(\"файл.ogg\") и like")
raise LtpError("picture(..., on_tap=[...]): внутри можно wiggle, sound(\"файл.ogg\"), like, confetti и buzz")
keys.append(tap.key)
if tap.sound_file:
sound_file = tap.sound_file
@@ -343,6 +351,7 @@ class Plugin:
self.icon = icon
self.id = id or "%s.%s" % (_slug(author) or "me", _slug(name) or "plugin")
self._rules = []
self._theme = None
self._base = _caller_folder()
# правила ----------------------------------------------------------------------------------------------------
@@ -361,6 +370,28 @@ class Plugin:
actions = actions[1:]
return self._add("screen", "screen.show", when, actions, title, limit)
def theme(self, name=None, *, page, card, text, accent, muted=None, on_accent=None, line=None, title_from=None,
title_to=None, dark=False, radius=None, outline=None, shadow=None, bevel=False, tick_box=False,
title_bars=False):
"""Тема оформления: цвета и пара чисел. Тема только красит: она ничего не прячет и не двигает.
plugin.theme("Закат", page="#2b1d3a", card="#3d2b52", text="#fbe9ff", accent="#ff8a5b", radius=20)
Цвета пишутся как #rrggbb маленькими буквами. radius 0–40, outline 0–6, shadow 0–12.
bevel даёт объёмные рамки (как Windows 95), tick_box рисует переключатель галочкой, title_bars делает
заголовки разделов полосой.
"""
theme = {"name": name or self.title, "page": page, "card": card, "text": text, "accent": accent}
for key, value in (("muted", muted), ("on_accent", on_accent), ("line", line), ("title_from", title_from),
("title_to", title_to), ("radius", radius), ("outline", outline), ("shadow", shadow)):
if value is not None:
theme[key] = value
for key, value in (("dark", dark), ("bevel", bevel), ("tick_box", tick_box), ("title_bars", title_bars)):
if value:
theme[key] = True
self._theme = theme
return self
def _add(self, kind, trigger, when, actions, title, limit):
if isinstance(when, Action): # забыли условие: plugin.video(hide) значит «всегда»
actions = (when,) + tuple(actions)
@@ -404,6 +435,8 @@ class Plugin:
manifest["license"] = self.license
if self.ai:
manifest["ai"] = self.ai
if self._theme is not None:
rights.append("ui.theme")
manifest["permissions"] = rights
if "net.download" in rights:
# сайты берутся из адресов скачиваний: писать их отдельно не нужно
@@ -416,7 +449,10 @@ class Plugin:
if host and host not in hosts:
hosts.append(host)
manifest["net"] = {"hosts": hosts}
manifest["rules"] = rules
if self._theme is not None:
manifest["theme"] = self._theme
if rules or self._theme is None:
manifest["rules"] = rules
if not self.description:
del manifest["description"]
return manifest

View File

@@ -4,6 +4,8 @@
Тест репозитория сравнивает его вывод с настоящим Java-защитником на всех готовых плагинах, так что они совпадают.
"""
from . import validate
CALM = 0
WATCH = 1
CAREFUL = 2
@@ -15,6 +17,8 @@ CANNOT_NET = ("Плагин не может: ходить куда-либо, к
"и только после вашего подтверждения.")
DEFAULT_LIMIT = 3
STYLE_WORDS = {"upper": "заглавными буквами", "lower": "строчными буквами", "reverse": "задом наперёд",
"wave": "волной (пРиВеТ)", "spaced": "с пробелами между буквами"}
DAYS = ["", "пн", "вт", "ср", "чт", "пт", "сб", "вс"]
@@ -89,6 +93,8 @@ def says_action(action):
return "дописать «%s» после имени" % value
if key == "name.replace":
return "показать вместо имени «%s»" % value
if key == "name.style":
return "показывать имя " + STYLE_WORDS[value]
if key == "notice":
return "показать подсказку «%s»" % value
if key == "download":
@@ -106,6 +112,10 @@ def says_action(action):
taps.append("звук")
if "like" in spec["tap"]:
taps.append("лайк видео")
if "confetti" in spec["tap"]:
taps.append("конфетти")
if "buzz" in spec["tap"]:
taps.append("вибрация")
if taps:
out += "; по нажатию: " + ", ".join(taps)
if spec["pet"]:
@@ -168,6 +178,10 @@ class Report:
return out + "\n" + (CANNOT_NET if self.net else CANNOT)
def _tenths(value):
return "%d.%d" % (value // 10, value % 10)
def check(manifest, asset_names=()):
careful, watch, calm, rules, seen = [], [], [], [], set()
@@ -177,7 +191,7 @@ def check(manifest, asset_names=()):
seen.add(key)
return True
for index, rule in enumerate(manifest["rules"]):
for index, rule in enumerate(manifest.get("rules", [])):
title = _title(rule, index)
rules.append("%s: %s" % (title, says_rule(rule)))
cond = rule.get("if")
@@ -203,6 +217,12 @@ def check(manifest, asset_names=()):
elif key in ("name.prefix", "name.suffix"):
if once("affix"):
calm.append("Дописывает текст к именам, только на вашем экране.")
elif key == "name.style":
if not picks:
watch.append("Правило «%s» меняет вид всех имён на экране (%s): читать их труднее."
% (title, STYLE_WORDS[value]))
elif once("style"):
calm.append("Меняет вид имён у выбранных аккаунтов, только на вашем экране.")
elif key == "notice":
if limit > 10 and once("notice"):
watch.append("Показывает подсказки до %d раз в день." % limit)
@@ -229,11 +249,26 @@ def check(manifest, asset_names=()):
"она закрывает часть экрана." % spec["image"])
elif spec["size"] >= 300 and once("big"):
watch.append("Большая картинка закрывает часть экрана.")
if ("confetti" in spec["tap"] or "buzz" in spec["tap"]) and once("fun"):
calm.append("Конфетти или лёгкая вибрация по нажатию на картинку.")
if "sound" in spec["tap"] and once("sound"):
watch.append("Играет звук, когда вы нажимаете на картинку.")
if "like" in spec["tap"] and once("like"):
careful.append("Ставит лайк видео на главной ленте, когда вы нажимаете на картинку плагина. "
"Это действие аккаунта: случайное нажатие тоже поставит лайк.")
theme = manifest.get("theme")
if theme is not None:
rules.append("Тема «%s»: меняет цвета и вид экранов мода и TikTok" % theme["name"].strip())
calm.append("Меняет оформление: цвета, формы и рамки. Ничего не скрывает и не двигает. "
"Вернуть как было можно в «Оформление» или режимом DEBUG.")
text, card, accent, on_accent = validate.theme_values(theme)
text_tenths = validate.contrast_tenths(text, card)
if text_tenths < 30:
watch.append("Текст на карточках темы плохо читается: контраст %s при нужных 3.0." % _tenths(text_tenths))
accent_tenths = validate.contrast_tenths(on_accent, accent)
if accent_tenths < 30:
watch.append("Текст на кнопках и заголовках темы плохо читается: контраст %s при нужных 3.0."
% _tenths(accent_tenths))
if asset_names:
calm.append("Файлов внутри: %d. Тип каждого проверен по первым байтам, они входят в хэш." % len(set(asset_names)))
if not (manifest.get("license") or "").strip():

View File

@@ -9,7 +9,7 @@ from . import core
from .core import (account as аккаунт, after as после, all_of as все_условия, always as всегда, any_of as любое_условие,
author as автор, before as перед, between as между, bounce as туда_сюда, wander as бродит,
day as день, download as скачать, evening as вечер,
friday as пятница, hashtag as хэштег, hide as скрыть, like as лайк, me as я, morning as утро,
friday as пятница, style as вид_имени, confetti as конфетти, buzz as вибро, hashtag as хэштег, hide as скрыть, like as лайк, me as я, morning as утро,
night as ночь, person as человек, picture as картинка, rename as переименовать, say as сказать,
sound as звук, weekday as день_недели, weekend as выходные, wiggle as качнуться, word as слово)

View File

@@ -24,14 +24,25 @@ MAX_ICON = 64 * 1024
MAX_FILE = 1024 * 1024
TRIGGERS = ("feed.item", "name.show", "screen.show")
RIGHTS = ("feed.hide", "names", "ui.notice", "ui.overlay", "ui.sound", "feed.like", "net.download")
ACTIONS = ("feed.hide", "name.prefix", "name.suffix", "name.replace", "notice", "overlay", "download")
RIGHTS = ("feed.hide", "names", "ui.notice", "ui.overlay", "ui.sound", "feed.like", "net.download", "ui.theme")
ACTIONS = ("feed.hide", "name.prefix", "name.suffix", "name.replace", "name.style", "notice", "overlay", "download")
NAME_STYLES = ("upper", "lower", "reverse", "wave", "spaced")
TAPS = ("animate", "sound", "like", "confetti", "buzz")
OVERLAY_KEYS = ("image", "size", "alpha", "right", "bottom", "movable", "tap", "sound", "pet", "animate_ms", "walk")
WALK_MODES = ("bounce", "wander")
WALK_KEYS = ("mode", "speed", "flip")
DOWNLOAD_KEYS = ("url", "as", "sha256")
MAX_LICENSE = 40
MAX_THEME_NAME = 24
MAX_RADIUS = 40
MAX_OUTLINE = 6
MAX_SHADOW = 12
THEME_KEYS = ("name", "dark", "page", "card", "text", "muted", "accent", "on_accent", "line", "title_from", "title_to",
"radius", "outline", "shadow", "bevel", "tick_box", "title_bars")
THEME_COLOURS = ("page", "card", "text", "muted", "accent", "on_accent", "line", "title_from", "title_to")
THEME_FLAGS = ("dark", "bevel", "tick_box", "title_bars")
COLOUR = re.compile(r"#[0-9a-f]{6}")
MAX_AI = 4
MAX_AI_TEXT = 60
MAX_URL = 200
@@ -137,6 +148,12 @@ def check_action(node, trigger, where):
raise LtpError("«скрыть» работает только в правилах про видео: %s" % where)
if value is not True:
raise LtpError("%s: нужно true" % here)
elif key == "name.style":
if trigger != "name.show":
raise LtpError("«вид имени» работает только в правилах про имена: %s" % where)
_text(value, 12, here)
if value not in NAME_STYLES:
raise LtpError("%s: вид имени — upper, lower, reverse, wave или spaced, а не «%s»" % (here, value))
elif key == "notice":
_text(value, 80, here)
elif key == "overlay":
@@ -205,8 +222,8 @@ def check_overlay(node, where):
if not isinstance(taps, list):
raise LtpError("%s, «tap»: нужен список" % where)
for tap in taps:
if tap not in ("animate", "sound", "like"):
raise LtpError("%s, «tap»: можно wiggle, sound(...) и like" % where)
if tap not in TAPS:
raise LtpError("%s, «tap»: можно wiggle, sound(...), like, confetti и buzz" % where)
if len(set(taps)) != len(taps):
raise LtpError("%s, «tap»: одно и то же действие названо дважды" % where)
else:
@@ -279,6 +296,65 @@ def rights_of(action):
return ["names"]
def theme_colour(theme, key, default):
"""Цвет темы как число 0xRRGGBB; если поля нет — значение по умолчанию (те же, что в приложении)."""
value = theme.get(key)
return default if value is None else int(value[1:], 16)
def theme_values(theme):
"""Цвета темы с теми же умолчаниями, что в ThemeData.java: (текст, карточка, акцент, текст на акценте)."""
text = theme_colour(theme, "text", 0)
card = theme_colour(theme, "card", 0)
accent = theme_colour(theme, "accent", 0)
on_accent = theme_colour(theme, "on_accent", 0xFFFFFF)
return text, card, accent, on_accent
def _linear(channel):
c = channel / 255.0
return c / 12.92 if c <= 0.03928 else ((c + 0.055) / 1.055) ** 2.4
def _luminance(rgb):
return 0.2126 * _linear((rgb >> 16) & 0xFF) + 0.7152 * _linear((rgb >> 8) & 0xFF) + 0.0722 * _linear(rgb & 0xFF)
def contrast_tenths(a, b):
"""Контраст WCAG в десятых (21.0 это 210), отбрасывая лишнее, как в Java: так проверки совпадают."""
one = _luminance(a) + 0.05
two = _luminance(b) + 0.05
ratio = one / two if one > two else two / one
return int(ratio * 10)
def check_theme(theme, where="plugin.json, «theme»"):
"""Тема: цвета и несколько чисел, ничего больше. Те же поля и границы, что в ThemeData.java."""
if not isinstance(theme, dict):
raise LtpError("%s: нужен объект {…}" % where)
for key in theme:
if key not in THEME_KEYS:
raise LtpError("%s: нет поля «%s»" % (where, key))
name = _text(theme.get("name"), MAX_THEME_NAME, where + ", поле «name»").strip()
if not name:
raise LtpError("%s: название темы не может быть пустым" % where)
for key in ("page", "card", "text", "accent"):
if theme.get(key) is None:
raise LtpError("%s: нет поля «%s»" % (where, key))
for key in THEME_COLOURS:
value = theme.get(key)
if value is not None:
_text(value, 7, where + ", поле «%s»" % key)
if not COLOUR.fullmatch(value):
raise LtpError("%s, поле «%s»: цвет пишут как #rrggbb, например #2b1d3a (маленькими буквами)" % (where, key))
for key, high in (("radius", MAX_RADIUS), ("outline", MAX_OUTLINE), ("shadow", MAX_SHADOW)):
if theme.get(key) is not None:
_integer(theme[key], 0, high, where + ", поле «%s»" % key)
for key in THEME_FLAGS:
if theme.get(key) is not None and not isinstance(theme[key], bool):
raise LtpError("%s, поле «%s»: нужно true или false" % (where, key))
def check_manifest(manifest, assets=None):
"""`assets` — словарь «имя файла → байты» (или None, если файлы тут неизвестны)."""
if not isinstance(manifest, dict):
@@ -317,8 +393,17 @@ def check_manifest(manifest, assets=None):
raise LtpError("Неизвестное право «%s»" % right)
if len(set(permissions)) != len(permissions):
raise LtpError("Одно право названо дважды")
theme = manifest.get("theme")
if theme is not None:
if "ui.theme" not in permissions:
raise LtpError("plugin.json: есть «theme», но нет права «ui.theme»")
check_theme(theme)
elif "ui.theme" in permissions:
raise LtpError("plugin.json: право «ui.theme» требует поле «theme»")
rules = manifest.get("rules")
if not isinstance(rules, list) or not rules:
if rules is None and theme is not None:
rules = [] # a plugin that only brings a theme has no rules
if not isinstance(rules, list) or (not rules and theme is None):
raise LtpError("В плагине нет правил: добавь хотя бы одно, например plugin.video(hashtag(\"fyp\"), hide)")
if len(rules) > MAX_RULES:
raise LtpError("В плагине больше %d правил" % MAX_RULES)
@@ -352,7 +437,7 @@ def check_manifest(manifest, assets=None):
if rule.get("limit") is not None:
_integer(rule["limit"], 1, MAX_LIMIT, where + ", «limit»")
for right in permissions:
if right not in used:
if right != "ui.theme" and right not in used:
raise LtpError("Плагин просит право «%s», но не использует его" % right)
check_net(manifest.get("net"), permissions, downloads, assets)
if assets is not None:

View File

@@ -36,6 +36,7 @@ plugin.save()
- **Про что**: `plugin.video(...)`, `plugin.name(...)`, `plugin.screen(...)`.
- **Если** (необязательно, без него «всегда»): `word("слово")`, `hashtag("тег")`, `author("ник")`, `person("id")`, `account("ник")`, `me`, `between("22:00","07:00")`, `weekday("fri")`, `morning/day/evening/night`, `friday/weekend`; сочетания `a & b` (и), `a | b` (или), `~a` (не). Несколько слов в одном условии значат «или»: `hashtag("fyp","foryou")`.
- **Тема оформления**: `plugin.theme("Закат", page="#2b1d3a", card="#3d2b52", text="#fbe9ff", accent="#ff8a5b", on_accent="#2b1d3a", radius=20)`. Цвета `#rrggbb` маленькими буквами; radius 0–40, outline 0–6, shadow 0–12; `bevel`, `tick_box`, `title_bars` для вида Windows 95. Тема только красит (ничего не прячет и не двигает), правила в таком плагине не нужны. Следи за контрастом: текст на карточках и на акценте не ниже 3.0, иначе защитник предупредит.
- **Что сделать**: `hide` (только в `video`), `say("текст")` (подсказка, `limit=1` чтобы не чаще раза в день), `before("…")`, `after("…")`, `rename("…")` (только в `name`), `picture("файл", size=…, right=…, bottom=…, opacity=…, movable=True, on_tap=[wiggle, sound("x.ogg"), like], pet="…")`, `download("https://…", "имя.png")` (только в `screen`).
- В `picture`: `like` ставит лайк по нажатию, поэтому добавляй его, только если человек прямо попросил.
- Лицензия и ИИ: всегда ставь `license="MIT"` (или `"VCBFU-2"`) и `ai="<какая модель написала>"`. Без лицензии защитник отметит замечание, а для полки «проверенные» нужна MIT или VCBFU-2.
@@ -52,12 +53,15 @@ plugin.save()
| Короткая подсказка (до 80 знаков, не чаще лимита) | Читать чаты, комментарии, пароли, личные данные |
| Картинка поверх приложения с анимацией, звуком, перетаскиванием, лайком по нажатию | Запускать код, вызывать любые функции |
| Скачать картинку или звук (https, до 400 КБ, названный сайт, два согласия человека) | Ходить в интернет иначе; скачивать другое; отправлять данные |
| Тема оформления: цвета, радиус, контур, тень, объёмные рамки, галочки, полосы заголовков | Прятать, двигать и добавлять элементы экрана |
| Лимиты: до 32 правил, до 8 действий в правиле, до 8 файлов по 400 КБ, всего 1 МБ | Темы, виджеты, кнопки: этого вида плагинов пока нет |
Если просят то, чего в левой колонке нет, скажи прямо: это пока невозможно. Не изобретай несуществующие функции и не предлагай обходные пути через код.
## Осторожность
- **Закрыто навсегда** (этого нет и не будет у плагинов, не обещай и не придумывай обходов): пароли и коды входа, токены и ключи, **куки** и сессии, тексты сообщений и чатов, запуск кода. Если просят такое, скажи прямо, что формат этого не даёт.
- Не делай плагин «скрыть все видео» или «поменять все имена» без условия: защитник пометит его красным. Спроси, не нужно ли сузить условие.
- Не клади в плагин чужие картинки, звуки и мемы без разрешения автора. Свои или свободные (CC0, MIT) файлы можно, и об источнике надо сказать.
- `download` пиши только с адресом, который дал человек. Если можешь, добавь `sha256="…"`, иначе защитник предупредит, что сайт может подменить файл.

View File

@@ -85,6 +85,7 @@ final class BarStyle implements ViewTreeObserver.OnPreDrawListener, View.OnAttac
create = bar.getChildAt(CREATE);
if (create != null) {
plus = new PlusPill(density, palette.primary, palette.onPrimary);
plus.setSquare(lihont.two.settings.ThemeEngine.square(activity));
android.util.Log.i("LihonT", "bar-style create button: " + describe(create));
}
int styled = 0;
@@ -101,6 +102,7 @@ final class BarStyle implements ViewTreeObserver.OnPreDrawListener, View.OnAttac
Drawable existing = item.getBackground();
if (existing != null && !(existing instanceof NavPill)) continue;
NavPill pill = new NavPill(icon, density, palette.secondaryContainer);
pill.setSquare(lihont.two.settings.ThemeEngine.square(activity));
item.setBackground(pill);
pill.snapTo(item.isSelected());
pills[i] = pill;

View File

@@ -28,6 +28,12 @@ final class NavPill extends Drawable {
private boolean selected;
private ValueAnimator animator;
private boolean square;
void setSquare(boolean value) {
square = value;
}
NavPill(View icon, float density, int color) {
this.icon = icon;
this.density = density;
@@ -100,7 +106,8 @@ final class NavPill extends Drawable {
rect.set(cx - width / 2f, cy - height / 2f, cx + width / 2f, cy + height / 2f);
int alpha = paint.getAlpha();
paint.setAlpha(Math.round(alpha * progress));
canvas.drawRoundRect(rect, height / 2f, height / 2f, paint);
if (square) canvas.drawRect(rect, paint);
else canvas.drawRoundRect(rect, height / 2f, height / 2f, paint);
paint.setAlpha(alpha);
}

View File

@@ -14,6 +14,11 @@ final class PlusPill extends Drawable {
private final Paint glyph = new Paint(Paint.ANTI_ALIAS_FLAG);
private final RectF body = new RectF();
private final float density;
private boolean square;
void setSquare(boolean value) {
square = value;
}
PlusPill(float density, int fillColor, int glyphColor) {
this.density = density;
@@ -33,7 +38,7 @@ final class PlusPill extends Drawable {
float cx = bounds.exactCenterX();
float cy = bounds.exactCenterY();
body.set(cx - width / 2f, cy - height / 2f, cx + width / 2f, cy + height / 2f);
float radius = height / 2.4f;
float radius = square ? 0f : height / 2.4f;
canvas.drawRoundRect(body, radius, radius, fill);
float arm = 9f * density;
float thick = 1.6f * density;

View File

@@ -108,7 +108,7 @@ final class ProfileMenu {
int gap = Math.round(1 * density);
GradientDrawable tile = new GradientDrawable();
tile.setColor(palette.surfaceContainerHigh);
tile.setCornerRadius(24 * density);
tile.setCornerRadius(lihont.two.settings.ThemeEngine.square(row.getContext()) ? 0f : 24 * density);
row.setBackground(new InsetDrawable(tile, side, gap, side, gap));
View name = cell.findViewById(title);

View File

@@ -20,6 +20,9 @@ public final class BubbleDrawable extends Drawable {
private final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.FILTER_BITMAP_FLAG);
private final Rect from = new Rect();
private final Path clip = new Path();
private final RectF clipBox = new RectF();
private int clipWidth = -1;
private int clipHeight = -1;
/** @param corner the radius of the rounded corners, in pixels */
public BubbleDrawable(Bitmap bitmap, int corner) {
@@ -40,8 +43,16 @@ public final class BubbleDrawable extends Drawable {
int left = (bitmap.getWidth() - w) / 2;
int top = (bitmap.getHeight() - h) / 2;
from.set(left, top, left + w, top + h);
clip.reset();
clip.addRoundRect(new RectF(box), corner, corner, Path.Direction.CW);
if (clipWidth != box.width() || clipHeight != box.height()) {
clipWidth = box.width();
clipHeight = box.height();
clip.reset();
clipBox.set(box);
clip.addRoundRect(clipBox, corner, corner, Path.Direction.CW);
} else if (clipBox.left != box.left || clipBox.top != box.top) {
clip.offset(box.left - clipBox.left, box.top - clipBox.top);
clipBox.set(box);
}
int saved = canvas.save();
canvas.clipPath(clip);
canvas.drawBitmap(bitmap, from, box, paint);

View File

@@ -25,7 +25,13 @@ public final class BubbleStore {
private static final String PEOPLE = "people";
private static final int MAX_PEOPLE = 60;
private static final Map<String, Bitmap> CACHE = new HashMap<String, Bitmap>();
/** At most this many pictures stay decoded in memory; the one used least recently leaves first. */
private static final int MAX_CACHED = 6;
private static final Map<String, Bitmap> CACHE = new java.util.LinkedHashMap<String, Bitmap>(8, 0.75f, true) {
@Override protected boolean removeEldestEntry(Map.Entry<String, Bitmap> eldest) {
return size() > MAX_CACHED;
}
};
private static String lastSeen;
private BubbleStore() {}
@@ -57,7 +63,7 @@ public final class BubbleStore {
/** Remembers the name of a person whose chat was opened, so that a picture can be chosen for them from a list. */
public static void seen(Context context, String person) {
if (person == null || person.length() == 0 || person.length() > 40 || person.equals(lastSeen)) return;
if (!plausible(person) || person.equals(lastSeen)) return;
lastSeen = person;
SharedPreferences prefs = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE);
java.util.Set<String> known = new java.util.HashSet<String>(prefs.getStringSet(PEOPLE, new java.util.HashSet<String>()));
@@ -68,11 +74,37 @@ public final class BubbleStore {
public static java.util.List<String> people(Context context) {
SharedPreferences prefs = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE);
java.util.List<String> list = new java.util.ArrayList<String>(prefs.getStringSet(PEOPLE, new java.util.HashSet<String>()));
java.util.List<String> list = new java.util.ArrayList<String>();
for (String name : prefs.getStringSet(PEOPLE, new java.util.HashSet<String>())) {
if (plausible(name)) list.add(name); // names kept by earlier builds that were really screen labels are hidden
}
java.util.Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
return list;
}
private static final String[] LABELS = {"репост", "репосты", "входящие", "сообщения", "чат", "чаты", "активность", "уведомления",
"запросы", "новые подписчики", "inbox", "reposts", "messages", "notifications", "activity", "chat"};
/** True when the text can be a person's name: not a number, not a one-letter mark and not a label of the app's own screens. */
static boolean plausible(String name) {
if (name == null) return false;
String text = name.trim();
if (text.length() < 2 || text.length() > 40) return false;
boolean digitsOnly = true;
for (int i = 0; i < text.length(); i++) {
if (!Character.isDigit(text.charAt(i))) {
digitsOnly = false;
break;
}
}
if (digitsOnly) return false;
String lower = text.toLowerCase(java.util.Locale.ROOT);
for (String label : LABELS) {
if (lower.equals(label)) return false;
}
return true;
}
/** The picture for a slot: OWN, GENERAL or "p:" + person; a person without one gets the general picture. */
public static synchronized Bitmap forSlot(Context context, String slot, boolean fallbackToGeneral) {
Bitmap own = load(context, slot);

View File

@@ -51,14 +51,24 @@ public final class Bubbles {
});
}
/** The ids of the chat views never change while the app runs: they are looked up once instead of three times a frame. */
private static int listIdCache;
private static int rowIdCache;
private static int bubbleIdCache;
private static int id(Activity activity, String name) {
return activity.getResources().getIdentifier(name, "id", activity.getPackageName());
}
private static void apply(Activity activity, View decor) {
int listId = id(activity, LIST);
int rowId = id(activity, ROW);
int bubbleId = id(activity, BUBBLE);
if (listIdCache == 0) {
listIdCache = id(activity, LIST);
rowIdCache = id(activity, ROW);
bubbleIdCache = id(activity, BUBBLE);
}
int listId = listIdCache;
int rowId = rowIdCache;
int bubbleId = bubbleIdCache;
if (listId == 0 || rowId == 0 || bubbleId == 0) return;
View found = decor.findViewById(listId);
if (!(found instanceof ViewGroup)) return;
@@ -122,6 +132,7 @@ public final class Bubbles {
int h = picture.getHeight();
Bitmap middle = Bitmap.createBitmap(picture, w / 4, h / 4, Math.max(1, w / 2), Math.max(1, h / 2));
Bitmap tiny = Bitmap.createScaledBitmap(middle, 8, 8, true);
if (middle != picture && middle != tiny) middle.recycle();
float sum = 0f;
float weight = 0f;
for (int y = 0; y < 8; y++) {
@@ -133,6 +144,7 @@ public final class Bubbles {
weight += a;
}
}
if (tiny != picture) tiny.recycle();
int color = weight == 0f || sum / weight < 0.55f ? 0xFFFFFFFF : 0xFF111111;
TEXT.put(picture, Integer.valueOf(color));
return color;

View File

@@ -107,7 +107,7 @@ final class CommentPanel {
this.palette = Md3.palette(activity, dark ? ModSettings.Theme.DARK : ModSettings.Theme.LIGHT);
this.sheetBackground = new SheetBackground(density);
this.sheetBackground.setColors(palette.surfaceContainerLow, palette.onSurfaceVariant);
this.pill = new Fill(palette.surfaceContainerHigh, PILL_RADIUS_DP * density);
this.pill = new Fill(activity, palette.surfaceContainerHigh, PILL_RADIUS_DP * density);
this.mutedIcon = new PorterDuffColorFilter(palette.onSurfaceVariant, PorterDuff.Mode.SRC_IN);
this.strongIcon = new PorterDuffColorFilter(palette.onSurface, PorterDuff.Mode.SRC_IN);
this.accentIcon = new PorterDuffColorFilter(palette.primary, PorterDuff.Mode.SRC_IN);
@@ -295,7 +295,7 @@ final class CommentPanel {
private boolean card(View card) {
CardState state = CARDS.get(card);
if (state == null) {
state = new CardState(new Fill(palette.surfaceContainer, CARD_RADIUS_DP * density));
state = new CardState(new Fill(activity, palette.surfaceContainer, CARD_RADIUS_DP * density));
state.color = palette.surfaceContainer;
CARDS.put(card, state);
note("card " + describe(card) + " " + card.getClass().getSuperclass().getSimpleName()

View File

@@ -1,11 +1,20 @@
package lihont.two.comments;
import android.content.Context;
import android.graphics.drawable.GradientDrawable;
import lihont.two.settings.ThemeEngine;
/** A rounded tonal fill of the comment skin; the type tells the skin which backgrounds are its own. */
final class Fill extends GradientDrawable {
Fill(int color, float radiusPx) {
Fill(Context context, int color, float radiusPx) {
setColor(color);
setCornerRadius(radiusPx);
if (ThemeEngine.square(context)) {
// a square theme: no rounding, a thin edge so the fill reads as a panel
setCornerRadius(0f);
setStroke(Math.max(1, Math.round(context.getResources().getDisplayMetrics().density)), ThemeEngine.edge(context));
} else {
setCornerRadius(radiusPx);
}
}
}

View File

@@ -0,0 +1,99 @@
package lihont.two.look;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;
import java.io.File;
import java.io.IOException;
import lihont.two.plugin.PluginRegistry;
import lihont.two.settings.ModSettings;
import lihont.two.settings.SettingsHost;
import lihont.two.settings.ThemeEngine;
/**
* The way back when a look or a plugin has made the screen hard to use.
*
* With DEBUG on, the app keeps a small marker file in its cache folder. Android's own "Clear cache" (App info, outside the
* app, so it works even when our screens cannot be read) removes the marker; the next time a screen opens, the missing marker
* tells the mod that the cache was cleared on purpose, and it resets the look (theme, colours, shape of the bar) and the
* plugins (safe mode on, internet off for every plugin). The plugin files stay, so nothing is lost: the person can switch
* them on again. DEBUG then turns itself off, so a cache that the system trims by itself later cannot reset anything twice.
*/
public final class DebugMode {
private static final String TAG = "LIHONT";
private static final String PREFS = "lihont_debug";
private static final String KEY = "enabled";
private static final String MARKER = "lihont_debug.marker";
private DebugMode() {}
public static boolean enabled(Context context) {
return context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).getBoolean(KEY, false);
}
/** Switches DEBUG on (and puts the marker in the cache) or off (and takes it out). */
public static void set(Context context, boolean on) {
context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit().putBoolean(KEY, on).apply();
File marker = new File(context.getCacheDir(), MARKER);
if (on) {
try {
if (!marker.exists() && !marker.createNewFile()) Log.w(TAG, "debug: marker not created");
} catch (IOException cannot) {
Log.w(TAG, "debug: marker not created: " + cannot);
}
} else if (marker.exists() && !marker.delete()) {
Log.w(TAG, "debug: marker not removed");
}
}
/** Puts the marker back when DEBUG is on: used after the app clears its own cache, which is not the way to a reset. */
public static void keepMarker(Context context) {
try {
if (enabled(context)) set(context, true);
} catch (RuntimeException ignored) {
// The marker is a convenience for recovery; never let it stop a restart.
}
}
/** Called when a screen opens: if DEBUG is on and the marker is gone, the cache was cleared, so reset. */
public static void check(Context context) {
try {
if (!enabled(context)) return;
if (new File(context.getCacheDir(), MARKER).exists()) return;
Log.i(TAG, "debug: the cache was cleared with DEBUG on, resetting the look and the plugins");
resetLook(context);
resetPlugins(context);
set(context, false);
} catch (Throwable ignored) {
// A recovery tool must never take a screen down.
}
}
private static void resetLook(Context context) {
ThemeEngine.reset(context);
ModSettings now = SettingsHost.active();
if (now == null) return;
ModSettings fresh = ModSettings.defaults();
ModSettings next = now.withMd3(fresh.md3()).withTheme(fresh.theme()).withAccent(fresh.accent())
.withAccentHue(fresh.accentHue()).withAmoled(fresh.amoled()).withCompactBar(fresh.compactBar());
try {
SettingsHost.repository(context).save(next);
} catch (IOException | RuntimeException cannot) {
Log.w(TAG, "debug: the look settings were not saved: " + cannot);
}
}
private static void resetPlugins(Context context) {
PluginRegistry.enterSafeMode(context);
for (PluginRegistry.Entry entry : PluginRegistry.entries(context)) {
PluginRegistry.setNetOn(context, entry.id, false);
}
}
/** The SharedPreferences file name, for the tests and for a person who wants to check it. */
static SharedPreferences prefs(Context context) {
return context.getSharedPreferences(PREFS, Context.MODE_PRIVATE);
}
}

View File

@@ -33,6 +33,8 @@ public final class Windows implements Application.ActivityLifecycleCallbacks {
/** Watchers for a screen that has just come to the front; also called by the main screen itself. */
public static void attach(Activity activity) {
// the recovery mode first: it may reset the look and the plugins before any skin reads them
DebugMode.check(activity);
try {
lihont.two.plugin.PluginScreen.attach(activity);
} catch (Throwable ignored) {

View File

@@ -11,6 +11,7 @@ import java.util.Map;
* {"name.prefix": "text"} text before the name (right names, trigger name.show)
* {"name.suffix": "text"} text after the name (right names, trigger name.show)
* {"name.replace": "text"} another name (right names, trigger name.show)
* {"name.style": "upper"} the look of the name: upper, lower, reverse, wave or spaced (right names, trigger name.show)
* {"notice": "text"} a short hint on the screen (right ui.notice, any trigger)
* {"overlay": {...}} a picture over the app, see OverlaySpec (right ui.overlay, plus ui.sound and
* feed.like for a tap that plays a sound or likes; trigger screen.show)
@@ -26,6 +27,40 @@ final class Act {
static final int NOTICE = 4;
static final int OVERLAY = 5;
static final int DOWNLOAD = 6;
static final int STYLE = 7;
/** The looks a name can be given, with the words the defender uses for each. */
static final String[] STYLES = {"upper", "lower", "reverse", "wave", "spaced"};
private static final String[] STYLE_WORDS = {"заглавными буквами", "строчными буквами", "задом наперёд",
"волной (пРиВеТ)", "с пробелами между буквами"};
static String styleWords(String style) {
for (int i = 0; i < STYLES.length; i++) {
if (STYLES[i].equals(style)) return STYLE_WORDS[i];
}
return style;
}
/** The name in the given look; a name that is longer than the screen can show is cut by the app, not here. */
static String restyle(String style, String name) {
if (style.equals("upper")) return name.toUpperCase(java.util.Locale.ROOT);
if (style.equals("lower")) return name.toLowerCase(java.util.Locale.ROOT);
if (style.equals("reverse")) return new StringBuilder(name).reverse().toString();
StringBuilder out = new StringBuilder();
int index = 0;
for (int i = 0; i < name.length(); ) {
int point = name.codePointAt(i);
i += Character.charCount(point);
if (style.equals("wave")) {
out.appendCodePoint(index % 2 == 0 ? Character.toLowerCase(point) : Character.toUpperCase(point));
} else {
if (index > 0) out.append(' ');
out.appendCodePoint(point);
}
index++;
}
return out.toString();
}
final int kind;
final String text;
@@ -71,6 +106,7 @@ final class Act {
if (kind == SUFFIX) return "дописать «" + text + "» после имени";
if (kind == REPLACE) return "показать вместо имени «" + text + "»";
if (kind == NOTICE) return "показать подсказку «" + text + "»";
if (kind == STYLE) return "показывать имя " + styleWords(text);
if (kind == DOWNLOAD) {
return "скачать файл " + download.as + " с сайта " + download.host + " (после вашего подтверждения)";
}
@@ -83,6 +119,8 @@ final class Act {
if (overlay.tap.contains(OverlaySpec.TAP_ANIMATE)) taps.add("играет анимация");
if (overlay.tap.contains(OverlaySpec.TAP_SOUND)) taps.add("звук");
if (overlay.tap.contains(OverlaySpec.TAP_LIKE)) taps.add("лайк видео");
if (overlay.tap.contains(OverlaySpec.TAP_CONFETTI)) taps.add("конфетти");
if (overlay.tap.contains(OverlaySpec.TAP_BUZZ)) taps.add("вибрация");
if (!taps.isEmpty()) {
out.append("; по нажатию: ");
for (int i = 0; i < taps.size(); i++) out.append(i > 0 ? ", " : "").append(taps.get(i));
@@ -111,6 +149,14 @@ final class Act {
if (!Rule.SCREEN.equals(trigger)) throw new LtpException(here + ": работает только в правиле screen.show");
return new Act(DOWNLOAD, "", null, DownloadSpec.parse(value, here));
}
if (key.equals("name.style")) {
if (!Rule.NAME.equals(trigger)) throw new LtpException(here + ": работает только в правиле name.show");
String style = Fields.text(value, 12, here);
if (!Fields.in(style, STYLES)) {
throw new LtpException(here + ": вид имени — upper, lower, reverse, wave или spaced, а не «" + style + "»");
}
return new Act(STYLE, style, null);
}
int kind = key.equals("name.prefix") ? PREFIX
: key.equals("name.suffix") ? SUFFIX
: key.equals("name.replace") ? REPLACE : -1;

View File

@@ -0,0 +1,90 @@
package lihont.two.plugin;
import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.SystemClock;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import java.util.Random;
/**
* A short burst of confetti thrown up from a point of the screen, for a tap on a plugin's picture. It draws on its own view
* that is put over the screen for a second and a half and then removed, never takes a touch, and holds no pictures: a few
* dozen small coloured shapes, so it costs almost no memory.
*/
final class Confetti extends View {
private static final int COUNT = 36;
private static final long LIFE_MS = 1500L;
private static final int[] COLOURS = {0xFFFF6B6B, 0xFFFFCD3C, 0xFF5ED6AA, 0xFF9670FF, 0xFF5AB4FF, 0xFFFF96C8};
private final Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
private final float[] vx = new float[COUNT];
private final float[] vy = new float[COUNT];
private final float[] spin = new float[COUNT];
private final float[] size = new float[COUNT];
private final float originX;
private final float originY;
private final float gravity;
private final long start = SystemClock.uptimeMillis();
private Confetti(Context context, float x, float y) {
super(context);
float density = context.getResources().getDisplayMetrics().density;
originX = x;
originY = y;
gravity = 900f * density;
Random random = new Random(start);
for (int i = 0; i < COUNT; i++) {
double angle = -Math.PI * (0.05 + random.nextDouble() * 0.9);
float speed = (180f + random.nextFloat() * 320f) * density;
vx[i] = (float) Math.cos(angle) * speed;
vy[i] = (float) Math.sin(angle) * speed;
spin[i] = (random.nextFloat() - 0.5f) * 16f;
size[i] = (4f + random.nextFloat() * 5f) * density;
}
setClickable(false);
setFocusable(false);
}
/** Throws confetti from the middle of `from`, over the whole screen of the activity. */
static void burst(Activity activity, View from) {
try {
ViewGroup decor = (ViewGroup) activity.getWindow().getDecorView();
int[] at = new int[2];
from.getLocationInWindow(at);
final Confetti view = new Confetti(activity, at[0] + from.getWidth() / 2f, at[1] + from.getHeight() / 2f);
decor.addView(view, new FrameLayout.LayoutParams(-1, -1));
view.postDelayed(new Runnable() {
@Override public void run() {
ViewGroup parent = (ViewGroup) view.getParent();
if (parent != null) parent.removeView(view);
}
}, LIFE_MS + 100L);
} catch (RuntimeException ignored) {
// A flourish: never worth taking a screen down.
}
}
@Override protected void onDraw(Canvas canvas) {
float t = (SystemClock.uptimeMillis() - start) / 1000f;
float fade = Math.max(0f, 1f - (t * 1000f) / LIFE_MS);
if (fade <= 0f) return;
paint.setStyle(Paint.Style.FILL);
for (int i = 0; i < COUNT; i++) {
float x = originX + vx[i] * t;
float y = originY + vy[i] * t + 0.5f * gravity * t * t;
paint.setColor(COLOURS[i % COLOURS.length]);
paint.setAlpha((int) (255 * fade));
canvas.save();
canvas.translate(x, y);
canvas.rotate(spin[i] * t * 57.3f);
canvas.drawRect(-size[i], -size[i] / 2f, size[i], size[i] / 2f, paint);
canvas.restore();
}
postInvalidateOnAnimation();
}
}

View File

@@ -86,6 +86,13 @@ public final class Defender {
}
} else if (act.kind == Act.PREFIX || act.kind == Act.SUFFIX) {
if (seen.add("affix")) calm.add("Дописывает текст к именам, только на вашем экране.");
} else if (act.kind == Act.STYLE) {
if (!selects) {
watch.add("Правило «" + rule.title + "» меняет вид всех имён на экране (" + Act.styleWords(act.text)
+ "): читать их труднее.");
} else if (seen.add("style")) {
calm.add("Меняет вид имён у выбранных аккаунтов, только на вашем экране.");
}
} else if (act.kind == Act.NOTICE) {
if (rule.limit > 10 && seen.add("notice")) {
watch.add("Показывает подсказки до " + rule.limit + " раз в день.");
@@ -112,6 +119,10 @@ public final class Defender {
} else if (spec.size >= 300 && seen.add("big")) {
watch.add("Большая картинка закрывает часть экрана.");
}
if ((spec.tap.contains(OverlaySpec.TAP_CONFETTI) || spec.tap.contains(OverlaySpec.TAP_BUZZ))
&& seen.add("fun")) {
calm.add("Конфетти или лёгкая вибрация по нажатию на картинку.");
}
if (spec.tap.contains(OverlaySpec.TAP_SOUND) && seen.add("sound")) {
watch.add("Играет звук, когда вы нажимаете на картинку.");
}
@@ -122,6 +133,19 @@ public final class Defender {
}
}
}
if (plugin.theme != null) {
ThemeData theme = plugin.theme;
rules.add("Тема «" + theme.name + "»: меняет цвета и вид экранов мода и TikTok");
calm.add("Меняет оформление: цвета, формы и рамки. Ничего не скрывает и не двигает. "
+ "Вернуть как было можно в «Оформление» или режимом DEBUG.");
if (theme.textContrast() < 30) {
watch.add("Текст на карточках темы плохо читается: контраст " + tenths(theme.textContrast()) + " при нужных 3.0.");
}
if (theme.accentContrast() < 30) {
watch.add("Текст на кнопках и заголовках темы плохо читается: контраст " + tenths(theme.accentContrast())
+ " при нужных 3.0.");
}
}
if (!plugin.assets.isEmpty()) {
calm.add("Файлов внутри: " + plugin.assets.size() + ". Тип каждого проверен по первым байтам, они входят в хэш.");
}
@@ -134,6 +158,10 @@ public final class Defender {
!plugin.hosts.isEmpty());
}
private static String tenths(int value) {
return (value / 10) + "." + (value % 10);
}
private static String join(List<String> items) {
StringBuilder out = new StringBuilder();
for (int i = 0; i < items.size(); i++) out.append(i > 0 ? ", " : "").append(items.get(i));

View File

@@ -35,6 +35,7 @@ public final class Evaluator {
if (act.kind == Act.PREFIX) result = expand(act.text, result, ctx) + result;
else if (act.kind == Act.SUFFIX) result = result + expand(act.text, result, ctx);
else if (act.kind == Act.REPLACE) result = expand(act.text, result, ctx);
else if (act.kind == Act.STYLE) result = Act.restyle(act.text, result);
}
}
if (result.length() > MAX_NAME) result = result.substring(0, MAX_NAME);

View File

@@ -34,6 +34,8 @@ public final class OverlaySpec {
public static final String TAP_ANIMATE = "animate";
public static final String TAP_SOUND = "sound";
public static final String TAP_LIKE = "like";
public static final String TAP_CONFETTI = "confetti";
public static final String TAP_BUZZ = "buzz";
public static final String WALK_BOUNCE = "bounce";
public static final String WALK_WANDER = "wander";
@@ -106,8 +108,8 @@ public final class OverlaySpec {
} else {
for (Object item : Fields.list(map.get("tap"), where + ", «tap»")) {
String what = Fields.text(item, 12, where + ", «tap»");
if (!Fields.in(what, TAP_ANIMATE, TAP_SOUND, TAP_LIKE)) {
throw new LtpException(where + ", «tap»: можно animate, sound и like, а не «" + what + "»");
if (!Fields.in(what, TAP_ANIMATE, TAP_SOUND, TAP_LIKE, TAP_CONFETTI, TAP_BUZZ)) {
throw new LtpException(where + ", «tap»: можно animate, sound, like, confetti и buzz, а не «" + what + "»");
}
if (tap.contains(what)) throw new LtpException(where + ", «tap»: «" + what + "» названо дважды");
tap.add(what);

View File

@@ -19,6 +19,7 @@ public final class Permission {
public static final String SOUND = "ui.sound";
public static final String LIKE = "feed.like";
public static final String NET_DOWNLOAD = "net.download";
public static final String UI_THEME = "ui.theme";
private static final Map<String, String> TEXT = new LinkedHashMap<String, String>();
@@ -29,6 +30,8 @@ public final class Permission {
TEXT.put(OVERLAY, "Показывать свою картинку поверх приложения (её можно двигать)");
TEXT.put(SOUND, "Проигрывать звук плагина, когда вы нажимаете на его картинку");
TEXT.put(LIKE, "Ставить лайк видео на главной ленте, когда вы нажимаете на картинку плагина");
TEXT.put(UI_THEME, "Менять оформление экранов мода и TikTok: цвета, формы, рамки "
+ "(ничего не скрывает и не двигает; вернуть можно в «Оформление» или режимом DEBUG)");
TEXT.put(NET_DOWNLOAD, "Скачивать картинки и звуки с названных сайтов (включается отдельным переключателем, "
+ "каждый адрес вы подтверждаете)");
}

View File

@@ -50,10 +50,13 @@ public final class Plugin {
public final String license;
/** The AI models the author says helped write it; empty when none are named. Said by the author, not checked. */
public final List<String> ai;
/** The look the plugin brings (right ui.theme), or null. */
public final ThemeData theme;
private Plugin(String id, String name, String version, String author, String description,
List<String> permissions, List<Rule> rules, String sha256, Set<String> assets, List<String> hosts,
String license, List<String> ai) {
String license, List<String> ai, ThemeData theme) {
this.theme = theme;
this.license = license;
this.ai = Collections.unmodifiableList(ai);
this.hosts = Collections.unmodifiableList(hosts);
@@ -125,13 +128,25 @@ public final class Plugin {
permissions.add(right);
}
List<Object> raw = Fields.list(root.get("rules"), "plugin.json, «rules»");
if (raw.isEmpty()) throw new LtpException("В плагине нет правил");
ThemeData theme = null;
if (root.get("theme") != null) {
if (!permissions.contains(Permission.UI_THEME)) {
throw new LtpException("plugin.json: есть «theme», но нет права «ui.theme»");
}
theme = ThemeData.parse(root.get("theme"), "plugin.json, «theme»");
} else if (permissions.contains(Permission.UI_THEME)) {
throw new LtpException("plugin.json: право «ui.theme» требует поле «theme»");
}
// a plugin that only brings a theme has no rules
List<Object> raw = root.get("rules") == null && theme != null ? new ArrayList<Object>()
: Fields.list(root.get("rules"), "plugin.json, «rules»");
if (raw.isEmpty() && theme == null) throw new LtpException("В плагине нет правил");
if (raw.size() > MAX_RULES) throw new LtpException("В плагине больше " + MAX_RULES + " правил");
List<Rule> rules = new ArrayList<Rule>();
for (int i = 0; i < raw.size(); i++) rules.add(Rule.parse(raw.get(i), i, permissions));
for (String right : permissions) {
if (right.equals(Permission.UI_THEME)) continue; // used by the "theme" part, not by a rule
boolean used = false;
for (Rule rule : rules) used = used || rule.uses(right);
if (!used) throw new LtpException("Плагин просит право «" + right + "», но не использует его");
@@ -146,7 +161,7 @@ public final class Plugin {
for (OverlaySpec spec : rule.overlays()) spec.check(known, "Правило «" + rule.title + "»");
}
return new Plugin(id, name, version, author, description, permissions, rules, sha256(bytes, files), names, hosts,
license, ai);
license, ai, theme);
}
/**

View File

@@ -317,6 +317,11 @@ public final class PluginRegistry {
return prefs(context).getBoolean("safe", false);
}
/** Puts the plugins into safe mode: none of them runs until the person leaves it. Used by the recovery mode. */
public static synchronized void enterSafeMode(Context context) {
prefs(context).edit().putBoolean("safe", true).apply();
}
public static synchronized void leaveSafeMode(Context context) {
prefs(context).edit().putBoolean("safe", false).putInt("early", 0).apply();
version++;

View File

@@ -313,6 +313,14 @@ public final class PluginScreen {
}
}
if (spec.tap.contains(OverlaySpec.TAP_ANIMATE) && play(view)) did.append("анимация ");
if (spec.tap.contains(OverlaySpec.TAP_CONFETTI)) {
Confetti.burst(host, view);
did.append("конфетти ");
}
if (spec.tap.contains(OverlaySpec.TAP_BUZZ)) {
view.performHapticFeedback(android.view.HapticFeedbackConstants.LONG_PRESS);
did.append("вибрация ");
}
if (spec.tap.contains(OverlaySpec.TAP_LIKE)) {
did.append(like() ? "лайк" : "лайк не поставлен (не главная лента)");
}

View File

@@ -0,0 +1,149 @@
package lihont.two.plugin;
import java.util.Map;
/**
* The "theme" part of a plugin: a look for the mod's screens, as data. It holds colours and a few shape numbers and nothing
* else: a theme paints, it never moves, hides or adds a control. Needs the right "ui.theme".
*
* "theme": {"name": "Закат", "page": "#2b1d3a", "card": "#3d2b52", "text": "#fbe9ff", "accent": "#ff8a5b",
* "radius": 20, "outline": 2, "shadow": 4}
*
* The same fields and limits are checked by sdk/lihont-ltp/lihont_ltp/validate.py (check_theme).
*/
public final class ThemeData {
public static final int MAX_NAME = 24;
public static final int MAX_RADIUS = 40;
public static final int MAX_OUTLINE = 6;
public static final int MAX_SHADOW = 12;
public final String name;
public final boolean dark;
public final int page;
public final int card;
public final int text;
public final int muted;
public final int accent;
public final int onAccent;
public final int line;
public final int titleFrom;
public final int titleTo;
public final int radius;
public final int outline;
public final int shadow;
public final boolean bevel;
public final boolean tickBox;
public final boolean titleBars;
private ThemeData(String name, boolean dark, int page, int card, int text, int muted, int accent, int onAccent, int line,
int titleFrom, int titleTo, int radius, int outline, int shadow, boolean bevel, boolean tickBox, boolean titleBars) {
this.name = name;
this.dark = dark;
this.page = page;
this.card = card;
this.text = text;
this.muted = muted;
this.accent = accent;
this.onAccent = onAccent;
this.line = line;
this.titleFrom = titleFrom;
this.titleTo = titleTo;
this.radius = radius;
this.outline = outline;
this.shadow = shadow;
this.bevel = bevel;
this.tickBox = tickBox;
this.titleBars = titleBars;
}
static ThemeData parse(Object node, String where) throws LtpException {
Map<String, Object> map = Fields.map(node, where);
for (String key : map.keySet()) {
if (!Fields.in(key, "name", "dark", "page", "card", "text", "muted", "accent", "on_accent", "line", "title_from",
"title_to", "radius", "outline", "shadow", "bevel", "tick_box", "title_bars")) {
throw new LtpException(where + ": нет поля «" + key + "»");
}
}
String name = Fields.string(map, "name", true, MAX_NAME, where).trim();
if (name.length() == 0) throw new LtpException(where + ": название темы не может быть пустым");
int page = colour(map, "page", true, 0, where);
int card = colour(map, "card", true, 0, where);
int text = colour(map, "text", true, 0, where);
int accent = colour(map, "accent", true, 0, where);
int muted = colour(map, "muted", false, text, where);
int onAccent = colour(map, "on_accent", false, 0xFFFFFF, where);
int line = colour(map, "line", false, text, where);
int titleFrom = colour(map, "title_from", false, accent, where);
int titleTo = colour(map, "title_to", false, accent, where);
int radius = number(map, "radius", 12, MAX_RADIUS, where);
int outline = number(map, "outline", 0, MAX_OUTLINE, where);
int shadow = number(map, "shadow", 0, MAX_SHADOW, where);
return new ThemeData(name, flag(map, "dark", where), page, card, text, muted, accent, onAccent, line, titleFrom, titleTo,
radius, outline, shadow, flag(map, "bevel", where), flag(map, "tick_box", where), flag(map, "title_bars", where));
}
/** A colour as "#rrggbb" (the # and six hex digits), returned as 0xRRGGBB. */
private static int colour(Map<String, Object> map, String key, boolean required, int fallback, String where)
throws LtpException {
Object value = map.get(key);
if (value == null) {
if (required) throw new LtpException(where + ": нет поля «" + key + "»");
return fallback;
}
String text = Fields.text(value, 7, where + ", поле «" + key + "»");
if (text.length() != 7 || text.charAt(0) != '#') {
throw new LtpException(where + ", поле «" + key + "»: цвет пишут как #rrggbb, например #2b1d3a");
}
int out = 0;
for (int i = 1; i < 7; i++) {
char ch = text.charAt(i);
int digit = Character.digit(ch, 16);
// lower case only, like the Python checker: #2b1d3a, not #2B1D3A
if (digit < 0 || (ch >= 'A' && ch <= 'F')) {
throw new LtpException(where + ", поле «" + key + "»: цвет пишут как #rrggbb, например #2b1d3a");
}
out = out * 16 + digit;
}
return out;
}
private static int number(Map<String, Object> map, String key, int fallback, int max, String where) throws LtpException {
Object value = map.get(key);
if (value == null) return fallback;
return Fields.integer(value, 0, max, where + ", поле «" + key + "»");
}
private static boolean flag(Map<String, Object> map, String key, String where) throws LtpException {
Object value = map.get(key);
if (value == null) return false;
if (!(value instanceof Boolean)) throw new LtpException(where + ", поле «" + key + "»: нужно true или false");
return (Boolean) value;
}
/** WCAG contrast of two colours in tenths (21.0 is 210), cut down not rounded, so the Java and Python checks agree. */
static int contrastTenths(int a, int b) {
double one = luminance(a) + 0.05;
double two = luminance(b) + 0.05;
double ratio = one > two ? one / two : two / one;
return (int) (ratio * 10);
}
private static double luminance(int rgb) {
return 0.2126 * linear((rgb >> 16) & 0xFF) + 0.7152 * linear((rgb >> 8) & 0xFF) + 0.0722 * linear(rgb & 0xFF);
}
private static double linear(int channel) {
double c = channel / 255.0;
return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
}
/** The contrast of the text on a card in tenths. */
public int textContrast() {
return contrastTenths(text, card);
}
/** The contrast of the text on an accent (buttons, title bars) in tenths. */
public int accentContrast() {
return contrastTenths(onAccent, accent);
}
}

View File

@@ -218,7 +218,7 @@ final class ProfilePanel {
if (view.getBackground() instanceof Tone || (host != null && host.getBackground() instanceof Tone)) return;
boolean action = host != null && saturated(host.getBackground());
View target = host != null ? host : view;
target.setBackground(new Tone(action ? palette.primary : palette.secondaryContainer, Md3.SHAPE_FULL * density));
target.setBackground(new Tone(activity, action ? palette.primary : palette.secondaryContainer, Md3.SHAPE_FULL * density));
inkAll(view, action ? palette.onPrimary : palette.onSecondaryContainer);
note("pill " + describe(view) + (action ? " action" : " tonal") + " on " + describe(target));
}
@@ -267,7 +267,7 @@ final class ProfilePanel {
Drawable background = button.getBackground();
if (background instanceof Tone) return;
boolean filled = isFilled(background);
button.setBackground(new Tone(filled ? palette.primary : palette.secondaryContainer, Md3.SHAPE_FULL * density));
button.setBackground(new Tone(activity, filled ? palette.primary : palette.secondaryContainer, Md3.SHAPE_FULL * density));
ink(button, filled ? palette.onPrimary : palette.onSecondaryContainer);
note("button " + describe(button) + (filled ? " filled" : " tonal"));
}
@@ -325,7 +325,7 @@ final class ProfilePanel {
if (!(row.getBackground() instanceof InsetDrawable)) {
int side = (int) (12 * density);
int gap = (int) (6 * density);
row.setBackground(new InsetDrawable(new Tone(palette.surfaceContainer, CARD_RADIUS_DP * density),
row.setBackground(new InsetDrawable(new Tone(activity, palette.surfaceContainer, CARD_RADIUS_DP * density),
side, gap, side, gap));
}
ink(text, palette.onSurface);

View File

@@ -1,11 +1,20 @@
package lihont.two.profile;
import android.content.Context;
import android.graphics.drawable.GradientDrawable;
import lihont.two.settings.ThemeEngine;
/** A rounded tonal fill of the profile skin; the type tells the skin which backgrounds are its own. */
final class Tone extends GradientDrawable {
Tone(int color, float radiusPx) {
Tone(Context context, int color, float radiusPx) {
setColor(color);
setCornerRadius(radiusPx);
if (ThemeEngine.square(context)) {
// a square theme: no rounding, a thin edge so the fill reads as a panel
setCornerRadius(0f);
setStroke(Math.max(1, Math.round(context.getResources().getDisplayMetrics().density)), ThemeEngine.edge(context));
} else {
setCornerRadius(radiusPx);
}
}
}

View File

@@ -0,0 +1,63 @@
package lihont.two.settings;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
/**
* The two-line 3D edge of Windows 95: a face with a light edge on the top and left and a dark one on the bottom and right
* (raised, like a button or a window), or the other way round (sunken, like a field or a tick box).
*/
final class BevelDrawable extends Drawable {
private final Paint paint = new Paint();
private final int face;
private final boolean raised;
private final int edge;
BevelDrawable(int face, boolean raised, int edgePx) {
this.face = face;
this.raised = raised;
this.edge = Math.max(1, edgePx);
}
@Override public void draw(Canvas canvas) {
Rect b = getBounds();
int white = Color.WHITE;
int light = Color.rgb(223, 223, 223);
int grey = Color.rgb(128, 128, 128);
int black = Color.BLACK;
paint.setStyle(Paint.Style.FILL);
paint.setColor(face);
canvas.drawRect(b, paint);
// outer ring, then the inner ring one edge in; raised: light top-left and dark bottom-right, sunken: the reverse
ring(canvas, b.left, b.top, b.right, b.bottom, raised ? white : grey, raised ? black : white);
ring(canvas, b.left + edge, b.top + edge, b.right - edge, b.bottom - edge,
raised ? light : black, raised ? grey : light);
}
private void ring(Canvas canvas, int left, int top, int right, int bottom, int topLeft, int bottomRight) {
paint.setColor(topLeft);
canvas.drawRect(left, top, right - edge, top + edge, paint);
canvas.drawRect(left, top, left + edge, bottom - edge, paint);
paint.setColor(bottomRight);
canvas.drawRect(left + edge, bottom - edge, right, bottom, paint);
canvas.drawRect(right - edge, top + edge, right, bottom, paint);
}
@Override public void setAlpha(int alpha) {}
@Override public void setColorFilter(ColorFilter filter) {}
@Override public int getOpacity() {
return PixelFormat.OPAQUE;
}
@Override public boolean getPadding(Rect padding) {
padding.set(edge * 2, edge * 2, edge * 2, edge * 2);
return true;
}
}

View File

@@ -46,13 +46,14 @@ import java.util.Locale;
/** Material 3 settings screen for LihonT 2. */
public final class LihonTSettingsActivity extends Activity {
private static final String VERSION_LINE = "LihonT 2.0 · Luna";
private static final String VERSION_LINE = "LihonT 2.0 · Serena alpha";
private static final String BASE_LINE = "База TikTok 47.1.3";
private static final String CHANNEL_URL = "https://t.me/lihont";
private static final String SOURCE_URL = "https://git.lihont.space/lihont/LihonT";
private static final String LICENSE_URL = SOURCE_URL + "/src/branch/main/LICENSE";
private static final String CHANGES =
"• Призрак (раздел «Приватность»): истории без отметки о просмотре и чаты без «прочитано». Переключатели выключены, пока вы их не включите.\n"
"• Serena alpha: оформление на выбор (Material 3, Стикеры или обычный TikTok) в настройках мода.\n"
+ "• Призрак (раздел «Приватность»): истории без отметки о просмотре и чаты без «прочитано». Переключатели выключены, пока вы их не включите.\n"
+ "• Несколько фото в одном комментарии (до 9), если это даёт сервер для вашего аккаунта.\n"
+ "• Плагины .ltp: правила для ленты, имён и картинок без кода. Права вы одобряете сами, плагины включаются на каждый аккаунт отдельно, есть журнал, откат версии и защитник, который говорит простыми словами, что делает плагин.\n"
+ "• Плагин может скачивать картинки и звуки с названных сайтов, но только когда вы включили ему интернет и подтвердили адрес. У плагина видны лицензия и ИИ, которые назвал автор.\n"
@@ -190,6 +191,8 @@ public final class LihonTSettingsActivity extends Activity {
Md3.flowerIconAvatar(this, palette.primaryContainer, Md3Icon.BOTTOM_BAR, palette.onPrimaryContainer, 8),
settings.md3(), TOGGLE_MD3));
cardFunc.addView(Md3.cardDivider(this, palette));
cardFunc.addView(styleRow());
cardFunc.addView(Md3.cardDivider(this, palette));
cardFunc.addView(switchRow("Скачивание без водяного знака", "Сохранённые видео без логотипа TikTok",
Md3.flowerIconAvatar(this, palette.primaryContainer, Md3Icon.DOWNLOAD, palette.onPrimaryContainer, 8),
settings.noWatermark(), TOGGLE_NO_WATERMARK));
@@ -205,6 +208,10 @@ public final class LihonTSettingsActivity extends Activity {
cardPrivacy.addView(ghostMessagesRow());
addSection("Приватность", cardPrivacy, false);
LinearLayout cardDebug = Md3.card(this, palette);
cardDebug.addView(debugRow());
addSection("Восстановление", cardDebug, false);
LinearLayout cardChat = Md3.card(this, palette);
cardChat.addView(bubblesSwitchRow());
cardChat.addView(Md3.cardDivider(this, palette));
@@ -390,6 +397,90 @@ public final class LihonTSettingsActivity extends Activity {
return row;
}
/** DEBUG: the way back from a broken look or plugin, through Android's "Clear cache" of the app (see DebugMode). */
private View debugRow() {
Md3Switch toggle = new Md3Switch(this, palette);
toggle.setContentDescription("Режим DEBUG");
toggle.setChecked(lihont.two.look.DebugMode.enabled(this), false);
toggle.setOnCheckedChangeListener((view, value) -> {
lihont.two.look.DebugMode.set(this, value);
Toast.makeText(this, value
? "DEBUG включён. Очистка кэша приложения в настройках Android сбросит оформление и плагины"
: "DEBUG выключен", Toast.LENGTH_LONG).show();
});
LinearLayout row = Md3.listItem(this, palette,
Md3.flowerIconAvatar(this, palette.primaryContainer, Md3Icon.INFO, palette.onPrimaryContainer, 8),
"Режим DEBUG", "Если оформление или плагин всё сломали: включите заранее, потом очистите кэш приложения "
+ "(Настройки Android → Приложения → TikTok → Хранилище → Очистить кэш). Оформление и плагины "
+ "сбросятся, файлы плагинов останутся", toggle, true);
row.setOnClickListener(v -> toggle.toggle());
return row;
}
private String styleName() {
if (!settings.md3()) return "Обычный TikTok";
ThemeSpec theme = ThemeEngine.active(this);
return theme != null ? theme.name : "Material 3";
}
/** The look of the mod's screens: Material 3, a theme (stickers, Windows 95...) or the plain TikTok one of Serena 1.2. */
private View styleRow() {
LinearLayout row = Md3.listItem(this, palette,
Md3.flowerIconAvatar(this, palette.primaryContainer, Md3Icon.BOTTOM_BAR, palette.onPrimaryContainer, 8),
"Оформление", styleName(), Md3.chevron(this, palette), true);
row.setOnClickListener(v -> chooseStyle());
return row;
}
private void chooseStyle() {
// the two base looks first, then every theme the engine knows
final java.util.List<String> ids = new java.util.ArrayList<String>();
final java.util.List<String> names = new java.util.ArrayList<String>();
final java.util.List<String> hints = new java.util.ArrayList<String>();
ids.add("md3");
names.add("Material 3");
hints.add("Мягкие скругления и цвета вашей палитры");
for (ThemeSpec spec : ThemeSpec.BUILT_IN) {
ids.add(spec.id);
names.add(spec.name);
hints.add(spec.id.equals("win95") ? "Серые окна, объёмные кнопки, синие заголовки и галочки"
: "Толстые контуры и жёсткие тени, как наклейки");
}
for (lihont.two.plugin.PluginRegistry.Entry entry : lihont.two.plugin.PluginRegistry.entries(this)) {
if (entry.plugin == null || !entry.approved || entry.plugin.theme == null) continue;
ids.add("plugin:" + entry.id);
names.add(entry.plugin.theme.name + " (плагин)");
hints.add("Тема из плагина «" + entry.plugin.name + "», автор " + entry.plugin.author);
}
ids.add("classic");
names.add("Обычный TikTok");
hints.add("Плоский вид Serena 1.2");
final Dialog[] shown = new Dialog[1];
LinearLayout list = new LinearLayout(this);
list.setOrientation(LinearLayout.VERTICAL);
for (int i = 0; i < ids.size(); i++) {
final String id = ids.get(i);
boolean current = names.get(i).equals(styleName());
LinearLayout item = new LinearLayout(this);
item.setOrientation(LinearLayout.VERTICAL);
item.setPadding(Md3.dp(this, 12), Md3.dp(this, 12), Md3.dp(this, 12), Md3.dp(this, 12));
item.setBackground(Md3.stateLayer(this, Md3.SHAPE_EXTRA_SMALL, Md3.stateLayerColor(palette.onSurface)));
item.setClickable(true);
item.addView(Md3.text(this, names.get(i) + (current ? " ✓" : ""), Md3.BODY_LARGE, true, palette.onSurface));
item.addView(Md3.text(this, hints.get(i), Md3.BODY_MEDIUM, false, palette.onSurfaceVariant));
item.setOnClickListener(v -> {
shown[0].dismiss();
ThemeEngine.set(this, id.equals("md3") || id.equals("classic") ? null : id);
persist(settings.withMd3(!id.equals("classic")));
showRestartNotice();
});
list.addView(item);
}
ScrollView scroll = new ScrollView(this);
scroll.addView(list, new ScrollView.LayoutParams(-1, -2));
shown[0] = bubbleDialog("Оформление", scroll, null, null);
}
/** Several photos in one comment (TikTok's own picker, up to nine); a choice about the app, so it has its own store. */
private View commentPhotosRow() {
Md3Switch toggle = new Md3Switch(this, palette);
@@ -1547,6 +1638,8 @@ public final class LihonTSettingsActivity extends Activity {
deleteRecursively(ext);
}
} catch (Throwable ignored) {}
// the app's own restart is not the "Clear cache" of Android: DEBUG must survive it
lihont.two.look.DebugMode.keepMarker(this);
}
private static boolean deleteRecursively(File file) {

View File

@@ -181,6 +181,23 @@ public final class Md3 {
Color.rgb(254, 44, 85), Color.rgb(255, 255, 255),
Color.rgb(255, 225, 230), Color.rgb(120, 10, 30));
/** The palette of a theme that brings its own colours (see ThemeSpec): a few colours spread over the 26 roles. */
static Palette themed(ThemeSpec t) {
int high = Color.rgb(223, 223, 223);
return new Palette(t.dark, false,
t.accent, t.onAccent,
t.accent, t.onAccent,
t.card, t.text,
t.accent, t.onAccent,
t.card, t.text,
t.page, t.card, t.card,
t.card, t.card, high,
t.text, t.muted,
t.line, t.line,
Color.rgb(128, 0, 0), Color.WHITE,
Color.rgb(255, 200, 200), Color.rgb(128, 0, 0));
}
public static Palette dark() { return DARK; }
public static Palette light() { return LIGHT; }
@@ -262,7 +279,8 @@ public final class Md3 {
/** Resolves the scheme from the saved theme, falling back to the system night mode and dynamic Monet colors. */
public static Palette palette(Context context, ModSettings.Theme theme) {
return palette(context, theme, SettingsHost.accent(), SettingsHost.accentHue(), SettingsHost.amoled());
return ThemeEngine.palette(context,
palette(context, theme, SettingsHost.accent(), SettingsHost.accentHue(), SettingsHost.amoled()));
}
/** The scheme for an explicit accent and black-surface choice. */
@@ -284,9 +302,9 @@ public final class Md3 {
* settings of the running process and changes after a restart.
*/
public static Palette palette(Context context, ModSettings settings) {
return settings.md3()
? palette(context, settings.theme(), settings.accent(), settings.accentHue(), settings.amoled())
: classic(context, settings.theme());
if (!settings.md3()) return classic(context, settings.theme());
return ThemeEngine.palette(context,
palette(context, settings.theme(), settings.accent(), settings.accentHue(), settings.amoled()));
}
/** The primary colour of an accent, for the swatch that shows it. */
@@ -481,8 +499,22 @@ public final class Md3 {
plain.setPadding(dp(context, 20), dp(context, 20), dp(context, 20), dp(context, 10));
return plain;
}
TextView view = text(context, value, LABEL_LARGE, true, palette.primary);
view.setPadding(dp(context, 24), dp(context, 12), dp(context, 24), dp(context, 4));
ThemeSpec theme = ThemeEngine.active(context);
if (theme != null && theme.titleBars) {
// a title bar across the page, like the caption of a window
TextView bar = text(context, value, 14f, true, theme.onAccent);
bar.setBackground(ThemeEngine.titleBar(theme));
bar.setPadding(dp(context, 10), dp(context, 5), dp(context, 10), dp(context, 5));
LinearLayout.LayoutParams barParams = new LinearLayout.LayoutParams(-1, -2);
barParams.leftMargin = dp(context, 16);
barParams.rightMargin = dp(context, 16);
barParams.topMargin = dp(context, 12);
bar.setLayoutParams(barParams);
return bar;
}
boolean sticker = theme != null;
TextView view = text(context, value, sticker ? 16f : LABEL_LARGE, true, sticker ? palette.onSurface : palette.primary);
view.setPadding(dp(context, 24), dp(context, sticker ? 16 : 12), dp(context, 24), dp(context, sticker ? 8 : 4));
return view;
}
@@ -513,9 +545,17 @@ public final class Md3 {
public static LinearLayout card(Context context, Palette palette) {
LinearLayout card = new LinearLayout(context);
card.setOrientation(LinearLayout.VERTICAL);
card.setBackground(shape(palette.surfaceContainer, palette.classic ? SHAPE_SMALL : SHAPE_EXTRA_LARGE, context));
if (android.os.Build.VERSION.SDK_INT >= 21) {
card.setClipToOutline(true);
ThemeSpec theme = palette.classic ? null : ThemeEngine.active(context);
if (theme != null) {
// the active theme draws the card; a hard shadow lives inside the drawable, so the card keeps room for it
card.setBackground(ThemeEngine.card(context, theme, palette));
int room = dp(context, ThemeEngine.shadowDp(theme));
card.setPadding(0, 0, room, room);
} else {
card.setBackground(shape(palette.surfaceContainer, palette.classic ? SHAPE_SMALL : SHAPE_EXTRA_LARGE, context));
if (android.os.Build.VERSION.SDK_INT >= 21) {
card.setClipToOutline(true);
}
}
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(-1, -2);
params.leftMargin = dp(context, 16);
@@ -722,6 +762,13 @@ public final class Md3 {
button.setMinimumHeight(dp(context, 40));
button.setClickable(true);
button.setFocusable(true);
ThemeSpec theme = palette.classic ? null : ThemeEngine.active(context);
if (theme != null && theme.bevel) {
button.setBackground(new BevelDrawable(palette.surfaceContainerHigh, true, Math.max(1, dp(context, 1))));
button.setTextColor(palette.onSurface);
button.setMinimumHeight(dp(context, 30));
return button;
}
button.setBackground(stateLayer(context, SHAPE_FULL, stateLayerColor(palette.primary)));
return button;
}

View File

@@ -31,6 +31,8 @@ public final class Md3Switch extends View implements Checkable {
private final int outline;
private final int stateLayer;
private final boolean classic;
private final boolean sticker;
private final boolean tickBox;
private final float trackWidthDp;
private final float trackHeightDp;
private final float handleOffDp;
@@ -45,6 +47,9 @@ public final class Md3Switch extends View implements Checkable {
public Md3Switch(Context context, Md3.Palette palette) {
super(context);
classic = palette.classic;
ThemeSpec theme = classic ? null : ThemeEngine.active(context);
sticker = theme != null && !theme.tickBox;
tickBox = theme != null && theme.tickBox;
if (classic) {
// Serena 1.2: a 44x26dp track with a plain white 20dp handle that only changes sides
trackWidthDp = 44f;
@@ -114,11 +119,19 @@ public final class Md3Switch extends View implements Checkable {
}
@Override protected void onMeasure(int widthSpec, int heightSpec) {
if (tickBox) {
setMeasuredDimension(dp(20f) + getPaddingLeft() + getPaddingRight(), dp(20f) + getPaddingTop() + getPaddingBottom());
return;
}
setMeasuredDimension(dp(trackWidthDp) + getPaddingLeft() + getPaddingRight(),
dp(trackHeightDp) + getPaddingTop() + getPaddingBottom());
}
@Override protected void onDraw(Canvas canvas) {
if (tickBox) {
drawTickBox(canvas);
return;
}
float height = getHeight() - getPaddingTop() - getPaddingBottom();
float width = Math.min(getWidth() - getPaddingLeft() - getPaddingRight(), dp(trackWidthDp));
float left = getPaddingLeft() + (getWidth() - getPaddingLeft() - getPaddingRight() - width) / 2f;
@@ -130,7 +143,13 @@ public final class Md3Switch extends View implements Checkable {
paint.setColor(blend(trackOff, trackOn, progress));
canvas.drawRoundRect(track, radius, radius, paint);
if (!classic && progress < 1f) {
if (sticker) {
// the sticker look: a thick ink outline on the track and on the handle, on and off alike
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(Math.max(2f, dp(2f)));
paint.setColor(outline);
canvas.drawRoundRect(track, radius, radius, paint);
} else if (!classic && progress < 1f) {
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(Math.max(1f, dp(1f)));
paint.setColor(withAlpha(outline, (int) (255 * (1f - progress))));
@@ -147,6 +166,12 @@ public final class Md3Switch extends View implements Checkable {
paint.setStyle(Paint.Style.FILL);
paint.setColor(blend(handleOff, handleOn, progress));
canvas.drawCircle(handleCenter, track.centerY(), handleRadius, paint);
if (sticker) {
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(Math.max(2f, dp(2f)));
paint.setColor(outline);
canvas.drawCircle(handleCenter, track.centerY(), handleRadius, paint);
}
}
@Override protected void onDetachedFromWindow() {
@@ -154,6 +179,26 @@ public final class Md3Switch extends View implements Checkable {
super.onDetachedFromWindow();
}
/** A sunken white square with a black tick when on: the check box of Windows 95. */
private void drawTickBox(Canvas canvas) {
int size = Math.min(getWidth() - getPaddingLeft() - getPaddingRight(), getHeight() - getPaddingTop() - getPaddingBottom());
int left = getPaddingLeft() + (getWidth() - getPaddingLeft() - getPaddingRight() - size) / 2;
int top = getPaddingTop() + (getHeight() - getPaddingTop() - getPaddingBottom() - size) / 2;
BevelDrawable box = new BevelDrawable(android.graphics.Color.WHITE, false, Math.max(1, dp(1f)));
box.setBounds(left, top, left + size, top + size);
box.draw(canvas);
if (progress > 0.5f) {
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(Math.max(2f, dp(2f)));
paint.setStrokeCap(Paint.Cap.SQUARE);
paint.setColor(android.graphics.Color.BLACK);
float u = size / 10f;
canvas.drawLine(left + 2.5f * u, top + 5f * u, left + 4.2f * u, top + 7f * u, paint);
canvas.drawLine(left + 4.2f * u, top + 7f * u, left + 7.8f * u, top + 2.8f * u, paint);
paint.setStrokeCap(Paint.Cap.BUTT);
}
}
private int dp(float value) { return Md3.dp(getContext(), value); }
private static int blend(int from, int to, float amount) {
@@ -173,4 +218,4 @@ public final class Md3Switch extends View implements Checkable {
android.graphics.Color.blue(color));
}
}

View File

@@ -121,7 +121,7 @@ final class PluginSettings {
PluginRegistry.setEnabled(activity, entry.id, uid, value);
rebuild.run();
});
String detail = "v" + entry.plugin.version + " · " + entry.plugin.author + " · правил: " + entry.plugin.rules.size()
String detail = "v" + entry.plugin.version + " · " + entry.plugin.author + " · " + (entry.plugin.rules.isEmpty() && entry.plugin.theme != null ? "тема оформления" : "правил: " + entry.plugin.rules.size())
+ (entry.approved ? "" : " · изменён, нужна проверка")
+ (entry.approved ? accountsNote(entry) : "");
LinearLayout row = Md3.listItem(activity, palette, avatar(letter), entry.plugin.name, detail, toggle, true);

View File

@@ -0,0 +1,122 @@
package lihont.two.settings;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
/**
* Which theme is on and how a theme draws the parts of the settings: cards, title bars, buttons and tick boxes.
*
* The choice is stored on its own (a choice about the look, not part of the settings model) and read each time a screen is
* built. A theme paints; it never moves, hides or adds a control.
*/
public final class ThemeEngine {
private static final String PREFS = "lihont_style";
private static final String KEY = "theme";
private static final String LEGACY_STICKER = "sticker";
private ThemeEngine() {}
/** The theme that is on, or null for the base look (Material 3, or plain TikTok when Material 3 is off). */
static ThemeSpec active(Context context) {
try {
android.content.SharedPreferences prefs = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE);
String id = prefs.getString(KEY, null);
if (id == null && prefs.getBoolean(LEGACY_STICKER, false)) id = "sticker";
if (id == null) return null;
return id.startsWith("plugin:") ? pluginTheme(context, id.substring(7)) : ThemeSpec.byId(id);
} catch (RuntimeException unreadable) {
return null;
}
}
private static String cachedId;
private static int cachedVersion = -1;
private static ThemeSpec cachedSpec;
/** The theme of an installed and approved plugin; null when the plugin is gone, unreadable or has no theme. */
private static synchronized ThemeSpec pluginTheme(Context context, String pluginId) {
int version = lihont.two.plugin.PluginRegistry.version();
if (pluginId.equals(cachedId) && version == cachedVersion) return cachedSpec;
ThemeSpec spec = null;
lihont.two.plugin.PluginRegistry.Entry entry = lihont.two.plugin.PluginRegistry.find(context, pluginId);
if (entry != null && entry.plugin != null && entry.approved && entry.plugin.theme != null) {
spec = ThemeSpec.fromPlugin(pluginId, entry.plugin.theme);
}
cachedId = pluginId;
cachedVersion = version;
cachedSpec = spec;
return spec;
}
/** @param id a theme id, or null for the base look */
static void set(Context context, String id) {
android.content.SharedPreferences.Editor edit = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).edit();
edit.remove(LEGACY_STICKER);
if (id == null) edit.remove(KEY);
else edit.putString(KEY, id);
edit.apply();
}
/** Back to the base look: no theme. Public for the recovery mode (DebugMode). */
public static void reset(Context context) {
set(context, null);
}
/** True when the active theme draws square corners (Windows 95): skins elsewhere in TikTok then drop their rounding. */
public static boolean square(Context context) {
ThemeSpec spec = active(context);
return spec != null && spec.ownColors && spec.radiusDp <= 0f;
}
/** The colour of a thin edge line for a square theme, drawn around tonal fills so they read as panels. */
public static int edge(Context context) {
ThemeSpec spec = active(context);
return spec != null && spec.ownColors ? spec.line : 0;
}
/** The palette for the active theme when it brings its own colours; otherwise the palette that was passed in. */
static Md3.Palette palette(Context context, Md3.Palette base) {
ThemeSpec spec = active(context);
if (spec == null || !spec.ownColors) return base;
Md3.Palette built = spec.palette;
if (built == null) {
built = Md3.themed(spec);
spec.palette = built;
}
return built;
}
// ---- drawing -----------------------------------------------------------
/** A card: a raised bevel, or a face with an ink outline and a hard shadow, depending on the theme. */
static Drawable card(Context context, ThemeSpec spec, Md3.Palette palette) {
if (spec.bevel) return new BevelDrawable(palette.surfaceContainerHigh, true, Math.max(1, Md3.dp(context, 1)));
int ink = palette.onSurface;
int shadowColor = palette.dark ? Color.BLACK : ink;
int offset = Md3.dp(context, spec.shadowDp);
GradientDrawable face = spec.outlineDp > 0f
? Md3.outlined(palette.surfaceContainerHigh, ink, spec.outlineDp, spec.radiusDp, context)
: Md3.shape(palette.surfaceContainerHigh, spec.radiusDp, context);
if (offset <= 0) return face;
GradientDrawable shadow = Md3.shape(shadowColor, spec.radiusDp, context);
LayerDrawable layers = new LayerDrawable(new Drawable[] {shadow, face});
layers.setLayerInset(0, offset, offset, 0, 0);
layers.setLayerInset(1, 0, 0, offset, offset);
return layers;
}
/** The room a card keeps on its right and bottom for the shadow, in dp. */
static int shadowDp(ThemeSpec spec) {
return spec.bevel ? 0 : spec.shadowDp;
}
/** A title bar: a colour that runs from left to right, with square corners. */
static Drawable titleBar(ThemeSpec spec) {
GradientDrawable bar = new GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT,
new int[] {spec.titleFrom, spec.titleTo});
return bar;
}
}

View File

@@ -0,0 +1,93 @@
package lihont.two.settings;
import android.graphics.Color;
/**
* A look for the mod's screens, described as plain data: colours, how corners and lines are drawn, how a switch looks.
*
* A theme paints and never changes what is on the screen: it cannot move, hide or add a control, so a theme can make the
* settings ugly but never unusable or dangerous. Built-in themes live here; a theme file in a plugin will fill the same
* fields.
*/
final class ThemeSpec {
final String id;
final String name;
/** True when the theme brings its own colours; false when it keeps the colours of the Material 3 palette. */
final boolean ownColors;
final boolean dark;
final int page;
final int card;
final int text;
final int muted;
final int accent;
final int onAccent;
final int line;
final int titleFrom;
final int titleTo;
final float radiusDp;
/** Width of the ink outline of a card, in dp; 0 for none. */
final float outlineDp;
/** Offset of the hard shadow behind a card, in dp; 0 for none. */
final int shadowDp;
/** Draw raised and sunken 3D edges (the look of Windows 95) instead of flat outlines. */
final boolean bevel;
/** A switch is drawn as a square tick box instead of a pill. */
final boolean tickBox;
/** Section headers and the top bar are drawn as a coloured title bar with light text. */
final boolean titleBars;
/** The Material 3 palette made from this theme, built the first time it is asked for and then reused. */
Md3.Palette palette;
private ThemeSpec(String id, String name, boolean ownColors, boolean dark, int page, int card, int text, int muted,
int accent, int onAccent, int line, int titleFrom, int titleTo, float radiusDp, float outlineDp, int shadowDp,
boolean bevel, boolean tickBox, boolean titleBars) {
this.id = id;
this.name = name;
this.ownColors = ownColors;
this.dark = dark;
this.page = page;
this.card = card;
this.text = text;
this.muted = muted;
this.accent = accent;
this.onAccent = onAccent;
this.line = line;
this.titleFrom = titleFrom;
this.titleTo = titleTo;
this.radiusDp = radiusDp;
this.outlineDp = outlineDp;
this.shadowDp = shadowDp;
this.bevel = bevel;
this.tickBox = tickBox;
this.titleBars = titleBars;
}
/** Thick outlines and hard shadows on the colours of the current Material 3 palette. */
static final ThemeSpec STICKER = new ThemeSpec("sticker", "Стикеры", false, false, 0, 0, 0, 0, 0, 0, 0, 0, 0,
22f, 2.5f, 5, false, false, false);
/** Grey windows on a teal desktop, raised and sunken edges, navy title bars and tick boxes. */
static final ThemeSpec WIN95 = new ThemeSpec("win95", "Windows 95", true, false,
Color.rgb(0, 128, 128), Color.rgb(192, 192, 192), Color.BLACK, Color.rgb(64, 64, 64),
Color.rgb(0, 0, 128), Color.WHITE, Color.rgb(128, 128, 128), Color.rgb(0, 0, 128), Color.rgb(16, 132, 208),
0f, 0f, 0, true, true, true);
static final ThemeSpec[] BUILT_IN = {STICKER, WIN95};
/** The theme a plugin brings (right ui.theme): the same fields, read from its checked plugin.json. */
static ThemeSpec fromPlugin(String pluginId, lihont.two.plugin.ThemeData data) {
return new ThemeSpec("plugin:" + pluginId, data.name + " (плагин)", true, data.dark,
0xFF000000 | data.page, 0xFF000000 | data.card, 0xFF000000 | data.text, 0xFF000000 | data.muted,
0xFF000000 | data.accent, 0xFF000000 | data.onAccent, 0xFF000000 | data.line,
0xFF000000 | data.titleFrom, 0xFF000000 | data.titleTo,
data.radius, data.outline, data.shadow, data.bevel, data.tickBox, data.titleBars);
}
/** The built-in theme with this id, or null (Material 3 and plain TikTok are not themes: they are the two base looks). */
static ThemeSpec byId(String id) {
for (ThemeSpec spec : BUILT_IN) {
if (spec.id.equals(id)) return spec;
}
return null;
}
}

View File

@@ -0,0 +1,10 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 450" width="800" height="450" role="img" aria-label="Как создать свой плагин для LihonT за четыре шага">
<rect width="800" height="450" rx="28" fill="#1E1B16"/>
<text x="400" y="52" text-anchor="middle" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="0"> </text>
<text x="40" y="52" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="22" font-weight="700" fill="#F0BF6D">Свой плагин для LihonT</text>
<circle cx="370" cy="46" r="7" fill="#4E4840"><animate attributeName="fill" values="#4E4840;#4E4840;#F0BF6D;#4E4840;#4E4840" keyTimes="0;0.0000;0.0006;0.2500;1" dur="16s" repeatCount="indefinite"/></circle><circle cx="390" cy="46" r="7" fill="#4E4840"><animate attributeName="fill" values="#4E4840;#4E4840;#F0BF6D;#4E4840;#4E4840" keyTimes="0;0.2500;0.2506;0.5000;1" dur="16s" repeatCount="indefinite"/></circle><circle cx="410" cy="46" r="7" fill="#4E4840"><animate attributeName="fill" values="#4E4840;#4E4840;#F0BF6D;#4E4840;#4E4840" keyTimes="0;0.5000;0.5006;0.7500;1" dur="16s" repeatCount="indefinite"/></circle><circle cx="430" cy="46" r="7" fill="#4E4840"><animate attributeName="fill" values="#4E4840;#4E4840;#F0BF6D;#4E4840;#4E4840" keyTimes="0;0.7500;0.7506;1.0000;1" dur="16s" repeatCount="indefinite"/></circle>
<g opacity="0"><animate attributeName="opacity" values="0;0;1;1;0;0" keyTimes="0.0000;0.0000;0.0250;0.2250;0.2500;1.0000" dur="16s" repeatCount="indefinite"/><rect x="80" y="86" width="640" height="236" rx="18" fill="#2B2620" stroke="#4E4840" stroke-width="2"/><circle cx="108" cy="108" r="6" fill="#FF6B6B"/><circle cx="130" cy="108" r="6" fill="#F0BF6D"/><circle cx="152" cy="108" r="6" fill="#9ED69A"/><text x="400" y="113" text-anchor="middle" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="14" fill="#9A9084">night.py</text><clipPath id="ca0"><rect x="110" y="142" width="0" height="30"><animate attributeName="width" values="0;0;560;560;0" keyTimes="0;0.0312;0.0750;0.9875;1" dur="16s" repeatCount="indefinite"/></rect></clipPath><text x="112" y="164" font-family="ui-monospace, Consolas, 'Courier New', monospace" font-size="17" fill="#FFB27A" clip-path="url(#ca0)" xml:space="preserve">from lihont_ltp import *</text><clipPath id="ca1"><rect x="110" y="178" width="0" height="30"><animate attributeName="width" values="0;0;560;560;0" keyTimes="0;0.0750;0.1187;0.9875;1" dur="16s" repeatCount="indefinite"/></rect></clipPath><text x="112" y="200" font-family="ui-monospace, Consolas, 'Courier New', monospace" font-size="17" fill="#EAE1D9" clip-path="url(#ca1)" xml:space="preserve">plugin = Plugin("Тихая ночь", author="Вася")</text><clipPath id="ca2"><rect x="110" y="214" width="0" height="30"><animate attributeName="width" values="0;0;560;560;0" keyTimes="0;0.1375;0.1875;0.9875;1" dur="16s" repeatCount="indefinite"/></rect></clipPath><text x="112" y="236" font-family="ui-monospace, Consolas, 'Courier New', monospace" font-size="17" fill="#EAE1D9" clip-path="url(#ca2)" xml:space="preserve">plugin.video(night &amp; hashtag("fyp"), hide)</text><clipPath id="ca3"><rect x="110" y="250" width="0" height="30"><animate attributeName="width" values="0;0;560;560;0" keyTimes="0;0.1875;0.2313;0.9875;1" dur="16s" repeatCount="indefinite"/></rect></clipPath><text x="112" y="272" font-family="ui-monospace, Consolas, 'Courier New', monospace" font-size="17" fill="#9ED69A" clip-path="url(#ca3)" xml:space="preserve">plugin.save()</text><text x="400" y="395" text-anchor="middle" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="26" font-weight="600" fill="#EAE1D9">1. Напиши правило, как предложение</text><text x="400" y="423" text-anchor="middle" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="16" fill="#9A9084">Видео с #fyp ночью скрыть: три строки на Python</text></g>
<g opacity="0"><animate attributeName="opacity" values="0;0;1;1;0;0" keyTimes="0.0000;0.2500;0.2750;0.4750;0.5000;1.0000" dur="16s" repeatCount="indefinite"/><rect x="80" y="86" width="640" height="236" rx="18" fill="#17140F" stroke="#4E4840" stroke-width="2"/><clipPath id="cb0"><rect x="108" y="108" width="0" height="30"><animate attributeName="width" values="0;0;400;400;0" keyTimes="0;0.2750;0.3250;0.9875;1" dur="16s" repeatCount="indefinite"/></rect></clipPath><text x="110" y="130" font-family="ui-monospace, Consolas, 'Courier New', monospace" font-size="17" fill="#EAE1D9" clip-path="url(#cb0)" xml:space="preserve">$ python night.py</text><text x="110" y="170" font-family="ui-monospace, Consolas, 'Courier New', monospace" font-size="16" fill="#F0BF6D" opacity="0" xml:space="preserve">Защитник: Обратите внимание<animate attributeName="opacity" values="0;0;1;1" keyTimes="0;0.3438;0.3444;1" dur="16s" repeatCount="indefinite"/></text><text x="110" y="200" font-family="ui-monospace, Consolas, 'Courier New', monospace" font-size="16" fill="#9A9084" opacity="0" xml:space="preserve">• Скрывает видео из ленты по условиям правил<animate attributeName="opacity" values="0;0;1;1" keyTimes="0;0.3688;0.3694;1" dur="16s" repeatCount="indefinite"/></text><text x="110" y="230" font-family="ui-monospace, Consolas, 'Courier New', monospace" font-size="16" fill="#9A9084" opacity="0" xml:space="preserve">Плагин не может: читать сообщения и пароли, запускать код.<animate attributeName="opacity" values="0;0;1;1" keyTimes="0;0.3937;0.3944;1" dur="16s" repeatCount="indefinite"/></text><text x="110" y="272" font-family="ui-monospace, Consolas, 'Courier New', monospace" font-size="16" fill="#9ED69A" opacity="0" xml:space="preserve">Готово: vasya.tihaya-noch.ltp<animate attributeName="opacity" values="0;0;1;1" keyTimes="0;0.4250;0.4256;1" dur="16s" repeatCount="indefinite"/></text><g transform="translate(640 250)" opacity="0"><animate attributeName="opacity" values="0;0;1;1" keyTimes="0;0.4375;0.4500;1" dur="16s" repeatCount="indefinite"/><rect x="-26" y="-34" width="52" height="68" rx="8" fill="#F0BF6D"/><text x="0" y="8" text-anchor="middle" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="16" font-weight="700" fill="#2B2620">.ltp</text></g><text x="400" y="395" text-anchor="middle" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="26" font-weight="600" fill="#EAE1D9">2. Запусти: защитник покажет всё</text><text x="400" y="423" text-anchor="middle" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="16" fill="#9A9084">Что делает каждое правило и насколько ему можно доверять</text></g>
<g opacity="0"><animate attributeName="opacity" values="0;0;1;1;0;0" keyTimes="0.0000;0.5000;0.5250;0.7250;0.7500;1.0000" dur="16s" repeatCount="indefinite"/><rect x="90" y="150" width="230" height="140" rx="12" fill="#2B2620" stroke="#4E4840" stroke-width="2"/><rect x="70" y="296" width="270" height="12" rx="6" fill="#4E4840"/><text x="205" y="212" text-anchor="middle" font-family="ui-monospace, Consolas, 'Courier New', monospace" font-size="15" fill="#EAE1D9">ltp phone</text><text x="205" y="238" text-anchor="middle" font-family="ui-monospace, Consolas, 'Courier New', monospace" font-size="13" fill="#F0BF6D">vasya.tihaya-noch.ltp</text><path d="M320 220 C 400 220 430 220 500 220" stroke="#4E4840" stroke-width="4" fill="none" stroke-dasharray="6 6"/><rect x="500" y="110" width="130" height="236" rx="22" fill="#2B2620" stroke="#4E4840" stroke-width="3"/><rect x="515" y="130" width="100" height="196" rx="10" fill="#17140F"/><text x="565" y="236" text-anchor="middle" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="13" fill="#9A9084">Download/ltp</text><g><rect x="-14" y="-18" width="28" height="36" rx="5" fill="#F0BF6D"/><animateMotion dur="16s" repeatCount="indefinite" keyPoints="0;0;1;1" keyTimes="0;0.5375;0.6500;1" calcMode="linear" path="M330 220 L 540 220"/></g><text x="400" y="395" text-anchor="middle" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="26" font-weight="600" fill="#EAE1D9">3. Отправь на телефон по проводу</text><text x="400" y="423" text-anchor="middle" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="16" fill="#9A9084">Команда ltp phone кладёт файл в Download/ltp</text></g>
<g opacity="0"><animate attributeName="opacity" values="0;0;1;1;0;0" keyTimes="0.0000;0.7500;0.7750;0.9750;1.0000;1.0000" dur="16s" repeatCount="indefinite"/><rect x="250" y="60" width="300" height="320" rx="30" fill="#2B2620" stroke="#4E4840" stroke-width="3"/><rect x="272" y="150" width="256" height="150" rx="20" fill="#3A342C"/><text x="288" y="182" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="16" font-weight="700" fill="#EAE1D9">Установить «Тихая ночь»?</text><text x="288" y="208" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="12" fill="#F0BF6D">Защитник: Обратите внимание</text><text x="288" y="228" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="12" fill="#9A9084">Права: скрывать видео по правилам</text><text x="410" y="284" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="14" fill="#9A9084">Отмена</text><g><rect x="468" y="266" width="52" height="26" rx="13" fill="#F0BF6D"/><text x="494" y="284" text-anchor="middle" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="13" font-weight="700" fill="#2B2620">Ставь</text><animate attributeName="opacity" values="1;1;0.55;1;1" keyTimes="0;0.8438;0.8625;0.8812;1" dur="16s" repeatCount="indefinite"/></g><g opacity="0"><animate attributeName="opacity" values="0;0;1;1" keyTimes="0;0.9000;0.9125;1" dur="16s" repeatCount="indefinite"/><rect x="276" y="330" width="248" height="34" rx="17" fill="#9ED69A"/><text x="400" y="352" text-anchor="middle" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="14" font-weight="700" fill="#2B2620">Плагин включён ✓</text></g><text x="400" y="395" text-anchor="middle" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="26" font-weight="600" fill="#EAE1D9">4. Установи и включи</text><text x="400" y="423" text-anchor="middle" font-family="system-ui, 'Segoe UI', Roboto, sans-serif" font-size="16" fill="#9A9084">Перед установкой видно права, правила и вердикт защитника</text></g>
</svg>

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -4,376 +4,419 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="light dark">
<meta name="theme-color" content="#fef7ff" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#141218" media="(prefers-color-scheme: dark)">
<meta name="description" content="LihonT — TikTok в стиле Material Design 3. Скачивание без водяных знаков, выбор любого региона, отдельные скруглённые карточки настроек и значок сообщества.">
<meta property="og:title" content="LihonT — TikTok в стиле Material 3">
<meta property="og:description" content="LihonT 2.0: палитра Monet, цветочки Material You, любые регионы и свобода от ограничений.">
<meta name="theme-color" content="#fff4e0" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#1c1626" media="(prefers-color-scheme: dark)">
<meta name="description" content="LihonT 2 Luna: TikTok в стиле Material 3. Режим призрака, свои пузыри в чате, до 9 фото в комментарии, плагины, виджет огонька, форма аватарок. Открытый код.">
<meta property="og:title" content="LihonT 2 · Luna">
<meta property="og:description" content="Призрак, свои пузыри, плагины, огоньки-виджеты. TikTok в стиле Material 3, открытый код.">
<meta property="og:type" content="website">
<meta property="og:image" content="https://lihont.space/logo_single_note.svg">
<title>LihonT — TikTok в стиле Material 3</title>
<title>LihonT 2 · Luna: TikTok в стиле Material 3</title>
<link rel="icon" type="image/svg+xml" href="/logo_single_note.svg">
<script>
/* Apply a saved theme before first paint, so there is no flash. */
/* A saved theme is applied before the first paint, so there is no flash. */
try { var t = localStorage.getItem("lihont-theme"); if (t === "light" || t === "dark") document.documentElement.setAttribute("data-theme", t); } catch (e) {}
</script>
<link rel="stylesheet" href="/assets/site/md3.css">
<script src="/assets/site/md3.js" defer></script>
<style>
:root {
--bg: #fff4e0; --ink: #221c2e; --card: #ffffff; --muted: #5b5368; --dots: rgba(34,28,46,.13);
--coral: #ff6b6b; --yellow: #ffcd3c; --mint: #5ed6aa; --violet: #9670ff; --sky: #5ab4ff; --pink: #ff96c8;
--shadow: #221c2e; --on-accent: #221c2e;
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--bg: #1c1626; --ink: #f6efe4; --card: #2b2338; --muted: #b9afc9; --dots: rgba(246,239,228,.1);
--shadow: #0b0810; --on-accent: #221c2e;
}
}
:root[data-theme="dark"] {
--bg: #1c1626; --ink: #f6efe4; --card: #2b2338; --muted: #b9afc9; --dots: rgba(246,239,228,.1);
--shadow: #0b0810; --on-accent: #221c2e;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
margin: 0; background: var(--bg); color: var(--ink);
font-family: "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; font-size: 17px; line-height: 1.55;
background-image: radial-gradient(var(--dots) 2.5px, transparent 2.6px); background-size: 40px 40px;
animation: drift 40s linear infinite; overflow-x: hidden;
}
@keyframes drift { to { background-position: 400px 240px; } }
a { color: inherit; }
.page { width: min(1120px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--yellow); color: var(--on-accent); padding: 8px 14px; border-radius: 12px; z-index: 99; }
.skip:focus { left: 8px; }
h1, h2, h3 { line-height: 1.08; margin: 0; font-weight: 900; letter-spacing: -.02em; }
p { margin: 0; }
code, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
/* stickers: a thick outline and a hard shadow */
.sticker { background: var(--card); border: 3px solid var(--ink); border-radius: 28px; box-shadow: 7px 7px 0 var(--shadow); }
.btn {
display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 10px 22px;
border: 3px solid var(--ink); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-weight: 800;
text-decoration: none; cursor: pointer; box-shadow: 5px 5px 0 var(--shadow); transition: transform .12s, box-shadow .12s;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--shadow); }
.btn:active { transform: translate(4px, 4px); box-shadow: 1px 1px 0 var(--shadow); }
.btn--yellow { background: var(--yellow); color: var(--on-accent); }
.btn--mint { background: var(--mint); color: var(--on-accent); }
.btn--lg { min-height: 60px; padding: 14px 30px; font-size: 1.15rem; }
.btn--flat { box-shadow: none; border-width: 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--card); font-weight: 800; font-size: .9rem; }
.chip--y { background: var(--yellow); color: var(--on-accent); } .chip--m { background: var(--mint); color: var(--on-accent); }
.chip--p { background: var(--pink); color: var(--on-accent); } .chip--v { background: var(--violet); color: #fff; } .chip--s { background: var(--sky); color: var(--on-accent); }
.muted { color: var(--muted); }
.cluster { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
/* top bar */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 3px solid var(--ink); }
.top__in { display: flex; align-items: center; gap: 16px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 900; font-size: 1.35rem; }
.brand img { width: 36px; height: 36px; animation: sway 5s ease-in-out infinite; }
.brand b { color: var(--coral); }
@keyframes sway { 50% { transform: rotate(10deg) scale(1.06); } }
.nav { display: none; gap: 4px; margin-left: auto; }
.nav a { padding: 8px 14px; border-radius: 999px; font-weight: 800; text-decoration: none; }
.nav a:hover, .nav a.on { background: var(--yellow); color: var(--on-accent); }
.top__end { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.nav + .top__end { margin-left: 0; }
.icon-btn { width: 46px; height: 46px; padding: 0; min-height: 0; }
@media (min-width: 980px) { .nav { display: flex; } .menu-btn { display: none; } }
.drawer { position: fixed; inset: 68px 0 auto 0; z-index: 19; display: none; padding: 16px; background: var(--bg); border-bottom: 3px solid var(--ink); }
.drawer.open { display: grid; gap: 6px; }
.drawer a { padding: 12px 16px; border-radius: 16px; font-weight: 800; text-decoration: none; border: 2.5px solid transparent; }
.drawer a:hover { border-color: var(--ink); background: var(--yellow); color: var(--on-accent); }
/* hero */
.hero { padding: 48px 0 28px; display: grid; gap: 40px; align-items: center; }
@media (min-width: 900px) { .hero { grid-template-columns: 1.1fr .9fr; padding-top: 72px; } }
.hero h1 { font-size: clamp(2.6rem, 8.5vw, 5.4rem); }
.hero h1 em { font-style: normal; background: var(--yellow); color: var(--on-accent); padding: 0 .18em; border-radius: .25em; display: inline-block; transform: rotate(-2deg); border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--shadow); }
.hero p.lead { font-size: 1.2rem; margin: 22px 0 28px; max-width: 54ch; }
.hero .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.stage { position: relative; min-height: 460px; }
.stage .bubble { position: absolute; padding: 14px 20px; border: 3px solid var(--ink); border-radius: 26px; font-weight: 800; box-shadow: 5px 5px 0 var(--shadow); max-width: 78%; animation: float 5s ease-in-out infinite; }
.b1 { top: 10px; left: 0; background: linear-gradient(120deg, #3d3bbd, #1c1370); color: #fff; }
.b2 { top: 108px; right: 0; background: linear-gradient(120deg, #aa50dc, #5a1e8c); color: #fff; animation-delay: -1.5s !important; }
.b3 { top: 210px; left: 12px; background: linear-gradient(120deg, #ffe2b0, #ffbec8); color: #221c2e; animation-delay: -3s !important; }
@keyframes float { 50% { transform: translateY(-12px) rotate(-1deg); } }
.stage .flame { position: absolute; width: 150px; animation: float 4s ease-in-out infinite; }
.f1 { left: 4%; bottom: 20px; width: 190px !important; } .f2 { right: 6%; bottom: 110px; width: 110px !important; animation-delay: -2s !important; } .f3 { right: 30%; bottom: 0; width: 78px !important; animation-delay: -1s !important; }
.ghost { position: absolute; right: 8%; top: 330px; width: 104px; animation: ghost 6s ease-in-out infinite; }
@keyframes ghost { 0%,100% { opacity: .95; transform: translateY(0); } 50% { opacity: .3; transform: translateY(-18px); } }
/* sections */
section.block { padding: 64px 0; }
.eyebrow { display: inline-block; margin-bottom: 14px; }
.block > .page > h2, .head h2 { font-size: clamp(2rem, 5.5vw, 3.4rem); }
.head { display: grid; gap: 12px; margin-bottom: 36px; max-width: 760px; }
.head p { font-size: 1.12rem; }
.head .chip, .eyebrow { justify-self: start; width: fit-content; }
.marquee { border-block: 3px solid var(--ink); background: var(--yellow); color: var(--on-accent); overflow: hidden; white-space: nowrap; }
.marquee div { display: inline-block; padding: 12px 0; font-weight: 900; font-size: 1.2rem; animation: run 28s linear infinite; }
@keyframes run { to { transform: translateX(-50%); } }
/* notes of the release: cards that jump in */
.notes { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.note { padding: 26px; display: grid; gap: 12px; align-content: start; transition: transform .15s; }
.note:hover { transform: rotate(-1deg) translateY(-4px); }
.note__tag { width: 54px; height: 54px; border: 3px solid var(--ink); border-radius: 18px; display: grid; place-items: center; font-weight: 900; font-size: 1.5rem; color: var(--on-accent); }
.note h3 { font-size: 1.45rem; }
.reveal { opacity: 0; transform: translateY(28px) scale(.97); transition: opacity .5s, transform .5s cubic-bezier(.2,1.4,.4,1); }
.reveal.in { opacity: 1; transform: none; }
/* code */
.code { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; background: var(--ink); color: var(--bg); border: 3px solid var(--ink); border-radius: 20px; box-shadow: 6px 6px 0 var(--shadow); overflow-x: auto; }
.code code { white-space: normal; word-break: break-all; font-size: .9rem; flex: 1 1 260px; min-width: 0; }
.code button { flex: none; }
.split { display: grid; gap: 28px; align-items: center; }
@media (min-width: 900px) { .split { grid-template-columns: 1fr 1fr; } }
.howto { width: 100%; height: auto; border: 3px solid var(--ink); border-radius: 28px; box-shadow: 7px 7px 0 var(--shadow); background: var(--card); }
/* downloads */
.dl { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.dl__card { padding: 28px; display: grid; gap: 16px; align-content: start; }
.dl__card--main { background: var(--violet); color: #fff; grid-column: 1 / -1; }
.dl__card--main .muted { color: rgba(255,255,255,.85); }
.dl__card--main .btn { color: var(--ink); }
.sha { font-size: .82rem; word-break: break-all; opacity: .9; }
.file { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border: 2.5px solid var(--ink); border-radius: 18px; text-decoration: none; background: var(--bg); color: var(--ink); font-weight: 800; transition: transform .12s; }
.file:hover { transform: translateX(6px); background: var(--yellow); color: var(--on-accent); }
.file small { display: block; font-weight: 600; opacity: .8; }
ul.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
ul.ticks li { padding-left: 32px; position: relative; }
ul.ticks li::before { content: ""; position: absolute; left: 0; top: .25em; width: 20px; height: 20px; border-radius: 50%; background: var(--mint); border: 2.5px solid var(--ink); }
/* community */
.comments { display: grid; gap: 14px; }
.comment { display: flex; gap: 14px; padding: 16px; align-items: flex-start; }
.avatar { width: 46px; height: 46px; flex: none; border: 3px solid var(--ink); background: var(--pink); color: var(--on-accent); display: grid; place-items: center; font-weight: 900; border-radius: 50%; }
.comment:nth-child(2) .avatar { background: var(--sky); border-radius: 34% 66% 55% 45% / 45% 45% 55% 55%; }
.comment b img { width: 18px; height: 18px; vertical-align: -3px; margin-left: 4px; }
/* faq */
.faq { display: grid; gap: 14px; max-width: 860px; }
details { padding: 0; }
summary { padding: 18px 22px; font-weight: 800; font-size: 1.08rem; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; width: 30px; height: 30px; flex: none; display: grid; place-items: center; border: 2.5px solid var(--ink); border-radius: 50%; background: var(--yellow); color: var(--on-accent); font-weight: 900; transition: transform .2s; }
details[open] summary::after { transform: rotate(45deg); }
details > div { padding: 0 22px 20px; color: var(--muted); }
footer { border-top: 3px solid var(--ink); padding: 36px 0 90px; margin-top: 40px; background: var(--card); }
footer .row { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; justify-content: space-between; }
footer nav { display: flex; flex-wrap: wrap; gap: 6px 16px; }
footer nav a { font-weight: 800; text-decoration: none; } footer nav a:hover { text-decoration: underline wavy; }
footer .note-line { margin-top: 18px; font-size: .88rem; display: grid; gap: 4px; }
.fab { position: fixed; right: 16px; bottom: 16px; z-index: 18; }
canvas#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }
@media (prefers-reduced-motion: reduce) {
*, *::before, *::after { animation: none !important; transition: none !important; }
.reveal { opacity: 1; transform: none; }
}
</style>
</head>
<body>
<a class="skip-link" href="#main">К содержимому</a>
<a class="skip" href="#main">К содержимому</a>
<canvas id="confetti" aria-hidden="true"></canvas>
<header class="top-bar" data-top-bar>
<div class="page top-bar__inner">
<button class="icon-btn top-bar__menu" type="button" data-drawer-open aria-label="Открыть меню">
<svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#menu"/></svg>
</button>
<a class="brand" href="/" aria-label="LihonT, главная">
<img src="/logo_single_note.svg" width="32" height="32" alt="">
<span>Lihon<b>T</b></span>
</a>
<nav class="tabs" aria-label="Разделы сайта" data-spy>
<a href="#spotlight">LihonT 2.0</a>
<a href="#versions">Сборки 1.2</a>
<a href="#features">Возможности</a>
<svg width="0" height="0" style="position:absolute" aria-hidden="true">
<defs>
<symbol id="flower" viewBox="0 0 360 360">
<g fill="#e26d6d">
<circle cx="180" cy="180" r="108"/><circle cx="180" cy="72" r="72"/><circle cx="256.4" cy="103.6" r="72"/><circle cx="288" cy="180" r="72"/>
<circle cx="256.4" cy="256.4" r="72"/><circle cx="180" cy="288" r="72"/><circle cx="103.6" cy="256.4" r="72"/><circle cx="72" cy="180" r="72"/><circle cx="103.6" cy="103.6" r="72"/>
</g>
</symbol>
<symbol id="flame-on" viewBox="0 0 24 24"><path d="M12 1.5C13.2 6 19.5 9 19.5 15.2c0 4.4-3.3 7.3-7.5 7.3s-7.5-2.9-7.5-7.1c0-2.8 1.5-4.8 3.3-6.6.2 2.2 1.1 3.4 2.4 4C9.5 8.6 10.4 4.8 12 1.5Z" fill="#ff7a00" stroke="#4e1320" stroke-width="1.5" stroke-linejoin="round"/><path d="M12 12c.6 2 2.6 3 2.6 5.2 0 1.6-1.2 2.6-2.6 2.6s-2.6-1-2.6-2.5c0-1 .5-1.7 1.2-2.4.1.8.5 1.2 1 1.4-.3-1.4 0-2.8.4-4.3Z" fill="#ffc53d"/></symbol>
<symbol id="flame-off" viewBox="0 0 24 24"><path d="M12 1.5C13.2 6 19.5 9 19.5 15.2c0 4.4-3.3 7.3-7.5 7.3s-7.5-2.9-7.5-7.1c0-2.8 1.5-4.8 3.3-6.6.2 2.2 1.1 3.4 2.4 4C9.5 8.6 10.4 4.8 12 1.5Z" fill="#8e9399" stroke="#4e1320" stroke-width="1.5" stroke-linejoin="round"/><path d="M12 12c.6 2 2.6 3 2.6 5.2 0 1.6-1.2 2.6-2.6 2.6s-2.6-1-2.6-2.5c0-1 .5-1.7 1.2-2.4.1.8.5 1.2 1 1.4-.3-1.4 0-2.8.4-4.3Z" fill="#c7cbd0"/></symbol>
</defs>
</svg>
<header class="top">
<div class="page top__in">
<a class="brand" href="/" aria-label="LihonT, главная"><img src="/logo_single_note.svg" alt="">Lihon<b>T</b></a>
<nav class="nav" aria-label="Разделы сайта" data-spy>
<a href="#new">Что нового</a>
<a href="#plugins">Плагины</a>
<a href="#download">Скачать</a>
<a href="#community">Сообщество</a>
<a href="#faq">Вопросы</a>
<a href="/lihonb/">LihonB</a>
</nav>
<div class="top-bar__actions">
<button class="icon-btn theme-toggle" type="button" data-theme-toggle aria-pressed="false" aria-label="Сменить тему">
<svg class="icon icon-light" aria-hidden="true"><use href="/assets/site/icons.svg#dark-mode"/></svg>
<svg class="icon icon-dark" aria-hidden="true"><use href="/assets/site/icons.svg#light-mode"/></svg>
</button>
<a class="btn btn--filled" href="https://git.lihont.space/lihont/LihonT/releases/tag/v2.0-luna-pre2" rel="noopener">Скачать 2.0</a>
<div class="top__end">
<button class="btn icon-btn btn--flat" type="button" id="theme" aria-label="Сменить тему" title="Тема">◐</button>
<a class="btn btn--yellow" data-confetti href="https://git.lihont.space/lihont/LihonT/releases/tag/v2.0-luna" rel="noopener">Скачать Luna</a>
<button class="btn icon-btn menu-btn" type="button" id="menu" aria-label="Меню" aria-expanded="false">☰</button>
</div>
</div>
</header>
<dialog id="drawer" class="drawer" aria-label="Навигация">
<div class="drawer__title">
<img src="/logo_single_note.svg" width="32" height="32" alt="">
<span class="t-title-lg">LihonT</span>
<button class="icon-btn" type="button" data-drawer-close aria-label="Закрыть меню" style="margin-inline-start:auto">
<svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#close"/></svg>
</button>
</div>
<nav class="drawer__list" aria-label="Разделы сайта" data-spy>
<a href="#spotlight"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#bolt"/></svg>LihonT 2.0</a>
<a href="#versions"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#download"/></svg>Сборки 1.2</a>
<a href="#features"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#palette"/></svg>Возможности</a>
<a href="#community"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#chat-bubble"/></svg>Сообщество</a>
<a href="#faq"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#info"/></svg>Вопросы</a>
</nav>
<hr class="divider" style="margin:12px 16px">
<nav class="drawer__list" aria-label="Другие страницы">
<a href="/lihonb/"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#public"/></svg>Браузер LihonB</a>
<a href="/members/"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#music-note"/></svg>Значок сообщества</a>
<a href="/pay/"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#favorite"/></svg>Поддержать</a>
<a href="/lihont2/"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#lock"/></svg>Портал 2.0</a>
</nav>
</dialog>
<nav class="drawer" id="drawer" aria-label="Разделы сайта">
<a href="#new">Что нового</a><a href="#plugins">Плагины</a><a href="#download">Скачать</a><a href="#community">Сообщество</a><a href="#faq">Вопросы</a>
<a href="/lihonb/">Браузер LihonB</a><a href="/members/">Значок сообщества</a><a href="/pay/">Поддержать</a>
</nav>
<main id="main">
<!-- Hero -->
<section class="page hero" aria-labelledby="hero-title">
<div class="hero__grid">
<div class="hero__copy">
<span class="chip chip--primary">
<svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#palette"/></svg>
Material Design 3
</span>
<h1 id="hero-title" class="t-display-lg hero__title">Твой TikTok<br>в стиле <em>Material 3</em></h1>
<p class="t-body-lg t-muted">Адаптивная палитра Monet, отдельные скруглённые карточки настроек, фирменные цветочки-бейджи, перенесённые оригинальные настройки TikTok и выбор любого региона мира.</p>
<div class="cluster">
<a class="btn btn--filled btn--lg btn--icon-lead" href="https://git.lihont.space/lihont/LihonT/releases/tag/v2.0-luna-pre2" rel="noopener">
<svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#download"/></svg>
Скачать 2.0 pre2
</a>
<a class="btn btn--tonal btn--lg btn--icon-lead" href="#versions">
<svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#download"/></svg>
Скачать 1.2
</a>
</div>
<div class="cluster">
<a class="btn btn--outlined" href="/lihonb/">Браузер LihonB</a>
<a class="btn btn--text" href="/members/">Значок сообщества</a>
</div>
<div class="hero__chips" aria-label="Требования">
<span class="chip">Android 6.0+</span>
<span class="chip">arm64-v8a</span>
<span class="chip">Без root</span>
<span class="chip chip--tonal">TikTok 47.1.3</span>
</div>
<div>
<span class="chip chip--m eyebrow">Релиз · Luna · TikTok 47.1.3</span>
<h1 id="hero-title">Твой TikTok<br>в стиле <em>Material 3</em></h1>
<p class="lead muted">Режим призрака, свои пузыри в чате, до 9 фото в комментарии, плагины без кода и виджет с живым огоньком. Код открыт, root не нужен.</p>
<div class="cluster">
<a class="btn btn--yellow btn--lg" data-confetti href="https://git.lihont.space/lihont/LihonT/releases/tag/v2.0-luna" rel="noopener">Скачать LihonT 2 · Luna</a>
<a class="btn btn--lg" href="#new">Что нового</a>
</div>
<div class="stage" aria-hidden="true">
<div class="stage__flower"><svg viewBox="0 0 100 100"><use href="/assets/site/icons.svg#flower"/></svg></div>
<div class="device">
<div class="device__screen">
<div class="device__status"><span>9:41</span><span>5G&nbsp;&nbsp;86%</span></div>
<div class="device__bar">
<svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#arrow-back"/></svg>
<span>Настройки</span>
</div>
<div class="device__label">Активность</div>
<div class="device__row device__row--active">
<span class="flower flower--solid"><svg viewBox="0 0 100 100"><use href="/assets/site/icons.svg#flower"/></svg><svg class="icon"><use href="/assets/site/icons.svg#music-note"/></svg></span>
<span>Настройки мода</span>
<svg class="icon"><use href="/assets/site/icons.svg#arrow-forward"/></svg>
</div>
<div class="device__row">
<span class="flower flower--secondary"><svg viewBox="0 0 100 100"><use href="/assets/site/icons.svg#flower"/></svg><svg class="icon"><use href="/assets/site/icons.svg#notifications"/></svg></span>
<span>Уведомления</span>
<svg class="icon"><use href="/assets/site/icons.svg#arrow-forward"/></svg>
</div>
<div class="device__row">
<span class="flower flower--tertiary"><svg viewBox="0 0 100 100"><use href="/assets/site/icons.svg#flower"/></svg><svg class="icon"><use href="/assets/site/icons.svg#visibility"/></svg></span>
<span>Эфир</span>
<svg class="icon"><use href="/assets/site/icons.svg#arrow-forward"/></svg>
</div>
<div class="device__label">Аккаунт</div>
<div class="device__row">
<span class="flower"><svg viewBox="0 0 100 100"><use href="/assets/site/icons.svg#flower"/></svg><svg class="icon"><use href="/assets/site/icons.svg#person"/></svg></span>
<span>Аккаунт</span>
<svg class="icon"><use href="/assets/site/icons.svg#arrow-forward"/></svg>
</div>
<div class="device__row">
<span class="flower flower--secondary"><svg viewBox="0 0 100 100"><use href="/assets/site/icons.svg#flower"/></svg><svg class="icon"><use href="/assets/site/icons.svg#language"/></svg></span>
<span>Язык</span>
<svg class="icon"><use href="/assets/site/icons.svg#arrow-forward"/></svg>
</div>
<div class="device__row">
<span class="flower flower--tertiary"><svg viewBox="0 0 100 100"><use href="/assets/site/icons.svg#flower"/></svg><svg class="icon"><use href="/assets/site/icons.svg#security"/></svg></span>
<span>Безопасность</span>
<svg class="icon"><use href="/assets/site/icons.svg#arrow-forward"/></svg>
</div>
</div>
</div>
<div class="chips">
<span class="chip">Android 6.0+</span><span class="chip">arm64-v8a</span><span class="chip">Без root</span><span class="chip chip--p">Открытый код</span>
</div>
</div>
<div class="stage" aria-hidden="true">
<div class="bubble b1">Привет! Это моя картинка</div>
<div class="bubble b2">Видно всё</div>
<div class="bubble b3">На светлой чёрный</div>
<svg class="ghost" viewBox="0 0 100 100"><path d="M18 52C18 26 34 10 50 10s32 16 32 42v36l-9-8-8 8-7-8-7 8-8-8-9 8Z" fill="#fff" stroke="#221c2e" stroke-width="5" stroke-linejoin="round"/><circle cx="39" cy="44" r="5" fill="#221c2e"/><circle cx="61" cy="44" r="5" fill="#221c2e"/><circle cx="50" cy="55" r="3.5" fill="#221c2e"/></svg>
<div class="flame f1"><svg viewBox="0 0 360 360"><use href="#flower"/><g transform="translate(126 36) scale(4.5)"><use href="#flame-on" width="24" height="24"/></g><text x="180" y="305" text-anchor="middle" font-size="120" font-weight="900" fill="#4e1320" font-family="sans-serif">7</text></svg></div>
<div class="flame f2"><svg viewBox="0 0 360 360"><use href="#flower"/><g transform="translate(126 36) scale(4.5)"><use href="#flame-off" width="24" height="24"/></g><text x="180" y="305" text-anchor="middle" font-size="120" font-weight="900" fill="#4e1320" font-family="sans-serif">7</text></svg></div>
<div class="flame f3"><svg viewBox="0 0 360 360"><use href="#flower"/><g transform="translate(126 36) scale(4.5)"><use href="#flame-on" width="24" height="24"/></g><text x="180" y="305" text-anchor="middle" font-size="120" font-weight="900" fill="#4e1320" font-family="sans-serif">3</text></svg></div>
</div>
</section>
<!-- LihonT 2.0 -->
<section id="spotlight" class="page" aria-labelledby="spotlight-title" style="padding-bottom: 24px">
<div class="card card--primary spotlight">
<span class="flower flower--lg flower--solid"><svg viewBox="0 0 100 100"><use href="/assets/site/icons.svg#flower"/></svg><svg class="icon"><use href="/assets/site/icons.svg#music-note"/></svg></span>
<div class="stack" style="gap: 8px">
<div class="cluster" style="gap: 8px">
<h2 id="spotlight-title" class="t-headline-md">LihonT 2.0 Native</h2>
<span class="chip chip--tonal">Пре-релиз pre2</span>
</div>
<p class="t-body-lg t-muted" style="max-width: 62ch">Новая версия мода на актуальной базе TikTok 47.1.3 в дизайне Material 3: отдельные скруглённые кнопки в настройках, палитра Monet, виджет серии огоньков с хранителем, свои настройки для каждого аккаунта и расширенные настройки. Исходники и APK открыты, это ещё тестовая сборка.</p>
</div>
<div class="stack" style="gap: 8px">
<a class="btn btn--filled btn--lg btn--icon-lead" href="https://git.lihont.space/lihont/LihonT/releases/tag/v2.0-luna-pre2" rel="noopener">
<svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#download"/></svg>
Скачать pre2
</a>
<a class="btn btn--text" href="/lihont2/">Портал участников</a>
</div>
<div class="marquee" aria-hidden="true"><div>Призрак · Свои пузыри · До 9 фото · Плагины .ltp · Огонёк-виджет · Форма аватарок · Material 3 · Призрак · Свои пузыри · До 9 фото · Плагины .ltp · Огонёк-виджет · Форма аватарок · Material 3 ·&nbsp;</div></div>
<section id="new" class="block page" aria-labelledby="new-title">
<div class="head">
<span class="chip chip--y eyebrow">Заметки релиза</span>
<h2 id="new-title">Что нового в Luna</h2>
<p class="muted">Всё, что добавилось с пре-релиза: коротко и по делу. Всё выключено, пока вы сами не включите.</p>
</div>
<div class="notes">
<article class="note sticker reveal"><div class="note__tag" style="background:var(--sky)">◌</div><h3>Режим призрака</h3><p class="muted">Истории без отметки о просмотре и чаты без «прочитано». Включается в «Приватность».</p></article>
<article class="note sticker reveal"><div class="note__tag" style="background:var(--violet);color:#fff">✎</div><h3>Свои пузыри</h3><p class="muted">Своя картинка для ваших сообщений, общая для незнакомцев и своя для каждого человека. Цвет текста выбираете сами. Картинки живут только на телефоне.</p></article>
<article class="note sticker reveal"><div class="note__tag" style="background:var(--pink)">9</div><h3>До 9 фото в комментарии</h3><p class="muted">Если сервер даёт это вашему аккаунту. Переключатель в настройках мода.</p></article>
<article class="note sticker reveal"><div class="note__tag" style="background:var(--yellow)">ltp</div><h3>Плагины .ltp</h3><p class="muted">Правила для ленты, имён и картинок без кода. Права одобряете вы, есть журнал, откат и защитник, который простыми словами говорит, что делает плагин.</p></article>
<article class="note sticker reveal"><div class="note__tag" style="background:var(--coral)"><svg width="30" height="30" viewBox="0 0 24 24"><use href="#flame-on"/></svg></div><h3>Огонёк-виджет и автопродление</h3><p class="muted">Виджет от 1×1 до 4×4: оранжевый, пока огонёк горит, серый, когда пора писать. Автопродление в выбранное время, выключено по умолчанию.</p></article>
<article class="note sticker reveal"><div class="note__tag" style="background:var(--mint)">●</div><h3>Форма аватарок и Material 3</h3><p class="muted">Круг, цветок, шестиугольник, сердце, треугольник. Тональные поверхности вместо чёрного, AMOLED остаётся.</p></article>
</div>
</section>
<!-- Versions 1.2 -->
<section id="versions" class="page section" aria-labelledby="versions-title">
<div class="section__head">
<span class="t-label-lg">Доступные сборки</span>
<h2 id="versions-title" class="t-headline-lg">Классические сборки LihonT 1.2</h2>
<p class="t-body-lg t-muted">Проверенные временем версии. Обычный APK обновляет установленный мод, отдельный клон ставится рядом как второй независимый TikTok.</p>
</div>
<div class="grid grid--2">
<article id="serena" class="card card--filled edition">
<div class="card__head">
<span class="flower flower--tertiary"><svg viewBox="0 0 100 100"><use href="/assets/site/icons.svg#flower"/></svg><svg class="icon"><use href="/assets/site/icons.svg#check-circle"/></svg></span>
<div>
<div class="t-label-md">Основная версия</div>
<h3 class="t-headline-sm">LihonT Serena 1.2</h3>
</div>
</div>
<p class="t-body-md t-muted">Стабильная орбита для каждого дня. Базовые функции мода, сохранение без водяных знаков и фон за аватаркой.</p>
<ul class="list list--check">
<li class="list__item"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#check"/></svg><span>Скачивание видео и фото-слайдов без водяных знаков</span></li>
<li class="list__item"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#check"/></svg><span>Японский регион по умолчанию</span></li>
<li class="list__item"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#check"/></svg><span>Фоновые обои в профиле и взаимодействия с репостами</span></li>
</ul>
<div class="edition__downloads">
<a class="download" href="/lihont-serena-1.2-original-46.9.3-b74f72f6.apk" download="lihont-serena-1.2-original.apk">
<span class="download__text"><span class="download__title">Обычный APK (обновление)</span><span class="download__meta">com.zhiliaoapp.musically · 354 МБ</span></span>
<span class="icon-btn"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#download"/></svg></span>
</a>
<a class="download" href="/lihont-serena-1.2-clone-46.9.3-ab674e17.apk" download="lihont-serena-1.2-clone.apk">
<span class="download__text"><span class="download__title">Отдельный APK (клон)</span><span class="download__meta">online.lihon.tiktok · 354 МБ</span></span>
<span class="icon-btn"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#download"/></svg></span>
</a>
</div>
</article>
<article id="luna" class="card card--filled edition">
<div class="card__head">
<span class="flower flower--secondary"><svg viewBox="0 0 100 100"><use href="/assets/site/icons.svg#flower"/></svg><svg class="icon"><use href="/assets/site/icons.svg#music-note"/></svg></span>
<div>
<div class="t-label-md">Со значком сообщества</div>
<h3 class="t-headline-sm">LihonT Luna 1.2</h3>
</div>
</div>
<p class="t-body-md t-muted">Значки LihonT в профилях и комментариях, расширенные настройки мода и выбор стран.</p>
<ul class="list list--check">
<li class="list__item"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#check"/></svg><span>Все основные функции Serena</span></li>
<li class="list__item"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#check"/></svg><span>Значки LihonT в комментариях и профилях</span></li>
<li class="list__item"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#check"/></svg><span>Можно скрыть значок или переключить MargyT / TikTok You</span></li>
</ul>
<div class="edition__downloads">
<a class="download" href="/lihont-luna-1.2-original-46.9.3-67115bcf.apk" download="lihont-luna-1.2-original.apk">
<span class="download__text"><span class="download__title">Обычный APK (обновление)</span><span class="download__meta">com.zhiliaoapp.musically · 353 МБ</span></span>
<span class="icon-btn"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#download"/></svg></span>
</a>
<a class="download" href="/lihont-luna-1.2-clone-46.9.3-6b4b7295.apk" download="lihont-luna-1.2-clone.apk">
<span class="download__text"><span class="download__title">Отдельный APK (клон)</span><span class="download__meta">online.lihon.tiktok · 353 МБ</span></span>
<span class="icon-btn"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#download"/></svg></span>
</a>
</div>
</article>
</div>
</section>
<!-- Features -->
<section id="features" class="page section" aria-labelledby="features-title">
<div class="section__head">
<span class="t-label-lg">Больше свободы</span>
<h2 id="features-title" class="t-headline-lg">Всё, за что любят LihonT</h2>
<p class="t-body-lg t-muted">Каждая деталь продумана для комфортного использования без рекламы и лишних ограничений.</p>
</div>
<div class="grid grid--3">
<article class="card card--outlined feature">
<span class="flower"><svg viewBox="0 0 100 100"><use href="/assets/site/icons.svg#flower"/></svg><svg class="icon"><use href="/assets/site/icons.svg#palette"/></svg></span>
<h3 class="t-title-lg">Material 3</h3>
<p class="t-body-md">Цветочки-бейджи, палитра Monet, отдельные скруглённые карточки и полное погружение в Material You.</p>
</article>
<article class="card card--outlined feature">
<span class="flower flower--tertiary"><svg viewBox="0 0 100 100"><use href="/assets/site/icons.svg#flower"/></svg><svg class="icon"><use href="/assets/site/icons.svg#download"/></svg></span>
<h3 class="t-title-lg">Сохраняй чисто</h3>
<p class="t-body-md">Скачивай любимые видео, фото-слайды и звуковые дорожки без водяных знаков в оригинальном качестве.</p>
</article>
<article class="card card--outlined feature">
<span class="flower flower--secondary"><svg viewBox="0 0 100 100"><use href="/assets/site/icons.svg#flower"/></svg><svg class="icon"><use href="/assets/site/icons.svg#language"/></svg></span>
<h3 class="t-title-lg">Любые регионы</h3>
<p class="t-body-md">Свободный выбор страны в настройках мода. Переключись на любой регион, а мод очистит кэш и применит настройки.</p>
</article>
<article class="card card--outlined feature">
<span class="flower flower--tertiary"><svg viewBox="0 0 100 100"><use href="/assets/site/icons.svg#flower"/></svg><svg class="icon"><use href="/assets/site/icons.svg#security"/></svg></span>
<h3 class="t-title-lg">Без root-прав</h3>
<p class="t-body-md">Ставится на любой Android 6.0+ без разблокировки загрузчика и без изменения системы.</p>
</article>
<article class="card card--outlined feature">
<span class="flower flower--secondary"><svg viewBox="0 0 100 100"><use href="/assets/site/icons.svg#flower"/></svg><svg class="icon"><use href="/assets/site/icons.svg#favorite"/></svg></span>
<h3 class="t-title-lg">Твой профиль</h3>
<p class="t-body-md">Фоновые картинки за аватаркой, значок участника сообщества и удобный просмотр репостов.</p>
</article>
<article class="card card--outlined feature">
<span class="flower"><svg viewBox="0 0 100 100"><use href="/assets/site/icons.svg#flower"/></svg><svg class="icon"><use href="/assets/site/icons.svg#lock"/></svg></span>
<h3 class="t-title-lg">Приватность</h3>
<p class="t-body-md">Никаких сторонних трекеров. Учётные данные остаются между тобой и TikTok.</p>
</article>
</div>
</section>
<!-- Community -->
<section id="community" class="page section" aria-labelledby="community-title">
<section id="plugins" class="block page" aria-labelledby="plugins-title">
<div class="split">
<div class="section__head" style="margin-bottom: 0">
<span class="t-label-lg">Свои среди своих</span>
<h2 id="community-title" class="t-headline-lg">Значок LihonT в комментариях</h2>
<p class="t-body-lg t-muted">Участники видят маленькую фирменную ноту рядом с именами друг друга и находят своих в комментариях и профилях.</p>
<div class="cluster">
<a class="btn btn--tonal btn--icon-lead" href="/members/">
<svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#music-note"/></svg>
Управление значком
</a>
<div class="head" style="margin:0">
<span class="chip chip--v eyebrow">Для авторов</span>
<h2 id="plugins-title">Свой плагин за пять строк</h2>
<p class="muted">Плагины пишутся на Python библиотекой <b>lihont-ltp</b>. Она сама проверяет файл теми же правилами, что и приложение, и показывает защитника. Интернет плагину только с вашего согласия и на названные сайты.</p>
<div class="code" role="group" aria-label="Команда установки">
<code id="pipcmd">pip install "git+https://git.lihont.space/lihont/LihonT.git#subdirectory=sdk/lihont-ltp"</code>
<button class="btn btn--yellow btn--flat" type="button" id="copy">Копировать</button>
</div>
<div class="cluster">
<a class="btn" href="https://git.lihont.space/lihont/LihonT/src/branch/main/docs/plugins-guide.md" rel="noopener">Руководство</a>
<a class="btn" href="https://git.lihont.space/lihont/LihonT/src/branch/main/plugins/examples" rel="noopener">Пример плагина</a>
</div>
</div>
<img class="howto" src="/assets/site/plugin_howto.svg" alt="Как сделать плагин: написать файл, проверить защитником, отправить на телефон" width="800" height="450" loading="lazy">
</div>
</section>
<section id="download" class="block page" aria-labelledby="dl-title">
<div class="head">
<span class="chip chip--m eyebrow">Скачать</span>
<h2 id="dl-title">Выбери свою версию</h2>
<p class="muted">У мода другая подпись, поэтому сначала удалите официальный TikTok.</p>
</div>
<div class="dl">
<article class="dl__card sticker dl__card--main">
<div class="cluster"><h3 style="font-size:2rem">LihonT 2 · Luna</h3><span class="chip chip--y">Новое</span></div>
<p class="muted">Свежая версия на базе TikTok 47.1.3 в дизайне Material 3. APK и исходники открыты на нашем git.</p>
<div class="cluster">
<a class="btn btn--yellow btn--lg" data-confetti href="https://git.lihont.space/lihont/LihonT/releases/download/v2.0-luna/LihonT-2.0-luna.apk">APK · 334 МБ</a>
<a class="btn btn--lg" href="https://git.lihont.space/lihont/LihonT/releases/tag/v2.0-luna" rel="noopener">Заметки и SHA-256</a>
</div>
<p class="sha mono">SHA-256 1a5753888ac80feea64ec0be8b75e1680294e32810f4adae2d46ebaef3c6e712</p>
</article>
<article id="serena" class="dl__card sticker">
<span class="chip chip--s" style="justify-self:start">Основная 1.2</span>
<h3>LihonT Serena 1.2</h3>
<p class="muted">Стабильная классика: скачивание без водяных знаков, японский регион по умолчанию, фон за аватаркой.</p>
<a class="file" href="/lihont-serena-1.2-original-46.9.3-b74f72f6.apk" download="lihont-serena-1.2-original.apk"><span>Обычный APK (обновление)<small>com.zhiliaoapp.musically · 354 МБ</small></span>↓</a>
<a class="file" href="/lihont-serena-1.2-clone-46.9.3-ab674e17.apk" download="lihont-serena-1.2-clone.apk"><span>Отдельный APK (клон)<small>online.lihon.tiktok · 354 МБ</small></span>↓</a>
</article>
<article id="luna" class="dl__card sticker">
<span class="chip chip--p" style="justify-self:start">Со значком 1.2</span>
<h3>LihonT Luna 1.2</h3>
<p class="muted">Значки LihonT в профилях и комментариях, расширенные настройки и выбор стран.</p>
<a class="file" href="/lihont-luna-1.2-original-46.9.3-67115bcf.apk" download="lihont-luna-1.2-original.apk"><span>Обычный APK (обновление)<small>com.zhiliaoapp.musically · 353 МБ</small></span>↓</a>
<a class="file" href="/lihont-luna-1.2-clone-46.9.3-6b4b7295.apk" download="lihont-luna-1.2-clone.apk"><span>Отдельный APK (клон)<small>online.lihon.tiktok · 353 МБ</small></span>↓</a>
</article>
</div>
</section>
<section id="community" class="block page" aria-labelledby="comm-title">
<div class="split">
<div class="head" style="margin:0">
<span class="chip chip--p eyebrow">Свои среди своих</span>
<h2 id="comm-title">Значок LihonT в комментариях</h2>
<p class="muted">Участники видят маленькую фирменную ноту рядом с именами друг друга. Форму аватарки тоже видят все, у кого есть мод.</p>
<div class="cluster"><a class="btn btn--mint" href="/members/">Управление значком</a><a class="btn" href="/pay/">Поддержать</a></div>
</div>
<div class="comments" role="list" aria-label="Пример комментариев со значком">
<div class="comment" role="listitem">
<span class="avatar" aria-hidden="true">a</span>
<div class="comment__body">
<div class="comment__author">anna.cosmo <img src="/logo_single_note.svg" alt="Значок LihonT"></div>
<p class="comment__text">Смотрите, какой вайб в новой версии LihonT!</p>
<p class="comment__meta">2 мин. назад · Ответить</p>
</div>
<span class="comment__likes"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#favorite"/></svg>42</span>
</div>
<div class="comment" role="listitem">
<span class="avatar" aria-hidden="true">l</span>
<div class="comment__body">
<div class="comment__author">luna.explorer <img src="/logo_single_note.svg" alt="Значок LihonT"></div>
<p class="comment__text">Нашёл своих. Цветочки в Material 3 топ!</p>
<p class="comment__meta">Только что · Ответить</p>
</div>
<span class="comment__likes"><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#favorite"/></svg>19</span>
</div>
<div class="comment sticker reveal" role="listitem"><span class="avatar" aria-hidden="true">a</span><div><b>anna.cosmo <img src="/logo_single_note.svg" alt="Значок LihonT"></b><p>Смотрите, какой вайб в новой версии LihonT!</p><p class="muted" style="font-size:.85rem">2 мин. назад</p></div></div>
<div class="comment sticker reveal" role="listitem"><span class="avatar" aria-hidden="true">l</span><div><b>luna.explorer <img src="/logo_single_note.svg" alt="Значок LihonT"></b><p>Нашёл своих. Пузыри с моей картинкой топ!</p><p class="muted" style="font-size:.85rem">Только что</p></div></div>
</div>
</div>
</section>
<!-- FAQ -->
<section id="faq" class="page section" aria-labelledby="faq-title">
<div class="section__head">
<span class="t-label-lg">Перед стартом</span>
<h2 id="faq-title" class="t-headline-lg">Часто задаваемые вопросы</h2>
<p class="t-body-lg t-muted">Коротко о версиях, установке, обновлении и смене региона.</p>
</div>
<div class="accordion">
<details>
<summary><span>Что нового в LihonT 2.0?</span><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#expand-more"/></svg></summary>
<div class="accordion__answer">LihonT 2.0 — переход на Material Design 3. Экраны «Настройки и конфиденциальность» переписаны в Material You: каждая строка — отдельная скруглённая кнопка, фирменные цветочки-бейджи, диалог выбора региона с очисткой кэша и быстрой перезагрузкой. В pre2 добавились виджет серии огоньков с хранителем и свои настройки для каждого аккаунта.</div>
</details>
<details>
<summary><span>Какую версию выбрать: Serena, Luna или 2.0?</span><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#expand-more"/></svg></summary>
<div class="accordion__answer">Хочешь самое новое и не против багов — ставь LihonT 2.0 (пре-релиз, скачивается с git.lihont.space). Нужна проверенная стабильная сборка — Serena 1.2 (классика) или Luna 1.2 (со значком сообщества).</div>
</details>
<details>
<summary><span>Какой APK скачать: обычный или отдельный (клон)?</span><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#expand-more"/></svg></summary>
<div class="accordion__answer">Обычный APK (пакет <code>com.zhiliaoapp.musically</code>) обновляет уже установленный мод. Отдельный APK (пакет <code>online.lihon.tiktok</code>) ставится параллельно как второй независимый TikTok со своими данными и входом.</div>
</details>
<details>
<summary><span>Как установить APK на Android?</span><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#expand-more"/></svg></summary>
<div class="accordion__answer">Скачай APK, открой его через проводник или браузер и разреши установку из этого источника. Нужен Android 6.0 или новее с 64-битным процессором (arm64-v8a).</div>
</details>
<details>
<summary><span>Как сменить регион в моде?</span><svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#expand-more"/></svg></summary>
<div class="accordion__answer">В TikTok открой «Настройки и конфиденциальность» → «Настройки мода» → «Регион мода». Выбери страну (по умолчанию Япония) и подтверди перезагрузку, чтобы очистить кэш.</div>
</details>
<section id="faq" class="block page" aria-labelledby="faq-title">
<div class="head"><span class="chip chip--y eyebrow">Перед стартом</span><h2 id="faq-title">Вопросы</h2></div>
<div class="faq">
<details class="sticker"><summary>Что нового в LihonT 2 Luna?</summary><div>Режим призрака для историй и чатов, свои пузыри в чате, до 9 фото в комментарии, плагины .ltp с защитником, виджет огонька и автопродление, форма аватарок, настройки по аккаунтам и Material 3 вместо чёрного. Всё выключено, пока вы не включите.</div></details>
<details class="sticker"><summary>Какую версию выбрать: 2 Luna или 1.2?</summary><div>Хочешь новое и свои пузыри, плагины, призрака — ставь LihonT 2 Luna. Нужна проверенная классика — Serena 1.2, а со значком сообщества — Luna 1.2.</div></details>
<details class="sticker"><summary>Какой APK скачать: обычный или отдельный (клон)?</summary><div>Обычный APK (пакет <code>com.zhiliaoapp.musically</code>) обновляет уже установленный мод. Отдельный (пакет <code>online.lihon.tiktok</code>) ставится параллельно как второй независимый TikTok со своими данными и входом.</div></details>
<details class="sticker"><summary>Как установить APK на Android?</summary><div>Скачай APK, открой его через проводник или браузер и разреши установку из этого источника. Нужен Android 6.0 или новее с 64-битным процессором (arm64-v8a). У мода другая подпись: сначала удали официальный TikTok.</div></details>
<details class="sticker"><summary>Куда деваются мои картинки пузырей?</summary><div>Они лежат только в памяти приложения на твоём телефоне и никуда не отправляются.</div></details>
<details class="sticker"><summary>Как сменить регион в моде?</summary><div>В TikTok открой «Настройки и конфиденциальность» → «Настройки мода» → «Регион мода». Выбери страну и подтверди перезагрузку, чтобы очистить кэш.</div></details>
</div>
</section>
</main>
<footer class="footer">
<footer>
<div class="page">
<div class="footer__row">
<a class="brand" href="/">
<img src="/logo_single_note.svg" width="32" height="32" alt="">
<span>Lihon<b>T</b></span>
</a>
<nav class="footer__links" aria-label="Ссылки">
<a class="btn btn--text" href="/lihonb/">Браузер LihonB</a>
<a class="btn btn--text" href="/lihont2/">Портал 2.0</a>
<a class="btn btn--text" href="/members/">Значок сообщества</a>
<a class="btn btn--text" href="/pay/">Поддержать</a>
<a class="btn btn--text" href="https://t.me/cheb0chik" target="_blank" rel="noopener">Автор @cheb0chik</a>
<a class="btn btn--text" href="https://t.me/narezany" target="_blank" rel="noopener">@narezany</a>
<div class="row">
<a class="brand" href="/"><img src="/logo_single_note.svg" alt="">Lihon<b>T</b></a>
<nav aria-label="Ссылки">
<a href="/members/">Значок сообщества</a><a href="/pay/">Поддержать</a>
<a href="https://git.lihont.space/lihont/LihonT" rel="noopener">Исходники</a>
<a href="https://t.me/cheb0chik" target="_blank" rel="noopener">Автор @cheb0chik</a>
</nav>
</div>
<div class="footer__note">
<span>© 2026 LihonT · Material Design 3</span>
<span>Бесплатная модификация TikTok для Android. Проект не связан с ByteDance и TikTok Pte. Ltd.</span>
</div>
<div class="note-line"><span>© 2026 LihonT · лицензия VCBFU v2</span><span class="muted">Бесплатная модификация TikTok для Android. Проект не связан с ByteDance и TikTok Pte. Ltd.</span></div>
</div>
</footer>
<a class="fab" href="#versions" data-fab>
<svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#download"/></svg>
Скачать
</a>
<a class="btn btn--yellow fab" href="#download" data-fab>Скачать</a>
<script>
(function () {
var root = document.documentElement;
var drawer = document.getElementById("drawer"), menu = document.getElementById("menu");
menu.addEventListener("click", function () { var o = drawer.classList.toggle("open"); menu.setAttribute("aria-expanded", o); });
drawer.addEventListener("click", function (e) { if (e.target.tagName === "A") { drawer.classList.remove("open"); menu.setAttribute("aria-expanded", "false"); } });
document.getElementById("theme").addEventListener("click", function () {
var dark = getComputedStyle(root).getPropertyValue("--bg").trim() === "#1c1626";
var next = dark ? "light" : "dark";
root.setAttribute("data-theme", next);
try { localStorage.setItem("lihont-theme", next); } catch (e) {}
});
var copy = document.getElementById("copy");
copy.addEventListener("click", function () {
var text = document.getElementById("pipcmd").textContent;
var done = function () { copy.textContent = "Скопировано"; setTimeout(function () { copy.textContent = "Копировать"; }, 1800); };
if (navigator.clipboard) navigator.clipboard.writeText(text).then(done, done); else done();
});
/* cards jump in when they come into view */
var items = document.querySelectorAll(".reveal");
if ("IntersectionObserver" in window) {
var io = new IntersectionObserver(function (list) { list.forEach(function (x) { if (x.isIntersecting) { x.target.classList.add("in"); io.unobserve(x.target); } }); }, { threshold: .15 });
items.forEach(function (el, i) { el.style.transitionDelay = (i % 3) * 90 + "ms"; io.observe(el); });
} else { items.forEach(function (el) { el.classList.add("in"); }); }
/* the section that is on screen lights up in the menu */
var links = document.querySelectorAll(".nav a[href^='#']");
var spy = new IntersectionObserver(function (list) {
list.forEach(function (x) { if (x.isIntersecting) links.forEach(function (a) { a.classList.toggle("on", a.getAttribute("href") === "#" + x.target.id); }); });
}, { rootMargin: "-40% 0px -55% 0px" });
document.querySelectorAll("main section[id]").forEach(function (s) { spy.observe(s); });
/* the download button throws confetti */
var canvas = document.getElementById("confetti"), ctx = canvas.getContext("2d"), bits = [], running = false;
var colors = ["#ff6b6b", "#ffcd3c", "#5ed6aa", "#9670ff", "#5ab4ff", "#ff96c8"];
function size() { canvas.width = innerWidth; canvas.height = innerHeight; }
addEventListener("resize", size); size();
function burst(x, y) {
if (matchMedia("(prefers-reduced-motion: reduce)").matches) return;
for (var i = 0; i < 46; i++) {
var a = -Math.PI * (0.05 + Math.random() * 0.9), v = 6 + Math.random() * 9;
bits.push({ x: x, y: y, vx: Math.cos(a) * v, vy: Math.sin(a) * v, r: 4 + Math.random() * 6, c: colors[i % 6], s: Math.random() * 6, life: 1 });
}
if (!running) { running = true; requestAnimationFrame(step); }
}
function step() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
bits = bits.filter(function (b) { return b.life > 0; });
bits.forEach(function (b) {
b.vy += .35; b.x += b.vx; b.y += b.vy; b.life -= .012; b.s += .2;
ctx.globalAlpha = Math.max(0, b.life); ctx.fillStyle = b.c;
ctx.save(); ctx.translate(b.x, b.y); ctx.rotate(b.s); ctx.fillRect(-b.r, -b.r / 2, b.r * 2, b.r); ctx.restore();
});
if (bits.length) requestAnimationFrame(step); else { running = false; ctx.clearRect(0, 0, canvas.width, canvas.height); }
}
document.querySelectorAll("[data-confetti]").forEach(function (a) {
a.addEventListener("click", function (e) { burst(e.clientX || innerWidth / 2, e.clientY || innerHeight / 2); });
});
setTimeout(function () { burst(innerWidth / 2, innerHeight * .35); }, 600);
})();
</script>
</body>
</html>

View File

@@ -1,81 +1,123 @@
<!doctype html>
<html lang="ru" data-accent="gold">
<html lang="ru">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="color-scheme" content="light dark">
<meta name="theme-color" content="#fff8f1" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#17130b" media="(prefers-color-scheme: dark)">
<meta name="theme-color" content="#fff4e0" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#1c1626" media="(prefers-color-scheme: dark)">
<meta name="description" content="Поддержка разработки LihonT через CloudTips.">
<title>LihonT — поддержать разработку</title>
<link rel="icon" type="image/svg+xml" href="/logo_single_note.svg">
<script>
try { var t = localStorage.getItem("lihont-theme"); if (t === "light" || t === "dark") document.documentElement.setAttribute("data-theme", t); } catch (e) {}
</script>
<link rel="stylesheet" href="/assets/site/md3.css">
<script src="/assets/site/md3.js" defer></script>
<style>
:root { --bg: #fff4e0; --ink: #221c2e; --card: #ffffff; --muted: #5b5368; --dots: rgba(34,28,46,.13); --coral: #ff6b6b; --yellow: #ffcd3c; --mint: #5ed6aa; --pink: #ff96c8; --shadow: #221c2e; --on-accent: #221c2e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #1c1626; --ink: #f6efe4; --card: #2b2338; --muted: #b9afc9; --dots: rgba(246,239,228,.1); --shadow: #0b0810; } }
:root[data-theme="dark"] { --bg: #1c1626; --ink: #f6efe4; --card: #2b2338; --muted: #b9afc9; --dots: rgba(246,239,228,.1); --shadow: #0b0810; }
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); font-family: "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; font-size: 17px; line-height: 1.55; background-image: radial-gradient(var(--dots) 2.5px, transparent 2.6px); background-size: 40px 40px; animation: drift 40s linear infinite; overflow-x: hidden; }
@keyframes drift { to { background-position: 400px 240px; } }
a { color: inherit; } p { margin: 0; } h1, h2 { margin: 0; line-height: 1.08; font-weight: 900; letter-spacing: -.02em; }
.page { width: min(720px, 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--yellow); color: var(--on-accent); padding: 8px 14px; border-radius: 12px; z-index: 99; } .skip:focus { left: 8px; }
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 3px solid var(--ink); }
.top__in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 68px; width: min(1120px, 100% - 32px); margin-inline: auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 900; font-size: 1.35rem; } .brand b { color: var(--coral); }
.brand img { width: 36px; height: 36px; animation: sway 5s ease-in-out infinite; } @keyframes sway { 50% { transform: rotate(10deg) scale(1.06); } }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 10px 22px; border: 3px solid var(--ink); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-weight: 800; text-decoration: none; cursor: pointer; box-shadow: 5px 5px 0 var(--shadow); transition: transform .12s, box-shadow .12s; }
.btn:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--shadow); } .btn:active { transform: translate(4px, 4px); box-shadow: 1px 1px 0 var(--shadow); }
.btn--yellow { background: var(--yellow); color: var(--on-accent); } .btn--lg { min-height: 60px; font-size: 1.15rem; } .btn--block { display: flex; width: 100%; }
.btn--flat { box-shadow: none; border-width: 2px; } .icon-btn { width: 46px; height: 46px; padding: 0; min-height: 0; }
.top__end { display: flex; gap: 10px; align-items: center; }
main { flex: 1; padding: 48px 0 40px; }
.hero { text-align: center; display: grid; gap: 18px; justify-items: center; margin-bottom: 36px; }
.heart { width: 150px; height: 150px; animation: beat 1.4s ease-in-out infinite; filter: drop-shadow(6px 6px 0 var(--shadow)); }
@keyframes beat { 0%, 100% { transform: scale(1) rotate(-3deg); } 30% { transform: scale(1.12) rotate(3deg); } 55% { transform: scale(.97); } }
.chip { display: inline-flex; padding: 4px 14px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--pink); color: var(--on-accent); font-weight: 800; font-size: .9rem; }
h1 { font-size: clamp(2.2rem, 7vw, 3.6rem); } h1 em { font-style: normal; background: var(--yellow); color: var(--on-accent); padding: 0 .18em; border-radius: .25em; display: inline-block; transform: rotate(-2deg); border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--shadow); }
.muted { color: var(--muted); }
.card { background: var(--card); border: 3px solid var(--ink); border-radius: 28px; box-shadow: 7px 7px 0 var(--shadow); padding: 28px; display: grid; gap: 18px; }
.card h2 { font-size: 1.6rem; } .stack { display: grid; gap: 14px; }
footer { border-top: 3px solid var(--ink); padding: 28px 0; background: var(--card); } footer .page { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; }
canvas#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
</style>
</head>
<body>
<a class="skip-link" href="#main">К содержимому</a>
<a class="skip" href="#main">К содержимому</a>
<canvas id="confetti" aria-hidden="true"></canvas>
<header class="top-bar" data-top-bar>
<div class="page top-bar__inner">
<a class="brand" href="/" aria-label="LihonT, главная">
<img src="/logo_single_note.svg" width="32" height="32" alt="">
<span>Lihon<b>T</b></span>
</a>
<div class="top-bar__actions">
<button class="icon-btn theme-toggle" type="button" data-theme-toggle aria-pressed="false" aria-label="Сменить тему">
<svg class="icon icon-light" aria-hidden="true"><use href="/assets/site/icons.svg#dark-mode"/></svg>
<svg class="icon icon-dark" aria-hidden="true"><use href="/assets/site/icons.svg#light-mode"/></svg>
</button>
<a class="btn btn--tonal btn--icon-lead" href="/" style="display: inline-flex">
<svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#arrow-back"/></svg>
На главную
</a>
<header class="top">
<div class="top__in">
<a class="brand" href="/" aria-label="LihonT, главная"><img src="/logo_single_note.svg" alt="">Lihon<b>T</b></a>
<div class="top__end">
<button class="btn icon-btn btn--flat" type="button" id="theme" aria-label="Сменить тему" title="Тема">◐</button>
<a class="btn btn--yellow" href="/">На главную</a>
</div>
</div>
</header>
<main id="main" class="page">
<div class="narrow">
<div class="narrow__hero">
<span class="flower flower--lg"><svg viewBox="0 0 100 100"><use href="/assets/site/icons.svg#flower"/></svg><svg class="icon"><use href="/assets/site/icons.svg#favorite"/></svg></span>
<span class="chip chip--primary">Поддержка проекта</span>
<h1 class="t-display-md">Поддержи развитие <span class="t-primary">LihonT</span></h1>
<p class="t-body-lg t-muted">Если нравится мод и хочется помочь проекту расти, поддержи разработку через CloudTips на любую комфортную сумму. Все средства идут на оплату серверов и развитие новых версий.</p>
</div>
<section class="card card--filled" aria-labelledby="donate-title">
<div class="card__head">
<span class="flower flower--sm"><svg viewBox="0 0 100 100"><use href="/assets/site/icons.svg#flower"/></svg><svg class="icon"><use href="/assets/site/icons.svg#volunteer-activism"/></svg></span>
<h2 id="donate-title" class="t-title-lg">Прямой донат через CloudTips</h2>
</div>
<p class="t-body-md t-muted">Оплата принимается через сервис CloudTips с банковских карт и СБП. Спасибо каждому, кто помогает проекту оставаться бесплатным и развиваться.</p>
<div class="stack" style="gap: 8px">
<a class="btn btn--filled btn--lg btn--block btn--icon-lead" href="https://pay.cloudtips.ru/p/37d08eb5" target="_blank" rel="noopener">
<svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#open-in-new"/></svg>
Перейти к оплате в CloudTips
</a>
<a class="btn btn--outlined btn--block btn--icon-lead" href="https://t.me/cheb0chik" target="_blank" rel="noopener">
<svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#telegram"/></svg>
Связаться с автором @cheb0chik
</a>
</div>
</section>
<div class="hero">
<svg class="heart" viewBox="0 0 100 100" aria-hidden="true"><path d="M50 90C16 64 4 44 12 26 19 11 40 9 50 28 60 9 81 11 88 26c8 18-4 38-38 64Z" fill="#ff6b6b" stroke="#221c2e" stroke-width="5" stroke-linejoin="round"/><path d="M24 30c3-7 11-9 17-5" stroke="#fff" stroke-width="5" stroke-linecap="round" fill="none" opacity=".8"/></svg>
<span class="chip">Поддержка проекта</span>
<h1>Поддержи развитие <em>LihonT</em></h1>
<p class="muted">Если нравится мод и хочется помочь проекту расти, поддержи разработку через CloudTips на любую комфортную сумму. Все средства идут на оплату серверов и развитие новых версий.</p>
</div>
<section class="card" aria-labelledby="donate-title">
<h2 id="donate-title">Прямой донат через CloudTips</h2>
<p class="muted">Оплата принимается через сервис CloudTips с банковских карт и СБП. Спасибо каждому, кто помогает проекту оставаться бесплатным и развиваться.</p>
<div class="stack">
<a class="btn btn--yellow btn--lg btn--block" id="donate" href="https://pay.cloudtips.ru/p/37d08eb5" target="_blank" rel="noopener">Перейти к оплате в CloudTips</a>
<a class="btn btn--block" href="https://t.me/cheb0chik" target="_blank" rel="noopener">Связаться с автором @cheb0chik</a>
</div>
</section>
</main>
<footer class="footer">
<footer>
<div class="page">
<div class="footer__row">
<a class="btn btn--tonal btn--icon-lead" href="/">
<svg class="icon" aria-hidden="true"><use href="/assets/site/icons.svg#arrow-back"/></svg>
На главную LihonT
</a>
</div>
<div class="footer__note"><span>© 2026 LihonT · поддержка проекта</span></div>
<a class="btn" href="/">На главную LihonT</a>
<span class="muted">© 2026 LihonT · поддержка проекта</span>
</div>
</footer>
<script>
(function () {
var root = document.documentElement;
document.getElementById("theme").addEventListener("click", function () {
var dark = getComputedStyle(root).getPropertyValue("--bg").trim() === "#1c1626";
var next = dark ? "light" : "dark";
root.setAttribute("data-theme", next);
try { localStorage.setItem("lihont-theme", next); } catch (e) {}
});
/* hearts and confetti fly up when the donate button is pressed */
var canvas = document.getElementById("confetti"), ctx = canvas.getContext("2d"), bits = [], running = false;
var colors = ["#ff6b6b", "#ffcd3c", "#5ed6aa", "#9670ff", "#5ab4ff", "#ff96c8"];
function size() { canvas.width = innerWidth; canvas.height = innerHeight; }
addEventListener("resize", size); size();
function burst(x, y) {
if (matchMedia("(prefers-reduced-motion: reduce)").matches) return;
for (var i = 0; i < 40; i++) {
var a = -Math.PI * (0.05 + Math.random() * 0.9), v = 6 + Math.random() * 9;
bits.push({ x: x, y: y, vx: Math.cos(a) * v, vy: Math.sin(a) * v, r: 4 + Math.random() * 6, c: colors[i % 6], s: Math.random() * 6, life: 1 });
}
if (!running) { running = true; requestAnimationFrame(step); }
}
function step() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
bits = bits.filter(function (b) { return b.life > 0; });
bits.forEach(function (b) {
b.vy += .35; b.x += b.vx; b.y += b.vy; b.life -= .012; b.s += .2;
ctx.globalAlpha = Math.max(0, b.life); ctx.fillStyle = b.c;
ctx.save(); ctx.translate(b.x, b.y); ctx.rotate(b.s); ctx.fillRect(-b.r, -b.r / 2, b.r * 2, b.r); ctx.restore();
});
if (bits.length) requestAnimationFrame(step); else { running = false; ctx.clearRect(0, 0, canvas.width, canvas.height); }
}
document.getElementById("donate").addEventListener("click", function (e) { burst(e.clientX || innerWidth / 2, e.clientY || innerHeight / 2); });
})();
</script>
</body>
</html>

View File

@@ -88,7 +88,7 @@ public final class PluginTest {
check(Evaluator.hidingRule(all, f) != null, "no condition means always");
// the shipped samples are valid, files of their assets/ included
for (File file : new File("plugins").listFiles()) {
if (!file.isDirectory()) continue;
if (!file.isDirectory() || !new File(file, "plugin.json").isFile()) continue; // plugins/examples holds only a readme and a built file
Plugin sample = sample(file.getName());
check(sample.id.equals(file.getName()), "folder is the id: " + file.getName());
}
@@ -208,6 +208,28 @@ public final class PluginTest {
check(Evaluator.rename(p, f, "Кто-то").equals("Кто-то"), "other accounts are untouched");
f.uid = "";
check(Evaluator.rename(p, f, "Видео").equals("Видео"), "no account, no rename");
// the looks of a name
String styles = "{\"title\":\"s\",\"when\":\"name.show\",\"if\":{\"uid\":[\"1\"]},\"do\":[{\"name.style\":\"upper\"}]},"
+ "{\"title\":\"t\",\"when\":\"name.show\",\"if\":{\"uid\":[\"2\"]},\"do\":[{\"name.style\":\"wave\"}]},"
+ "{\"title\":\"u\",\"when\":\"name.show\",\"if\":{\"uid\":[\"3\"]},\"do\":[{\"name.style\":\"spaced\"},{\"name.suffix\":\"!\"}]},"
+ "{\"title\":\"v\",\"when\":\"name.show\",\"if\":{\"uid\":[\"4\"]},\"do\":[{\"name.style\":\"reverse\"}]},"
+ "{\"title\":\"w\",\"when\":\"name.show\",\"if\":{\"uid\":[\"5\"]},\"do\":[{\"name.style\":\"lower\"}]}";
Plugin looks = plugin(head("[\"names\"]", styles));
Fake g = new Fake();
g.uid = "1";
check(Evaluator.rename(looks, g, "Привет").equals("ПРИВЕТ"), "upper");
g.uid = "2";
check(Evaluator.rename(looks, g, "Привет").equals("пРиВеТ"), "wave");
g.uid = "3";
check(Evaluator.rename(looks, g, "Аня").equals("А н я!"), "spaced, then the suffix");
g.uid = "4";
check(Evaluator.rename(looks, g, "Аня").equals("янА"), "reverse");
g.uid = "5";
check(Evaluator.rename(looks, g, "АНЯ").equals("аня"), "lower");
g.uid = "9";
check(Evaluator.rename(looks, g, "Аня").equals("Аня"), "other accounts keep their name");
refused(head("[\"names\"]", "{\"when\":\"name.show\",\"do\":[{\"name.style\":\"zalgo\"}]}"), "вид имени");
refused(head("[\"names\"]", "{\"when\":\"feed.item\",\"do\":[{\"name.style\":\"upper\"}]}"), "name.show");
// the result is capped
StringBuilder long80 = new StringBuilder();
for (int i = 0; i < 90; i++) long80.append('x');
@@ -406,7 +428,7 @@ public final class PluginTest {
refusedWith(screen("{\"image\":\"../cat.gif\"}", "[\"ui.overlay\"]"), files, "имя файла");
refusedWith(screen("{\"image\":\"Cat.GIF\"}", "[\"ui.overlay\"]"), files, "имя файла");
refusedWith(screen("{}", "[\"ui.overlay\"]"), files, "image");
refusedWith(screen("{\"image\":\"cat.gif\",\"tap\":[\"explode\"]}", "[\"ui.overlay\"]"), files, "animate, sound и like");
refusedWith(screen("{\"image\":\"cat.gif\",\"tap\":[\"explode\"]}", "[\"ui.overlay\"]"), files, "animate, sound, like, confetti и buzz");
refusedWith(screen("{\"image\":\"cat.gif\",\"tap\":[\"like\",\"like\"]}", "[\"ui.overlay\",\"feed.like\"]"), files, "дважды");
refusedWith(screen("{\"image\":\"cat.gif\",\"tap\":[\"sound\"]}", "[\"ui.overlay\",\"ui.sound\"]"), files, "нет");
refusedWith(screen("{\"image\":\"cat.gif\",\"sound\":\"meow.ogg\"}", "[\"ui.overlay\",\"ui.sound\"]"), files, "нет «sound»");

58
tests/test_debug_mode.py Normal file
View File

@@ -0,0 +1,58 @@
"""The recovery mode (DEBUG): the cache marker, the reset and where it is wired in, checked on the sources."""
import unittest
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
TWO = ROOT / "src" / "lihont" / "two"
class DebugModeTest(unittest.TestCase):
def setUp(self):
self.source = (TWO / "look" / "DebugMode.java").read_text(encoding="utf-8")
def test_the_marker_lives_in_the_cache_so_clearing_the_cache_removes_it(self):
self.assertIn("getCacheDir()", self.source)
self.assertNotIn("getFilesDir()", self.source)
def test_a_missing_marker_with_debug_on_resets_the_look_and_the_plugins_once(self):
check = self.source[self.source.index("public static void check"):]
self.assertIn("if (!enabled(context)) return;", check)
self.assertIn("resetLook(context);", check)
self.assertIn("resetPlugins(context);", check)
# one shot: DEBUG turns itself off, so a cache the system trims later cannot reset anything twice
self.assertIn("set(context, false);", check)
def test_the_plugins_are_put_in_safe_mode_and_lose_the_internet_but_keep_their_files(self):
self.assertIn("PluginRegistry.enterSafeMode(context)", self.source)
self.assertIn("setNetOn(context, entry.id, false)", self.source)
self.assertNotIn("PluginRegistry.remove(", self.source)
def test_every_screen_checks_before_any_skin_reads_the_look(self):
windows = (TWO / "look" / "Windows.java").read_text(encoding="utf-8")
attach = windows[windows.index("public static void attach"):]
self.assertLess(attach.index("DebugMode.check(activity)"), attach.index("PluginScreen.attach"))
def test_the_settings_have_the_switch_and_explain_how_to_use_it(self):
screen = (TWO / "settings" / "LihonTSettingsActivity.java").read_text(encoding="utf-8")
self.assertIn("debugRow()", screen)
self.assertIn("Очистить кэш", screen)
self.assertIn('addSection("Восстановление"', screen)
def test_the_apps_own_restart_does_not_trigger_a_reset(self):
# the restart clears the cache; the marker must be put back, or every restart with DEBUG on would reset the look
screen = (TWO / "settings" / "LihonTSettingsActivity.java").read_text(encoding="utf-8")
clear = screen[screen.index("private void clearCache()"):]
clear = clear[:clear.index("private static boolean deleteRecursively")]
self.assertIn("DebugMode.keepMarker(this)", clear)
self.assertIn("public static void keepMarker", self.source)
def test_choosing_a_theme_always_offers_the_restart_so_old_and_new_paint_do_not_mix(self):
screen = (TWO / "settings" / "LihonTSettingsActivity.java").read_text(encoding="utf-8")
choose = screen[screen.index("private void chooseStyle()"):]
choose = choose[:choose.index("shown[0] = bubbleDialog")]
self.assertIn("showRestartNotice();", choose)
self.assertNotIn("if (repository.restartRequired()) showRestartNotice();", choose)
if __name__ == "__main__":
unittest.main()

View File

@@ -22,7 +22,7 @@ from lihont_ltp.errors import LtpError # noqa: E402
from lihont_ltp.pack import read_ltp # noqa: E402
CORE = ["Act", "Cond", "Ctx", "Defender", "DownloadSpec", "Evaluator", "Fields", "GuardDump", "Journal", "Json",
"LtpException", "OverlaySpec", "Permission", "Plugin", "PluginPackage", "Rule"]
"LtpException", "OverlaySpec", "Permission", "Plugin", "PluginPackage", "Rule", "ThemeData"]
def build(plugin):
@@ -313,7 +313,7 @@ class AgreesWithTheApp(unittest.TestCase):
def test_the_shipped_plugins_get_identical_words(self):
folders, python = [], {}
for folder in sorted(p for p in (ROOT / "plugins").iterdir() if p.is_dir()):
for folder in sorted(p for p in (ROOT / "plugins").iterdir() if p.is_dir() and (p / "plugin.json").is_file()):
manifest = json.loads((folder / "plugin.json").read_text(encoding="utf-8"))
assets = {a.name: a.read_bytes() for a in (folder / "assets").glob("*")} if (folder / "assets").is_dir() else {}
validate.check_manifest(manifest, assets)
@@ -324,10 +324,77 @@ class AgreesWithTheApp(unittest.TestCase):
for name, text in python.items():
self.assertEqual(java[name], text, name)
def theme_manifest(self, **theme):
base = {"name": "Тест", "page": "#2b1d3a", "card": "#3d2b52", "text": "#fbe9ff", "accent": "#ff8a5b", "on_accent": "#2b1d3a"}
base.update(theme)
return {"ltp": 1, "id": "lihont.theme-test", "name": "Тема", "version": "1.0", "author": "тест",
"license": "MIT", "permissions": ["ui.theme"], "theme": base}
def test_a_theme_gets_identical_words_in_both_defenders_and_a_low_contrast_is_flagged_in_both(self):
good = self.theme_manifest()
murky = self.theme_manifest(text="#777777", card="#808080", on_accent="#ffffff", accent="#eeeeee")
folders, python = [], {}
for name, manifest in (("good", good), ("murky", murky)):
validate.check_manifest(manifest, {})
python[name] = guard_module.check(manifest, []).text()
folders.append(self.folder_of(name, manifest, {}))
self.assertNotIn("плохо читается", python["good"])
self.assertIn("Текст на карточках темы плохо читается", python["murky"])
self.assertIn("Текст на кнопках и заголовках темы плохо читается", python["murky"])
java = self.java_says(folders)
for name, text in python.items():
self.assertEqual(java[name], text, name)
def test_a_theme_that_is_not_in_order_is_refused_the_same_way_by_the_library(self):
def refused(manifest, word):
with self.assertRaises(LtpError) as caught:
validate.check_manifest(manifest, {})
self.assertIn(word, str(caught.exception))
no_right = self.theme_manifest()
no_right["permissions"] = []
refused(no_right, "ui.theme")
refused(self.theme_manifest(page="#2B1D3A"), "#rrggbb")
refused(self.theme_manifest(page="red"), "#rrggbb")
refused(self.theme_manifest(radius=99), "от 0 до 40")
refused(self.theme_manifest(bevel="yes"), "true или false")
refused(self.theme_manifest(layout="grid"), "нет поля")
no_theme = self.theme_manifest()
del no_theme["theme"]
refused(no_theme, "ui.theme")
def test_a_theme_can_come_with_rules_and_the_right_is_not_asked_to_be_used_by_a_rule(self):
both = self.theme_manifest()
both["permissions"] = ["feed.hide", "ui.theme"]
both["rules"] = [{"title": "Без fyp", "when": "feed.item", "if": {"hashtag": ["fyp"]}, "do": [{"feed.hide": True}]}]
validate.check_manifest(both, {})
text = guard_module.check(both, []).text()
self.assertIn("Без fyp:", text)
self.assertIn("Тема «Тест»", text)
def test_the_fun_functions_get_identical_words_in_both_defenders(self):
png = bytes([0x89]) + b"PNG" + bytes([0x0D, 0x0A, 0x1A, 0x0A]) + bytes(32)
manifest = {"ltp": 1, "id": "lihont.fun-test", "name": "Приколы", "version": "1.0", "author": "тест",
"license": "MIT", "permissions": ["names", "ui.overlay"],
"rules": [
{"title": "Все имена волной", "when": "name.show", "do": [{"name.style": "wave"}]},
{"title": "Моё имя наоборот", "when": "name.show", "if": {"uid": ["self"]},
"do": [{"name.style": "reverse"}]},
{"title": "Звезда", "when": "screen.show",
"do": [{"overlay": {"image": "star.png", "tap": ["animate", "confetti", "buzz"]}}]}]}
validate.check_manifest(manifest, {"star.png": png})
python = guard_module.check(manifest, ["star.png"]).text()
self.assertIn("меняет вид всех имён на экране (волной (пРиВеТ))", python)
self.assertIn("Меняет вид имён у выбранных аккаунтов", python)
self.assertIn("Конфетти или лёгкая вибрация по нажатию на картинку.", python)
self.assertIn("по нажатию: играет анимация, конфетти, вибрация", python)
java = self.java_says([self.folder_of("fun", manifest, {"star.png": png})])
self.assertEqual(java["fun"], python)
def test_the_hash_the_review_prints_is_the_one_the_app_shows(self):
from lihont_ltp import review
folders, expected = [], {}
for folder in sorted(p for p in (ROOT / "plugins").iterdir() if p.is_dir()):
for folder in sorted(p for p in (ROOT / "plugins").iterdir() if p.is_dir() and (p / "plugin.json").is_file()):
ltp = self.work / (folder.name + ".ltp")
with zipfile.ZipFile(ltp, "w") as archive:
archive.writestr("plugin.json", (folder / "plugin.json").read_bytes())

View File

@@ -43,4 +43,4 @@ class ManifestActivityTest(unittest.TestCase):
if __name__ == '__main__':
unittest.main()
unittest.main()

View File

@@ -16,7 +16,7 @@ from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
CORE = ["Act", "Cond", "Ctx", "Defender", "DownloadSpec", "Downloader", "Evaluator", "Fields", "Journal", "Json",
"LtpException", "OverlaySpec", "Permission", "Plugin", "PluginPackage", "Rule"]
"LtpException", "OverlaySpec", "Permission", "Plugin", "PluginPackage", "Rule", "ThemeData"]
HARNESS = ROOT / "tests" / "java" / "lihont" / "two" / "plugin" / "PluginTest.java"
@@ -156,5 +156,26 @@ class HooksTest(unittest.TestCase):
self.assertIn("PluginSettings.REQUEST_PICK", text)
class ForbiddenDataTest(unittest.TestCase):
"""Plugins are never given passwords, tokens, cookies, chat text or code execution: no right and no field says so."""
FORBIDDEN = ("password", "passwd", "token", "cookie", "session", "secret", "credential", "chat", "message", "dm.",
"exec", "eval", "shell")
def test_no_permission_names_a_forbidden_kind_of_data(self):
text = (ROOT / "src" / "lihont" / "two" / "plugin" / "Permission.java").read_text(encoding="utf-8")
names = [line.split('"')[1].lower() for line in text.splitlines()
if "public static final String" in line and '= "' in line]
self.assertTrue(names, "no permissions found: the parser of this test is out of date")
for name in names:
for word in self.FORBIDDEN:
self.assertNotIn(word, name, "permission %s names forbidden data (%s)" % (name, word))
def test_the_context_a_plugin_sees_has_no_forbidden_field(self):
text = (ROOT / "src" / "lihont" / "two" / "plugin" / "Ctx.java").read_text(encoding="utf-8").lower()
for word in ("password", "token", "cookie", "secret", "credential", "messagetext", "chattext"):
self.assertNotIn(word, text, "Ctx exposes %s to plugins" % word)
if __name__ == "__main__":
unittest.main()