-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
49 lines (48 loc) · 2.3 KB
/
index.html
File metadata and controls
49 lines (48 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no" />
<meta name="renderer" content="webkit" />
<title>菠菜面Nemo作品口令一键生成</title>
<link rel="stylesheet" href="https://unpkg.com/mdui@1.0.2/dist/css/mdui.min.css">
</head>
<body>
<script src="https://unpkg.com/mdui@1.0.2/dist/js/mdui.min.js"></script>
<script>
let params = new URL(location.href).searchParams
let workId = params.get('workId') || prompt('输入作品ID, 本工具只支持Nemo作品', '')
let token = params.get('token') || prompt('输入你的 Token Authorization, 否则无法生成作品分享口令', '')
;(async () => {
let workInfo = await fetch(`https://api.codemao.cn/creation-tools/v1/works/${ workId }/source/public`).then(re => re.json())
// 一般我们取最新的
let bcmUrl = workInfo.work_urls[0]
let re = await fetch('https://api.codemao.cn/nemo/v2/miao-codes/bcm', {
method: 'POST',
body: JSON.stringify({
"app_version": "4.3.4",
"bcm_version": "0.16.2",
"equipment": "Redmi",
"name": workInfo.name, // "作品名称",
"os": "android",
"preview": workInfo.preview, // "封面.cover",
"work_id": workId, // "作品ID",
"work_url": bcmUrl, // "作品源代码.bcm"
}),
headers: {
"Content-Type": "application/json; charset=UTF-8",
"User-Agent": "okhttp/4.2.2",
"Authorization": `Bearer ${ token }`,
},
credentials: 'include',
})
let json = await re.json()
if (re.ok) {
let text = `【喵口令】$&${ json.token }&$`
mdui.alert(text)
} else
mdui.alert('错误: ' + JSON.stringify(json))
})()
</script>
</body>
</html>