u
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user