Skip to content

Commit d695e35

Browse files
committed
Merge branch 'master' into dev
2 parents fd25ff5 + 3c76e68 commit d695e35

7 files changed

Lines changed: 64 additions & 23 deletions

File tree

docs/docs/en-US/guide/FAQ.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@ On Chrome, you'll see this prompt when the response body modification feature is
88
* Disable "Modify Response Body" in "Options".
99
* Add the `--silent-debugger-extension-api` parameter when running Chrome.
1010

11+
## Why is "header name" reduced to lowercase?
12+
13+
[RFC 2616](https://tools.ietf.org/html/rfc2616.html#section-4.2) says:
14+
15+
> Each header field consists of a name followed by a colon `(":")` and the field value. Field names are case-insensitive.
16+
17+
So, since 4.0.0, Header Editor will reduce "header name" to lowercase. Except for custom functions: the custom function will still get the original header (except that it has been modified by other rules)
18+
19+
## Response header modification not taking effect
20+
21+
The modified response header will not be displayed in the developer tools. This result is inaccurate. Please refer to the actual result for accuracy.
22+
23+
For example, modify `content-type` to `text/plain` will make the webpage display as plain text. This indicates that the modification has been successful, but the developer tools still display `text/html`.
24+
25+
![2025-09-03_115619.png](https://img10.360buyimg.com/ddimg/jfs/t1/325127/5/15269/85767/68b7bc80F3d770c5e/45cdb64f42625693.jpg)
26+
1127
## All rules are ineffective
1228

1329
In rare cases, some rules may fail to initialize due to syntax errors, resulting in all rules being ineffective.
@@ -27,14 +43,6 @@ Firefox:
2743
* Find the corresponding rule and error message.
2844
![img](https://img13.360buyimg.com/ddimg/jfs/t1/289605/39/18012/32092/68a4ae2cFa61f9a6a/9be7525f36abe945.jpg)
2945

30-
## Why is "header name" reduced to lowercase?
31-
32-
[RFC 2616](https://tools.ietf.org/html/rfc2616.html#section-4.2) says:
33-
34-
> Each header field consists of a name followed by a colon `(":")` and the field value. Field names are case-insensitive.
35-
36-
So, since 4.0.0, Header Editor will reduce "header name" to lowercase. Except for custom functions: the custom function will still get the original header (except that it has been modified by other rules)
37-
3846
## Can I delete a header in a simple way?
3947

4048
Yes, just modify it to `_header_editor_remove_`

docs/docs/zh-CN/guide/FAQ.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@ title: FAQ
88
* 在“选项”中禁用“修改响应体”。
99
* 运行 Chrome 时,添加`--silent-debugger-extension-api`参数。
1010

11+
## 为什么“头名称”变成小写了?
12+
13+
[RFC 2616](https://tools.ietf.org/html/rfc2616.html#section-4.2)中写到:
14+
15+
> Each header field consists of a name followed by a colon `(":")` and the field value. Field names are case-insensitive.
16+
17+
因此,从4.0.0开始,Header Editor会将“头名称”变为小写。但自定义函数除外:除了已被其他规则修改的头外,自定义函数获取到的仍然是原始头
18+
19+
## 响应头修改不生效
20+
21+
开发者工具中不会显示修改后的响应头,此结果不准确,请以实际结果为准。
22+
23+
例如将`content-type`修改为`text/plain`可以让网页显示为纯文本,可以看出实际已经修改成功,但开发者工具中仍然显示为`text/html`
24+
25+
![2025-09-03_115619.png](https://img10.360buyimg.com/ddimg/jfs/t1/325127/5/15269/85767/68b7bc80F3d770c5e/45cdb64f42625693.jpg)
26+
1127
## 所有规则都不生效
1228

1329
极少数情况下,部分规则因为存在语法问题,会导致初始化失败,致使所有规则都不生效。
@@ -27,14 +43,6 @@ Firefox:
2743
* 找到报错提示,查看规则、错误信息。
2844
![img](https://img13.360buyimg.com/ddimg/jfs/t1/289605/39/18012/32092/68a4ae2cFa61f9a6a/9be7525f36abe945.jpg)
2945

30-
## 为什么“头名称”变成小写了?
31-
32-
[RFC 2616](https://tools.ietf.org/html/rfc2616.html#section-4.2)中写到:
33-
34-
> Each header field consists of a name followed by a colon `(":")` and the field value. Field names are case-insensitive.
35-
36-
因此,从4.0.0开始,Header Editor会将“头名称”变为小写。但自定义函数除外:除了已被其他规则修改的头外,自定义函数获取到的仍然是原始头
37-
3846
## 我能以简单的方式删除头吗?
3947

4048
可以,只需将其修改为`_header_editor_remove_`

docs/docs/zh-TW/guide/FAQ.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@ title: FAQ
88
* 在「選項」中停用「修改回應主體」。
99
* 在執行 Chrome 瀏覽器時新增 `--silent-debugger-extension-api` 參數。
1010

11+
## 為什麼“標頭名稱”會被縮減為小寫?
12+
13+
[RFC 2616](https://tools.ietf.org/html/rfc2616.html#section-4.2) 規定:
14+
15+
> Each header field consists of a name followed by a colon `(":")` and the field value. Field names are case-insensitive.
16+
17+
因此,從 4.0.0 版本開始,Header Editor 會將“標頭名稱”縮減為小寫。自訂函數除外:自訂函數仍將取得原始 header(除非它已被其他規則修改)。
18+
19+
## 修改回應頭不生效
20+
21+
修改後的回應頭不會顯示在開發者工具中。此結果不準確,請以實際結果為準。
22+
23+
例如,將“content-type”變更為“text/plain”會導致網頁顯示為純文字。這表示修改成功,但開發者工具仍然顯示“text/html”。
24+
25+
![2025-09-03_115619.png](https://img10.360buyimg.com/ddimg/jfs/t1/325127/5/15269/85767/68b7bc80F3d770c5e/45cdb64f42625693.jpg)
26+
1127
## 所有規則均無效
1228

1329
在極少數情況下,某些規則可能會因為語法錯誤而無法初始化,導致所有規則都無效。

scripts/pack-utils/amo.mjs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { setTimeout as sleep } from 'node:timers/promises';
44
import { signAddon } from 'amo-upload';
55
import { last } from 'lodash-es';
66
import { path as _path, getVersion } from '../config.mjs';
7-
import { copyDir, fileExists } from '../utils.mjs';
7+
import { copyDir, fileExists, getNote } from '../utils.mjs';
88
import { createZip } from '../zip.mjs';
99

1010
let packingSourceCode = null;
@@ -114,8 +114,7 @@ export async function submitAddon(
114114
const opts = {
115115
apiKey: process.env.AMO_KEY,
116116
apiSecret: process.env.AMO_SECRET,
117-
approvalNotes:
118-
'https://github.com/FirefoxBar/HeaderEditor/blob/master/README.md',
117+
approvalNotes: getNote(),
119118
override: false,
120119
pollInterval: 8000,
121120
pollRetry: 9999,

scripts/pack-utils/cws.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ async function packCws({ zipPath, extensionConfig }) {
2020
clientSecret: process.env.CWS_CLIENT_SECRET,
2121
});
2222

23-
return client.submit({
23+
const res = await client.submit({
2424
filePath: zipPath,
2525
});
26+
27+
return JSON.stringify(res);
2628
}
2729

2830
export default packCws;

scripts/pack-utils/edge.mjs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { createReadStream } from 'node:fs';
22
import { EdgeAddonsAPI } from '@plasmohq/edge-addons-api';
3+
import { getNote } from '../utils.mjs';
34

45
export default async function ({ zipPath, extensionConfig }) {
56
if (!process.env.MS_CLIENT_ID) {
@@ -19,9 +20,7 @@ export default async function ({ zipPath, extensionConfig }) {
1920
console.log('[edge] upload done', uploadResp);
2021
const uploadStatus = await client.waitForUpload(uploadResp);
2122
console.log('[edge] upload check success', uploadStatus);
22-
const publishResp = await client.publish(
23-
'https://github.com/FirefoxBar/HeaderEditor/blob/master/README.md',
24-
);
23+
const publishResp = await client.publish(getNote());
2524
console.log('[edge] publish done', publishResp);
2625
return JSON.stringify(await client.getPublishStatus(publishResp));
2726
}

scripts/utils.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,12 @@ export function copyDir(source, target) {
6666
);
6767
});
6868
}
69+
70+
export function getNote() {
71+
const repo = process.env.GITHUB_REPOSITORY;
72+
const runId = process.env.GITHUB_RUN_ID;
73+
if (repo && runId) {
74+
return `Submit via GitHub Actions: https://github.com/${repo}/actions/runs/${runId}`;
75+
}
76+
return 'https://github.com/FirefoxBar/HeaderEditor/blob/master/README.md';
77+
}

0 commit comments

Comments
 (0)