Skip to content

Commit

Permalink
Merge branch 'release/0.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
RayWangQvQ committed Dec 14, 2022
2 parents 91c7c7c + 4f117a9 commit 36f4ea1
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -367,4 +367,4 @@ bilipro
kustomization.yaml

# cookie config
cookies.json
**/Ray.BiliBiliTool.Console/cookies.json
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,7 @@
- Fix( #260 ),在需要的时候encode cookie
- 更新文档
## 0.3.2
- Fix( #358 ),获取auth时兼容老板青龙文件路径
- Fix( #364 ),兼容青龙异性response数据类型
- Fix( #358 ),获取auth时兼容老版青龙文件路径
- Fix( #364 ),兼容青龙异形response数据类型
- Fix( #366 #361 ),修复一些低级bug
- Feature( #359 ),兼容读取不到`$QL_DIR`的情况
4 changes: 4 additions & 0 deletions docker/sample/cookies.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"BiliBiliCookies": [
],
}
2 changes: 1 addition & 1 deletion qinglong/DefaultTasks/bili_task_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# new Env("bili_base")
# cron 0 0 1 1 * bili_base.sh

dir_shell=$QL_DIR/shell
dir_shell=${QL_DIR-'/ql'}/shell
. $dir_shell/share.sh

## 安装dotnet
Expand Down
2 changes: 1 addition & 1 deletion qinglong/DefaultTasks/dev/bili_dev_task_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# new Env("bili_dev_task_base")
# cron 0 0 1 1 * bili_dev_task_base.sh

dir_shell=$QL_DIR/shell
dir_shell=${QL_DIR-'/ql'}/shell
. $dir_shell/share.sh

## 安装dotnet
Expand Down
20 changes: 12 additions & 8 deletions src/Ray.BiliBiliTool.Application/LoginTaskAppService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ protected void AddOrUpdateCkToQingLong(BiliCookie ckInfo)
return;
}

var list = re.Data.Where(x=>x.name.StartsWith("Ray_BiliBiliCookies__"));
var list = re.Data.Where(x => x.name.StartsWith("Ray_BiliBiliCookies__")).ToList();
QingLongEnv oldEnv = list.FirstOrDefault(x => x.value.Contains(ckInfo.UserId));

if (oldEnv != null)
Expand All @@ -245,13 +245,17 @@ protected void AddOrUpdateCkToQingLong(BiliCookie ckInfo)
}

_logger.LogInformation("用户不存在,新增cookie");
var lastNum = list.Select(x =>
var maxNum = -1;
if (list.Any())
{
var num = x.name.Replace("Ray_BiliBiliCookies__","");
var parseSuc= int.TryParse(num, out int envNum);
return parseSuc ? envNum : 0;
}).MaxBy(x=>x);
var name = $"Ray_BiliBiliCookies__{lastNum + 1}";
maxNum = list.Select(x =>
{
var num = x.name.Replace("Ray_BiliBiliCookies__", "");
var parseSuc = int.TryParse(num, out int envNum);
return parseSuc ? envNum : 0;
}).Max();
}
var name = $"Ray_BiliBiliCookies__{maxNum + 1}";
_logger.LogInformation("Key:{key}", name);

var add = new AddQingLongEnv()
Expand Down Expand Up @@ -378,7 +382,7 @@ private bool GetToken(out string token)

var qlDir = _configuration["QL_DIR"] ?? "/ql";

string authFile= qlDir;
string authFile = qlDir;
if (_hostingEnvironment.ContentRootPath.Contains($"{qlDir}/data/"))
{
authFile = Path.Combine(authFile, "data");
Expand Down

0 comments on commit 36f4ea1

Please sign in to comment.