Skip to content

issue611的实现:a custom bearer token for http , WebUI - #614

Merged
AAswordman merged 3 commits into
AAswordman:mainfrom
tuxKOH:main
Jun 19, 2026
Merged

issue611的实现:a custom bearer token for http , WebUI#614
AAswordman merged 3 commits into
AAswordman:mainfrom
tuxKOH:main

Conversation

@tuxKOH

@tuxKOH tuxKOH commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

详情见 #611
编译成功 见下图效果:

Screenshot_20260616_193528 Screenshot_20260616_193534

@tuxKOH

tuxKOH commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator Author

那啥 我加了点料 大概就是移除了一堆硬编码的包名 然后我忘记跟这个pr独立开来了 所以你一起审吧awa

@tuxKOH

tuxKOH commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator Author

移除硬编码包名,新增builder type:Clone
新增指向Clone的task:CloneDebug
更改文档:说明运行assembleaCloneDebug可编译共存版
修复文档:漏了一些jdk17

最终效果:
Screenshot_20260616-211143_ASUS_Launcher

@luojiaping

Copy link
Copy Markdown
Collaborator

以下是个人的几点改进建议:

1. setBearerToken 缺少防御性校验

当前实现直接存入任意字符串:

suspend fun setBearerToken(token: String) {
    context.externalHttpApiDataStore.edit { preferences ->
        preferences[KEY_BEARER_TOKEN] = token
    }
}

建议:

  • token.trim() 去除首尾空白
  • 设置长度下限(≥ 8)和上限(≤ 128)
  • 禁止空白字符、换行、控制字符(it.isWhitespace() || it.isISOControl()
  • 外部 HTTP 服务监听 0.0.0.0,局域网内可访问,弱 Token 风险较高
suspend fun setBearerToken(customToken: String): String {
    val normalizedToken = customToken.trim()
    require(normalizedToken.length in 8..128) { ... }
    require(normalizedToken.none { it.isWhitespace() || it.isISOControl() }) { ... }
    context.externalHttpApiDataStore.edit { ... }
    return normalizedToken
}

2. UI 字符串硬编码中文

showToast("Token长度需大于6!")
showToast("Token 已保存")
Text("保存")

项目支持多语言(values-en、values-ko、values-es 等),建议改用 stringResource(R.string.xxx) 并在 strings.xml 中添加对应条目,否则非中文用户无法理解提示信息。

3. 最小长度 6 偏短

mytoken(7 位)和 123456(6 位)都在 issue 原文示例中,但对一个暴露在局域网的 HTTP 认证接口来说太弱了。建议 8 位起

4. 小建议

  • 输入框可以加 placeholder 提示格式要求(如 "请输入 8-128 位 Bearer Token")
  • external_http_chat_token_desc 的描述文案也应同步更新,告知用户现在可以手动设置

@tuxKOH

tuxKOH commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

以下是个人的几点改进建议:

1. setBearerToken 缺少防御性校验

当前实现直接存入任意字符串:

suspend fun setBearerToken(token: String) {
    context.externalHttpApiDataStore.edit { preferences ->
        preferences[KEY_BEARER_TOKEN] = token
    }
}

建议:

  • token.trim() 去除首尾空白
  • 设置长度下限(≥ 8)和上限(≤ 128)
  • 禁止空白字符、换行、控制字符(it.isWhitespace() || it.isISOControl()
  • 外部 HTTP 服务监听 0.0.0.0,局域网内可访问,弱 Token 风险较高
suspend fun setBearerToken(customToken: String): String {
    val normalizedToken = customToken.trim()
    require(normalizedToken.length in 8..128) { ... }
    require(normalizedToken.none { it.isWhitespace() || it.isISOControl() }) { ... }
    context.externalHttpApiDataStore.edit { ... }
    return normalizedToken
}

2. UI 字符串硬编码中文

showToast("Token长度需大于6!")
showToast("Token 已保存")
Text("保存")

项目支持多语言(values-en、values-ko、values-es 等),建议改用 stringResource(R.string.xxx) 并在 strings.xml 中添加对应条目,否则非中文用户无法理解提示信息。

3. 最小长度 6 偏短

mytoken(7 位)和 123456(6 位)都在 issue 原文示例中,但对一个暴露在局域网的 HTTP 认证接口来说太弱了。建议 8 位起

4. 小建议

  • 输入框可以加 placeholder 提示格式要求(如 "请输入 8-128 位 Bearer Token")
  • external_http_chat_token_desc 的描述文案也应同步更新,告知用户现在可以手动设置

中文硬编码上个commit已改,其他我认为应给用户作死的自由 毕竟设计初衷是“让难记token易记” 我认为有能力下载并折腾op的有责任自己负责自己的密码安全

@luojiaping

Copy link
Copy Markdown
Collaborator

以下是个人的几点改进建议:

1. setBearerToken 缺少防御性校验

当前实现直接存入任意字符串:

suspend fun setBearerToken(token: String) {
    context.externalHttpApiDataStore.edit { preferences ->
        preferences[KEY_BEARER_TOKEN] = token
    }
}

建议:

  • token.trim() 去除首尾空白
  • 设置长度下限(≥ 8)和上限(≤ 128)
  • 禁止空白字符、换行、控制字符(it.isWhitespace() || it.isISOControl()
  • 外部 HTTP 服务监听 0.0.0.0,局域网内可访问,弱 Token 风险较高
suspend fun setBearerToken(customToken: String): String {
    val normalizedToken = customToken.trim()
    require(normalizedToken.length in 8..128) { ... }
    require(normalizedToken.none { it.isWhitespace() || it.isISOControl() }) { ... }
    context.externalHttpApiDataStore.edit { ... }
    return normalizedToken
}

2. UI 字符串硬编码中文

showToast("Token长度需大于6!")
showToast("Token 已保存")
Text("保存")

项目支持多语言(values-en、values-ko、values-es 等),建议改用 stringResource(R.string.xxx) 并在 strings.xml 中添加对应条目,否则非中文用户无法理解提示信息。

3. 最小长度 6 偏短

mytoken(7 位)和 123456(6 位)都在 issue 原文示例中,但对一个暴露在局域网的 HTTP 认证接口来说太弱了。建议 8 位起

4. 小建议

  • 输入框可以加 placeholder 提示格式要求(如 "请输入 8-128 位 Bearer Token")
  • external_http_chat_token_desc 的描述文案也应同步更新,告知用户现在可以手动设置

中文硬编码上个commit已改,其他我认为应给用户作死的自由 毕竟设计初衷是“让难记token易记” 我认为有能力下载并折腾op的有责任自己负责自己的密码安全

我还是决得从工程常识和长期维护的角度来说,加个校验也就几行代码的事,利大于弊

@AAswordman
AAswordman merged commit d3f5006 into AAswordman:main Jun 19, 2026
929411354 added a commit to 929411354/Operit that referenced this pull request Jul 2, 2026
* Fix cloud embedding endpoint validation

* feat: add tool hook interception and localize AI message strings

* feat: save long MCP results to files and improve chat scroll navigation error handling

* fix: 修复DashScope兼容模式音频识别400错误

DashScope兼容模式的input_audio.data字段要求URL格式,不接受裸base64。
对ALIYUN provider将base64包装为data URL格式,其他provider不变。

Fixes AAswordman#600

* update submodule

* 文档改变for编译兼容性 (AAswordman#606)

* jdk update to 21, and some compatibility update in MCPToolExecutor.kt

* oops, i wrote it to false.

* feat: add group orchestration mode and timestamp-based chat history loading

* Issue AAswordman#602 的实现 (AAswordman#610)

* jdk update to 21, and some compatibility update in MCPToolExecutor.kt

* oops, i wrote it to false.

* Done :D, you can now custom the prompt for concluding

* update

* issue611的实现:a custom bearer token for http , WebUI (AAswordman#614)

* a custom bearer token for http , WebUI

* added build type:clone , and a task that is linking to it (DebugClone) , and remove mannnny of hardcoded-path of package name

* for got to add english support in some place.

* update

* feat: add crash-repair recovery flow and startup isolation

Add repair-mode recovery UI, isolate main startup from utility entries, and refresh related tool and example assets.

* fix that the custom concluding isnt auto saving

* 移除硬编码的默认 DeepSeek API Key

- 删除 ApiPreferences 中的 ENCODED_API_KEY、DEFAULT_API_KEY 和 decodeApiKey
- 默认配置 apiKey 改为空字符串
- 所有 DEFAULT_API_KEY 引用改为 isBlank() 判断
- 清理不再使用的 ApiPreferences import

* 移除重复的"未"

* fix: 工具选择弹窗显示工具描述,帮助管理员理解工具用途 (AAswordman#645)

Co-authored-by: luojiaping <luojiaping@users.noreply.github.com>

* update market

* fix: prevent process limit button text overflow

* Fix model provider display name

* new market

* feat: deduplicate attachment file names and refactor attachment state management

* market fix

* 1.12.0

* 1.12.0

* feat(brand): rebrand app to Engie Claw with original warm ember theme

- Rename app_name to "Engie Claw" across all locales
- Add original Engie Claw brand palette (ember/clay/olive), replacing default Material purple
- Disable Material You dynamic color so the brand identity stays consistent
- Update share-image brand bar to Engie Claw

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* feat(brand): show Engie Claw as sidebar software identity name

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* feat(theme): original Engie Claw type scale + architectural shape language

- Distinctive editorial type scale (heavy, tight-tracked headings) app-wide
- New EngieClawShapes corner language wired into MaterialTheme
- Floating window theme now defaults to the brand palette/shapes

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* feat(theme): apply Engie Claw brand colors to base XML app theme

- Add ember/clay/olive brand color resources
- Repoint Theme.Operit (light + night) primary/secondary from purple/teal to brand colors (affects splash/window background, status bar, View-based components)

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* feat(chat): crisper original bubble corners aligned with brand shape language

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: HengdianZou <hd18512614931@gmail.com>
Co-authored-by: AAswordsman <66207760+AAswordman@users.noreply.github.com>
Co-authored-by: AAswordman <1002153674@qq.com>
Co-authored-by: luojiaping <luojiaping@users.noreply.github.com>
Co-authored-by: tuxKOH <yumicheng14@gmail.com>
Co-authored-by: luojiaping <75722052+luojiaping@users.noreply.github.com>
Co-authored-by: exepc666 <929411354@qq.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants