feat: Login

This commit is contained in:
2025-02-21 14:44:48 +03:00
commit dc588a045d
56 changed files with 1677 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
/*
* Created by sweetbread on 21.02.2025, 12:01
* Copyright (c) 2025. All rights reserved.
* Last modified 21.02.2025, 12:01
*/
package ru.risdeveau.pixeldragon.api
import io.ktor.client.request.get
import io.ktor.client.statement.bodyAsText
import org.json.JSONException
import org.json.JSONObject
import ru.risdeveau.pixeldragon.client
suspend fun isMatrixServer(url: String): Boolean {
val r = try { client.get("https://$url/.well-known/matrix/client") }
catch (_: Exception) { return false }
try { JSONObject(r.bodyAsText()) }
catch (_: JSONException) { return false }
return true
}