diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9f2ccc0..7ca75e1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,7 +11,7 @@ on: - main permissions: - contents: write + contents: read jobs: quality: @@ -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 diff --git a/app/Services/EmbedProcessorService.php b/app/Services/EmbedProcessorService.php index 650bb65..9bd9f4b 100644 --- a/app/Services/EmbedProcessorService.php +++ b/app/Services/EmbedProcessorService.php @@ -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 @@ -40,14 +40,14 @@ private static function processTwitterEmbeds(string $content): string $embedHtml = self::getTwitterOEmbed($url); if ($embedHtml) { - return '
' . $embedHtml . '
'; + return '
'.$embedHtml.'
'; } // Fallback: create a basic embed structure that Twitter widget.js can enhance - return '
' . - '
' . - 'Ver tweet' . - '
' . + return '
'. + ''. '
'; } @@ -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 { @@ -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; @@ -93,14 +94,14 @@ private static function processYouTubeEmbeds(string $content): string return preg_replace_callback($pattern, function ($matches) { $videoId = $matches[2]; - return '
' . - '' . + return '
'. + ''. '
'; }, $content) ?? $content; } @@ -121,14 +122,14 @@ private static function processInstagramEmbeds(string $content): string $embedHtml = self::getInstagramOEmbed($url); if ($embedHtml) { - return '
' . $embedHtml . '
'; + return '
'.$embedHtml.'
'; } // Fallback - return '
' . - '
' . - 'Ver no Instagram' . - '
' . + return '
'. + '
'. + 'Ver no Instagram'. + '
'. '
'; }, $content) ?? $content; } @@ -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 { @@ -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; @@ -174,14 +176,14 @@ private static function processRedditEmbeds(string $content): string $embedHtml = self::getRedditOEmbed($url); if ($embedHtml) { - return '
' . $embedHtml . '
'; + return '
'.$embedHtml.'
'; } // Fallback: link to the Reddit post - return '
' . - '
' . - 'Ver no Reddit' . - '
' . + return '
'. + '
'. + 'Ver no Reddit'. + '
'. '
'; }, $content) ?? $content; } @@ -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 { @@ -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; diff --git a/app/Services/WpAuthService.php b/app/Services/WpAuthService.php index 845e68b..faecdd5 100644 --- a/app/Services/WpAuthService.php +++ b/app/Services/WpAuthService.php @@ -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; @@ -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; @@ -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; @@ -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; diff --git a/package.json b/package.json index bf8b77f..dc2bf59 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/resources/css/app.css b/resources/css/app.css index 55eaa7c..faa0fab 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -1,5 +1,5 @@ @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'; @@ -7,7 +7,9 @@ @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); @@ -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; } @@ -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; } } diff --git a/resources/js/components/Carousel.vue b/resources/js/components/Carousel.vue index 5386bec..f6dfdd8 100644 --- a/resources/js/components/Carousel.vue +++ b/resources/js/components/Carousel.vue @@ -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, + }), + ]" > diff --git a/resources/js/components/CarouselCard.vue b/resources/js/components/CarouselCard.vue index 1e57bdd..0ff98ec 100644 --- a/resources/js/components/CarouselCard.vue +++ b/resources/js/components/CarouselCard.vue @@ -27,7 +27,7 @@ const getExcerpt = (post: Post) => {
- - Política de privacidade - + Política de privacidade
diff --git a/resources/js/components/Header.vue b/resources/js/components/Header.vue index 6b52f4c..138c1d6 100644 --- a/resources/js/components/Header.vue +++ b/resources/js/components/Header.vue @@ -1,9 +1,9 @@ diff --git a/resources/js/components/PostContentAuthor.vue b/resources/js/components/PostContentAuthor.vue index eaaf503..acd880e 100644 --- a/resources/js/components/PostContentAuthor.vue +++ b/resources/js/components/PostContentAuthor.vue @@ -15,7 +15,7 @@ defineProps<{