mirror of
https://github.com/simon-ding/polaris.git
synced 2026-02-06 23:21:00 +08:00
feat: nfo support frontend
This commit is contained in:
@@ -19,6 +19,7 @@ type GeneralSettings struct {
|
||||
LogLevel string `json:"log_level"`
|
||||
Proxy string `json:"proxy"`
|
||||
EnablePlexmatch bool `json:"enable_plexmatch"`
|
||||
EnableNfo bool `json:"enable_nfo"`
|
||||
AllowQiangban bool `json:"allow_qiangban"`
|
||||
}
|
||||
|
||||
@@ -62,6 +63,12 @@ func (s *Server) SetSetting(c *gin.Context) (interface{}, error) {
|
||||
s.db.SetSetting(db.SettingAllowQiangban, "false")
|
||||
}
|
||||
|
||||
if in.EnableNfo {
|
||||
s.db.SetSetting(db.SettingNfoSupportEnabled, "true")
|
||||
} else {
|
||||
s.db.SetSetting(db.SettingNfoSupportEnabled, "false")
|
||||
}
|
||||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -71,6 +78,7 @@ func (s *Server) GetSetting(c *gin.Context) (interface{}, error) {
|
||||
logLevel := s.db.GetSetting(db.SettingLogLevel)
|
||||
plexmatchEnabled := s.db.GetSetting(db.SettingPlexMatchEnabled)
|
||||
allowQiangban := s.db.GetSetting(db.SettingAllowQiangban)
|
||||
enableNfo := s.db.GetSetting(db.SettingNfoSupportEnabled)
|
||||
return &GeneralSettings{
|
||||
TmdbApiKey: tmdb,
|
||||
DownloadDir: downloadDir,
|
||||
@@ -78,6 +86,7 @@ func (s *Server) GetSetting(c *gin.Context) (interface{}, error) {
|
||||
Proxy: s.db.GetSetting(db.SettingProxy),
|
||||
EnablePlexmatch: plexmatchEnabled == "true",
|
||||
AllowQiangban: allowQiangban == "true",
|
||||
EnableNfo: enableNfo == "true",
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ class GeneralSetting {
|
||||
String? proxy;
|
||||
bool? enablePlexmatch;
|
||||
bool? allowQiangban;
|
||||
bool? enableNfo;
|
||||
|
||||
GeneralSetting(
|
||||
{this.tmdbApiKey,
|
||||
@@ -60,6 +61,7 @@ class GeneralSetting {
|
||||
this.logLevel,
|
||||
this.proxy,
|
||||
this.enablePlexmatch,
|
||||
this.enableNfo,
|
||||
this.allowQiangban});
|
||||
|
||||
factory GeneralSetting.fromJson(Map<String, dynamic> json) {
|
||||
@@ -69,6 +71,7 @@ class GeneralSetting {
|
||||
logLevel: json["log_level"],
|
||||
proxy: json["proxy"],
|
||||
allowQiangban: json["allow_qiangban"] ?? false,
|
||||
enableNfo: json["enable_nfo"] ?? false,
|
||||
enablePlexmatch: json["enable_plexmatch"] ?? false);
|
||||
}
|
||||
|
||||
@@ -80,6 +83,7 @@ class GeneralSetting {
|
||||
data["proxy"] = proxy;
|
||||
data["enable_plexmatch"] = enablePlexmatch;
|
||||
data["allow_qiangban"] = allowQiangban;
|
||||
data["enable_nfo"] = enableNfo;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ class _GeneralState extends ConsumerState<GeneralSettings> {
|
||||
"proxy": v.proxy,
|
||||
"enable_plexmatch": v.enablePlexmatch,
|
||||
"allow_qiangban": v.allowQiangban,
|
||||
"enable_nfo": v.enableNfo,
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -92,7 +93,15 @@ class _GeneralState extends ConsumerState<GeneralSettings> {
|
||||
width: 300,
|
||||
child: FormBuilderSwitch(
|
||||
decoration:
|
||||
const InputDecoration(icon: Icon(Icons.phone_iphone)),
|
||||
const InputDecoration(icon: Icon(Icons.library_books), helperText: "emby/kodi等软件刮削需要"),
|
||||
name: "enable_nfo",
|
||||
title: const Text("nfo 文件支持")),
|
||||
),
|
||||
SizedBox(
|
||||
width: 300,
|
||||
child: FormBuilderSwitch(
|
||||
decoration:
|
||||
const InputDecoration(icon: Icon(Icons.remove_circle)),
|
||||
name: "allow_qiangban",
|
||||
title: const Text("是否下载枪版资源")),
|
||||
),
|
||||
@@ -115,6 +124,7 @@ class _GeneralState extends ConsumerState<GeneralSettings> {
|
||||
logLevel: values["log_level"],
|
||||
proxy: values["proxy"],
|
||||
allowQiangban: values["allow_qiangban"],
|
||||
enableNfo: values["enable_nfo"],
|
||||
enablePlexmatch:
|
||||
values["enable_plexmatch"]))
|
||||
.then((v) => showSnakeBar("更新成功"));
|
||||
|
||||
Reference in New Issue
Block a user