diff --git a/src/main/kotlin/de/fabianonline/telegram_backup/IniSettings.kt b/src/main/kotlin/de/fabianonline/telegram_backup/IniSettings.kt index 2d96006..8f811fb 100644 --- a/src/main/kotlin/de/fabianonline/telegram_backup/IniSettings.kt +++ b/src/main/kotlin/de/fabianonline/telegram_backup/IniSettings.kt @@ -51,5 +51,10 @@ object IniSettings { fun println() = println(settings) + fun get(key: String, default: String? = null): String? = settings.get(key)?.last() ?: default + fun getInt(key: String, default: Int? = null): Int? = try { settings.get(key)?.last()?.toInt() } catch (e: NumberFormatException) { null } ?: default + fun getArray(key: String): List = settings.get(key) ?: listOf() + val gmaps_key: String + get() = get("gmaps_key", default=Config.SECRET_GMAPS)!! } diff --git a/src/main/kotlin/de/fabianonline/telegram_backup/mediafilemanager/GeoFileManager.kt b/src/main/kotlin/de/fabianonline/telegram_backup/mediafilemanager/GeoFileManager.kt index 15726c8..67c5647 100644 --- a/src/main/kotlin/de/fabianonline/telegram_backup/mediafilemanager/GeoFileManager.kt +++ b/src/main/kotlin/de/fabianonline/telegram_backup/mediafilemanager/GeoFileManager.kt @@ -21,7 +21,7 @@ import de.fabianonline.telegram_backup.Database import de.fabianonline.telegram_backup.StickerConverter import de.fabianonline.telegram_backup.DownloadProgressInterface import de.fabianonline.telegram_backup.DownloadManager -import de.fabianonline.telegram_backup.Config +import de.fabianonline.telegram_backup.IniSettings import com.github.badoualy.telegram.api.TelegramClient import com.github.badoualy.telegram.tl.core.TLIntVector @@ -76,7 +76,7 @@ class GeoFileManager(msg: TLMessage, user: UserManager, client: TelegramClient) val url = "https://maps.googleapis.com/maps/api/staticmap?" + "center=" + geo.getLat() + "," + geo.getLong() + "&" + "zoom=14&size=300x150&scale=2&format=png&" + - "key=" + Config.SECRET_GMAPS + "key=" + IniSettings.gmaps_key return DownloadManager.downloadExternalFile(targetPathAndFilename, url) } }