mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-30 12:34:15 +02:00
Add .oxfmtignore to skip generated bindings and wasm-pack output. Add npm format script, update DEVELOPMENT.md for Vite+ toolchain, and format all non-generated files with oxfmt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import type { PluginDefinition } from "@yaakapp/api";
|
|
import type { CallHttpAuthenticationRequest } from "@yaakapp-internal/plugins";
|
|
|
|
export const plugin: PluginDefinition = {
|
|
authentication: {
|
|
name: "bearer",
|
|
label: "Bearer Token",
|
|
shortLabel: "Bearer",
|
|
args: [
|
|
{
|
|
type: "text",
|
|
name: "token",
|
|
label: "Token",
|
|
optional: true,
|
|
password: true,
|
|
},
|
|
{
|
|
type: "text",
|
|
name: "prefix",
|
|
label: "Prefix",
|
|
optional: true,
|
|
placeholder: "",
|
|
defaultValue: "Bearer",
|
|
description:
|
|
'The prefix to use for the Authorization header, which will be of the format "<PREFIX> <TOKEN>".',
|
|
},
|
|
],
|
|
async onApply(_ctx, { values }) {
|
|
return { setHeaders: [generateAuthorizationHeader(values)] };
|
|
},
|
|
},
|
|
};
|
|
|
|
function generateAuthorizationHeader(values: CallHttpAuthenticationRequest["values"]) {
|
|
const token = String(values.token || "").trim();
|
|
const prefix = String(values.prefix || "").trim();
|
|
const value = `${prefix} ${token}`.trim();
|
|
return { name: "Authorization", value };
|
|
}
|