Commit graph

34 commits

Author SHA1 Message Date
006e05a375 fix(blogs): register controller endpoints via MapControllers
All [ApiController] classes (BlogApi, BlogTags, PostTags, FileSystem,
FileSystemStream, Comments, TagsApi) returned 404 on every route,
even though Kestrel was up. The pipeline in Program.cs was missing
MapControllers(), so the controllers were never attached to the
endpoint data source. MapIdentityApi and MapGet("/identity")
worked because they're explicit minimal-API routes; the attribute-
routed controllers didn't.

Confirmed end-to-end: GET /api/v1/blog now returns 401 (auth
required by [Authorize("BlogScope")]) instead of 404.
2026-07-07 21:48:02 +01:00
6d222cf819 fix(blogs): accept JSON on POST /api/v1/blog (no file)
BlogApiController.PostBlog called Request.Form.Files
unconditionally, which throws on a plain JSON body — the
exception is "This request does not have a Content-Type header.
Forms are available from requests with bodies like POSTs and a
form Content-Type of either application/x-www-form-urlencoded or
multipart/form-data."

That broke PostIt's first-bill-of-blog flow: the client posts a
BlogPost as JSON and has no files to attach. The endpoint
contract is [FromBody] BlogPost, so the JSON body is deserialised
into 'blog' as expected — only the IFormFileCollection argument
to BlogSpotService.Create needs a real-or-empty value.

Branch on Request.HasFormContentType: pass the form files when
present, pass an empty FormFileCollection otherwise. BlogSpotService
already short-circuits on a null/empty file collection, so the
JSON-only path is now a clean code path.

Tests: add PostBlog_creates_a_post_and_Get_returns_it_in_the_list
(POST a draft, assert 201 + server-assigned Id, GET the index,
assert exactly one entry with that Id). Add a per-test
ResetDatabase helper because the in-memory store is shared across
the lifetime of the BlogsWebServerFixture instance.
2026-07-06 22:03:41 +01:00
0d2d4160af PostIt: fix blog API double-prefix; drop redundant New
BlogApiClient's "api/blog" path combined with the BaseAddress's
"api/v1/" prefix to produce 404s on every call. Drop the redundant
"api/" segment, let Save handle the create case (no selection) and
remove the now-redundant New button + command.
2026-07-06 20:58:58 +01:00
1d26cbdf3d refacto chathub 2026-07-04 15:28:07 +01:00
1751145be8 Exploiting GitVersion 2026-06-28 14:11:26 +01:00
234c837937 drop baked-in Kestrel:Endpoints:Https from Yavsc.Blogs / Yavsc.Api
Both appsettings-blogs.json and appsettings-api.json shipped a
Kestrel:Endpoints:Https block pointing at https://localhost:3003
and https://localhost:3004 respectively. These are leftover dev
templates that don't match the production ports (5004/5005 for
Blogs, 5002/5003 for Api) and crash Kestrel at startup when no
cert is configured for those URLs.

docker-compose.yaml now sets ASPNETCORE_URLS explicitly per
service runtime (http://+:5000/5002/5004 + ASPNETCORE_HTTPS_PORT=empty),
which is the authoritative source for the binding. The baked
Kestrel block in the appsettings overrides nothing useful and
just blocks HTTP-only startup.

Search confirms no source code references localhost:3003/3004
(grep across src/*.{cs,json,axaml,cshtml} returns only the two
lines we just deleted), so removing the block is safe.
2026-06-27 17:36:57 +01:00
f3a3b63595 WIP PostIt login 2026-06-25 00:08:25 +01:00
2dec799d71 Introduce Yavsc.Interfaces.ISmtpClient and a recording test fake
Narrow ISmtpClient to the four operations MailSender actually uses,
behind a Yavsc.Interfaces.ISmtpClientFactory. Production wires
MailKitSmtpClient (SmtpClientFactory); tests wire a recording fake
(RecordingSmtpClientFactory). The fake is pre-registered in
WebServerFixture so SMTP calls are short-circuited; the EMailling
test now asserts the Connect -> Authenticate -> Send -> Disconnect
sequence. Yavsc.Abstract stays free of MailKit/MimeKit.
2026-06-22 02:09:02 +01:00
b2a35b60ce petite factorisation 2026-06-20 18:43:01 +01:00
86c268eebd deploying the blogs 2026-06-19 23:09:43 +01:00
4398715004 reinstall fixes and reorg 2026-06-19 21:13:17 +01:00
148f333b36 do not override appsettings-*.*.json 2026-06-19 16:18:39 +01:00
dcf2a93ad0 Split Site:Audience into Site:ExternalUrl + Site:CorsAllowedOrigins
The Site:Audience setting was conflating two distinct concepts: an OAuth
JWT audience (a single resource identifier) and a CORS allow-list (an
array of origins). Collapsing them caused several latent bugs:
- OAuth/JWT validation expected a single string while CORS WithOrigins
  accepts an array.
- Password-reset callback URLs and OAuth client RedirectUri/Origin were
  being built from what was meant to be an audience identifier, not a
  base URL.
- Yavsc.Org's main CORS policy was hardcoded to '*', with no way to
  restrict it without code changes.

Changes:
- SiteSettings.Audience (string) replaced with CorsAllowedOrigins
  (IList<string>).
- OAuth JWT Authority still reads Site:Authority; Audience now reads
  Site:ExternalUrl (Org only; Api/Blogs use ValidateAudience=false).
- MailSender and AccountController build reset-callback URLs from
  Site:ExternalUrl.
- ClientController uses Site:ExternalUrl for OAuth RedirectUri/Origin
  defaults on newly created clients.
- Yavsc.Api and Yavsc.Blogs now read CORS origins from
  Site:CorsAllowedOrigins instead of hardcoded URLs.

Add shared AddYavscCors / AddYavscJwtBearer extension methods in
Yavsc.Server/Helpers/ServiceExtensions.cs to enforce a single
configuration contract across all runtime services (Api, Blogs, Org).
Fails closed when CorsAllowedOrigins is empty; fails fast at startup
when Site:Authority is missing.

Remove obsolete ConfigurationHelpers.GetAudience (no remaining callers).

Local appsettings-*.json files (which carry deployment-specific values
and are gitignored) must be updated to add Site:CorsAllowedOrigins.
2026-06-19 13:15:21 +01:00
508c74f3e4 cleanup 2026-06-19 02:17:07 +01:00
c1f4d19975 fices the UI 2026-06-15 02:55:22 +01:00
5c6d6ee687 refactoring 2026-06-15 00:33:38 +01:00
aabbbc1fea use the helper 2026-06-15 00:11:48 +01:00
e137c3e2ff Fixes the UI testing wwwroot 2026-06-14 20:05:01 +01:00
9415521bcb WIP: refactoring pour déploiement
Non testé en conditions réelles. À valider avant de pousser.
2026-06-14 12:17:03 +01:00
root
198d5bc202 cd contrib; make reinstall 2026-06-13 20:57:30 +01:00
1a0556695c Login settings 2026-06-10 16:59:23 +01:00
fa7d6242f1 postit and them also 2026-06-10 00:23:17 +01:00
57adfc82a5 Start protecting the Api 2026-06-06 21:30:41 +01:00
80144bf9fc refacts, and launching Blogs 2026-06-04 22:04:20 +01:00
e24208e77b refact 2026-05-30 19:34:22 +01:00
95dec3636a Use InMemory db driver at testing 2026-05-28 22:18:26 +01:00
3b4376a5f0 repo refs 2026-05-24 20:55:29 +01:00
6cc0c519d2 tests OK 2026-04-20 00:35:51 +01:00
e1ad899158 Modernization 2026-04-19 17:23:18 +01:00
Paul Schneider
e042e34bf7 refact and login 2026-03-09 02:07:42 +00:00
Paul Schneider
cbd5822fa2 diable nullable 2026-03-01 17:25:25 +00:00
Paul Schneider
93f0c2d25e cleanup 2026-03-01 14:09:10 +00:00
Paul Schneider
bfb37bc214 Blog Files model 2026-03-01 02:13:26 +00:00
Paul Schneider
40e8e08690 reorg 2026-02-28 21:17:54 +00:00