- サイドメニューの項目を整理
- notestockでusername,display_nameの片方が欠けていても動作するよう変更 - 某が/api/v1/instanceに200とエラーHTMLを返す問題の対策
This commit is contained in:
parent
4ce12590b5
commit
ff44caf652
|
@ -602,20 +602,29 @@ class SideMenuAdapter(
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
|
|
||||||
fun filterListItems() {
|
fun filterListItems(notify:Boolean=true) {
|
||||||
|
log.i("filterListItems notify=$notify")
|
||||||
list = originalList.filter {
|
list = originalList.filter {
|
||||||
when (it.itemType) {
|
when (it.itemType) {
|
||||||
ItemType.IT_NOTIFICATION_PERMISSION ->
|
ItemType.IT_NOTIFICATION_PERMISSION ->
|
||||||
notificationActionRecommend() != null
|
notificationActionRecommend() != null
|
||||||
|
|
||||||
|
ItemType.IT_NORMAL -> when (it.title) {
|
||||||
|
R.string.antenna_list_misskey,
|
||||||
|
R.string.misskey_hybrid_timeline_long,
|
||||||
|
-> PrefB.bpEnableDeprecatedSomething.value
|
||||||
|
|
||||||
|
else -> true
|
||||||
|
}
|
||||||
else -> true
|
else -> true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
notifyDataSetChanged()
|
if(notify) notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
actMain.applicationContext.checkVersion()
|
actMain.applicationContext.checkVersion()
|
||||||
filterListItems()
|
filterListItems(notify = false)
|
||||||
|
|
||||||
ListView(actMain).apply {
|
ListView(actMain).apply {
|
||||||
adapter = this@SideMenuAdapter
|
adapter = this@SideMenuAdapter
|
||||||
|
|
|
@ -477,9 +477,13 @@ open class TootAccount(
|
||||||
// notestock はActivityPub 準拠のサービスなので、サーバ内IDというのは特にない
|
// notestock はActivityPub 準拠のサービスなので、サーバ内IDというのは特にない
|
||||||
val id: EntityId = EntityId.DEFAULT
|
val id: EntityId = EntityId.DEFAULT
|
||||||
|
|
||||||
|
val tmpDisplayName = src.string("display_name")
|
||||||
|
val tmpUserName = src.string("username")
|
||||||
|
|
||||||
// notestockはdisplay_nameとusernameが入れ替わってる?
|
// notestockはdisplay_nameとusernameが入れ替わってる?
|
||||||
val username: String = src.stringOrThrow("display_name")
|
val username = tmpDisplayName ?: tmpUserName ?: error("missing username,displayname")
|
||||||
val display_name: String = src.stringOrThrow("username")
|
val display_name =
|
||||||
|
tmpUserName ?: tmpDisplayName ?: error("missing username,displayname")
|
||||||
|
|
||||||
val tmpAcct = src.string("subject")?.let { Acct.parse(it) }
|
val tmpAcct = src.string("subject")?.let { Acct.parse(it) }
|
||||||
val url: String? = src.string("url")
|
val url: String? = src.string("url")
|
||||||
|
|
|
@ -367,7 +367,7 @@ class TootInstance(parser: TootParser, src: JsonObject) {
|
||||||
val result = TootApiResult.makeWithCaption(apiHost)
|
val result = TootApiResult.makeWithCaption(apiHost)
|
||||||
if (result.error != null) return result
|
if (result.error != null) return result
|
||||||
|
|
||||||
if(!PrefB.bpEnableDeprecatedSomething.value){
|
if (!PrefB.bpEnableDeprecatedSomething.value) {
|
||||||
return result.setError(context.getString(R.string.misskey_support_end))
|
return result.setError(context.getString(R.string.misskey_support_end))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,13 +418,17 @@ class TootInstance(parser: TootParser, src: JsonObject) {
|
||||||
|
|
||||||
// 両方読めなかった場合
|
// 両方読めなかった場合
|
||||||
return when (r1.response?.code) {
|
return when (r1.response?.code) {
|
||||||
// Mastodon側が404を返したらMisskeyのエラー応答を返す
|
// /api/v1/instance が404を返したらMisskeyのエラー応答を返す
|
||||||
404 -> r2
|
404 -> r2
|
||||||
|
|
||||||
// Mastodonはホワイトリストモードの際に401を返す。
|
// /api/v1/instance 401を返すのはMastodonのホワイトリストモードだと思う
|
||||||
// Mastoronのエラー結果を返す。
|
// Mastoronのエラー結果を返す。
|
||||||
401 -> r1
|
401 -> r1
|
||||||
|
|
||||||
|
// /api/v1/instance が200を返すがJsonObjectではないのは、
|
||||||
|
// Misskeyサーバへの /api/meta にアクセスしない && Misskey は /api/v1/instance に200を返すから。
|
||||||
|
200 -> r2
|
||||||
|
|
||||||
// その他の場合
|
// その他の場合
|
||||||
// Mastoronのエラー結果を返す。
|
// Mastoronのエラー結果を返す。
|
||||||
else -> r1
|
else -> r1
|
||||||
|
|
|
@ -794,8 +794,10 @@ class TootStatus(
|
||||||
val apTag = APTag(parser, src.jsonArray("tag"))
|
val apTag = APTag(parser, src.jsonArray("tag"))
|
||||||
|
|
||||||
val who = parser.account(src.jsonObject("account"))
|
val who = parser.account(src.jsonObject("account"))
|
||||||
?: error("missing account")
|
if (who == null) {
|
||||||
val accountRef = TootAccountRef.tootAccountRef(parser, who)
|
error("missing account")
|
||||||
|
}
|
||||||
|
val accountRef = tootAccountRef(parser, who)
|
||||||
val account = accountRef.get()
|
val account = accountRef.get()
|
||||||
|
|
||||||
val uri = src.string("id") ?: error("missing uri")
|
val uri = src.string("id") ?: error("missing uri")
|
||||||
|
|
Loading…
Reference in New Issue