fix: erros
All checks were successful
BCards Deployment Pipeline / Run Tests (push) Successful in 2s
BCards Deployment Pipeline / PR Validation (push) Has been skipped
BCards Deployment Pipeline / Build and Push Image (push) Successful in 8m0s
BCards Deployment Pipeline / Deploy to Production (ARM - OCI) (push) Successful in 2m25s
BCards Deployment Pipeline / Deploy to Staging (x86 - Local) (push) Has been skipped
BCards Deployment Pipeline / Cleanup Old Resources (push) Has been skipped
BCards Deployment Pipeline / Deployment Summary (push) Successful in 0s
All checks were successful
BCards Deployment Pipeline / Run Tests (push) Successful in 2s
BCards Deployment Pipeline / PR Validation (push) Has been skipped
BCards Deployment Pipeline / Build and Push Image (push) Successful in 8m0s
BCards Deployment Pipeline / Deploy to Production (ARM - OCI) (push) Successful in 2m25s
BCards Deployment Pipeline / Deploy to Staging (x86 - Local) (push) Has been skipped
BCards Deployment Pipeline / Cleanup Old Resources (push) Has been skipped
BCards Deployment Pipeline / Deployment Summary (push) Successful in 0s
This commit is contained in:
parent
aea64c0b8e
commit
9406997316
@ -60,16 +60,42 @@ public class PageStatusMiddleware
|
|||||||
case PageStatus.Rejected:
|
case PageStatus.Rejected:
|
||||||
// Páginas em desenvolvimento/moderação requerem preview token
|
// Páginas em desenvolvimento/moderação requerem preview token
|
||||||
var previewToken = context.Request.Query["preview"].FirstOrDefault();
|
var previewToken = context.Request.Query["preview"].FirstOrDefault();
|
||||||
if (string.IsNullOrEmpty(previewToken) ||
|
|
||||||
string.IsNullOrEmpty(page.PreviewToken) ||
|
_logger.LogInformation($"Page {category}/{slug} (Status: {page.Status}) - Token provided: {!string.IsNullOrEmpty(previewToken)}, Page token: {!string.IsNullOrEmpty(page.PreviewToken)}, Expiry: {page.PreviewTokenExpiry}");
|
||||||
previewToken != page.PreviewToken ||
|
|
||||||
page.PreviewTokenExpiry < DateTime.UtcNow)
|
if (string.IsNullOrEmpty(previewToken))
|
||||||
{
|
{
|
||||||
_logger.LogInformation($"Page {category}/{slug} requires valid preview token");
|
_logger.LogInformation($"Page {category}/{slug} requires preview token - no token provided");
|
||||||
context.Response.StatusCode = 404;
|
context.Response.StatusCode = 404;
|
||||||
await context.Response.WriteAsync("Página em desenvolvimento. Acesso restrito.");
|
await context.Response.WriteAsync("Página em desenvolvimento. Acesso restrito.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(page.PreviewToken))
|
||||||
|
{
|
||||||
|
_logger.LogWarning($"Page {category}/{slug} has no preview token set in database");
|
||||||
|
context.Response.StatusCode = 404;
|
||||||
|
await context.Response.WriteAsync("Página em desenvolvimento. Acesso restrito.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (previewToken != page.PreviewToken)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"Page {category}/{slug} preview token mismatch - provided: {previewToken}, expected: {page.PreviewToken}");
|
||||||
|
context.Response.StatusCode = 404;
|
||||||
|
await context.Response.WriteAsync("Página em desenvolvimento. Acesso restrito.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (page.PreviewTokenExpiry < DateTime.UtcNow)
|
||||||
|
{
|
||||||
|
_logger.LogInformation($"Page {category}/{slug} preview token expired at {page.PreviewTokenExpiry} (now: {DateTime.UtcNow})");
|
||||||
|
context.Response.StatusCode = 404;
|
||||||
|
await context.Response.WriteAsync("Token de preview expirado. Gere um novo token no painel.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_logger.LogInformation($"Page {category}/{slug} preview token validated successfully");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PageStatus.Active:
|
case PageStatus.Active:
|
||||||
|
|||||||
@ -564,8 +564,8 @@ app.UseAuthorization();
|
|||||||
app.UseMiddleware<SmartCacheMiddleware>();
|
app.UseMiddleware<SmartCacheMiddleware>();
|
||||||
app.UseMiddleware<AuthCacheMiddleware>();
|
app.UseMiddleware<AuthCacheMiddleware>();
|
||||||
app.UseMiddleware<PlanLimitationMiddleware>();
|
app.UseMiddleware<PlanLimitationMiddleware>();
|
||||||
app.UseMiddleware<PageStatusMiddleware>();
|
|
||||||
app.UseMiddleware<PreviewTokenMiddleware>();
|
app.UseMiddleware<PreviewTokenMiddleware>();
|
||||||
|
app.UseMiddleware<PageStatusMiddleware>();
|
||||||
app.UseMiddleware<ModerationAuthMiddleware>();
|
app.UseMiddleware<ModerationAuthMiddleware>();
|
||||||
|
|
||||||
if (app.Environment.IsDevelopment())
|
if (app.Environment.IsDevelopment())
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using BCards.Web.Models;
|
using BCards.Web.Models;
|
||||||
|
using MongoDB.Bson;
|
||||||
using MongoDB.Driver;
|
using MongoDB.Driver;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
@ -265,6 +266,7 @@ public class ThemeService : IThemeService
|
|||||||
{
|
{
|
||||||
new PageTheme
|
new PageTheme
|
||||||
{
|
{
|
||||||
|
Id = ObjectId.GenerateNewId().ToString(),
|
||||||
Name = "Minimalista",
|
Name = "Minimalista",
|
||||||
PrimaryColor = "#2563eb",
|
PrimaryColor = "#2563eb",
|
||||||
SecondaryColor = "#1d4ed8",
|
SecondaryColor = "#1d4ed8",
|
||||||
@ -275,6 +277,7 @@ public class ThemeService : IThemeService
|
|||||||
},
|
},
|
||||||
new PageTheme
|
new PageTheme
|
||||||
{
|
{
|
||||||
|
Id = ObjectId.GenerateNewId().ToString(),
|
||||||
Name = "Dark Mode",
|
Name = "Dark Mode",
|
||||||
PrimaryColor = "#10b981",
|
PrimaryColor = "#10b981",
|
||||||
SecondaryColor = "#059669",
|
SecondaryColor = "#059669",
|
||||||
@ -285,6 +288,7 @@ public class ThemeService : IThemeService
|
|||||||
},
|
},
|
||||||
new PageTheme
|
new PageTheme
|
||||||
{
|
{
|
||||||
|
Id = ObjectId.GenerateNewId().ToString(),
|
||||||
Name = "Natureza",
|
Name = "Natureza",
|
||||||
PrimaryColor = "#16a34a",
|
PrimaryColor = "#16a34a",
|
||||||
SecondaryColor = "#15803d",
|
SecondaryColor = "#15803d",
|
||||||
@ -296,6 +300,7 @@ public class ThemeService : IThemeService
|
|||||||
},
|
},
|
||||||
new PageTheme
|
new PageTheme
|
||||||
{
|
{
|
||||||
|
Id = ObjectId.GenerateNewId().ToString(),
|
||||||
Name = "Corporativo",
|
Name = "Corporativo",
|
||||||
PrimaryColor = "#1e40af",
|
PrimaryColor = "#1e40af",
|
||||||
SecondaryColor = "#1e3a8a",
|
SecondaryColor = "#1e3a8a",
|
||||||
@ -306,6 +311,7 @@ public class ThemeService : IThemeService
|
|||||||
},
|
},
|
||||||
new PageTheme
|
new PageTheme
|
||||||
{
|
{
|
||||||
|
Id = ObjectId.GenerateNewId().ToString(),
|
||||||
Name = "Vibrante",
|
Name = "Vibrante",
|
||||||
PrimaryColor = "#dc2626",
|
PrimaryColor = "#dc2626",
|
||||||
SecondaryColor = "#b91c1c",
|
SecondaryColor = "#b91c1c",
|
||||||
@ -326,6 +332,7 @@ public class ThemeService : IThemeService
|
|||||||
{
|
{
|
||||||
return new PageTheme
|
return new PageTheme
|
||||||
{
|
{
|
||||||
|
Id = ObjectId.GenerateNewId().ToString(),
|
||||||
Name = "Padrão",
|
Name = "Padrão",
|
||||||
PrimaryColor = "#2563eb",
|
PrimaryColor = "#2563eb",
|
||||||
SecondaryColor = "#1d4ed8",
|
SecondaryColor = "#1d4ed8",
|
||||||
|
|||||||
@ -572,13 +572,13 @@
|
|||||||
<!-- Seção para Link Normal -->
|
<!-- Seção para Link Normal -->
|
||||||
<div id="normalLinkSection">
|
<div id="normalLinkSection">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="linkTitle" class="form-label">Título do Link</label>
|
<label for="linkTitle" class="form-label">Título do Link <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="linkTitle" placeholder="Ex: Meu Site, Portfólio, Instagram..." required>
|
<input type="text" class="form-control" id="linkTitle" placeholder="Ex: Meu Site, Portfólio, Instagram..." required>
|
||||||
<div class="form-text">Nome que aparecerá no botão</div>
|
<div class="form-text">Nome que aparecerá no botão</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="linkUrl" class="form-label">URL</label>
|
<label for="linkUrl" class="form-label">URL <span class="text-danger">*</span></label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-text bg-primary text-white fw-bold">https://</span>
|
<span class="input-group-text bg-primary text-white fw-bold">https://</span>
|
||||||
<input type="text" class="form-control" id="linkUrlInput" placeholder="exemplo.com" required>
|
<input type="text" class="form-control" id="linkUrlInput" placeholder="exemplo.com" required>
|
||||||
@ -616,10 +616,10 @@
|
|||||||
<!-- Seção para Link de Afiliado -->
|
<!-- Seção para Link de Afiliado -->
|
||||||
<div id="productLinkSection" style="display: none;">
|
<div id="productLinkSection" style="display: none;">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="productUrl" class="form-label">URL do Produto</label>
|
<label for="productUrl" class="form-label">URL do Produto <span class="text-danger">*</span></label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-text bg-success text-white fw-bold">https://</span>
|
<span class="input-group-text bg-success text-white fw-bold">https://</span>
|
||||||
<input type="text" class="form-control" id="productUrlInput" placeholder="mercadolivre.com.br/produto...">
|
<input type="text" class="form-control" id="productUrlInput" placeholder="mercadolivre.com.br/produto..." required>
|
||||||
<button type="button" class="btn btn-outline-primary" id="extractProductBtn">
|
<button type="button" class="btn btn-outline-primary" id="extractProductBtn">
|
||||||
<i class="fas fa-magic"></i> Extrair Dados
|
<i class="fas fa-magic"></i> Extrair Dados
|
||||||
</button>
|
</button>
|
||||||
@ -642,8 +642,8 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="productTitle" class="form-label">Título do Produto</label>
|
<label for="productTitle" class="form-label">Título do Produto <span class="text-danger">*</span></label>
|
||||||
<input type="text" class="form-control" id="productTitle" maxlength="100" placeholder="Nome do produto">
|
<input type="text" class="form-control" id="productTitle" maxlength="100" placeholder="Nome do produto" required>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="productDescription" class="form-label">Descrição (Opcional)</label>
|
<label for="productDescription" class="form-label">Descrição (Opcional)</label>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user