Skip to content

Commit eec6ec6

Browse files
committed
Warn about old API url (#174)
1 parent 3a82eff commit eec6ec6

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/config.cr

+11-2
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,23 @@ class Config
9393
raise "Login is disabled, but default username is not set. " \
9494
"Please set a default username"
9595
end
96+
97+
# `Logger.default` is not available yet
98+
Log.setup :debug
9699
unless mangadex["api_url"] =~ /\/v2/
97-
# `Logger.default` is not available yet
98-
Log.setup :debug
99100
Log.warn { "It looks like you are using the deprecated MangaDex API " \
100101
"v1 in your config file. Please update it to " \
101102
"https://api.mangadex.org/v2 to suppress this warning." }
102103
mangadex["api_url"] = "https://api.mangadex.org/v2"
103104
end
105+
if mangadex["api_url"] =~ /\/api\/v2/
106+
Log.warn { "It looks like you are using the outdated MangaDex API " \
107+
"url (mangadex.org/api/v2) in your config file. Please " \
108+
"update it to https://api.mangadex.org/v2 to suppress this " \
109+
"warning." }
110+
mangadex["api_url"] = "https://api.mangadex.org/v2"
111+
end
112+
104113
mangadex["api_url"] = mangadex["api_url"].to_s.rstrip "/"
105114
mangadex["base_url"] = mangadex["base_url"].to_s.rstrip "/"
106115
end

0 commit comments

Comments
 (0)