Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(umami): 修正请求头并优化参数配置说明 #1137

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,12 @@ web_analytics:
# statistics on the start time, the format is "YYYY-MM-DD"
start_time: 2024-01-01

# 新建一个 umami viewOnly 用户,然后通过 login api 获取该用户 token
# create an umami viewOnly user, and then get user token through the login api
# 新建一个 umami viewOnly 用户,且有权限获取访问数据(通过团队),然后通过 login api 获取该用户 token
# create an umami viewOnly user with permission to access data (through the team), and then get user token through the login api
token:

# 填写 umami 部署的服务器地址,如 "https://umami.example.com"
# server url of umami deployment, such as "https://umami.example.com"
# 填写 umami 的 api 链接前缀,如 "https://umami.example.com/api"
# server url of umami API link prefix, such as "https://umami.example.com/api"
api_server:

# Canonical 用于向 Google 搜索指定规范网址,开启前确保 hexo _config.yml 中配置 `url: http://yourdomain.com`
Expand Down
6 changes: 3 additions & 3 deletions source/js/umami-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ const params = new URLSearchParams({
startAt: start_time,
endAt: end_time,
});
// 构造请求头
// 构造请求头,参见https://umami.is/docs/api/authentication
const request_header = {
method: "GET",
headers: {
"Content-Type": "application/json",
"x-umami-api-key": "oZKCH3msvqt10VlXKwoJvHclmaS4bVx0",
"Accept": "application/json",
"Authorization": `Bearer ${token}`,
},
};

Expand Down
Loading