chore: change qBittorrent setting [skip ci]

pull/3441/head
Andy Hsu 2023-02-15 16:24:03 +08:00
parent 805b1e4fa3
commit ae2ee1821a
4 changed files with 9 additions and 6 deletions

View File

@ -156,7 +156,7 @@ func InitialSettings() []model.SettingItem {
{Key: conf.GithubLoginEnabled, Value: "false", Type: conf.TypeBool, Group: model.GITHUB, Flag: model.PUBLIC}, {Key: conf.GithubLoginEnabled, Value: "false", Type: conf.TypeBool, Group: model.GITHUB, Flag: model.PUBLIC},
// qbittorrent settings // qbittorrent settings
{Key: conf.QbittorrentUrl, Value: "http://admin:adminadmin@localhost:8080/", Type: conf.TypeString, Group: model.QBITTORRENT, Flag: model.PRIVATE}, {Key: conf.QbittorrentUrl, Value: "http://admin:adminadmin@localhost:8080/", Type: conf.TypeString, Group: model.SINGLE, Flag: model.PRIVATE},
} }
if flags.Dev { if flags.Dev {
initialSettingItems = append(initialSettingItems, []model.SettingItem{ initialSettingItems = append(initialSettingItems, []model.SettingItem{

View File

@ -9,7 +9,6 @@ const (
ARIA2 ARIA2
INDEX INDEX
GITHUB GITHUB
QBITTORRENT
) )
const ( const (

View File

@ -19,10 +19,14 @@ func SetQbittorrent(c *gin.Context) {
common.ErrorResp(c, err, 400) common.ErrorResp(c, err, 400)
return return
} }
items := []model.SettingItem{ item := &model.SettingItem{
{Key: conf.QbittorrentUrl, Value: req.Url, Type: conf.TypeString, Group: model.QBITTORRENT, Flag: model.PRIVATE}, Key: conf.QbittorrentUrl,
Value: req.Url,
Type: conf.TypeString,
Group: model.SINGLE,
Flag: model.PRIVATE,
} }
if err := op.SaveSettingItems(items); err != nil { if err := op.SaveSettingItem(item); err != nil {
common.ErrorResp(c, err, 500) common.ErrorResp(c, err, 500)
return return
} }

View File

@ -89,7 +89,7 @@ func admin(g *gin.RouterGroup) {
setting.POST("/delete", handles.DeleteSetting) setting.POST("/delete", handles.DeleteSetting)
setting.POST("/reset_token", handles.ResetToken) setting.POST("/reset_token", handles.ResetToken)
setting.POST("/set_aria2", handles.SetAria2) setting.POST("/set_aria2", handles.SetAria2)
setting.POST("/set_qbittorrent", handles.SetQbittorrent) setting.POST("/set_qbit", handles.SetQbittorrent)
task := g.Group("/task") task := g.Group("/task")
handles.SetupTaskRoute(task) handles.SetupTaskRoute(task)