3fc7bf2b97
Build backend images / build content-svc (push) Failing after 3m39s
Build backend images / build file-svc (push) Failing after 52s
Build backend images / build gateway (push) Failing after 58s
Build backend images / build identity-svc (push) Failing after 1m21s
Build backend images / build notification-svc (push) Failing after 1m0s
Build backend images / build render-svc (push) Failing after 58s
Build backend images / build studio-svc (push) Failing after 55s
AI SEO content generator - content-svc: per-tenant OpenAI config (ai_settings) + /v1/ai endpoints (settings GET/PUT, seo-post) with SEO-expert prompt → structured article - admin UI to configure token/base-url/model and generate + save as blog - configurable base URL for restricted networks Full data-driven admin panel - generic /api/admin/resource proxy + reusable AdminResource component - categories/tags/fonts/blogs (CRUD), users (list + ban), plans/slides - AI content section; nav + i18n i18n localization sweep - localized 116 user-facing + studio/editor components to next-intl (fa+en) under the auto.* namespace; merge tooling in scripts/merge-i18n.js Branding + assets - Monoline F logo (LogoMark + favicon) - offline SVG placeholder generator (/api/placeholder), dropped picsum.photos Fixes - JWT issuer mismatch on content/studio (flatrender → flatrender-identity) - missing role claim → [Authorize(Roles="Admin")] now works (RBAC) - Secure cookies broke HTTP sessions → gated behind AUTH_COOKIE_SECURE - Radix RTL via DirectionProvider (right-aligned menus in fa) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
52 lines
1.7 KiB
C#
52 lines
1.7 KiB
C#
using System.Security.Claims;
|
|
using FlatRender.ContentSvc.Application.Services;
|
|
using FlatRender.ContentSvc.Models;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace FlatRender.ContentSvc.Controllers;
|
|
|
|
[ApiController]
|
|
[Route("v1/ai")]
|
|
[Authorize]
|
|
public class AiController(AiContentService svc) : ControllerBase
|
|
{
|
|
private Guid TenantId =>
|
|
Guid.TryParse(User.FindFirstValue("tenant_id"), out var t) ? t : AiContentService.DefaultTenant;
|
|
|
|
private bool IsAdmin =>
|
|
string.Equals(User.FindFirstValue("is_admin"), "true", StringComparison.OrdinalIgnoreCase) ||
|
|
string.Equals(User.FindFirstValue("is_tenant_admin"), "true", StringComparison.OrdinalIgnoreCase);
|
|
|
|
[HttpGet("settings")]
|
|
public async Task<IActionResult> GetSettings()
|
|
{
|
|
if (!IsAdmin) return Forbidden();
|
|
return Ok(await svc.GetSettingsAsync(TenantId));
|
|
}
|
|
|
|
[HttpPut("settings")]
|
|
public async Task<IActionResult> UpdateSettings([FromBody] UpdateAiSettingsRequest req)
|
|
{
|
|
if (!IsAdmin) return Forbidden();
|
|
return Ok(await svc.UpdateSettingsAsync(TenantId, req));
|
|
}
|
|
|
|
[HttpPost("seo-post")]
|
|
public async Task<IActionResult> GenerateSeoPost([FromBody] GenerateSeoPostRequest req, CancellationToken ct)
|
|
{
|
|
if (!IsAdmin) return Forbidden();
|
|
try
|
|
{
|
|
return Ok(await svc.GenerateSeoPostAsync(TenantId, req, ct));
|
|
}
|
|
catch (AiConfigException ex)
|
|
{
|
|
return BadRequest(new { error = new { code = "ai_error", message = ex.Message } });
|
|
}
|
|
}
|
|
|
|
private IActionResult Forbidden() =>
|
|
StatusCode(403, new { error = new { code = "forbidden", message = "Admin access required." } });
|
|
}
|