Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/KitsuneCommand/Web/OwinStartup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,16 @@ public void Configuration(IAppBuilder app)

config.EnsureInitialized();

app.UseAutofacMiddleware(_container);
app.UseAutofacWebApi(config);
// NOTE: deliberately NOT using app.UseAutofacMiddleware / app.UseAutofacWebApi.
// Those register Autofac.Integration.Owin's per-request lifetime-scope injector,
// which disposes the scope with `await using` → IAsyncDisposable.DisposeAsync().
// 7D2D's Mono runtime does not implement that method, so it throws
// MissingMethodException at JIT in front of the whole pipeline — taking down EVERY
// /api/* request on Linux/Mono. Web API's own AutofacWebApiDependencyResolver (set
// above) creates and disposes the per-request lifetime scope SYNCHRONOUSLY via
// IDisposable.Dispose(), which Mono has. InstancePerRequest registrations still
// resolve correctly (same RequestLifetimeScopeTag). Do not re-add the injector
// without confirming Mono gained IAsyncDisposable support.
app.UseWebApi(config);
}
}
Expand Down
5 changes: 4 additions & 1 deletion src/KitsuneCommand/Web/WebServerHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,10 @@ private void HandleLogin(HttpListenerContext ctx)
body = reader.ReadToEnd();

var loginReq = JsonConvert.DeserializeObject<LoginPayload>(body);
string username = loginReq?.username;
// Normalize to match how accounts are stored: UserController.Create lowercases +
// trims the username, and SQLite compares TEXT case-sensitively. Without this, a
// username created/typed as "KCAdmin" is stored "kcadmin" and never matches at login.
string username = loginReq?.username?.Trim().ToLowerInvariant();
string password = loginReq?.password;

if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password))
Expand Down
Loading