This commit is contained in:
seb
2026-08-01 01:36:49 +02:00
parent 243143e7eb
commit 671064bf3f
9 changed files with 181 additions and 5 deletions

View File

@@ -127,6 +127,21 @@ const MENU = {
},
],
},
pic: {
label: 'pic',
items: [
{
value: 'pic.getImageByHash',
label: 'getImageByHash',
hint: 'googleAuthId, hash → meta',
},
{
value: 'pic.getThumbByHash',
label: 'getThumbByHash',
hint: 'googleAuthId, hash → meta',
},
],
},
companyuser: {
label: 'companyuser',
items: [
@@ -443,6 +458,43 @@ async function runMethod(client, action) {
await client.article.addImage(Number(googleAuthId), sku, image),
];
}
case 'pic.getImageByHash': {
const googleAuthId = await askInt('google_auth id');
if (googleAuthId == null) return;
const hash = await askText('hash (SHA-256 hex)', {
validate: (v) => (!v?.trim() ? 'Required' : undefined),
});
if (hash == null) return;
const image = await client.pic.getImageByHash(Number(googleAuthId), hash.trim());
return [
'result',
{
w: image.w,
h: image.h,
size: image.size,
contentType: image.contentType,
bufferLength: image.buffer.length,
},
];
}
case 'pic.getThumbByHash': {
const googleAuthId = await askInt('google_auth id');
if (googleAuthId == null) return;
const hash = await askText('hash (SHA-256 hex)', {
validate: (v) => (!v?.trim() ? 'Required' : undefined),
});
if (hash == null) return;
const image = await client.pic.getThumbByHash(Number(googleAuthId), hash.trim());
return [
'result',
{
w: image.w,
h: image.h,
contentType: image.contentType,
bufferLength: image.buffer.length,
},
];
}
case 'companyuser.add': {
const companyId = await askInt('Company id');
if (companyId == null) return;