| 22 | } |
| 23 | |
| 24 | function getHash() { |
| 25 | return new Promise((resove) => { |
| 26 | const url = { url: 'https://apk.tw/', headers: {} } |
| 27 | url.headers['Host'] = 'apk.tw' |
| 28 | url.headers['Referer'] = 'https://apk.tw/forum.php' |
| 29 | url.headers['Accept'] = '*/*' |
| 30 | url.headers['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15' |
| 31 | $.get(url, (error, response, data) => { |
| 32 | try { |
| 33 | if (error) throw new Error(error) |
| 34 | if (/\/source\/plugin\/dsu_amupper\/images\/wb\.gif/.test(data)) { |
| 35 | $.isSigned = true |
| 36 | $.isSignSuc = true |
| 37 | } else { |
| 38 | $.isSigned = false |
| 39 | const [hash] = /plugin.php\?id=dsu_amupper:pper([^('|")]*)/.exec(data) |
| 40 | if (hash) { |
| 41 | $.hash = hash |
| 42 | } else { |
| 43 | $.isSignSuc = false |
| 44 | } |
| 45 | } |
| 46 | } catch (e) { |
| 47 | $.log(`❗️ ${$.name}, 执行失败!`, ` error = ${error || e}`, `response = ${JSON.stringify(response)}`, '') |
| 48 | } finally { |
| 49 | resove() |
| 50 | } |
| 51 | }) |
| 52 | }) |
| 53 | } |
| 54 | |
| 55 | function sign() { |
| 56 | if ($.isSigned && !$.hash) return |