All checks were successful
Desktop source guards / guards (push) Successful in 8s
100 lines
3.4 KiB
Python
100 lines
3.4 KiB
Python
#!/usr/bin/env python3
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
FORK_RELEASES = "https://git.zapret.moe/zastogram/ZaStoGram_desktop/releases"
|
|
|
|
|
|
def source(path: str) -> str:
|
|
return (ROOT / path).read_text(encoding="utf-8")
|
|
|
|
|
|
def require(path: str, *needles: str) -> None:
|
|
text = source(path)
|
|
missing = [needle for needle in needles if needle not in text]
|
|
if missing:
|
|
raise AssertionError(
|
|
f"{path} lost ZaStoGram fork markers: {', '.join(missing)}")
|
|
|
|
|
|
def main() -> None:
|
|
application = source("SourceFiles/core/application.cpp")
|
|
if FORK_RELEASES not in application:
|
|
raise AssertionError("the ZaStoGram release history URL is missing")
|
|
|
|
require(
|
|
"SourceFiles/core/version.h",
|
|
'constexpr auto AppName = "ZaStoGram"_cs;',
|
|
"constexpr auto AppBetaVersion = false;",
|
|
)
|
|
require(
|
|
"SourceFiles/core/launcher.cpp",
|
|
'QApplication::setApplicationName(u"ZaStoGram"_q);',
|
|
)
|
|
require(
|
|
"SourceFiles/boxes/about_box.cpp",
|
|
"box->setTitle(AppName.utf16());",
|
|
'u" (build %1)"_q.arg(ZsgBuildId.utf16())',
|
|
)
|
|
require(
|
|
"SourceFiles/core/update_checker.cpp",
|
|
"kZaStoGramReleasesApi",
|
|
"https://git.zapret.moe/api/v1/repos/",
|
|
"?draft=false&pre-release=true&limit=1",
|
|
"if (IsZaStoGramDevBuild())",
|
|
"ResponseType::DevReleases",
|
|
'release.value("prerelease").toBool()',
|
|
"ZaStoGramDevBuildNumber()",
|
|
'name == "current4"',
|
|
"_dev%2",
|
|
"versionNum == AppVersion && !IsZaStoGramDevBuild()",
|
|
"request.setTransferTimeout(int(kUpdateCheckTimeout));",
|
|
"tryLoaders();",
|
|
)
|
|
updater = source("SourceFiles/core/update_checker.cpp")
|
|
timeout = updater.split("void Updater::handleTimeout()", 1)[1].split(
|
|
"bool Updater::tryLoaders()", 1
|
|
)[0]
|
|
if "cSetLastUpdateCheck(0)" in timeout or "_timer.callOnce" in timeout:
|
|
raise AssertionError("a timed-out update check must not restart itself")
|
|
require(
|
|
"SourceFiles/window/window_main_menu.cpp",
|
|
"AppName.utf16()",
|
|
FORK_RELEASES,
|
|
)
|
|
require(
|
|
"SourceFiles/settings/sections/settings_advanced.cpp",
|
|
"BuildUpdateSection(builder, true);",
|
|
"return !downloading;",
|
|
"Core::UpdateChecker checker;",
|
|
"tr::lng_settings_check_now()",
|
|
)
|
|
advanced = source("SourceFiles/settings/sections/settings_advanced.cpp")
|
|
if "lng_settings_install_beta" in advanced:
|
|
raise AssertionError("the obsolete upstream beta switch returned")
|
|
require(
|
|
"SourceFiles/core/launcher.cpp",
|
|
"ZaStoGram has two baked, independent channels",
|
|
"cSetInstallBetaVersion(false);",
|
|
)
|
|
localstorage = source("SourceFiles/storage/localstorage.cpp")
|
|
if FORK_RELEASES + "/download/latest" not in localstorage:
|
|
raise AssertionError("the native Forgejo latest-asset prefix is missing")
|
|
if FORK_RELEASES + "/latest/download" in localstorage:
|
|
raise AssertionError("the GitHub latest-asset path order returned")
|
|
require(
|
|
"Resources/winrc/Telegram.rc",
|
|
'VALUE "FileDescription", "ZaStoGram"',
|
|
'VALUE "ProductName", "ZaStoGram"',
|
|
)
|
|
require(
|
|
"../.forgejo/workflows/source-guards.yml",
|
|
"release_guards.txt",
|
|
"Run canonical release source guards",
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|