| 112 | } |
| 113 | |
| 114 | function parseAccount(raw) { |
| 115 | const text = String(raw || "").trim(); |
| 116 | if (!text) return { openid: "", cookie: "", secret: "" }; |
| 117 | |
| 118 | if (text.startsWith("{")) { |
| 119 | try { |
| 120 | const data = JSON.parse(text); |
| 121 | return { |
| 122 | openid: data.openid || data.openId || data.account || "", |
| 123 | cookie: data.cookie || data.Cookie || "", |
| 124 | secret: data.secret || data.jsrsasign_secret || "", |
| 125 | }; |
| 126 | } catch {} |
| 127 | } |
| 128 | |
| 129 | for (const sep of ["#", "|"]) { |
| 130 | if (text.includes(sep)) { |
| 131 | const [openid, cookie, secret] = text.split(sep); |
| 132 | return { openid: openid.trim(), cookie: (cookie || "").trim(), secret: (secret || "").trim() }; |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | if (text.includes("wps_sid=") || text.includes("kso_sid=")) return { openid: "", cookie: text, secret: "" }; |
| 137 | return { openid: text, cookie: "", secret: "" }; |
| 138 | } |
| 139 | |
| 140 | function canonicalJson(data = {}) { |
| 141 | const sorted = {}; |