Skip to content

Commit

Permalink
Merge pull request #98 from letmeknowmyfriend/feat/Support_Page
Browse files Browse the repository at this point in the history
[Feat] Support Page close #97
  • Loading branch information
ChaCha3088 authored Jan 1, 2024
2 parents fc4de88 + 0230b19 commit 7a56c98
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class AuthenticationProcessFilter extends OncePerRequestFilter {
private final JwtService jwtService;
private final ObjectMapper objectMapper;

private static final List<String> NO_CHECK_URL = Arrays.asList("/api/auth", "/auth/member");
private static final List<String> NO_CHECK_URL = Arrays.asList("/api/auth", "/auth/member", "/support");

/**
* "/auth/login"으로 시작하는 URL 요청은 logIn 검증 및 authenticate X
Expand Down
16 changes: 14 additions & 2 deletions src/main/java/com/letmeknow/config/security/CorsConfig.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.letmeknow.config.security;

import com.letmeknow.enumstorage.SpringProfile;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -15,6 +16,12 @@ public class CorsConfig {
@Value("${allowed-origin}")
private String allowedOrigin;

@Value("${spring.profiles.active}")
private String activeProfile;

@Value("${server.port}")
private String port;

@Bean
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration config = new CorsConfiguration();
Expand All @@ -23,8 +30,13 @@ public CorsConfigurationSource corsConfigurationSource() {
config.setAllowedHeaders(List.of("Authorization", "AuthorizationRefresh, DeviceToken"));
config.setExposedHeaders(List.of("Authorization", "AuthorizationRefresh, DeviceToken"));

String httpsDomain = allowedOrigin.replace("http", "https");
config.setAllowedOrigins(List.of(allowedOrigin, httpsDomain));
String withPort = allowedOrigin;
if (activeProfile.equals(SpringProfile.LOCAL.getProfile())) {
withPort += ":" + port;
}

String domain = allowedOrigin.replace("http", "https");
config.setAllowedOrigins(List.of(withPort, domain));
config.setAllowedMethods(List.of("*"));

UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.antMatchers("/api/member/**").permitAll()
.antMatchers("/api/request/**").permitAll()
.antMatchers("/auth/**").permitAll()

.antMatchers("/support/**").permitAll()
.anyRequest().authenticated()
);

Expand Down
14 changes: 14 additions & 0 deletions src/main/java/com/letmeknow/controller/SupportController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.letmeknow.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping(value = "/support")
public class SupportController {
@GetMapping
public String getSupportPage() {
return "support/support";
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
package com.letmeknow.repository.board;

import com.letmeknow.entity.Board;
import com.querydsl.jpa.impl.JPAQueryFactory;
import javax.persistence.EntityManager;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;

import javax.persistence.EntityManager;
import java.util.List;

import static com.letmeknow.entity.QBoard.board;
import static com.letmeknow.entity.notification.QSubscription.subscription;

@Repository
@RequiredArgsConstructor
public class BoardRepositoryImpl implements BoardRepositoryQueryDsl {
Expand Down
7 changes: 6 additions & 1 deletion src/main/resources/templates/fragments/footer.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<div class="footer" th:fragment="footer">
<p>&copy; Let Me Know</p>
<footer class="my-5 pt-5 text-muted text-center text-small">
<p class="mb-1">© 2023 Let Me Know</p>
<ul class="list-inline">
<li class="list-inline-item"><a href="/support">Support</a></li>
</ul>
</footer>
</div>
4 changes: 2 additions & 2 deletions src/main/resources/templates/fragments/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://app.letmeknow.store/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
<link rel="stylesheet" href="/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
<!-- Custom styles for this template -->
<link href="https://app.letmeknow.store/css/jumbotron-narrow.css" rel="stylesheet">
<link href="/css/jumbotron-narrow.css" rel="stylesheet">

<title>Let Me Know</title>
</head>
24 changes: 5 additions & 19 deletions src/main/resources/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,16 @@
<div th:replace="fragments/bodyHeader :: bodyHeader" />

<div class="jumbotron">
<h2>LetMeKnow</h2>
<p th:unless="${username}" class="lead">회원 기능</p>
<p th:unless="${username}">
<a class="btn btn-lg btn-secondary" href="/auth/login">로그인</a>
</p>
<p th:if="${username}" class="lead" th:text="'안녕하세요 ' + ${username} + '님'"></p>
<p th:if="${username}">
<a class="btn btn-lg btn-secondary" th:href="@{/members/{memberId}(memberId = ${memberFindDto.id})}">내 정보</a>
<a class="btn btn-lg btn-secondary" href="/auth/logout">로그아웃</a>
</p>
<p class="lead">상품 기능</p>
<p>
<a class="btn btn-lg btn-dark" href="/items/new">상품 등록</a>
<a class="btn btn-lg btn-dark" href="/items">상품 목록</a>
</p>
<p class="lead">주문 기능</p>
<h1>Let Me Know!</h1>
<h3>대학교 단과대 게시판 구독 서비스</h3>
<p>
<a class="btn btn-lg btn-info" href="/order">상품 주문</a>
<a class="btn btn-lg btn-info" href="/orders">주문 내역</a>
이 서비스는 대학교 단과대 게시판의 새로운 글을 알려주는 서비스입니다.<br>

게시판을 찾아 구독하고, 새로운 글이 올라오면 알림을 받아보세요!
</p>
</div>

<div th:replace="fragments/footer :: footer" />

</div>

</body>
Expand Down
26 changes: 26 additions & 0 deletions src/main/resources/templates/support/support.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="fragments/header :: header">
<title>Hello</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>

<body>

<div class="container">

<div th:replace="fragments/bodyHeader :: bodyHeader" />

<div class="jumbotron">
<h1>개발자에게 문의하기</h1>
<p>
<a href="mailto:cha3088@gmail.com" target="_blank" class="btn btn-light">cha3088@gmail.com</a>
</p>
<p>
<a href="https://github.com/ChaCha3088" target="_blank" class="btn btn-dark">GitHub</a>
</p>
</div>
<div th:replace="fragments/footer :: footer" />

</body>
</html>

0 comments on commit 7a56c98

Please sign in to comment.