Prevent double scaling on home thumbnails

This commit is contained in:
2026-06-01 13:35:45 +08:00
parent faec1140e7
commit ac8e88fe66
2 changed files with 203 additions and 174 deletions

View File

@@ -256,8 +256,8 @@ const cacheFakeDocument = {
addEventListener() {},
};
const cacheStore = new Map([
["tm-thumb-scale:size-cache:v9", JSON.stringify({
schema: 9,
["tm-thumb-scale:size-cache:v11", JSON.stringify({
schema: 11,
scale: 2,
cardHeightScale: 1.55,
modules: {
@@ -350,15 +350,17 @@ vm.runInNewContext(source, {
localStorage: {
getItem() {
return JSON.stringify({
schema: 9,
schema: 11,
scale: 2,
cardHeightScale: 1.55,
modules: {
home: {
homeCard: { width: 174, height: 120 },
homeThumb: { width: 174, height: 98 },
},
followingList: {
followingListCard: { width: 190, height: 120 },
followingListThumb: { width: 188, height: 106 },
},
},
});
@@ -385,7 +387,7 @@ vm.runInNewContext(source, {
assert.equal(followingAttrs.get("data-tm-thumb-scale-following-list"), "1", "followed-cams should use its own cached list module");
assert.equal(followingAttrs.get("data-tm-thumb-scale-home"), undefined, "followed-cams should not apply homepage cache");
assert.equal(followingVars.get("--tm-thumb-following-list-width"), "380px");
assert.equal(followingVars.get("--tm-thumb-following-list-card-height"), undefined);
assert.equal(followingVars.get("--tm-thumb-following-list-card-height"), "226px");
assert.equal(followingVars.get("--tm-thumb-following-list-thumb-width"), undefined);
assert.equal(followingVars.get("--tm-thumb-following-list-thumb-height"), undefined);
assert.equal(followingVars.get("--tm-thumb-following-list-thumb-height"), "212px");
assert.equal(followingVars.get("--tm-thumb-home-width"), undefined);