From fef44babf0d4af60a0b71782a0a964c6f0e273e4 Mon Sep 17 00:00:00 2001 From: Kengwang Date: Sun, 9 Jun 2024 23:07:43 +0800 Subject: [PATCH 1/3] =?UTF-8?q?add:=20=E4=B8=80=E8=B5=B7=E5=90=AC=20?= =?UTF-8?q?=E6=8E=A5=E5=8F=97=E9=82=80=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/listentogether_accept.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 module/listentogether_accept.js diff --git a/module/listentogether_accept.js b/module/listentogether_accept.js new file mode 100644 index 0000000..d728364 --- /dev/null +++ b/module/listentogether_accept.js @@ -0,0 +1,19 @@ +module.exports = (query, request) => { + const data = { + refer: 'inbox_invite', + roomId: query.roomId, + inviterId: query.inviterId, + } + return request( + 'POST', + `http://interface.music.163.com/eapi/listen/together/play/invitation/accept`, + data, + { + crypto: 'eapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + url: '/api/listen/together/play/invitation/accept', + }, + ) +} From 1123672a86237e286fa6227e2d6674c8433c0b0c Mon Sep 17 00:00:00 2001 From: Kengwang Date: Sun, 9 Jun 2024 23:36:27 +0800 Subject: [PATCH 2/3] =?UTF-8?q?example:=20=E4=B8=80=E8=B5=B7=E5=90=AC?= =?UTF-8?q?=E5=AE=8C=E6=95=B4=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/listen_together_host.html | 65 ++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git a/public/listen_together_host.html b/public/listen_together_host.html index da21efb..0d2b9c4 100644 --- a/public/listen_together_host.html +++ b/public/listen_together_host.html @@ -5,7 +5,7 @@ - 一起听 - 主机模式 + 一起听 @@ -29,10 +29,16 @@
+
+ 加入房间 +
房间ID:
+
邀请者 ID:
+ +
分享链接为: - https://st.music.163.com/listen-together/share/?songId=1372188635&roomId={{roomInfo.roomId}}&inviterId={{account.userId}} + https://st.music.163.com/listen-together/share/?songId=1372188635&roomId={{roomInfo.roomId}}&inviterId={{roomInfo.inviterId}}

@@ -81,6 +87,7 @@ }, roomInfo: { roomId: null, + inviterId: 0, roomUsers: [], }, playlistInfo: { @@ -97,7 +104,7 @@ clientSeq: 1, login: async function () { const res = await axios({ - url: `/login/status`, + url: `/login/status?timestamp=${new Date().getTime()}`, method: 'get', data: { cookie: localStorage.getItem('cookie'), @@ -112,6 +119,57 @@ this.message = '成功登录, 请创建房间' } }, + joinRoom: async function () { + const res = await axios({ + url: 'listentogether/accept', + method: 'post', + data: { + roomId: this.roomInfo.roomId, + inviterId: this.roomInfo.inviterId, + cookie: localStorage.getItem('cookie'), + }, + }) + console.log(res) + if (res.data.code != 200) { + this.message = '加入房间出现问题: ' + res.data.message + } else { + this.message = '加入房间成功: ' + this.roomInfo.roomId + const res2 = await axios({ + url: 'listentogether/room/check', + method: 'post', + data: { + roomId: this.roomInfo.roomId, + cookie: localStorage.getItem('cookie'), + }, + }) + console.log(res2) + const res3 = await axios({ + url: 'listentogether/sync/playlist/get', + method: 'post', + data: { + roomId: this.roomInfo.roomId, + cookie: localStorage.getItem('cookie'), + }, + }) + + this.playlistInfo.playlistName = "其他人的歌单" + this.playlistInfo.playlistTrackIds = res3.data.data.playlist.displayList.result + .join(',') + const resa = await axios({ + url: '/song/detail', + method: 'post', + data: { + ids: this.playlistInfo.playlistTrackIds, + cookie: localStorage.getItem('cookie'), + }, + }) + console.log(resa) + this.playlistInfo.playlistTracks = resa.data.songs + + + } + + }, createRoom: async function () { const res = await axios({ url: 'listentogether/room/create', @@ -125,6 +183,7 @@ this.message = '创建房间出现问题: ' + res.data.message } else { this.message = '创建房间成功: ' + res.data.data.roomInfo.roomId + this.roomInfo.inviterId = this.account.userId this.roomInfo.roomId = res.data.data.roomInfo.roomId const res2 = await axios({ url: 'listentogether/room/check', From dd7e109b928f5a204a374e56e273ad7b8fffebc3 Mon Sep 17 00:00:00 2001 From: Kengwang Date: Sun, 9 Jun 2024 23:37:00 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix:=20=E9=93=BE=E6=8E=A5=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/listen_together_host.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/listen_together_host.html b/public/listen_together_host.html index 0d2b9c4..f9ebd74 100644 --- a/public/listen_together_host.html +++ b/public/listen_together_host.html @@ -14,7 +14,7 @@