feat: forum rich-text editor, emoji picker, mentions, discover nav, feed, uploads, profile
Forum: - TipTap WYSIWYG editor with full toolbar - @emoji-mart/react emoji picker (consistent with tweets) - @mention autocomplete with user search API - Fix PHP 8.4 parse errors in Blade templates - Fix thread data display (paginator items) - Align forum page widths to max-w-5xl Discover: - Extract shared _nav.blade.php partial - Add missing nav links to for-you page - Add Following link for authenticated users Feed/Posts: - Post model, controllers, policies, migrations - Feed page components (PostComposer, FeedCard, etc) - Post reactions, comments, saves, reports, sharing - Scheduled publishing support - Link preview controller Profile: - Profile page components (ProfileHero, ProfileTabs) - Profile API controller Uploads: - Upload wizard enhancements - Scheduled publish picker - Studio status bar and readiness checklist
This commit is contained in:
@@ -76,33 +76,6 @@ final class UploadStorageService
|
||||
return $dir;
|
||||
}
|
||||
|
||||
public function publicHashDirectory(string $hash): string
|
||||
{
|
||||
$prefix = trim((string) config('uploads.public_img_prefix', 'img'), DIRECTORY_SEPARATOR);
|
||||
$base = $this->sectionPath('public') . DIRECTORY_SEPARATOR . $prefix;
|
||||
|
||||
if (! File::exists($base)) {
|
||||
File::makeDirectory($base, 0755, true);
|
||||
}
|
||||
|
||||
$segments = $this->hashSegments($hash);
|
||||
$dir = $base . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $segments);
|
||||
|
||||
if (! File::exists($dir)) {
|
||||
File::makeDirectory($dir, 0755, true);
|
||||
}
|
||||
|
||||
return $dir;
|
||||
}
|
||||
|
||||
public function publicRelativePath(string $hash, string $filename): string
|
||||
{
|
||||
$prefix = trim((string) config('uploads.public_img_prefix', 'img'), DIRECTORY_SEPARATOR);
|
||||
$segments = $this->hashSegments($hash);
|
||||
|
||||
return $prefix . '/' . implode('/', $segments) . '/' . ltrim($filename, '/');
|
||||
}
|
||||
|
||||
public function sectionRelativePath(string $section, string $hash, string $filename): string
|
||||
{
|
||||
$segments = $this->hashSegments($hash);
|
||||
@@ -111,6 +84,24 @@ final class UploadStorageService
|
||||
return $section . '/' . implode('/', $segments) . '/' . ltrim($filename, '/');
|
||||
}
|
||||
|
||||
public function originalHashExists(string $hash): bool
|
||||
{
|
||||
$segments = $this->hashSegments($hash);
|
||||
$dir = $this->sectionPath('original') . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $segments);
|
||||
|
||||
if (! File::isDirectory($dir)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$normalizedHash = strtolower(preg_replace('/[^a-z0-9]/', '', $hash) ?? '');
|
||||
if ($normalizedHash === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$matches = File::glob($dir . DIRECTORY_SEPARATOR . $normalizedHash . '.*');
|
||||
return is_array($matches) && count($matches) > 0;
|
||||
}
|
||||
|
||||
private function safeExtension(UploadedFile $file): string
|
||||
{
|
||||
$extension = (string) $file->guessExtension();
|
||||
@@ -125,10 +116,11 @@ final class UploadStorageService
|
||||
$hash = preg_replace('/[^a-z0-9]/', '', $hash) ?? '';
|
||||
$hash = str_pad($hash, 6, '0');
|
||||
|
||||
// Use two 2-char segments for directory sharding: first two chars, next two chars.
|
||||
// Result: <section>/<aa>/<bb>/<filename>
|
||||
$segments = [
|
||||
substr($hash, 0, 2),
|
||||
substr($hash, 2, 2),
|
||||
substr($hash, 4, 2),
|
||||
];
|
||||
|
||||
return array_map(static fn (string $part): string => $part === '' ? '00' : $part, $segments);
|
||||
|
||||
Reference in New Issue
Block a user