Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0433cc7b0a | ||
|
|
accc02c74c | ||
|
|
87b6c99f1f | ||
|
|
b2a092c64e | ||
|
|
51fc5c3c74 | ||
|
|
5e6a17f86c | ||
|
|
2fedfd6c76 | ||
|
|
61bc9b72bd | ||
|
|
a997726a5f |
72
README.md
@@ -2,8 +2,8 @@
|
||||
|
||||
Polaris 是一个电视剧和电影的追踪软件。配置好了之后,当剧集或者电影播出后,会第一时间下载对应的资源。支持本地存储或者webdav。
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
交流群: https://t.me/+8R2nzrlSs2JhMDgx
|
||||
|
||||
@@ -13,75 +13,21 @@ Polaris 是一个电视剧和电影的追踪软件。配置好了之后,当剧
|
||||
- [x] 电影自动追踪下载
|
||||
- [x] webdav 存储支持,配合 [alist](https://github.com/alist-org/alist) 或阿里云等实现更多功能
|
||||
|
||||
## 使用
|
||||
|
||||
使用此程序参考 [【快速开始】](./doc/quick_start.md)
|
||||
|
||||
|
||||
## 对比 sonarr/radarr
|
||||
* 更好的中文支持
|
||||
* 对于动漫、日剧的良好支持,配合国内站点基本能匹配上对应资源
|
||||
* 支持 webdav 后端存储,可以配合 alist 或者阿里云来实现下载后实时传到云上的功能。这样外出就可以不依靠家里的宽带来看电影了,或者实现个轻 NAS 功能,下载功能放在本地,数据放在云盘
|
||||
* golang 实现后端,相比于 .NET 更节省资源
|
||||
* 一个程序同时实现了电影、电视剧功能,不需要装两个程序
|
||||
* 当然 sonarr/radarr 也是非常优秀的开源项目,目前 Polaris 功能还没有 sonarr/radarr 丰富
|
||||
|
||||
## 快速开始
|
||||
|
||||
最简单部署 Polaris 的方式是使用 docker compose
|
||||
|
||||
```yaml
|
||||
services:
|
||||
polaris:
|
||||
image: ghcr.io/simon-ding/polaris:latest
|
||||
restart: always
|
||||
volumes:
|
||||
- ./config/polaris:/app/data #程序配置文件路径
|
||||
- /downloads:/downloads #下载路径,需要和下载客户端配置一致
|
||||
- /data:/data #媒体数据存储路径,也可以启动自己配置webdav存储
|
||||
ports:
|
||||
- 8080:8080
|
||||
transmission: #下载客户端,也可以不安装使用已有的
|
||||
image: lscr.io/linuxserver/transmission:latest
|
||||
container_name: transmission
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- ./config/transmission:/config
|
||||
- /downloads:/downloads #此路径要与polaris下载路径保持一致
|
||||
ports:
|
||||
- 9091:9091
|
||||
- 51413:51413
|
||||
- 51413:51413/udp
|
||||
```
|
||||
|
||||
拉起之后访问 http://< ip >:8080 的形式访问
|
||||
|
||||
## 配置
|
||||
|
||||
要正确使用此程序,需要配置好以下设置:
|
||||
|
||||
### TMDB设置
|
||||
因为此程序需要使用到 TMDB 的数据,使用此程序首先要申请一个 TMDB 的 Api Key
|
||||
|
||||
### 索引器
|
||||
|
||||
索引器是资源提供者,目前支持 torznab 协议,意味着 polarr 或者 jackett 都可以支持。请自行部署相关程序。
|
||||
|
||||
推荐使用 linuxserver 的镜像:https://docs.linuxserver.io/images/docker-jackett/
|
||||
|
||||
### 下载器
|
||||
|
||||
资源由谁下载,目前可支持 tansmission,需要配置好对应下载器
|
||||
|
||||
### 存储设置
|
||||
|
||||
程序默认所有剧集和电影存储在 /data 路径下,如果想修改路径或者webdav存储,需要在存储配置下修改
|
||||
|
||||
## 开始使用
|
||||
|
||||
配置完了这些,开始享受使用此程序吧!可以搜索几部自己想看的电影或者电视机,加入想看列表。当剧集有更新或者电影有资源是就会自动下载对应资源了。
|
||||
|
||||
|
||||
|
||||
-------------
|
||||
|
||||
## 请我喝杯咖啡
|
||||
|
||||
<img src="assets/wechat.JPG" width=40% height=40%>
|
||||
<img src="./doc/assets/wechat.JPG" width=40% height=40%>
|
||||
|
||||
4
db/db.go
@@ -63,6 +63,10 @@ func (c *Client) init() {
|
||||
log.Infof("set default log level")
|
||||
c.SetSetting(SettingLogLevel, "info")
|
||||
}
|
||||
// if tr := c.GetTransmission(); tr == nil {
|
||||
// log.Warnf("no download client, set default download client")
|
||||
// c.SaveTransmission("transmission", "http://transmission:9091", "", "")
|
||||
// }
|
||||
}
|
||||
|
||||
func (c *Client) generateJwtSerectIfNotExist() {
|
||||
|
||||
BIN
doc/assets/add_indexer.png
Normal file
|
After Width: | Height: | Size: 92 KiB |
BIN
doc/assets/add_series.png
Normal file
|
After Width: | Height: | Size: 804 KiB |
BIN
doc/assets/copy_feed.png
Normal file
|
After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 2.1 MiB After Width: | Height: | Size: 2.1 MiB |
BIN
doc/assets/downloader.png
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
doc/assets/jackett_api_key.png
Normal file
|
After Width: | Height: | Size: 115 KiB |
BIN
doc/assets/local_storage.png
Normal file
|
After Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 3.4 MiB After Width: | Height: | Size: 3.4 MiB |
BIN
doc/assets/polaris_add_indexer.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
doc/assets/search_add.png
Normal file
|
After Width: | Height: | Size: 80 KiB |
BIN
doc/assets/search_series.png
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
doc/assets/webdav_storage.png
Normal file
|
After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 111 KiB After Width: | Height: | Size: 111 KiB |
54
doc/configuration.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# 配置
|
||||
|
||||
要正确使用此程序,需要配置好以下设置:
|
||||
|
||||
### TMDB设置
|
||||
1. 因为此程序需要使用到 TMDB 的数据,使用此程序首先要申请一个 TMDB 的 Api Key. 申请教程请 google [tmdb api key申请](https://www.google.com/search?q=tmdb+api+key%E7%94%B3%E8%AF%B7)
|
||||
|
||||
2. 拿到 TMDB Api Key之后,请填到 *设置 -> 常规设置 -> TMDB Api Key里*
|
||||
|
||||
### 索引器
|
||||
|
||||
索引器是资源提供者,目前支持 torznab 协议,意味着 polarr 或者 jackett 都可以支持。请自行部署相关程序,或者使用的 docker compose 配置一起拉起
|
||||
|
||||
推荐使用 linuxserver 的镜像:https://docs.linuxserver.io/images/docker-jackett/
|
||||
|
||||
#### 索引器配置
|
||||
|
||||
索引器配置这里以 jackett 为例。使用默认 docker compose 配置拉起后以 http://< ip >:9117 可访问 jackett 的主页。
|
||||
|
||||
1. 打开 jackett 主页后,点击页面上面的 Add indexer,会出现 BT/PT 站点列表,选择你需要的站点点击+号添加。如果是PT,请自行配置好相关配置
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
2. 添加后主页即会显示相应的BT/PT站点,点击 *Copy Torznab Feed* 即得到了我们需要的地址
|
||||
|
||||

|
||||
|
||||
3. 回到我们的主程序 Polaris 当中,点击 *设置 -> 索引器设置* -> 点击+号增加新的索引器,输入一个名称,拷贝我们第2步得到的地址到地址栏
|
||||
|
||||

|
||||
|
||||
4. 选相框中我们可以看到,还需要一个 API Key,我们回到 Jackett 中,在页面右上角,复制我们需要的 API Key:
|
||||

|
||||
|
||||
5. 恭喜!你已经成功完成了索引器配置。如需要更多的站点,请重复相同的操作完成配置
|
||||
|
||||
### 下载器
|
||||
|
||||
资源下载器,目前可支持 tansmission,请配置好对应配置
|
||||
|
||||

|
||||
|
||||
### 存储设置
|
||||
|
||||
默认配置了名为 local 的本地存储,如果你不知道怎么配置。请使用默认配置
|
||||
|
||||

|
||||
|
||||
类型里选择 webdav 可以使用 webdav 存储,配合 alist/clouddrive 等,可以实现存储到云盘里的功能。
|
||||
|
||||

|
||||
69
doc/quick_start.md
Normal file
@@ -0,0 +1,69 @@
|
||||
## 快速开始
|
||||
|
||||
最简单部署 Polaris 的方式是使用 docker compose,Polaris要完整运行另外需要一个索引客户端和一个下载客户端。索引客户端支持 polarr 或 jackett,下载客户端目前只支持 transmission。
|
||||
|
||||
下面是一个示例 docker-compose 配置,为了简单起见,一起拉起了 transmission 和 jackett,你也可选择单独安装
|
||||
|
||||
**注意:** transmission 的下载路径映射要和 polaris 保持一致,如果您不知道怎么做,请保持默认设置。
|
||||
|
||||
```yaml
|
||||
services:
|
||||
polaris:
|
||||
image: ghcr.io/simon-ding/polaris:latest
|
||||
restart: always
|
||||
volumes:
|
||||
- ./config/polaris:/app/data #程序配置文件路径
|
||||
- /downloads:/downloads #下载路径,需要和下载客户端配置一致
|
||||
- /data:/data #媒体数据存储路径,也可以启动自己配置webdav存储
|
||||
ports:
|
||||
- 8080:8080
|
||||
transmission: #下载客户端,也可以不安装使用已有的
|
||||
image: lscr.io/linuxserver/transmission:latest
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- ./config/transmission:/config
|
||||
- /downloads:/downloads #此路径要与polaris下载路径保持一致
|
||||
ports:
|
||||
- 9091:9091
|
||||
- 51413:51413
|
||||
- 51413:51413/udp
|
||||
jackett: #索引客户端,也可以不安装使用已有的
|
||||
image: lscr.io/linuxserver/jackett:latest
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- ./config/jackett:/config
|
||||
ports:
|
||||
- 9117:9117
|
||||
restart: unless-stopped
|
||||
```
|
||||
|
||||
拉起之后访问 http://< ip >:8080 的形式访问
|
||||
|
||||
|
||||

|
||||
|
||||
## 配置
|
||||
|
||||
详细配置请看 [配置篇](./configuration.md)
|
||||
|
||||
|
||||
## 开始使用
|
||||
|
||||
1. 完成配置之后,我们就可以在右上角的搜索按钮里输入我们想看的电影、电视剧。
|
||||

|
||||
|
||||
2. 找到对应电影电视剧后,点击加入想看列表
|
||||

|
||||
|
||||
3. 当电影有资源、或者电视剧有更新时,程序就会自动下载对应资源到指定的存储。对于剧集,您也可以进入剧集的详细页面,点击搜索按钮来自己搜索对应集的资源。
|
||||
|
||||
|
||||
到此,您已经基本掌握了此程序的使用方式,请尽情体验吧!
|
||||
|
||||
|
||||
@@ -41,9 +41,9 @@ func SetLogLevel(l string) {
|
||||
case "info":
|
||||
atom.SetLevel(zap.InfoLevel)
|
||||
Info("set log level to info")
|
||||
case "warn", "warnning":
|
||||
case "warn", "warning":
|
||||
atom.SetLevel(zap.WarnLevel)
|
||||
Warn("set log level to warnning")
|
||||
Warn("set log level to warning")
|
||||
case "error":
|
||||
atom.SetLevel(zap.ErrorLevel)
|
||||
Error("set log level to error")
|
||||
|
||||
@@ -45,6 +45,22 @@ type Client struct {
|
||||
cfg Config
|
||||
}
|
||||
|
||||
func (c *Client) GetAll() ([]*Torrent, error) {
|
||||
all, err := c.c.TorrentGetAll(context.TODO())
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "get all")
|
||||
}
|
||||
var torrents []*Torrent
|
||||
for _, t := range all {
|
||||
torrents = append(torrents, &Torrent{
|
||||
ID: *t.ID,
|
||||
c: c.c,
|
||||
Config: c.cfg,
|
||||
})
|
||||
}
|
||||
return torrents, nil
|
||||
}
|
||||
|
||||
func (c *Client) Download(link, dir string) (*Torrent, error) {
|
||||
if strings.HasPrefix(link, "http") {
|
||||
client := &http.Client{
|
||||
|
||||
@@ -93,3 +93,33 @@ func (s *Server) GetMediaDownloadHistory(c *gin.Context) (interface{}, error) {
|
||||
}
|
||||
return his, nil
|
||||
}
|
||||
|
||||
type TorrentInfo struct {
|
||||
Name string `json:"name"`
|
||||
ID int64 `json:"id"`
|
||||
SeedRatio float32 `json:"seed_ratio"`
|
||||
Progress int `json:"progress"`
|
||||
}
|
||||
|
||||
func (s *Server) GetAllTorrents(c *gin.Context) (interface{}, error) {
|
||||
trc, err := s.getDownloadClient()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "connect transmission")
|
||||
}
|
||||
all, err := trc.GetAll()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "get all")
|
||||
}
|
||||
var infos []TorrentInfo
|
||||
for _, t := range all {
|
||||
if !t.Exists() {
|
||||
continue
|
||||
}
|
||||
infos = append(infos, TorrentInfo{
|
||||
Name: t.Name(),
|
||||
ID: t.ID,
|
||||
Progress: t.Progress(),
|
||||
})
|
||||
}
|
||||
return infos, nil
|
||||
}
|
||||
|
||||
@@ -110,10 +110,6 @@ func SearchMovie(db1 *db.Client, movieId int, checkResolution bool) ([]torznab.R
|
||||
if meta.Year != year && meta.Year != year-1 && meta.Year != year+1 { //year not match
|
||||
continue
|
||||
}
|
||||
if utils.ContainsIgnoreCase(r.Name, "soundtrack") {
|
||||
//ignore soundtracks
|
||||
continue
|
||||
}
|
||||
|
||||
filtered = append(filtered, r)
|
||||
|
||||
|
||||
@@ -73,6 +73,7 @@ func (s *Server) Serve() error {
|
||||
activity.GET("/", HttpHandler(s.GetAllActivities))
|
||||
activity.DELETE("/:id", HttpHandler(s.RemoveActivity))
|
||||
activity.GET("/media/:id", HttpHandler(s.GetMediaDownloadHistory))
|
||||
activity.GET("/torrents", HttpHandler(s.GetAllTorrents))
|
||||
}
|
||||
|
||||
tv := api.Group("/media")
|
||||
|
||||
@@ -30,84 +30,82 @@ class _SystemSettingsPageState extends ConsumerState<SystemSettingsPage> {
|
||||
|
||||
var tmdbSetting = settings.when(
|
||||
data: (v) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.fromLTRB(40, 10, 40, 0),
|
||||
child: FormBuilder(
|
||||
key: _formKey, //设置globalKey,用于后面获取FormState
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
initialValue: {
|
||||
"tmdb_api": v.tmdbApiKey,
|
||||
"download_dir": v.downloadDIr,
|
||||
"log_level": v.logLevel
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
FormBuilderTextField(
|
||||
name: "tmdb_api",
|
||||
autofocus: true,
|
||||
decoration: Commons.requiredTextFieldStyle(
|
||||
text: "TMDB Api Key", icon: const Icon(Icons.key)),
|
||||
//
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
FormBuilderTextField(
|
||||
name: "download_dir",
|
||||
autofocus: true,
|
||||
decoration: Commons.requiredTextFieldStyle(
|
||||
text: "下载路径", icon: const Icon(Icons.folder)),
|
||||
//
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
SizedBox(
|
||||
width: 300,
|
||||
child: FormBuilderDropdown(
|
||||
name: "log_level",
|
||||
decoration: const InputDecoration(
|
||||
labelText: "日志级别",
|
||||
icon: Icon(Icons.file_present_rounded),
|
||||
),
|
||||
items: const [
|
||||
DropdownMenuItem(
|
||||
value: "debug", child: Text("DEBUG")),
|
||||
DropdownMenuItem(value: "info", child: Text("INFO")),
|
||||
DropdownMenuItem(
|
||||
value: "warn", child: Text("WARNNING")),
|
||||
DropdownMenuItem(
|
||||
value: "error", child: Text("ERROR")),
|
||||
],
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 28.0),
|
||||
child: ElevatedButton(
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Text("保存"),
|
||||
),
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.saveAndValidate()) {
|
||||
var values = _formKey.currentState!.value;
|
||||
var f = ref
|
||||
.read(settingProvider.notifier)
|
||||
.updateSettings(GeneralSetting(
|
||||
tmdbApiKey: values["tmdb_api"],
|
||||
downloadDIr: values["download_dir"],
|
||||
logLevel: values["log_level"]));
|
||||
f.then((v) {
|
||||
Utils.showSnakeBar("更新成功");
|
||||
}).onError((e, s) {
|
||||
Utils.showSnakeBar("更新失败:$e");
|
||||
});
|
||||
}
|
||||
}),
|
||||
),
|
||||
)
|
||||
],
|
||||
return FormBuilder(
|
||||
key: _formKey, //设置globalKey,用于后面获取FormState
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
initialValue: {
|
||||
"tmdb_api": v.tmdbApiKey,
|
||||
"download_dir": v.downloadDIr,
|
||||
"log_level": v.logLevel
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
FormBuilderTextField(
|
||||
name: "tmdb_api",
|
||||
autofocus: true,
|
||||
decoration: Commons.requiredTextFieldStyle(
|
||||
text: "TMDB Api Key", icon: const Icon(Icons.key)),
|
||||
//
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
));
|
||||
FormBuilderTextField(
|
||||
name: "download_dir",
|
||||
autofocus: true,
|
||||
decoration: Commons.requiredTextFieldStyle(
|
||||
text: "下载路径", icon: const Icon(Icons.folder)),
|
||||
//
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
SizedBox(
|
||||
width: 300,
|
||||
child: FormBuilderDropdown(
|
||||
name: "log_level",
|
||||
decoration: const InputDecoration(
|
||||
labelText: "日志级别",
|
||||
icon: Icon(Icons.file_present_rounded),
|
||||
),
|
||||
items: const [
|
||||
DropdownMenuItem(
|
||||
value: "debug", child: Text("DEBUG")),
|
||||
DropdownMenuItem(value: "info", child: Text("INFO")),
|
||||
DropdownMenuItem(
|
||||
value: "warn", child: Text("WARNING")),
|
||||
DropdownMenuItem(
|
||||
value: "error", child: Text("ERROR")),
|
||||
],
|
||||
validator: FormBuilderValidators.required(),
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 28.0),
|
||||
child: ElevatedButton(
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Text("保存"),
|
||||
),
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.saveAndValidate()) {
|
||||
var values = _formKey.currentState!.value;
|
||||
var f = ref
|
||||
.read(settingProvider.notifier)
|
||||
.updateSettings(GeneralSetting(
|
||||
tmdbApiKey: values["tmdb_api"],
|
||||
downloadDIr: values["download_dir"],
|
||||
logLevel: values["log_level"]));
|
||||
f.then((v) {
|
||||
Utils.showSnakeBar("更新成功");
|
||||
}).onError((e, s) {
|
||||
Utils.showSnakeBar("更新失败:$e");
|
||||
});
|
||||
}
|
||||
}),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
error: (err, trace) => Text("$err"),
|
||||
loading: () => const MyProgressIndicator());
|
||||
@@ -247,39 +245,34 @@ class _SystemSettingsPageState extends ConsumerState<SystemSettingsPage> {
|
||||
children: [
|
||||
ExpansionTile(
|
||||
expandedAlignment: Alignment.centerLeft,
|
||||
tilePadding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
|
||||
childrenPadding: const EdgeInsets.fromLTRB(50, 0, 50, 0),
|
||||
childrenPadding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
|
||||
initiallyExpanded: true,
|
||||
title: const Text("常规设置"),
|
||||
children: [tmdbSetting],
|
||||
),
|
||||
ExpansionTile(
|
||||
expandedAlignment: Alignment.centerLeft,
|
||||
tilePadding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
|
||||
childrenPadding: const EdgeInsets.fromLTRB(50, 0, 50, 0),
|
||||
childrenPadding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
|
||||
initiallyExpanded: false,
|
||||
title: const Text("索引器设置"),
|
||||
children: [indexerSetting],
|
||||
),
|
||||
ExpansionTile(
|
||||
expandedAlignment: Alignment.centerLeft,
|
||||
tilePadding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
|
||||
childrenPadding: const EdgeInsets.fromLTRB(50, 0, 50, 0),
|
||||
childrenPadding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
|
||||
initiallyExpanded: false,
|
||||
title: const Text("下载器设置"),
|
||||
children: [downloadSetting],
|
||||
),
|
||||
ExpansionTile(
|
||||
expandedAlignment: Alignment.centerLeft,
|
||||
tilePadding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
|
||||
childrenPadding: const EdgeInsets.fromLTRB(50, 0, 50, 0),
|
||||
childrenPadding: const EdgeInsets.fromLTRB(20, 0, 50, 0),
|
||||
initiallyExpanded: false,
|
||||
title: const Text("存储设置"),
|
||||
children: [storageSetting],
|
||||
),
|
||||
ExpansionTile(
|
||||
tilePadding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
|
||||
childrenPadding: const EdgeInsets.fromLTRB(50, 0, 50, 0),
|
||||
childrenPadding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
|
||||
initiallyExpanded: false,
|
||||
title: const Text("认证设置"),
|
||||
children: [authSetting],
|
||||
@@ -341,7 +334,7 @@ class _SystemSettingsPageState extends ConsumerState<SystemSettingsPage> {
|
||||
url: values["url"],
|
||||
apiKey: values["api_key"]));
|
||||
} else {
|
||||
throw "数据校验失败";
|
||||
throw "validation_error";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,7 +442,7 @@ class _SystemSettingsPageState extends ConsumerState<SystemSettingsPage> {
|
||||
user: _enableAuth ? values["user"] : null,
|
||||
password: _enableAuth ? values["password"] : null));
|
||||
} else {
|
||||
throw "数据校验不通过";
|
||||
throw "validation_error";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -576,7 +569,7 @@ class _SystemSettingsPageState extends ConsumerState<SystemSettingsPage> {
|
||||
},
|
||||
));
|
||||
} else {
|
||||
throw "数据校验位未通过";
|
||||
throw "validation_error";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -629,7 +622,9 @@ class _SystemSettingsPageState extends ConsumerState<SystemSettingsPage> {
|
||||
Utils.showSnakeBar("操作成功");
|
||||
Navigator.of(context).pop();
|
||||
}).onError((e, s) {
|
||||
Utils.showSnakeBar("操作失败:$e");
|
||||
if (e.toString() != "validation_error") {
|
||||
Utils.showSnakeBar("操作失败:$e");
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:ui/providers/APIs.dart';
|
||||
|
||||
import 'package:ui/providers/settings.dart';
|
||||
import 'package:ui/utils.dart';
|
||||
import 'package:ui/widgets/progress_indicator.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
@@ -45,7 +46,7 @@ class _SystemPageState extends ConsumerState<SystemPage> {
|
||||
|
||||
return DataRow(cells: [
|
||||
DataCell(Text(item.name ?? "")),
|
||||
DataCell(Text("${item.size ?? 0}")),
|
||||
DataCell(Text((item.size??0).readableFileSize())),
|
||||
DataCell(InkWell(
|
||||
child: Icon(Icons.download),
|
||||
onTap: () => launchUrl(uri,
|
||||
|
||||
@@ -34,5 +34,25 @@
|
||||
</head>
|
||||
<body>
|
||||
<script src="flutter_bootstrap.js" async></script>
|
||||
<script>
|
||||
if (
|
||||
navigator.userAgent.indexOf("Safari") !== -1 &&
|
||||
navigator.userAgent.indexOf("Chrome") === -1
|
||||
) {
|
||||
var originalGetContext = HTMLCanvasElement.prototype.getContext;
|
||||
HTMLCanvasElement.prototype.getContext = function () {
|
||||
var contextType = arguments[0];
|
||||
if (contextType === "webgl2") {
|
||||
return;
|
||||
}
|
||||
return originalGetContext.apply(
|
||||
this,
|
||||
[contextType].concat(Array.prototype.slice.call(arguments, 1)),
|
||||
);
|
||||
};
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||