fix: Provide v2/instance configuration defaults (#474)
Some servers don't include a `urls` or `translation` block, which was preventing parsing of the block, and falling back to the v1 instance data. Fix this by providing sensible defaults.
This commit is contained in:
parent
486acecfe7
commit
f5d90081ff
|
@ -101,8 +101,9 @@ data class ThumbnailVersions(
|
||||||
|
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
data class Configuration(
|
data class Configuration(
|
||||||
|
// May be missing (e.g., Friendica), so provide a default
|
||||||
/** URLs of interest for clients apps. */
|
/** URLs of interest for clients apps. */
|
||||||
val urls: InstanceV2Urls,
|
val urls: InstanceV2Urls = InstanceV2Urls(),
|
||||||
|
|
||||||
/** Limits related to accounts. */
|
/** Limits related to accounts. */
|
||||||
val accounts: InstanceV2Accounts,
|
val accounts: InstanceV2Accounts,
|
||||||
|
@ -116,8 +117,9 @@ data class Configuration(
|
||||||
/** Limits related to polls. */
|
/** Limits related to polls. */
|
||||||
val polls: InstanceV2Polls,
|
val polls: InstanceV2Polls,
|
||||||
|
|
||||||
|
// May be missing, so provide a default
|
||||||
/** Hints related to translation. */
|
/** Hints related to translation. */
|
||||||
val translation: InstanceV2Translation,
|
val translation: InstanceV2Translation = InstanceV2Translation(enabled = false),
|
||||||
)
|
)
|
||||||
|
|
||||||
@JsonClass(generateAdapter = true)
|
@JsonClass(generateAdapter = true)
|
||||||
|
|
Loading…
Reference in New Issue