mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-08-28 19:47:41 +08:00
feat: 支持使用永久令牌进行认证
This commit is contained in:
@@ -70,10 +70,13 @@ class Alist(StorageBase, metaclass=Singleton):
|
|||||||
@cached(maxsize=1, ttl=60 * 60 * 24 * 2 - 60 * 5)
|
@cached(maxsize=1, ttl=60 * 60 * 24 * 2 - 60 * 5)
|
||||||
def __generate_token(self) -> str:
|
def __generate_token(self) -> str:
|
||||||
"""
|
"""
|
||||||
使用账号密码生成一个临时token
|
如果设置永久令牌则返回永久令牌,否则使用账号密码生成一个临时 token
|
||||||
缓存2天,提前5分钟更新
|
缓存2天,提前5分钟更新
|
||||||
"""
|
"""
|
||||||
conf = self.get_conf()
|
conf = self.get_conf()
|
||||||
|
token = conf.get("token")
|
||||||
|
if token:
|
||||||
|
return str(token)
|
||||||
resp: Response = RequestUtils(headers={
|
resp: Response = RequestUtils(headers={
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
}).post_res(
|
}).post_res(
|
||||||
|
|||||||
Reference in New Issue
Block a user