INNER CODE UNIT · Python

htaccess_path

ivoyager/planetarium · web/post_export.py:86

    htaccess_path = EXPORT_DIR / HTACCESS
    if (not htaccess_path.is_file()
            or HTACCESS_GZIP_LINE not in htaccess_path.read_text(encoding="utf-8")):
        missing_files.append("the .htaccess in web/README.md")
    return missing_files


def add_splash_image(name):
    shutil.copyfile(SPLASH_IMAGE, EXPORT_DIR / SPLASH_IMAGE.name)
    worker_path = EXPORT_DIR / (name + ".service.worker.js")
    with open(worker_path, encoding="utf-8", newline="") as file:
        worker = file.read()
    match = re.search(r"^const CACHED_FILES = (\[.*?\]);", worker, flags=re.MULTILINE)
    if not match:
        sys.exit(f"ERROR: found no CACHED_FILES array in {worker_path}.")
    cached_files = json.loads(match.group(1))
    if SPLASH_IMAGE.name in cached_files:
        print(f"{worker_path.name}: CACHED_FILES already has {SPLASH_IMAGE.name}")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…