Compare commits
47 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f5a90aea4d | |||
| dff376217f | |||
| 55a8154b52 | |||
| 8ca82fd0c8 | |||
| 837b3de163 | |||
| 71014349aa | |||
| aefe03ed67 | |||
| 1afe77415d | |||
| f492a4d02f | |||
| 0c0a6a401e | |||
| bdc4158dec | |||
| 0ecb4610eb | |||
| d75d76ef6e | |||
| dc6df8b02a | |||
| a91106ddf7 | |||
| 53b611bb31 | |||
| 7e1f8fc55a | |||
| f71c51f4ba | |||
| ef24a16132 | |||
| 3b0051585c | |||
| a52db45972 | |||
| 487b2e2956 | |||
| 74a678edda | |||
| dc577f5c8b | |||
| 22893fd957 | |||
| 176a883633 | |||
| 3cb98ce542 | |||
| 300c417f3c | |||
| dcf99a3351 | |||
| 1bc89691d9 | |||
| c76bf45904 | |||
| 3cdb6f88b8 | |||
| 378c34b8c0 | |||
| 73844b6db0 | |||
| f47528a2a1 | |||
| 6977d5ad57 | |||
| 0009d3339e | |||
| 93acbb4325 | |||
| e9fdc9be51 | |||
| a1ca5b084a | |||
| 60dfa1588a | |||
| 60ce1cf400 | |||
| a9158c722a | |||
| 848c528de3 | |||
| d163d24780 | |||
| 05e7d4754f | |||
| 1abfa96c2c |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -30,3 +30,4 @@ avancee.ods
|
||||
rhpz.local+1.pem
|
||||
rhpz.local+1-key.pem
|
||||
extra.less
|
||||
config/xenforo.php
|
||||
|
||||
41
app/Console/Commands/MigrateDownloadsCount.php
Normal file
41
app/Console/Commands/MigrateDownloadsCount.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
#[Signature('migrate:downloads-count')]
|
||||
#[Description('Command description')]
|
||||
class MigrateDownloadsCount extends Command
|
||||
{
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$rows = DB::table('migrations_logs')
|
||||
->where('source_system', 'wp')
|
||||
->where('source_table', 'wp_posts')
|
||||
->where('target_table', 'entries' )
|
||||
->get(['source_id', 'target_id'])
|
||||
;
|
||||
|
||||
$updated = 0;
|
||||
|
||||
foreach ($rows as $row) {
|
||||
$downloadCount = DB::connection('old_wp')
|
||||
->table('postmeta')
|
||||
->where('post_id', $row->source_id)
|
||||
->where('meta_key', 'download_counter' )
|
||||
->value('meta_value');
|
||||
|
||||
if( $downloadCount ) {
|
||||
DB::table('entries')->where('id', $row->target_id)->update(['old_download_count' => intval($downloadCount)]);
|
||||
$updated++;
|
||||
}
|
||||
}
|
||||
|
||||
$this->info('All done (' . $updated . '/' . count($rows) .')');
|
||||
}
|
||||
}
|
||||
22
app/Console/Commands/SubmissionsDown.php
Normal file
22
app/Console/Commands/SubmissionsDown.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
#[Signature('submissions:down')]
|
||||
#[Description('Disable submissions')]
|
||||
class SubmissionsDown extends Command
|
||||
{
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
Cache::put('submissions_maintenance', true );
|
||||
$this->info("Submissions disabled.");
|
||||
}
|
||||
}
|
||||
22
app/Console/Commands/SubmissionsUp.php
Normal file
22
app/Console/Commands/SubmissionsUp.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
#[Signature('submissions:up')]
|
||||
#[Description('Enable submissions')]
|
||||
class SubmissionsUp extends Command
|
||||
{
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
Cache::forget('submissions_maintenance');
|
||||
$this->info('Submissions enabled.');
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,8 @@ use App\Models\Entry;
|
||||
use App\Models\EntryFile;
|
||||
use App\Models\News;
|
||||
use App\Services\XenforoApiService;
|
||||
use GuzzleHttp\Exception\ConnectException;
|
||||
use GuzzleHttp\Exception\RequestException;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
@@ -74,25 +76,29 @@ class EntryHelpers {
|
||||
$cacheKey = "news_comments_{$entry->id}";
|
||||
else
|
||||
$cacheKey = "entry_comments_{$entry->id}";
|
||||
return Cache::remember($cacheKey, now()->addDays(1), function () use ($entry, $limit) {
|
||||
return Cache::flexible($cacheKey, [now()->addMinutes(30), now()->addMinutes(60)], function () use ($entry, $limit) {
|
||||
|
||||
$service = app(XenforoApiService::class);
|
||||
try {
|
||||
$service = app(XenforoApiService::class);
|
||||
|
||||
// Get thread infos and pagination.
|
||||
$paginationInfos = $service->getThreadPosts($entry->comments_thread_id, 1);
|
||||
$lastPage = $paginationInfos['pagination']['last_page'] ?? 1;
|
||||
// Get thread infos and pagination.
|
||||
$paginationInfos = $service->getThreadPosts($entry->comments_thread_id, 1);
|
||||
$lastPage = $paginationInfos['pagination']['last_page'] ?? 1;
|
||||
|
||||
// Get last threads
|
||||
$lastPageData = $lastPage > 1 ? $service->getThreadPosts($entry->comments_thread_id, $lastPage) : $paginationInfos;
|
||||
$posts = $lastPageData['posts'] ?? [];
|
||||
// Get last threads
|
||||
$lastPageData = $lastPage > 1 ? $service->getThreadPosts($entry->comments_thread_id, $lastPage) : $paginationInfos;
|
||||
$posts = $lastPageData['posts'] ?? [];
|
||||
|
||||
if( count( $posts ) < $limit && $lastPage > 1 ){
|
||||
$previousPageData = $service->getThreadPosts($entry->comments_thread_id, $lastPage - 1 );
|
||||
$posts = array_merge( $posts, $previousPageData['posts'] ?? [] );
|
||||
if (count($posts) < $limit && $lastPage > 1) {
|
||||
$previousPageData = $service->getThreadPosts($entry->comments_thread_id, $lastPage - 1);
|
||||
$posts = array_merge($posts, $previousPageData['posts'] ?? []);
|
||||
}
|
||||
|
||||
return collect($posts)->slice(-$limit)->reverse()->values()->toArray();
|
||||
} catch (ConnectException|RequestException $e ){
|
||||
return [];
|
||||
}
|
||||
|
||||
return collect( $posts )->slice(-$limit)->reverse()->values()->toArray();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class AuthorController extends Controller
|
||||
{
|
||||
$items = Author::withCount('entries')
|
||||
->orderBy('name')
|
||||
->tap(fn($query) => $this->applySearch($query, ['name']))
|
||||
->tap(fn($query) => $this->applySearch($query, ['id','name']))
|
||||
->paginate(30)
|
||||
->withQueryString();
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class GameController extends Controller
|
||||
public function index()
|
||||
{
|
||||
$items = Game::withCount('entries')->orderBy('name')
|
||||
->tap(fn($query) => $this->applySearch($query, ['name']))
|
||||
->tap(fn($query) => $this->applySearch($query, ['id','name']))
|
||||
->paginate(30)->withQueryString();
|
||||
$platforms = Platform::orderBy('name')->get();
|
||||
$genres = Genre::orderBy('name')->get();
|
||||
|
||||
@@ -18,7 +18,7 @@ class GenreController extends Controller
|
||||
{
|
||||
$items = Genre::withCount('games')
|
||||
->orderBy('name')
|
||||
->tap(fn($query) => $this->applySearch($query, ['name']))
|
||||
->tap(fn($query) => $this->applySearch($query, ['id','name']))
|
||||
->paginate(30)
|
||||
->withQueryString();
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class LanguageController extends Controller
|
||||
{
|
||||
$items = Language::withCount('entries')
|
||||
->orderBy('name')
|
||||
->tap(fn($query) => $this->applySearch($query, ['name']))
|
||||
->tap(fn($query) => $this->applySearch($query, ['id','name']))
|
||||
->paginate(30)
|
||||
->withQueryString();
|
||||
|
||||
|
||||
67
app/Http/Controllers/ModCP/LevelController.php
Normal file
67
app/Http/Controllers/ModCP/LevelController.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\ModCP;
|
||||
|
||||
use App\Helpers\EntryHelpers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Level;
|
||||
use App\Traits\ModCPSearch;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class LevelController extends Controller
|
||||
{
|
||||
|
||||
use ModCPSearch;
|
||||
|
||||
public function index()
|
||||
{
|
||||
$items = Level::withCount('entries')
|
||||
->orderBy('name')
|
||||
->tap(fn($query) => $this->applySearch($query, ['id','name']))
|
||||
->paginate(30)
|
||||
->withQueryString();
|
||||
|
||||
return view('modcp.resources', [
|
||||
'items' => $items,
|
||||
'title' => 'Levels',
|
||||
'singular' => 'Level',
|
||||
'storeRoute' => 'modcp.levels.store',
|
||||
'updateRoute' => 'modcp.levels.update',
|
||||
'destroyRoute' => 'modcp.levels.destroy'
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => 'required|string|max:255|unique:levels,name',
|
||||
]);
|
||||
|
||||
Level::create([
|
||||
'name' => trim($request->name),
|
||||
'slug' => EntryHelpers::uniqueSlug( $request->name, Level::class ),
|
||||
]);
|
||||
|
||||
return back()->with('success', 'Level added.');
|
||||
}
|
||||
|
||||
public function update(Request $request, Level $level)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => 'required|string|max:255|unique:levels,name,' . $level->id,
|
||||
]);
|
||||
|
||||
$level->update([
|
||||
'name' => trim($request->name),
|
||||
'slug' => EntryHelpers::uniqueSlug( $request->name, Level::class, $level->id ),
|
||||
]);
|
||||
|
||||
return back()->with('success', 'Level updated.');
|
||||
}
|
||||
|
||||
public function destroy(Level $level)
|
||||
{
|
||||
$level->delete();
|
||||
return back()->with('success', 'Level deleted.');
|
||||
}
|
||||
}
|
||||
67
app/Http/Controllers/ModCP/ModificationsController.php
Normal file
67
app/Http/Controllers/ModCP/ModificationsController.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\ModCP;
|
||||
|
||||
use App\Helpers\EntryHelpers;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Modification;
|
||||
use App\Traits\ModCPSearch;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ModificationsController extends Controller
|
||||
{
|
||||
|
||||
use ModCPSearch;
|
||||
|
||||
public function index()
|
||||
{
|
||||
$items = Modification::withCount('entries')
|
||||
->orderBy('name')
|
||||
->tap(fn($query) => $this->applySearch($query, ['id','name']))
|
||||
->paginate(30)
|
||||
->withQueryString();
|
||||
|
||||
return view('modcp.resources', [
|
||||
'items' => $items,
|
||||
'title' => 'Modifications',
|
||||
'singular' => 'Modification',
|
||||
'storeRoute' => 'modcp.modifications.store',
|
||||
'updateRoute' => 'modcp.modifications.update',
|
||||
'destroyRoute' => 'modcp.modifications.destroy'
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => 'required|string|max:255|unique:modifications,name',
|
||||
]);
|
||||
|
||||
Modification::create([
|
||||
'name' => trim($request->name),
|
||||
'slug' => EntryHelpers::uniqueSlug( $request->name, Modification::class ),
|
||||
]);
|
||||
|
||||
return back()->with('success', 'Modification added.');
|
||||
}
|
||||
|
||||
public function update(Request $request, Modification $Modification)
|
||||
{
|
||||
$request->validate([
|
||||
'name' => 'required|string|max:255|unique:modifications,name,' . $Modification->id,
|
||||
]);
|
||||
|
||||
$Modification->update([
|
||||
'name' => trim($request->name),
|
||||
'slug' => EntryHelpers::uniqueSlug( $request->name, Modification::class, $Modification->id ),
|
||||
]);
|
||||
|
||||
return back()->with('success', 'Modification updated.');
|
||||
}
|
||||
|
||||
public function destroy(Modification $Modification)
|
||||
{
|
||||
$Modification->delete();
|
||||
return back()->with('success', 'Modification deleted.');
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ class PlatformController extends Controller
|
||||
{
|
||||
$items = Platform::withCount(['games','entries'])
|
||||
->orderBy('name')
|
||||
->tap(fn($query) => $this->applySearch($query, ['name']))
|
||||
->tap(fn($query) => $this->applySearch($query, ['id','name']))
|
||||
->paginate(30)
|
||||
->withQueryString();
|
||||
|
||||
|
||||
@@ -78,8 +78,8 @@ class SubmissionController extends Controller
|
||||
'bg' => '#f3eaff1a',
|
||||
'border' => '#f3eaff40',
|
||||
],
|
||||
'lua-script' => [
|
||||
'slug' => 'lua-script',
|
||||
'lua-scripts' => [
|
||||
'slug' => 'lua-scripts',
|
||||
'label' => 'Lua script',
|
||||
'icon' => 'terminal',
|
||||
'color' => '#a04515',
|
||||
|
||||
33
app/Http/Middleware/SubmissionsEnabled.php
Normal file
33
app/Http/Middleware/SubmissionsEnabled.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class SubmissionsEnabled
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param Closure(Request): (Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if( Cache::get('submissions_maintenance', false ) ){
|
||||
if( $request->expectsJson() ){
|
||||
return response()->json([
|
||||
'message' => 'The submissions are currently in maintenance mode.',
|
||||
], 503 );
|
||||
}
|
||||
|
||||
return back()->withErrors([
|
||||
'maintenance' => "The submissions are currently in maintenance mode.",
|
||||
])->withInput();
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -175,6 +175,7 @@ class Database extends Component
|
||||
public const array SORT_OPTIONS = [
|
||||
'created_at' => 'Date added',
|
||||
'release_date' => 'Release date',
|
||||
'total_downloads' => 'Total downloads',
|
||||
'title' => 'Title'
|
||||
];
|
||||
|
||||
@@ -236,7 +237,7 @@ class Database extends Component
|
||||
{
|
||||
$query = Entry::query()->published()->with([
|
||||
'game.platform', 'game.genre', 'status', 'authors', 'languages', 'level', 'systems', 'categories', 'modifications'
|
||||
]);
|
||||
])->withSum('files', 'download_count');
|
||||
|
||||
if( $this->search ) {
|
||||
$query->where(function($q) {
|
||||
@@ -328,7 +329,13 @@ class Database extends Component
|
||||
$query->where('user_id', $this->userId);
|
||||
}
|
||||
|
||||
return $query->orderBy($this->sortBy, $this->sortDir);
|
||||
$sortColumn = $this->sortBy;
|
||||
|
||||
if ($sortColumn === 'total_downloads') {
|
||||
return $query->orderByRaw('COALESCE(files_sum_download_count, 0) + old_download_count ' . $this->sortDir);
|
||||
}
|
||||
|
||||
return $query->orderBy($sortColumn, $this->sortDir);
|
||||
}
|
||||
|
||||
private function searchFilter( string $modelClass, string $search )
|
||||
|
||||
@@ -21,6 +21,7 @@ class EntrySelector extends Component
|
||||
if( $entry ) {
|
||||
$this->selectedEntryId = $oldEntryId;
|
||||
$this->entryName = $entry->complete_title ?? $entry->title;
|
||||
$this->search = $entry->complete_title ?? $entry->title;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ use App\Services\XenforoService;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
@@ -32,6 +34,9 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
*/
|
||||
class Author extends Model
|
||||
{
|
||||
|
||||
use LogsActivity;
|
||||
|
||||
protected $fillable = [
|
||||
'name', 'slug', 'user_id', 'website'
|
||||
];
|
||||
@@ -49,4 +54,14 @@ class Author extends Model
|
||||
return app(XenforoService::class)->getXfUser($this->user_id);
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->useLogName('author')
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges()
|
||||
->setDescriptionForEvent(fn(string $eventName) => "Author {$eventName}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -253,6 +253,11 @@ class Entry extends Model
|
||||
return $converter->convert($this->description)->getContent();
|
||||
}
|
||||
|
||||
public function getTotalDownloadsAttribute(): int
|
||||
{
|
||||
return $this->files->sum('download_count') + $this->old_download_count;
|
||||
}
|
||||
|
||||
public function parseStaffCredits(): ?array {
|
||||
return json_decode( $this->staff_credits ?? "", true );
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Support\Str;
|
||||
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
@@ -41,7 +43,7 @@ use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||
class EntryReview extends Model
|
||||
{
|
||||
|
||||
use HasXenforoUserId, SoftDeletes;
|
||||
use HasXenforoUserId, SoftDeletes, LogsActivity;
|
||||
|
||||
protected $fillable = [ 'entry_id', 'title', 'rating', 'description', 'user_id' ];
|
||||
|
||||
@@ -60,4 +62,14 @@ class EntryReview extends Model
|
||||
return $converter->convert($this->description)->getContent();
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->useLogName('review')
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges()
|
||||
->setDescriptionForEvent(fn(string $eventName) => "Review {$eventName}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
@@ -31,6 +33,9 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
*/
|
||||
class Game extends Model
|
||||
{
|
||||
|
||||
use LogsActivity;
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
@@ -50,4 +55,14 @@ class Game extends Model
|
||||
{
|
||||
return $this->hasMany(Entry::class);
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->useLogName('game')
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges()
|
||||
->setDescriptionForEvent(fn(string $eventName) => "Game {$eventName}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
@@ -23,4 +24,9 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Level extends Model
|
||||
{
|
||||
protected $fillable = ['name', 'slug'];
|
||||
|
||||
public function entries(): HasMany
|
||||
{
|
||||
return $this->hasMany(Entry::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
@@ -23,4 +25,9 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Modification extends Model
|
||||
{
|
||||
protected $fillable = [ 'name', 'slug' ];
|
||||
|
||||
public function entries(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Entry::class, 'entry_modifications');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||
use Spatie\Activitylog\Models\Concerns\LogsActivity;
|
||||
use Spatie\Activitylog\Support\LogOptions;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
@@ -61,7 +63,7 @@ use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||
class News extends Model
|
||||
{
|
||||
|
||||
use SoftDeletes, HasGallery, HasXenforoUserId;
|
||||
use SoftDeletes, HasGallery, HasXenforoUserId, LogsActivity;
|
||||
|
||||
protected $table = 'news';
|
||||
|
||||
@@ -127,4 +129,14 @@ class News extends Model
|
||||
return EntryHelpers::getYoutubeVideoId( $this->youtube_link );
|
||||
}
|
||||
|
||||
public function getActivitylogOptions(): LogOptions
|
||||
{
|
||||
return LogOptions::defaults()
|
||||
->useLogName('news')
|
||||
->logAll()
|
||||
->logOnlyDirty()
|
||||
->dontLogEmptyChanges()
|
||||
->setDescriptionForEvent(fn(string $eventName) => "News {$eventName}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ class EntryPolicy
|
||||
return $user->_can('romhackplaza', 'canModerateEntries' );
|
||||
}
|
||||
|
||||
public function moderate(User $user, Entry $entry): bool
|
||||
public function moderate(User $user, ?Entry $entry = null): bool
|
||||
{
|
||||
return $user->_can('romhackplaza', 'canModerateEntries' );
|
||||
}
|
||||
|
||||
@@ -199,6 +199,9 @@ class ActivityService
|
||||
'post.user_id', 'post.message'
|
||||
])
|
||||
->get()
|
||||
->reject(function($post){
|
||||
return (int) $post->user_id === config('xenforo.bot_user_id');
|
||||
})
|
||||
->map($this->formatMessage(...))
|
||||
->toArray();
|
||||
});
|
||||
@@ -213,6 +216,7 @@ class ActivityService
|
||||
->join('post', 'thread.first_post_id', '=', 'post.post_id')
|
||||
->where('thread.discussion_state', 'visible')
|
||||
->where('thread.discussion_type', '!=', 'redirect' )
|
||||
->where('thread.node_id', '!=', config('xenforo.comments_node_id') )
|
||||
->orderByDesc('thread.post_date')
|
||||
->limit(self::ITEMS_PER_TYPE)
|
||||
->select([
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Entry;
|
||||
use App\Models\News;
|
||||
use Illuminate\Http\Client\ConnectionException;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
@@ -24,7 +25,7 @@ class XenforoApiService {
|
||||
*/
|
||||
private function get(string $endpoint, ?int $customUserId = null ): mixed
|
||||
{
|
||||
$response = Http::timeout(30)->withOptions(['verify' => false])->withHeaders([
|
||||
$response = Http::timeout(8)->connectTimeout(4)->withOptions(['verify' => false])->withHeaders([
|
||||
'XF-Api-Key' => $this->apiKey,
|
||||
'XF-Api-User' => $customUserId ?? $this->superUserId,
|
||||
])->get("{$this->apiUrl}/{$endpoint}");
|
||||
@@ -39,7 +40,7 @@ class XenforoApiService {
|
||||
|
||||
private function post(string $endpoint, ?int $customUserId = null, array $data = [] ): mixed
|
||||
{
|
||||
$response = Http::timeout(30)->withOptions(['verify' => false])->withHeaders([
|
||||
$response = Http::timeout(8)->connectTimeout(4)->withOptions(['verify' => false])->withHeaders([
|
||||
'XF-Api-Key' => $this->apiKey,
|
||||
'XF-Api-User' => $customUserId ?? $this->superUserId,
|
||||
])->post("{$this->apiUrl}/{$endpoint}", $data);
|
||||
@@ -54,7 +55,7 @@ class XenforoApiService {
|
||||
|
||||
private function delete(string $endpoint, ?int $customUserId = null, array $data = [] ): mixed
|
||||
{
|
||||
$response = Http::timeout(30)->withOptions(['verify' => false])->withHeaders([
|
||||
$response = Http::timeout(8)->connectTimeout(4)->withOptions(['verify' => false])->withHeaders([
|
||||
'XF-Api-Key' => $this->apiKey,
|
||||
'XF-Api-User' => $customUserId ?? $this->superUserId,
|
||||
])->delete("{$this->apiUrl}/{$endpoint}", $data);
|
||||
@@ -81,7 +82,7 @@ class XenforoApiService {
|
||||
public function markAllNotificationsRead(int $userId): void
|
||||
{
|
||||
Cache::forget("xf_alerts_{$userId}");
|
||||
$this->post("alerts/mark-all", $userId );
|
||||
$this->post("alerts/mark-all", $userId, ['read' => true, 'viewed' => true] );
|
||||
}
|
||||
|
||||
public function getConversations(int $userId): mixed
|
||||
@@ -104,10 +105,10 @@ class XenforoApiService {
|
||||
if( !$entry->comments_thread_id || $entry->comments_thread_id <= 0 ){
|
||||
$data = [
|
||||
'node_id' => config('xenforo.comments_node_id'),
|
||||
'title' => $entry->complete_title,
|
||||
'title' => $entry->complete_title ?? $entry->title,
|
||||
'message' => $entry->description,
|
||||
'prefix_id' => config('xenforo.comments_prefixes')[$entry->type] ?? 1,
|
||||
'custom_fields' => [ 'entry_id' => $entry->id ],
|
||||
'prefix_id' => config('xenforo.comments_prefixes')[$entry->type ?? "news"] ?? 1,
|
||||
'custom_fields' => $entry->type ? [ 'entry_id' => $entry->id ] : [ 'news_id' => $entry->id ],
|
||||
'discussion_open' => true,
|
||||
];
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@ class ErrorBlock extends Component
|
||||
'icon' => 'ban',
|
||||
'message' => '%s'
|
||||
],
|
||||
'not-found' => [
|
||||
'icon' => 'sticky-note-off',
|
||||
'message' => "404: This page does not exist."
|
||||
],
|
||||
'page-not-allowed' => [
|
||||
'icon' => 'shield-ban',
|
||||
'message' => "You do not have permission to access this page.\nRequired permission: %s"
|
||||
@@ -21,6 +25,10 @@ class ErrorBlock extends Component
|
||||
'user-state-not-valid' => [
|
||||
'icon' => 'shield-ban',
|
||||
'message' => "You do not have permission to access this page.\nYour user profile is incomplete: %s\nGo back to the forum for more details."
|
||||
],
|
||||
'server-error' => [
|
||||
'icon' => 'bomb',
|
||||
'message' => "500: Internal Server Error."
|
||||
]
|
||||
];
|
||||
|
||||
|
||||
@@ -61,6 +61,10 @@ class SubmitEntryStatus extends Component
|
||||
}
|
||||
}
|
||||
|
||||
if( $this->isEdit && $this->entry->state === 'pending' && isset( $states['published'] ) ) {
|
||||
unset( $states['published'] );
|
||||
}
|
||||
|
||||
return $states;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ return Application::configure(basePath: dirname(__DIR__))
|
||||
$middleware->encryptCookies(except: ['xf_session','xf_user','xf_csrf','xf_style_variation','activity_filters']);
|
||||
$middleware->alias([
|
||||
'xf.auth' => \App\Http\Middleware\CheckXenForoPermissions::class,
|
||||
'submissions.maintenance' => \App\Http\Middleware\SubmissionsEnabled::class,
|
||||
]);
|
||||
$middleware->redirectGuestsTo(function(Request $request): void {
|
||||
if( $request->is('manage*'))
|
||||
@@ -24,5 +25,28 @@ return Application::configure(basePath: dirname(__DIR__))
|
||||
$middleware->append(\App\Http\Middleware\CheckXenForoUserState::class);
|
||||
})
|
||||
->withExceptions(function (Exceptions $exceptions): void {
|
||||
//
|
||||
$exceptions->render(function(Throwable $e, $request) {
|
||||
if (
|
||||
$e instanceof \Illuminate\Validation\ValidationException ||
|
||||
$e instanceof \Illuminate\Auth\AuthenticationException ||
|
||||
$e instanceof \Illuminate\Auth\Access\AuthorizationException ||
|
||||
$e instanceof \Symfony\Component\HttpKernel\Exception\HttpException
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
$statusCode = method_exists($e, 'getStatusCode') ? $e->getStatusCode() : 500;
|
||||
|
||||
if( app()->environment('production') && $statusCode >= 500 && !$request->expectsJson() ){
|
||||
$errorId = (string) Str::uuid();
|
||||
|
||||
\Illuminate\Support\Facades\Log::error($e->getMessage(), [
|
||||
'error_id' => $errorId,
|
||||
'exception' => $e,
|
||||
'url' => $request->fullUrl(),
|
||||
'user_id' => (optional($request->user())->user_id ?? 0),
|
||||
]);
|
||||
|
||||
return response()->view('errors.500', ['errorId' => $errorId], 500 );
|
||||
}
|
||||
});
|
||||
})->create();
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'bot_user_id' => 1,
|
||||
|
||||
'comments_node_id' => 4,
|
||||
|
||||
'comments_prefixes' => [
|
||||
'translations' => 1,
|
||||
'romhacks' => 2,
|
||||
'homebrew' => 3,
|
||||
'utilities' => 4,
|
||||
'documents' => 5,
|
||||
'lua-scripts' => 6,
|
||||
'tutorials' => 7,
|
||||
'news' => 8
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('entries', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('old_download_count')->default(0);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('entries', function (Blueprint $table) {
|
||||
$table->dropColumn('old_download_count');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -94,21 +94,36 @@
|
||||
color: var(--text3);
|
||||
border-color: var(--rhpz-orange);
|
||||
}
|
||||
.badge.blue, .badge.translations {
|
||||
.badge.blue, .badge.romhacks {
|
||||
background-color: var(--info);
|
||||
color: var(--text);
|
||||
border-color: var(--info);
|
||||
}
|
||||
.badge.green, .badge.romhacks {
|
||||
.badge.green, .badge.translations {
|
||||
background-color: var(--success2);
|
||||
color: var(--text);
|
||||
border-color: var(--success2);
|
||||
}
|
||||
.badge.red, .badge.homebrew {
|
||||
background-color: #bf2323;
|
||||
color: var(--text);
|
||||
border-color: #bf2323;
|
||||
}
|
||||
.badge.yellow, .badge.utilities {
|
||||
background-color: #fdeb0f;
|
||||
color: #000;
|
||||
border-color: #fdeb0f;
|
||||
}
|
||||
.badge.purple, .badge.documents{
|
||||
background-color: #8b23bf;
|
||||
color: var(--text);
|
||||
border-color: #8b23bf;
|
||||
}
|
||||
.badge.brown, .badge.lua-scripts {
|
||||
background-color: #b4825f;
|
||||
color: var(--text);
|
||||
border-color: #b4825f;
|
||||
}
|
||||
|
||||
.topbar-badge {
|
||||
position: absolute;
|
||||
|
||||
@@ -220,6 +220,9 @@
|
||||
overflow: hidden;
|
||||
background-color: var(--bg4);
|
||||
border: 1px solid var(--border);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</div>
|
||||
<div style="margin-bottom:10px">
|
||||
<span class="badge {{ $entry->type }}">{{ \App\View\Components\EntryCard::ENTRY_TYPES_BADGE[$entry->type] ?? $entry->type }}</span>
|
||||
@if( section_must_be('romhacks', $entry->type ) )
|
||||
@if( section_must_be(['romhacks', 'lua-scripts'], $entry->type ) )
|
||||
@foreach( $entry->modifications as $modif )
|
||||
<span class="badge orange">{{ $modif->name }}</span>
|
||||
@endforeach
|
||||
@@ -28,7 +28,7 @@
|
||||
@foreach( $entry->languages as $lang )
|
||||
<span class="badge orange">{{ $lang->name }}</span>
|
||||
@endforeach
|
||||
@elseif( section_must_be( 'utilities', $entry->type ) )
|
||||
@elseif( section_must_be( ['utilities', 'documents'], $entry->type ) )
|
||||
@foreach( $entry->categories as $category )
|
||||
<span class="badge orange">{{ $category->name }}</span>
|
||||
@endforeach
|
||||
@@ -46,7 +46,7 @@
|
||||
@endif
|
||||
</div>
|
||||
<div class="entry-card-meta">
|
||||
<span><i data-lucide="download" size="12"></i> x</span>
|
||||
<span><i data-lucide="download" size="12"></i> {{ $entry->total_downloads ?? 0 }}</span>
|
||||
<span>Added: {{ $entry->created_at->format('y-m-d') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
<x-form-field-title name="Screenshots" helper="At least 1 Screenshot required, Maximum 20." required="{{ $required ? 'true' : 'false' }}" />
|
||||
<div class="form-group main-image-grid">
|
||||
<div class="form-upload" style="flex:1;" :class="{ 'disabled': isFull }">
|
||||
<input type="file" id="gallery-field" accept="image/png, image/jpeg, image/webp" multiple :disabled="isFull" @change="handleSubmitFiles($event)">
|
||||
<input type="file" id="gallery-field" accept="image/png, image/jpeg, image/webp, image/gif" multiple :disabled="isFull" @change="handleSubmitFiles($event)">
|
||||
<div class="form-upload-placeholder level">
|
||||
<i data-lucide="file-archive" size="36" style="margin-bottom:15px;color:var(--text2)"></i>
|
||||
<div style="font-size: 1.1rem;color:var(--text);margin-bottom:5px;">
|
||||
Click or drag'n drop files here.
|
||||
</div>
|
||||
<div style="font-size:0.85rem;color:var(--text2);">
|
||||
Accepted: PNG, JPG or WebP
|
||||
Accepted: PNG, JPG, GIF or WebP
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
<x-form-field-title name="Main image" helper="This will show up on the index and on top of the entry. A screenshot or custom cover is prefered else all entries of same game will look the same." required="{{ $required ? 'true' : 'false' }}" />
|
||||
<div class="form-group main-image-grid">
|
||||
<div class="form-upload" style="flex:4;">
|
||||
<input type="file" id="main-image-field" accept="image/png, image/jpeg, image/webp" @change="handleSubmitFile($event)">
|
||||
<input type="file" id="main-image-field" accept="image/png, image/jpeg, image/webp, image/gif" @change="handleSubmitFile($event)">
|
||||
<div class="form-upload-placeholder level">
|
||||
<i data-lucide="file-archive" size="36" style="margin-bottom:15px;color:var(--text2)"></i>
|
||||
<div style="font-size: 1.1rem;color:var(--text);margin-bottom:5px;">
|
||||
Click or drag'n drop files here.
|
||||
</div>
|
||||
<div style="font-size:0.85rem;color:var(--text2);">
|
||||
Accepted: PNG, JPG or WebP
|
||||
Accepted: PNG, JPG, GIF or WebP
|
||||
</div>
|
||||
</div>
|
||||
<input type="hidden" name="main-image" x-model="serverFilePath">
|
||||
|
||||
@@ -122,6 +122,9 @@
|
||||
<x-entry-meta-item label="Release Date" value="{{ $entry->release_date->format('Y-m-d') }}"
|
||||
route="none"/>
|
||||
@endif
|
||||
@if( $entry->total_downloads )
|
||||
<x-entry-meta-item label="Downloads" value="{{ $entry->total_downloads }}" route="none" />
|
||||
@endif
|
||||
</div>
|
||||
<div class="hack-actions" style="display:flex;gap:10px;">
|
||||
@if($entry->state === 'pending')
|
||||
|
||||
6
resources/views/errors/403.blade.php
Normal file
6
resources/views/errors/403.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<x-error-block error-type="page-not-allowed" message="Unknown" />
|
||||
<a class="btn" href="javascript:history.go(-1)">Go back to the previous page</a>
|
||||
@endsection
|
||||
6
resources/views/errors/404.blade.php
Normal file
6
resources/views/errors/404.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<x-error-block error-type="not-found" />
|
||||
<a class="btn" href="javascript:history.go(-1)">Go back to the previous page</a>
|
||||
@endsection
|
||||
6
resources/views/errors/4xx.blade.php
Normal file
6
resources/views/errors/4xx.blade.php
Normal file
@@ -0,0 +1,6 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('content')
|
||||
<x-error-block error-type="custom" message="{{ $exception->getMessage() }}" />
|
||||
<a class="btn" href="javascript:history.go(-1)">Go back to the previous page</a>
|
||||
@endsection
|
||||
305
resources/views/errors/500.blade.php
Normal file
305
resources/views/errors/500.blade.php
Normal file
@@ -0,0 +1,305 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>500 - Internal server error - Romhack Plaza</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
|
||||
:root {
|
||||
|
||||
/* RHPZ color */
|
||||
--rhpz-orange: #ff7300;
|
||||
--rhpz-orange-hover: #e56700;
|
||||
|
||||
/* Background colors */
|
||||
--bg: #1e1e1e;
|
||||
--bg2: #252526;
|
||||
--bg3: #2d2d30;
|
||||
--bg4: #3e3e42;
|
||||
|
||||
/* Text */
|
||||
--text: #f1f1f1;
|
||||
--text2: #a1a1aa;
|
||||
--text3: #111111;
|
||||
|
||||
/* Elements */
|
||||
--border: #3f3f46;
|
||||
--error: #e57373;
|
||||
--info: #1976d2;
|
||||
--success: #81c784;
|
||||
--success2: #388e3c;
|
||||
|
||||
/* Typo */
|
||||
--typography: 'Segoe UI', 'San Francisco', 'Helvetica Neue', sans-serif;
|
||||
|
||||
/* Menu settings */
|
||||
--menu-size: 260px;
|
||||
--menu-user-avatar-bg: #555;
|
||||
|
||||
/* Gap */
|
||||
--gap: 15px;
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: var(--typography);
|
||||
background-color: var(--bg);
|
||||
color: var(--text);
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--rhpz-orange);
|
||||
text-decoration: none;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: var(--rhpz-orange-hover);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#app {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin-left: 20px;
|
||||
margin-bottom: 20px;
|
||||
list-style-type: square;
|
||||
}
|
||||
|
||||
[x-cloak] {display: none !important;}
|
||||
|
||||
|
||||
/* BUTTONS */
|
||||
|
||||
.btn {
|
||||
background-color: var(--bg3);
|
||||
border: 1px solid var(--border);
|
||||
color: var(--text);
|
||||
padding: 8px 16px;
|
||||
font-size: 0.9rem;
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
transition: all 0.1s;
|
||||
}
|
||||
.btn:hover {
|
||||
background-color: var(--bg4);
|
||||
border-color: var(--menu-user-avatar-bg);
|
||||
}
|
||||
.btn.primary {
|
||||
background-color: var(--rhpz-orange);
|
||||
color: var(--text3);
|
||||
border-color: var(--rhpz-orange);
|
||||
font-weight: 600;
|
||||
}
|
||||
.btn.primary:hover {
|
||||
background-color: var(--rhpz-orange-hover);
|
||||
border-color: var(--rhpz-orange-hover);
|
||||
}
|
||||
.btn.danger {
|
||||
background-color: transparent;
|
||||
color: var(--error);
|
||||
border-color: var(--error);
|
||||
}
|
||||
.btn.danger:hover {
|
||||
background-color: rgba(229, 115, 115, 0.1);
|
||||
}
|
||||
.btn.success {
|
||||
background-color: transparent;
|
||||
color: var(--success);
|
||||
border-color: var(--success);
|
||||
}
|
||||
.btn.success:hover {
|
||||
background-color: rgba(129, 199, 132, 0.1);
|
||||
}
|
||||
|
||||
/* BLOCK */
|
||||
|
||||
.block {
|
||||
background-color: var(--bg2);
|
||||
border: 1px solid var(--border);
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.block.featured {
|
||||
border-left: 3px solid var(--rhpz-orange);
|
||||
}
|
||||
.block-header {
|
||||
font-size: 1.2rem;
|
||||
color: var(--text);
|
||||
margin-bottom: 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
.block-success {
|
||||
background-color: var(--success);
|
||||
border: 1px solid var(--success);
|
||||
color: var(--text);
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.block-error {
|
||||
background-color: var(--error);
|
||||
border: 1px solid var(--error);
|
||||
color: var(--text);
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* PAGE */
|
||||
|
||||
.page-title {
|
||||
font-size: 1.8rem;
|
||||
font-weight: 300;
|
||||
margin-bottom: 20px;
|
||||
color: var(--text);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* TEXTS */
|
||||
|
||||
.whisper {
|
||||
color: var(--text2);
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.content-title {
|
||||
color: var(--text);
|
||||
margin: 30px 0 15px 0;
|
||||
border-left: 3px solid var(--rhpz-orange);
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.quote {
|
||||
background-color: var(--bg);
|
||||
border-left: 4px solid #1976d2;
|
||||
padding: 15px;
|
||||
margin-top: 30px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.btn {
|
||||
padding: 7px 12px;
|
||||
font-size: 0.85rem;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.block {
|
||||
padding: 15px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.block-header {
|
||||
font-size: 1.05rem;
|
||||
margin-bottom: 12px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 1.5rem;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.content-title {
|
||||
margin: 20px 0 12px 0;
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
||||
.quote {
|
||||
padding: 12px;
|
||||
margin-top: 20px;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.whisper {
|
||||
margin-bottom: 12px;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.breadcrumb {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.btn {
|
||||
padding: 6px 10px;
|
||||
font-size: 0.8rem;
|
||||
gap: 4px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.btn.primary, .btn.danger, .btn.success {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.block {
|
||||
padding: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.block-header {
|
||||
font-size: 0.95rem;
|
||||
margin-bottom: 10px;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 1.2rem;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.badge {
|
||||
padding: 2px 6px;
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
|
||||
.topbar-badge {
|
||||
min-width: 16px;
|
||||
height: 16px;
|
||||
padding: 0 3px;
|
||||
font-size: 0.6rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" style="display:flex;flex-direction: column;align-items: center;justify-content: center;">
|
||||
<main id="main-wrapper">
|
||||
<main id="content">
|
||||
<div class="block">
|
||||
<div class="page-title">500 - Internal server error</div>
|
||||
<p>To resolve the issue quickly, please report it on Gitea, Discord, or the forum with the following information.</p>
|
||||
<ul>
|
||||
<li>Your error code: {{ $errorId ?? "" }}</li>
|
||||
<li>What you were doing before the error occurred.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>
|
||||
<a href="https://code.romhackplaza.org/RHPZAdmin/RomhackPlaza/issues" class="btn primary">Report the problem on Gitea</a>
|
||||
<a href="https://community.romhackplaza.org/forums/bug-reports.6/" class="btn primary">Report the problem on the forum</a>
|
||||
<a href="https://community.romhackplaza.org/misc/contact/" class="btn">Report the problem with the contact form</a>
|
||||
<a href="https://discord.gg/5CKzeWmZZU" class="btn">Report the problem on Discord</a>
|
||||
</div>
|
||||
</main>
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -24,6 +24,9 @@
|
||||
@if(session('error'))
|
||||
<x-error-block error-type="custom" :message="session('error')" />
|
||||
@endif
|
||||
@if(isset($errors) && $errors->has('maintenance'))
|
||||
<x-error-block error-type="custom" :message="$errors->get('maintenance')[0]" />
|
||||
@endif
|
||||
@yield('content')
|
||||
</div>
|
||||
</main>
|
||||
|
||||
@@ -27,10 +27,12 @@
|
||||
|
||||
<div class="modcp-nav-group">
|
||||
<span class="modcp-nav-label">Content</span>
|
||||
<a href="{{ route('modcp.locked') }}" class="modcp-nav-item" {{ request()->routeIs('modcp.locked') ? 'active' : '' }}>
|
||||
<i data-lucide="lock" size="15"></i>
|
||||
Locked entries
|
||||
</a>
|
||||
@can('moderate','\App\Models\Entry')
|
||||
<a href="{{ route('modcp.locked') }}" class="modcp-nav-item" {{ request()->routeIs('modcp.locked') ? 'active' : '' }}>
|
||||
<i data-lucide="lock" size="15"></i>
|
||||
Locked entries
|
||||
</a>
|
||||
@endcan
|
||||
@can('is-admin')
|
||||
<a href="{{ route('modcp.draft') }}" class="modcp-nav-item" {{ request()->routeIs('modcp.draft') ? 'active' : '' }}>
|
||||
<i data-lucide="scissors" size="15"></i>
|
||||
@@ -74,6 +76,14 @@
|
||||
<i data-lucide="box" size="15"></i>
|
||||
Genres
|
||||
</a>
|
||||
<a href="{{ route('modcp.levels.index') }}" class="modcp-nav-item" {{ request()->routeIs('modcp.levels.*') ? 'active' : '' }}">
|
||||
<i data-lucide="weight" size="15"></i>
|
||||
Levels
|
||||
</a>
|
||||
<a href="{{ route('modcp.modifications.index') }}" class="modcp-nav-item" {{ request()->routeIs('modcp.modifications.*') ? 'active' : '' }}">
|
||||
<i data-lucide="pencil-ruler" size="15"></i>
|
||||
Modifications
|
||||
</a>
|
||||
@endcan
|
||||
</div>
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@
|
||||
</div>
|
||||
|
||||
<div class="log-pagination">
|
||||
{{ $logs->links() }}
|
||||
{{ $logs->links('modcp.pagination') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
299
resources/views/maintenance.blade.php
Normal file
299
resources/views/maintenance.blade.php
Normal file
@@ -0,0 +1,299 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>500 - Internal server error - Romhack Plaza</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
|
||||
:root {
|
||||
|
||||
/* RHPZ color */
|
||||
--rhpz-orange: #ff7300;
|
||||
--rhpz-orange-hover: #e56700;
|
||||
|
||||
/* Background colors */
|
||||
--bg: #1e1e1e;
|
||||
--bg2: #252526;
|
||||
--bg3: #2d2d30;
|
||||
--bg4: #3e3e42;
|
||||
|
||||
/* Text */
|
||||
--text: #f1f1f1;
|
||||
--text2: #a1a1aa;
|
||||
--text3: #111111;
|
||||
|
||||
/* Elements */
|
||||
--border: #3f3f46;
|
||||
--error: #e57373;
|
||||
--info: #1976d2;
|
||||
--success: #81c784;
|
||||
--success2: #388e3c;
|
||||
|
||||
/* Typo */
|
||||
--typography: 'Segoe UI', 'San Francisco', 'Helvetica Neue', sans-serif;
|
||||
|
||||
/* Menu settings */
|
||||
--menu-size: 260px;
|
||||
--menu-user-avatar-bg: #555;
|
||||
|
||||
/* Gap */
|
||||
--gap: 15px;
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: var(--typography);
|
||||
background-color: var(--bg);
|
||||
color: var(--text);
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--rhpz-orange);
|
||||
text-decoration: none;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: var(--rhpz-orange-hover);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#app {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin-left: 20px;
|
||||
margin-bottom: 20px;
|
||||
list-style-type: square;
|
||||
}
|
||||
|
||||
[x-cloak] {display: none !important;}
|
||||
|
||||
|
||||
/* BUTTONS */
|
||||
|
||||
.btn {
|
||||
background-color: var(--bg3);
|
||||
border: 1px solid var(--border);
|
||||
color: var(--text);
|
||||
padding: 8px 16px;
|
||||
font-size: 0.9rem;
|
||||
cursor: pointer;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
transition: all 0.1s;
|
||||
}
|
||||
.btn:hover {
|
||||
background-color: var(--bg4);
|
||||
border-color: var(--menu-user-avatar-bg);
|
||||
}
|
||||
.btn.primary {
|
||||
background-color: var(--rhpz-orange);
|
||||
color: var(--text3);
|
||||
border-color: var(--rhpz-orange);
|
||||
font-weight: 600;
|
||||
}
|
||||
.btn.primary:hover {
|
||||
background-color: var(--rhpz-orange-hover);
|
||||
border-color: var(--rhpz-orange-hover);
|
||||
}
|
||||
.btn.danger {
|
||||
background-color: transparent;
|
||||
color: var(--error);
|
||||
border-color: var(--error);
|
||||
}
|
||||
.btn.danger:hover {
|
||||
background-color: rgba(229, 115, 115, 0.1);
|
||||
}
|
||||
.btn.success {
|
||||
background-color: transparent;
|
||||
color: var(--success);
|
||||
border-color: var(--success);
|
||||
}
|
||||
.btn.success:hover {
|
||||
background-color: rgba(129, 199, 132, 0.1);
|
||||
}
|
||||
|
||||
/* BLOCK */
|
||||
|
||||
.block {
|
||||
background-color: var(--bg2);
|
||||
border: 1px solid var(--border);
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.block.featured {
|
||||
border-left: 3px solid var(--rhpz-orange);
|
||||
}
|
||||
.block-header {
|
||||
font-size: 1.2rem;
|
||||
color: var(--text);
|
||||
margin-bottom: 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
.block-success {
|
||||
background-color: var(--success);
|
||||
border: 1px solid var(--success);
|
||||
color: var(--text);
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.block-error {
|
||||
background-color: var(--error);
|
||||
border: 1px solid var(--error);
|
||||
color: var(--text);
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* PAGE */
|
||||
|
||||
.page-title {
|
||||
font-size: 1.8rem;
|
||||
font-weight: 300;
|
||||
margin-bottom: 20px;
|
||||
color: var(--text);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* TEXTS */
|
||||
|
||||
.whisper {
|
||||
color: var(--text2);
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.content-title {
|
||||
color: var(--text);
|
||||
margin: 30px 0 15px 0;
|
||||
border-left: 3px solid var(--rhpz-orange);
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.quote {
|
||||
background-color: var(--bg);
|
||||
border-left: 4px solid #1976d2;
|
||||
padding: 15px;
|
||||
margin-top: 30px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.btn {
|
||||
padding: 7px 12px;
|
||||
font-size: 0.85rem;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.block {
|
||||
padding: 15px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.block-header {
|
||||
font-size: 1.05rem;
|
||||
margin-bottom: 12px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 1.5rem;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.content-title {
|
||||
margin: 20px 0 12px 0;
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
||||
.quote {
|
||||
padding: 12px;
|
||||
margin-top: 20px;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.whisper {
|
||||
margin-bottom: 12px;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.breadcrumb {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.btn {
|
||||
padding: 6px 10px;
|
||||
font-size: 0.8rem;
|
||||
gap: 4px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.btn.primary, .btn.danger, .btn.success {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.block {
|
||||
padding: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.block-header {
|
||||
font-size: 0.95rem;
|
||||
margin-bottom: 10px;
|
||||
padding-bottom: 6px;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
font-size: 1.2rem;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.badge {
|
||||
padding: 2px 6px;
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
|
||||
.topbar-badge {
|
||||
min-width: 16px;
|
||||
height: 16px;
|
||||
padding: 0 3px;
|
||||
font-size: 0.6rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app" style="display:flex;flex-direction: column;align-items: center;justify-content: center;">
|
||||
<main id="main-wrapper">
|
||||
<main id="content">
|
||||
<div class="block">
|
||||
<div class="page-title">Maintenance is in progress.</div>
|
||||
<p>Please wait until maintenance is complete. Follow the Discord server or the forum if this is unscheduled maintenance.</p>
|
||||
</div>
|
||||
<div>
|
||||
<a href="https://community.romhackplaza.org/" class="btn primary">Go to the forum</a>
|
||||
<a href="https://discord.gg/5CKzeWmZZU" class="btn">Go to Discord</a>
|
||||
</div>
|
||||
</main>
|
||||
</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -84,6 +84,6 @@
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
{{ $items->links() }}
|
||||
{{ $items->links('modcp.pagination') }}
|
||||
|
||||
@endsection
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
{{ $entries->links() }}
|
||||
{{ $entries->links('modcp.pagination') }}
|
||||
@endif
|
||||
|
||||
@endsection
|
||||
|
||||
@@ -47,6 +47,6 @@
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
{{ $entries->links() }}
|
||||
{{ $entries->links( 'modcp.pagination' ) }}
|
||||
@endif
|
||||
@endsection
|
||||
|
||||
@@ -98,6 +98,6 @@
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
{{ $items->links() }}
|
||||
{{ $items->links('modcp.pagination') }}
|
||||
|
||||
@endsection
|
||||
|
||||
@@ -14,13 +14,15 @@
|
||||
<span class="modcp-stat-label">In queue</span>
|
||||
</div>
|
||||
</a>
|
||||
<a href="{{ route('modcp.locked') }}" class="modcp-stat-card">
|
||||
<div class="modcp-stat-icon"><i data-lucide="lock" size="22"></i></div>
|
||||
<div class="modcp-stat-info">
|
||||
<span class="modcp-stat-value">{{ $stats['locked'] }}</span>
|
||||
<span class="modcp-stat-label">Locked</span>
|
||||
</div>
|
||||
</a>
|
||||
@can('moderate','\App\Models\Entry')
|
||||
<a href="{{ route('modcp.locked') }}" class="modcp-stat-card">
|
||||
<div class="modcp-stat-icon"><i data-lucide="lock" size="22"></i></div>
|
||||
<div class="modcp-stat-info">
|
||||
<span class="modcp-stat-value">{{ $stats['locked'] }}</span>
|
||||
<span class="modcp-stat-label">Locked</span>
|
||||
</div>
|
||||
</a>
|
||||
@endcan
|
||||
@can('is-admin')
|
||||
<a href="{{ route('modcp.draft') }}" class="modcp-stat-card">
|
||||
<div class="modcp-stat-icon"><i data-lucide="scissors" size="22"></i></div>
|
||||
@@ -54,37 +56,39 @@
|
||||
</div>
|
||||
|
||||
@if($recentDeleted->isNotEmpty())
|
||||
<div class="modcp-section-title" style="margin-top: 25px;">Recently deleted</div>
|
||||
<div class="modcp-list">
|
||||
@foreach($recentDeleted as $entry)
|
||||
<div class="modcp-list-item">
|
||||
<div class="modcp-list-item-info">
|
||||
<span class="modcp-list-item-title">{{ $entry->complete_title ?? $entry->title }}</span>
|
||||
<span class="modcp-list-item-meta">
|
||||
<span class="badge {{ $entry->type }}">{{ $entry->type }}</span>
|
||||
Deleted {{ $entry->deleted_at->diffForHumans() }}
|
||||
</span>
|
||||
@can('is-admin')
|
||||
<div class="modcp-section-title" style="margin-top: 25px;">Recently deleted</div>
|
||||
<div class="modcp-list">
|
||||
@foreach($recentDeleted as $entry)
|
||||
<div class="modcp-list-item">
|
||||
<div class="modcp-list-item-info">
|
||||
<span class="modcp-list-item-title">{{ $entry->complete_title ?? $entry->title }}</span>
|
||||
<span class="modcp-list-item-meta">
|
||||
<span class="badge {{ $entry->type }}">{{ $entry->type }}</span>
|
||||
Deleted {{ $entry->deleted_at->diffForHumans() }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="modcp-list-item-actions">
|
||||
<form action="{{ route('modcp.restore', $entry->id) }}" method="POST" style="display:inline">
|
||||
@csrf @method('PATCH')
|
||||
<button type="submit" class="btn success">
|
||||
<i data-lucide="rotate-ccw" size="13"></i> Restore
|
||||
</button>
|
||||
</form>
|
||||
<form action="{{ route('modcp.destroy', $entry->id) }}" method="POST" style="display:inline"
|
||||
onsubmit="return confirm('Permanently delete?')">
|
||||
@csrf @method('DELETE')
|
||||
<button type="submit" class="btn danger">
|
||||
<i data-lucide="trash-2" size="13"></i> Purge
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modcp-list-item-actions">
|
||||
<form action="{{ route('modcp.restore', $entry->id) }}" method="POST" style="display:inline">
|
||||
@csrf @method('PATCH')
|
||||
<button type="submit" class="btn success">
|
||||
<i data-lucide="rotate-ccw" size="13"></i> Restore
|
||||
</button>
|
||||
</form>
|
||||
<form action="{{ route('modcp.destroy', $entry->id) }}" method="POST" style="display:inline"
|
||||
onsubmit="return confirm('Permanently delete?')">
|
||||
@csrf @method('DELETE')
|
||||
<button type="submit" class="btn danger">
|
||||
<i data-lucide="trash-2" size="13"></i> Purge
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
<a href="{{ route('modcp.deleted') }}" class="modcp-list-see-all">
|
||||
See all deleted entries →
|
||||
</a>
|
||||
@endforeach
|
||||
<a href="{{ route('modcp.deleted') }}" class="modcp-list-see-all">
|
||||
See all deleted entries →
|
||||
</a>
|
||||
@endcan
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
34
resources/views/modcp/pagination.blade.php
Normal file
34
resources/views/modcp/pagination.blade.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php /** @var \Illuminate\Pagination\LengthAwarePaginator $paginator */ ?>
|
||||
@if ($paginator->hasPages())
|
||||
<div class="database-pagination">
|
||||
|
||||
@if ($paginator->onFirstPage())
|
||||
<button class="btn" disabled>«</button>
|
||||
@else
|
||||
<a class="btn" href="{{ $paginator->previousPageUrl() }}">«</a>
|
||||
@endif
|
||||
|
||||
{{-- Pages --}}
|
||||
@foreach ($elements as $element)
|
||||
@if (is_string($element))
|
||||
<button class="btn" disabled>{{ $element }}</button>
|
||||
@endif
|
||||
|
||||
@if (is_array($element))
|
||||
@foreach ($element as $page => $url)
|
||||
<a
|
||||
class="btn {{ $page == $paginator->currentPage() ? 'active' : '' }}"
|
||||
href="{{ $url }}"
|
||||
>{{ $page }}</a>
|
||||
@endforeach
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
@if ($paginator->hasMorePages())
|
||||
<a class="btn" href="{{ $paginator->nextPageUrl() }}">»</a>
|
||||
@else
|
||||
<button class="btn" disabled>»</button>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
@endif
|
||||
@@ -71,6 +71,6 @@
|
||||
@endforelse
|
||||
</div>
|
||||
|
||||
{{ $items->links() }}
|
||||
{{ $items->links('modcp.pagination') }}
|
||||
|
||||
@endsection
|
||||
|
||||
@@ -154,71 +154,73 @@
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
<aside class="news-sidebar">
|
||||
@if( $news->entry()->exists() || $news->relevant_link || $news->youtube_link )
|
||||
<aside class="news-sidebar">
|
||||
|
||||
@if($news->entry()->exists())
|
||||
<div class="sidebar-block">
|
||||
<h3 class="sidebar-title">
|
||||
<i data-lucide="content" size="18"></i>
|
||||
Related entry
|
||||
</h3>
|
||||
<div class="related-card">
|
||||
@if( $news->entry->main_image )
|
||||
<div class="related-card-cover">
|
||||
<img src="{{ Storage::url($news->entry->main_image) }}">
|
||||
@if($news->entry()->exists())
|
||||
<div class="sidebar-block">
|
||||
<h3 class="sidebar-title">
|
||||
<i data-lucide="content" size="18"></i>
|
||||
Related entry
|
||||
</h3>
|
||||
<div class="related-card">
|
||||
@if( $news->entry->main_image )
|
||||
<div class="related-card-cover">
|
||||
<img src="{{ Storage::url($news->entry->main_image) }}">
|
||||
</div>
|
||||
@endif
|
||||
<div class="related-card-info">
|
||||
<h4>{{ $news->entry->title }}</h4>
|
||||
<a href="{{ route('entries.show', ['section' => $news->entry->type, 'entry' => $news->entry ]) }}" class="btn-sidebar" class="btn-orange">
|
||||
Go to the entry
|
||||
</a>
|
||||
</div>
|
||||
@endif
|
||||
<div class="related-card-info">
|
||||
<h4>{{ $news->entry->title }}</h4>
|
||||
<a href="{{ route('entries.show', ['section' => $news->entry->type, 'entry' => $news->entry ]) }}" class="btn-sidebar" class="btn-orange">
|
||||
Go to the entry
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@if($news->relevant_link)
|
||||
<div class="sidebar-block">
|
||||
<h3 class="sidebar-title">
|
||||
<i data-lucide="link" size="18"></i>
|
||||
Relevant link
|
||||
</h3>
|
||||
<a href="{{ $news->relevant_link }}" target="_blank" rel="noopener">
|
||||
{{ $news->relevant_link }}
|
||||
</a>
|
||||
</div>
|
||||
@endif
|
||||
@if($news->relevant_link)
|
||||
<div class="sidebar-block">
|
||||
<h3 class="sidebar-title">
|
||||
<i data-lucide="link" size="18"></i>
|
||||
Relevant link
|
||||
</h3>
|
||||
<a href="{{ $news->relevant_link }}" target="_blank" rel="noopener">
|
||||
{{ $news->relevant_link }}
|
||||
</a>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if( $news->youtube_link )
|
||||
<div x-data="{open: false, src: ''}" x-cloak class="sidebar-block youtube-section">
|
||||
@if( $news->youtube_link )
|
||||
<div x-data="{open: false, src: ''}" x-cloak class="sidebar-block youtube-section">
|
||||
|
||||
<h3 class="sidebar-title">
|
||||
<i data-lucide="play" size="18"></i>
|
||||
Youtube video
|
||||
</h3>
|
||||
<h3 class="sidebar-title">
|
||||
<i data-lucide="play" size="18"></i>
|
||||
Youtube video
|
||||
</h3>
|
||||
|
||||
<div class="video-thumbnail-wrapper"
|
||||
@click="src = 'https://www.youtube.com/embed/{{ $news->getYoutubeVideoId() }}?autoplay=1'; open = true">
|
||||
<img src="https://img.youtube.com/vi/{{ $news->getYoutubeVideoId() }}/maxresdefault.jpg">
|
||||
<div class="play-trigger">
|
||||
<i data-lucide="play"></i>
|
||||
<div class="video-thumbnail-wrapper"
|
||||
@click="src = 'https://www.youtube.com/embed/{{ $news->getYoutubeVideoId() }}?autoplay=1'; open = true">
|
||||
<img src="https://img.youtube.com/vi/{{ $news->getYoutubeVideoId() }}/maxresdefault.jpg">
|
||||
<div class="play-trigger">
|
||||
<i data-lucide="play"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="gallery-modal" x-show="open" x-transition.opacity.duration.300ms
|
||||
@click="open = false; src = ''" @keydown.escape.window="open = false; src = ''">
|
||||
<span class="gallery-modal-close" @click="open = false; src = '';"><i
|
||||
data-lucide="x"></i></span>
|
||||
<div class="gallery-modal-video" @click.stop>
|
||||
<iframe :src="src"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="gallery-modal" x-show="open" x-transition.opacity.duration.300ms
|
||||
@click="open = false; src = ''" @keydown.escape.window="open = false; src = ''">
|
||||
<span class="gallery-modal-close" @click="open = false; src = '';"><i
|
||||
data-lucide="x"></i></span>
|
||||
<div class="gallery-modal-video" @click.stop>
|
||||
<iframe :src="src"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
allowfullscreen></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</aside>
|
||||
@endif
|
||||
</aside>
|
||||
@endif
|
||||
</div>
|
||||
</article>
|
||||
@include('entries.comments')
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
@if ($paginator->hasPages())
|
||||
<div class="database-pagination">
|
||||
|
||||
{{-- Précédent --}}
|
||||
@if ($paginator->onFirstPage())
|
||||
<button class="btn" disabled>«</button>
|
||||
@else
|
||||
@@ -24,7 +23,6 @@
|
||||
@endif
|
||||
@endforeach
|
||||
|
||||
{{-- Suivant --}}
|
||||
@if ($paginator->hasMorePages())
|
||||
<button class="btn" wire:click="nextPage">»</button>
|
||||
@else
|
||||
|
||||
@@ -33,14 +33,14 @@ Route::name('reviews.')->controller(ReviewController::class)->group(function ()
|
||||
});
|
||||
|
||||
// SubmissionController.
|
||||
Route::name('submit.')->prefix('/submit')->controller(\App\Http\Controllers\SubmissionController::class)->middleware(['xf.auth', 'can:create,\App\Models\Entry'])->group(function () {
|
||||
Route::name('submit.')->prefix('/submit')->controller(\App\Http\Controllers\SubmissionController::class)->middleware(['submissions.maintenance','xf.auth', 'can:create,\App\Models\Entry'])->group(function () {
|
||||
Route::get('/', 'index')->name('index');
|
||||
Route::get('/{section}', 'create' )->name('create')
|
||||
->where([ 'section' => 'translations|romhacks|homebrew|utilities|documents|lua-scripts' ]);
|
||||
Route::post('/{section}', 'store' )->name('store')
|
||||
->where([ 'section' => 'translations|romhacks|homebrew|utilities|documents|lua-scripts' ]);
|
||||
});
|
||||
Route::name('submit.')->prefix('/edit')->controller(\App\Http\Controllers\SubmissionController::class)->middleware(['xf.auth', 'can:update,entry'])->group(function () {
|
||||
Route::name('submit.')->prefix('/edit')->controller(\App\Http\Controllers\SubmissionController::class)->middleware(['submissions.maintenance','xf.auth', 'can:update,entry'])->group(function () {
|
||||
Route::get('/{section}/{entry:id}', 'edit' )->name('edit')
|
||||
->where([ 'section' => 'translations|romhacks|homebrew|utilities|documents|lua-scripts', 'entry' => '[0-9\-]+' ]);
|
||||
Route::post('/{section}/{entry:id}', 'update' )->name('update')
|
||||
@@ -54,12 +54,12 @@ Route::name('news.')->controller(\App\Http\Controllers\NewsController::class)->g
|
||||
Route::get('/news/', 'index' )->name('index');
|
||||
Route::get('/news/{news:slug}', 'show' )->name('show')->where([ 'news' => '[a-zA-Z0-9\-_]+']);
|
||||
|
||||
Route::get('/submit/news', 'create' )->name('create')->middleware(['xf.auth','can:create,\App\Models\News']);
|
||||
Route::post('/submit/news', 'store' )->name('store')->middleware(['xf.auth','can:create,\App\Models\News']);
|
||||
Route::get('/submit/news', 'create' )->name('create')->middleware(['submissions.maintenance','xf.auth','can:create,\App\Models\News']);
|
||||
Route::post('/submit/news', 'store' )->name('store')->middleware(['submissions.maintenance','xf.auth','can:create,\App\Models\News']);
|
||||
|
||||
Route::get('/edit/news/{news:id}', 'edit')->name('edit')->where(['news' => '[0-9\-]+'])->middleware(['xf.auth','can:update,news']);
|
||||
Route::post('/edit/news/{news:id}', 'update')->name('update')->where(['news' => '[0-9\-]+'])->middleware(['xf.auth','can:update,news']);
|
||||
Route::delete('/edit/news/{news:id}', 'destroy')->name('destroy')->where(['news' => '[0-9\-]+'])->middleware(['xf.auth','can:update,news']);
|
||||
Route::get('/edit/news/{news:id}', 'edit')->name('edit')->where(['news' => '[0-9\-]+'])->middleware(['submissions.maintenance','xf.auth','can:update,news']);
|
||||
Route::post('/edit/news/{news:id}', 'update')->name('update')->where(['news' => '[0-9\-]+'])->middleware(['submissions.maintenance','xf.auth','can:update,news']);
|
||||
Route::delete('/edit/news/{news:id}', 'destroy')->name('destroy')->where(['news' => '[0-9\-]+'])->middleware(['submissions.maintenance','xf.auth','can:update,news']);
|
||||
});
|
||||
|
||||
// QueueController
|
||||
@@ -67,32 +67,32 @@ Route::name('queue.')->prefix('/queue')->controller(\App\Http\Controllers\QueueC
|
||||
Route::get('/', 'index' )->name('index');
|
||||
|
||||
Route::patch('/{entry:id}/comment', 'updateComment' )
|
||||
->middleware(['xf.auth', 'can:updateComment,entry' ] )
|
||||
->middleware(['submissions.maintenance','xf.auth', 'can:updateComment,entry' ] )
|
||||
->where([ 'entry' => '[0-9\-]+' ])
|
||||
->name('comment');
|
||||
|
||||
Route::patch('/{entry:id}/approve', 'approve' )
|
||||
->middleware(['xf.auth', 'can:approve,entry' ] )
|
||||
->middleware(['submissions.maintenance','xf.auth', 'can:approve,entry' ] )
|
||||
->where([ 'entry' => '[0-9\-]+' ])
|
||||
->name('approve');
|
||||
|
||||
Route::patch('/{entry:id}/reject', 'reject' )
|
||||
->middleware(['xf.auth', 'can:reject,entry' ] )
|
||||
->middleware(['submissions.maintenance','xf.auth', 'can:reject,entry' ] )
|
||||
->where([ 'entry' => '[0-9\-]+' ])
|
||||
->name('reject');
|
||||
|
||||
Route::patch('/news/{news:id}/comment', 'updateComment_news' )
|
||||
->middleware(['xf.auth', 'can:updateComment,news' ] )
|
||||
->middleware(['submissions.maintenance','xf.auth', 'can:updateComment,news' ] )
|
||||
->where([ 'news' => '[0-9\-]+' ])
|
||||
->name('news.comment');
|
||||
|
||||
Route::patch('/news/{news:id}/approve', 'approve_news' )
|
||||
->middleware(['xf.auth', 'can:approve,news' ] )
|
||||
->middleware(['submissions.maintenance','xf.auth', 'can:approve,news' ] )
|
||||
->where([ 'news' => '[0-9\-]+' ])
|
||||
->name('news.approve');
|
||||
|
||||
Route::patch('/news/{news:id}/reject', 'reject_news' )
|
||||
->middleware(['xf.auth', 'can:reject,news' ] )
|
||||
->middleware(['submissions.maintenance','xf.auth', 'can:reject,news' ] )
|
||||
->where([ 'news' => '[0-9\-]+' ])
|
||||
->name('news.reject');
|
||||
});
|
||||
@@ -111,7 +111,7 @@ Route::name('tools.')->controller(\App\Http\Controllers\ToolsController::class)-
|
||||
Route::name('modcp.')->prefix('/modcp')->controller(\App\Http\Controllers\ModCPController::class)->middleware(['xf.auth','can:is-mod'])->group(function () {
|
||||
|
||||
Route::get('/', 'index' )->name('index');
|
||||
Route::get('/locked-entries', 'locked' )->name('locked');
|
||||
Route::get('/locked-entries', 'locked' )->name('locked')->middleware('can:moderate,\App\Models\Entry');
|
||||
Route::get('/draft-entries', 'draft' )->name('draft')->middleware('can:is-admin');
|
||||
Route::get('/hidden-entries', 'hidden' )->name('hidden')->middleware('can:is-admin');
|
||||
Route::get('/deleted-entries', 'deleted' )->name('deleted')->middleware('can:is-admin');
|
||||
@@ -125,6 +125,8 @@ Route::name('modcp.')->prefix('/modcp')->controller(\App\Http\Controllers\ModCPC
|
||||
Route::resource('authors', \App\Http\Controllers\ModCP\AuthorController::class)->only(['index', 'store','update','destroy']);
|
||||
Route::resource('platforms', \App\Http\Controllers\ModCP\PlatformController::class )->middleware('can:is-admin')->only(['index', 'store','update','destroy']);
|
||||
Route::resource('genres', \App\Http\Controllers\ModCP\GenreController::class )->middleware('can:is-admin')->only(['index', 'store','update','destroy']);
|
||||
Route::resource('levels', \App\Http\Controllers\ModCP\LevelController::class )->middleware('can:is-admin')->only(['index', 'store','update','destroy']);
|
||||
Route::resource('modifications', \App\Http\Controllers\ModCP\ModificationsController::class )->middleware('can:is-admin')->only(['index', 'store','update','destroy']);
|
||||
});
|
||||
|
||||
// RedirectController
|
||||
|
||||
Reference in New Issue
Block a user