From: Stephen Jianu Date: Sun, 23 Mar 2025 21:09:03 +0000 (-0500) Subject: Rebrand this fork as reasonableweather and remove relative functionality X-Git-Url: https://stephenjianu.com/gitweb/?a=commitdiff_plain;h=7023532fdfb3ec7e973862773cdb1424120342c8;p=reasonableweather.git Rebrand this fork as reasonableweather and remove relative functionality --- diff --git a/README.md b/README.md index 0771df3..2027c4e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# relativeweather -This is a simple joke website that pulls a 7 day forecast for Park Ridge, IL where every temperature is relative to the current temperature. It uses the Open-Meteo API. +# reasonableweather +This is a simple website that pulls a 7 day forecast for Park Ridge, IL. It uses the Open-Meteo API. ### Requirements * A web server (tested with Apache) @@ -10,7 +10,7 @@ This is a simple joke website that pulls a 7 day forecast for Park Ridge, IL whe Instead of spinning up a web server with PHP yourself, you can opt to run the Docker container. Here is an example: ``` -docker run -d -p 6969:80 --restart=unless-stopped --name relativeweather registry.services.jianu.house/relativeweather +docker run -d -p 6969:80 --restart=unless-stopped --name reasonableweather registry.services.jianu.house/reasonableweather ``` ### Credits diff --git a/index.php b/index.php index 5234054..e9304c3 100644 --- a/index.php +++ b/index.php @@ -7,7 +7,6 @@ echo "\n"; echo "

The current conditions in Park Ridge are:

\n"; echo "

\n"; - $relative = (strcmp($_GET["relative"], "false") == 0) ? false : true; $url = "https://api.open-meteo.com/v1/forecast?latitude=42.0111&longitude=-87.8406&daily=temperature_2m_max,temperature_2m_min,weather_code¤t=temperature_2m,weather_code,is_day&timezone=America%2FChicago&wind_speed_unit=mph&temperature_unit=fahrenheit&precipitation_unit=inch"; $json = json_decode(file_get_contents($url), true); $jsonDescriptions = json_decode(file_get_contents("descriptions.json"), true); @@ -15,10 +14,7 @@ $isDay = ($json["current"]["is_day"]) ? "day" : "night"; $description = $jsonDescriptions[$code][$isDay]["description"]; $image = $jsonDescriptions[$code][$isDay]["image"]; - if ($relative) - echo "
".$description."
"."0°\n"; - else - echo "
".$description."
".$json["current"]["temperature_2m"]."° F\n"; + echo "
".$description."
".$json["current"]["temperature_2m"]."° F\n"; echo "

\n"; echo "

Your 7 day forecast for Park Ridge is:

\n"; $tempNow = $json["current"]["temperature_2m"]; @@ -27,28 +23,19 @@ $description = $jsonDescriptions[$code]["day"]["description"]; $image = $jsonDescriptions[$code]["day"]["image"]; $tempHigh = $json["daily"]["temperature_2m_max"][$i]; - $tempHighConverted = $tempHigh - $tempNow; $tempLow = $json["daily"]["temperature_2m_min"][$i]; - $tempLowConverted = $tempLow - $tempNow; echo "
\n"; echo "

\n"; echo "".date('l', strtotime($json["daily"]["time"][$i]))."
\n"; echo "

\n"; echo "".$description."
\n"; - if ($relative) - echo "High: ".$tempHighConverted."°\n"; - else - echo "High: ".$tempHigh."° F\n"; + echo "High: ".$tempHigh."° F\n"; echo "
\n"; - if ($relative) - echo "Low: ".$tempLowConverted."°\n"; - else - echo "Low: ".$tempLow."° F\n"; + echo "Low: ".$tempLow."° F\n"; echo "
\n"; } - echo "

\n"; - if ($relative) - echo "This site uses the MJM weather system, the most accurate weather system in the world, for measuring temperature. We source our weather from the National Weather Service and give you pure, unmodified data.\n"; + echo "

\n"; + echo "Weather data by Open-Meteo.com\n"; echo "\n"; echo "\n"; ?>