Skip to content

Commit

Permalink
Warn about old API url (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
hkalexling committed Mar 10, 2021
1 parent 3a82eff commit eec6ec6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/config.cr
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,23 @@ class Config
raise "Login is disabled, but default username is not set. " \
"Please set a default username"
end

# `Logger.default` is not available yet
Log.setup :debug
unless mangadex["api_url"] =~ /\/v2/
# `Logger.default` is not available yet
Log.setup :debug
Log.warn { "It looks like you are using the deprecated MangaDex API " \
"v1 in your config file. Please update it to " \
"https://api.mangadex.org/v2 to suppress this warning." }
mangadex["api_url"] = "https://api.mangadex.org/v2"
end
if mangadex["api_url"] =~ /\/api\/v2/
Log.warn { "It looks like you are using the outdated MangaDex API " \
"url (mangadex.org/api/v2) in your config file. Please " \
"update it to https://api.mangadex.org/v2 to suppress this " \
"warning." }
mangadex["api_url"] = "https://api.mangadex.org/v2"
end

mangadex["api_url"] = mangadex["api_url"].to_s.rstrip "/"
mangadex["base_url"] = mangadex["base_url"].to_s.rstrip "/"
end
Expand Down

0 comments on commit eec6ec6

Please sign in to comment.