A pair of people can have a kitten, a puppy or a lion cub in place of TikTok's streak creature: it grows with the days of the streak (cub, teen, adult, elder), goes grey while the streak is about to burn out, can be dragged in the chat and is also shown on the big streak screen. An animal is given by a link (lihont.space/pet) that the friend accepts. The drawings are made by scripts/make_pet_designs.py and served as strips of frames. Also here: the promo video scripts (make_pet_video.py on top of make_store_video.py), a retry pause for strips that failed to load, stricter checks in the answer to a gift. Work in progress: the gift service is not switched on for everyone yet and there is no public build with the animals. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
65 lines
2.7 KiB
Python
65 lines
2.7 KiB
Python
"""Assemble the website payload in work/site-stage, laid out as on the server.
|
|
|
|
py scripts/stage_site.py
|
|
|
|
The server serves /var/www/lihont. Pages that live in folders (/lihonb, /members, /pay) are
|
|
index.html files there. Only files that belong to the site redesign are staged: the pages and
|
|
src/web/assets/site/{md3.css,md3.js,icons.svg}. Existing downloads, logos and the old
|
|
md3-theme.css (used by the member portal) are not touched.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import shutil
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
STAGE = ROOT / "work" / "site-stage"
|
|
|
|
# (source in the repository, path on the server relative to the web root)
|
|
PAYLOAD = [
|
|
("src/web/index.html", "index.html"),
|
|
("src/web/lihonb.html", "lihonb.html"),
|
|
("src/web/lihonb.html", "lihonb/index.html"),
|
|
("src/web/members_index.html", "members/index.html"),
|
|
("src/web/pay_index.html", "pay/index.html"),
|
|
("src/web/pet_index.html", "pet/index.html"),
|
|
("src/web/assets/pets/cat.png", "assets/pets/cat.png"),
|
|
("src/web/assets/pets/dog.png", "assets/pets/dog.png"),
|
|
("src/web/assets/pets/lion.png", "assets/pets/lion.png"),
|
|
("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"),
|
|
]
|
|
|
|
# The animals of the Серийчик: one strip of frames per animal, age and mood (see scripts/make_pet_designs.py)
|
|
for _strip in sorted((ROOT / "src" / "web" / "assets" / "pets" / "strips").glob("*.png")):
|
|
PAYLOAD.append((_strip.relative_to(ROOT).as_posix(), "assets/pets/strips/" + _strip.name))
|
|
|
|
# The avatar frames the mod downloads (see scripts/build_frames_catalog.py): the catalog and every sprite of every pack, at
|
|
# /frames/ on the site. A new pack is only the files of its folder: build the catalog, deploy, and phones pick it up by themselves.
|
|
_FRAMES = ROOT / "frames"
|
|
if (_FRAMES / "index.json").is_file():
|
|
PAYLOAD.append(("frames/index.json", "frames/index.json"))
|
|
for _sprite in sorted(_FRAMES.glob("*/*.png")):
|
|
PAYLOAD.append((_sprite.relative_to(ROOT).as_posix(), _sprite.relative_to(ROOT).as_posix()))
|
|
|
|
|
|
def main() -> int:
|
|
missing = [source for source, _ in PAYLOAD if not (ROOT / source).is_file()]
|
|
if missing:
|
|
print("Missing sources:\n " + "\n ".join(missing))
|
|
return 1
|
|
for source, target in PAYLOAD:
|
|
destination = STAGE / target
|
|
destination.parent.mkdir(parents=True, exist_ok=True)
|
|
shutil.copyfile(ROOT / source, destination)
|
|
print("Staged %d files in %s" % (len(PAYLOAD), STAGE))
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|