|
|
|
@ -17,16 +17,18 @@ module.exports = {
|
|
|
|
|
if (parseInt(current, 10) === 120) {
|
|
|
|
|
await meta.configs.set('topicThumbSize', 512);
|
|
|
|
|
}
|
|
|
|
|
await meta.configs.set('allowTopicsThumbnail', 1);
|
|
|
|
|
|
|
|
|
|
await batch.processSortedSet('topics:tid', async function (tids) {
|
|
|
|
|
const keys = tids.map(tid => `topic:${tid}`);
|
|
|
|
|
const topicThumbs = (await db.getObjectsFields(keys, ['thumb'])).map(obj => (obj.thumb ? obj.thumb.replace(nconf.get('upload_url'), '') : null));
|
|
|
|
|
const topicThumbs = (await db.getObjectsFields(keys, ['thumb']))
|
|
|
|
|
.map(obj => (obj.thumb ? obj.thumb.replace(nconf.get('upload_url'), '') : null));
|
|
|
|
|
|
|
|
|
|
await Promise.all(tids.map(async (tid, idx) => {
|
|
|
|
|
const path = topicThumbs[idx];
|
|
|
|
|
if (path) {
|
|
|
|
|
await topics.thumbs.associate({ id: tid, path });
|
|
|
|
|
if (path.length < 255 && !path.startsWith('data:')) {
|
|
|
|
|
await topics.thumbs.associate({ id: tid, path });
|
|
|
|
|
}
|
|
|
|
|
await db.deleteObjectField(keys[idx], 'thumb');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|