-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.md
125 lines (91 loc) · 4.3 KB
/
README.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# mURL (my url)
![MyUrl](https://github.com/m-sql/myurl/blob/master/templates/control/img/myUrl.png)
## 是一个对文件URL压缩短链的自动化工具(文件上传+文件短网址)服务 🚀
# 功能特点
* 跨平台支持(支持Linux, Mac环境,Windows环境理论上也支持,不过未全面测试)
* 目前只支持 PNG、JPG、JPEG 等 文件上传
* 支持批量文件上传
* 支持自定义Route 和 API快速定制
# 安装使用
## 依赖软件
### 一般依赖
* go 1.14+
* git
## 1、下载源码
```linux
普通地址:https://github.com/m-sql/myurl
加速地址:https://gh.neting.cc.cnpmjs.org/m-sql/myurl.git
```
```linux
[root@lidi home]# git clone https://gh.neting.cc.cnpmjs.org/m-sql/myurl.git
Cloning into 'myurl'...
remote: Enumerating objects: 26, done.
remote: Counting objects: 100% (26/26), done.
remote: Compressing objects: 100% (21/21), done.
```
## 2、检测DNS配置: .env
``` linux
DB_TYPE="mysql"
DB_DSN="myurl:123456@tcp(localhost:3306)/myurl?charset=utf8&parseTime=True&loc=Local"
JWT_KEY="jwt_secret"
JWT_ISSUER="123456"
REDIS_DB="0"
REDIS_ADDR="localhost:6379"
REDIS_PWD=""
FILE_URL=""
PROXY_URL="此项目服务地址(你的地址+:9090/)"
```
## 3、linux下执行Go
``` linux
cd myurl
备注: 如果你的Go没有加速,请golang国内加速
可参考 https://blog.csdn.net/weixin_35888494/article/details/121083280
[root@test1 myurl]# go run main.go
[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.
[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.
- using env: export GIN_MODE=release
- using code: gin.SetMode(gin.ReleaseMode)
[GIN-debug] GET /v2/:short_url --> myurl/controller.Short2Long (4 handlers)
[GIN-debug] POST /api/user/login --> myurl/controller.Login (4 handlers)
[GIN-debug] POST /api/user/register --> myurl/controller.Register (4 handlers)
[GIN-debug] POST /api/long/short --> myurl/controller.Long2Short (4 handlers)
[GIN-debug] GET /templates/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (4 handlers)
[GIN-debug] HEAD /templates/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (4 handlers)
[GIN-debug] GET /upload/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (4 handlers)
[GIN-debug] HEAD /upload/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (4 handlers)
[GIN-debug] GET /upload --> myurl/controller.UploadHtml (4 handlers)
[GIN-debug] POST /upload/UploadAction --> myurl/controller.UploadFile (4 handlers)
[GIN-debug] Listening and serving HTTP on :9090
```
或者 在后台挂起
```
nohup go run main.go &
# tail -f nohup.out
[GIN-debug] POST /api/user/login --> myurl/controller.Login (4 handlers)
[GIN-debug] POST /api/user/register --> myurl/controller.Register (4 handlers)
[GIN-debug] POST /api/long/short --> myurl/controller.Long2Short (4 handlers)
[GIN-debug] GET /templates/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (4 handlers)
[GIN-debug] HEAD /templates/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (4 handlers)
[GIN-debug] GET /upload/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (4 handlers)
[GIN-debug] HEAD /upload/*filepath --> github.com/gin-gonic/gin.(*RouterGroup).createStaticHandler.func1 (4 handlers)
[GIN-debug] GET /upload --> myurl/controller.UploadHtml (4 handlers)
[GIN-debug] POST /upload/UploadAction --> myurl/controller.UploadFile (4 handlers)
[GIN-debug] Listening and serving HTTP on :9090
```
## 4、立刻即用
```linux
访问即可 : http://localhost:9090/upload
```
.
## 5、样例图片
![MyUrl-demo](https://github.com/m-sql/myurl/blob/master/doc/1.png)
.
## 6、体验-demo
点击访问:http://82.156.64.198:9090/upload
.
## 7、License
Completely MIT Licensed. Including ALL dependencies. If you love or like it !Please join us!
[MIT : license](https://github.com/m-sql/myurl/blob/master/LICENSE)
如有疑问,可微信我:
WeChat Me : adi1427569517
.