diff --git a/apps/info.js b/apps/info.js index a4c6dca..bd8a5af 100644 --- a/apps/info.js +++ b/apps/info.js @@ -1,6 +1,6 @@ import moment from 'moment' import { segment } from '#lib' -import { App } from '#components' +import { App, Config } from '#components' import { db, utils, api } from '#models' const app = { @@ -26,7 +26,7 @@ export const rule = { return true } const info = data.pop() - const avatarBuffer = await utils.getImgUrlBuffer(info.avatarfull) + const avatarBuffer = Config.other.steamAvatar ? await utils.getImgUrlBuffer(info.avatarfull) : '' const msg = [] avatarBuffer && msg.push(segment.image(avatarBuffer)) msg.push([ diff --git a/components/Config.js b/components/Config.js index 8046740..eb5e4aa 100644 --- a/components/Config.js +++ b/components/Config.js @@ -104,7 +104,9 @@ class Config { * 获取其他配置 * @returns {{ * renderScale: number, - * hiddenLength: number + * hiddenLength: number, + * itemLength: number, + * steamAvatar: boolean, * }} */ get other () { diff --git a/components/Render.js b/components/Render.js index db48386..1ca7255 100644 --- a/components/Render.js +++ b/components/Render.js @@ -34,7 +34,7 @@ const Render = { Math.max(1, Number(Config.other.itemLength) || 1) ) const size = params.data.findIndex(i => i.size === 'large') >= 0 ? 370 : 300 - const len = minLength === 1 ? (size === 370 ? 1 : 1.4) : minLength + const len = minLength === 1 ? 1.4 : minLength data.style = `` } return await puppeteer.screenshot(path, data) diff --git a/config/default_config/other.yaml b/config/default_config/other.yaml index 9a1eaee..f333a6f 100644 --- a/config/default_config/other.yaml +++ b/config/default_config/other.yaml @@ -7,3 +7,6 @@ hiddenLength: 99 # 截图时每行显示的最大数量 itemLength: 3 + +# 是否显示Steam头像 可能会有18+的头像 +steamAvatar: false diff --git a/models/setting/index.js b/models/setting/index.js index c349c96..6300859 100644 --- a/models/setting/index.js +++ b/models/setting/index.js @@ -167,6 +167,13 @@ export const cfgSchema = { def: 3, input: (n) => Math.max(1, n * 1 || 3), desc: '截图时每行最多显示的数量' + }, + steamAvatar: { + title: '展示steam头像', + key: '展示头像', + type: 'boolean', + def: false, + desc: '是否展示steam头像, 可能会有18+头像' } } },