🍭 集合多家 API 的新一代图床

AUXPI

集合多家 API 的新一代图床

Travis CI GitHub forks GitHub stars GitHub license FOSSA Status

Snipaste_2019-05-12_22-16-26.png


功能 特色

  • 支持 web 上传图片
  • 支持 API 上传图片
  • 支持分发,控制反转
  • 各种自由定制请看下面的截图

项目截图

首页

管理员后台

设置

支持拖拽对首页的菜单进行排序和开关控制

拖拽

图片链接按照权重进行异步分发

分发

首页有几个可视化的图表,方便分析

首页


如果您感觉不错,请您点个 Star,您的 Star 是对我最大的鼓励 (认真脸)

有问题请到 Issue 中提出

安装教程

如果您是空白的 vps,您可以直接使用一键脚本进行安装,安装教程

注意此脚本会给您安装 Nginx 和 Mysql,请确保您的服务器是干净的

https://github.com/aimerforreimu/AUXPI/wiki/%E4%B8%80%E9%94%AE%E5%AE%89%E8%A3%85%E8%84%9A%E6%9C%AC

如果您想手动安装,可以参考安装 wiki

https://github.com/aimerforreimu/AUXPI/wiki/%E5%9B%BE%E5%BA%8A%E9%85%8D%E7%BD%AE

演示站点为 https://test.demo-1s.com/

请勿滥用,滥用者将被加入 ip 黑名单并且放到 github 上公示

请注意,目前已经开启图片鉴黄,且等级较高,如果试用程序请尽量上传风景图,否则有可能无法上传

演示站点管理员账户:

用户名:admin123
密码:admin123
邮箱:[email protected]

分发原理

流程图

开发人员 && 折腾用户

如果您想要从源代码中构建 auxpi,您可以按照下面的教程进行构建,如果您仅仅想使用 auxpi,这一段您可以跳过

请注意你,请确保您的电脑上有 Go 环境。

从源码中构建

使用脚本构建

最近一次更新 中加入了批量编译打包的脚本,您可以使用此脚本进行代码的构建

bash build.sh all # 编译所有平台的程序
bash build.sh mac # 编译 mac 程序
bash build.sh windows # 编译 Windows 程序
bash build.sh linux #编译 linux 程序
bash build.sh all 2.2.0 clear # 编译程序,分别打包所有的平台的项目,2.2.0 为版本号,清空编译以后文件,只保留压缩包
bahs build.sh help #查看帮助

打包前端

cd resource
yarn install
yarn run build

使用 Bee 工具运行程序

cd $GOPATH/src
git clone [email protected]:aimerforreimu/AUXPI.git
cd AUXPI/
bee run auxpi

交叉编译

#Mac/Windows环境编译成 Linux 程序 
GOOS=linux GOARCH=amd64 bee pack 
#Mac/Linux 环境编译 Windows 程序
GOOS=windows GOARCH=amd64 bee pack
#Windows/Linux 编译 Mac 程序
GOOS=darwin GOARCH=amd64 bee pack

更多交叉编译请参考 Go 交叉编译

二次开发规范

如果这个项目让您感觉还不错,您想二次开发一下或者想为这个项目提交 PR

1.命名规范
  • 函数,私有变量必须采用小驼峰方式进行命名 即 sendMail(),userInfo

  • 共有变量需要使用大驼峰方式命名

  • 结构体,接口必须使用大驼峰方式进行命名

2.代码组织

最好请按照这个下面说明的结构去组织您的代码

  • 中间件请存放在 middleware 文件夹中

  • api 请按照版本号放在 controller/api/v(0-9)/中,所有 api 除去 auth 都不能进行模板引擎的渲染和操作,只允许输出 json

  • 如果需要渲染模板引擎,请直接在 controller/ 下面建立对应的 controller

  • utils 下面的各种工具文件不允许与 models 下面的文件耦合在一起,如果要为 models 编写工具,请放到 tools

  • all.go 中只允许写入经常被引入,需要格式化成 json , xml 等格式的结构体

.
├── LICENSE
├── README.md
├── auxpiAll
├── bootstrap
├── build
├── build.sh
├── conf
├── controllers
├── install.sh
├── log
├── main.go
├── middleware
├── models
├── pem
├── resource
├── routers
├── server
├── static
├── tests
├── tools
├── utils
└── views

API 上传

API 上传实例

图片上传 V1 接口

功能 图片上传接口
HTTP 请求方式  POST
URL  http://yourname/api/v1/upload

请求参数

参数名称 类型 是否必须 描述
image File 表单名称,上传图片
token  String 认证所必须的 token ,如果站在没有开启则留空即可
apiSelect  String 所选择的 API 类型

apiSelect可选参数

apiSelect 可选参数 参数说明
SouGou 搜狗图床
Sina 新浪图床
Smms SMMS 图床

成功上传返回

{
    "code": 200,
    "msg": "上传成功",
    "data": {
        "name": "Snipaste_2018-08-28_01-17-58.png",
        "url": "https://img04.sogoucdn.com/app/a/100520146/0dcb98aadb59c6b29dc0832eb7cc094a"
    }
}
{
    "code": 200,
    "msg": "上传成功",
    "data": {
        "name": "Snipaste_2018-08-28_01-17-58.png",
        "url": "https://i.loli.net/2018/11/05/5be038b1b4af6.png"
    }
}

失败返回值

上传出错返回值

{
    "code": 500,
    "msg": "上传失败"
}

API 未开启返回值

{
    "code": 405,
    "msg": "Method not allowed"
}

Token 验证失败返回值

{
    "code": 403,
    "msg": "Forbidden"
}

选择文件为空返回值

{
    "code": 500,
    "msg": "No files were uploaded."
}

文件太大返回值

{
    "code": 500,
    "msg": "File is too large."
}

TODO

  • API 上传

  • API v2 版本分发上传,返回所有图床储存链接

  • 用户系统

  • 前后端分离,Vue 驱动前端

  • 后台控制

  • 本地上传,各大平台对接储存

  • 使用 MySQL 而不是 JSON

  • API 自动文档

  • 国际化

  • 多缓存选择 Memory|redis|file|Memcached

  • 用户后台重构

  • 定时任务调度

说明

本项目是学习 Go 的过程中,边学边写出来的程序,可能存在 bug 连篇 ,逻辑让人无法接受,南辕北辙,代码无法让人直视等副作用。

致敬

@ astaxie (beego)

@ PanJiaChen (vue-element-admin)

@ metowolf (upimg-cli)

@ wisp-x (lsky-pro)

LICENSE

GNU General Public License v3.0

FOSSA Status

Owner
不会写代码的车辆工程师不是好厨师👨‍🍳
null
Comments
  • 无法创建管理员用户

    无法创建管理员用户

    使用./auxpi -mod=admin -name=hello [email protected] -pass=123123123 命令时


    /\ /\ /\ / / / _ \
    //\/ / \ \ / / /)/ / // / _ \ _/ / / // / _/ _/_//_/ ___/

    🍭 A NEW API IMAGES STORE TOOL 🍭

    2019/03/10 20:39:32.827 [A] [users.go:245] [Models Error]: record not found ===>[users.go:245] [SUCCESS]:Create Admin SUCCESS 但是登陆就显示用户不存在或用户密码错误... 去看了下数据库发现user表中空白

  • [EQ]Centos7下无法运行!

    [EQ]Centos7下无法运行!

    大佬好!这里是TurboHsu 前几天在v2ex上翻到了这个项目,觉得很不错,于是就搬到服务器上用。可是出现了一些问题! [tip]我服务器软件环境 宝塔面板6.9.3/NGINX1.15.10/MySQL(没压岁钱了)5.5.57 完全按照教程安装,在执行数据库配置的时候发现以下报错: Screenshot_20190512-132822_JuiceSSH 我检查了数据库配置,包括app.json和siteconfig.json,sql服务器用户密码均正确,用php脚本连接正常,但是就是报错 后来在网上看到了go的mysql驱动安装,于是我试了一下,执行了如下指令 go get -u github.com/go-sql-driver/mysql 然后再次执行数据库配置,发现依旧报错。 翻了一下,大概报错是:SQL SERVER CLOSED 为什么!(挠头) 然后我就直接./auxpi run,访问页面,出现以下报错 浏览器 Screenshot_20190512-132816_Chrome 服务端 -------分割线------- [root@turbocloud-tokyo auxpi]# ./auxpi run 2019/05/12 13:40:40 &{ 0 0xc0000f0480 false 0 {0xc0001b2410} {{0 0} {} map[] 0} 0xc0000b8e70 0x10907e0 0xc0001c7ea0 false} 2019/05/12 13:40:40 Error 1045: Access denied for user ''@'localhost' (using password: YES) 2019/05/12 13:40:40 [info] replacing callback gorm:update_time_stamp from /Users/aimer/go/src/github.com/auxpi/models/models.go:67 2019/05/12 13:40:40 [info] replacing callback gorm:update_time_stamp from /Users/aimer/go/src/github.com/auxpi/models/models.go:68

    (/Users/aimer/go/src/github.com/auxpi/models/options.go:58) [2019-05-12 13:40:40] sql: database is closed

    (/Users/aimer/go/src/github.com/auxpi/models/options.go:58) [2019-05-12 13:40:40] [0.39ms] SELECT * FROM auxpi_option WHERE (auxpi_option.options_key = 'flickr') AND (auxpi_option.group = 'conf') ORDER BY auxpi_option.id ASC LIMIT 1 [0 rows affected or returned ]

    (/Users/aimer/go/src/github.com/auxpi/models/logs.go:18) [2019-05-12 13:40:40] sql: database is closed

    (/Users/aimer/go/src/github.com/auxpi/models/logs.go:18) [2019-05-12 13:40:40] [0.10ms] INSERT INTO auxpi_log (created_on,modified_on,deleted_on,created_day,type,content,part,level) VALUES ('1557639640','1557639640','0','2019/05/12','MODEL','sql: database is closed ===>[options.go:60]','SYSTEM','ERROR') [0 rows affected or returned ] [Models Error]: sql: database is closed ===>[options.go:60]


    /\ /\ /\ / / / _ \
    //\/ / \ \ / / /)/ / // / _ \ _/ / / // / _/ _/_//_/ ___/

    🍭 A NEW API IMAGES STORE TOOL 🍭

    2019/05/12 13:40:40.980 [A] [main.go:43] logs: duplicate adaptername "file" (you have set this logger before) 2019/05/12 13:40:40.989 [I] [asm_amd64.s:1333] http server Running on http://:61301

    (/Users/aimer/go/src/github.com/auxpi/models/options.go:58) [2019-05-12 13:40:48] sql: database is closed

    (/Users/aimer/go/src/github.com/auxpi/models/options.go:58) [2019-05-12 13:40:48] [0.28ms] SELECT * FROM auxpi_option WHERE (auxpi_option.options_key = 'site_base') AND (auxpi_option.group = 'conf') ORDER BY auxpi_option.id ASC LIMIT 1 [0 rows affected or returned ]

    (/Users/aimer/go/src/github.com/auxpi/models/logs.go:18) [2019-05-12 13:40:48] sql: database is closed

    (/Users/aimer/go/src/github.com/auxpi/models/logs.go:18) [2019-05-12 13:40:48] [0.07ms] INSERT INTO auxpi_log (created_on,modified_on,deleted_on,created_day,type,content,part,level) VALUES ('1557639648','1557639648','0','2019/05/12','MODEL','sql: database is closed ===>[options.go:60]','SYSTEM','ERROR') [0 rows affected or returned ] [Models Error]: sql: database is closed ===>[options.go:60] 2019/05/12 13:40:48.809 [W] [index.go:34] EOF

    (/Users/aimer/go/src/github.com/auxpi/models/logs.go:18) [2019-05-12 13:40:48] sql: database is closed

    (/Users/aimer/go/src/github.com/auxpi/models/logs.go:18) [2019-05-12 13:40:48] [0.09ms] INSERT INTO auxpi_log (created_on,modified_on,deleted_on,created_day,type,content,part,level) VALUES ('1557639648','1557639648','0','2019/05/12','CONTROLLER','EOF','SYSTEM','WARNING') [0 rows affected or returned ]

    (/Users/aimer/go/src/github.com/auxpi/models/stores.go:53) [2019-05-12 13:40:48] sql: database is closed

    (/Users/aimer/go/src/github.com/auxpi/models/stores.go:53) [2019-05-12 13:40:48] [0.50ms] SELECT * FROM auxpi_store WHERE (status='true') ORDER BY rank ASC [0 rows affected or returned ]

    (/Users/aimer/go/src/github.com/auxpi/models/logs.go:18) [2019-05-12 13:40:48] sql: database is closed

    (/Users/aimer/go/src/github.com/auxpi/models/logs.go:18) [2019-05-12 13:40:48] [0.07ms] INSERT INTO auxpi_log (created_on,modified_on,deleted_on,created_day,type,content,part,level) VALUES ('1557639648','1557639648','0','2019/05/12','MODEL','sql: database is closed ===>[stores.go:57]','SYSTEM','ERROR') [0 rows affected or returned ] [Models Error]: sql: database is closed ===>[stores.go:57] 2019/05/12 13:40:48.810 [C] [asm_amd64.s:522] the request url is /2019/05/12 13:40:48.810 [C] [asm_amd64.s:522] Handler crashed with error runtime error: index out of range 2019/05/12 13:40:48.810 [C] [asm_amd64.s:522] /usr/local/Cellar/go/1.11/libexec/src/runtime/asm_amd64.s:522 2019/05/12 13:40:48.810 [C] [asm_amd64.s:522] /usr/local/Cellar/go/1.11/libexec/src/runtime/panic.go:513 2019/05/12 13:40:48.810 [C] [asm_amd64.s:522] /usr/local/Cellar/go/1.11/libexec/src/runtime/panic.go:44 2019/05/12 13:40:48.810 [C] [asm_amd64.s:522] /Users/aimer/go/src/github.com/auxpi/controllers/index.go:39 2019/05/12 13:40:48.810 [C] [asm_amd64.s:522] /Users/aimer/go/src/github.com/auxpi/controllers/index.go:74 2019/05/12 13:40:48.810 [C] [asm_amd64.s:522] /usr/local/Cellar/go/1.11/libexec/src/runtime/asm_amd64.s:522 2019/05/12 13:40:48.810 [C] [asm_amd64.s:522] /usr/local/Cellar/go/1.11/libexec/src/reflect/value.go:447 2019/05/12 13:40:48.810 [C] [asm_amd64.s:522] /usr/local/Cellar/go/1.11/libexec/src/reflect/value.go:308 2019/05/12 13:40:48.810 [C] [asm_amd64.s:522] /Users/aimer/go/pkg/mod/github.com/astaxie/[email protected]/router.go:852 2019/05/12 13:40:48.810 [C] [asm_amd64.s:522] /usr/local/Cellar/go/1.11/libexec/src/net/http/server.go:2741 2019/05/12 13:40:48.810 [C] [asm_amd64.s:522] /usr/local/Cellar/go/1.11/libexec/src/net/http/server.go:1847 2019/05/12 13:40:48.810 [C] [asm_amd64.s:522] /usr/local/Cellar/go/1.11/libexec/src/runtime/asm_amd64.s:1333 2019/05/12 13:40:48.811 [server.go:2977] [HTTP] http: multiple response.WriteHeader calls 2019/05/12 13:40:48.979 [D] [server.go:2741] | 49.67.222.243| 200 | 285.404µs| match| GET /favicon.ico -----分割线-----

    翻了一下phpmyadmin,发现没有创建表单。 求解!

    (注 刚刚在这里看到一位老哥windows下运行遇到一毛一样的错误,望解决! )

  • 请求修正前端页面的一些问题

    请求修正前端页面的一些问题

    经过这3天来的测试,在nginx的服务器上,如果使用http(80端口)来上图床网站,那么一切正常,很少会出现什么问题。但是,如果使用的是https(443端口)的话,那么nginx服务器端很容易对一部分图片返回400 Bad Request的错误。这错误发生频率很高,但帮助文档里,nginx的配置文档只写了80端口(仅http服务)。希望作者大大能在帮助文档里添加一下对https的优化支持,毕竟现在https是大趋势。我测试https的结果是——目前对于单张图片上传,10M以上的大图会100%报错,10M以下的单图上传一般没事。如果是批量上传小图,则图片数量多时会有一部分报错,图片平均体积越大,报错比例越高,我怀疑也同样是在上传图片总体积超过10M后开始报错……报错后需要重新上传,但重传时也可能再次报错……有时需要重传好几次才能全部传好,很麻烦……

  • 如何在代码中调用?

    如何在代码中调用?

    想通过读取本地文件,直接调用某个接口上传。

    imgBytes, _ := ioutil.ReadFile(imgFilePath)
    
    		imgParam := auxpi.ImageParam{
    			Name:    imgFilePath,
    			Type: "jpg",
    			Content: &imgBytes,
    		}
    
    		client := auxpi.Ali{FileLimit: nil, MaxSize: 5024}
    		res, err := client.Upload(&imgParam)
    		fmt.Println(res)
    		if err != nil {
    			fmt.Println(err)
    		}
    

    结果拿不到返回的url:

    {"code":"2"}
    
    

    这个code是啥意思

  • 通过 Auxpi-Admin 登陆无效

    通过 Auxpi-Admin 登陆无效

    Bug report(问题描述)

    访问 /admin 使用邮箱/用户名登陆都无效

    Steps to reproduce(问题复现步骤)

    1. Auxpi-Admin /admin#/login?redirect=%2Fdashboard登陆无法使用 不管使用管理员邮箱或者用户名都提示 “请输入正确的用户名”

    Screenshot or Gif(截图或动态图)

    Server environment(服务器环境)

    • Your OS & version (服务器系统&版本): macos
    • DataBase & version (数据库&版本): mysql

    Other relevant information(格外信息)

    • auxpi version:dev
  • 搜狗图床后台无法解析,百度图床无法返回正常连接

    搜狗图床后台无法解析,百度图床无法返回正常连接

    大佬,目前遇到两个问题 1、如果使用搜狗图床上传的话,后台所有图片处无法解析 返回的链接是https://我的域名/api/proxy?url=https://img01.sogoucdn.com/app/a/图片连接 这种格式就导致了后台所有图片的搜狗图片无法解析,显示裂开图片 2、还有个是百度图床前台传完了以后,会显示连接为https://image.baidu.com/search/down?tn=download&url= 并不能正确的返回图片连接来复制 不知道是不是我安装问题还是程序问题,请帮忙看下,谢谢!

  • 手动安装过程中管理员未正确添加

    手动安装过程中管理员未正确添加

    Bug report(问题描述)

    Steps to reproduce(问题复现步骤)

    1. 参考图床配置页面中流程配置进行手动安装
    2. 执行完成”初始化程序“、”修改配置文件“、”创建(迁移)数据库“步骤
    3. 创建管理员,执行
    $ ./auxpi -mod=admin -name=xxx [email protected] -pass=myPassword
    

    指令

    返回为:

    [1] 17488
    Redis
    2019/06/12 11:42:08 [info] replacing callback `gorm:update_time_stamp` from /Users/aimer/go/src/github.com/auxpi/models/models.go:80
    2019/06/12 11:42:08 [info] replacing callback `gorm:update_time_stamp` from /Users/aimer/go/src/github.com/auxpi/models/models.go:81
    
       _       __  __  ___ _____
      /_\  /\ /\ \/ / / _ \\_   \
     //_\\/ / \ \  / / /_)/ / /\/
    
    /  _  \ \_/ /  \/ ___/\/ /_
    \_/ \_/\___/_/\_\/   \____/
    
    🍭 A NEW API IMAGES STORE TOOL 🍭
    
    
    (/Users/aimer/go/src/github.com/auxpi/models/users.go:242)
    [2019-06-12 11:42:08]  [1.14ms]  SELECT * FROM `auxpi_user`  WHERE (id='1') ORDER BY `auxpi_user`.`id` ASC LIMIT 1
    [0 rows affected or returned ]
    
    (/Users/aimer/go/src/github.com/auxpi/models/logs.go:31)
    [2019-06-12 11:42:08]  [0.58ms]  INSERT INTO `auxpi_log` (`created_on`,`modified_on`,`deleted_on`,`created_day`,`type`,`content`,`part`,`level`) VALUES ('1560310928','1560310928','0','2019/06/12','MODEL','record not found  ===>[users.go:243]','SYSTEM','ERROR')
    [1 rows affected or returned ]
    [Models Error]:  record not found  ===>[users.go:243]
    
    (/Users/aimer/go/src/github.com/auxpi/models/users.go:294)
    [2019-06-12 11:42:08]  [0.45ms]  INSERT INTO `auxpi_user` (`id`,`created_on`,`modified_on`,`deleted_on`,`created_day`,`username`,`password`,`is_admin`,`email`,`status`,`token`,`version`,`role_id`) VALUES ('1','1560310928','1560310928','0','2019/06/12','xxx','039898f337858fcbb6279b2cd59785420bb7891111aec173824cf4b222b2b2ff1','true','[email protected]','1','1d483d3111c5657dfe4c4cadf4ea9543be618a7f6def7e1df2b4b17d7d85e074','1','1')
    [1 rows affected or returned ]
    [INFO]: Create Admin SUCCESS
    *bY: command not found
    [1]+  Done                    ./auxpi -mod=admin -name=xxx [email protected] -pass=myPassword
    
    1. 执行./auxpi run后可正常建立服务,进入用户界面正常。
    2. 点击页面上”后台管理“,输入正确用户名密码进入管理员界面过程中报错(弹出提示栏):
    getInfo: roles must be a non-null array !
    

    后台日志:

    (/Users/aimer/go/src/github.com/auxpi/models/users.go:104)
    [2019-06-12 12:01:42]  [0.77ms]  SELECT * FROM `auxpi_user`  WHERE (username = 'xxx') ORDER BY `auxpi_user`.`id` ASC LIMIT 1
    [1 rows affected or returned ]
    
    (/Users/aimer/go/src/github.com/auxpi/models/users.go:104)
    [2019-06-12 12:01:42]  [0.44ms]  SELECT * FROM `auxpi_role`  WHERE (`id` IN ('1')) ORDER BY `auxpi_role`.`id` ASC
    [0 rows affected or returned ]
    

    Server environment(服务器环境)

    • Your OS & version (服务器系统&版本): DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu 16.04.6 LTS"
    • DataBase & version (数据库&版本): Mysql: 5.7.26 (docker)

    Other relevant information(格外信息)

    • auxpi version: V2.3.9

    貌似是执行建立管理员指令中没有往auxpi_role表写入数据?

  • 本地图床返回的 URL 无法插入数据库

    本地图床返回的 URL 无法插入数据库

    [A] [asm_amd64.s:1333]  本地图床返回的 URL 无法插入数据库, URL为:http://176.96.138.79:2333/images/2019/07/21/o7mIr1wE2zlCd3eM.jpg
    

    使用一键脚本安装图床程序(不包含nginx,mysql等),cache使用memory; ./auxpi init后添加管理员[email protected] 123123123,后台更改站点链接为http://176.96.138.79:2333 (目前demo运行中) 后上传图片正常,但log中显示无法插入数据库,在后台也看不到上传的图片,但是通过链接可以访问图片 LOG见http://176.96.138.79/log.txt

  • 请支持图片url远程上传

    请支持图片url远程上传

    很多时候并不是都必须使用post给api接口上传,能简化流程当然更简化!!

    比如我在网上看到一张配图 正常操作一: 保存电脑,打开图床程序选择图片提交上传 正常操作二:采集网页获取文章图片保存下载,写代码post图片到api接口,接收返回url,替换图片地址,发布..

    以上是最常用的情景都存在的效率问题: 保存下载- post到图床程序- 图床程序再post到平台接口, 其中的(保存下载- post到图床程序) 这两步可以说完全多余的,如果直接post或get图片地址到图床程序能完成就增加很多流量时间效率

    比如直接访问:http://test/get?http://sina.cn/img.jpg 图床服务器直接获取get?参数的图片地址进行保存下载,分发平台 返回图床程序的图片URL..

    这样的流程就省下: 保存下载再上传图床程序 或 采集文章保存图片时要下载后post到图床程序的步骤..

  • 利用图片中转url 随时切换各大图片平台

    利用图片中转url 随时切换各大图片平台

    搜狗好像已经失效了,有时间限制,一过时间就 404..

    功能很喜欢,但环境可能有点麻烦, 一个正常的 web 环境 linux 宝塔安装了 nginx php mysql 等环境不敢乱上这个源码的脚本搭环境,生怕 web 环境受到影响...

    给个建议: 上传或 api 图片,服务器以 MD5 名称先保存到服务器本地备份,图片 MD5 记录到 mysql 里返回标准 url http://test/MD5 后台选择本地,sina,smms 等任意一个返回图片地址 mysql 字段用 id,MD5,sinaurl,smmsurl,x1url,x2url,x3url 等等

    流程: 图片上传服务器 - 服务器分发各大 api 平台 - 记录各大平台返回的图片地址到 mysql

    后台指定开启本地图片或 sina 图床 - 访问 http://test/MD5 - 跳转本地或 sina 图片 url

    好处:各大平台有备份,url 也都保存 mysql 了,唯一标识就是 MD5 码

    只要你写文章时调用的是 http://test/MD5,不管你正在使用的是什么图床平台,一旦平台挂了直接选择其他平台 url,假如全部平台挂了还有最安全的本地图片来调用..

    就是说图片平台挂,不影响你发布文章调用的图片 url,因为后台一换平台就又正常恢复了,,

    试想一下如果不是 md5 方式保存 sql,你写文章时用的是 sina 平台的图片 url,就算你分发到各大平台,但 sina 平台挂了,你的文章不就要一个一个图片替换 url 吗? 这个工作量可是非常恐怖了,如果是采用 http://test/MD5 来中转,你就不用担心平台挂了要去文章里替换图片地址的问题....

  • 执行 ./auxpi migrate`./auxpi init时出错

    执行 ./auxpi migrate`./auxpi init时出错

    Question(提问)

    执行auxpi init 显示

    [root@iz2zec9sx8vfuzeq5rhts3z auxpi]# ./auxpi migrate panic: dial tcp 127.0.0.1:6379: connect: connection refused 执行./auxpi migrate显示 goroutine 1 [running]: github.com/auxpi/bootstrap.initCache(0xc00000a420, 0xc000047f30) /Users/aimer/go/src/github.com/auxpi/bootstrap/Config.go:220 +0x71a panic: dial tcp 127.0.0.1:6379: connect: connection refused

  • 脚本进行下去、管理账号无法登录

    脚本进行下去、管理账号无法登录

    1、内地对于github十分不友好,脚本无法运行,经过更改wget链接,才让脚本进行下去。 解决建议:

    将代码搬到gitee、或者上传到网盘. . . . 修改一键脚本

    2、脚本运行完成之后,无法登录管理员账号! 迷惑内容:

    管理员账号不是应该在一键脚本运行完成时,就已经配置好了么?为什么还要在创建? 或许是我能力不足,我到现在都无法确定我是否已经创建好了管理员账号 解决建议: 将默认用户名密码,内置到一键脚本中,用户自行更改!

    愿景:

    希望这么棒的项目,能够成长壮大,更加人性化! 感谢项目团队的无私分享!

  • 上传图片提示runtime error: invalid memory address or nil pointer dereference

    上传图片提示runtime error: invalid memory address or nil pointer dereference

    Question(提问)

    Build了dev分支的源码,上传图片提示如下

    TurboCloud-IMG:runtime error: invalid memory address or nil pointer dereference
    
    Request Method: | POST
    -- | --
    Request URL: | /api/v1/web_upload
    RemoteAddr: | ***********************
    
    /usr/lib/golang/src/runtime/panic.go:679
    /usr/lib/golang/src/runtime/panic.go:199
    /usr/lib/golang/src/runtime/signal_unix.go:394
    /root/go/pkg/mod/github.com/astaxie/[email protected]/controller.go:557
    /usr/lib/golang/src/reflect/value.go:460
    /usr/lib/golang/src/reflect/value.go:321
    /root/go/pkg/mod/github.com/astaxie/[email protected]/router.go:853
    /usr/lib/golang/src/net/http/server.go:2802
    /usr/lib/golang/src/net/http/server.go:1890
    /usr/lib/golang/src/runtime/asm_amd64.s:1357
    

    后端抛这个

    2020/06/14 11:18:55.113 [C] [panic.go:679]  the request url is  /api/v1/web_upload
    2020/06/14 11:18:55.113 [C] [panic.go:679]  Handler crashed with error runtime error: invalid memory address or nil pointer dereference
    2020/06/14 11:18:55.113 [C] [panic.go:679]  /usr/lib/golang/src/runtime/panic.go:679
    2020/06/14 11:18:55.113 [C] [panic.go:679]  /usr/lib/golang/src/runtime/panic.go:199
    2020/06/14 11:18:55.113 [C] [panic.go:679]  /usr/lib/golang/src/runtime/signal_unix.go:394
    2020/06/14 11:18:55.113 [C] [panic.go:679]  /root/go/pkg/mod/github.com/astaxie/[email protected]/controller.go:557
    2020/06/14 11:18:55.113 [C] [panic.go:679]  /usr/lib/golang/src/reflect/value.go:460
    2020/06/14 11:18:55.113 [C] [panic.go:679]  /usr/lib/golang/src/reflect/value.go:321
    2020/06/14 11:18:55.113 [C] [panic.go:679]  /root/go/pkg/mod/github.com/astaxie/[email protected]/router.go:853
    2020/06/14 11:18:55.113 [C] [panic.go:679]  /usr/lib/golang/src/net/http/server.go:2802
    2020/06/14 11:18:55.113 [C] [panic.go:679]  /usr/lib/golang/src/net/http/server.go:1890
    2020/06/14 11:18:55.113 [C] [panic.go:679]  /usr/lib/golang/src/runtime/asm_amd64.s:1357
    

    这个问题在2.3.9的源码build中发现上传小的图片不会报错,大图就gg

  • BeeGo依赖问题

    BeeGo依赖问题

    直接运行release的程序报错,提示

    2020/06/14 10:37:18 [info] replacing callback `gorm:update_time_stamp` from /Users/aimer/go/src/github.com/auxpi/models/models.go:80
    2020/06/14 10:37:18 [info] replacing callback `gorm:update_time_stamp` from /Users/aimer/go/src/github.com/auxpi/models/models.go:81
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x1b8 pc=0x9a69b9]
    
    goroutine 1 [running]:
    github.com/auxpi/utils.init()
            /Users/aimer/go/src/github.com/auxpi/utils/jwt.go:24 +0xd9
    
    

    然后我自己build了下 发现了如下Bug

    Bug report(问题描述)

    Build时BeeGo v1.11.1 require的goes已经用不了了

    Steps to reproduce(问题复现步骤)

    直接build,即可复现

    Screenshot or Gif(截图或动态图)

    直接上提示

    go: github.com/astaxie/[email protected] requires
            github.com/belogik/[email protected]: invalid version: git fetch -f https://github.com/belogik/goes refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /root/go/pkg/mod/cache/vcs/0c31a160b38443d5e33ca2a5e60e51734d83293b66dc3d9b0c12699f8d2b5cec: exit status 128:
            remote: Invalid username or password.
            fatal: Authentication failed for 'https://github.com/belogik/goes/'
    

    Server environment(服务器环境)

    • Your OS & version (服务器系统&版本):Centos7.6 x86_64
    • DataBase & version (数据库&版本):mysql5.6

    Other relevant information(格外信息)

    • auxpi version:dev

    经过测试的解决方案

    BeeGo已经在v1.12.0更改了github.com/OwnLocal/goes v1.0.0作为依赖 所以只需要在go.sum/go.mod下更改beego的版本为v1.12.1即可 go.mod更改以下内容 github.com/astaxie/beego v1.12.1 go.sum更改以下内容 github.com/astaxie/beego v1.12.1 h1:dfpuoxpzLVgclveAXe4PyNKqkzgm5zF4tgF2B3kkM2I= github.com/astaxie/beego v1.12.1/go.mod h1:kPBWpSANNbSdIqOc8SUL9h+1oyBMZhROeYsXQDbidWQ=

    然后重新build,编译未报错,执行也正常了。

    希望作者更改dev的两个文件

Fully serverless CAPTCHA API created with API Gateway, Lambda, Dynamodb and Go
Fully serverless CAPTCHA API created with API Gateway, Lambda, Dynamodb and Go

Fully serverless CAPTCHA API created with API Gateway, Lambda, Dynamodb and Go

Mar 4, 2022
Go (Golang) API REST with Gin FrameworkGo (Golang) API REST with Gin Framework

go-rest-api-aml-service Go (Golang) API REST with Gin Framework 1. Project Description Build REST APIs to support AML service with the support of exte

Nov 21, 2021
Rental-api - A RESTful-API that allows developers to connect to data about rental properties

Rentals-API is a RESTful-API that allows developers to connect to data about rental properties.

Jan 24, 2022
Go-todo-api - An example API project written Go and Fiber Framework

This is an example API project written Go and Fiber Framework. Test codes has been written for all controller functions. Environment variables are taken from config.yml.

Jan 24, 2022
Go-gin-mongo-api - A backend RESTful API built using golang, gin and mongoDB

go-gin-mongo-API This is a RESTful backend API which is developed using the gola

Jul 19, 2022
Ecommerce-api - Rest api of e-commerce web application
Ecommerce-api - Rest api of e-commerce web application

E-commerce Rest API Swagger documentation to test api Domain diagram

Jan 2, 2023
License-API - Basic license based authentication API with discord account integration

License-API Basic license based authentication API with discord account integrat

Feb 18, 2022
Api-go-gin-viper - Simple representaion on how to implement CRUD functionality in API using Go programming language

Simple API implementaion in Go To Get Started Clone repo Run the command to clon

Feb 18, 2022
REST API for RabbitMQ, Write with Google Go(lang).

RabbitMQ HTTP API REST HTTP API for RabbitMQ, it's not RabbitMQ Management Plugin. Status: Under active development. Required: * RabbitMQ (2.8+) * Go(

Aug 29, 2022
gin api blog

Gin项目 介绍 以下是基于gin开发的项目接口,将持续更新,有兴趣请star,本项目包含mysql,redis,elasticsearch,mongo,rabbitmq,kafka,jaeger,单机限流,分布式限流,sentry, jwt,请求参数验证,发送邮件,图片上传,httpclient用

Oct 14, 2022
Simple Bank is a simple REST API that allows users to perform transferences with each other.

Simple Bank is a simple REST API that allows users to perform transferences with each other. ?? Technologies Golang Docker PostgreSQ

Feb 15, 2022
Go Server/API boilerplate using best practices DDD CQRS ES gRPC
Go Server/API boilerplate using best practices DDD CQRS ES gRPC

Go Server/API boilerplate using best practices DDD CQRS ES gRPC

Jan 6, 2023
📔 Journal helps you manage multiple journals with ease from the comfort of your terminal, web browser or API client.
📔 Journal helps you manage multiple journals with ease from the comfort of your terminal, web browser or API client.

Journal helps you manage multiple journals with ease from the comfort of your terminal, web browser or API client. You can import/export journals as horcruxes and set simple customizations for layout, theme, and keybindings.

Sep 14, 2022
Sample Go REST API implementation with DDD using Clean Architecture.

This layer is a part developed for client-side (mobile, web, etc.) applications to access our domain. It will forward the requests from this layer to the application layer and expose the response it receives from the application layer.

Jan 3, 2023
An RRDtool api server that exports a subset of rrdtool commands over http(s).

rrdsrv An RRDtool api server that exports a subset of rrdtool commands over http(s). Be sure to checkout the grafana plugin. Demo video. Usage Usage o

Dec 7, 2022
使用 GO 搭建的 API 后台框架

使用 GO 搭建的 API 后台框架 一个适合新手上手的 API 框架,基于 Gin 开发。

Aug 27, 2022
GraphQL API for Fantom Artion

Artion-API-GraphQL GraphQL API for Fantom Artion. GraphQL api is available at http://localhost:16761/graphi NFTs images can be accessed like http://lo

Oct 1, 2022
Simple vanilla Go CRUD application with mongoDB database with its mflix dataset that I use for my thesis about benchmarking REST API and GraphQL.

Go GraphQL Simple vanilla Go CRUD application with mongoDB database with its mflix dataset that I use for my thesis about benchmarking REST API and Gr

Oct 15, 2021
A restful api's with Gin Framework with a structured project that defaults to PostgreSQL database
A restful api's with Gin Framework with a structured project that defaults to PostgreSQL database

Welcome to Golang Gin boilerplate v2 The fastest way to deploy a restful api's with Gin Framework with a structured project that defaults to PostgreSQ

Oct 15, 2021