Skip to content

Commit

Permalink
change location info api
Browse files Browse the repository at this point in the history
  • Loading branch information
Epifanov Aleksandr Sergeevich committed Dec 9, 2024
1 parent ab568da commit 919104d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ccal.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.4.5"
version = "0.4.6"
author = "inv2004"
description = "calendar with local holidays via ip location"
license = "MIT"
Expand Down
4 changes: 2 additions & 2 deletions src/ccal.nim
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import hashes
const NimblePkgVersion {.strdefine.} = "Unknown"
const APP = "ccal"
const ONE_DAY = initDuration(days = 1)
const IP_INFO_URL = "https://ipinfo.io"
const IP_INFO_URL = "http://ip-api.com/json"
const HOLIDAYS_URL = "https://date.nager.at/api/v3/PublicHolidays"
const LOW_YEAR = 100
const DEFAULT_FG_COLOR = if defined(windows): fgWhite else: fgDefault
Expand Down Expand Up @@ -114,7 +114,7 @@ proc fetchJson(url: string): JsonNode =
proc cacheHolidays(cacheDir: string, country: string, year: int): string =
result = country
if result == "":
result = fetchJson(IP_INFO_URL)["country"].getStr().toLower()
result = fetchJson(IP_INFO_URL)["countryCode"].getStr().toLower()
let json = fetchJson(fmt"{HOLIDAYS_URL}/{year}/{result}")
if json.getElems().len == 0:
return ""
Expand Down

0 comments on commit 919104d

Please sign in to comment.