Skip to content
Open
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
30 changes: 18 additions & 12 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- main

permissions:
contents: write
contents: read

jobs:
quality:
Expand All @@ -24,22 +24,28 @@ jobs:
with:
php-version: '8.4'

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'

- name: Install Dependencies
run: |
composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
npm install
npm ci

- name: Run Pint
run: vendor/bin/pint
# The steps below report instead of rewriting the checkout. The writing
# variants (pint / prettier --write / eslint --fix) always exit 0, so the
# job passed no matter what they found.
- name: Check PHP Code Style
run: vendor/bin/pint --test

- name: Format Frontend
run: npm run format
- name: Check Frontend Formatting
run: npm run format:check

- name: Lint Frontend
run: npm run lint
run: npm run lint:check

# - name: Commit Changes
# uses: stefanzweifel/git-auto-commit-action@v5
# with:
# commit_message: fix code style
# commit_options: '--no-verify'
- name: Type Check Frontend
run: npm run type-check
63 changes: 33 additions & 30 deletions app/Services/EmbedProcessorService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace App\Services;

use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;

class EmbedProcessorService
Expand Down Expand Up @@ -40,14 +40,14 @@ private static function processTwitterEmbeds(string $content): string
$embedHtml = self::getTwitterOEmbed($url);

if ($embedHtml) {
return '<div class="embed-container embed-twitter" data-tweet-id="' . $tweetId . '">' . $embedHtml . '</div>';
return '<div class="embed-container embed-twitter" data-tweet-id="'.$tweetId.'">'.$embedHtml.'</div>';
}

// Fallback: create a basic embed structure that Twitter widget.js can enhance
return '<div class="embed-container embed-twitter" data-tweet-id="' . $tweetId . '">' .
'<blockquote class="twitter-tweet" data-dnt="true">' .
'<a href="' . htmlspecialchars($url) . '">Ver tweet</a>' .
'</blockquote>' .
return '<div class="embed-container embed-twitter" data-tweet-id="'.$tweetId.'">'.
'<blockquote class="twitter-tweet" data-dnt="true">'.
'<a href="'.htmlspecialchars($url).'">Ver tweet</a>'.
'</blockquote>'.
'</div>';
}

Expand All @@ -60,7 +60,7 @@ private static function processTwitterEmbeds(string $content): string
*/
private static function getTwitterOEmbed(string $url): ?string
{
$cacheKey = 'twitter_oembed_' . md5($url);
$cacheKey = 'twitter_oembed_'.md5($url);

return Cache::remember($cacheKey, 86400, function () use ($url) {
try {
Expand All @@ -72,10 +72,11 @@ private static function getTwitterOEmbed(string $url): ?string

if ($response->successful()) {
$data = $response->json();

return $data['html'] ?? null;
}
} catch (\Exception $e) {
Log::warning('Failed to fetch Twitter oEmbed: ' . $e->getMessage());
Log::warning('Failed to fetch Twitter oEmbed: '.$e->getMessage());
}

return null;
Expand All @@ -93,14 +94,14 @@ private static function processYouTubeEmbeds(string $content): string
return preg_replace_callback($pattern, function ($matches) {
$videoId = $matches[2];

return '<div class="embed-container embed-youtube">' .
'<iframe ' .
'src="https://www.youtube-nocookie.com/embed/' . htmlspecialchars($videoId) . '" ' .
'frameborder="0" ' .
'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" ' .
'allowfullscreen ' .
'loading="lazy">' .
'</iframe>' .
return '<div class="embed-container embed-youtube">'.
'<iframe '.
'src="https://www.youtube-nocookie.com/embed/'.htmlspecialchars($videoId).'" '.
'frameborder="0" '.
'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" '.
'allowfullscreen '.
'loading="lazy">'.
'</iframe>'.
'</div>';
}, $content) ?? $content;
}
Expand All @@ -121,14 +122,14 @@ private static function processInstagramEmbeds(string $content): string
$embedHtml = self::getInstagramOEmbed($url);

if ($embedHtml) {
return '<div class="embed-container embed-instagram" data-instagram-id="' . $postId . '">' . $embedHtml . '</div>';
return '<div class="embed-container embed-instagram" data-instagram-id="'.$postId.'">'.$embedHtml.'</div>';
}

// Fallback
return '<div class="embed-container embed-instagram" data-instagram-id="' . $postId . '">' .
'<blockquote class="instagram-media" data-instgrm-permalink="' . htmlspecialchars($url) . '">' .
'<a href="' . htmlspecialchars($url) . '">Ver no Instagram</a>' .
'</blockquote>' .
return '<div class="embed-container embed-instagram" data-instagram-id="'.$postId.'">'.
'<blockquote class="instagram-media" data-instgrm-permalink="'.htmlspecialchars($url).'">'.
'<a href="'.htmlspecialchars($url).'">Ver no Instagram</a>'.
'</blockquote>'.
'</div>';
}, $content) ?? $content;
}
Expand All @@ -138,7 +139,7 @@ private static function processInstagramEmbeds(string $content): string
*/
private static function getInstagramOEmbed(string $url): ?string
{
$cacheKey = 'instagram_oembed_' . md5($url);
$cacheKey = 'instagram_oembed_'.md5($url);

return Cache::remember($cacheKey, 86400, function () use ($url) {
try {
Expand All @@ -149,10 +150,11 @@ private static function getInstagramOEmbed(string $url): ?string

if ($response->successful()) {
$data = $response->json();

return $data['html'] ?? null;
}
} catch (\Exception $e) {
Log::warning('Failed to fetch Instagram oEmbed: ' . $e->getMessage());
Log::warning('Failed to fetch Instagram oEmbed: '.$e->getMessage());
}

return null;
Expand All @@ -174,14 +176,14 @@ private static function processRedditEmbeds(string $content): string
$embedHtml = self::getRedditOEmbed($url);

if ($embedHtml) {
return '<div class="embed-container embed-reddit">' . $embedHtml . '</div>';
return '<div class="embed-container embed-reddit">'.$embedHtml.'</div>';
}

// Fallback: link to the Reddit post
return '<div class="embed-container embed-reddit">' .
'<blockquote class="reddit-embed-bq">' .
'<a href="' . htmlspecialchars($url) . '">Ver no Reddit</a>' .
'</blockquote>' .
return '<div class="embed-container embed-reddit">'.
'<blockquote class="reddit-embed-bq">'.
'<a href="'.htmlspecialchars($url).'">Ver no Reddit</a>'.
'</blockquote>'.
'</div>';
}, $content) ?? $content;
}
Expand All @@ -191,7 +193,7 @@ private static function processRedditEmbeds(string $content): string
*/
private static function getRedditOEmbed(string $url): ?string
{
$cacheKey = 'reddit_oembed_' . md5($url);
$cacheKey = 'reddit_oembed_'.md5($url);

return Cache::remember($cacheKey, 86400, function () use ($url) {
try {
Expand All @@ -201,10 +203,11 @@ private static function getRedditOEmbed(string $url): ?string

if ($response->successful()) {
$data = $response->json();

return $data['html'] ?? null;
}
} catch (\Exception $e) {
Log::warning('Failed to fetch Reddit oEmbed: ' . $e->getMessage());
Log::warning('Failed to fetch Reddit oEmbed: '.$e->getMessage());
}

return null;
Expand Down
8 changes: 4 additions & 4 deletions app/Services/WpAuthService.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private static function parseWpCookie(string $cookieValue): ?array
// Find user in WordPress database
$user = WpUser::where('user_login', $username)->first();

if (!$user) {
if (! $user) {
Log::debug('WpAuth: User not found in database', ['username' => $username]);

return null;
Expand All @@ -63,7 +63,7 @@ private static function parseWpCookie(string $cookieValue): ?array
Log::debug('WpAuth: User found', ['user_id' => $user->ID]);

// Check if user has admin capabilities
if (!self::userHasAdminCapability($user->ID)) {
if (! self::userHasAdminCapability($user->ID)) {
Log::debug('WpAuth: User does not have admin capabilities', ['user_id' => $user->ID]);

return null;
Expand All @@ -90,7 +90,7 @@ private static function userHasAdminCapability(int $userId): bool
->where('meta_key', 'like', '%_capabilities')
->first();

if (!$capabilities) {
if (! $capabilities) {
Log::debug('WpAuth: No capabilities meta found', ['user_id' => $userId]);

return false;
Expand All @@ -100,7 +100,7 @@ private static function userHasAdminCapability(int $userId): bool

$caps = @unserialize($capabilities->meta_value);

if (!\is_array($caps)) {
if (! \is_array($caps)) {
Log::debug('WpAuth: Failed to unserialize capabilities');

return false;
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"dev": "vite",
"format": "prettier --write resources/",
"format:check": "prettier --check resources/",
"lint": "eslint . --fix"
"lint": "eslint . --fix",
"lint:check": "eslint .",
"type-check": "vue-tsc --noEmit"
},
"devDependencies": {
"@eslint/js": "^9.19.0",
Expand Down
19 changes: 11 additions & 8 deletions resources/css/app.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
@import 'tailwindcss';
@import "tw-animate-css";
@import 'tw-animate-css';

@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';

@custom-variant dark (&:is(.dark *));

@theme inline {
--font-sans: 'Montserrat', Instrument Sans, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
--font-sans:
'Montserrat', Instrument Sans, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji';
--color-sidebar-ring: var(--sidebar-ring);
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
Expand Down Expand Up @@ -48,8 +50,9 @@

@font-face {
font-family: 'Inversionz';
src: url('/fonts/Inversionz.ttf') format('truetype'),
url('/fonts/Inversionz-Italic.ttf') format('truetype');
src:
url('/fonts/Inversionz.ttf') format('truetype'),
url('/fonts/Inversionz-Italic.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
Expand Down Expand Up @@ -126,10 +129,10 @@
}

@layer base {
* {
@apply border-border outline-ring/50;
* {
@apply border-border outline-ring/50;
}
body {
@apply bg-background text-foreground;
body {
@apply bg-background text-foreground;
}
}
16 changes: 9 additions & 7 deletions resources/js/components/Carousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ watchOnce(api, (api) => {
:opts="{
loop: true,
}"
:plugins="[Autoplay({
delay: 5000,
active: true,
stopOnFocusIn: false,
stopOnInteraction: false,
stopOnMouseEnter: false,
})]"
:plugins="[
Autoplay({
delay: 5000,
active: true,
stopOnFocusIn: false,
stopOnInteraction: false,
stopOnMouseEnter: false,
}),
]"
>
<CarouselContent>
<CarouselItem v-for="(post, idx) in highlightedPosts.data" :key="post.id" class="relative">
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/CarouselCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const getExcerpt = (post: Post) => {
<img
:src="post.thumbnail"
:alt="'Capa do post - ' + post.title"
class="h-full w-full xl:w-auto md:h-auto"
class="h-full w-full md:h-auto xl:w-auto"
width="700"
height="350"
:fetchpriority="isFirst ? 'high' : undefined"
Expand Down
7 changes: 1 addition & 6 deletions resources/js/components/Footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,7 @@ import { Link } from '@inertiajs/vue3';
<template>
<footer class="mt-10 w-full border-t border-gray-800 bg-[#171717] py-4">
<div class="mx-auto w-full px-5 xl:w-[1200px] xl:px-0">
<Link
:href="route('page.privacy-policy')"
class="text-sm text-gray-400 hover:text-gray-300"
>
Política de privacidade
</Link>
<Link :href="route('page.privacy-policy')" class="text-sm text-gray-400 hover:text-gray-300"> Política de privacidade </Link>
</div>
</footer>
</template>
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/Header.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<script setup lang="ts">
import HeaderDesktop from '@/components/HeaderDesktop.vue';
import HeaderMobile from '@/components/HeaderMobile.vue';
import type { AppPageProps } from '@/types';
import { usePage } from '@inertiajs/vue3';
import { computed } from 'vue';
import type { AppPageProps } from '@/types';

const { staticHeader = true } = defineProps<{
staticHeader?: boolean;
Expand All @@ -19,7 +19,7 @@ const hasWpAdmin = computed(() => !!page.props.wpAdmin);
:class="{
'!static': staticHeader === true,
'!top-8': hasWpAdmin && !staticHeader,
'mt-8': hasWpAdmin && staticHeader
'mt-8': hasWpAdmin && staticHeader,
}"
>
<HeaderDesktop />
Expand Down
9 changes: 7 additions & 2 deletions resources/js/components/PostCardList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ defineProps<{
</script>

<template>
<div class="mt-5 xl:mt-0 w-full md:w-[668px] md:mx-auto xl:w-full xl:mx-0">
<div class="mt-5 w-full md:mx-auto md:w-[668px] xl:mx-0 xl:mt-0 xl:w-full">
<div v-for="(post, idx) in posts.data" v-bind:key="post.id" :class="idx !== posts.data.length - 1 ? 'mb-10' : ''">
<PostCard :post="post" :isLcp="firstPostIsLcp && idx === 0" />
</div>
<PostCardListPagination v-if="posts.meta.total > 0" :total="posts.meta.total" :per-page="posts.meta.per_page" :backend-current-page="posts.meta.current_page" />
<PostCardListPagination
v-if="posts.meta.total > 0"
:total="posts.meta.total"
:per-page="posts.meta.per_page"
:backend-current-page="posts.meta.current_page"
/>
</div>
</template>

Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/PostContentAuthor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defineProps<{
<template>
<div class="mt-10 w-full border-y-5 border-[#e6c619] py-8">
<div class="flex px-3 xl:px-0">
<div class="h-[96px] w-[96px] shrink-0 hidden xl:block">
<div class="hidden h-[96px] w-[96px] shrink-0 xl:block">
<img :src="authorData.author_gravatar" class="h-full w-full rounded-full" alt="Autor avatar image" />
</div>
<div class="ml-8 flex flex-col">
Expand Down
Loading