All checks were successful
Zapret source guards / validate (push) Successful in 8s
From the ntc.party YouTube thread (12–15 Nov 2026) and bolvan's explanation: stock wssize rewrites the window scale in the SYN for the whole connection, so the server sees the client's window 64–128× smaller and video crawls. - New presets «Default + YouTube no QUIC + wssize_ramp» (+ game filter): the video profile uses wssize_ramp (custom_funcs.lua, private f8fd6c2: tiny window only until the server's first bytes are ACKed, then the real window, cap 128 KB) with --wf-tcp-empty=1. Old presets untouched. Composite catalog entries added. win10, server 130 ms away: plain 106–138 Mbit/s, stock wssize 0.1, wssize_ramp 7.6 (cap predicted 7.8); --wf-tcp-empty=1 alone costs ~1 s CPU per 100 MB. BlockCheck's «Включить пресет без QUIC» now leads to the wssize_ramp preset. - Video server sweep tries each address up to 5 times (3 when it stays silent): new code «flaky» — «ответ приходит через раз: N из 5». - tls_hello records the TCP connect time; the sweep shows the round trip per node, names far nodes (≥120 ms) as distance/fresh-video slowness rather than a block, and shows the speed cap when the video profile runs wssize (ramp: info with Mbit/s; stock: warning pointing at wssize_ramp). - Caches closed with «Закрыть кэши YouTube» were tested at 127.0.0.2 (hosts first) and looked dead forever. They are now resolved past hosts and retested; when one answers again BlockCheck offers «Вернуть кэши YouTube» (the player can stick to a closed node until the tab is reloaded). Closed nodes stay out of the fix journal's before/after share. Reload hint added to the cache texts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
85 lines
4 KiB
Python
85 lines
4 KiB
Python
"""Кнопки исправления видео в итоге BlockCheck: у каждой есть слова и значок, пресет берётся с тем же игровым фильтром."""
|
||
|
||
from __future__ import annotations
|
||
|
||
import unittest
|
||
from types import SimpleNamespace
|
||
|
||
from app.page_names import PageName
|
||
from ui.page_deps.system import build_blockcheck_page_kwargs
|
||
|
||
_ACTIONS = ("youtube_block_caches", "youtube_unblock_caches", "youtube_preset")
|
||
|
||
|
||
class _Presets:
|
||
def __init__(self, current: str) -> None:
|
||
self.current = current
|
||
self.activated: list[tuple[str, str]] = []
|
||
|
||
def get_selected_source_preset_file_name(self, _method: str) -> str:
|
||
return self.current
|
||
|
||
def activate_preset_file(self, method: str, file_name: str) -> None:
|
||
self.activated.append((method, file_name))
|
||
|
||
|
||
def _kwargs(presets) -> dict:
|
||
runtime = SimpleNamespace(start=lambda: True, stop=lambda: True, is_running=lambda: False, shutdown_sync_from_worker=None)
|
||
return build_blockcheck_page_kwargs(
|
||
page_name=PageName.BLOCKCHECK, blockcheck_feature=object(), dns_feature=object(), runtime_feature=runtime, presets_feature=presets
|
||
)
|
||
|
||
|
||
class PresetButtonTests(unittest.TestCase):
|
||
def test_game_filter_preset_switches_to_the_game_variant(self) -> None:
|
||
presets = _Presets("Default (game filter).txt")
|
||
ok, name = _kwargs(presets)["activate_preset"]("Default + YouTube no QUIC + wssize.txt")
|
||
self.assertTrue(ok)
|
||
self.assertEqual(presets.activated[0][1], "Default + YouTube no QUIC + wssize (game filter).txt")
|
||
self.assertEqual(name, "Default + YouTube no QUIC + wssize (game filter)")
|
||
|
||
def test_plain_preset_switches_to_the_plain_variant(self) -> None:
|
||
presets = _Presets("Default multisplit_sni.txt")
|
||
_kwargs(presets)["activate_preset"]("Default + YouTube no QUIC + wssize.txt")
|
||
self.assertEqual(presets.activated[0][1], "Default + YouTube no QUIC + wssize.txt")
|
||
|
||
def test_no_presets_feature_means_no_button(self) -> None:
|
||
self.assertIsNone(_kwargs(None)["activate_preset"])
|
||
|
||
def test_target_preset_files_exist(self) -> None:
|
||
from pathlib import Path
|
||
|
||
from diagnostics.problems import YOUTUBE_FIX_PRESET
|
||
|
||
folder = Path(__file__).resolve().parents[1] / "src" / "presets" / "builtin" / "winws2"
|
||
self.assertTrue((folder / YOUTUBE_FIX_PRESET).is_file())
|
||
self.assertTrue((folder / YOUTUBE_FIX_PRESET.replace(".txt", " (game filter).txt")).is_file())
|
||
|
||
def test_target_presets_keep_speed_with_wssize_ramp(self) -> None:
|
||
"""Обычный wssize занижает множитель окна на всё соединение (скорость падает в десятки раз),
|
||
поэтому кнопка ведёт на пресет с wssize_ramp, а ему нужны пустые подтверждения (--wf-tcp-empty=1)."""
|
||
from pathlib import Path
|
||
|
||
from diagnostics.problems import YOUTUBE_FIX_PRESET
|
||
|
||
folder = Path(__file__).resolve().parents[1] / "src" / "presets" / "builtin" / "winws2"
|
||
for name in (YOUTUBE_FIX_PRESET, YOUTUBE_FIX_PRESET.replace(".txt", " (game filter).txt")):
|
||
lines = (folder / name).read_text(encoding="utf-8").splitlines()
|
||
with self.subTest(preset=name):
|
||
self.assertIn("--wf-tcp-empty=1", lines)
|
||
self.assertIn("--lua-desync=wssize_ramp:wsize=1:scale=1", lines)
|
||
self.assertFalse(any(line.startswith("--lua-desync=wssize:") for line in lines))
|
||
|
||
|
||
class ActionWordsTests(unittest.TestCase):
|
||
def test_every_video_fix_action_has_text_description_and_icon(self) -> None:
|
||
from blockcheck.ui import check_results
|
||
|
||
for action in _ACTIONS:
|
||
self.assertTrue(check_results._ACTION_TEXT.get(action), action)
|
||
self.assertTrue(check_results._ACTION_DESCRIPTION.get(action), action)
|
||
self.assertTrue(check_results._ACTION_ICONS.get(action), action)
|
||
|
||
|
||
if __name__ == "__main__":
|
||
unittest.main()
|