diff --git a/src/main/java/store/itpick/backend/config/WebConfig.java b/src/main/java/store/itpick/backend/config/WebConfig.java index 6a863ef..aea343c 100644 --- a/src/main/java/store/itpick/backend/config/WebConfig.java +++ b/src/main/java/store/itpick/backend/config/WebConfig.java @@ -39,12 +39,20 @@ public void addArgumentResolvers(List resolvers) resolvers.add(getJwtHandlerArgumentResolver); } -// @Override -// public void addCorsMappings(CorsRegistry registry) { -// registry.addMapping("/**") -// .allowedOrigins("https://itpick.netlify.app") -// .allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD") -// .allowedHeaders("Authorization", "Content-Type") -// .allowCredentials(true); -// } + + + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOriginPatterns("http://localhost:3000/", "http://localhost:5173/", "https://localhost:5173/", + "https://itpick.netlify.app") + .allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH") + .exposedHeaders("location", "Authorization") + .allowedHeaders("*") + .allowCredentials(true); + } + + + + } \ No newline at end of file diff --git a/src/main/java/store/itpick/backend/service/SeleniumService.java b/src/main/java/store/itpick/backend/service/SeleniumService.java index 4b419dc..883179f 100644 --- a/src/main/java/store/itpick/backend/service/SeleniumService.java +++ b/src/main/java/store/itpick/backend/service/SeleniumService.java @@ -290,11 +290,11 @@ private List SearchReference(List keywords, List lin Reference reference=new Reference(); - reference.setNewsTitle(newsTitle); - reference.setNewsContent(newsContent); - reference.setNewsLink(newsLink); - reference.setNewsImage(imageUrl); - reference.setSearchLink(searchLink); + reference.setNewsTitle(truncateContent(newsTitle)); + reference.setNewsContent(truncateContent(newsContent)); + reference.setNewsLink(truncateContent(newsLink)); + reference.setNewsImage(truncateContent(imageUrl)); + reference.setSearchLink(truncateContent(searchLink)); references.add(reference); }catch (NoSuchElementException e){ @@ -400,7 +400,14 @@ public void processKeywordsAndReferences(String communityName, List keyw } } - + //글자수 자르기 + private String truncateContent(String content) { + final int MAX_LENGTH = 250; + if (content.length() > MAX_LENGTH) { + return content.substring(0, MAX_LENGTH); + } + return content; + }