Repository navigation
Commit 86ffd90
Fastace
feat(cloud): 新增华为云 OBS 云存储后端并统一新增账户与发布行为
与既有 S3(腾讯云 COS)/AWSS3/ALIYUNOSS 链路同构,新增 CloudType.HUAWEIOBS 云类型,打通
「添加账户 → 目录浏览 → restic 仓库备份/恢复」全流程。目录浏览与 rustic 仓库访问统一走
opendal 的 obs scheme;同时收敛一批一致性问题:新增账户不再回填历史 restic 初始化密码、
去掉不适用于移动端的 VPC/内网 endpoint 说明、修复英文下增量胶囊把数值挤成省略号,
以及 JNI 工作流的 Version Name 与 Release Type 联动。
一、数据模型(core/model)
- CloudType 新增 HUAWEIOBS("Huawei Cloud OBS")
- 新增 HuaweiObsExtra:accessKeyId / secretAccessKey / bucket / endpoint / protocol /
resticPassword,配套新增 HuaweiObsProtocol(HTTP, HTTPS)。华为云没有独立 region 配置,
地域由 endpoint 表达;密钥字段名沿用华为云官方命名 secretAccessKey,与 OSS 的
accessKeySecret 区分
- CloudEntity 沿用既有承载方式:host=bucket、user=AccessKeyId、pass=SecretAccessKey,
完整配置以 extra 保存
二、网络层(core/network)
- 新增 HuaweiObsClientImpl,实现 CloudClient,scheme 为 "obs"
- buildOpendalOptions() 产出 bucket/root/endpoint/access_key_id/secret_access_key 五键,
与 rustic 仓库侧使用同一套键,避免两处语义漂移
- buildOpendalEndpoint() 一律剥离 http(s):// 前缀:opendal 的 OBS builder 会自行拼
https://{bucket}.{endpoint},带 scheme 下发会拼出非法节点(与 OSS 的"按所选协议补全"
行为相反);protocol 字段仅参与界面完整地址预览
- 列目录/建目录经 RemoteRootService.opendalList / opendalCreateDir;testConnection 以
成功列举根路径为连通判据
三、restic 仓库层(core/restic)
- 新增 ResticRepositoryHuaweiObs:backendUrl 为 opendal:obs,root 走
shared.formatOpenDALRoot(remotePath),其余四键与目录浏览一致
- CloudResticBackendModule 新增 @BINDS @Intomap @CloudTypeKey(CloudType.HUAWEIOBS)
绑定,注册方式与 AWSS3/COS/OSS 相同
- BackupServiceCloudImpl 的 restic 备份分支加入 CloudType.HUAWEIOBS
四、UI / 路由 / 文案
- Routes 新增 MainRoutes.HuaweiObsSetup;MainActivity 的 NavHost 注册
PageHuaweiObsSetup;云列表跳转与「添加账户」入口按 HUAWEIOBS 分发
- ModelUtil 为 CloudType.HUAWEIOBS 指定 Storage 图标
- 新增 HuaweiObsSetup 引导页:Access Key Id(AK) / Secret Access Key(SK) / Bucket /
Endpoint(含填写说明与完整访问地址预览)/ 协议分段按钮 / 仓库路径与密码 / 连接测试 /
仓库初始化,配套新增 HuaweiObsResticViewModel
- IndexViewModel 新增 buildHuaweiObsCloudEntity 与 updateHuaweiObsEntity
- feature:main:cloud 的 values 与 values-zh-rCN 同步补齐双语文案:
cloud_type_huawei_obs / huawei_obs_setup / huawei_obs_access_key_id /
huawei_obs_access_key_secret / huawei_obs_endpoint / huawei_obs_endpoint_example /
huawei_obs_url_preview
五、新增账户不再回填历史 restic 初始化密码(fix)
- AliyunOssResticViewModel / HuaweiObsResticViewModel 删除 init 中读取全局 datastore
(readXxxResticPassword / readXxxResticInitialized / readXxxResticRepoPath)并预填
密码框、直接置 Success 的逻辑
- 两者此前会把密码 StateFlow 回写输入框,导致新增账户一进来就带着上一个账户的初始化
密码,与 AWS S3 / COS 表现不一致;删除后新增一律为空 + Idle 状态,必须重新输入并初始化
- 编辑既有账户仍由 restoreStateFromEntity() 从 CloudEntity.extra.resticPassword 恢复,
老账户无需重输;initialize 成功时的 save* 保留,供 restic 侧 resolveResticPassword 兜底
六、文案与可读性问题修复
- aliyun_oss_endpoint_example / huawei_obs_endpoint_example(en + zh)删除 ECS 的
VPC/内网地址相关说明——移动端不走内网,保留反而误导填写
- core/ui 的 increment 英文由 Incremental(11 字符) 改为 Added(5):语义仍是去重后
实际新增写入的数据量,并与 Total/Speed/Dedup 三个胶囊宽度对齐
- core/ui Card.kt 的 ProgressStatChip 给标签加 Modifier.weight(1f, fill = false):
空间不足时先牺牲标签自身省略,右侧数值永远完整显示,不再出现被截断的大小
七、偏好存储(core/datastore)与 native
- 新增 huawei_obs_restic_repo_path / huawei_obs_restic_password /
huawei_obs_restic_initialized 三个键及其 save/read 扩展函数,与既有云类型保持一致
- source/native/.../rustic/rustic/Cargo.toml 的 opendal features 追加 services-obs
(目录浏览所需;与 rustic_backend 复用同一 opendal 版本以合并特性)
八、文档
- README.md 与 README_en.md 的云存储协议支持表:Aliyun OSS / HuaWei OBS 由
「待实现 / WIP」改为「已完成 / done」,并删除表格下方"逐步适配中,敬请期待"的引用块
九、CI:JNI 构建脚本 Version Name 与 Release Type 联动
- .github/workflows/build-jni.yaml 的 job env 新增 BASE_VERSION_NAME: '3.0.1-Rustic-JNI'
- Calculate Dynamic Version 改为"手动值优先 + 按 release_type 兜底":version_name 留空时
release → 3.0.1-Rustic-JNI、pre-release → 3.0.1-Rustic-JNI-Pre;输入框带 trim,避免
误填空格被判定为手动值
- 不再 grep gradle/libs.versions.toml 兜底(该值为本地用的 3.0.1-Rustic-JNI-Local,
不适合作为发布版本名);构建注入与 tag 链路沿用既有输出,未改动
验证
- :feature:main:cloud、:core:service、:core:restic、:core:network、:core:ui、
:feature:main:processing 的 compileDebugKotlin 与 :feature:main:cloud 的
processDebugResources 全部 BUILD SUCCESSFUL
- :app:compileArm64-v8aFossDebugKotlin 通过,含 app 级 Hilt/KSP 全图校验
- .github/workflows/build-jni.yaml 改动仅涉及输入描述、job env 与 shell 判定块,
未改动既有 task/tag 表达式1 parent 4c49b22 commit 86ffd90
25 files changed
Lines changed: 1212 additions & 33 deletions
File tree
- .github/workflows
- source
- app/src/main/kotlin/com/xayah/databackup
- core
- datastore/src/main/kotlin/com/xayah/core/datastore
- model/src/main/kotlin/com/xayah/core/model
- database
- network/src/main/kotlin/com/xayah/core/network/client
- restic/src/main/kotlin/com/xayah/core/restic
- di
- service/src/main/kotlin/com/xayah/core/service/medium/backup
- ui/src/main
- kotlin/com/xayah/core/ui
- component
- route
- util
- res/values
- feature/main/cloud/src/main
- kotlin/com/xayah/feature/main/cloud
- add
- res
- values-zh-rCN
- values
- native/src/main/jni/external/rustic/rustic
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
172 | 174 | | |
173 | 175 | | |
174 | 176 | | |
175 | | - | |
176 | | - | |
177 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
178 | 182 | | |
179 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
180 | 190 | | |
181 | 191 | | |
182 | 192 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
| 41 | + | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | 48 | | |
51 | 49 | | |
52 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
| 41 | + | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | 48 | | |
51 | 49 | | |
52 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
199 | 200 | | |
200 | 201 | | |
201 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
202 | 206 | | |
203 | 207 | | |
204 | 208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
40 | 45 | | |
41 | 46 | | |
42 | 47 | | |
| |||
191 | 196 | | |
192 | 197 | | |
193 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
194 | 236 | | |
195 | 237 | | |
196 | 238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
99 | 122 | | |
100 | 123 | | |
101 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
73 | 79 | | |
74 | 80 | | |
75 | 81 | | |
| |||
0 commit comments