Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/homepage/commit/2faa78163a575ae507c5d2521c2c190a553efac8
You should set ROOT_URL correctly, otherwise the web may not work correctly.
2 changed files with
5 additions and
8 deletions
@ -5,7 +5,7 @@ import Icon from "./icon";
export default function OpenWeatherMap ( { options } ) {
const { data , error } = useSWR (
` /api/widgets/openweathermap?lat= ${ options . latitude } &lon= ${ options . longitude } &apiKey= ${ options . apiKey } &duration= ${ options . cache } `
` /api/widgets/openweathermap?lat= ${ options . latitude } &lon= ${ options . longitude } &apiKey= ${ options . apiKey } &duration= ${ options . cache } &units=${ options . units } `
) ;
if ( error ) {
@ -27,17 +27,14 @@ export default function OpenWeatherMap({ options }) {
if ( data . error ) {
return < div className = "order-last grow flex-none flex flex-row items-center justify-end" > < / div > ;
}
/ / O p e n W e a t h e r M a p r e t u r n s t e m p e r a t u r e i n K e l v i n s
var temp _c = data . main . temp - 273.15 ;
var temp _f = temp _c * 9 / 5 + 32 ;
return (
< div className = "order-last grow flex-none flex flex-row items-center justify-end" >
< Icon condition = { data . weather [ 0 ] . id } timeOfDay = { ( data . dt > data . sys . sunrise ) && ( data . dt < data . sys . sundown ) ? "day" : "night" } / >
< div className = "flex flex-col ml-3 text-left" >
< span className = "text-theme-800 dark:text-theme-200 text-sm" >
{ options. units === "metric" ? temp _c . toFixed ( 0 ) : temp _f . toFixed ( 0 ) } & deg ;
{ data. main . temp . toFixed ( 1 ) } & deg ;
< / span >
< span className = "text-theme-800 dark:text-theme-200 text-xs" > { data . weather [ 0 ] . description }< / span >
< span className = "text-theme-800 dark:text-theme-200 text-xs" > { data . weather [ 0 ] . description .charAt ( 0 ) . toUpperCase ( ) + data . weather [ 0 ] . description . slice ( 1 ) }< / span >
< / div >
< / div >
) ;
@ -1,9 +1,9 @@
import cachedFetch from "utils/cached-fetch" ;
export default async function handler ( req , res ) {
const { lat , lon , apiKey , duration } = req . query ;
const { lat , lon , apiKey , duration , units } = req . query ;
const api _url = ` https://api.openweathermap.org/data/2.5/weather?lat= ${ lat } &lon= ${ lon } &appid= ${ apiKey } `;
const api _url = ` https://api.openweathermap.org/data/2.5/weather?lat= ${ lat } &lon= ${ lon } &appid= ${ apiKey } &units=${ units } `;
res . send ( await cachedFetch ( api _url , duration ) ) ;
}