@neteasecloudmusicapienhanced/api 4.29.20 → 4.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,94 +1,322 @@
1
- <!-- eslint-disable prettier/prettier -->
2
1
  <!DOCTYPE html>
3
2
  <html lang="zh">
4
3
  <head>
5
4
  <meta charset="UTF-8" />
6
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>一起听</title>
6
+ <title>一起听 - 主机模式</title>
8
7
  <script src="https://unpkg.com/petite-vue"></script>
9
8
  <script src="https://fastly.jsdelivr.net/npm/axios@0.26.1/dist/axios.min.js"></script>
10
- <link
11
- rel="stylesheet"
12
- href="https://unpkg.com/mdui@1.0.2/dist/css/mdui.min.css"
13
- />
14
- <script src="https://unpkg.com/mdui@1.0.2/dist/js/mdui.min.js"></script>
9
+ <style>
10
+ * {
11
+ margin: 0;
12
+ padding: 0;
13
+ box-sizing: border-box;
14
+ }
15
+
16
+ body {
17
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
18
+ min-height: 100vh;
19
+ background: #f5f5f5;
20
+ padding: 20px;
21
+ }
22
+
23
+ .container {
24
+ max-width: 900px;
25
+ margin: 0 auto;
26
+ background: white;
27
+ border-radius: 12px;
28
+ padding: 32px;
29
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
30
+ }
31
+
32
+ h1 {
33
+ font-size: 24px;
34
+ font-weight: 600;
35
+ color: #333;
36
+ margin-bottom: 16px;
37
+ }
38
+
39
+ .login-link {
40
+ display: block;
41
+ margin-bottom: 24px;
42
+ color: #666;
43
+ font-size: 14px;
44
+ text-decoration: none;
45
+ }
46
+
47
+ .login-link:hover {
48
+ color: #333;
49
+ text-decoration: underline;
50
+ }
51
+
52
+ .message {
53
+ padding: 12px 16px;
54
+ background: #f9f9f9;
55
+ border-radius: 6px;
56
+ margin-bottom: 20px;
57
+ font-size: 14px;
58
+ color: #555;
59
+ }
60
+
61
+ .audio-player {
62
+ width: 100%;
63
+ margin-bottom: 20px;
64
+ }
65
+
66
+ .btn {
67
+ background: #333;
68
+ color: white;
69
+ padding: 10px 20px;
70
+ border: none;
71
+ border-radius: 6px;
72
+ font-size: 14px;
73
+ font-weight: 500;
74
+ cursor: pointer;
75
+ transition: background 0.2s ease;
76
+ margin-right: 8px;
77
+ margin-bottom: 8px;
78
+ }
79
+
80
+ .btn:hover {
81
+ background: #555;
82
+ }
83
+
84
+ .section {
85
+ margin-bottom: 24px;
86
+ padding: 20px;
87
+ background: #f9f9f9;
88
+ border-radius: 6px;
89
+ }
90
+
91
+ .section h3 {
92
+ font-size: 16px;
93
+ font-weight: 600;
94
+ color: #333;
95
+ margin-bottom: 12px;
96
+ }
97
+
98
+ input[type="text"], input[type="number"] {
99
+ padding: 10px 14px;
100
+ border: 1px solid #ddd;
101
+ border-radius: 6px;
102
+ font-size: 14px;
103
+ outline: none;
104
+ width: 200px;
105
+ }
106
+
107
+ input:focus {
108
+ border-color: #333;
109
+ }
110
+
111
+ .input-group {
112
+ display: flex;
113
+ align-items: center;
114
+ gap: 12px;
115
+ margin-bottom: 12px;
116
+ }
117
+
118
+ .input-group label {
119
+ font-size: 14px;
120
+ color: #555;
121
+ min-width: 80px;
122
+ }
123
+
124
+ .share-link {
125
+ padding: 12px;
126
+ background: #f0f0f0;
127
+ border-radius: 6px;
128
+ font-size: 13px;
129
+ color: #666;
130
+ word-break: break-all;
131
+ margin-bottom: 12px;
132
+ }
133
+
134
+ .user-list {
135
+ list-style: none;
136
+ max-height: 200px;
137
+ overflow-y: auto;
138
+ }
139
+
140
+ .user-item {
141
+ display: flex;
142
+ align-items: center;
143
+ gap: 12px;
144
+ padding: 10px;
145
+ border-bottom: 1px solid #eee;
146
+ }
147
+
148
+ .user-item:last-child {
149
+ border-bottom: none;
150
+ }
151
+
152
+ .user-avatar {
153
+ width: 40px;
154
+ height: 40px;
155
+ border-radius: 50%;
156
+ object-fit: cover;
157
+ }
158
+
159
+ .user-name {
160
+ font-size: 14px;
161
+ color: #333;
162
+ }
163
+
164
+ .track-list {
165
+ list-style: none;
166
+ max-height: 300px;
167
+ overflow-y: auto;
168
+ }
169
+
170
+ .track-item {
171
+ display: flex;
172
+ align-items: center;
173
+ gap: 12px;
174
+ padding: 10px;
175
+ border-bottom: 1px solid #eee;
176
+ cursor: pointer;
177
+ transition: background 0.2s ease;
178
+ }
179
+
180
+ .track-item:hover {
181
+ background: #f5f5f5;
182
+ }
183
+
184
+ .track-item:last-child {
185
+ border-bottom: none;
186
+ }
187
+
188
+ .track-cover {
189
+ width: 40px;
190
+ height: 40px;
191
+ border-radius: 4px;
192
+ object-fit: cover;
193
+ }
194
+
195
+ .track-name {
196
+ font-size: 14px;
197
+ color: #333;
198
+ }
199
+
200
+ details {
201
+ cursor: pointer;
202
+ }
203
+
204
+ details summary {
205
+ font-size: 14px;
206
+ font-weight: 500;
207
+ color: #555;
208
+ padding: 8px 0;
209
+ }
210
+
211
+ details summary:hover {
212
+ color: #333;
213
+ }
214
+
215
+ details[open] summary {
216
+ margin-bottom: 12px;
217
+ }
218
+
219
+ .control-buttons {
220
+ display: flex;
221
+ flex-wrap: wrap;
222
+ gap: 8px;
223
+ }
224
+ </style>
15
225
  </head>
16
226
 
17
- <body class="mdui-container">
18
- <div>
19
- <a href="/qrlogin.html"> 如果没登录,请先登录 </a>
20
- </div>
227
+ <body class="container">
228
+ <a href="/qrlogin.html" class="login-link">还没登录?点击登录</a>
229
+
21
230
  <h1>一起听 - 主机模式</h1>
22
- <div>消息: {{message}}</div>
23
- <audio id="player" autoplay controls></audio>
24
- <br />
25
- <br />
26
- <button v-if="!account.login" @click="login">获取登录状态</button>
27
- <div>您的当前登录账号为: {{account.nickname}}</div>
28
- <br />
29
- <div v-if="account.login">
30
- <button v-if="!roomInfo.roomId" @click="createRoom">创建房间</button>
231
+
232
+ <div class="message">消息: {{message}}</div>
233
+
234
+ <audio id="player" class="audio-player" autoplay controls></audio>
235
+
236
+ <div v-if="!account.login">
237
+ <button class="btn" @click="login">获取登录状态</button>
238
+ </div>
239
+
240
+ <div class="section">
241
+ <h3>账号信息</h3>
242
+ <div>当前登录账号: {{account.nickname}}</div>
243
+ </div>
244
+
245
+ <div v-if="account.login" class="section">
246
+ <h3>房间管理</h3>
247
+ <div class="control-buttons">
248
+ <button v-if="!roomInfo.roomId" class="btn" @click="createRoom">创建房间</button>
249
+ </div>
250
+
31
251
  <details>
32
252
  <summary>加入房间</summary>
33
- <div><span>房间ID: </span><input v-model="roomInfo.roomId" /></div>
34
- <div>
35
- <span>邀请者 ID: </span><input v-model="roomInfo.inviterId" />
253
+ <div class="input-group">
254
+ <label>房间ID:</label>
255
+ <input v-model="roomInfo.roomId" type="text" />
256
+ </div>
257
+ <div class="input-group">
258
+ <label>邀请者ID:</label>
259
+ <input v-model="roomInfo.inviterId" type="text" />
36
260
  </div>
37
- <button @click="joinRoom">点击加入</button>
261
+ <button class="btn" @click="joinRoom">加入房间</button>
38
262
  </details>
39
263
 
40
- <div v-if="roomInfo.roomId">
41
- <div>
42
- 分享链接为:
264
+ <div v-if="roomInfo.roomId" style="margin-top: 16px;">
265
+ <h4>分享链接</h4>
266
+ <div class="share-link">
43
267
  https://st.music.163.com/listen-together/share/?songId=1372188635&roomId={{roomInfo.roomId}}&inviterId={{roomInfo.inviterId}}
44
268
  </div>
45
- <br />
46
- <button @click="refreshRoom">刷新房间状态</button>
47
- <div>在线用户:</div>
48
- <ul class="mdui-list">
49
- <li
50
- v-for="user in roomInfo.roomUsers"
51
- class="mdui-list-item mdui-ripple"
52
- >
53
- <div class="mdui-list-item-avatar">
54
- <img :src="user.avatarUrl" />
55
- </div>
56
- <div class="mdui-list-item-content">{{user.nickname}}</div>
269
+ <button class="btn" @click="refreshRoom">刷新房间状态</button>
270
+ <button class="btn" @click="closeRoom">关闭房间</button>
271
+
272
+ <h4 style="margin-top: 16px;">在线用户</h4>
273
+ <ul class="user-list">
274
+ <li v-for="user in roomInfo.roomUsers" :key="user.userId" class="user-item">
275
+ <img :src="user.avatarUrl" class="user-avatar" alt="avatar" />
276
+ <span class="user-name">{{user.nickname}}</span>
57
277
  </li>
58
278
  </ul>
59
- <button v-if="roomInfo.roomId" @click="closeRoom">关闭房间</button>
60
279
  </div>
61
280
  </div>
62
- <button @click="playTrack">播放</button>
63
- <button @click="pauseTrack">暂停</button>
64
- <button @click="seekTrack">同步进度</button>
281
+
282
+ <div class="section">
283
+ <h3>播放控制</h3>
284
+ <div class="control-buttons">
285
+ <button class="btn" @click="playTrack">播放</button>
286
+ <button class="btn" @click="pauseTrack">暂停</button>
287
+ <button class="btn" @click="seekTrack">同步进度</button>
288
+ </div>
289
+ </div>
290
+
65
291
  <details>
66
292
  <summary>播放列表</summary>
67
- <br />
68
- <div>
69
- <span>歌单ID: </span><input v-model="playlistInfo.playlistId" />
293
+ <div class="section">
294
+ <div class="input-group">
295
+ <label>歌单ID:</label>
296
+ <input v-model="playlistInfo.playlistId" type="text" />
297
+ </div>
298
+ <button class="btn" @click="loadPlaylist">加载歌单</button>
299
+ <div style="margin-top: 12px; font-size: 14px; color: #555;">
300
+ 歌单名称: {{playlistInfo.playlistName}}
301
+ </div>
302
+
303
+ <h4 style="margin-top: 16px;">歌单内容</h4>
304
+ <ul class="track-list">
305
+ <li
306
+ @click="gotoTrack(track.id)"
307
+ v-for="track in playlistInfo.playlistTracks"
308
+ :key="track.id"
309
+ class="track-item"
310
+ >
311
+ <img :src="track.al.picUrl" class="track-cover" alt="cover" />
312
+ <span class="track-name">{{track.name}}</span>
313
+ </li>
314
+ </ul>
70
315
  </div>
71
- <button @click="loadPlaylist">加载歌单到播放列表</button>
72
- <span>{{playlistInfo.playlistName}}</span>
73
- <br />
74
- <br />
75
- <div>歌单内容:</div>
76
- <ul class="mdui-list">
77
- <li
78
- @click="gotoTrack(track.id)"
79
- v-for="track in playlistInfo.playlistTracks"
80
- class="mdui-list-item mdui-ripple"
81
- >
82
- <div class="mdui-list-item-avatar">
83
- <img :src="track.al.picUrl" />
84
- </div>
85
- <div class="mdui-list-item-content">{{track.name}}</div>
86
- </li>
87
- </ul>
88
316
  </details>
89
317
  </body>
318
+
90
319
  <script>
91
- const logger = require('../util/logger.js')
92
320
  PetiteVue.createApp({
93
321
  message: '请点击获取登录状态',
94
322
  account: {
@@ -127,7 +355,7 @@
127
355
  this.account.userId = res.data.data.profile.userId
128
356
  this.account.nickname = res.data.data.profile.nickname
129
357
  this.account.login = true
130
- this.message = '成功登录, 请创建房间'
358
+ this.message = '成功登录,请创建房间'
131
359
  }
132
360
  },
133
361
  joinRoom: async function () {
@@ -140,7 +368,7 @@
140
368
  cookie: localStorage.getItem('cookie'),
141
369
  },
142
370
  })
143
- logger.info(res)
371
+ console.info(res)
144
372
  if (res.data.code != 200) {
145
373
  this.message = '加入房间出现问题: ' + res.data.message
146
374
  } else {
@@ -153,7 +381,7 @@
153
381
  cookie: localStorage.getItem('cookie'),
154
382
  },
155
383
  })
156
- logger.info(res2)
384
+ console.info(res2)
157
385
  const res3 = await axios({
158
386
  url: 'listentogether/sync/playlist/get',
159
387
  method: 'post',
@@ -174,7 +402,7 @@
174
402
  cookie: localStorage.getItem('cookie'),
175
403
  },
176
404
  })
177
- logger.info(resa)
405
+ console.info(resa)
178
406
  this.playlistInfo.playlistTracks = resa.data.songs
179
407
  }
180
408
  },
@@ -186,7 +414,7 @@
186
414
  cookie: localStorage.getItem('cookie'),
187
415
  },
188
416
  })
189
- logger.info(res)
417
+ console.info(res)
190
418
  if (res.data.code != 200) {
191
419
  this.message = '创建房间出现问题: ' + res.data.message
192
420
  } else {
@@ -201,7 +429,7 @@
201
429
  cookie: localStorage.getItem('cookie'),
202
430
  },
203
431
  })
204
- logger.info(res2)
432
+ console.info(res2)
205
433
  }
206
434
  },
207
435
  refreshRoom: async function () {
@@ -211,9 +439,9 @@
211
439
  cookie: localStorage.getItem('cookie'),
212
440
  },
213
441
  })
214
- logger.info(res)
442
+ console.info(res)
215
443
  if (res.data.code != 200 || !res.data.data.inRoom) {
216
- this.message = '房间状态获取失败, 可能退出了房间'
444
+ this.message = '房间状态获取失败,可能退出了房间'
217
445
  } else {
218
446
  this.roomInfo.roomUsers = res.data.data.roomInfo.roomUsers
219
447
  }
@@ -227,7 +455,7 @@
227
455
  cookie: localStorage.getItem('cookie'),
228
456
  },
229
457
  })
230
- logger.info(res)
458
+ console.info(res)
231
459
  if (res.data.code != 200 || !res.data.data.success) {
232
460
  this.message = '房间关闭失败'
233
461
  } else {
@@ -244,7 +472,7 @@
244
472
  cookie: localStorage.getItem('cookie'),
245
473
  },
246
474
  })
247
- logger.info(res)
475
+ console.info(res)
248
476
  this.playlistInfo.playlistName = res.data.playlist.name
249
477
  this.playlistInfo.playlistTrackIds = res.data.playlist.trackIds
250
478
  .map((track) => track.id)
@@ -257,7 +485,7 @@
257
485
  cookie: localStorage.getItem('cookie'),
258
486
  },
259
487
  })
260
- logger.info(resa)
488
+ console.info(resa)
261
489
  this.playlistInfo.playlistTracks = resa.data.songs
262
490
  if (this.roomInfo.roomId) {
263
491
  const resb = await axios({
@@ -274,7 +502,7 @@
274
502
  cookie: localStorage.getItem('cookie'),
275
503
  },
276
504
  })
277
- logger.info(resb)
505
+ console.info(resb)
278
506
  }
279
507
  },
280
508
  gotoTrack: async function (trackId) {
@@ -317,7 +545,7 @@
317
545
  cookie: localStorage.getItem('cookie'),
318
546
  },
319
547
  })
320
- logger.info(res)
548
+ console.info(res)
321
549
  },
322
550
  }).mount()
323
551
  </script>