diff --git a/.env.example b/.env.example index ec7f031..d595fff 100644 --- a/.env.example +++ b/.env.example @@ -1,11 +1,11 @@ -APP_NAME=Laravel +APP_NAME="KOL-Manager" APP_ENV=local APP_KEY= APP_DEBUG=true APP_URL=http://localhost # ── App Gate Password ───────────────────────────────────────────────────────── -APP_PASSWORD= +APP_PASSWORD=admin123 APP_LOCALE=en APP_FALLBACK_LOCALE=en diff --git a/Dockerfile b/Dockerfile index 6dffabb..9e10dbe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -92,12 +92,14 @@ RUN mkdir -p \ storage/framework/cache \ storage/framework/sessions \ storage/framework/views \ + storage \ bootstrap/cache \ database \ && chown -R www-data:www-data \ storage \ bootstrap/cache \ database \ + /var/lib/nginx \ && chmod -R 775 \ storage \ bootstrap/cache \ diff --git a/docker-compose.yml b/docker-compose.yml index 865a926..e81be8c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,8 +7,8 @@ services: container_name: kol-manager restart: unless-stopped - ports: - - "${APP_PORT:-8080}:80" + # ports: + # - "${APP_PORT:-8080}:80" # Mount .env.docker as the runtime .env env_file: @@ -22,7 +22,7 @@ services: - kol_storage:/var/www/html/storage healthcheck: - test: ["CMD", "curl", "-f", "http://localhost/up"] + test: [ "CMD", "curl", "-f", "http://localhost/up" ] interval: 30s timeout: 10s retries: 3 diff --git a/resources/views/clients/show.blade.php b/resources/views/clients/show.blade.php index 59df90f..d3ad498 100644 --- a/resources/views/clients/show.blade.php +++ b/resources/views/clients/show.blade.php @@ -18,9 +18,22 @@ const fd = new FormData(); fd.append('avatar', input.files[0]); fd.append('_token', document.querySelector('meta[name=csrf-token]').content); - const res = await fetch('{{ route('clients.upload-avatar', $client) }}', { method: 'POST', body: fd }); - const data = await res.json(); - if (res.ok) this.avatarUrl = data.url + '?t=' + Date.now(); + try { + const res = await fetch('{{ route('clients.upload-avatar', $client->id, false) }}', { + method: 'POST', + body: fd, + headers: { 'Accept': 'application/json' } + }); + const data = await res.json(); + if (res.ok) { + this.avatarUrl = data.url + '?t=' + Date.now(); + } else { + alert(data.message || 'Upload failed'); + } + } catch (err) { + console.error('Avatar upload error:', err); + alert('Network Error. Could not upload.'); + } this.uploading = false; input.value = ''; }, @@ -29,8 +42,16 @@ const fd = new FormData(); fd.append('_token', document.querySelector('meta[name=csrf-token]').content); fd.append('_method', 'DELETE'); - await fetch('{{ route('clients.delete-avatar', $client) }}', { method: 'POST', body: fd }); - this.avatarUrl = ''; + try { + await fetch('{{ route('clients.delete-avatar', $client->id, false) }}', { + method: 'POST', + body: fd, + headers: { 'Accept': 'application/json' } + }); + this.avatarUrl = ''; + } catch (err) { + console.error(err); + } } }">