@gengchenchina/chrome-media-publish-extension 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/index.js +13 -3
- package/dist/index.js.map +2 -2
- package/index.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -511,7 +511,8 @@ Manager 发布菜单会自动递增 patch;工具包若首发为 `1.0.9`,则
|
|
|
511
511
|
|
|
512
512
|
百家号编辑页跳到 STOKEN 中间页时,内核会自动执行 Passport 获取 STOKEN、`dealtoken` 和一次编辑页重试。
|
|
513
513
|
真实账号验证步骤与失败诊断见 `docs/integration-guide.md` 的“百家号 STOKEN 补全与修复验证”。
|
|
514
|
-
|
|
514
|
+
本次还补充了 Passport STOKEN 接口的百家号 Referer 规则,以处理 `errno=12 / invalid refer`。
|
|
515
|
+
已发布版本不会自动包含本地新修复;发布前查询版本并递增,然后更新下游依赖、重建并重新加载扩展。
|
|
515
516
|
|
|
516
517
|
真实平台 adapter 放在:
|
|
517
518
|
|
package/dist/index.js
CHANGED
|
@@ -4140,6 +4140,12 @@ var BAIJIAHAO_HEADER_RULES = Object.freeze([
|
|
|
4140
4140
|
Referer: `${BAIJIAHAO_ORIGIN}/`
|
|
4141
4141
|
}),
|
|
4142
4142
|
resourceTypes: Object.freeze(["xmlhttprequest"])
|
|
4143
|
+
}),
|
|
4144
|
+
Object.freeze({
|
|
4145
|
+
// Passport 校验 STOKEN 请求来源;只覆盖此接口,保持其他 Passport 请求不变。
|
|
4146
|
+
urlFilter: `|${BAIJIAHAO_PASSPORT_AUTH_URL}`,
|
|
4147
|
+
headers: Object.freeze({ Referer: `${BAIJIAHAO_ORIGIN}/` }),
|
|
4148
|
+
resourceTypes: Object.freeze(["xmlhttprequest"])
|
|
4143
4149
|
})
|
|
4144
4150
|
]);
|
|
4145
4151
|
var BAIJIAHAO_SKIP_IMAGE_HOSTS = Object.freeze([
|
|
@@ -4713,6 +4719,10 @@ async function fetchBaijiahaoAuthToken(ctx, input = {}) {
|
|
|
4713
4719
|
}
|
|
4714
4720
|
const errno = typeof auth.errno === "number" || typeof auth.errno === "string" && /^-?\d+$/.test(auth.errno) ? Number(auth.errno) : NaN;
|
|
4715
4721
|
diagnostics.sessionRefresh.authErrno = Number.isFinite(errno) ? errno : null;
|
|
4722
|
+
if (errno === 12) {
|
|
4723
|
+
diagnostics.failure = "STOKEN_REFERER_REJECTED";
|
|
4724
|
+
throw new Error("\u767E\u5BB6\u53F7 Passport \u8BF7\u6C42\u6765\u6E90\u6821\u9A8C\u5931\u8D25\uFF08errno=12\uFF09\uFF0C\u8BF7\u66F4\u65B0\u53D1\u6587\u6269\u5C55\u540E\u91CD\u8BD5");
|
|
4725
|
+
}
|
|
4716
4726
|
const stoken = typeof auth.stoken === "string" ? auth.stoken.trim() : "";
|
|
4717
4727
|
if (errno !== 0 || !/^[\x21-\x7e]+$/.test(stoken)) {
|
|
4718
4728
|
diagnostics.failure = "STOKEN_AUTH_FAILED";
|
|
@@ -4923,9 +4933,9 @@ async function findBaijiahaoArticle(ctx, articleId, input = {}) {
|
|
|
4923
4933
|
function mapBaijiahaoArticleStatus(item, statusRef) {
|
|
4924
4934
|
const checkedAt = Date.now();
|
|
4925
4935
|
const status = String(item?.status || "");
|
|
4926
|
-
const postUrl = [item?.
|
|
4927
|
-
|
|
4928
|
-
|
|
4936
|
+
const postUrl = [item?.url, item?.share_url, statusRef.url].map(toBaijiahaoPublicUrl).find(Boolean);
|
|
4937
|
+
if (/reject|fail|nopass|not_pass|forbid|withdraw|delete/i.test(status) || item?.secure_status === "rejected") {
|
|
4938
|
+
const reason = item?.secure_not_pass_reason || item?.audit_msg || item?.quality_not_pass_reason;
|
|
4929
4939
|
return {
|
|
4930
4940
|
status: "rejected",
|
|
4931
4941
|
postUrl,
|