Merge remote-tracking branch 'origin/master'

This commit is contained in:
yoimiya-kokomi 2022-07-04 05:32:59 +08:00
commit b43a32b600
2 changed files with 10 additions and 4 deletions

View File

@ -128,7 +128,7 @@ let Profile = {
let data = Profile._get(uid, charId); let data = Profile._get(uid, charId);
let Serv = getServ(uid); let Serv = getServ(uid);
if (Serv.getCharData && data && data.id) { if (Serv.getCharData && data && data.id) {
return await Serv.getCharData(uid, data, Profile.saveCharData); return await Serv.getCharData(uid, data, Profile.saveCharData, { config });
} }
return data; return data;
}, },

View File

@ -5,7 +5,7 @@ import moment from "moment";
import { artiIdx, artiSetMap, attrMap } from "./miao-meta.js"; import { artiIdx, artiSetMap, attrMap } from "./miao-meta.js";
import cmeta from "./enka-char.js"; import cmeta from "./enka-char.js";
const url = "http://49.232.91.210/profile"; const url = "http://49.232.91.210/profile/detail?token=kokomi";
let Miao = { let Miao = {
key: "miao", key: "miao",
@ -63,12 +63,18 @@ let Miao = {
}; };
}, },
async getCharData(uid, ds, saveCharData) { async getCharData(uid, ds, saveCharData, { config = {} }) {
if (ds.dataSource !== "miao-pre" || !ds.id) { if (ds.dataSource !== "miao-pre" || !ds.id) {
return ds; return ds;
} }
try { try {
let api = `${url}/detail?uid=${uid}&avatar=${ds.id}`; let profileApi = function ({ uid, avatar }) {
return `http://49.232.91.210/profile/detail?uid=${uid}&avatar=${avatar}`
};
if (config.miaoApi && lodash.isFunction(config.miaoApi)) {
profileApi = config.miaoApi;
}
let api = profileApi({ uid, avatar: ds.id });
let req = await fetch(api); let req = await fetch(api);
let data = await req.json(); let data = await req.json();
if (data.status === 0 && data.uidData) { if (data.status === 0 && data.uidData) {