Skip to content

Commit afb79d2

Browse files
authored
Merge pull request #941 from RayWangQvQ/develop
Release 3.3.0
2 parents e6fd7db + 52094b1 commit afb79d2

37 files changed

Lines changed: 2088 additions & 54 deletions

.github/workflows/publish-image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
uses: docker/build-push-action@v4
7979
with:
8080
context: .
81-
platforms: linux/amd64,linux/arm64
81+
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7
8282
push: true
8383
tags: |
8484
${{ steps.tags.outputs.dockerTagWithVersion }}

.github/workflows/verify-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
checkTargetBranch:
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: Vankka/pr-target-branch-action@v1.1
10+
- uses: Vankka/pr-target-branch-action@v3
1111
env:
1212
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1313
with:

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 3.3.0
2+
- Feature[#935]: Web 新增登录功能
3+
- Feature[#935]: Web 新增修改密码功能
4+
- Feature: 镜像新增 linux/386 和 linux/arm/v7 架构
5+
- Feature[#935]: 更新文档
6+
- Feature: 更新开源协议为 GNU GPLv3
17
## 3.2.0
28
- Fix: 修复大会员大积分签到任务
39
- Fix: 修复大会员大积分的签到和浏览追番频道任务

LICENSE

Lines changed: 674 additions & 21 deletions
Large diffs are not rendered by default.

common.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<PropertyGroup>
33
<Authors>Ray</Authors>
4-
<Version>3.2.0</Version>
4+
<Version>3.3.0</Version>
55
<NoWarn>$(NoWarn);CS1591;CS0436</NoWarn>
66
</PropertyGroup>
77
</Project>

docker/README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
- [4.1. Docker启动](#41-docker启动)
1111
- [4.2. 其他指令参考](#42-其他指令参考)
1212
- [4.3. 使用Watchtower更新容器](#43-使用watchtower更新容器)
13-
- [5. 登录 Bili](#5-登录-bili)
14-
- [6. 自己构建镜像(非必须)](#6-自己构建镜像非必须)
15-
- [7. 其他](#7-其他)
13+
- [5. 登录](#5-登录)
14+
- [6. 添加 Bili 账号](#6-添加-bili-账号)
15+
- [7. 自己构建镜像(非必须)](#7-自己构建镜像非必须)
16+
- [8. 其他](#8-其他)
1617

1718
<!-- /TOC -->
19+
1820
## 1. 前期工作
1921

2022
```
@@ -130,15 +132,22 @@ docker run --rm \
130132
bili_tool_web
131133
```
132134

133-
## 5. 登录 Bili
135+
## 5. 登录
136+
137+
- 默认用户:`admin`
138+
- 默认密码:`BiliTool@2233`
139+
140+
首次登陆后,请到`Admin`页面修改密码。
141+
142+
## 6. 添加 Bili 账号
134143

135-
扫码进行登录
144+
扫码进行账号添加
136145

137146
![trigger](../docs/imgs/web-trigger-login.png)
138147

139148
![login](../docs/imgs/docker-login.png)
140149

141-
## 6. 自己构建镜像(非必须)
150+
## 7. 自己构建镜像(非必须)
142151

143152
目前我提供和维护的镜像:
144153

@@ -153,7 +162,7 @@ docker run --rm \
153162

154163
`TARGET_NAME`为镜像名称和版本,可以自己起个名字
155164

156-
## 7. 其他
165+
## 8. 其他
157166

158167
代码编译和发布环境: mcr.microsoft.com/dotnet/sdk:8.0
159168

podman/README.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33

44
- [1. 前期工作](#1-前期工作)
55
- [1.1. Podman环境](#11-podman环境)
6-
- [从Docker迁移](#从docker迁移)
6+
- [1.2. 从Docker迁移](#12-从docker迁移)
77
- [2. 运行容器](#2-运行容器)
88
- [2.1. 极简版](#21-极简版)
99
- [2.2. 综合版](#22-综合版)
10-
- [登录](#登录)
11-
- [3. 自己构建镜像(非必须)](#3-自己构建镜像非必须)
12-
- [4. 其他](#4-其他)
10+
- [3. 登录](#3-登录)
11+
- [4. 添加 Bili 账号](#4-添加-bili-账号)
12+
- [5. 自己构建镜像(非必须)](#5-自己构建镜像非必须)
13+
- [6. 其他](#6-其他)
1314

1415
<!-- /TOC -->
1516

@@ -37,7 +38,7 @@ podman machine start
3738
podman info
3839
```
3940

40-
### 从Docker迁移
41+
### 1.2. 从Docker迁移
4142

4243
Podman可以和Docker共存,命令也基本可以通用。
4344

@@ -97,15 +98,22 @@ podman ps -a
9798
podman exec -it bili bash
9899
```
99100

100-
## 登录
101+
## 3. 登录
102+
103+
- 默认用户:`admin`
104+
- 默认密码:`BiliTool@2233`
105+
106+
首次登陆后,请到`Admin`页面修改密码。
107+
108+
## 4. 添加 Bili 账号
101109

102110
扫码进行登录。
103111

104112
![trigger](../docs/imgs/web-trigger-login.png)
105113

106114
![login](../docs/imgs/docker-login.png)
107115

108-
## 3. 自己构建镜像(非必须)
116+
## 5. 自己构建镜像(非必须)
109117

110118
目前我提供和维护的镜像:`[zai7lou/bilibili_tool_web](https://hub.docker.com/repository/docker/zai7lou/bilibili_tool_web)`;
111119

@@ -117,6 +125,6 @@ podman exec -it bili bash
117125

118126
`TARGET_NAME`为镜像名称和版本,可以自己起个名字
119127

120-
## 4. 其他
128+
## 6. 其他
121129

122130
镜像使用的是docker仓库的镜像。
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.ComponentModel.DataAnnotations;
2+
using System.ComponentModel.DataAnnotations.Schema;
3+
4+
namespace Ray.BiliBiliTool.Domain;
5+
6+
[Table("bili_user")]
7+
public class User
8+
{
9+
[Key]
10+
public long Id { get; set; }
11+
public required string Username { get; set; }
12+
public required string PasswordHash { get; set; }
13+
public required string Salt { get; set; }
14+
public List<string> Roles { get; set; } = [];
15+
}

src/Ray.BiliBiliTool.Infrastructure.EF/BiliDbContext.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class BiliDbContext(IConfiguration config) : DbContext
1111
{
1212
public DbSet<ExecutionLog> ExecutionLogs { get; set; }
1313
public DbSet<BiliLogs> BiliLogs { get; set; }
14+
public DbSet<User> Users { get; set; }
1415

1516
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
1617
{
@@ -69,6 +70,22 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
6970
.HasIndex(x => x.FireInstanceIdComputed) // 在计算列上创建索引
7071
.HasDatabaseName("IX_Logs_FireInstanceIdComputed");
7172
});
73+
74+
modelBuilder.Entity<User>(entity =>
75+
{
76+
entity.HasKey(e => e.Id);
77+
entity.Property(e => e.Username).IsRequired().HasMaxLength(50);
78+
entity.Property(e => e.PasswordHash).IsRequired();
79+
entity.Property(e => e.Salt).IsRequired();
80+
entity
81+
.Property(e => e.Roles)
82+
.HasConversion(
83+
v => string.Join(',', v),
84+
v => v.Split(',', StringSplitOptions.RemoveEmptyEntries).ToList()
85+
);
86+
87+
entity.HasIndex(e => e.Username).IsUnique();
88+
});
7289
}
7390

7491
private void AddSqliteDateTimeOffsetSupport(ModelBuilder builder)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using Microsoft.EntityFrameworkCore;
2+
using Ray.BiliBiliTool.Domain;
3+
using Ray.BiliBiliTool.Infrastructure.Helpers;
4+
5+
namespace Ray.BiliBiliTool.Infrastructure.EF;
6+
7+
public class DbInitializer(BiliDbContext context)
8+
{
9+
private const string DefaultUserName = "admin";
10+
private const string DefaultPassword = "BiliTool@2233";
11+
12+
public async Task InitializeAsync()
13+
{
14+
await context.Database.MigrateAsync();
15+
16+
await InitUserAsync();
17+
}
18+
19+
private async Task InitUserAsync()
20+
{
21+
if (await context.Users.AnyAsync())
22+
{
23+
return;
24+
}
25+
26+
var (hash, salt) = PasswordHelper.HashPassword(DefaultPassword);
27+
var adminUser = new User
28+
{
29+
Username = DefaultUserName,
30+
PasswordHash = hash,
31+
Salt = salt,
32+
Roles = ["Administrator"],
33+
};
34+
35+
context.Users.Add(adminUser);
36+
await context.SaveChangesAsync();
37+
}
38+
}

0 commit comments

Comments
 (0)