Release/ArtigosPDF #22
@ -162,7 +162,7 @@ jobs:
|
|||||||
|
|
||||||
# Build para a plataforma correta
|
# Build para a plataforma correta
|
||||||
if [ "${{ steps.settings.outputs.deploy_target }}" = "production" ]; then
|
if [ "${{ steps.settings.outputs.deploy_target }}" = "production" ]; then
|
||||||
# Build para produção (main branch)
|
# Build para produção (main branch) - Usa Configuration=Release (padrão)
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
--platform ${{ steps.settings.outputs.platform }} \
|
--platform ${{ steps.settings.outputs.platform }} \
|
||||||
--file ${{ steps.settings.outputs.dockerfile }} \
|
--file ${{ steps.settings.outputs.dockerfile }} \
|
||||||
@ -171,12 +171,13 @@ jobs:
|
|||||||
--progress=plain \
|
--progress=plain \
|
||||||
.
|
.
|
||||||
else
|
else
|
||||||
# Build para staging (Release branches)
|
# Build para staging (Release branches) - Usa Configuration=Testing para habilitar código de teste
|
||||||
docker buildx build \
|
docker buildx build \
|
||||||
--platform ${{ steps.settings.outputs.platform }} \
|
--platform ${{ steps.settings.outputs.platform }} \
|
||||||
--file ${{ steps.settings.outputs.dockerfile }} \
|
--file ${{ steps.settings.outputs.dockerfile }} \
|
||||||
--tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.settings.outputs.tag }} \
|
--tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.settings.outputs.tag }} \
|
||||||
--push \
|
--push \
|
||||||
|
--build-arg BUILD_CONFIGURATION=Testing \
|
||||||
--build-arg VERSION=${{ steps.settings.outputs.version || 'latest' }} \
|
--build-arg VERSION=${{ steps.settings.outputs.version || 'latest' }} \
|
||||||
--build-arg COMMIT=${{ steps.settings.outputs.commit }} \
|
--build-arg COMMIT=${{ steps.settings.outputs.commit }} \
|
||||||
--progress=plain \
|
--progress=plain \
|
||||||
|
|||||||
@ -5,15 +5,17 @@ EXPOSE 8080
|
|||||||
EXPOSE 8443
|
EXPOSE 8443
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
|
||||||
|
ARG BUILD_CONFIGURATION=Release
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY ["src/BCards.Web/BCards.Web.csproj", "src/BCards.Web/"]
|
COPY ["src/BCards.Web/BCards.Web.csproj", "src/BCards.Web/"]
|
||||||
RUN dotnet restore "src/BCards.Web/BCards.Web.csproj"
|
RUN dotnet restore "src/BCards.Web/BCards.Web.csproj"
|
||||||
COPY . .
|
COPY . .
|
||||||
WORKDIR "/src/src/BCards.Web"
|
WORKDIR "/src/src/BCards.Web"
|
||||||
RUN dotnet build "BCards.Web.csproj" -c Release -o /app/build
|
RUN dotnet build "BCards.Web.csproj" -c ${BUILD_CONFIGURATION} -o /app/build
|
||||||
|
|
||||||
FROM build AS publish
|
FROM build AS publish
|
||||||
RUN dotnet publish "BCards.Web.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
ARG BUILD_CONFIGURATION=Release
|
||||||
|
RUN dotnet publish "BCards.Web.csproj" -c ${BUILD_CONFIGURATION} -o /app/publish /p:UseAppHost=false
|
||||||
|
|
||||||
FROM base AS final
|
FROM base AS final
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|||||||
@ -40,8 +40,9 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="Content\Artigos\" />
|
<None Update="Content\**\*">
|
||||||
<Folder Include="Content\Tutoriais\" />
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)'=='Testing'">
|
<PropertyGroup Condition="'$(Configuration)'=='Testing'">
|
||||||
|
|||||||
@ -572,6 +572,13 @@ builder.Services.AddHttpClient<CriticalServicesHealthCheck>(client =>
|
|||||||
client.DefaultRequestHeaders.Add("User-Agent", "BCards-CriticalCheck/1.0");
|
client.DefaultRequestHeaders.Add("User-Agent", "BCards-CriticalCheck/1.0");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
builder.Services.AddHsts(options =>
|
||||||
|
{
|
||||||
|
options.MaxAge = TimeSpan.FromDays(365);
|
||||||
|
options.IncludeSubDomains = true;
|
||||||
|
options.Preload = true;
|
||||||
|
});
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
app.UseForwardedHeaders();
|
app.UseForwardedHeaders();
|
||||||
|
|||||||
@ -239,6 +239,35 @@
|
|||||||
</h2>
|
</h2>
|
||||||
<div id="collapseDocuments" class="accordion-collapse collapse" aria-labelledby="headingDocuments" data-bs-parent="#pageWizard">
|
<div id="collapseDocuments" class="accordion-collapse collapse" aria-labelledby="headingDocuments" data-bs-parent="#pageWizard">
|
||||||
<div class="accordion-body">
|
<div class="accordion-body">
|
||||||
|
@if (!Model.AllowDocumentUpload)
|
||||||
|
{
|
||||||
|
<!-- Alerta amarelo APENAS para quem NÃO tem Premium -->
|
||||||
|
<div class="alert alert-warning border-start border-4 border-warning d-flex align-items-start mb-4">
|
||||||
|
<i class="fas fa-crown me-3 mt-1 text-warning" style="font-size: 1.2rem;"></i>
|
||||||
|
<div class="flex-grow-1">
|
||||||
|
<h6 class="mb-1 fw-bold">
|
||||||
|
<i class="fas fa-file-pdf me-1"></i> Anexar PDFs é exclusivo dos planos Premium
|
||||||
|
</h6>
|
||||||
|
<p class="mb-2 small text-muted">
|
||||||
|
Compartilhe apresentações, catálogos, portfólios e documentos diretamente na sua página profissional.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="d-flex align-items-center gap-2 flex-wrap mb-3">
|
||||||
|
<span class="badge bg-light text-dark border">
|
||||||
|
<i class="fas fa-check-circle text-success me-1"></i> Plano Premium: até 5 PDFs
|
||||||
|
</span>
|
||||||
|
<span class="badge bg-light text-dark border">
|
||||||
|
<i class="fas fa-check-circle text-success me-1"></i> Plano Premium + Afiliados: até 10 PDFs
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a asp-controller="Home" asp-action="Pricing" class="btn btn-warning btn-sm">
|
||||||
|
<i class="fas fa-arrow-up me-1"></i>Fazer upgrade e desbloquear PDFs
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
@if (Model.AllowDocumentUpload)
|
@if (Model.AllowDocumentUpload)
|
||||||
{
|
{
|
||||||
<p class="text-muted mb-3">Anexe PDFs com apresentações, catálogos ou materiais exclusivos para quem acessar sua página Premium.</p>
|
<p class="text-muted mb-3">Anexe PDFs com apresentações, catálogos ou materiais exclusivos para quem acessar sua página Premium.</p>
|
||||||
@ -2594,6 +2623,63 @@
|
|||||||
@:}
|
@:}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ========================================
|
||||||
|
// Sistema de Confirmação ao Sair da Página
|
||||||
|
// ========================================
|
||||||
|
let formChanged = false;
|
||||||
|
let isSubmitting = false;
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
// Marcar formulário como alterado quando qualquer campo mudar
|
||||||
|
$('form :input').on('change input', function() {
|
||||||
|
if (!isSubmitting) {
|
||||||
|
formChanged = true;
|
||||||
|
console.log('Formulário alterado detectado');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Quando submeter o formulário, desabilitar aviso
|
||||||
|
$('form').on('submit', function() {
|
||||||
|
console.log('Formulário submetido - desabilitando avisos');
|
||||||
|
isSubmitting = true;
|
||||||
|
formChanged = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Aviso ao tentar fechar/recarregar a página
|
||||||
|
window.addEventListener('beforeunload', function(e) {
|
||||||
|
if (formChanged && !isSubmitting) {
|
||||||
|
console.log('beforeunload: Tentativa de sair com alterações não salvas');
|
||||||
|
e.preventDefault();
|
||||||
|
e.returnValue = ''; // Chrome requer isso
|
||||||
|
return 'Você tem alterações não salvas. Deseja realmente sair?';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Interceptar cliques em links de navegação (incluindo Dashboard)
|
||||||
|
$(document).on('click', 'a:not(.no-confirm)', function(e) {
|
||||||
|
if (formChanged && !isSubmitting) {
|
||||||
|
const href = $(this).attr('href');
|
||||||
|
|
||||||
|
// Não avisar para links externos, âncoras ou JavaScript
|
||||||
|
if (href && !href.startsWith('#') && !href.startsWith('javascript:')) {
|
||||||
|
console.log('Link clicado com alterações não salvas:', href);
|
||||||
|
|
||||||
|
if (!confirm('Você tem alterações não salvas. Deseja realmente sair desta página?')) {
|
||||||
|
e.preventDefault();
|
||||||
|
console.log('Usuário cancelou navegação');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Usuário confirmou, permitir navegação
|
||||||
|
console.log('Usuário confirmou saída');
|
||||||
|
formChanged = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('Sistema de confirmação ao sair inicializado');
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,43 +19,92 @@
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(url)) return "#";
|
if (string.IsNullOrEmpty(url)) return "#";
|
||||||
|
|
||||||
// Se já tem protocolo, retorna direto
|
// WhatsApp - sempre normalizar para evitar URLs malformadas
|
||||||
if (url.StartsWith("http://") || url.StartsWith("https://"))
|
|
||||||
return url;
|
|
||||||
|
|
||||||
// WhatsApp - garantir prefixo wa.me
|
|
||||||
if (!string.IsNullOrEmpty(icon) && icon.Contains("whatsapp"))
|
if (!string.IsNullOrEmpty(icon) && icon.Contains("whatsapp"))
|
||||||
{
|
{
|
||||||
// Remove qualquer prefixo parcial que possa existir
|
// Remove qualquer prefixo conhecido (incluindo https://)
|
||||||
var cleanUrl = url.Replace("wa.me/", "").Replace("whatsapp://", "");
|
var cleanUrl = url
|
||||||
|
.Replace("https://wa.me/", "")
|
||||||
|
.Replace("http://wa.me/", "")
|
||||||
|
.Replace("https://api.whatsapp.com/send?phone=", "")
|
||||||
|
.Replace("https://api.whatsapp.com/", "")
|
||||||
|
.Replace("wa.me/", "")
|
||||||
|
.Replace("whatsapp://send?phone=", "")
|
||||||
|
.Replace("whatsapp://", "");
|
||||||
|
|
||||||
|
// Remove barras extras
|
||||||
|
cleanUrl = cleanUrl.TrimStart('/').Trim();
|
||||||
|
|
||||||
|
// Apenas números devem sobrar
|
||||||
return $"https://wa.me/{cleanUrl}";
|
return $"https://wa.me/{cleanUrl}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Se já tem protocolo correto para outras redes, retorna direto
|
||||||
|
if (url.StartsWith("http://") || url.StartsWith("https://"))
|
||||||
|
return url;
|
||||||
|
|
||||||
// Facebook
|
// Facebook
|
||||||
if (!string.IsNullOrEmpty(icon) && icon.Contains("facebook"))
|
if (!string.IsNullOrEmpty(icon) && icon.Contains("facebook"))
|
||||||
{
|
{
|
||||||
var cleanUrl = url.Replace("facebook.com/", "").Replace("fb.com/", "");
|
var cleanUrl = url
|
||||||
|
.Replace("https://facebook.com/", "")
|
||||||
|
.Replace("https://www.facebook.com/", "")
|
||||||
|
.Replace("https://fb.com/", "")
|
||||||
|
.Replace("https://www.fb.com/", "")
|
||||||
|
.Replace("http://facebook.com/", "")
|
||||||
|
.Replace("http://www.facebook.com/", "")
|
||||||
|
.Replace("facebook.com/", "")
|
||||||
|
.Replace("fb.com/", "")
|
||||||
|
.TrimStart('/').Trim();
|
||||||
return $"https://facebook.com/{cleanUrl}";
|
return $"https://facebook.com/{cleanUrl}";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instagram
|
// Instagram
|
||||||
if (!string.IsNullOrEmpty(icon) && icon.Contains("instagram"))
|
if (!string.IsNullOrEmpty(icon) && icon.Contains("instagram"))
|
||||||
{
|
{
|
||||||
var cleanUrl = url.Replace("instagram.com/", "").Replace("instagr.am/", "");
|
var cleanUrl = url
|
||||||
|
.Replace("https://instagram.com/", "")
|
||||||
|
.Replace("https://www.instagram.com/", "")
|
||||||
|
.Replace("https://instagr.am/", "")
|
||||||
|
.Replace("http://instagram.com/", "")
|
||||||
|
.Replace("http://www.instagram.com/", "")
|
||||||
|
.Replace("instagram.com/", "")
|
||||||
|
.Replace("instagr.am/", "")
|
||||||
|
.TrimStart('/').Trim();
|
||||||
return $"https://instagram.com/{cleanUrl}";
|
return $"https://instagram.com/{cleanUrl}";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Twitter/X
|
// Twitter/X
|
||||||
if (!string.IsNullOrEmpty(icon) && (icon.Contains("twitter") || icon.Contains("x-twitter")))
|
if (!string.IsNullOrEmpty(icon) && (icon.Contains("twitter") || icon.Contains("x-twitter")))
|
||||||
{
|
{
|
||||||
var cleanUrl = url.Replace("x.com/", "").Replace("twitter.com/", "");
|
var cleanUrl = url
|
||||||
|
.Replace("https://x.com/", "")
|
||||||
|
.Replace("https://twitter.com/", "")
|
||||||
|
.Replace("https://www.twitter.com/", "")
|
||||||
|
.Replace("https://www.x.com/", "")
|
||||||
|
.Replace("http://x.com/", "")
|
||||||
|
.Replace("http://twitter.com/", "")
|
||||||
|
.Replace("x.com/", "")
|
||||||
|
.Replace("twitter.com/", "")
|
||||||
|
.TrimStart('/').Trim();
|
||||||
return $"https://x.com/{cleanUrl}";
|
return $"https://x.com/{cleanUrl}";
|
||||||
}
|
}
|
||||||
|
|
||||||
// TikTok
|
// TikTok
|
||||||
if (!string.IsNullOrEmpty(icon) && icon.Contains("tiktok"))
|
if (!string.IsNullOrEmpty(icon) && icon.Contains("tiktok"))
|
||||||
{
|
{
|
||||||
var cleanUrl = url.Replace("tiktok.com/", "").Replace("tiktok.com/@", "");
|
var cleanUrl = url
|
||||||
|
.Replace("https://tiktok.com/@", "")
|
||||||
|
.Replace("https://www.tiktok.com/@", "")
|
||||||
|
.Replace("https://tiktok.com/", "")
|
||||||
|
.Replace("https://www.tiktok.com/", "")
|
||||||
|
.Replace("https://vm.tiktok.com/", "")
|
||||||
|
.Replace("http://tiktok.com/@", "")
|
||||||
|
.Replace("http://tiktok.com/", "")
|
||||||
|
.Replace("tiktok.com/@", "")
|
||||||
|
.Replace("tiktok.com/", "")
|
||||||
|
.TrimStart('/').Trim();
|
||||||
|
|
||||||
// Se não tem @, adiciona
|
// Se não tem @, adiciona
|
||||||
if (!cleanUrl.StartsWith("@"))
|
if (!cleanUrl.StartsWith("@"))
|
||||||
cleanUrl = "@" + cleanUrl;
|
cleanUrl = "@" + cleanUrl;
|
||||||
@ -65,14 +114,29 @@
|
|||||||
// Pinterest
|
// Pinterest
|
||||||
if (!string.IsNullOrEmpty(icon) && icon.Contains("pinterest"))
|
if (!string.IsNullOrEmpty(icon) && icon.Contains("pinterest"))
|
||||||
{
|
{
|
||||||
var cleanUrl = url.Replace("pinterest.com/", "").Replace("pin.it/", "");
|
var cleanUrl = url
|
||||||
|
.Replace("https://pinterest.com/", "")
|
||||||
|
.Replace("https://www.pinterest.com/", "")
|
||||||
|
.Replace("https://pin.it/", "")
|
||||||
|
.Replace("http://pinterest.com/", "")
|
||||||
|
.Replace("http://www.pinterest.com/", "")
|
||||||
|
.Replace("pinterest.com/", "")
|
||||||
|
.Replace("pin.it/", "")
|
||||||
|
.TrimStart('/').Trim();
|
||||||
return $"https://pinterest.com/{cleanUrl}";
|
return $"https://pinterest.com/{cleanUrl}";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Discord
|
// Discord
|
||||||
if (!string.IsNullOrEmpty(icon) && icon.Contains("discord"))
|
if (!string.IsNullOrEmpty(icon) && icon.Contains("discord"))
|
||||||
{
|
{
|
||||||
var cleanUrl = url.Replace("discord.gg/", "").Replace("discord.com/invite/", "");
|
var cleanUrl = url
|
||||||
|
.Replace("https://discord.gg/", "")
|
||||||
|
.Replace("https://discord.com/invite/", "")
|
||||||
|
.Replace("http://discord.gg/", "")
|
||||||
|
.Replace("http://discord.com/invite/", "")
|
||||||
|
.Replace("discord.gg/", "")
|
||||||
|
.Replace("discord.com/invite/", "")
|
||||||
|
.TrimStart('/').Trim();
|
||||||
return $"https://discord.gg/{cleanUrl}";
|
return $"https://discord.gg/{cleanUrl}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user