readme 修改成 https 克隆(不用登录 修改 /public 几个测试网页

去掉了 http://localhost:port/
public 里面的网页 lang 都改成 zh 了
This commit is contained in:
huggy 2020-09-11 00:32:21 +08:00
parent 9ee30f363a
commit c05c83db14
5 changed files with 245 additions and 230 deletions

View File

@ -192,7 +192,7 @@
## 安装
```shell
$ git clone git@github.com:Binaryify/NeteaseCloudMusicApi.git
$ git clone https://github.com/Binaryify/NeteaseCloudMusicApi.git
$ npm install
```

View File

@ -1,10 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>更新头像</title>
</head>
<body>
<input id="file" type="file" name="filename" />
<img id="avatar" style="height: 200px; width: 200px; border-radius: 50%;" />
@ -13,7 +15,6 @@
<script>
const phone = ''
const password = ''
const port = 3000
let cookieToken = ''
if (!phone || !password) {
const msg = '请设置你的手机号码和密码'
@ -33,14 +34,14 @@
false
)
const res = await axios({
url: `http://localhost:${port}/user/detail?uid=32953014&timestamp=${Date.now()}`,
url: `/user/detail?uid=32953014&timestamp=${Date.now()}`,
withCredentials: true, //关键
})
document.querySelector('#avatar').src = res.data.profile.avatarUrl
}
async function login() {
const res = await axios({
url: `http://localhost:${port}/login/cellphone?phone=${phone}&password=${password}`,
url: `/login/cellphone?phone=${phone}&password=${password}`,
withCredentials: true, //关键
})
cookieToken = res.data.cookie
@ -77,4 +78,5 @@
}
</script>
</body>
</html>

View File

@ -1,11 +1,13 @@
<!DOCTYPE html>
<html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>网易云音乐 API</title>
</head>
<body>
<h1>网易云音乐 API</h1>
当你看到这个页面时,这个服务已经成功跑起来了~
@ -17,7 +19,8 @@
<li>3. <a href="/dj/program?rid=336355127">电台节目</a></li>
</ul>
<style>
html,body{
html,
body {
height: 100vh;
width: 100vw;
margin: 0;
@ -27,22 +30,29 @@
margin-top: 30px;
overflow: hidden;
}
* {
color: rgb(100, 100, 100);
}
a {
color: #42b983;
}
ul,li{
ul,
li {
margin: 0;
}
ul {
margin-left: -40px;
line-height: 30px;
}
li {
list-style: none;
}
</style>
</body>
</html>

View File

@ -1,10 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>歌单封面上传</title>
</head>
<body>
<input id="file" type="file" name="filename" />
@ -15,7 +17,6 @@
const phone = ''
const password = ''
const playlist_id = ''
const port = 3000
let cookieToken = ''
if (!phone || !password) {
const msg = '请设置你的手机号码和密码'
@ -40,13 +41,13 @@
false
)
const res = await axios({
url: `http://localhost:${port}/playlist/detail?id=${playlist_id}&timestamp=${Date.now()}`,
url: `/playlist/detail?id=${playlist_id}&timestamp=${Date.now()}`,
})
document.querySelector('#playlist_cover').src = res.data.playlist.coverImgUrl
}
async function login() {
const res = await axios({
url: `http://localhost:${port}/login/cellphone?phone=${phone}&password=${password}`,
url: `/login/cellphone?phone=${phone}&password=${password}`,
withCredentials: true, //关键
})
cookieToken = res.data.cookie
@ -83,4 +84,5 @@
}
</script>
</body>
</html>

View File

@ -1,5 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
@ -14,21 +15,20 @@
<script>
const phone = ''
const password = ''
const port = 3000
if (!phone || !password) {
const msg = '请设置你的手机号码和密码'
alert(msg)
throw new Error(msg)
}
$.ajax({
url: `http://localhost:${port}/login/cellphone?phone=${phone}&password=${password}`,
url: `/login/cellphone?phone=${phone}&password=${password}`,
xhrFields: {
withCredentials: true //关键
},
success: function (data) {
console.log(data)
$.ajax({
url: `http://localhost:${port}/recommend/resource `,
url: `/recommend/resource `,
xhrFields: {
withCredentials: true //关键
},
@ -46,12 +46,12 @@
})
axios({
url: `http://localhost:${port}/login/cellphone?phone=${phone}&password=${password}`,
url: `/login/cellphone?phone=${phone}&password=${password}`,
withCredentials: true //关键
}).then(function (res) {
console.log(res.data)
axios({
url: `http://localhost:${port}/recommend/resource`,
url: `/recommend/resource`,
withCredentials: true //关键
}).then(function (res) {
console.log(res.data)
@ -59,4 +59,5 @@
})
</script>
</body>
</html>