feat: bootstrap MusicManager with scanner and Subsonic auth
- Gradle/Kotlin/Ktor project on JVM 21 with ShadowJar - SQLite WAL, Flyway migrations and config-driven users/folders - deterministic IDs, MP3 tag extraction, cover cache and delta scanner - OpenSubsonic JSON envelope with token/password authentication - system endpoints: ping, license, extensions, scan status
This commit is contained in:
1 parent
961341b449
commit
e194badefb
45 files changed
+4079
-126
No files matched your search
@@ -0,0 +1,31 @@
|
||||
package win.taptap.musicmanager.subsonic.routes
|
||||
|
||||
import io.ktor.http.ContentType
|
||||
import io.ktor.http.HttpMethod
|
||||
import io.ktor.http.Parameters
|
||||
import io.ktor.server.application.ApplicationCall
|
||||
import io.ktor.server.request.contentType
|
||||
import io.ktor.server.request.httpMethod
|
||||
import io.ktor.server.request.receiveParameters
|
||||
import io.ktor.util.AttributeKey
|
||||
import win.taptap.musicmanager.config.UserAccount
|
||||
|
||||
val CurrentUserKey = AttributeKey<UserAccount>("musicmanager.currentUser")
|
||||
|
||||
/**
|
||||
* Unified parameter access for Subsonic: query parameters plus URL-encoded form
|
||||
* bodies (the `formPost` OpenSubsonic extension).
|
||||
*/
|
||||
suspend fun subsonicParameters(call: ApplicationCall): Parameters {
|
||||
val query = call.request.queryParameters
|
||||
if (call.request.httpMethod != HttpMethod.Post) return query
|
||||
|
||||
val contentType = call.request.contentType()
|
||||
if (!contentType.match(ContentType.Application.FormUrlEncoded)) return query
|
||||
|
||||
val form = call.receiveParameters()
|
||||
return Parameters.build {
|
||||
query.forEach { name, values -> values.forEach { append(name, it) } }
|
||||
form.forEach { name, values -> values.forEach { append(name, it) } }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user