ocngx / README-OCNGX.md
tanbushi's picture
update
6fbd168
|
Raw
History Blame
1.19 kB

项目功能

你可以设置密码,安全访问在 huggingface 上部署的 opencode,你可以有两种方式访问,web 模式和 api 模式,两种操作的内容相同 session 的会话,内容是一致的

访问

假设你的 huggingface 的 profile 用变量 {profile} 表示,则访问地址为: https://{profile}-ocngx.hf.space

我的演示项目的地址为:https://airsltd-ocngx.hf.space

访问后,需要用户名密码,请填入环境变量里你设置的用户和密码 环境变量为: USERNAME PASSWORD

http 访问 Basic 认证算法

用户名: tbs 密码: tbs123

Basic认证字符串:dGJzOnRiczEyMw== HTTP请求头格式:Authorization: Basic dGJzOnRiczEyMw==

Python:

import base64

credentials = "tbs:tbs123"
encoded = base64.b64encode(credentials.encode()).decode()
print(encoded)  # dGJzOnRiczEyMw==

JavaScript:

const credentials = "tbs:tbs123";
const encoded = btoa(credentials);
console.log(encoded);  // dGJzOnRiczEyMw==

Node.js:

const credentials = "tbs:tbs123";
const encoded = Buffer.from(credentials).toString('base64');
console.log(encoded);  // dGJzOnRiczEyMw==