Skip to content

Commit

Permalink
[音乐盒] 更新Chimomo提供的云端歌曲API
Browse files Browse the repository at this point in the history
  • Loading branch information
happyme531 committed Aug 4, 2024
1 parent 4981814 commit bbf91a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions 楚留香音乐盒/src/cloud/chimomoApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ let axios = require('axios');

/**
* @typedef {Object} ChimomoApiFileEntry
* @property {number} id - 文件的唯一标识符
* @property {string} id - 文件的唯一标识符 (uuid)
* @property {string} name - MIDI文件的名称
* @property {string} url - MIDI文件的下载链接
* @property {string} type - 文件类型,貌似不影响使用
* @property {string} createdAt - 文件创建的日期和时间,格式为 'YYYY-MM-DD HH:mm:ss'
* @property {string} uploader - 上传者的名称
*/
Expand All @@ -23,7 +23,7 @@ let axios = require('axios');
*/

function ChimomoApi() {
const apiBase = "http://autoplay.chimomo.cn/api/v1/"
const apiBase = "https://autoplay.chimomo.cn/api/v1/"


/**
Expand All @@ -34,7 +34,7 @@ function ChimomoApi() {
* @param {(err: Error?, data: ChimomoApiMusicList?) => void} callback 回调函数
*/
this.fetchMusicList = function (pageNo, pageSize, keyword, callback) {
const url = `${apiBase}midi/list`;
const url = `${apiBase}/song/list`;
const params = {
pageNo,
pageSize,
Expand All @@ -59,11 +59,11 @@ function ChimomoApi() {

/**
* @brief 获取音乐文件
* @param {number} musicId 音乐ID
* @param {string} musicId 音乐ID
* @param {(err: Error?, data: import('@tonejs/midi').MidiJSON?) => void} callback 回调函数
*/
this.fetchMusicFileById = function (musicId, callback) {
const url = `${apiBase}midi/${musicId}`;
const url = `${apiBase}/song/${musicId}`;
let config = {
timeout: 5000
};
Expand Down
2 changes: 1 addition & 1 deletion 楚留香音乐盒/test/cloud/testChimomoApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('ChimomoApi', () => {
});

test('fetchMusicFileById', (t, done) => {
api.fetchMusicFileById(949, (err, data) => {
api.fetchMusicFileById('58a38ed3-f8b1-4a6b-a69a-1ca9048ed3d8', (err, data) => {
assert.strictEqual(err, null);
assert.notStrictEqual(data, undefined);
assert.ok(typeof data === 'object');
Expand Down

0 comments on commit bbf91a7

Please sign in to comment.