mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-11 20:00:29 +01:00
A few tweaks
This commit is contained in:
8
package-lock.json
generated
8
package-lock.json
generated
@@ -9,7 +9,7 @@
|
||||
"plugins/*"
|
||||
],
|
||||
"dependencies": {
|
||||
"@yaakapp/api": "^0.2.29"
|
||||
"@yaakapp/api": "^0.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.7.4",
|
||||
@@ -1013,9 +1013,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@yaakapp/api": {
|
||||
"version": "0.2.29",
|
||||
"resolved": "https://registry.npmjs.org/@yaakapp/api/-/api-0.2.29.tgz",
|
||||
"integrity": "sha512-RuyWRUGhYIQjFmaZTYuAekSkidl0b9rWcTV1l+Hs5Pw+LUv8+euedAvNodEJgxAgy42btUns7QUmdM5YNvgoug==",
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@yaakapp/api/-/api-0.3.0.tgz",
|
||||
"integrity": "sha512-A2msKEiqVIOdqn2q9oVXT69aJ7EwrbwNZ6gdrvqTqeTERLddRtO0OKj6wYUUpiqbGr1QY8Byu4BzHclp/aYHWw==",
|
||||
"dependencies": {
|
||||
"@types/node": "^22.5.4"
|
||||
}
|
||||
|
||||
@@ -19,6 +19,6 @@
|
||||
"workspaces-run": "^1.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@yaakapp/api": "^0.2.29"
|
||||
"@yaakapp/api": "^0.3.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,32 +29,34 @@ export const plugin: PluginDefinition = {
|
||||
type: 'select',
|
||||
name: 'algorithm',
|
||||
label: 'Algorithm',
|
||||
hideLabel: true,
|
||||
defaultValue: defaultAlgorithm,
|
||||
options: algorithms.map(value => ({ name: value === 'none' ? 'None' : value, value })),
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
name: 'secret',
|
||||
label: 'Secret',
|
||||
label: 'Secret or Private Key',
|
||||
optional: true,
|
||||
},
|
||||
{
|
||||
type: 'checkbox',
|
||||
name: 'secretBase64',
|
||||
label: 'Secret Base64 Encoded',
|
||||
label: 'Secret is base64 encoded',
|
||||
},
|
||||
{
|
||||
type: 'editor',
|
||||
name: 'payload',
|
||||
label: 'Payload',
|
||||
language: 'json',
|
||||
optional: true,
|
||||
defaultValue: '{\n "foo": "bar"\n}',
|
||||
placeholder: '{ }',
|
||||
},
|
||||
],
|
||||
async onApply(_ctx, args) {
|
||||
const { algorithm, secret: _secret, secretBase64, payload } = args.config;
|
||||
const secret = secretBase64 ? Buffer.from(`${_secret}`, 'base64') : `${_secret}`;
|
||||
const token = secret ? jwt.sign(`${payload}`, secret, { algorithm: algorithm as any }) : jwt.sign(`${payload}`, null);
|
||||
const token = jwt.sign(`${payload}`, secret, { algorithm: algorithm as any });
|
||||
const value = `Bearer ${token}`;
|
||||
return { setHeaders: [{ name: 'Authorization', value }] };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user