Improve website translations and favicons; disable push workflows

This commit is contained in:
Hakan Seven committed 2026-09-07 01:19:39 +03:00
1 parent d66e89ca19
commit 143703d809
32 files changed
+300 -298

No files matched your search

+7 -7
View File
@@ -50,16 +50,16 @@ def build(output):
workspace = asset(ROOT / "site/workspace.png")
modeling = asset(ROOT / "site/modeling.png")
shutil.copyfile(ROOT / "assets/logo.svg", output / "assets/logo.svg")
ico = asset(ROOT / "site/favicon.ico")
touch = asset(ROOT / "site/apple-touch-icon.png")
icons = (f'<link rel="icon" href="{ico}" sizes="16x16 32x32 48x48" />\n'
f'<link rel="icon" href="{logo}" type="image/svg+xml" sizes="any" />\n'
f'<link rel="apple-touch-icon" href="{touch}" sizes="180x180" />')
for filename in ("favicon.ico", "favicon.svg", "favicon.png"):
shutil.copyfile(ROOT / "site" / filename, output / filename)
icons = ('<link rel="icon" href="/favicon.ico" sizes="16x16 32x32 48x48 96x96 256x256" />\n'
'<link rel="icon" href="/favicon.png" type="image/png" sizes="96x96" />\n'
'<link rel="icon" href="/favicon.svg" type="image/svg+xml" sizes="any" />\n'
'<link rel="apple-touch-icon" href="/apple-touch-icon.png" sizes="180x180" />')
manifest = json.loads((ROOT / "site/site.webmanifest").read_text())
manifest["icons"] = [{"src": logo, "sizes": "any", "type": "image/svg+xml"}]
manifest["icons"] = [{"src": "/favicon.svg", "sizes": "any", "type": "image/svg+xml"}]
for size in (192, 512):
manifest["icons"].append({"src": asset(ROOT / f"site/icon-{size}.png"), "sizes": f"{size}x{size}", "type": "image/png"})
shutil.copyfile(ROOT / "site/favicon.ico", output / "favicon.ico")
shutil.copyfile(ROOT / "site/apple-touch-icon.png", output / "apple-touch-icon.png")
css_version = hashlib.sha256((ROOT / "site/site.css").read_bytes()).hexdigest()[:12]
script = "const SITE_LOCALES = " + json.dumps(list(catalogs)) + ";\n" + (ROOT / "site/site.js").read_text()
+4 -2
View File
@@ -55,6 +55,7 @@ with tempfile.TemporaryDirectory() as directory:
page = Page(html)
assert ('html', {'lang': locale, 'dir': 'rtl' if locale == 'ar-SA' else 'ltr'}) in page.tags
links = [attrs for tag, attrs in page.tags if tag == 'link']
assert {link['href'] for link in links if link.get('rel') == 'icon'} == {'/favicon.ico', '/favicon.png', '/favicon.svg'}
assert {link['hreflang'] for link in links if link.get('rel') == 'alternate'} == supported | {'x-default'}
assert next(link['href'] for link in links if link.get('rel') == 'canonical') == f'https://www.opencadstudio.com/{locale}/'
choices = [attrs for tag, attrs in page.tags if tag == 'a' and 'hreflang' in attrs]
@@ -82,8 +83,9 @@ with tempfile.TemporaryDirectory() as directory:
assert value != catalogs['en-US'][key], (locale, key)
app = (output / 'app/index.html').read_text()
assert 'old.svg' not in app and 'integrity="old"' not in app and '>App<' in app
logo = next(attrs['href'] for tag, attrs in Page(app).tags if attrs.get('type') == 'image/svg+xml')
assert (output / logo.lstrip('/')).read_bytes() == (ROOT / 'assets/logo.svg').read_bytes()
icon = next(attrs['href'] for tag, attrs in Page(app).tags if attrs.get('type') == 'image/svg+xml')
assert icon == '/favicon.svg'
assert (output / icon.lstrip('/')).read_bytes() == (ROOT / 'site/favicon.svg').read_bytes()
sitemap = ET.parse(output / 'sitemap.xml')
assert len(sitemap.getroot()) == len(supported) + 1
assert (output / 'index.html').read_bytes() == (output / 'en-US/index.html').read_bytes()