<?php

if (!function_exists('isLegacy')) {
    /**
     * Checks if the current hostname should return the legacy site
     * @return bool
     */
    function isLegacy(): bool {
        return (
            request()->getHost() === "legacy.wah.moe" ||        // Accessed via legacy.wah.moe domain
            str_starts_with(request()->getHost(), "192.168") || // Accessed via local IP address
            !request()->hasHeader("Host")                  // Browser does not send Host header (e.g. NCSA MOSAIC)
        );
    }
}
