# ============================================================
# LaporanWe Chat Upload Security
# Folder: /uploads/chat/
# ============================================================

Options -Indexes

# ------------------------------------------------------------
# Jangan izinkan eksekusi PHP
# ------------------------------------------------------------

<FilesMatch "\.(php|php[0-9]?|phtml|pht|phar|cgi|pl|py|sh)$">
    Require all denied
</FilesMatch>

# Untuk server Apache versi lama
<IfModule !mod_authz_core.c>
    <FilesMatch "\.(php|php[0-9]?|phtml|pht|phar|cgi|pl|py|sh)$">
        Order Allow,Deny
        Deny from all
    </FilesMatch>
</IfModule>

# ------------------------------------------------------------
# Blok file konfigurasi / source / credential
# ------------------------------------------------------------

<FilesMatch "(^\.|composer\.(json|lock)|package(-lock)?\.json|config\.php|\.env|\.ini|\.log)$">
    Require all denied
</FilesMatch>

# ------------------------------------------------------------
# Nonaktifkan content sniffing
# ------------------------------------------------------------

<IfModule mod_headers.c>
    Header always set X-Content-Type-Options "nosniff"
</IfModule>

# ------------------------------------------------------------
# Allow file umum untuk Chat
# ------------------------------------------------------------

<IfModule mod_mime.c>

    AddType image/jpeg .jpg .jpeg
    AddType image/png .png
    AddType image/webp .webp
    AddType image/gif .gif

    AddType video/mp4 .mp4
    AddType video/quicktime .mov
    AddType video/webm .webm
    AddType video/x-m4v .m4v

    AddType audio/mpeg .mp3
    AddType audio/wav .wav
    AddType audio/mp4 .m4a
    AddType audio/ogg .ogg .oga
    AddType audio/aac .aac
    AddType audio/flac .flac

    AddType application/pdf .pdf

    AddType application/msword .doc
    AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document .docx

    AddType application/vnd.ms-excel .xls
    AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .xlsx

    AddType application/vnd.ms-powerpoint .ppt
    AddType application/vnd.openxmlformats-officedocument.presentationml.presentation .pptx

    AddType text/plain .txt
    AddType text/csv .csv

    AddType image/svg+xml .svg

    AddType application/octet-stream .psd
    AddType application/octet-stream .ai
    AddType application/octet-stream .eps

    AddType application/zip .zip
    AddType application/x-rar-compressed .rar
    AddType application/x-7z-compressed .7z

</IfModule>