Skip to content

Commit 57d5609

Browse files
committed
feat: 移除一些不必要的依赖库
1 parent cd3fd12 commit 57d5609

File tree

6 files changed

+15
-88
lines changed

6 files changed

+15
-88
lines changed

README.md

Lines changed: 2 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
一个超简单的短网址管理平台(前端)。
44

5-
[**配置后端 API:shortener**](https://git.jetsung.com/idev/shortener-server)
5+
[**配置后端 API:shortener-server**](https://git.jetsung.com/idev/shortener-server)
66

77
预览: ![Shortener](screenshot.png)
88

@@ -42,77 +42,7 @@ npm run build
4242

4343
## 部署
4444

45-
### Docker
46-
47-
```yaml
48-
---
49-
# https://git.jetsung.com/idev/shortener-server
50-
51-
services:
52-
shortener:
53-
image: ghcr.io/idevsig/shortener-server:dev-amd64
54-
container_name: shortener
55-
restart: unless-stopped
56-
ports:
57-
- ${BACKEND_PORT:-8080}:8080
58-
volumes:
59-
- ./data:/app/data
60-
- ./config.toml:/app/config.toml
61-
depends_on:
62-
- valkey
63-
64-
valkey:
65-
image: valkey/valkey:latest
66-
restart: unless-stopped
67-
environment:
68-
- TZ=Asia/Shanghai
69-
70-
frontend:
71-
image: ghcr.io/idevsig/shortener-frontend:dev-amd64
72-
restart: unless-stopped
73-
ports:
74-
- ${FRONTEND_PORT:-8081}:80
75-
```
76-
77-
### Nginx 反向代理
78-
79-
```nginx
80-
# 前端配置
81-
location / {
82-
proxy_pass http://127.0.0.1:8080;
83-
84-
client_max_body_size 1024m;
85-
proxy_set_header Host $host:$server_port;
86-
87-
proxy_set_header X-Real-Ip $remote_addr;
88-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
89-
proxy_set_header X-Forwarded-Proto $scheme; # 透传 HTTPS 协议标识
90-
proxy_set_header X-Forwarded-Ssl on; # 明确 SSL 启用状态
91-
92-
proxy_http_version 1.1;
93-
proxy_set_header Upgrade $http_upgrade;
94-
proxy_set_header Connection "upgrade";
95-
proxy_connect_timeout 99999;
96-
}
97-
98-
# 对接 API
99-
location /api/ {
100-
proxy_pass http://127.0.0.1:8081/api/v1/;
101-
102-
client_max_body_size 1024m;
103-
proxy_set_header Host $host:$server_port;
104-
105-
proxy_set_header X-Real-Ip $remote_addr;
106-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
107-
proxy_set_header X-Forwarded-Proto $scheme; # 透传 HTTPS 协议标识
108-
proxy_set_header X-Forwarded-Ssl on; # 明确 SSL 启用状态
109-
110-
proxy_http_version 1.1;
111-
proxy_set_header Upgrade $http_upgrade;
112-
proxy_set_header Connection "upgrade";
113-
proxy_connect_timeout 99999;
114-
}
115-
```
45+
部署教程查看 [**shortener-server**](https://git.jetsung.com/idev/shortener-frontend#文档) 项目。
11646

11747
## 仓库镜像
11848

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "shortener",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"private": true,
55
"description": "A simple URL shortener service",
66
"scripts": {
@@ -55,7 +55,6 @@
5555
"lodash": "^4.17.21",
5656
"moment": "^2.30.1",
5757
"omit.js": "^2.0.2",
58-
"querystring": "^0.2.1",
5958
"rc-menu": "^9.16.1",
6059
"rc-util": "^5.44.4",
6160
"react": "19.1.0",
@@ -64,9 +63,7 @@
6463
"devDependencies": {
6564
"@ant-design/pro-cli": "^3.2.1",
6665
"@testing-library/react": "16.3.0",
67-
"@types/classnames": "^2.3.4",
6866
"@types/express": "^5.0.1",
69-
"@types/history": "^5.0.0",
7067
"@types/jest": "^29.5.14",
7168
"@types/lodash": "^4.17.16",
7269
"@types/react": "^19.1.2",
@@ -83,7 +80,7 @@
8380
"gh-pages": "6.3.0",
8481
"jest": "^29.7.0",
8582
"jest-environment-jsdom": "^29.7.0",
86-
"lint-staged": "15.5.1",
83+
"lint-staged": "16.0.0",
8784
"mockjs": "^1.1.0",
8885
"prettier": "^3.5.3",
8986
"react-dev-inspector": "^2.0.1",

src/components/Footer/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ const Footer: React.FC = () => {
1919
{
2020
key: 'Shortener Code',
2121
title: <GitlabFilled />,
22-
href: 'https://git.jetsung.com/idev/shortener',
22+
href: 'https://git.jetsung.com/idev/shortener-server',
2323
blankTarget: true,
2424
},
2525
{
2626
key: 'Shortener GitHub',
2727
title: <GithubFilled />,
28-
href: 'https://github.com/idevsig/shortener',
28+
href: 'https://github.com/idevsig/shortener-server',
2929
blankTarget: true,
3030
},
3131
]}

src/components/RightContent/AvatarDropdown.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { LogoutOutlined, SettingOutlined, UserOutlined } from '@ant-design/icons
22
import { history, useModel } from '@umijs/max';
33
import { Spin } from 'antd';
44
import { createStyles } from 'antd-style';
5-
import { stringify } from 'querystring';
65
import type { MenuInfo } from 'rc-menu/lib/interface';
76
import React, { useCallback } from 'react';
87
import { flushSync } from 'react-dom';
@@ -57,9 +56,7 @@ export const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu, childre
5756
if (window.location.pathname !== '/account/login' && !redirect) {
5857
history.replace({
5958
pathname: '/account/login',
60-
search: stringify({
61-
redirect: pathname + search,
62-
}),
59+
search: new URLSearchParams({ redirect: pathname + search }).toString(),
6360
});
6461
}
6562
};

src/pages/Shortener/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ const useStyles = createStyles(({ token }) => {
2727
footerToolBar: {
2828
fontWeight: 600,
2929
},
30+
rightAlignedTitle: {
31+
display: 'block',
32+
textAlign: 'right',
33+
},
3034
codeContainer: {
3135
display: 'flex',
3236
justifyContent: 'flex-end',
@@ -164,7 +168,7 @@ const TableList: React.FC = () => {
164168
// },
165169
// },
166170
{
167-
title: '短码',
171+
title: <span className={styles.rightAlignedTitle}>短码</span>,
168172
dataIndex: 'code',
169173
width: 180,
170174
render: (_, entity) => (

src/requestErrorConfig.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ export const errorConfig: RequestConfig = {
1212
errorConfig: {
1313
// 错误抛出
1414
errorThrower: (res) => {
15-
console.log('errorThrower:', res);
16-
const { errcode, errinfo } =
17-
res as unknown as API.ErrorResponse;
15+
// console.log('errorThrower:', res);
16+
const { errcode, errinfo } = res as unknown as API.ErrorResponse;
1817
if (errcode && errinfo) {
1918
const error: any = new Error(errinfo);
2019
error.name = 'BizError';
@@ -25,7 +24,7 @@ export const errorConfig: RequestConfig = {
2524
// 错误接收及处理
2625
errorHandler: (error: any, opts: any) => {
2726
// console.log('errorHandler:', error, opts);
28-
console.log('errorHandler:', error);
27+
// console.log('errorHandler:', error);
2928
if (opts?.skipErrorHandler) throw error;
3029
if (error.name === 'BizError') {
3130
console.error('BizError:', error);

0 commit comments

Comments
 (0)