@adelie/wechat-miniprogram 0.0.0-stage → 0.4.2
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/LICENSE +201 -0
- package/icon.svg +7 -0
- package/package.json +17 -3
- package/plugin.json +9 -0
- package/skills/wechat-miniprogram/SKILL.md +148 -0
- package/skills/wechat-miniprogram/scripts/add-ip2.mjs +358 -0
- package/skills/wechat-miniprogram/scripts/auto-submit.mjs +170 -0
- package/skills/wechat-miniprogram/scripts/check-session.mjs +40 -0
- package/skills/wechat-miniprogram/scripts/login2.mjs +226 -0
- package/skills/wechat-miniprogram/scripts/miniapp-info.mjs +67 -0
- package/skills/wechat-miniprogram/scripts/miniapp-nav.mjs +56 -0
- package/skills/wechat-miniprogram/scripts/package.json +12 -0
- package/skills/wechat-miniprogram/scripts/privacy-fill2.mjs +302 -0
- package/skills/wechat-miniprogram/scripts/probe-key-qr.mjs +147 -0
- package/skills/wechat-miniprogram/scripts/probe-privacy.mjs +73 -0
- package/skills/wechat-miniprogram/scripts/probe-privcheck.mjs +129 -0
- package/skills/wechat-miniprogram/scripts/probe-switch3.mjs +104 -0
- package/skills/wechat-miniprogram/scripts/reset-key2.mjs +259 -0
- package/skills/wechat-miniprogram/scripts/stealth.mjs +92 -0
- package/skills/wechat-miniprogram/scripts/submit-review4.mjs +186 -0
- package/skills/wechat-miniprogram/scripts/to-miniapp.mjs +136 -0
- package/skills/wechat-miniprogram/scripts/withdraw2.mjs +229 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/README.md +46 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/app.js +14 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/app.json +12 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/app.wxss +13 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/package.json +14 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/pages/about/about.js +33 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/pages/about/about.json +4 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/pages/about/about.wxml +24 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/pages/about/about.wxss +49 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/pages/index/index.js +145 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/pages/index/index.json +4 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/pages/index/index.wxml +55 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/pages/index/index.wxss +173 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/preview.js +53 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/project.config.json +25 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/sitemap.json +9 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/tools/test-page.js +123 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/tools/validate.js +103 -0
- package/skills/wechat-miniprogram/templates/miniprogram-todo/upload.js +49 -0
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/icon.svg
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<rect x="4" y="2.5" width="16" height="19" rx="3" />
|
|
3
|
+
<path d="M8 6.5h8" />
|
|
4
|
+
<circle cx="9" cy="11" r="1.3" />
|
|
5
|
+
<circle cx="15" cy="11" r="1.3" />
|
|
6
|
+
<path d="M8.5 15c1 1 2.2 1.5 3.5 1.5s2.5-.5 3.5-1.5" />
|
|
7
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adelie/wechat-miniprogram",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.4.2",
|
|
4
|
+
"description": "Publish a WeChat mini-program end to end from a headless Linux server: QR login to mp.weixin.qq.com, switching from a public account to the mini-program backend, the AppID and upload key, IP whitelisting, miniprogram-ci upload, the privacy policy, review and release.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/lmliheng/Adelie.git",
|
|
9
|
+
"directory": "plugins/wechat-miniprogram"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"plugin.json",
|
|
13
|
+
"icon.svg",
|
|
14
|
+
"skills",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
}
|
|
6
20
|
}
|
package/plugin.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Publish a WeChat mini-program end to end from a headless Linux server: log in to mp.weixin.qq.com by QR, switch from a public account to the mini-program backend, read the AppID, reset the code-upload private key, whitelist the server IP, upload with miniprogram-ci, hand the user a verified preview QR, fill the mandatory user-privacy policy, submit for review and publish.",
|
|
3
|
+
"description_zh": "在无桌面的 Linux 服务器上把微信小程序从代码做到发布:扫码登录 mp.weixin.qq.com、从公众号后台切到小程序后台、取 AppID 与上传密钥、加 IP 白名单、用 miniprogram-ci 上传、交付校验过的预览码、填写必填的用户隐私保护指引、提交审核与发布。",
|
|
4
|
+
"short_description": "WeChat mini-program: login, upload, privacy policy, review, publish.",
|
|
5
|
+
"short_description_zh": "微信小程序全流程:扫码登录与切号、上传、隐私指引、提交审核与发布。",
|
|
6
|
+
"version": "2026.10.01.1",
|
|
7
|
+
"category": "software-development",
|
|
8
|
+
"preinstall": false
|
|
9
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: wechat-miniprogram
|
|
3
|
+
description: Take a WeChat mini-program from code to published, driving the real mp.weixin.qq.com admin from a headless Linux server — log in by QR, switch from a public account to the mini-program backend, read the AppID, reset the code-upload private key, whitelist the server IP, upload with miniprogram-ci, hand the user a preview QR, fill the mandatory user-privacy policy, submit for review, withdraw a stale review version, and publish.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 微信小程序:登录 → 开发 → 上传 → 审核 → 发布
|
|
7
|
+
|
|
8
|
+
## Before you start
|
|
9
|
+
|
|
10
|
+
如果消息只是点名这个技能(比如「用 wechat-miniprogram」)而没有具体的小程序或具体环节,先问清楚是
|
|
11
|
+
发布新版本、查后台信息,还是准备发布材料。扫码登录与重置密钥都**要用户本人在场**(二维码 5–10 分钟
|
|
12
|
+
过期、重置要管理员扫码),人不在就别开等待进程。
|
|
13
|
+
|
|
14
|
+
用真人路径(浏览器打开 mp.weixin.qq.com 后台,点真实按钮)完成小程序的上架链路。适用于:写并发布一个小程序、更新已有小程序版本、查小程序后台信息、准备发布材料。
|
|
15
|
+
|
|
16
|
+
微信的后台**大量关键步骤不报错、只是静默失败**(提审按钮点了没反应、上传返回一句 `invalid ip`),所以本技能的核心价值是:**知道每一步真正的前置条件,以及怎么独立复核结果**。
|
|
17
|
+
|
|
18
|
+
## 一、先搞清楚:登录态与账号归属
|
|
19
|
+
|
|
20
|
+
**公众号≠小程序。** 公众号后台的「小程序管理」页只暴露**原始 ID**(`gh_xxxx`),拿不到 AppID;AppID 只在小程序自己的后台里。两者用同一套 mp.weixin.qq.com 登录,靠「切换账号」在同一个浏览器 profile 里来回切。
|
|
21
|
+
|
|
22
|
+
| 事实 | 说明 |
|
|
23
|
+
| --- | --- |
|
|
24
|
+
| 登录只需一次扫码 | 登录态由 Chromium profile 持久化,cookie 有效期约几天;过期后让用户重扫一次 |
|
|
25
|
+
| 切到小程序后台**不用再扫码** | 公众号后台左下角点账号块 `.mp_account_box`(要点一下,hover 无效)→ `li.account_box-panel-item` 里的「切换账号」→ 弹窗 `.switch-account-dialog` → 点小程序那一行 |
|
|
26
|
+
| 切换弹窗里可能出现「小程序测试号 / 小游戏测试号」 | **测试号不能提交审核发布**,只能开发调试,别在它上面浪费时间 |
|
|
27
|
+
| 扫码登录的坑 | 登录二维码是 472×472 的 jpg 被 CSS 缩到 122×122 显示,**元素截图拿到的是降采样图,微信扫不出来**。必须在页面里用 canvas 取原图、放大 2 倍导出 PNG,**并用 jsQR 解码验证**后再交给用户 |
|
|
28
|
+
| 每次换号/换码都要让用户本人在场 | 二维码约 5–10 分钟过期。**人不在就别开等待进程**,白耗资源 |
|
|
29
|
+
|
|
30
|
+
## 二、把代码推上去(这一步不需要扫码,但要白名单)
|
|
31
|
+
|
|
32
|
+
1. **拿上传密钥**:开发管理 → 开发设置 → 小程序代码上传密钥 → **重置**(旧密钥不可查看,只能重置)。重置要**管理员微信扫码**(弹窗「重置代码上传密钥 / 身份确认」),确认后弹窗第二步给「下载密钥」,用 Playwright 的 `download` 事件把 `private.<appid>.key` 存到服务器。
|
|
33
|
+
2. **加 IP 白名单**:同一页「IP白名单 → 编辑」,**同样要管理员扫码**。不加就上传,服务端会返回
|
|
34
|
+
`{"errCode":-10008,"errMsg":"invalid ip: <你的出口IP>, reference: ..."}`。
|
|
35
|
+
先 `curl -s https://api.ipify.org` 拿出口 IP 再填。
|
|
36
|
+
3. **上传**:`miniprogram-ci`
|
|
37
|
+
```bash
|
|
38
|
+
cd <项目> && MP_APPID=wx... MP_KEY_PATH=<key> MP_VERSION=1.0.0 MP_DESC="..." node upload.js
|
|
39
|
+
```
|
|
40
|
+
成功后该版本出现在后台「管理 → 版本管理 → 开发版本」。
|
|
41
|
+
4. **预览码**(给用户试用,**不需要扫码授权**,但会用掉一次上传配额):
|
|
42
|
+
```bash
|
|
43
|
+
MP_APPID=wx... MP_KEY_PATH=<key> MP_QR_OUT=<输出路径> node preview.js
|
|
44
|
+
```
|
|
45
|
+
微信返回的可能是 **470×470 的 JPEG**(哪怕文件名写成 .png)。用 `jpeg-js` 解码 → `jsQR` 验证能解出 `https://mp.weixin.qq.com/a/~~...~~` → 最近邻放大 2 倍存成真 PNG 再交给用户。预览码约 25 分钟有效。
|
|
46
|
+
|
|
47
|
+
## 三、提审与发布(真正的坑都在这)
|
|
48
|
+
|
|
49
|
+
**发布链路:上传开发版 → 提交审核 → 微信审核(1–7 天)→ 发布(替换线上版本)。** 提交审核与发布都是后台的人工动作,个人主体小程序必须过审才能发布。
|
|
50
|
+
|
|
51
|
+
### 前置条件清单(缺一个就静默失败)
|
|
52
|
+
|
|
53
|
+
- [ ] **用户隐私保护指引**必须已配置(见下)——否则点「提交审核 → 须知 → 下一步 → 继续提交」后**什么都不发生**,页面只悄悄发一次 `CheckPrivacyApiAuth`。
|
|
54
|
+
- [ ] **不能已有版本在审核中**——旧审核版本要先撤回。
|
|
55
|
+
- [ ] 服务类目已设置(基本设置里可见)。
|
|
56
|
+
|
|
57
|
+
### 用户隐私保护指引(最容易卡住的一步)
|
|
58
|
+
|
|
59
|
+
入口:**基本设置 → 服务内容声明 → 用户隐私保护指引「去完善」**(点它会**新开一个标签页**)。
|
|
60
|
+
地址必须带参数,少了就显示「页面连接异常,请关闭重试」:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
https://mp.weixin.qq.com/wxamp/wadevelopcode/privacy?ver=1&id=0&wait=0&token=<token>&lang=zh_CN
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
编辑器里这些**全是必填**,漏一个「确定并提交协议」就无反应:
|
|
67
|
+
|
|
68
|
+
| 位置 | 怎么填 |
|
|
69
|
+
| --- | --- |
|
|
70
|
+
| 每条信息类型的「用途」 | `input[placeholder="请填写用途"]`,微信按代码识别出 2–5 条(手机号 / 相册 / 位置 / 剪切板…),**给用户的用途文案必须先让用户拍板**,这是对外公示的法律声明 |
|
|
71
|
+
| 联系方式 | 点「请选择」→ 选类型(电话/邮箱/微信号/qq)→ 填**同行**的输入框(用 `input[placeholder="邮箱"]` 之类的 placeholder 精确定位,别用"最后一个输入框",会填错到别的栏) |
|
|
72
|
+
| 5.2「再次以 ___ 方式告知」 | 预览时会显示「**待填写**」,必须补,例如「弹窗提示」 |
|
|
73
|
+
| 底部声明勾选框 | 「本小程序已对用户的信息处理进行了逐一、如实的说明…」必须勾上 |
|
|
74
|
+
|
|
75
|
+
然后点「预览后提交协议」→ 确认预览里**没有「待填写/待完善」**→ 勾声明 →「确定并提交协议」。**提交成功的判据是回到基本设置看到「用户隐私保护指引 → 审核中」**(不是看编辑器页面有没有跳转)。
|
|
76
|
+
|
|
77
|
+
⚠️ **隐私指引处于「审核中」时,代码提审照样被拦**,要等它先过。
|
|
78
|
+
|
|
79
|
+
### 提交代码审核
|
|
80
|
+
|
|
81
|
+
点开发版本右侧的「**提交审核**」→ 弹窗「确认提交审核?」勾两个确认项 → **下一步** → 弹窗「代码审核进行安全测试提醒」→ **继续提交**。之后应进入审核信息表单;若页面毫无反应,回去查上面的前置条件清单。
|
|
82
|
+
|
|
83
|
+
### 撤回旧审核版本
|
|
84
|
+
|
|
85
|
+
版本管理页「审核版本」块里点「**删除**」→ **要管理员扫码**(「删除当前版本 / 请使用微信扫描二维码进行验证」)→ 扫码确认后自动完成。撤回只删"待审记录",**同名开发版本仍在**,随时可重提。
|
|
86
|
+
|
|
87
|
+
## 四、复核(不要凭页面文字下结论)
|
|
88
|
+
|
|
89
|
+
| 要确认什么 | 怎么看 |
|
|
90
|
+
| --- | --- |
|
|
91
|
+
| 登录态 | 打开 `https://mp.weixin.qq.com/`,URL 里有 `token=<数字>` 即为已登录 |
|
|
92
|
+
| 当前是在哪个账号后台 | URL 含 `/wxamp/` = 小程序后台;含 `/cgi-bin/` = 公众号后台 |
|
|
93
|
+
| AppID | 基本设置页 `/wxamp/basicprofile/index` 正文里的 `wx[0-9a-f]{16}` |
|
|
94
|
+
| 上传是否真成功 | 版本管理页 `/wxamp/wacodepage/getcodepage` 的「开发版本」里出现该版本号 + `ci机器人1` |
|
|
95
|
+
| 隐私指引是否提交成功 | 基本设置里那一行变成「**审核中**」 |
|
|
96
|
+
| 代码是否真进了审核 | 版本管理页「审核版本」块里出现版本号(**注意:「你暂无提交审核的版本或者版本已发布上线」只是审核版本为空的占位文案,不是报错**) |
|
|
97
|
+
|
|
98
|
+
## 五、命令行手艺(Linux 无桌面环境)
|
|
99
|
+
|
|
100
|
+
- 有头模式跑:`xvfb-run -a --server-args="-screen 0 1440x900x24" node xxx.mjs`
|
|
101
|
+
- **页面一律用 `waitUntil: 'commit'` + 固定等待**;机器负载高时 `domcontentloaded` 会 60s 超时。
|
|
102
|
+
- **弹窗里的按钮先 `scrollIntoView({block:'center'})` 再按坐标点**,否则坐标可能落在视口外(y=920 > 视口 900)而点击无效。
|
|
103
|
+
- 二维码交付三条铁律:**先解码验证** → **按二维码内容 hash 命名**(同一张码反复截图不会换名删旧文件,别用 PNG 字节做 hash)→ **只保留当前一张**。
|
|
104
|
+
- `pkill -f "xxx.mjs"` 会匹配到**自己这条 shell 命令行**(里面含脚本名)导致自杀。用 `P=$(printf 'add-%s2.mjs' ip); pkill -f "$P"`,或把 kill 和"启动脚本"分成两条命令。
|
|
105
|
+
- 长时间等待扫码的进程:用 `setsid ... &` 起独立会话,否则这次 shell 一结束就被连带清理;等待进程要**先把用户叫到跟前**。
|
|
106
|
+
- 管理员扫码那类等待脚本的"第二步已就绪"判据:**不能看「身份确认」字样**(步骤条里一直有),要看"请使用管理员微信扫描"是否消失。
|
|
107
|
+
|
|
108
|
+
## 六、资产
|
|
109
|
+
|
|
110
|
+
工具(**不要重造**):`<app_data_dir>/agents/<agent_id>/shared_env/wechat-mp/`
|
|
111
|
+
本技能 `scripts/` 是同一批脚本的**便携快照**,新环境直接把 `scripts/` 拷到 shared_env 再用:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
cp -r <skills>/wechat-miniprogram/scripts <shared_env>/wechat-mp
|
|
115
|
+
cd <shared_env>/wechat-mp && npm install # 依赖见 scripts/package.json
|
|
116
|
+
npx playwright install chromium # 没装过浏览器才需要
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
脚本之间用 `./stealth.mjs` 相对引用、浏览器 profile 默认落在脚本同目录的 `profile/`,
|
|
120
|
+
所以**拷过去即可跑,只差一次扫码登录**(`node login2.mjs` 出码 → 用户扫 → 登录态存进 profile)。
|
|
121
|
+
|
|
122
|
+
| 脚本 | 作用 |
|
|
123
|
+
| --- | --- |
|
|
124
|
+
| `stealth.mjs` | `launchStealth(profileDir,{headless})`:反检测 + 持久化 profile 的浏览器 |
|
|
125
|
+
| `login2.mjs` | 扫码登录:出码(canvas 放大 + jsQR 校验 + 内容 hash 命名)、等扫码、检测登录成功 |
|
|
126
|
+
| `check-session.mjs` | 复用 profile 验证登录态并回报账号名 |
|
|
127
|
+
| `to-miniapp.mjs` | 公众号后台 →「切换账号」→ 切到指定小程序后台,并 dump 落地页 |
|
|
128
|
+
| `miniapp-info.mjs` | 一次采完:小程序后台首页 / 基本设置(AppID)/ 开发设置(上传密钥与白名单) |
|
|
129
|
+
| `miniapp-nav.mjs` | 打开后台任意页面并 dump 文本/按钮(`node miniapp-nav.mjs /wxamp/xxx label outDir`) |
|
|
130
|
+
| `reset-key2.mjs` | 重置上传密钥:出码 → 等扫码 → 捕获密钥下载落盘 |
|
|
131
|
+
| `add-ip2.mjs` | 加 IP 白名单:出码 → 等扫码 → 填 IP → 保存 → 复核 |
|
|
132
|
+
| `privacy-fill2.mjs` | 填写并提交用户隐私保护指引(用途 + 联系方式 + 5.2 + 声明勾选) |
|
|
133
|
+
| `submit-review4.mjs` | 提审全流程:须知 → 下一步 → 安全测试提醒 → 继续提交,并抓即时提示 |
|
|
134
|
+
| `withdraw2.mjs` | 撤回(删除)审核版本 |
|
|
135
|
+
| `auto-submit.mjs` | 状态巡检 + 条件提审:隐私未过就只报告,过了就自动提审;结果写 status.json(适合挂定时任务) |
|
|
136
|
+
| `probe-*.mjs` | 排查用:`probe-switch*.mjs` 切号入口、`probe-key-qr.mjs` 二维码元素与分辨率、`probe-privacy.mjs` 隐私页、`probe-privcheck.mjs` 提审请求体 |
|
|
137
|
+
|
|
138
|
+
模板:`templates/miniprogram-todo/` —— 一个零后端、纯本地的待办清单小程序(含 `tools/validate.js` 静态校验与 `tools/test-page.js` 无头逻辑单测,打桩 `wx`/`Page`)。复制出去 `npm install` 即可用。
|
|
139
|
+
|
|
140
|
+
账号相关的**具体信息**(AppID、密钥路径、profile 目录、当前进度)写进记忆,不要写死在本技能里。
|
|
141
|
+
|
|
142
|
+
## 七、铁律
|
|
143
|
+
|
|
144
|
+
1. **密钥、cookie、`.vault.toml` 绝不打印、绝不让用户贴进对话**;密钥文件只落服务器。
|
|
145
|
+
2. 需要扫码的步骤**先把用户叫到跟前**,再开码;人不在就停,不要空挂浏览器。
|
|
146
|
+
3. 提交审核、发布、删除/撤回都是**改变账号状态的动作**:先确认用户意图,再动手。
|
|
147
|
+
4. 「发布」会**替换线上版本**——发布前明确告诉用户旧版本会被覆盖。
|
|
148
|
+
5. 任何"已完成"的结论都要**回到后台页面独立复核**(见第四节),不要凭弹窗关闭或页面跳转下结论。
|