This commit is contained in:
@@ -28,7 +28,7 @@ export class AssetManager {
|
||||
private MAX = 300;
|
||||
private approximateSize = 0;
|
||||
|
||||
private async getAssetList() {
|
||||
async getAssetList(): Promise<string[]> {
|
||||
const [avatars, weapons, relics, pfps, namecards] = await batchStore(
|
||||
"avatars",
|
||||
"weapons",
|
||||
@@ -50,7 +50,7 @@ export class AssetManager {
|
||||
(p) => p.IconPath /* .replace("_Circle", "") */,
|
||||
),
|
||||
...Object.values(namecards).map((p) => p.Icon),
|
||||
];
|
||||
].filter((e) => e !== "None");
|
||||
}
|
||||
|
||||
async getMissingAssets() {
|
||||
|
||||
@@ -77,6 +77,26 @@ export function card(app: App) {
|
||||
.derive(() => ({
|
||||
log: createLogger(),
|
||||
}))
|
||||
.get(
|
||||
"/genshin/stats",
|
||||
async ({ query: { with_assets } }) => {
|
||||
return {
|
||||
cache: assets.health,
|
||||
assets:
|
||||
with_assets === "" || with_assets === "true"
|
||||
? await assets.getAssetList()
|
||||
: "Add ?with_assets to include this array. Refer to /docs for documentation",
|
||||
};
|
||||
},
|
||||
{
|
||||
query: t.Object({
|
||||
with_assets: t.String({ default: "false" }),
|
||||
}),
|
||||
detail: {
|
||||
description: "Return stats related to cache",
|
||||
},
|
||||
},
|
||||
)
|
||||
.get("/genshin/diff", DiffPage)
|
||||
.get("/genshin/diff/ororo.png", () => file(DiffPageExample))
|
||||
.get("/genshin/diff/listoriginal.webp", () => file(ListDiffExample))
|
||||
|
||||
Reference in New Issue
Block a user