Skip to content

Commit

Permalink
perf: 更换静态图链接不使用通用反代
Browse files Browse the repository at this point in the history
  • Loading branch information
XasYer committed Dec 2, 2024
1 parent dbe76e6 commit cd2cbdb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
6 changes: 3 additions & 3 deletions apps/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export const rule = {
const color = info.gameid ? 1 : info.personastate === 0 ? 3 : 2
const bg = await api.IPlayerService.GetProfileItemsEquipped(steamId)
const img = await Render.render('info/index', {
background: await utils.saveImg(utils.getStaticUrl(bg.mini_profile_background.image_large)),
frame: await utils.saveImg(utils.getStaticUrl(bg.avatar_frame.image_small)),
avatar: await utils.saveImg(Config.other.steamAvatar ? info.avatarfull : await utils.getUserAvatar(e.self_id, uid, e.group_id)),
background: utils.getStaticUrl(bg.mini_profile_background.image_large),
frame: utils.getStaticUrl(bg.avatar_frame.image_small),
avatar: Config.other.steamAvatar ? info.avatarfull : await utils.getUserAvatar(e.self_id, uid, e.group_id),
name: info.personaname,
status: utils.getPersonaState(info.personastate),
gameId: info.gameid,
Expand Down
3 changes: 2 additions & 1 deletion components/Render.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ const Render = {
copyright: params.copyright || `Created By <span class="version"> ${Version.BotName} v${Version.BotVersion} </span> & <span class="version"> ${Version.pluginName} v${Version.pluginVersion} </span>`
},
pageGotoParams: {
waitUntil: 'networkidle0' // +0.5s
// waitUntil: 'networkidle0' // +0.5s
waitUntil: 'load'
},
...params
}
Expand Down
4 changes: 3 additions & 1 deletion models/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ export async function sendGroupMsg (botId, gid, msg) {
*/
export function getHeaderImgUrlByAppid (appid) {
if (!appid) return ''
// return `https://shared.akamai.steamstatic.com/store_item_assets/steam/apps/${appid}/header.jpg`
return `https://steamcdn-a.akamaihd.net/steam/apps/${appid}/header.jpg`
}

Expand All @@ -207,7 +208,8 @@ export function getHeaderImgUrlByAppid (appid) {
*/
export function getStaticUrl (path) {
if (path?.startsWith('items')) {
return `https://cdn.fastly.steamstatic.com/steamcommunity/public/images/${path}`
// return `https://cdn.fastly.steamstatic.com/steamcommunity/public/images/${path}`
return `https://steamcdn-a.akamaihd.net/steamcommunity/public/images/${path}`
}
return ''
}
Expand Down
7 changes: 1 addition & 6 deletions models/utils/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@ export default async function request (url, options = {}) {
return url
}
})()
const baseURL = (() => {
if (options.baseURL && options.baseURL.includes('steam') && Config.steam.commonProxy) {
return Config.steam.commonProxy.replace('{{url}}', options.baseURL)
}
return options.baseURL ?? steamApi
})()
const baseURL = options.baseURL ?? steamApi
return await axios.request({
url,
baseURL,
Expand Down

0 comments on commit cd2cbdb

Please sign in to comment.