mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-31 06:23:08 +02:00
Merge main into proxy branch (formatting and docs)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "@yaak/auth-apikey",
|
||||
"displayName": "API Key Authentication",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "Authenticate requests using an API key",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mountain-loop/yaak.git",
|
||||
"directory": "plugins/auth-apikey"
|
||||
},
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"scripts": {
|
||||
"build": "yaakcli build",
|
||||
"dev": "yaakcli dev"
|
||||
|
||||
@@ -1,51 +1,51 @@
|
||||
import type { PluginDefinition } from '@yaakapp/api';
|
||||
import type { PluginDefinition } from "@yaakapp/api";
|
||||
|
||||
export const plugin: PluginDefinition = {
|
||||
authentication: {
|
||||
name: 'apikey',
|
||||
label: 'API Key',
|
||||
shortLabel: 'API Key',
|
||||
name: "apikey",
|
||||
label: "API Key",
|
||||
shortLabel: "API Key",
|
||||
args: [
|
||||
{
|
||||
type: 'select',
|
||||
name: 'location',
|
||||
label: 'Behavior',
|
||||
defaultValue: 'header',
|
||||
type: "select",
|
||||
name: "location",
|
||||
label: "Behavior",
|
||||
defaultValue: "header",
|
||||
options: [
|
||||
{ label: 'Insert Header', value: 'header' },
|
||||
{ label: 'Append Query Parameter', value: 'query' },
|
||||
{ label: "Insert Header", value: "header" },
|
||||
{ label: "Append Query Parameter", value: "query" },
|
||||
],
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
name: 'key',
|
||||
label: 'Key',
|
||||
type: "text",
|
||||
name: "key",
|
||||
label: "Key",
|
||||
dynamic: (_ctx, { values }) => {
|
||||
return values.location === 'query'
|
||||
return values.location === "query"
|
||||
? {
|
||||
label: 'Parameter Name',
|
||||
description: 'The name of the query parameter to add to the request',
|
||||
label: "Parameter Name",
|
||||
description: "The name of the query parameter to add to the request",
|
||||
}
|
||||
: {
|
||||
label: 'Header Name',
|
||||
description: 'The name of the header to add to the request',
|
||||
label: "Header Name",
|
||||
description: "The name of the header to add to the request",
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
name: 'value',
|
||||
label: 'API Key',
|
||||
type: "text",
|
||||
name: "value",
|
||||
label: "API Key",
|
||||
optional: true,
|
||||
password: true,
|
||||
},
|
||||
],
|
||||
async onApply(_ctx, { values }) {
|
||||
const key = String(values.key ?? '');
|
||||
const value = String(values.value ?? '');
|
||||
const key = String(values.key ?? "");
|
||||
const value = String(values.value ?? "");
|
||||
const location = String(values.location);
|
||||
|
||||
if (location === 'query') {
|
||||
if (location === "query") {
|
||||
return { setQueryParameters: [{ name: key, value }] };
|
||||
}
|
||||
return { setHeaders: [{ name: key, value }] };
|
||||
|
||||
Reference in New Issue
Block a user