Add NAS file manager integration and all pending platform changes
- Installed p7h/nas-file-manager package via private VCS repo - Published config/nas-file-manager.php with super_admin middleware restriction - Added NAS env vars to .env.example - Created admin/nas-storage page with connection info panel and file browser widget - Added NAS Storage link to admin sidebar (super_admin only) - Added SuperAdminController@nasStorage method and admin.nas-storage route - Includes all accumulated branch changes: profile wall, 2FA, audit logs, settings panel, country/phone/timezone components, posts, slideshow, playlist shares, video downloads/shares, comment likes, notifications, social links, and more Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
1 parent
d44490dfe0
commit
0b2e95ea65
161 files changed
+27496
-7250
No files matched your search
@@ -9,4 +9,29 @@ use Illuminate\Routing\Controller as BaseController;
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, ValidatesRequests;
|
||||
|
||||
/**
|
||||
* Generate a collision-safe filename using the authenticated user's name,
|
||||
* a compact timestamp with millisecond precision, and the original extension.
|
||||
*
|
||||
* Format: {username}_{YYYYMMDD}_{HHmmss}_{ms}.{ext}
|
||||
* Example: ghassanyusuf_20260301_120102_020.mp4
|
||||
*/
|
||||
protected static function generateFilename(string $extension, ?string $username = null): string
|
||||
{
|
||||
$user = $username ?? (auth()->user()?->name ?? 'user');
|
||||
|
||||
// Sanitize: lowercase, keep only alphanumeric, collapse to max 20 chars
|
||||
$slug = preg_replace('/[^a-z0-9]/', '', strtolower($user));
|
||||
$slug = substr($slug ?: 'user', 0, 20);
|
||||
|
||||
$now = now();
|
||||
$ms = str_pad((int) ($now->microsecond / 1000), 3, '0', STR_PAD_LEFT);
|
||||
|
||||
$timestamp = $now->format('Ymd') . '_' . $now->format('His') . '_' . $ms;
|
||||
|
||||
$ext = ltrim(strtolower($extension), '.');
|
||||
|
||||
return "{$slug}_{$timestamp}.{$ext}";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user