Skip to content

Commit 74b5802

Browse files
committed
fix: 开放click-stats接口权限 + 添加生产环境CORS
1 parent 2330eb8 commit 74b5802

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/main/java/com/layor/tinyflow/config/SecurityConfig.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
5858
"/api/redirect/**", // 短链跳转(核心功能)
5959
"/api/shorten", // 创建短链(允许匿名)
6060
"/api/urls", // 查询短链列表(允许匿名)
61+
"/api/urls/click-stats", // 点击统计(允许匿名)
6162
"/api/stats/**", // 统计接口(允许匿名)
6263
"/actuator/**", // 监控端点
6364
"/error", // 错误页面
@@ -97,7 +98,12 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
9798
@Bean
9899
public CorsConfigurationSource corsConfigurationSource() {
99100
CorsConfiguration configuration = new CorsConfiguration();
100-
configuration.setAllowedOrigins(List.of("http://localhost:5173", "http://localhost:5174", "http://localhost:8080"));
101+
configuration.setAllowedOrigins(List.of(
102+
"http://localhost:5173",
103+
"http://localhost:5174",
104+
"http://localhost:8080",
105+
"http://47.97.110.128"
106+
));
101107
configuration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "OPTIONS"));
102108
configuration.setAllowedHeaders(List.of("*"));
103109
configuration.setAllowCredentials(true);

web/src/style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ html, body {
5858
}
5959

6060
.fs-btn-primary {
61+
display: inline-flex;
62+
align-items: center;
63+
justify-content: center;
6164
background: var(--tf-brand-primary);
6265
color: #fff;
6366
border: none;
@@ -67,6 +70,7 @@ html, body {
6770
font-weight: 500;
6871
cursor: pointer;
6972
transition: all 0.2s ease;
73+
line-height: 1;
7074
}
7175
.fs-btn-primary:hover {
7276
background: var(--tf-brand-hover);

0 commit comments

Comments
 (0)