diff --git a/.editorconfig b/.editorconfig index facf37e..df5e8c9 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,12 +7,16 @@ indent_size = 4 indent_style = space insert_final_newline = true trim_trailing_whitespace = true +max_line_length = 120 [*.md] trim_trailing_whitespace = false +max_line_length = off [*.{yml,yaml,neon}] indent_size = 2 +max_line_length = off [docker-compose.yml] indent_size = 4 +max_line_length = off diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f3eb04a..dff56c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -154,4 +154,6 @@ jobs: run: composer install -n --no-dev --prefer-dist - name: Execute Code Static Analysis with Larastan - run: vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress + run: | + composer require --dev larastan/larastan + vendor/bin/phpstan analyse -c ./phpstan.neon --no-progress diff --git a/app/Http/Controllers/ModController.php b/app/Http/Controllers/ModController.php index 71ffc5d..890b074 100644 --- a/app/Http/Controllers/ModController.php +++ b/app/Http/Controllers/ModController.php @@ -33,7 +33,7 @@ class ModController extends Controller ->with('user:id,name') ->find($modId); - if (!$mod || $mod->slug !== $slug) { + if (! $mod || $mod->slug !== $slug) { abort(404); } diff --git a/app/Policies/ModPolicy.php b/app/Policies/ModPolicy.php index 9e66cd9..c806b37 100644 --- a/app/Policies/ModPolicy.php +++ b/app/Policies/ModPolicy.php @@ -4,7 +4,6 @@ namespace App\Policies; use App\Models\Mod; use App\Models\User; -use Illuminate\Auth\Access\Response; class ModPolicy { diff --git a/composer.json b/composer.json index 64cee15..3aa5b0c 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,7 @@ }, "require-dev": { "barryvdh/laravel-debugbar": "^3.13", + "deployer/deployer": "^7.4", "fakerphp/faker": "^1.23", "larastan/larastan": "^2.9", "laravel/pint": "^1.13", diff --git a/composer.lock b/composer.lock index 3cd4566..b26dbb2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ca3ac0463e2bccac87eddb5c41b29a5b", + "content-hash": "40b3d2220c6f07a6c8182c49f5174d16", "packages": [ { "name": "bacon/bacon-qr-code", @@ -7236,6 +7236,49 @@ ], "time": "2024-04-12T11:20:37+00:00" }, + { + "name": "deployer/deployer", + "version": "v7.4.0", + "source": { + "type": "git", + "url": "https://github.com/deployphp/deployer.git", + "reference": "b438dc22545ab2ecc67d79c80c7a79c156de3599" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/deployphp/deployer/zipball/b438dc22545ab2ecc67d79c80c7a79c156de3599", + "reference": "b438dc22545ab2ecc67d79c80c7a79c156de3599", + "shasum": "" + }, + "bin": [ + "dep" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anton Medvedev", + "email": "anton@medv.io" + } + ], + "description": "Deployment Tool", + "homepage": "https://deployer.org", + "support": { + "docs": "https://deployer.org/docs", + "issues": "https://github.com/deployphp/deployer/issues", + "source": "https://github.com/deployphp/deployer" + }, + "funding": [ + { + "url": "https://github.com/sponsors/antonmedv", + "type": "github" + } + ], + "time": "2024-04-17T20:55:49+00:00" + }, { "name": "fakerphp/faker", "version": "v1.23.1", diff --git a/deploy.yaml b/deploy.yaml new file mode 100644 index 0000000..8dc59d8 --- /dev/null +++ b/deploy.yaml @@ -0,0 +1,24 @@ +import: + - recipe/laravel.php + +config: + application: 'Forge' + repository: 'https://github.com/SPT-AKI/forge.git' + keep_releases: 5 + +hosts: + forge.sp-tarkov.com: + remote_user: deployer + deploy_path: '~/Forge' + branch: 'main' + env: + environment: production + labels: + env: prod + +tasks: + build: + - run: uptime + +after: + deploy:failed: deploy:unlock diff --git a/resources/js/app.js b/resources/js/app.js index 9a6fb24..dad301d 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,37 +1,49 @@ import "./bootstrap"; -var themeToggleDarkIcon = document.getElementById("theme-toggle-dark-icon"); -var themeToggleLightIcon = document.getElementById("theme-toggle-light-icon"); +document.addEventListener("DOMContentLoaded", function () { + const themeToggleIcon = { + dark: document.getElementById("theme-toggle-dark-icon"), + light: document.getElementById("theme-toggle-light-icon"), + }; -if ( - localStorage.getItem("color-theme") === "dark" || - (!("color-theme" in localStorage) && - window.matchMedia("(prefers-color-scheme: dark)").matches) -) { - themeToggleLightIcon.classList.remove("hidden"); -} else { - themeToggleDarkIcon.classList.remove("hidden"); -} - -var themeToggleBtn = document.getElementById("theme-toggle"); -themeToggleBtn.addEventListener("click", function () { - themeToggleDarkIcon.classList.toggle("hidden"); - themeToggleLightIcon.classList.toggle("hidden"); - if (localStorage.getItem("color-theme")) { - if (localStorage.getItem("color-theme") === "light") { - document.documentElement.classList.add("dark"); - localStorage.setItem("color-theme", "dark"); + // Function to update the visibility of the theme icons based on the theme + function updateIconVisibility(theme) { + if (theme === "dark") { + themeToggleIcon.dark.classList.add("hidden"); + themeToggleIcon.light.classList.remove("hidden"); } else { - document.documentElement.classList.remove("dark"); - localStorage.setItem("color-theme", "light"); - } - } else { - if (document.documentElement.classList.contains("dark")) { - document.documentElement.classList.remove("dark"); - localStorage.setItem("color-theme", "light"); - } else { - document.documentElement.classList.add("dark"); - localStorage.setItem("color-theme", "dark"); + themeToggleIcon.dark.classList.remove("hidden"); + themeToggleIcon.light.classList.add("hidden"); } } + + // Function to update the theme + function updateTheme(theme) { + // Update the document element class + document.documentElement.classList.remove("light", "dark"); + document.documentElement.classList.add(theme); + + // Update local storage + localStorage.setItem("forge-theme", theme); + + // Update icon visibility + updateIconVisibility(theme); + } + + // Initial setup: Determine the current theme and set icon visibility + const initialTheme = + localStorage.getItem("forge-theme") || + (window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark"); + document.documentElement.classList.add(initialTheme); // Ensure the class is set + updateIconVisibility(initialTheme); + + // Set up the theme toggle button + const themeToggleBtn = document.getElementById("theme-toggle"); + themeToggleBtn.addEventListener("click", function () { + // Determine the current theme by checking the classList of documentElement + const currentTheme = document.documentElement.classList.contains("dark") ? "dark" : "light"; + const newTheme = currentTheme === "light" ? "dark" : "light"; + + updateTheme(newTheme); + }); }); diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 6e215d2..5804ca7 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -7,16 +7,21 @@ {{ config('app.name', 'The Forge') }} - - + + + - {{-- Handle setting the dark mode theme. Done here to avoid FOUC --}} @vite(['resources/css/app.css', 'resources/js/app.js']) @@ -32,14 +37,14 @@ @livewire('navigation-menu') @if (isset($header)) -
+
{{ $header }}
@endif -
+
{{ $slot }}
diff --git a/resources/views/layouts/guest.blade.php b/resources/views/layouts/guest.blade.php index 1168196..3a33820 100644 --- a/resources/views/layouts/guest.blade.php +++ b/resources/views/layouts/guest.blade.php @@ -5,28 +5,35 @@ - {{ config('app.name', 'Laravel') }} + {{ config('app.name', 'The Forge') }} - - + + + - {{-- Handle setting the dark mode theme. Done here to avoid FOUC --}} @vite(['resources/css/app.css', 'resources/js/app.js']) @livewireStyles +
{{ $slot }}
@livewireScripts + diff --git a/resources/views/mod/show.blade.php b/resources/views/mod/show.blade.php index 6d1133c..2fc5dea 100644 --- a/resources/views/mod/show.blade.php +++ b/resources/views/mod/show.blade.php @@ -1,30 +1,44 @@ -

+

{{ __('Mod Details') }}

-
-
-
-
-
- {{ $mod->name }} -

{{ $mod->name }}

-

{{ $mod->latestSptVersion->sptVersion->version }}

-

{{ $mod->user->name }}

-

{{ $mod->total_downloads }}

-
- +
+ +
+
+
+ @if(empty($mod->thumbnail)) + {{ $mod->name }} + + @else + {{ $mod->name }} + @endif
-
-

{{ __('Details') }}

+
+

+ {{ $mod->name }} + + {{ $mod->latestSptVersion->version }} + +

+

{{ __('Created by') }} {{ $mod->user->name }}

+

{{ $mod->latestSptVersion->sptVersion->version }} {{ __('Compatible') }}

+

{{ $mod->total_downloads }} {{ __('Downloads') }}

+ + +
+ diff --git a/resources/views/navigation-menu.blade.php b/resources/views/navigation-menu.blade.php index 8ccb974..85ff270 100644 --- a/resources/views/navigation-menu.blade.php +++ b/resources/views/navigation-menu.blade.php @@ -1,4 +1,4 @@ -