Repository: AlistGo/alist (language: go)

Issue:
onedrive添加流程建议
### Please make sure of the following things

- [X] I have read the [documentation](https://alist-doc.nn.ci).
- [X] I'm sure there are no duplicate issues or discussions.
- [X] I'm sure this feature is not implemented.
- [X] I'm sure it's a reasonable and popular requirement.

### Description of the feature / 需求描述

感觉onedrive的添加有点麻烦，而且存在一定不稳定性
建议：

- 重定向uri处直接填好
- 刷新令牌可以直接根据填写的客户端ID和机密获取
- 国际版是可以一键创建客户端id和机密的，可以参考onindex

### Suggested solution / 实现思路

- 现在uri必须添加https://tool.nn.ci/onedrive/callback，那不如直接默认填好
- 将https://tool.nn.ci/onedrive/request这个功能加在程序里，前面的client_id和client_secret填好后点击按钮获取token，然后直接填好
- 下面的图是我的onlaindex添加帐号的页面，可以参考一下这个申请功能

### Additional context / 附件

![Screenshot_2022-04-18-21-24-32-200_com android chrome](https://user-images.githubusercontent.com/40017293/163814662-2fa77055-efb3-4397-be9e-a8fab4bf13ad.jpg)


Discussion / hints:

Fix patch:
diff --git a/.gitignore b/.gitignore
index ffbe096bf0d..576dca8b4f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,6 +22,7 @@ dist/
 # vendor/
 bin/*
 /alist
+/alist.exe
 *.json
 public/*.html
 public/assets/
diff --git a/LICENSE b/LICENSE
index 29ebfa545f5..0ad25db4bd1 100644
--- a/LICENSE
+++ b/LICENSE
@@ -658,4 +658,4 @@ specific requirements.
   You should also get your employer (if you work as a programmer) or school,
 if any, to sign a "copyright disclaimer" for the program, if necessary.
 For more information on this, and how to apply and follow the GNU AGPL, see
-<https://www.gnu.org/licenses/>.
\ No newline at end of file
+<https://www.gnu.org/licenses/>.
diff --git a/README.md b/README.md
index f4235c97f9f..5790c1f4feb 100755
--- a/README.md
+++ b/README.md
@@ -87,4 +87,4 @@ The `AList` is open-source software licensed under the AGPL-3.0 license.
 
 ---
 
-> [@Blog](https://nn.ci/) · [@GitHub](https://github.com/Xhofe) · [@TelegramGroup](https://t.me/alist_chat) · [@QQGroup](https://jq.qq.com/?_wv=1027&k=OVPJcv2b)
\ No newline at end of file
+> [@Blog](https://nn.ci/) · [@GitHub](https://github.com/Xhofe) · [@TelegramGroup](https://t.me/alist_chat) · [@QQGroup](https://jq.qq.com/?_wv=1027&k=YJJj2Gwb)
\ No newline at end of file
diff --git a/README_cn.md b/README_cn.md
index 0f53d36685a..69e8300e862 100644
--- a/README_cn.md
+++ b/README_cn.md
@@ -87,4 +87,4 @@
 
 ---
 
-> [@Blog](https://nn.ci/) · [@GitHub](https://github.com/Xhofe) · [@TelegramGroup](https://t.me/alist_chat) · [@QQGroup](https://jq.qq.com/?_wv=1027&k=OVPJcv2b)
\ No newline at end of file
+> [@博客](https://nn.ci/) · [@GitHub](https://github.com/Xhofe) · [@Telegram群](https://t.me/alist_chat) · [@QQ群](https://jq.qq.com/?_wv=1027&k=YJJj2Gwb)
\ No newline at end of file
diff --git a/alist.go b/alist.go
index 9ad4601fc7f..84514efa75e 100644
--- a/alist.go
+++ b/alist.go
@@ -12,7 +12,6 @@ import (
 )
 
 func Init() bool {
-	//bootstrap.InitLog()
 	bootstrap.InitConf()
 	bootstrap.InitCron()
 	bootstrap.InitModel()
diff --git a/drivers/189pc/189.go b/drivers/189pc/189.go
index a22f51be543..b6f72f6b7ab 100644
--- a/drivers/189pc/189.go
+++ b/drivers/189pc/189.go
@@ -291,6 +291,13 @@ func (s *State) Request(method string, fullUrl string, params Params, callback f
 		return nil, fmt.Errorf(erron.Msg)
 	}
 	if erron.ErrorCode != "" {
+		switch erron.ErrorCode {
+		case "InvalidSessionKey":
+			if err := s.RefreshSession(account); err != nil {
+				return nil, err
+			}
+			return s.Request(method, fullUrl, params, callback, account)
+		}
 		return nil, fmt.Errorf(erron.ErrorMsg)
 	}
 
diff --git a/drivers/onedrive/driver.go b/drivers/onedrive/driver.go
index dc498d64bd8..09297293860 100644
--- a/drivers/onedrive/driver.go
+++ b/drivers/onedrive/driver.go
@@ -53,6 +53,7 @@ func (driver Onedrive) Items() []base.Item {
 			Label:    "redirect uri",
 			Type:     base.TypeString,
 			Required: true,
+			Default:  "https://tool.nn.ci/onedrive/callback",
 		},
 		{
 			Name:     "refresh_token",
diff --git a/drivers/xunlei/xunlei.go b/drivers/xunlei/xunlei.go
index 89440da0e7a..2e9d4c23040 100644
--- a/drivers/xunlei/xunlei.go
+++ b/drivers/xunlei/xunlei.go
@@ -245,12 +245,18 @@ func (s *State) Request(method string, url string, callback func(*resty.Request)
 	log.Debug(res.String())
 
 	var e Erron
-	utils.Json.Unmarshal(res.Body(), &e)
+	err = utils.Json.Unmarshal(res.Body(), &e)
+	if err != nil {
+		return nil, err
+	}
 	switch e.ErrorCode {
 	case 9:
-		s.newCaptchaToken(getAction(method, url), nil, account)
+		_, err = s.newCaptchaToken(getAction(method, url), nil, account)
+		if err != nil {
+			return nil, err
+		}
 		fallthrough
-	case 4122, 4121:
+	case 4122, 4121: // Authorization expired
 		return s.Request(method, url, callback, account)
 	case 0:
 		if res.StatusCode() == http.StatusOK {
diff --git a/public/public.go b/public/public.go
index ff72043edf7..46319777695 100644
--- a/public/public.go
+++ b/public/public.go
@@ -4,9 +4,3 @@ import "embed"
 
 //go:embed *
 var Public embed.FS
-
-////go:embed index.html
-//var Index embed.FS
-//
-////go:embed assets/**
-//var Assets embed.FS


Test patch: