From ede46fda8243c73eaa795660fa5c3f723205ae42 Mon Sep 17 00:00:00 2001 From: miteruzo Date: Mon, 21 Jul 2025 17:24:01 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E7=B4=B0=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/controllers/posts_controller.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/backend/app/controllers/posts_controller.rb b/backend/app/controllers/posts_controller.rb index 60f3577..feb2340 100644 --- a/backend/app/controllers/posts_controller.rb +++ b/backend/app/controllers/posts_controller.rb @@ -19,8 +19,16 @@ class PostsController < ApplicationController posts = posts.first(limit) end - render json: { posts: posts.as_json(include: { tags: { only: [:id, :name, :category, :post_count] } }), - next_cursor: } + render json: { posts: posts.map { |post| + post.as_json(include: { tags: { only: [:id, :name, :category, :post_count] } }).tap { |json| + json['thumbnail'] = + if post.thumbnail.attached? + rails_storage_proxy_url(post.thumbnail, only_path: false) + else + nil + end + } + }, next_cursor: } end def random From f3bd9bea777ea8cf18f1e22af0a3a02de25c0c5a Mon Sep 17 00:00:00 2001 From: miteruzo Date: Mon, 21 Jul 2025 17:25:18 +0900 Subject: [PATCH 2/2] =?UTF-8?q?#80=20=E7=94=BB=E5=83=8F=E8=AA=AD=E8=BE=BC?= =?UTF-8?q?=E3=81=AE=E5=84=AA=E5=85=88=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/public/.htaccess | 6 ++++++ frontend/src/pages/posts/PostListPage.tsx | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/public/.htaccess b/frontend/public/.htaccess index 133a5f4..51ba3ad 100644 --- a/frontend/public/.htaccess +++ b/frontend/public/.htaccess @@ -1,3 +1,9 @@ + + + Header set Cache-Control "max-age=31536000, public" + + + RewriteEngine On RewriteBase / diff --git a/frontend/src/pages/posts/PostListPage.tsx b/frontend/src/pages/posts/PostListPage.tsx index 79a826f..600a3dd 100644 --- a/frontend/src/pages/posts/PostListPage.tsx +++ b/frontend/src/pages/posts/PostListPage.tsx @@ -94,13 +94,16 @@ export default () => { {posts.length ? (
- {posts.map (post => ( + {posts.map ((post, i) => ( {post.title ))}
)