JsonConfig: prepare for module weather and public ip

This commit is contained in:
李通洲
2023-08-18 13:28:07 +08:00
parent 55b9e274b6
commit 77e0d9dba1
6 changed files with 63 additions and 14 deletions
+6
View File
@@ -19,6 +19,12 @@ static inline void wrapYyjsonFree(yyjson_doc** doc)
void ffPreparePublicIp(FFPublicIpOptions* options)
{
if (status != -1)
{
fputs("Error: " FF_PUBLICIP_DISPLAY_NAME " can only be used once due to internal limitations\n", stderr);
exit(1);
}
if (options->url.length == 0)
status = ffNetworkingSendHttpRequest(&state, "ipinfo.io", "/json", NULL);
else
+6
View File
@@ -11,6 +11,12 @@ static int status = -1;
void ffPrepareWeather(FFWeatherOptions* options)
{
if (status != -1)
{
fputs("Error: " FF_WEATHER_MODULE_NAME " can only be used once due to internal limitations\n", stderr);
exit(1);
}
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreateS("/");
if (options->location.length)
ffStrbufAppend(&path, &options->location);