mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-05-06 07:53:52 +02:00
Compare commits
1 Commits
v2025.10.0
...
copilot/cr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0cb42dedc9 |
@@ -1,22 +0,0 @@
|
||||
# Project Rules
|
||||
|
||||
## General Development
|
||||
- **NEVER** commit or push without explicit confirmation
|
||||
|
||||
## Build and Lint
|
||||
- **ALWAYS** run `npm run lint` after modifying TypeScript or JavaScript files
|
||||
- Run `npm run bootstrap` after changing plugin runtime or MCP server code
|
||||
|
||||
## Plugin System
|
||||
|
||||
### Backend Constraints
|
||||
- Always use `UpdateSource::Plugin` when calling database methods from plugin events
|
||||
- Never send timestamps (`createdAt`, `updatedAt`) from TypeScript - Rust backend controls these
|
||||
- Backend uses `NaiveDateTime` (no timezone) so avoid sending ISO timestamp strings
|
||||
|
||||
### MCP Server
|
||||
- MCP server has **no active window context** - cannot call `window.workspaceId()`
|
||||
- Get workspace ID from `workspaceCtx.yaak.workspace.list()` instead
|
||||
|
||||
## Rust Type Generation
|
||||
- Run `cd src-tauri && cargo test --package yaak-plugins` to regenerate TypeScript bindings after modifying Rust event types
|
||||
@@ -1,50 +0,0 @@
|
||||
---
|
||||
name: Yaak:generate-release-notes
|
||||
description: Generate formatted release notes for Yaak releases by analyzing git history and pull request descriptions
|
||||
---
|
||||
|
||||
# Release Notes Generator
|
||||
|
||||
Generate formatted release notes for Yaak releases by analyzing git history and pull request descriptions.
|
||||
|
||||
## Usage
|
||||
|
||||
You can invoke this skill by:
|
||||
1. Providing a version number: "Generate release notes for 2025.10.0-beta.6"
|
||||
2. Using "latest" to generate notes for the most recent tag
|
||||
|
||||
## What this skill does
|
||||
|
||||
1. Identifies the version tag and previous version
|
||||
2. Retrieves all commits between versions
|
||||
3. Fetches PR descriptions for linked issues to find:
|
||||
- Feedback URLs (feedback.yaak.app)
|
||||
- Additional context and descriptions
|
||||
- Installation links for plugins
|
||||
4. Formats the release notes using the standard Yaak format:
|
||||
- Changelog badge at the top
|
||||
- Bulleted list of changes with PR links
|
||||
- Feedback links where available
|
||||
- Full changelog comparison link at the bottom
|
||||
|
||||
## Output Format
|
||||
|
||||
The skill generates markdown-formatted release notes following this structure:
|
||||
|
||||
```markdown
|
||||
[](https://yaak.app/changelog/VERSION)
|
||||
|
||||
- Feature/fix description in [#123](https://github.com/mountain-loop/yaak/pull/123)
|
||||
- Additional context if needed
|
||||
- [Linked feedback item](https://feedback.yaak.app/p/item) in [#456](https://github.com/mountain-loop/yaak/pull/456)
|
||||
|
||||
**Full Changelog**: https://github.com/mountain-loop/yaak/compare/vPREV...vCURRENT
|
||||
```
|
||||
|
||||
**IMPORTANT**: Always add a blank line after the closing ``` markdown fence before any explanatory text.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Git repository must be available
|
||||
- GitHub CLI (`gh`) must be installed and authenticated
|
||||
- Version tags should follow the format: `v2025.10.0-beta.X`
|
||||
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -1,7 +1,5 @@
|
||||
src-tauri/vendored/**/* linguist-generated=true
|
||||
src-tauri/gen/schemas/**/* linguist-generated=true
|
||||
**/bindings/* linguist-generated=true
|
||||
src-tauri/yaak-templates/pkg/* linguist-generated=true
|
||||
|
||||
# Ensure consistent line endings for test files that check exact content
|
||||
src-tauri/yaak-http/tests/test.txt text eol=lf
|
||||
|
||||
50
.github/workflows/claude.yml
vendored
50
.github/workflows/claude.yml
vendored
@@ -1,50 +0,0 @@
|
||||
name: Claude Code
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
pull_request_review_comment:
|
||||
types: [created]
|
||||
issues:
|
||||
types: [opened, assigned]
|
||||
pull_request_review:
|
||||
types: [submitted]
|
||||
|
||||
jobs:
|
||||
claude:
|
||||
if: |
|
||||
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
|
||||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
|
||||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
|
||||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
issues: read
|
||||
id-token: write
|
||||
actions: read # Required for Claude to read CI results on PRs
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Run Claude Code
|
||||
id: claude
|
||||
uses: anthropics/claude-code-action@v1
|
||||
with:
|
||||
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
|
||||
|
||||
# This is an optional setting that allows Claude to read CI results on PRs
|
||||
additional_permissions: |
|
||||
actions: read
|
||||
|
||||
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
|
||||
# prompt: 'Update the pull request description to include a summary of changes.'
|
||||
|
||||
# Optional: Add claude_args to customize behavior and configuration
|
||||
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
|
||||
# or https://code.claude.com/docs/en/cli-reference for available options
|
||||
# claude_args: '--allowed-tools Bash(gh pr:*)'
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
<p align="center">
|
||||
<!-- sponsors-premium --><a href="https://github.com/MVST-Solutions"><img src="https://github.com/MVST-Solutions.png" width="80px" alt="User avatar: MVST-Solutions" /></a> <a href="https://github.com/dharsanb"><img src="https://github.com/dharsanb.png" width="80px" alt="User avatar: dharsanb" /></a> <a href="https://github.com/railwayapp"><img src="https://github.com/railwayapp.png" width="80px" alt="User avatar: railwayapp" /></a> <a href="https://github.com/caseyamcl"><img src="https://github.com/caseyamcl.png" width="80px" alt="User avatar: caseyamcl" /></a> <a href="https://github.com/bytebase"><img src="https://github.com/bytebase.png" width="80px" alt="User avatar: bytebase" /></a> <a href="https://github.com/"><img src="https://raw.githubusercontent.com/JamesIves/github-sponsors-readme-action/dev/.github/assets/placeholder.png" width="80px" alt="User avatar: " /></a> <!-- sponsors-premium -->
|
||||
<!-- sponsors-premium --><a href="https://github.com/MVST-Solutions"><img src="https://github.com/MVST-Solutions.png" width="80px" alt="User avatar: MVST-Solutions" /></a> <a href="https://github.com/dharsanb"><img src="https://github.com/dharsanb.png" width="80px" alt="User avatar: dharsanb" /></a> <a href="https://github.com/railwayapp"><img src="https://github.com/railwayapp.png" width="80px" alt="User avatar: railwayapp" /></a> <a href="https://github.com/caseyamcl"><img src="https://github.com/caseyamcl.png" width="80px" alt="User avatar: caseyamcl" /></a> <a href="https://github.com/"><img src="https://raw.githubusercontent.com/JamesIves/github-sponsors-readme-action/dev/.github/assets/placeholder.png" width="80px" alt="User avatar: " /></a> <!-- sponsors-premium -->
|
||||
</p>
|
||||
<p align="center">
|
||||
<!-- sponsors-base --><a href="https://github.com/seanwash"><img src="https://github.com/seanwash.png" width="50px" alt="User avatar: seanwash" /></a> <a href="https://github.com/jerath"><img src="https://github.com/jerath.png" width="50px" alt="User avatar: jerath" /></a> <a href="https://github.com/itsa-sh"><img src="https://github.com/itsa-sh.png" width="50px" alt="User avatar: itsa-sh" /></a> <a href="https://github.com/dmmulroy"><img src="https://github.com/dmmulroy.png" width="50px" alt="User avatar: dmmulroy" /></a> <a href="https://github.com/timcole"><img src="https://github.com/timcole.png" width="50px" alt="User avatar: timcole" /></a> <a href="https://github.com/VLZH"><img src="https://github.com/VLZH.png" width="50px" alt="User avatar: VLZH" /></a> <a href="https://github.com/terasaka2k"><img src="https://github.com/terasaka2k.png" width="50px" alt="User avatar: terasaka2k" /></a> <a href="https://github.com/andriyor"><img src="https://github.com/andriyor.png" width="50px" alt="User avatar: andriyor" /></a> <a href="https://github.com/majudhu"><img src="https://github.com/majudhu.png" width="50px" alt="User avatar: majudhu" /></a> <a href="https://github.com/axelrindle"><img src="https://github.com/axelrindle.png" width="50px" alt="User avatar: axelrindle" /></a> <a href="https://github.com/jirizverina"><img src="https://github.com/jirizverina.png" width="50px" alt="User avatar: jirizverina" /></a> <a href="https://github.com/chip-well"><img src="https://github.com/chip-well.png" width="50px" alt="User avatar: chip-well" /></a> <a href="https://github.com/GRAYAH"><img src="https://github.com/GRAYAH.png" width="50px" alt="User avatar: GRAYAH" /></a> <!-- sponsors-base -->
|
||||
|
||||
957
package-lock.json
generated
957
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -10,8 +10,6 @@
|
||||
"packages/common-lib",
|
||||
"packages/plugin-runtime",
|
||||
"packages/plugin-runtime-types",
|
||||
"plugins-external/mcp-server",
|
||||
"plugins-external/template-function-faker",
|
||||
"plugins/action-copy-curl",
|
||||
"plugins/action-copy-grpcurl",
|
||||
"plugins/auth-apikey",
|
||||
|
||||
47
packages/plugin-runtime-types/package-lock.json
generated
Normal file
47
packages/plugin-runtime-types/package-lock.json
generated
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"name": "@yaakapp/api",
|
||||
"version": "0.1.17",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@yaakapp/api",
|
||||
"version": "0.1.17",
|
||||
"dependencies": {
|
||||
"@types/node": "^22.5.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.6.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "22.5.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.5.4.tgz",
|
||||
"integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~6.19.2"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.6.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz",
|
||||
"integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "6.19.8",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz",
|
||||
"integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,53 +1,18 @@
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type AnyModel = CookieJar | Environment | Folder | GraphQlIntrospection | GrpcConnection | GrpcEvent | GrpcRequest | HttpRequest | HttpResponse | HttpResponseEvent | KeyValue | Plugin | Settings | SyncState | WebsocketConnection | WebsocketEvent | WebsocketRequest | Workspace | WorkspaceMeta;
|
||||
|
||||
export type ClientCertificate = { host: string, port: number | null, crtFile: string | null, keyFile: string | null, pfxFile: string | null, passphrase: string | null, enabled?: boolean, };
|
||||
|
||||
export type Cookie = { raw_cookie: string, domain: CookieDomain, expires: CookieExpires, path: [string, boolean], };
|
||||
|
||||
export type CookieDomain = { "HostOnly": string } | { "Suffix": string } | "NotPresent" | "Empty";
|
||||
|
||||
export type CookieExpires = { "AtUtc": string } | "SessionEnd";
|
||||
|
||||
export type CookieJar = { model: "cookie_jar", id: string, createdAt: string, updatedAt: string, workspaceId: string, cookies: Array<Cookie>, name: string, };
|
||||
|
||||
export type EditorKeymap = "default" | "vim" | "vscode" | "emacs";
|
||||
|
||||
export type EncryptedKey = { encryptedKey: string, };
|
||||
|
||||
export type Environment = { model: "environment", id: string, workspaceId: string, createdAt: string, updatedAt: string, name: string, public: boolean, parentModel: string, parentId: string | null, variables: Array<EnvironmentVariable>, color: string | null, sortPriority: number, };
|
||||
|
||||
export type EnvironmentVariable = { enabled?: boolean, name: string, value: string, id?: string, };
|
||||
|
||||
export type Folder = { model: "folder", id: string, createdAt: string, updatedAt: string, workspaceId: string, folderId: string | null, authentication: Record<string, any>, authenticationType: string | null, description: string, headers: Array<HttpRequestHeader>, name: string, sortPriority: number, };
|
||||
|
||||
export type GraphQlIntrospection = { model: "graphql_introspection", id: string, createdAt: string, updatedAt: string, workspaceId: string, requestId: string, content: string | null, };
|
||||
|
||||
export type GrpcConnection = { model: "grpc_connection", id: string, createdAt: string, updatedAt: string, workspaceId: string, requestId: string, elapsed: number, error: string | null, method: string, service: string, status: number, state: GrpcConnectionState, trailers: { [key in string]?: string }, url: string, };
|
||||
|
||||
export type GrpcConnectionState = "initialized" | "connected" | "closed";
|
||||
|
||||
export type GrpcEvent = { model: "grpc_event", id: string, createdAt: string, updatedAt: string, workspaceId: string, requestId: string, connectionId: string, content: string, error: string | null, eventType: GrpcEventType, metadata: { [key in string]?: string }, status: number | null, };
|
||||
|
||||
export type GrpcEventType = "info" | "error" | "client_message" | "server_message" | "connection_start" | "connection_end";
|
||||
|
||||
export type GrpcRequest = { model: "grpc_request", id: string, createdAt: string, updatedAt: string, workspaceId: string, folderId: string | null, authenticationType: string | null, authentication: Record<string, any>, description: string, message: string, metadata: Array<HttpRequestHeader>, method: string | null, name: string, service: string | null, sortPriority: number, url: string, };
|
||||
|
||||
export type HttpRequest = { model: "http_request", id: string, createdAt: string, updatedAt: string, workspaceId: string, folderId: string | null, authentication: Record<string, any>, authenticationType: string | null, body: Record<string, any>, bodyType: string | null, description: string, headers: Array<HttpRequestHeader>, method: string, name: string, sortPriority: number, url: string, urlParameters: Array<HttpUrlParameter>, };
|
||||
|
||||
export type HttpRequestHeader = { enabled?: boolean, name: string, value: string, id?: string, };
|
||||
|
||||
export type HttpResponse = { model: "http_response", id: string, createdAt: string, updatedAt: string, workspaceId: string, requestId: string, bodyPath: string | null, contentLength: number | null, contentLengthCompressed: number | null, elapsed: number, elapsedHeaders: number, error: string | null, headers: Array<HttpResponseHeader>, remoteAddr: string | null, requestContentLength: number | null, requestHeaders: Array<HttpResponseHeader>, status: number, statusReason: string | null, state: HttpResponseState, url: string, version: string | null, };
|
||||
|
||||
export type HttpResponseEvent = { model: "http_response_event", id: string, createdAt: string, updatedAt: string, workspaceId: string, responseId: string, event: HttpResponseEventData, };
|
||||
|
||||
/**
|
||||
* Serializable representation of HTTP response events for DB storage.
|
||||
* This mirrors `yaak_http::sender::HttpResponseEvent` but with serde support.
|
||||
* The `From` impl is in yaak-http to avoid circular dependencies.
|
||||
*/
|
||||
export type HttpResponseEventData = { "type": "setting", name: string, value: string, } | { "type": "info", message: string, } | { "type": "redirect", url: string, status: number, behavior: string, } | { "type": "send_url", method: string, path: string, } | { "type": "receive_url", version: string, status: string, } | { "type": "header_up", name: string, value: string, } | { "type": "header_down", name: string, value: string, } | { "type": "chunk_sent", bytes: number, } | { "type": "chunk_received", bytes: number, };
|
||||
export type HttpResponse = { model: "http_response", id: string, createdAt: string, updatedAt: string, workspaceId: string, requestId: string, bodyPath: string | null, contentLength: number | null, elapsed: number, elapsedHeaders: number, error: string | null, headers: Array<HttpResponseHeader>, remoteAddr: string | null, status: number, statusReason: string | null, state: HttpResponseState, url: string, version: string | null, };
|
||||
|
||||
export type HttpResponseHeader = { name: string, value: string, };
|
||||
|
||||
@@ -55,28 +20,6 @@ export type HttpResponseState = "initialized" | "connected" | "closed";
|
||||
|
||||
export type HttpUrlParameter = { enabled?: boolean, name: string, value: string, id?: string, };
|
||||
|
||||
export type KeyValue = { model: "key_value", id: string, createdAt: string, updatedAt: string, key: string, namespace: string, value: string, };
|
||||
|
||||
export type Plugin = { model: "plugin", id: string, createdAt: string, updatedAt: string, checkedAt: string | null, directory: string, enabled: boolean, url: string | null, };
|
||||
|
||||
export type ProxySetting = { "type": "enabled", http: string, https: string, auth: ProxySettingAuth | null, bypass: string, disabled: boolean, } | { "type": "disabled" };
|
||||
|
||||
export type ProxySettingAuth = { user: string, password: string, };
|
||||
|
||||
export type Settings = { model: "settings", id: string, createdAt: string, updatedAt: string, appearance: string, clientCertificates: Array<ClientCertificate>, coloredMethods: boolean, editorFont: string | null, editorFontSize: number, editorKeymap: EditorKeymap, editorSoftWrap: boolean, hideWindowControls: boolean, useNativeTitlebar: boolean, interfaceFont: string | null, interfaceFontSize: number, interfaceScale: number, openWorkspaceNewWindow: boolean | null, proxy: ProxySetting | null, themeDark: string, themeLight: string, updateChannel: string, hideLicenseBadge: boolean, autoupdate: boolean, autoDownloadUpdates: boolean, checkNotifications: boolean, };
|
||||
|
||||
export type SyncState = { model: "sync_state", id: string, workspaceId: string, createdAt: string, updatedAt: string, flushedAt: string, modelId: string, checksum: string, relPath: string, syncDir: string, };
|
||||
|
||||
export type WebsocketConnection = { model: "websocket_connection", id: string, createdAt: string, updatedAt: string, workspaceId: string, requestId: string, elapsed: number, error: string | null, headers: Array<HttpResponseHeader>, state: WebsocketConnectionState, status: number, url: string, };
|
||||
|
||||
export type WebsocketConnectionState = "initialized" | "connected" | "closing" | "closed";
|
||||
|
||||
export type WebsocketEvent = { model: "websocket_event", id: string, createdAt: string, updatedAt: string, workspaceId: string, requestId: string, connectionId: string, isServer: boolean, message: Array<number>, messageType: WebsocketEventType, };
|
||||
|
||||
export type WebsocketEventType = "binary" | "close" | "frame" | "open" | "ping" | "pong" | "text";
|
||||
|
||||
export type WebsocketRequest = { model: "websocket_request", id: string, createdAt: string, updatedAt: string, workspaceId: string, folderId: string | null, authentication: Record<string, any>, authenticationType: string | null, description: string, headers: Array<HttpRequestHeader>, message: string, name: string, sortPriority: number, url: string, urlParameters: Array<HttpUrlParameter>, };
|
||||
|
||||
export type Workspace = { model: "workspace", id: string, createdAt: string, updatedAt: string, authentication: Record<string, any>, authenticationType: string | null, description: string, headers: Array<HttpRequestHeader>, name: string, encryptionKeyChallenge: string | null, settingValidateCertificates: boolean, settingFollowRedirects: boolean, settingRequestTimeout: number, };
|
||||
|
||||
export type WorkspaceMeta = { model: "workspace_meta", id: string, workspaceId: string, createdAt: string, updatedAt: string, encryptionKey: EncryptedKey | null, settingSyncDir: string | null, };
|
||||
|
||||
@@ -1,33 +1,25 @@
|
||||
import type {
|
||||
FindHttpResponsesRequest,
|
||||
FindHttpResponsesResponse,
|
||||
GetCookieValueRequest,
|
||||
GetCookieValueResponse,
|
||||
GetHttpRequestByIdRequest,
|
||||
GetHttpRequestByIdResponse,
|
||||
ListCookieNamesResponse,
|
||||
ListFoldersRequest,
|
||||
ListFoldersResponse,
|
||||
ListHttpRequestsRequest,
|
||||
ListHttpRequestsResponse,
|
||||
OpenWindowRequest,
|
||||
PromptTextRequest,
|
||||
PromptTextResponse,
|
||||
RenderGrpcRequestRequest,
|
||||
RenderGrpcRequestResponse,
|
||||
RenderHttpRequestRequest,
|
||||
RenderHttpRequestResponse,
|
||||
SendHttpRequestRequest,
|
||||
SendHttpRequestResponse,
|
||||
ShowToastRequest,
|
||||
TemplateRenderRequest,
|
||||
WorkspaceInfo,
|
||||
FindHttpResponsesRequest,
|
||||
FindHttpResponsesResponse,
|
||||
GetCookieValueRequest,
|
||||
GetCookieValueResponse,
|
||||
GetHttpRequestByIdRequest,
|
||||
GetHttpRequestByIdResponse,
|
||||
ListCookieNamesResponse,
|
||||
OpenWindowRequest,
|
||||
PromptTextRequest,
|
||||
PromptTextResponse,
|
||||
RenderGrpcRequestRequest,
|
||||
RenderGrpcRequestResponse,
|
||||
RenderHttpRequestRequest,
|
||||
RenderHttpRequestResponse,
|
||||
SendHttpRequestRequest,
|
||||
SendHttpRequestResponse,
|
||||
ShowToastRequest,
|
||||
TemplateRenderRequest,
|
||||
} from '../bindings/gen_events.ts';
|
||||
import type { HttpRequest } from '../bindings/gen_models.ts';
|
||||
import type { JsonValue } from '../bindings/serde_json/JsonValue';
|
||||
|
||||
export type WorkspaceHandle = Pick<WorkspaceInfo, 'id' | 'name'>;
|
||||
|
||||
export interface Context {
|
||||
clipboard: {
|
||||
copyText(text: string): Promise<void>;
|
||||
@@ -65,19 +57,6 @@ export interface Context {
|
||||
send(args: SendHttpRequestRequest): Promise<SendHttpRequestResponse['httpResponse']>;
|
||||
getById(args: GetHttpRequestByIdRequest): Promise<GetHttpRequestByIdResponse['httpRequest']>;
|
||||
render(args: RenderHttpRequestRequest): Promise<RenderHttpRequestResponse['httpRequest']>;
|
||||
list(args?: ListHttpRequestsRequest): Promise<ListHttpRequestsResponse['httpRequests']>;
|
||||
create(
|
||||
args: Omit<Partial<HttpRequest>, 'id' | 'model' | 'createdAt' | 'updatedAt'> &
|
||||
Pick<HttpRequest, 'workspaceId' | 'url'>,
|
||||
): Promise<HttpRequest>;
|
||||
update(
|
||||
args: Omit<Partial<HttpRequest>, 'model' | 'createdAt' | 'updatedAt'> &
|
||||
Pick<HttpRequest, 'id'>,
|
||||
): Promise<HttpRequest>;
|
||||
delete(args: { id: string }): Promise<HttpRequest>;
|
||||
};
|
||||
folder: {
|
||||
list(args?: ListFoldersRequest): Promise<ListFoldersResponse['folders']>;
|
||||
};
|
||||
httpResponse: {
|
||||
find(args: FindHttpResponsesRequest): Promise<FindHttpResponsesResponse['httpResponses']>;
|
||||
@@ -88,8 +67,4 @@ export interface Context {
|
||||
plugin: {
|
||||
reload(): void;
|
||||
};
|
||||
workspace: {
|
||||
list(): Promise<WorkspaceHandle[]>;
|
||||
withContext(handle: WorkspaceHandle): Context;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
import type { CallFolderActionArgs, FolderAction } from '../bindings/gen_events';
|
||||
import type { Context } from './Context';
|
||||
|
||||
export type FolderActionPlugin = FolderAction & {
|
||||
onSelect(ctx: Context, args: CallFolderActionArgs): Promise<void> | void;
|
||||
};
|
||||
@@ -1,6 +0,0 @@
|
||||
import type { CallWebsocketRequestActionArgs, WebsocketRequestAction } from '../bindings/gen_events';
|
||||
import type { Context } from './Context';
|
||||
|
||||
export type WebsocketRequestActionPlugin = WebsocketRequestAction & {
|
||||
onSelect(ctx: Context, args: CallWebsocketRequestActionArgs): Promise<void> | void;
|
||||
};
|
||||
@@ -1,6 +0,0 @@
|
||||
import type { CallWorkspaceActionArgs, WorkspaceAction } from '../bindings/gen_events';
|
||||
import type { Context } from './Context';
|
||||
|
||||
export type WorkspaceActionPlugin = WorkspaceAction & {
|
||||
onSelect(ctx: Context, args: CallWorkspaceActionArgs): Promise<void> | void;
|
||||
};
|
||||
@@ -4,9 +4,6 @@ import type { Context } from './Context';
|
||||
import type { FilterPlugin } from './FilterPlugin';
|
||||
import { GrpcRequestActionPlugin } from './GrpcRequestActionPlugin';
|
||||
import type { HttpRequestActionPlugin } from './HttpRequestActionPlugin';
|
||||
import type { WebsocketRequestActionPlugin } from './WebsocketRequestActionPlugin';
|
||||
import type { WorkspaceActionPlugin } from './WorkspaceActionPlugin';
|
||||
import type { FolderActionPlugin } from './FolderActionPlugin';
|
||||
import type { ImporterPlugin } from './ImporterPlugin';
|
||||
import type { TemplateFunctionPlugin } from './TemplateFunctionPlugin';
|
||||
import type { ThemePlugin } from './ThemePlugin';
|
||||
@@ -15,8 +12,6 @@ export type { Context };
|
||||
export type { DynamicTemplateFunctionArg } from './TemplateFunctionPlugin';
|
||||
export type { DynamicAuthenticationArg } from './AuthenticationPlugin';
|
||||
export type { TemplateFunctionPlugin };
|
||||
export type { WorkspaceActionPlugin } from './WorkspaceActionPlugin';
|
||||
export type { FolderActionPlugin } from './FolderActionPlugin';
|
||||
|
||||
/**
|
||||
* The global structure of a Yaak plugin
|
||||
@@ -29,9 +24,6 @@ export type PluginDefinition = {
|
||||
filter?: FilterPlugin;
|
||||
authentication?: AuthenticationPlugin;
|
||||
httpRequestActions?: HttpRequestActionPlugin[];
|
||||
websocketRequestActions?: WebsocketRequestActionPlugin[];
|
||||
workspaceActions?: WorkspaceActionPlugin[];
|
||||
folderActions?: FolderActionPlugin[];
|
||||
grpcRequestActions?: GrpcRequestActionPlugin[];
|
||||
templateFunctions?: TemplateFunctionPlugin[];
|
||||
};
|
||||
|
||||
10
packages/plugin-runtime/package-lock.json
generated
Normal file
10
packages/plugin-runtime/package-lock.json
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "@yaakapp-internal/plugin-runtime",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@yaakapp-internal/plugin-runtime"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ import { applyFormInputDefaults, validateTemplateFunctionArgs } from '@yaakapp-i
|
||||
import {
|
||||
BootRequest,
|
||||
DeleteKeyValueResponse,
|
||||
DeleteModelResponse,
|
||||
FindHttpResponsesResponse,
|
||||
GetCookieValueRequest,
|
||||
GetCookieValueResponse,
|
||||
@@ -10,12 +9,10 @@ import {
|
||||
GetKeyValueResponse,
|
||||
GrpcRequestAction,
|
||||
HttpAuthenticationAction,
|
||||
HttpRequest,
|
||||
HttpRequestAction,
|
||||
InternalEvent,
|
||||
InternalEventPayload,
|
||||
ListCookieNamesResponse,
|
||||
ListWorkspacesResponse,
|
||||
PluginContext,
|
||||
PromptTextResponse,
|
||||
RenderGrpcRequestResponse,
|
||||
@@ -23,7 +20,6 @@ import {
|
||||
SendHttpRequestResponse,
|
||||
TemplateFunction,
|
||||
TemplateRenderResponse,
|
||||
UpsertModelResponse,
|
||||
WindowInfoResponse,
|
||||
} from '@yaakapp-internal/plugins';
|
||||
import { Context, PluginDefinition } from '@yaakapp/api';
|
||||
@@ -176,57 +172,6 @@ export class PluginInstance {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
payload.type === 'get_websocket_request_actions_request' &&
|
||||
Array.isArray(this.#mod?.websocketRequestActions)
|
||||
) {
|
||||
const reply = this.#mod.websocketRequestActions.map((a) => ({
|
||||
...a,
|
||||
onSelect: undefined,
|
||||
}));
|
||||
const replyPayload: InternalEventPayload = {
|
||||
type: 'get_websocket_request_actions_response',
|
||||
pluginRefId: this.#workerData.pluginRefId,
|
||||
actions: reply,
|
||||
};
|
||||
this.#sendPayload(context, replyPayload, replyId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
payload.type === 'get_workspace_actions_request' &&
|
||||
Array.isArray(this.#mod?.workspaceActions)
|
||||
) {
|
||||
const reply = this.#mod.workspaceActions.map((a) => ({
|
||||
...a,
|
||||
onSelect: undefined,
|
||||
}));
|
||||
const replyPayload: InternalEventPayload = {
|
||||
type: 'get_workspace_actions_response',
|
||||
pluginRefId: this.#workerData.pluginRefId,
|
||||
actions: reply,
|
||||
};
|
||||
this.#sendPayload(context, replyPayload, replyId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
payload.type === 'get_folder_actions_request' &&
|
||||
Array.isArray(this.#mod?.folderActions)
|
||||
) {
|
||||
const reply = this.#mod.folderActions.map((a) => ({
|
||||
...a,
|
||||
onSelect: undefined,
|
||||
}));
|
||||
const replyPayload: InternalEventPayload = {
|
||||
type: 'get_folder_actions_response',
|
||||
pluginRefId: this.#workerData.pluginRefId,
|
||||
actions: reply,
|
||||
};
|
||||
this.#sendPayload(context, replyPayload, replyId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (payload.type === 'get_themes_request' && Array.isArray(this.#mod?.themes)) {
|
||||
const replyPayload: InternalEventPayload = {
|
||||
type: 'get_themes_response',
|
||||
@@ -357,42 +302,6 @@ export class PluginInstance {
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
payload.type === 'call_websocket_request_action_request' &&
|
||||
Array.isArray(this.#mod.websocketRequestActions)
|
||||
) {
|
||||
const action = this.#mod.websocketRequestActions[payload.index];
|
||||
if (typeof action?.onSelect === 'function') {
|
||||
await action.onSelect(ctx, payload.args);
|
||||
this.#sendEmpty(context, replyId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
payload.type === 'call_workspace_action_request' &&
|
||||
Array.isArray(this.#mod.workspaceActions)
|
||||
) {
|
||||
const action = this.#mod.workspaceActions[payload.index];
|
||||
if (typeof action?.onSelect === 'function') {
|
||||
await action.onSelect(ctx, payload.args);
|
||||
this.#sendEmpty(context, replyId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
payload.type === 'call_folder_action_request' &&
|
||||
Array.isArray(this.#mod.folderActions)
|
||||
) {
|
||||
const action = this.#mod.folderActions[payload.index];
|
||||
if (typeof action?.onSelect === 'function') {
|
||||
await action.onSelect(ctx, payload.args);
|
||||
this.#sendEmpty(context, replyId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
payload.type === 'call_grpc_request_action_request' &&
|
||||
Array.isArray(this.#mod.grpcRequestActions)
|
||||
@@ -702,57 +611,6 @@ export class PluginInstance {
|
||||
);
|
||||
return httpRequest;
|
||||
},
|
||||
list: async (args?: { folderId?: string }) => {
|
||||
const payload = {
|
||||
type: 'list_http_requests_request',
|
||||
folderId: args?.folderId,
|
||||
} as any;
|
||||
const { httpRequests } = await this.#sendForReply<any>(context, payload);
|
||||
return httpRequests as any[];
|
||||
},
|
||||
create: async (args) => {
|
||||
const payload = {
|
||||
type: 'upsert_model_request',
|
||||
model: {
|
||||
name: '',
|
||||
method: 'GET',
|
||||
...args,
|
||||
id: '',
|
||||
model: 'http_request',
|
||||
},
|
||||
} as InternalEventPayload;
|
||||
const response = await this.#sendForReply<UpsertModelResponse>(context, payload);
|
||||
return response.model as HttpRequest;
|
||||
},
|
||||
update: async (args) => {
|
||||
const payload = {
|
||||
type: 'upsert_model_request',
|
||||
model: {
|
||||
model: 'http_request',
|
||||
...args,
|
||||
},
|
||||
} as InternalEventPayload;
|
||||
const response = await this.#sendForReply<UpsertModelResponse>(context, payload);
|
||||
return response.model as HttpRequest;
|
||||
},
|
||||
delete: async (args) => {
|
||||
const payload = {
|
||||
type: 'delete_model_request',
|
||||
model: 'http_request',
|
||||
id: args.id,
|
||||
} as InternalEventPayload;
|
||||
const response = await this.#sendForReply<DeleteModelResponse>(context, payload);
|
||||
return response.model as HttpRequest;
|
||||
},
|
||||
},
|
||||
folder: {
|
||||
list: async () => {
|
||||
const payload = {
|
||||
type: 'list_folders_request',
|
||||
} as any;
|
||||
const { folders } = await this.#sendForReply<any>(context, payload);
|
||||
return folders as any[];
|
||||
},
|
||||
},
|
||||
cookies: {
|
||||
getValue: async (args: GetCookieValueRequest) => {
|
||||
@@ -806,29 +664,6 @@ export class PluginInstance {
|
||||
this.#sendPayload(context, { type: 'reload_response', silent: true }, null);
|
||||
},
|
||||
},
|
||||
workspace: {
|
||||
list: async () => {
|
||||
const payload = {
|
||||
type: 'list_workspaces_request'
|
||||
} as InternalEventPayload;
|
||||
const response = await this.#sendForReply<ListWorkspacesResponse>(context, payload);
|
||||
return response.workspaces.map((w) => ({
|
||||
id: w.id,
|
||||
name: w.name,
|
||||
// Hide label from plugin authors, but keep it for internal routing
|
||||
_label: (w as any).label as string,
|
||||
}));
|
||||
},
|
||||
withContext: (workspaceHandle: { id: string; name: string; _label?: string }) => {
|
||||
// Create a new context with the workspace's window label
|
||||
const newContext: PluginContext = {
|
||||
...context,
|
||||
label: workspaceHandle._label || null,
|
||||
workspaceId: workspaceHandle.id,
|
||||
};
|
||||
return this.#newCtx(newContext);
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { applyFormInputDefaults } from '@yaakapp-internal/lib/templateFunction';
|
||||
import { CallTemplateFunctionArgs } from '@yaakapp-internal/plugins';
|
||||
import { Context, DynamicTemplateFunctionArg } from '@yaakapp/api';
|
||||
import { describe, expect, test } from 'vitest';
|
||||
import { applyDynamicFormInput } from '../src/common';
|
||||
import { applyDynamicFormInput, applyFormInputDefaults } from '../src/common';
|
||||
|
||||
describe('applyFormInputDefaults', () => {
|
||||
test('Works with top-level select', () => {
|
||||
|
||||
1
plugins-external/.gitignore
vendored
1
plugins-external/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
*/build
|
||||
@@ -1,76 +0,0 @@
|
||||
# Yaak Faker Plugin
|
||||
|
||||
This is a template function that generates realistic fake data
|
||||
for testing and development using [FakerJS](https://fakerjs.dev).
|
||||
|
||||

|
||||
|
||||
## Example JSON Body
|
||||
|
||||
Here's an example JSON body that uses fake data:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "${[ faker.string.uuid() ]}",
|
||||
"name": "${[ faker.person.fullName() ]}",
|
||||
"email": "${[ faker.internet.email() ]}",
|
||||
"phone": "${[ faker.phone.number() ]}",
|
||||
"address": {
|
||||
"street": "${[ faker.location.streetAddress() ]}",
|
||||
"city": "${[ faker.location.city() ]}",
|
||||
"country": "${[ faker.location.country() ]}",
|
||||
"zipCode": "${[ faker.location.zipCode() ]}"
|
||||
},
|
||||
"company": "${[ faker.company.name() ]}",
|
||||
"website": "${[ faker.internet.url() ]}"
|
||||
}
|
||||
```
|
||||
|
||||
This will generate a random JSON body on every request:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "589f0aec-7310-4bf2-81c4-0b1bb7f1c3c1",
|
||||
"name": "Lucy Gottlieb-Weissnat",
|
||||
"email": "Destiny_Herzog@gmail.com",
|
||||
"phone": "411.805.2871 x699",
|
||||
"address": {
|
||||
"street": "846 Christ Mills",
|
||||
"city": "Spencerfurt",
|
||||
"country": "United Kingdom",
|
||||
"zipCode": "20354"
|
||||
},
|
||||
"company": "Emard, Kohler and Rutherford",
|
||||
"website": "https://watery-detective.org"
|
||||
}
|
||||
```
|
||||
|
||||
## Available Categories
|
||||
|
||||
The plugin provides access to all FakerJS modules and their methods:
|
||||
|
||||
| Category | Description | Example Methods |
|
||||
|------------|---------------------------|--------------------------------------------|
|
||||
| `airline` | Airline-related data | `aircraftType`, `airline`, `airplane` |
|
||||
| `animal` | Animal names and types | `bear`, `bird`, `cat`, `dog`, `fish` |
|
||||
| `color` | Colors in various formats | `human`, `rgb`, `hex`, `hsl` |
|
||||
| `commerce` | E-commerce data | `department`, `product`, `price` |
|
||||
| `company` | Company information | `name`, `catchPhrase`, `bs` |
|
||||
| `database` | Database-related data | `column`, `type`, `collation` |
|
||||
| `date` | Date and time values | `recent`, `future`, `past`, `between` |
|
||||
| `finance` | Financial data | `account`, `amount`, `currency` |
|
||||
| `git` | Git-related data | `branch`, `commitEntry`, `commitSha` |
|
||||
| `hacker` | Tech/hacker terminology | `abbreviation`, `noun`, `phrase` |
|
||||
| `image` | Image URLs and data | `avatar`, `url`, `dataUri` |
|
||||
| `internet` | Internet-related data | `email`, `url`, `ip`, `userAgent` |
|
||||
| `location` | Geographic data | `city`, `country`, `latitude`, `longitude` |
|
||||
| `lorem` | Lorem ipsum text | `word`, `sentence`, `paragraph` |
|
||||
| `person` | Personal information | `firstName`, `lastName`, `fullName` |
|
||||
| `music` | Music-related data | `genre`, `songName`, `artist` |
|
||||
| `number` | Numeric data | `int`, `float`, `binary`, `hex` |
|
||||
| `phone` | Phone numbers | `number`, `imei` |
|
||||
| `science` | Scientific data | `chemicalElement`, `unit` |
|
||||
| `string` | String utilities | `uuid`, `alpha`, `alphanumeric` |
|
||||
| `system` | System-related data | `fileName`, `mimeType`, `fileExt` |
|
||||
| `vehicle` | Vehicle information | `vehicle`, `manufacturer`, `model` |
|
||||
| `word` | Word generation | `adjective`, `adverb`, `conjunction` |
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"name": "@yaak/faker",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"displayName": "Faker",
|
||||
"description": "Template functions for generating fake data using FakerJS",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mountain-loop/yaak.git",
|
||||
"directory": "plugins-external/faker"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yaakcli build",
|
||||
"dev": "yaakcli dev"
|
||||
},
|
||||
"dependencies": {
|
||||
"@faker-js/faker": "^10.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^25.0.3",
|
||||
"typescript": "^5.9.3"
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
import type { PluginDefinition, TemplateFunctionArg } from '@yaakapp/api';
|
||||
|
||||
const modules = [
|
||||
'airline',
|
||||
'animal',
|
||||
'color',
|
||||
'commerce',
|
||||
'company',
|
||||
'database',
|
||||
'date',
|
||||
'finance',
|
||||
'git',
|
||||
'hacker',
|
||||
'image',
|
||||
'internet',
|
||||
'location',
|
||||
'lorem',
|
||||
'person',
|
||||
'music',
|
||||
'number',
|
||||
'phone',
|
||||
'science',
|
||||
'string',
|
||||
'system',
|
||||
'vehicle',
|
||||
'word',
|
||||
];
|
||||
|
||||
function normalizeResult(result: unknown): string {
|
||||
if (typeof result === 'string') return result;
|
||||
return JSON.stringify(result);
|
||||
}
|
||||
|
||||
// Whatever Yaak’s arg type shape is – rough example
|
||||
function args(modName: string, fnName: string): TemplateFunctionArg[] {
|
||||
return [
|
||||
{
|
||||
type: 'banner',
|
||||
color: 'info',
|
||||
inputs: [
|
||||
{
|
||||
type: 'markdown',
|
||||
content: `Need help? View documentation for [\`${modName}.${fnName}(…)\`](https://fakerjs.dev/api/${encodeURIComponent(modName)}.html#${encodeURIComponent(fnName)})`,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'options',
|
||||
label: 'Arguments',
|
||||
type: 'editor',
|
||||
language: 'json',
|
||||
optional: true,
|
||||
placeholder: 'e.g. { "min": 1, "max": 10 } or 10 or ["en","US"]',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
export const plugin: PluginDefinition = {
|
||||
templateFunctions: modules.flatMap((modName) => {
|
||||
// @ts-expect-error - Dynamic access to faker modules
|
||||
const mod = faker[modName];
|
||||
return Object.keys(mod)
|
||||
.filter((n) => n !== 'faker')
|
||||
.map((fnName) => ({
|
||||
name: ['faker', modName, fnName].join('.'),
|
||||
args: args(modName, fnName),
|
||||
async onRender(_ctx, args) {
|
||||
const fn = mod[fnName] as (...a: unknown[]) => unknown;
|
||||
const options = args.values.options;
|
||||
|
||||
// No options supplied
|
||||
if (options == null || options === '') {
|
||||
return normalizeResult(fn());
|
||||
}
|
||||
|
||||
// Try JSON first
|
||||
let parsed: unknown = options;
|
||||
if (typeof options === 'string') {
|
||||
try {
|
||||
parsed = JSON.parse(options);
|
||||
} catch {
|
||||
// Not valid JSON – maybe just a scalar
|
||||
const n = Number(options);
|
||||
if (!Number.isNaN(n)) {
|
||||
parsed = n;
|
||||
} else {
|
||||
parsed = options;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let result: unknown;
|
||||
if (Array.isArray(parsed)) {
|
||||
// Treat as positional arguments
|
||||
result = fn(...parsed);
|
||||
} else {
|
||||
// Treat as a single argument (option object or scalar)
|
||||
result = fn(parsed);
|
||||
}
|
||||
|
||||
return normalizeResult(result);
|
||||
},
|
||||
}));
|
||||
}),
|
||||
};
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json"
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
# Yaak MCP Server Plugin
|
||||
|
||||
A Yaak plugin that exposes Yaak's functionality via the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/), allowing AI assistants and other tools to interact with Yaak programmatically.
|
||||
|
||||
## Features
|
||||
|
||||
This plugin starts an MCP server on `http://127.0.0.1:64343/mcp` that provides tools for:
|
||||
|
||||
### HTTP Requests
|
||||
- `list_http_requests` - List all HTTP requests in a workspace
|
||||
- `get_http_request` - Get details of a specific HTTP request
|
||||
- `send_http_request` - Send an HTTP request and get the response
|
||||
- `create_http_request` - Create a new HTTP request
|
||||
- `update_http_request` - Update an existing HTTP request
|
||||
- `delete_http_request` - Delete an HTTP request
|
||||
|
||||
### Folders
|
||||
- `list_folders` - List all folders in a workspace
|
||||
|
||||
### Workspaces
|
||||
- `list_workspaces` - List all open workspaces in Yaak
|
||||
|
||||
### Clipboard
|
||||
- `copy_to_clipboard` - Copy text to the system clipboard
|
||||
|
||||
### Window
|
||||
- `get_workspace_id` - Get the current workspace ID
|
||||
- `get_environment_id` - Get the current environment ID
|
||||
|
||||
### Toast Notifications
|
||||
- `show_toast` - Show a toast notification in Yaak
|
||||
|
||||
## Usage
|
||||
|
||||
Once the plugin is installed and Yaak is running, the MCP server will be available at:
|
||||
|
||||
```
|
||||
http://127.0.0.1:64343/mcp
|
||||
```
|
||||
|
||||
Configure your MCP client to connect to this endpoint to start interacting with Yaak.
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
npm install
|
||||
|
||||
# Build the plugin
|
||||
npm run build
|
||||
|
||||
# Development mode with auto-rebuild
|
||||
npm run dev
|
||||
```
|
||||
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"name": "@yaak/mcp-server",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"displayName": "MCP Server",
|
||||
"description": "Expose Yaak functionality via Model Context Protocol",
|
||||
"minYaakVersion": "2025.10.0-beta.6",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mountain-loop/yaak.git",
|
||||
"directory": "plugins-external/mcp-server"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "yaakcli build",
|
||||
"dev": "yaakcli dev"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hono/mcp": "^0.2.3",
|
||||
"@hono/node-server": "^1.19.7",
|
||||
"@modelcontextprotocol/sdk": "^1.25.1",
|
||||
"hono": "^4.11.3",
|
||||
"zod": "^3.25.76"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^25.0.3",
|
||||
"typescript": "^5.9.3"
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import type { Context, PluginDefinition } from '@yaakapp/api';
|
||||
import { createMcpServer } from './server.js';
|
||||
|
||||
const serverPort = 64343;
|
||||
|
||||
let mcpServer: Awaited<ReturnType<typeof createMcpServer>> | null = null;
|
||||
|
||||
export const plugin: PluginDefinition = {
|
||||
async init(ctx: Context) {
|
||||
// Start the server after waiting, so there's an active window open to do things
|
||||
// like show the startup toast.
|
||||
setTimeout(() => {
|
||||
mcpServer = createMcpServer({ yaak: ctx }, serverPort);
|
||||
}, 5000);
|
||||
},
|
||||
|
||||
async dispose() {
|
||||
console.log('Disposing MCP Server plugin');
|
||||
|
||||
if (mcpServer) {
|
||||
await mcpServer.close();
|
||||
mcpServer = null;
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -1,58 +0,0 @@
|
||||
import { serve } from '@hono/node-server';
|
||||
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
||||
import { WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js';
|
||||
import { Hono } from 'hono';
|
||||
import { registerFolderTools } from './tools/folder.js';
|
||||
import { registerHttpRequestTools } from './tools/httpRequest.js';
|
||||
import { registerToastTools } from './tools/toast.js';
|
||||
import { registerWindowTools } from './tools/window.js';
|
||||
import { registerWorkspaceTools } from './tools/workspace.js';
|
||||
import type { McpServerContext } from './types.js';
|
||||
|
||||
export function createMcpServer(ctx: McpServerContext, port: number) {
|
||||
const server = new McpServer({
|
||||
name: 'yaak-mcp-server',
|
||||
version: '0.1.0',
|
||||
});
|
||||
|
||||
// Register all tools
|
||||
registerToastTools(server, ctx);
|
||||
registerHttpRequestTools(server, ctx);
|
||||
registerFolderTools(server, ctx);
|
||||
registerWindowTools(server, ctx);
|
||||
registerWorkspaceTools(server, ctx);
|
||||
|
||||
// Create a stateless transport
|
||||
const transport = new WebStandardStreamableHTTPServerTransport();
|
||||
|
||||
// Create Hono app
|
||||
const app = new Hono();
|
||||
|
||||
// MCP endpoint - reuse the same transport for all requests
|
||||
app.all('/mcp', (c) => transport.handleRequest(c.req.raw));
|
||||
|
||||
// Connect server to transport
|
||||
server.connect(transport).then(() => {
|
||||
console.log(`MCP Server running at http://127.0.0.1:${port}/mcp`);
|
||||
ctx.yaak.toast.show({
|
||||
message: `MCP Server running on port ${port}`,
|
||||
icon: 'check_circle',
|
||||
color: 'success',
|
||||
});
|
||||
});
|
||||
|
||||
// Start the HTTP server
|
||||
const honoServer = serve({
|
||||
fetch: app.fetch,
|
||||
port,
|
||||
hostname: '127.0.0.1',
|
||||
});
|
||||
|
||||
return {
|
||||
server,
|
||||
close: async () => {
|
||||
honoServer.close();
|
||||
await server.close();
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
||||
import * as z from 'zod/v4';
|
||||
import type { McpServerContext } from '../types.js';
|
||||
import { getWorkspaceContext } from './helpers.js';
|
||||
|
||||
export function registerFolderTools(server: McpServer, ctx: McpServerContext) {
|
||||
server.registerTool(
|
||||
'list_folders',
|
||||
{
|
||||
title: 'List Folders',
|
||||
description: 'List all folders in a workspace',
|
||||
inputSchema: z.object({
|
||||
workspaceId: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe('Workspace ID (required if multiple workspaces are open)'),
|
||||
}),
|
||||
},
|
||||
async ({ workspaceId }) => {
|
||||
const workspaceCtx = await getWorkspaceContext(ctx, workspaceId);
|
||||
const folders = await workspaceCtx.yaak.folder.list();
|
||||
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text' as const,
|
||||
text: JSON.stringify(folders, null, 2),
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
import type { McpServerContext } from '../types.js';
|
||||
|
||||
export async function getWorkspaceContext(
|
||||
ctx: McpServerContext,
|
||||
workspaceId?: string,
|
||||
): Promise<McpServerContext> {
|
||||
const workspaces = await ctx.yaak.workspace.list();
|
||||
|
||||
if (!workspaceId && workspaces.length > 1) {
|
||||
const workspaceList = workspaces.map((w, i) => `${i + 1}. ${w.name} (ID: ${w.id})`).join('\n');
|
||||
throw new Error(
|
||||
`Multiple workspaces are open. Please specify which workspace to use.\n\n` +
|
||||
`Currently open workspaces:\n${workspaceList}\n\n` +
|
||||
`You can use the list_workspaces tool to get workspace IDs, then use other tools ` +
|
||||
`with the workspace context. For example, ask the user which workspace they want ` +
|
||||
`to work with by presenting them with the numbered list above.`,
|
||||
);
|
||||
}
|
||||
|
||||
const workspace = workspaceId ? workspaces.find((w) => w.id === workspaceId) : workspaces[0];
|
||||
if (!workspace) {
|
||||
const workspaceList = workspaces.map((w) => `- ${w.name} (ID: ${w.id})`).join('\n');
|
||||
throw new Error(
|
||||
`Workspace with ID "${workspaceId}" not found.\n\n` +
|
||||
`Available workspaces:\n${workspaceList}`,
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
yaak: ctx.yaak.workspace.withContext(workspace),
|
||||
};
|
||||
}
|
||||
@@ -1,219 +0,0 @@
|
||||
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
||||
import * as z from 'zod/v4';
|
||||
import type { McpServerContext } from '../types.js';
|
||||
import { getWorkspaceContext } from './helpers.js';
|
||||
|
||||
export function registerHttpRequestTools(server: McpServer, ctx: McpServerContext) {
|
||||
server.registerTool(
|
||||
'list_http_requests',
|
||||
{
|
||||
title: 'List HTTP Requests',
|
||||
description: 'List all HTTP requests in a workspace',
|
||||
inputSchema: z.object({
|
||||
workspaceId: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe('Workspace ID (required if multiple workspaces are open)'),
|
||||
}),
|
||||
},
|
||||
async ({ workspaceId }) => {
|
||||
const workspaceCtx = await getWorkspaceContext(ctx, workspaceId);
|
||||
const requests = await workspaceCtx.yaak.httpRequest.list();
|
||||
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text' as const,
|
||||
text: JSON.stringify(requests, null, 2),
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
'get_http_request',
|
||||
{
|
||||
title: 'Get HTTP Request',
|
||||
description: 'Get details of a specific HTTP request by ID',
|
||||
inputSchema: z.object({
|
||||
id: z.string().describe('The HTTP request ID'),
|
||||
workspaceId: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe('Workspace ID (required if multiple workspaces are open)'),
|
||||
}),
|
||||
},
|
||||
async ({ id, workspaceId }) => {
|
||||
const workspaceCtx = await getWorkspaceContext(ctx, workspaceId);
|
||||
const request = await workspaceCtx.yaak.httpRequest.getById({ id });
|
||||
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text' as const,
|
||||
text: JSON.stringify(request, null, 2),
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
'send_http_request',
|
||||
{
|
||||
title: 'Send HTTP Request',
|
||||
description: 'Send an HTTP request and get the response',
|
||||
inputSchema: z.object({
|
||||
id: z.string().describe('The HTTP request ID to send'),
|
||||
environmentId: z.string().optional().describe('Optional environment ID to use'),
|
||||
workspaceId: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe('Workspace ID (required if multiple workspaces are open)'),
|
||||
}),
|
||||
},
|
||||
async ({ id, workspaceId }) => {
|
||||
const workspaceCtx = await getWorkspaceContext(ctx, workspaceId);
|
||||
const httpRequest = await workspaceCtx.yaak.httpRequest.getById({ id });
|
||||
if (httpRequest == null) {
|
||||
throw new Error(`HTTP request with ID ${id} not found`);
|
||||
}
|
||||
|
||||
const response = await workspaceCtx.yaak.httpRequest.send({ httpRequest });
|
||||
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text' as const,
|
||||
text: JSON.stringify(response, null, 2),
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
'create_http_request',
|
||||
{
|
||||
title: 'Create HTTP Request',
|
||||
description: 'Create a new HTTP request',
|
||||
inputSchema: z.object({
|
||||
workspaceId: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe('Workspace ID (required if multiple workspaces are open)'),
|
||||
name: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe('Request name (empty string to auto-generate from URL)'),
|
||||
url: z.string().describe('Request URL'),
|
||||
method: z.string().optional().describe('HTTP method (defaults to GET)'),
|
||||
folderId: z.string().optional().describe('Parent folder ID'),
|
||||
description: z.string().optional().describe('Request description'),
|
||||
headers: z
|
||||
.array(
|
||||
z.object({
|
||||
name: z.string(),
|
||||
value: z.string(),
|
||||
enabled: z.boolean().default(true),
|
||||
}),
|
||||
)
|
||||
.optional()
|
||||
.describe('Request headers'),
|
||||
urlParameters: z
|
||||
.array(
|
||||
z.object({
|
||||
name: z.string(),
|
||||
value: z.string(),
|
||||
enabled: z.boolean().default(true),
|
||||
}),
|
||||
)
|
||||
.optional()
|
||||
.describe('URL query parameters'),
|
||||
}),
|
||||
},
|
||||
async ({ workspaceId: ogWorkspaceId, ...args }) => {
|
||||
const workspaceCtx = await getWorkspaceContext(ctx, ogWorkspaceId);
|
||||
const workspaceId = await workspaceCtx.yaak.window.workspaceId();
|
||||
if (!workspaceId) {
|
||||
throw new Error('No workspace is open');
|
||||
}
|
||||
|
||||
const httpRequest = await workspaceCtx.yaak.httpRequest.create({
|
||||
workspaceId: workspaceId,
|
||||
...args,
|
||||
});
|
||||
|
||||
return {
|
||||
content: [{ type: 'text' as const, text: JSON.stringify(httpRequest, null, 2) }],
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
'update_http_request',
|
||||
{
|
||||
title: 'Update HTTP Request',
|
||||
description: 'Update an existing HTTP request',
|
||||
inputSchema: z.object({
|
||||
id: z.string().describe('HTTP request ID to update'),
|
||||
workspaceId: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe('Workspace ID (required if multiple workspaces are open)'),
|
||||
name: z.string().optional().describe('Request name'),
|
||||
url: z.string().optional().describe('Request URL'),
|
||||
method: z.string().optional().describe('HTTP method'),
|
||||
folderId: z.string().optional().describe('Parent folder ID'),
|
||||
description: z.string().optional().describe('Request description'),
|
||||
headers: z
|
||||
.array(
|
||||
z.object({
|
||||
name: z.string(),
|
||||
value: z.string(),
|
||||
enabled: z.boolean().default(true),
|
||||
}),
|
||||
)
|
||||
.optional()
|
||||
.describe('Request headers'),
|
||||
urlParameters: z
|
||||
.array(
|
||||
z.object({
|
||||
name: z.string(),
|
||||
value: z.string(),
|
||||
enabled: z.boolean().default(true),
|
||||
}),
|
||||
)
|
||||
.optional()
|
||||
.describe('URL query parameters'),
|
||||
}),
|
||||
},
|
||||
async ({ id, workspaceId, ...updates }) => {
|
||||
const workspaceCtx = await getWorkspaceContext(ctx, workspaceId);
|
||||
const httpRequest = await workspaceCtx.yaak.httpRequest.update({ id, ...updates });
|
||||
return {
|
||||
content: [{ type: 'text' as const, text: JSON.stringify(httpRequest, null, 2) }],
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
'delete_http_request',
|
||||
{
|
||||
title: 'Delete HTTP Request',
|
||||
description: 'Delete an HTTP request by ID',
|
||||
inputSchema: z.object({
|
||||
id: z.string().describe('HTTP request ID to delete'),
|
||||
}),
|
||||
},
|
||||
async ({ id }) => {
|
||||
const httpRequest = await ctx.yaak.httpRequest.delete({ id });
|
||||
return {
|
||||
content: [
|
||||
{ type: 'text' as const, text: `Deleted: ${httpRequest.name} (${httpRequest.id})` },
|
||||
],
|
||||
};
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
||||
import type { Color, Icon } from '@yaakapp/api';
|
||||
import * as z from 'zod/v4';
|
||||
import type { McpServerContext } from '../types.js';
|
||||
|
||||
const ICON_VALUES = [
|
||||
'alert_triangle',
|
||||
'check',
|
||||
'check_circle',
|
||||
'chevron_down',
|
||||
'copy',
|
||||
'info',
|
||||
'pin',
|
||||
'search',
|
||||
'trash',
|
||||
] as const satisfies readonly Icon[];
|
||||
|
||||
const COLOR_VALUES = [
|
||||
'primary',
|
||||
'secondary',
|
||||
'info',
|
||||
'success',
|
||||
'notice',
|
||||
'warning',
|
||||
'danger',
|
||||
] as const satisfies readonly Color[];
|
||||
|
||||
export function registerToastTools(server: McpServer, ctx: McpServerContext) {
|
||||
server.registerTool(
|
||||
'show_toast',
|
||||
{
|
||||
title: 'Show Toast',
|
||||
description: 'Show a toast notification in Yaak',
|
||||
inputSchema: z.object({
|
||||
message: z.string().describe('The message to display'),
|
||||
icon: z.enum(ICON_VALUES).optional().describe('Icon name'),
|
||||
color: z.enum(COLOR_VALUES).optional().describe('Toast color'),
|
||||
timeout: z.number().optional().describe('Timeout in milliseconds'),
|
||||
}),
|
||||
},
|
||||
async ({ message, icon, color, timeout }) => {
|
||||
await ctx.yaak.toast.show({
|
||||
message,
|
||||
icon,
|
||||
color,
|
||||
timeout,
|
||||
});
|
||||
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text' as const,
|
||||
text: `✓ Toast shown: "${message}"`,
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
||||
import * as z from 'zod/v4';
|
||||
import type { McpServerContext } from '../types.js';
|
||||
import { getWorkspaceContext } from './helpers.js';
|
||||
|
||||
export function registerWindowTools(server: McpServer, ctx: McpServerContext) {
|
||||
server.registerTool(
|
||||
'get_workspace_id',
|
||||
{
|
||||
title: 'Get Workspace ID',
|
||||
description: 'Get the current workspace ID',
|
||||
inputSchema: z.object({}),
|
||||
},
|
||||
async () => {
|
||||
const workspaceCtx = await getWorkspaceContext(ctx);
|
||||
const workspaceId = await workspaceCtx.yaak.window.workspaceId();
|
||||
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text' as const,
|
||||
text: workspaceId || 'No workspace open',
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
server.registerTool(
|
||||
'get_environment_id',
|
||||
{
|
||||
title: 'Get Environment ID',
|
||||
description: 'Get the current environment ID',
|
||||
inputSchema: z.object({}),
|
||||
},
|
||||
async () => {
|
||||
const workspaceCtx = await getWorkspaceContext(ctx);
|
||||
const environmentId = await workspaceCtx.yaak.window.environmentId();
|
||||
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text' as const,
|
||||
text: environmentId || 'No environment selected',
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
||||
import * as z from 'zod/v4';
|
||||
import type { McpServerContext } from '../types.js';
|
||||
|
||||
export function registerWorkspaceTools(server: McpServer, ctx: McpServerContext) {
|
||||
server.registerTool(
|
||||
'list_workspaces',
|
||||
{
|
||||
title: 'List Workspaces',
|
||||
description: 'List all open workspaces in Yaak',
|
||||
inputSchema: z.object({}),
|
||||
},
|
||||
async () => {
|
||||
const workspaces = await ctx.yaak.workspace.list();
|
||||
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text' as const,
|
||||
text: JSON.stringify(workspaces, null, 2),
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import type { Context } from '@yaakapp/api';
|
||||
|
||||
export interface McpServerContext {
|
||||
yaak: Context;
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json"
|
||||
}
|
||||
@@ -194,18 +194,11 @@ function importCommand(parseEntries: ParseEntry[], workspaceId: string) {
|
||||
let value: string | boolean;
|
||||
const nextEntry = parseEntries[i + 1];
|
||||
const hasValue = !BOOLEAN_FLAGS.includes(name);
|
||||
// Check if nextEntry looks like a flag:
|
||||
// - Single dash followed by a letter: -X, -H, -d
|
||||
// - Double dash followed by a letter: --data-raw, --header
|
||||
// This prevents mistaking data that starts with dashes (like multipart boundaries ------) as flags
|
||||
const nextEntryIsFlag =
|
||||
typeof nextEntry === 'string' &&
|
||||
(nextEntry.match(/^-[a-zA-Z]/) || nextEntry.match(/^--[a-zA-Z]/));
|
||||
if (isSingleDash && name.length > 1) {
|
||||
// Handle squished arguments like -XPOST
|
||||
value = name.slice(1);
|
||||
name = name.slice(0, 1);
|
||||
} else if (typeof nextEntry === 'string' && hasValue && !nextEntryIsFlag) {
|
||||
} else if (typeof nextEntry === 'string' && hasValue && !nextEntry.startsWith('-')) {
|
||||
// Next arg is not a flag, so assign it as the value
|
||||
value = nextEntry;
|
||||
i++; // Skip next one
|
||||
@@ -312,34 +305,11 @@ function importCommand(parseEntries: ParseEntry[], workspaceId: string) {
|
||||
}
|
||||
|
||||
// Body (Text or Blob)
|
||||
const contentTypeHeader = headers.find((header) => header.name.toLowerCase() === 'content-type');
|
||||
const mimeType = contentTypeHeader ? contentTypeHeader.value.split(';')[0]?.trim() : null;
|
||||
|
||||
// Extract boundary from Content-Type header for multipart parsing
|
||||
const boundaryMatch = contentTypeHeader?.value.match(/boundary=([^\s;]+)/i);
|
||||
const boundary = boundaryMatch?.[1];
|
||||
|
||||
// Get raw data from --data-raw flags (before splitting by &)
|
||||
const rawDataValues = [
|
||||
...((flagsByName['data-raw'] as string[] | undefined) || []),
|
||||
...((flagsByName.d as string[] | undefined) || []),
|
||||
...((flagsByName.data as string[] | undefined) || []),
|
||||
...((flagsByName['data-binary'] as string[] | undefined) || []),
|
||||
...((flagsByName['data-ascii'] as string[] | undefined) || []),
|
||||
];
|
||||
|
||||
// Check if this is multipart form data in --data-raw (Chrome DevTools format)
|
||||
let multipartFormDataFromRaw:
|
||||
| { name: string; value?: string; file?: string; enabled: boolean }[]
|
||||
| null = null;
|
||||
if (mimeType === 'multipart/form-data' && boundary && rawDataValues.length > 0) {
|
||||
const rawBody = rawDataValues.join('');
|
||||
multipartFormDataFromRaw = parseMultipartFormData(rawBody, boundary);
|
||||
}
|
||||
|
||||
const dataParameters = pairsToDataParameters(flagsByName);
|
||||
const contentTypeHeader = headers.find((header) => header.name.toLowerCase() === 'content-type');
|
||||
const mimeType = contentTypeHeader ? contentTypeHeader.value.split(';')[0] : null;
|
||||
|
||||
// Body (Multipart Form Data from -F flags)
|
||||
// Body (Multipart Form Data)
|
||||
const formDataParams = [
|
||||
...((flagsByName.form as string[] | undefined) || []),
|
||||
...((flagsByName.F as string[] | undefined) || []),
|
||||
@@ -366,13 +336,7 @@ function importCommand(parseEntries: ParseEntry[], workspaceId: string) {
|
||||
let bodyType: string | null = null;
|
||||
const bodyAsGET = getPairValue(flagsByName, false, ['G', 'get']);
|
||||
|
||||
if (multipartFormDataFromRaw) {
|
||||
// Handle multipart form data parsed from --data-raw (Chrome DevTools format)
|
||||
bodyType = 'multipart/form-data';
|
||||
body = {
|
||||
form: multipartFormDataFromRaw,
|
||||
};
|
||||
} else if (dataParameters.length > 0 && bodyAsGET) {
|
||||
if (dataParameters.length > 0 && bodyAsGET) {
|
||||
urlParameters.push(...dataParameters);
|
||||
} else if (
|
||||
dataParameters.length > 0 &&
|
||||
@@ -509,71 +473,6 @@ function splitOnce(str: string, sep: string): string[] {
|
||||
return [str];
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses multipart form data from a raw body string
|
||||
* Used when Chrome DevTools exports a cURL with --data-raw containing multipart data
|
||||
*/
|
||||
function parseMultipartFormData(
|
||||
rawBody: string,
|
||||
boundary: string,
|
||||
): { name: string; value?: string; file?: string; enabled: boolean }[] | null {
|
||||
const results: { name: string; value?: string; file?: string; enabled: boolean }[] = [];
|
||||
|
||||
// The boundary in the body typically has -- prefix
|
||||
const boundaryMarker = `--${boundary}`;
|
||||
const parts = rawBody.split(boundaryMarker);
|
||||
|
||||
for (const part of parts) {
|
||||
// Skip empty parts and the closing boundary marker
|
||||
if (!part || part.trim() === '--' || part.trim() === '--\r\n') {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Each part has headers and content separated by \r\n\r\n
|
||||
const headerContentSplit = part.indexOf('\r\n\r\n');
|
||||
if (headerContentSplit === -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const headerSection = part.slice(0, headerContentSplit);
|
||||
let content = part.slice(headerContentSplit + 4); // Skip \r\n\r\n
|
||||
|
||||
// Remove trailing \r\n from content
|
||||
if (content.endsWith('\r\n')) {
|
||||
content = content.slice(0, -2);
|
||||
}
|
||||
|
||||
// Parse Content-Disposition header to get name and filename
|
||||
const contentDispositionMatch = headerSection.match(
|
||||
/Content-Disposition:\s*form-data;\s*name="([^"]+)"(?:;\s*filename="([^"]+)")?/i,
|
||||
);
|
||||
|
||||
if (!contentDispositionMatch) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const name = contentDispositionMatch[1] ?? '';
|
||||
const filename = contentDispositionMatch[2];
|
||||
|
||||
const item: { name: string; value?: string; file?: string; enabled: boolean } = {
|
||||
name,
|
||||
enabled: true,
|
||||
};
|
||||
|
||||
if (filename) {
|
||||
// This is a file upload field
|
||||
item.file = filename;
|
||||
} else {
|
||||
// This is a regular text field
|
||||
item.value = content;
|
||||
}
|
||||
|
||||
results.push(item);
|
||||
}
|
||||
|
||||
return results.length > 0 ? results : null;
|
||||
}
|
||||
|
||||
const idCount: Partial<Record<string, number>> = {};
|
||||
|
||||
function generateId(model: string): string {
|
||||
|
||||
@@ -441,72 +441,6 @@ describe('importer-curl', () => {
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test('Imports multipart form data from --data-raw (Chrome DevTools format)', () => {
|
||||
// This is the format Chrome DevTools uses when copying a multipart form submission as cURL
|
||||
const curlCommand = `curl 'http://localhost:8080/system' \
|
||||
-H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryHwsXKi4rKA6P5VBd' \
|
||||
--data-raw $'------WebKitFormBoundaryHwsXKi4rKA6P5VBd\r\nContent-Disposition: form-data; name="username"\r\n\r\njsgj\r\n------WebKitFormBoundaryHwsXKi4rKA6P5VBd\r\nContent-Disposition: form-data; name="password"\r\n\r\n654321\r\n------WebKitFormBoundaryHwsXKi4rKA6P5VBd\r\nContent-Disposition: form-data; name="captcha"; filename="test.xlsx"\r\nContent-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\r\n\r\n\r\n------WebKitFormBoundaryHwsXKi4rKA6P5VBd--\r\n'`;
|
||||
|
||||
expect(convertCurl(curlCommand)).toEqual({
|
||||
resources: {
|
||||
workspaces: [baseWorkspace()],
|
||||
httpRequests: [
|
||||
baseRequest({
|
||||
url: 'http://localhost:8080/system',
|
||||
method: 'POST',
|
||||
headers: [
|
||||
{
|
||||
name: 'Content-Type',
|
||||
value: 'multipart/form-data; boundary=----WebKitFormBoundaryHwsXKi4rKA6P5VBd',
|
||||
enabled: true,
|
||||
},
|
||||
],
|
||||
bodyType: 'multipart/form-data',
|
||||
body: {
|
||||
form: [
|
||||
{ name: 'username', value: 'jsgj', enabled: true },
|
||||
{ name: 'password', value: '654321', enabled: true },
|
||||
{ name: 'captcha', file: 'test.xlsx', enabled: true },
|
||||
],
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test('Imports multipart form data with text-only fields from --data-raw', () => {
|
||||
const curlCommand = `curl 'http://example.com/api' \
|
||||
-H 'Content-Type: multipart/form-data; boundary=----FormBoundary123' \
|
||||
--data-raw $'------FormBoundary123\r\nContent-Disposition: form-data; name="field1"\r\n\r\nvalue1\r\n------FormBoundary123\r\nContent-Disposition: form-data; name="field2"\r\n\r\nvalue2\r\n------FormBoundary123--\r\n'`;
|
||||
|
||||
expect(convertCurl(curlCommand)).toEqual({
|
||||
resources: {
|
||||
workspaces: [baseWorkspace()],
|
||||
httpRequests: [
|
||||
baseRequest({
|
||||
url: 'http://example.com/api',
|
||||
method: 'POST',
|
||||
headers: [
|
||||
{
|
||||
name: 'Content-Type',
|
||||
value: 'multipart/form-data; boundary=----FormBoundary123',
|
||||
enabled: true,
|
||||
},
|
||||
],
|
||||
bodyType: 'multipart/form-data',
|
||||
body: {
|
||||
form: [
|
||||
{ name: 'field1', value: 'value1', enabled: true },
|
||||
{ name: 'field2', value: 'value2', enabled: true },
|
||||
],
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
const idCount: Partial<Record<string, number>> = {};
|
||||
|
||||
@@ -1,116 +1,791 @@
|
||||
import type { PluginDefinition } from '@yaakapp/api';
|
||||
|
||||
// Yaak themes
|
||||
import { highContrast, highContrastDark } from './themes/high-contrast';
|
||||
import {
|
||||
catppuccinFrappe,
|
||||
catppuccinMacchiato,
|
||||
catppuccinMocha,
|
||||
catppuccinLatte,
|
||||
} from './themes/catppuccin';
|
||||
import { dracula } from './themes/dracula';
|
||||
import { githubDark, githubLight } from './themes/github';
|
||||
import { gruvbox } from './themes/gruvbox';
|
||||
import { hotdogStand } from './themes/hotdog-stand';
|
||||
import {
|
||||
monokaiPro,
|
||||
monokaiProClassic,
|
||||
monokaiProMachine,
|
||||
monokaiProOctagon,
|
||||
monokaiProRistretto,
|
||||
monokaiProSpectrum,
|
||||
} from './themes/monokai-pro';
|
||||
import { moonlight } from './themes/moonlight';
|
||||
import { nord } from './themes/nord';
|
||||
import { relaxing } from './themes/relaxing';
|
||||
import { rosePine, rosePineMoon, rosePineDawn } from './themes/rose-pine';
|
||||
import { triangle } from './themes/triangle';
|
||||
|
||||
// VSCode themes
|
||||
import { oneDarkPro } from './themes/one-dark-pro';
|
||||
import { materialPalenight } from './themes/material-palenight';
|
||||
import { materialOcean } from './themes/material-ocean';
|
||||
import { materialDarker } from './themes/material-darker';
|
||||
import { nightOwl, lightOwl } from './themes/night-owl';
|
||||
import { tokyoNight, tokyoNightStorm, tokyoNightDay } from './themes/tokyo-night';
|
||||
import { solarizedDark, solarizedLight } from './themes/solarized';
|
||||
import { ayuDark, ayuMirage, ayuLight } from './themes/ayu';
|
||||
import { synthwave84 } from './themes/synthwave-84';
|
||||
import { shadesOfPurple, shadesOfPurpleSuperDark } from './themes/shades-of-purple';
|
||||
import { cobalt2 } from './themes/cobalt2';
|
||||
import { horizon } from './themes/horizon';
|
||||
import { pandaSyntax } from './themes/panda';
|
||||
import { andromeda } from './themes/andromeda';
|
||||
import { winterIsComing } from './themes/winter-is-coming';
|
||||
import { atomOneDark } from './themes/atom-one-dark';
|
||||
import { vitesseDark, vitesseLight } from './themes/vitesse';
|
||||
import { everforestDark, everforestLight } from './themes/everforest';
|
||||
import { githubDarkDimmed } from './themes/github-dimmed';
|
||||
import { slackAubergine } from './themes/slack';
|
||||
import { noctisAzureus } from './themes/noctis';
|
||||
import { blulocoDark, blulocoLight } from './themes/bluloco';
|
||||
import { fleetLight, fleetDarkPurple, fleetDark } from './themes/fleet';
|
||||
|
||||
export const plugin: PluginDefinition = {
|
||||
themes: [
|
||||
andromeda,
|
||||
atomOneDark,
|
||||
ayuDark,
|
||||
ayuLight,
|
||||
ayuMirage,
|
||||
blulocoDark,
|
||||
blulocoLight,
|
||||
catppuccinFrappe,
|
||||
catppuccinLatte,
|
||||
catppuccinMacchiato,
|
||||
catppuccinMocha,
|
||||
cobalt2,
|
||||
dracula,
|
||||
everforestDark,
|
||||
everforestLight,
|
||||
fleetDark,
|
||||
fleetDarkPurple,
|
||||
fleetLight,
|
||||
githubDark,
|
||||
githubDarkDimmed,
|
||||
githubLight,
|
||||
gruvbox,
|
||||
highContrast,
|
||||
highContrastDark,
|
||||
horizon,
|
||||
hotdogStand,
|
||||
lightOwl,
|
||||
materialDarker,
|
||||
materialOcean,
|
||||
materialPalenight,
|
||||
monokaiPro,
|
||||
monokaiProClassic,
|
||||
monokaiProMachine,
|
||||
monokaiProOctagon,
|
||||
monokaiProRistretto,
|
||||
monokaiProSpectrum,
|
||||
moonlight,
|
||||
nightOwl,
|
||||
noctisAzureus,
|
||||
nord,
|
||||
oneDarkPro,
|
||||
pandaSyntax,
|
||||
relaxing,
|
||||
rosePine,
|
||||
rosePineDawn,
|
||||
rosePineMoon,
|
||||
shadesOfPurple,
|
||||
shadesOfPurpleSuperDark,
|
||||
slackAubergine,
|
||||
solarizedDark,
|
||||
solarizedLight,
|
||||
synthwave84,
|
||||
tokyoNight,
|
||||
tokyoNightDay,
|
||||
tokyoNightStorm,
|
||||
triangle,
|
||||
vitesseDark,
|
||||
vitesseLight,
|
||||
winterIsComing,
|
||||
{
|
||||
id: 'high-contrast',
|
||||
label: 'High Contrast Light',
|
||||
dark: false,
|
||||
base: {
|
||||
surface: 'white',
|
||||
surfaceHighlight: 'hsl(218,24%,93%)',
|
||||
text: 'black',
|
||||
textSubtle: 'hsl(217,24%,40%)',
|
||||
textSubtlest: 'hsl(217,24%,40%)',
|
||||
border: 'hsl(217,22%,50%)',
|
||||
borderSubtle: 'hsl(217,22%,60%)',
|
||||
primary: 'hsl(267,67%,47%)',
|
||||
secondary: 'hsl(218,18%,53%)',
|
||||
info: 'hsl(206,100%,36%)',
|
||||
success: 'hsl(155,100%,26%)',
|
||||
notice: 'hsl(45,100%,31%)',
|
||||
warning: 'hsl(30,99%,34%)',
|
||||
danger: 'hsl(334,100%,35%)',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'high-contrast-dark',
|
||||
label: 'High Contrast Dark',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(0,0%,0%)',
|
||||
surfaceHighlight: 'hsl(0,0%,20%)',
|
||||
text: 'hsl(0,0%,100%)',
|
||||
textSubtle: 'hsl(0,0%,90%)',
|
||||
textSubtlest: 'hsl(0,0%,80%)',
|
||||
selection: 'hsl(276,100%,30%)',
|
||||
surfaceActive: 'hsl(276,100%,30%)',
|
||||
border: 'hsl(0,0%,60%)',
|
||||
primary: 'hsl(266,100%,85%)',
|
||||
secondary: 'hsl(242,20%,72%)',
|
||||
info: 'hsl(208,100%,83%)',
|
||||
success: 'hsl(150,100%,63%)',
|
||||
notice: 'hsl(49,100%,77%)',
|
||||
warning: 'hsl(28,100%,73%)',
|
||||
danger: 'hsl(343,100%,79%)',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'catppuccin-frappe',
|
||||
label: 'Catppuccin Frappé',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(231,19%,20%)',
|
||||
text: 'hsl(227,70%,87%)',
|
||||
textSubtle: 'hsl(228,29%,73%)',
|
||||
textSubtlest: 'hsl(227,17%,58%)',
|
||||
primary: 'hsl(277,59%,76%)',
|
||||
secondary: 'hsl(228,39%,80%)',
|
||||
info: 'hsl(222,74%,74%)',
|
||||
success: 'hsl(96,44%,68%)',
|
||||
notice: 'hsl(40,62%,73%)',
|
||||
warning: 'hsl(20,79%,70%)',
|
||||
danger: 'hsl(359,68%,71%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(240,21%,12%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(229,19%,23%)',
|
||||
border: 'hsl(229,19%,27%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(229,20%,17%)',
|
||||
border: 'hsl(229,20%,25%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(229,19%,23%)',
|
||||
border: 'hsl(229,19%,27%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(277,59%,68%)',
|
||||
secondary: 'hsl(228,39%,72%)',
|
||||
info: 'hsl(222,74%,67%)',
|
||||
success: 'hsl(96,44%,61%)',
|
||||
notice: 'hsl(40,62%,66%)',
|
||||
warning: 'hsl(20,79%,63%)',
|
||||
danger: 'hsl(359,68%,64%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'catppuccin-macchiato',
|
||||
label: 'Catppuccin Macchiato',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(233,23%,15%)',
|
||||
text: 'hsl(227,68%,88%)',
|
||||
textSubtle: 'hsl(227,27%,72%)',
|
||||
textSubtlest: 'hsl(228,15%,57%)',
|
||||
primary: 'hsl(267,83%,80%)',
|
||||
secondary: 'hsl(228,39%,80%)',
|
||||
info: 'hsl(220,83%,75%)',
|
||||
success: 'hsl(105,48%,72%)',
|
||||
notice: 'hsl(40,70%,78%)',
|
||||
warning: 'hsl(21,86%,73%)',
|
||||
danger: 'hsl(351,74%,73%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(240,21%,12%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(232,23%,18%)',
|
||||
border: 'hsl(231,23%,22%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(236,23%,12%)',
|
||||
border: 'hsl(236,23%,21%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(232,23%,18%)',
|
||||
border: 'hsl(231,23%,22%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(267,82%,72%)',
|
||||
secondary: 'hsl(228,39%,72%)',
|
||||
info: 'hsl(220,83%,68%)',
|
||||
success: 'hsl(105,48%,65%)',
|
||||
notice: 'hsl(40,70%,70%)',
|
||||
warning: 'hsl(21,86%,66%)',
|
||||
danger: 'hsl(351,74%,66%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'catppuccin-mocha',
|
||||
label: 'Catppuccin Mocha',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(240,21%,12%)',
|
||||
text: 'hsl(226,64%,88%)',
|
||||
textSubtle: 'hsl(228,24%,72%)',
|
||||
textSubtlest: 'hsl(230,13%,55%)',
|
||||
primary: 'hsl(267,83%,80%)',
|
||||
secondary: 'hsl(227,35%,80%)',
|
||||
info: 'hsl(217,92%,76%)',
|
||||
success: 'hsl(115,54%,76%)',
|
||||
notice: 'hsl(41,86%,83%)',
|
||||
warning: 'hsl(23,92%,75%)',
|
||||
danger: 'hsl(343,81%,75%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(240,21%,12%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(240,21%,15%)',
|
||||
border: 'hsl(240,21%,19%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(240,23%,9%)',
|
||||
border: 'hsl(240,22%,18%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(240,21%,15%)',
|
||||
border: 'hsl(240,21%,19%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(267,67%,65%)',
|
||||
secondary: 'hsl(227,28%,64%)',
|
||||
info: 'hsl(217,74%,61%)',
|
||||
success: 'hsl(115,43%,61%)',
|
||||
notice: 'hsl(41,69%,66%)',
|
||||
warning: 'hsl(23,74%,60%)',
|
||||
danger: 'hsl(343,65%,60%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'catppuccin-latte',
|
||||
label: 'Catppuccin Latte',
|
||||
dark: false,
|
||||
base: {
|
||||
surface: 'hsl(220,23%,95%)',
|
||||
text: 'hsl(234,16%,35%)',
|
||||
textSubtle: 'hsl(233,10%,47%)',
|
||||
textSubtlest: 'hsl(231,10%,59%)',
|
||||
primary: 'hsl(266,85%,58%)',
|
||||
secondary: 'hsl(233,10%,47%)',
|
||||
info: 'hsl(231,97%,72%)',
|
||||
success: 'hsl(183,74%,35%)',
|
||||
notice: 'hsl(35,77%,49%)',
|
||||
warning: 'hsl(22,99%,52%)',
|
||||
danger: 'hsl(355,76%,59%)',
|
||||
},
|
||||
components: {
|
||||
sidebar: {
|
||||
surface: 'hsl(220,22%,92%)',
|
||||
border: 'hsl(220,22%,87%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(220,21%,89%)',
|
||||
border: 'hsl(220,22%,87%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'dracula',
|
||||
label: 'Dracula',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(231,15%,18%)',
|
||||
surfaceHighlight: 'hsl(230,15%,24%)',
|
||||
text: 'hsl(60,30%,96%)',
|
||||
textSubtle: 'hsl(232,14%,65%)',
|
||||
textSubtlest: 'hsl(232,14%,50%)',
|
||||
primary: 'hsl(265,89%,78%)',
|
||||
secondary: 'hsl(225,27%,51%)',
|
||||
info: 'hsl(191,97%,77%)',
|
||||
success: 'hsl(135,94%,65%)',
|
||||
notice: 'hsl(65,92%,76%)',
|
||||
warning: 'hsl(31,100%,71%)',
|
||||
danger: 'hsl(0,100%,67%)',
|
||||
},
|
||||
components: {
|
||||
sidebar: {
|
||||
backdrop: 'hsl(230,15%,24%)',
|
||||
},
|
||||
appHeader: {
|
||||
backdrop: 'hsl(235,14%,15%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'github-dark',
|
||||
label: 'GitHub',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(213,30%,7%)',
|
||||
surfaceHighlight: 'hsl(213,16%,13%)',
|
||||
text: 'hsl(212,27%,89%)',
|
||||
textSubtle: 'hsl(212,9%,57%)',
|
||||
textSubtlest: 'hsl(217,8%,45%)',
|
||||
border: 'hsl(215,21%,11%)',
|
||||
primary: 'hsl(262,78%,74%)',
|
||||
secondary: 'hsl(217,8%,50%)',
|
||||
info: 'hsl(215,84%,64%)',
|
||||
success: 'hsl(129,48%,52%)',
|
||||
notice: 'hsl(39,71%,58%)',
|
||||
warning: 'hsl(22,83%,60%)',
|
||||
danger: 'hsl(3,83%,65%)',
|
||||
},
|
||||
components: {
|
||||
button: {
|
||||
primary: 'hsl(262,79%,71%)',
|
||||
secondary: 'hsl(217,8%,45%)',
|
||||
info: 'hsl(215,84%,60%)',
|
||||
success: 'hsl(129,48%,47%)',
|
||||
notice: 'hsl(39,71%,53%)',
|
||||
warning: 'hsl(22,83%,56%)',
|
||||
danger: 'hsl(3,83%,61%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'github-light',
|
||||
label: 'GitHub',
|
||||
dark: false,
|
||||
base: {
|
||||
surface: 'hsl(0,0%,100%)',
|
||||
surfaceHighlight: 'hsl(210,29%,94%)',
|
||||
text: 'hsl(213,13%,14%)',
|
||||
textSubtle: 'hsl(212,9%,43%)',
|
||||
textSubtlest: 'hsl(203,8%,55%)',
|
||||
border: 'hsl(210,15%,92%)',
|
||||
borderSubtle: 'hsl(210,15%,92%)',
|
||||
primary: 'hsl(261,69%,59%)',
|
||||
secondary: 'hsl(212,8%,47%)',
|
||||
info: 'hsl(212,92%,48%)',
|
||||
success: 'hsl(137,66%,32%)',
|
||||
notice: 'hsl(40,100%,40%)',
|
||||
warning: 'hsl(24,100%,44%)',
|
||||
danger: 'hsl(356,71%,48%)',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'gruvbox',
|
||||
label: 'Gruvbox',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(0,0%,16%)',
|
||||
surfaceHighlight: 'hsl(20,3%,19%)',
|
||||
text: 'hsl(53,74%,91%)',
|
||||
textSubtle: 'hsl(39,24%,66%)',
|
||||
textSubtlest: 'hsl(30,12%,51%)',
|
||||
primary: 'hsl(344,47%,68%)',
|
||||
secondary: 'hsl(157,16%,58%)',
|
||||
info: 'hsl(104,35%,62%)',
|
||||
success: 'hsl(61,66%,44%)',
|
||||
notice: 'hsl(42,95%,58%)',
|
||||
warning: 'hsl(27,99%,55%)',
|
||||
danger: 'hsl(6,96%,59%)',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'hotdog-stand',
|
||||
label: 'Hotdog Stand',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(0,100%,50%)',
|
||||
surfaceHighlight: 'hsl(0,0%,0%)',
|
||||
text: 'hsl(0,0%,100%)',
|
||||
textSubtle: 'hsl(0,0%,100%)',
|
||||
textSubtlest: 'hsl(60,100%,50%)',
|
||||
border: 'hsl(0,0%,0%)',
|
||||
primary: 'hsl(60,100%,50%)',
|
||||
secondary: 'hsl(60,100%,50%)',
|
||||
info: 'hsl(60,100%,50%)',
|
||||
success: 'hsl(60,100%,50%)',
|
||||
notice: 'hsl(60,100%,50%)',
|
||||
warning: 'hsl(60,100%,50%)',
|
||||
danger: 'hsl(60,100%,50%)',
|
||||
},
|
||||
components: {
|
||||
appHeader: {
|
||||
surface: 'hsl(0,0%,0%)',
|
||||
text: 'hsl(0,0%,100%)',
|
||||
textSubtle: 'hsl(60,100%,50%)',
|
||||
textSubtlest: 'hsl(0,100%,50%)',
|
||||
},
|
||||
menu: {
|
||||
surface: 'hsl(0,0%,0%)',
|
||||
border: 'hsl(0,100%,50%)',
|
||||
surfaceHighlight: 'hsl(0,100%,50%)',
|
||||
text: 'hsl(0,0%,100%)',
|
||||
textSubtle: 'hsl(60,100%,50%)',
|
||||
textSubtlest: 'hsl(60,100%,50%)',
|
||||
},
|
||||
button: {
|
||||
surface: 'hsl(0,0%,0%)',
|
||||
text: 'hsl(0,0%,100%)',
|
||||
primary: 'hsl(0,0%,0%)',
|
||||
secondary: 'hsl(0,0%,100%)',
|
||||
info: 'hsl(0,0%,0%)',
|
||||
success: 'hsl(60,100%,50%)',
|
||||
notice: 'hsl(60,100%,50%)',
|
||||
warning: 'hsl(0,0%,0%)',
|
||||
danger: 'hsl(0,100%,50%)',
|
||||
},
|
||||
editor: {
|
||||
primary: 'hsl(0,0%,100%)',
|
||||
secondary: 'hsl(0,0%,100%)',
|
||||
info: 'hsl(0,0%,100%)',
|
||||
success: 'hsl(0,0%,100%)',
|
||||
notice: 'hsl(60,100%,50%)',
|
||||
warning: 'hsl(0,0%,100%)',
|
||||
danger: 'hsl(0,0%,100%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'monokai-pro',
|
||||
label: 'Monokai Pro',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(285,5%,17%)',
|
||||
text: 'hsl(60,25%,98%)',
|
||||
textSubtle: 'hsl(0,1%,75%)',
|
||||
textSubtlest: 'hsl(300,0%,57%)',
|
||||
primary: 'hsl(250,77%,78%)',
|
||||
secondary: 'hsl(0,1%,75%)',
|
||||
info: 'hsl(186,71%,69%)',
|
||||
success: 'hsl(90,59%,66%)',
|
||||
notice: 'hsl(45,100%,70%)',
|
||||
warning: 'hsl(20,96%,70%)',
|
||||
danger: 'hsl(345,100%,69%)',
|
||||
},
|
||||
components: {
|
||||
appHeader: {
|
||||
surface: 'hsl(300,5%,13%)',
|
||||
text: 'hsl(0,1%,75%)',
|
||||
textSubtle: 'hsl(300,0%,57%)',
|
||||
textSubtlest: 'hsl(300,1%,44%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(250,77%,70%)',
|
||||
secondary: 'hsl(0,1%,68%)',
|
||||
info: 'hsl(186,71%,62%)',
|
||||
success: 'hsl(90,59%,59%)',
|
||||
notice: 'hsl(45,100%,63%)',
|
||||
warning: 'hsl(20,96%,63%)',
|
||||
danger: 'hsl(345,100%,62%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'monokai-pro-classic',
|
||||
label: 'Monokai Pro Classic',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(70,8%,15%)',
|
||||
text: 'hsl(69,100%,97%)',
|
||||
textSubtle: 'hsl(65,9%,73%)',
|
||||
textSubtlest: 'hsl(66,4%,55%)',
|
||||
primary: 'hsl(261,100%,75%)',
|
||||
secondary: 'hsl(202,8%,72%)',
|
||||
info: 'hsl(190,81%,67%)',
|
||||
success: 'hsl(80,76%,53%)',
|
||||
notice: 'hsl(54,70%,68%)',
|
||||
warning: 'hsl(32,98%,56%)',
|
||||
danger: 'hsl(338,95%,56%)',
|
||||
},
|
||||
components: {
|
||||
appHeader: {
|
||||
surface: 'hsl(72,9%,11%)',
|
||||
text: 'hsl(202,8%,72%)',
|
||||
textSubtle: 'hsl(213,4%,48%)',
|
||||
textSubtlest: 'hsl(223,6%,44%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(261,100%,68%)',
|
||||
secondary: 'hsl(202,8%,65%)',
|
||||
info: 'hsl(190,81%,60%)',
|
||||
success: 'hsl(80,76%,48%)',
|
||||
notice: 'hsl(54,71%,61%)',
|
||||
warning: 'hsl(32,98%,50%)',
|
||||
danger: 'hsl(338,95%,50%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'monokai-pro-machine',
|
||||
label: 'Monokai Pro Machine',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(200,16%,18%)',
|
||||
text: 'hsl(173,24%,93%)',
|
||||
textSubtle: 'hsl(185,6%,57%)',
|
||||
textSubtlest: 'hsl(189,6%,45%)',
|
||||
primary: 'hsl(258,86%,80%)',
|
||||
secondary: 'hsl(175,9%,75%)',
|
||||
info: 'hsl(194,81%,72%)',
|
||||
success: 'hsl(98,67%,69%)',
|
||||
notice: 'hsl(52,100%,72%)',
|
||||
warning: 'hsl(28,100%,72%)',
|
||||
danger: 'hsl(353,100%,71%)',
|
||||
},
|
||||
components: {
|
||||
appHeader: {
|
||||
surface: 'hsl(196,16%,14%)',
|
||||
text: 'hsl(202,8%,72%)',
|
||||
textSubtle: 'hsl(213,4%,48%)',
|
||||
textSubtlest: 'hsl(223,6%,44%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(258,86%,72%)',
|
||||
secondary: 'hsl(175,9%,68%)',
|
||||
info: 'hsl(194,80%,65%)',
|
||||
success: 'hsl(98,67%,62%)',
|
||||
notice: 'hsl(52,100%,65%)',
|
||||
warning: 'hsl(28,100%,65%)',
|
||||
danger: 'hsl(353,100%,64%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'monokai-pro-octagon',
|
||||
label: 'Monokai Pro Octagon',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(233,18%,19%)',
|
||||
text: 'hsl(173,24%,93%)',
|
||||
textSubtle: 'hsl(202,8%,72%)',
|
||||
textSubtlest: 'hsl(213,4%,48%)',
|
||||
primary: 'hsl(292,30%,70%)',
|
||||
secondary: 'hsl(202,8%,72%)',
|
||||
info: 'hsl(155,37%,72%)',
|
||||
success: 'hsl(75,60%,61%)',
|
||||
notice: 'hsl(44,100%,71%)',
|
||||
warning: 'hsl(23,100%,68%)',
|
||||
danger: 'hsl(352,100%,70%)',
|
||||
},
|
||||
components: {
|
||||
appHeader: {
|
||||
surface: 'hsl(235,18%,14%)',
|
||||
text: 'hsl(202,8%,72%)',
|
||||
textSubtle: 'hsl(213,4%,48%)',
|
||||
textSubtlest: 'hsl(223,6%,44%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(292,26%,63%)',
|
||||
secondary: 'hsl(201,7%,65%)',
|
||||
info: 'hsl(155,33%,65%)',
|
||||
success: 'hsl(75,54%,55%)',
|
||||
notice: 'hsl(44,90%,64%)',
|
||||
warning: 'hsl(23,90%,61%)',
|
||||
danger: 'hsl(352,90%,63%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'monokai-pro-ristretto',
|
||||
label: 'Monokai Pro Ristretto',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(0,9%,16%)',
|
||||
text: 'hsl(351,100%,97%)',
|
||||
textSubtle: 'hsl(355,9%,74%)',
|
||||
textSubtlest: 'hsl(354,4%,56%)',
|
||||
primary: 'hsl(239,63%,79%)',
|
||||
secondary: 'hsl(355,9%,74%)',
|
||||
info: 'hsl(170,53%,69%)',
|
||||
success: 'hsl(88,57%,66%)',
|
||||
notice: 'hsl(41,92%,70%)',
|
||||
warning: 'hsl(13,85%,70%)',
|
||||
danger: 'hsl(349,97%,70%)',
|
||||
},
|
||||
components: {
|
||||
appHeader: {
|
||||
surface: 'hsl(0,8%,12%)',
|
||||
text: 'hsl(355,9%,74%)',
|
||||
textSubtle: 'hsl(354,4%,56%)',
|
||||
textSubtlest: 'hsl(353,4%,43%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(239,63%,71%)',
|
||||
secondary: 'hsl(355,9%,67%)',
|
||||
info: 'hsl(170,53%,62%)',
|
||||
success: 'hsl(88,57%,59%)',
|
||||
notice: 'hsl(41,92%,63%)',
|
||||
warning: 'hsl(13,86%,63%)',
|
||||
danger: 'hsl(349,97%,63%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'monokai-pro-spectrum',
|
||||
label: 'Monokai Pro Spectrum',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(0,0%,13%)',
|
||||
text: 'hsl(266,100%,97%)',
|
||||
textSubtle: 'hsl(264,7%,73%)',
|
||||
textSubtlest: 'hsl(266,3%,55%)',
|
||||
primary: 'hsl(247,61%,72%)',
|
||||
secondary: 'hsl(264,7%,73%)',
|
||||
info: 'hsl(188,74%,63%)',
|
||||
success: 'hsl(133,54%,66%)',
|
||||
notice: 'hsl(51,96%,69%)',
|
||||
warning: 'hsl(23,98%,66%)',
|
||||
danger: 'hsl(343,96%,68%)',
|
||||
},
|
||||
components: {
|
||||
appHeader: {
|
||||
surface: 'hsl(0,0%,10%)',
|
||||
text: 'hsl(264,7%,73%)',
|
||||
textSubtle: 'hsl(266,3%,55%)',
|
||||
textSubtlest: 'hsl(264,2%,41%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(247,61%,65%)',
|
||||
secondary: 'hsl(264,7%,66%)',
|
||||
info: 'hsl(188,74%,57%)',
|
||||
success: 'hsl(133,54%,59%)',
|
||||
notice: 'hsl(51,96%,62%)',
|
||||
warning: 'hsl(23,98%,59%)',
|
||||
danger: 'hsl(343,96%,61%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'moonlight',
|
||||
label: 'Moonlight',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(234,23%,17%)',
|
||||
text: 'hsl(225,71%,90%)',
|
||||
textSubtle: 'hsl(230,28%,62%)',
|
||||
textSubtlest: 'hsl(232,26%,43%)',
|
||||
primary: 'hsl(262,100%,82%)',
|
||||
secondary: 'hsl(232,18%,65%)',
|
||||
info: 'hsl(217,100%,74%)',
|
||||
success: 'hsl(174,66%,54%)',
|
||||
notice: 'hsl(35,100%,73%)',
|
||||
warning: 'hsl(17,100%,71%)',
|
||||
danger: 'hsl(356,100%,73%)',
|
||||
},
|
||||
components: {
|
||||
appHeader: {
|
||||
surface: 'hsl(233,23%,15%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(233,23%,15%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'nord',
|
||||
label: 'Nord',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(220,16%,22%)',
|
||||
surfaceHighlight: 'hsl(220,14%,28%)',
|
||||
text: 'hsl(220,28%,93%)',
|
||||
textSubtle: 'hsl(220,26%,90%)',
|
||||
textSubtlest: 'hsl(220,24%,86%)',
|
||||
primary: 'hsl(193,38%,68%)',
|
||||
secondary: 'hsl(210,34%,63%)',
|
||||
info: 'hsl(174,25%,69%)',
|
||||
success: 'hsl(89,26%,66%)',
|
||||
notice: 'hsl(40,66%,73%)',
|
||||
warning: 'hsl(17,48%,64%)',
|
||||
danger: 'hsl(353,43%,56%)',
|
||||
},
|
||||
components: {
|
||||
sidebar: {
|
||||
backdrop: 'hsl(220,16%,22%)',
|
||||
},
|
||||
appHeader: {
|
||||
backdrop: 'hsl(220,14%,28%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'relaxing',
|
||||
label: 'Relaxing',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(267,33%,17%)',
|
||||
text: 'hsl(275,49%,92%)',
|
||||
primary: 'hsl(267,84%,81%)',
|
||||
secondary: 'hsl(227,35%,80%)',
|
||||
info: 'hsl(217,92%,76%)',
|
||||
success: 'hsl(115,54%,76%)',
|
||||
notice: 'hsl(41,86%,83%)',
|
||||
warning: 'hsl(23,92%,75%)',
|
||||
danger: 'hsl(343,81%,75%)',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'rose-pine',
|
||||
label: 'Rosé Pine',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(249,22%,12%)',
|
||||
text: 'hsl(245,50%,91%)',
|
||||
textSubtle: 'hsl(248,15%,61%)',
|
||||
textSubtlest: 'hsl(249,12%,47%)',
|
||||
primary: 'hsl(267,57%,78%)',
|
||||
secondary: 'hsl(249,12%,47%)',
|
||||
info: 'hsl(199,49%,60%)',
|
||||
success: 'hsl(180,43%,73%)',
|
||||
notice: 'hsl(35,88%,72%)',
|
||||
warning: 'hsl(1,74%,79%)',
|
||||
danger: 'hsl(343,76%,68%)',
|
||||
},
|
||||
components: {
|
||||
responsePane: {
|
||||
surface: 'hsl(247,23%,15%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(247,23%,15%)',
|
||||
},
|
||||
menu: {
|
||||
surface: 'hsl(248,21%,26%)',
|
||||
textSubtle: 'hsl(248,15%,66%)',
|
||||
textSubtlest: 'hsl(249,12%,52%)',
|
||||
border: 'hsl(248,21%,35%)',
|
||||
borderSubtle: 'hsl(248,21%,33%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'rose-pine-moon',
|
||||
label: 'Rosé Pine Moon',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(246,24%,17%)',
|
||||
text: 'hsl(245,50%,91%)',
|
||||
textSubtle: 'hsl(248,15%,61%)',
|
||||
textSubtlest: 'hsl(249,12%,47%)',
|
||||
primary: 'hsl(267,57%,78%)',
|
||||
secondary: 'hsl(248,15%,61%)',
|
||||
info: 'hsl(197,48%,60%)',
|
||||
success: 'hsl(197,48%,60%)',
|
||||
notice: 'hsl(35,88%,72%)',
|
||||
warning: 'hsl(2,66%,75%)',
|
||||
danger: 'hsl(343,76%,68%)',
|
||||
},
|
||||
components: {
|
||||
responsePane: {
|
||||
surface: 'hsl(247,24%,20%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(247,24%,20%)',
|
||||
},
|
||||
menu: {
|
||||
surface: 'hsl(248,21%,26%)',
|
||||
textSubtle: 'hsl(248,15%,61%)',
|
||||
textSubtlest: 'hsl(249,12%,55%)',
|
||||
border: 'hsl(248,21%,35%)',
|
||||
borderSubtle: 'hsl(248,21%,31%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'rose-pine-dawn',
|
||||
label: 'Rosé Pine Dawn',
|
||||
dark: false,
|
||||
base: {
|
||||
surface: 'hsl(32,57%,95%)',
|
||||
border: 'hsl(10,9%,86%)',
|
||||
surfaceHighlight: 'hsl(25,35%,93%)',
|
||||
text: 'hsl(248,19%,40%)',
|
||||
textSubtle: 'hsl(248,12%,52%)',
|
||||
textSubtlest: 'hsl(257,9%,61%)',
|
||||
primary: 'hsl(271,27%,56%)',
|
||||
secondary: 'hsl(249,12%,47%)',
|
||||
info: 'hsl(197,52%,36%)',
|
||||
success: 'hsl(188,31%,45%)',
|
||||
notice: 'hsl(34,64%,49%)',
|
||||
warning: 'hsl(2,47%,64%)',
|
||||
danger: 'hsl(343,35%,55%)',
|
||||
},
|
||||
components: {
|
||||
responsePane: {
|
||||
border: 'hsl(20,12%,90%)',
|
||||
},
|
||||
sidebar: {
|
||||
border: 'hsl(20,12%,90%)',
|
||||
},
|
||||
appHeader: {
|
||||
border: 'hsl(20,12%,90%)',
|
||||
},
|
||||
input: {
|
||||
border: 'hsl(10,9%,86%)',
|
||||
},
|
||||
dialog: {
|
||||
border: 'hsl(20,12%,90%)',
|
||||
},
|
||||
menu: {
|
||||
surface: 'hsl(28,40%,92%)',
|
||||
border: 'hsl(10,9%,86%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'triangle',
|
||||
dark: true,
|
||||
label: 'Triangle',
|
||||
base: {
|
||||
surface: 'rgb(0,0,0)',
|
||||
surfaceHighlight: 'rgb(21,21,21)',
|
||||
surfaceActive: 'rgb(31,31,31)',
|
||||
text: 'rgb(237,237,237)',
|
||||
textSubtle: 'rgb(161,161,161)',
|
||||
textSubtlest: 'rgb(115,115,115)',
|
||||
border: 'rgb(31,31,31)',
|
||||
primary: 'rgb(196,114,251)',
|
||||
secondary: 'rgb(161,161,161)',
|
||||
info: 'rgb(71,168,255)',
|
||||
success: 'rgb(0,202,81)',
|
||||
notice: 'rgb(255,175,0)',
|
||||
warning: '#FF4C8D',
|
||||
danger: '#fd495a',
|
||||
},
|
||||
components: {
|
||||
editor: {
|
||||
danger: '#FF4C8D',
|
||||
warning: '#fd495a',
|
||||
},
|
||||
dialog: {
|
||||
surface: 'rgb(10,10,10)',
|
||||
border: 'rgb(31,31,31)',
|
||||
},
|
||||
sidebar: {
|
||||
border: 'rgb(31,31,31)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'rgb(10,10,10)',
|
||||
border: 'rgb(31,31,31)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'rgb(10,10,10)',
|
||||
border: 'rgb(31,31,31)',
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const andromeda: Theme = {
|
||||
id: 'andromeda',
|
||||
label: 'Andromeda',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(251, 25%, 15%)',
|
||||
surfaceHighlight: 'hsl(251, 22%, 20%)',
|
||||
text: 'hsl(220, 10%, 85%)',
|
||||
textSubtle: 'hsl(220, 8%, 60%)',
|
||||
textSubtlest: 'hsl(220, 6%, 45%)',
|
||||
primary: 'hsl(293, 75%, 68%)',
|
||||
secondary: 'hsl(220, 8%, 60%)',
|
||||
info: 'hsl(180, 60%, 60%)',
|
||||
success: 'hsl(85, 60%, 55%)',
|
||||
notice: 'hsl(38, 100%, 65%)',
|
||||
warning: 'hsl(25, 95%, 60%)',
|
||||
danger: 'hsl(358, 80%, 60%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(251, 25%, 12%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(251, 23%, 13%)',
|
||||
border: 'hsl(251, 20%, 18%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(251, 25%, 11%)',
|
||||
border: 'hsl(251, 20%, 16%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(251, 23%, 13%)',
|
||||
border: 'hsl(251, 20%, 18%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(293, 75%, 61%)',
|
||||
secondary: 'hsl(220, 8%, 53%)',
|
||||
info: 'hsl(180, 60%, 53%)',
|
||||
success: 'hsl(85, 60%, 48%)',
|
||||
notice: 'hsl(38, 100%, 58%)',
|
||||
warning: 'hsl(25, 95%, 53%)',
|
||||
danger: 'hsl(358, 80%, 53%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,47 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const atomOneDark: Theme = {
|
||||
id: 'atom-one-dark',
|
||||
label: 'Atom One Dark',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(220, 13%, 18%)',
|
||||
surfaceHighlight: 'hsl(219, 13%, 22%)',
|
||||
text: 'hsl(219, 14%, 71%)',
|
||||
textSubtle: 'hsl(220, 9%, 55%)',
|
||||
textSubtlest: 'hsl(220, 8%, 45%)',
|
||||
primary: 'hsl(286, 60%, 67%)',
|
||||
secondary: 'hsl(220, 9%, 55%)',
|
||||
info: 'hsl(207, 82%, 66%)',
|
||||
success: 'hsl(95, 38%, 62%)',
|
||||
notice: 'hsl(39, 67%, 69%)',
|
||||
warning: 'hsl(29, 54%, 61%)',
|
||||
danger: 'hsl(355, 65%, 65%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(220, 13%, 14%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(220, 13%, 16%)',
|
||||
border: 'hsl(220, 13%, 20%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(220, 13%, 12%)',
|
||||
border: 'hsl(220, 13%, 18%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(220, 13%, 16%)',
|
||||
border: 'hsl(220, 13%, 20%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(286, 60%, 60%)',
|
||||
secondary: 'hsl(220, 9%, 48%)',
|
||||
info: 'hsl(207, 82%, 59%)',
|
||||
success: 'hsl(95, 38%, 55%)',
|
||||
notice: 'hsl(39, 67%, 62%)',
|
||||
warning: 'hsl(29, 54%, 54%)',
|
||||
danger: 'hsl(355, 65%, 58%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,122 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const ayuDark: Theme = {
|
||||
id: 'ayu-dark',
|
||||
label: 'Ayu Dark',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(220, 25%, 10%)',
|
||||
surfaceHighlight: 'hsl(220, 20%, 15%)',
|
||||
text: 'hsl(210, 22%, 78%)',
|
||||
textSubtle: 'hsl(40, 13%, 50%)',
|
||||
textSubtlest: 'hsl(220, 10%, 40%)',
|
||||
primary: 'hsl(38, 100%, 56%)',
|
||||
secondary: 'hsl(210, 15%, 55%)',
|
||||
info: 'hsl(200, 80%, 60%)',
|
||||
success: 'hsl(100, 75%, 60%)',
|
||||
notice: 'hsl(38, 100%, 56%)',
|
||||
warning: 'hsl(25, 100%, 60%)',
|
||||
danger: 'hsl(345, 80%, 60%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(220, 25%, 8%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(220, 22%, 12%)',
|
||||
border: 'hsl(220, 20%, 16%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(220, 25%, 7%)',
|
||||
border: 'hsl(220, 20%, 13%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(220, 22%, 12%)',
|
||||
border: 'hsl(220, 20%, 16%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(38, 100%, 50%)',
|
||||
secondary: 'hsl(210, 15%, 48%)',
|
||||
info: 'hsl(200, 80%, 53%)',
|
||||
success: 'hsl(100, 75%, 53%)',
|
||||
notice: 'hsl(38, 100%, 50%)',
|
||||
warning: 'hsl(25, 100%, 53%)',
|
||||
danger: 'hsl(345, 80%, 53%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const ayuMirage: Theme = {
|
||||
id: 'ayu-mirage',
|
||||
label: 'Ayu Mirage',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(226, 23%, 17%)',
|
||||
surfaceHighlight: 'hsl(226, 20%, 22%)',
|
||||
text: 'hsl(212, 15%, 81%)',
|
||||
textSubtle: 'hsl(212, 12%, 55%)',
|
||||
textSubtlest: 'hsl(212, 10%, 45%)',
|
||||
primary: 'hsl(38, 100%, 67%)',
|
||||
secondary: 'hsl(212, 12%, 55%)',
|
||||
info: 'hsl(200, 80%, 70%)',
|
||||
success: 'hsl(100, 50%, 68%)',
|
||||
notice: 'hsl(38, 100%, 67%)',
|
||||
warning: 'hsl(25, 100%, 70%)',
|
||||
danger: 'hsl(345, 80%, 70%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(226, 23%, 14%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(226, 22%, 15%)',
|
||||
border: 'hsl(226, 20%, 20%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(226, 23%, 12%)',
|
||||
border: 'hsl(226, 20%, 17%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(226, 22%, 15%)',
|
||||
border: 'hsl(226, 20%, 20%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(38, 100%, 60%)',
|
||||
info: 'hsl(200, 80%, 63%)',
|
||||
success: 'hsl(100, 50%, 61%)',
|
||||
notice: 'hsl(38, 100%, 60%)',
|
||||
warning: 'hsl(25, 100%, 63%)',
|
||||
danger: 'hsl(345, 80%, 63%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const ayuLight: Theme = {
|
||||
id: 'ayu-light',
|
||||
label: 'Ayu Light',
|
||||
dark: false,
|
||||
base: {
|
||||
surface: 'hsl(40, 22%, 97%)',
|
||||
surfaceHighlight: 'hsl(40, 20%, 93%)',
|
||||
text: 'hsl(214, 10%, 35%)',
|
||||
textSubtle: 'hsl(214, 8%, 50%)',
|
||||
textSubtlest: 'hsl(214, 6%, 60%)',
|
||||
primary: 'hsl(35, 100%, 45%)',
|
||||
secondary: 'hsl(214, 8%, 50%)',
|
||||
info: 'hsl(200, 75%, 45%)',
|
||||
success: 'hsl(100, 60%, 40%)',
|
||||
notice: 'hsl(35, 100%, 45%)',
|
||||
warning: 'hsl(22, 100%, 50%)',
|
||||
danger: 'hsl(345, 70%, 55%)',
|
||||
},
|
||||
components: {
|
||||
sidebar: {
|
||||
surface: 'hsl(40, 20%, 95%)',
|
||||
border: 'hsl(40, 15%, 90%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(40, 20%, 93%)',
|
||||
border: 'hsl(40, 15%, 88%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,77 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const blulocoDark: Theme = {
|
||||
id: 'bluloco-dark',
|
||||
label: 'Bluloco Dark',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(230, 20%, 14%)',
|
||||
surfaceHighlight: 'hsl(230, 17%, 19%)',
|
||||
text: 'hsl(220, 15%, 80%)',
|
||||
textSubtle: 'hsl(220, 10%, 55%)',
|
||||
textSubtlest: 'hsl(220, 8%, 42%)',
|
||||
primary: 'hsl(218, 85%, 65%)',
|
||||
secondary: 'hsl(220, 10%, 55%)',
|
||||
info: 'hsl(218, 85%, 65%)',
|
||||
success: 'hsl(95, 55%, 55%)',
|
||||
notice: 'hsl(37, 90%, 60%)',
|
||||
warning: 'hsl(22, 85%, 55%)',
|
||||
danger: 'hsl(355, 75%, 60%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(230, 20%, 11%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(230, 18%, 12%)',
|
||||
border: 'hsl(230, 16%, 17%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(230, 20%, 10%)',
|
||||
border: 'hsl(230, 16%, 15%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(230, 18%, 12%)',
|
||||
border: 'hsl(230, 16%, 17%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(218, 85%, 58%)',
|
||||
secondary: 'hsl(220, 10%, 48%)',
|
||||
info: 'hsl(218, 85%, 58%)',
|
||||
success: 'hsl(95, 55%, 48%)',
|
||||
notice: 'hsl(37, 90%, 53%)',
|
||||
warning: 'hsl(22, 85%, 48%)',
|
||||
danger: 'hsl(355, 75%, 53%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const blulocoLight: Theme = {
|
||||
id: 'bluloco-light',
|
||||
label: 'Bluloco Light',
|
||||
dark: false,
|
||||
base: {
|
||||
surface: 'hsl(0, 0%, 98%)',
|
||||
surfaceHighlight: 'hsl(220, 15%, 94%)',
|
||||
text: 'hsl(228, 18%, 30%)',
|
||||
textSubtle: 'hsl(228, 10%, 48%)',
|
||||
textSubtlest: 'hsl(228, 8%, 58%)',
|
||||
primary: 'hsl(218, 80%, 48%)',
|
||||
secondary: 'hsl(228, 10%, 48%)',
|
||||
info: 'hsl(218, 80%, 48%)',
|
||||
success: 'hsl(138, 55%, 40%)',
|
||||
notice: 'hsl(35, 85%, 45%)',
|
||||
warning: 'hsl(22, 80%, 48%)',
|
||||
danger: 'hsl(355, 70%, 48%)',
|
||||
},
|
||||
components: {
|
||||
sidebar: {
|
||||
surface: 'hsl(220, 15%, 96%)',
|
||||
border: 'hsl(220, 12%, 90%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(220, 15%, 94%)',
|
||||
border: 'hsl(220, 12%, 88%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,165 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const catppuccinFrappe: Theme = {
|
||||
id: 'catppuccin-frappe',
|
||||
label: 'Catppuccin Frappé',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(231,19%,20%)',
|
||||
text: 'hsl(227,70%,87%)',
|
||||
textSubtle: 'hsl(228,29%,73%)',
|
||||
textSubtlest: 'hsl(227,17%,58%)',
|
||||
primary: 'hsl(277,59%,76%)',
|
||||
secondary: 'hsl(228,39%,80%)',
|
||||
info: 'hsl(222,74%,74%)',
|
||||
success: 'hsl(96,44%,68%)',
|
||||
notice: 'hsl(40,62%,73%)',
|
||||
warning: 'hsl(20,79%,70%)',
|
||||
danger: 'hsl(359,68%,71%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(240,21%,12%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(229,19%,23%)',
|
||||
border: 'hsl(229,19%,27%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(229,20%,17%)',
|
||||
border: 'hsl(229,20%,25%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(229,19%,23%)',
|
||||
border: 'hsl(229,19%,27%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(277,59%,68%)',
|
||||
secondary: 'hsl(228,39%,72%)',
|
||||
info: 'hsl(222,74%,67%)',
|
||||
success: 'hsl(96,44%,61%)',
|
||||
notice: 'hsl(40,62%,66%)',
|
||||
warning: 'hsl(20,79%,63%)',
|
||||
danger: 'hsl(359,68%,64%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const catppuccinMacchiato: Theme = {
|
||||
id: 'catppuccin-macchiato',
|
||||
label: 'Catppuccin Macchiato',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(233,23%,15%)',
|
||||
text: 'hsl(227,68%,88%)',
|
||||
textSubtle: 'hsl(227,27%,72%)',
|
||||
textSubtlest: 'hsl(228,15%,57%)',
|
||||
primary: 'hsl(267,83%,80%)',
|
||||
secondary: 'hsl(228,39%,80%)',
|
||||
info: 'hsl(220,83%,75%)',
|
||||
success: 'hsl(105,48%,72%)',
|
||||
notice: 'hsl(40,70%,78%)',
|
||||
warning: 'hsl(21,86%,73%)',
|
||||
danger: 'hsl(351,74%,73%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(240,21%,12%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(232,23%,18%)',
|
||||
border: 'hsl(231,23%,22%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(236,23%,12%)',
|
||||
border: 'hsl(236,23%,21%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(232,23%,18%)',
|
||||
border: 'hsl(231,23%,22%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(267,82%,72%)',
|
||||
secondary: 'hsl(228,39%,72%)',
|
||||
info: 'hsl(220,83%,68%)',
|
||||
success: 'hsl(105,48%,65%)',
|
||||
notice: 'hsl(40,70%,70%)',
|
||||
warning: 'hsl(21,86%,66%)',
|
||||
danger: 'hsl(351,74%,66%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const catppuccinMocha: Theme = {
|
||||
id: 'catppuccin-mocha',
|
||||
label: 'Catppuccin Mocha',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(240,21%,12%)',
|
||||
text: 'hsl(226,64%,88%)',
|
||||
textSubtle: 'hsl(228,24%,72%)',
|
||||
textSubtlest: 'hsl(230,13%,55%)',
|
||||
primary: 'hsl(267,83%,80%)',
|
||||
secondary: 'hsl(227,35%,80%)',
|
||||
info: 'hsl(217,92%,76%)',
|
||||
success: 'hsl(115,54%,76%)',
|
||||
notice: 'hsl(41,86%,83%)',
|
||||
warning: 'hsl(23,92%,75%)',
|
||||
danger: 'hsl(343,81%,75%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(240,21%,12%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(240,21%,15%)',
|
||||
border: 'hsl(240,21%,19%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(240,23%,9%)',
|
||||
border: 'hsl(240,22%,18%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(240,21%,15%)',
|
||||
border: 'hsl(240,21%,19%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(267,67%,65%)',
|
||||
secondary: 'hsl(227,28%,64%)',
|
||||
info: 'hsl(217,74%,61%)',
|
||||
success: 'hsl(115,43%,61%)',
|
||||
notice: 'hsl(41,69%,66%)',
|
||||
warning: 'hsl(23,74%,60%)',
|
||||
danger: 'hsl(343,65%,60%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const catppuccinLatte: Theme = {
|
||||
id: 'catppuccin-latte',
|
||||
label: 'Catppuccin Latte',
|
||||
dark: false,
|
||||
base: {
|
||||
surface: 'hsl(220,23%,95%)',
|
||||
text: 'hsl(234,16%,35%)',
|
||||
textSubtle: 'hsl(233,10%,47%)',
|
||||
textSubtlest: 'hsl(231,10%,59%)',
|
||||
primary: 'hsl(266,85%,58%)',
|
||||
secondary: 'hsl(233,10%,47%)',
|
||||
info: 'hsl(231,97%,72%)',
|
||||
success: 'hsl(183,74%,35%)',
|
||||
notice: 'hsl(35,77%,49%)',
|
||||
warning: 'hsl(22,99%,52%)',
|
||||
danger: 'hsl(355,76%,59%)',
|
||||
},
|
||||
components: {
|
||||
sidebar: {
|
||||
surface: 'hsl(220,22%,92%)',
|
||||
border: 'hsl(220,22%,87%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(220,21%,89%)',
|
||||
border: 'hsl(220,22%,87%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,47 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const cobalt2: Theme = {
|
||||
id: 'cobalt2',
|
||||
label: 'Cobalt2',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: '#193549',
|
||||
surfaceHighlight: '#1f4662',
|
||||
text: '#d2e1f1',
|
||||
textSubtle: '#709ac8',
|
||||
textSubtlest: '#55749e',
|
||||
primary: '#ffc600',
|
||||
secondary: '#819fc3',
|
||||
info: '#0088FF',
|
||||
success: '#3AD900',
|
||||
notice: '#FFEE80',
|
||||
warning: '#FF9D00',
|
||||
danger: '#FF628C',
|
||||
},
|
||||
components: {
|
||||
sidebar: {
|
||||
surface: '#13283a',
|
||||
border: '#102332',
|
||||
},
|
||||
input: {
|
||||
border: '#1f4561',
|
||||
},
|
||||
appHeader: {
|
||||
surface: '#13283a',
|
||||
border: '#112636',
|
||||
},
|
||||
responsePane: {
|
||||
surface: '#13283a',
|
||||
border: '#112636',
|
||||
},
|
||||
button: {
|
||||
primary: '#ffc600',
|
||||
secondary: '#709ac8',
|
||||
info: '#0088FF',
|
||||
success: '#3AD900',
|
||||
notice: '#ecdc6a',
|
||||
warning: '#FF9D00',
|
||||
danger: '#FF628C',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,29 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const dracula: Theme = {
|
||||
id: 'dracula',
|
||||
label: 'Dracula',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(231,15%,18%)',
|
||||
surfaceHighlight: 'hsl(230,15%,24%)',
|
||||
text: 'hsl(60,30%,96%)',
|
||||
textSubtle: 'hsl(232,14%,65%)',
|
||||
textSubtlest: 'hsl(232,14%,50%)',
|
||||
primary: 'hsl(265,89%,78%)',
|
||||
secondary: 'hsl(225,27%,51%)',
|
||||
info: 'hsl(191,97%,77%)',
|
||||
success: 'hsl(135,94%,65%)',
|
||||
notice: 'hsl(65,92%,76%)',
|
||||
warning: 'hsl(31,100%,71%)',
|
||||
danger: 'hsl(0,100%,67%)',
|
||||
},
|
||||
components: {
|
||||
sidebar: {
|
||||
backdrop: 'hsl(230,15%,24%)',
|
||||
},
|
||||
appHeader: {
|
||||
backdrop: 'hsl(235,14%,15%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,77 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const everforestDark: Theme = {
|
||||
id: 'everforest-dark',
|
||||
label: 'Everforest Dark',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(150, 8%, 18%)',
|
||||
surfaceHighlight: 'hsl(150, 7%, 22%)',
|
||||
text: 'hsl(45, 30%, 78%)',
|
||||
textSubtle: 'hsl(145, 8%, 55%)',
|
||||
textSubtlest: 'hsl(145, 6%, 42%)',
|
||||
primary: 'hsl(142, 35%, 60%)',
|
||||
secondary: 'hsl(145, 8%, 55%)',
|
||||
info: 'hsl(200, 35%, 65%)',
|
||||
success: 'hsl(142, 35%, 60%)',
|
||||
notice: 'hsl(46, 55%, 68%)',
|
||||
warning: 'hsl(24, 55%, 65%)',
|
||||
danger: 'hsl(358, 50%, 68%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(150, 8%, 15%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(150, 7%, 16%)',
|
||||
border: 'hsl(150, 6%, 20%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(150, 8%, 14%)',
|
||||
border: 'hsl(150, 6%, 18%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(150, 7%, 16%)',
|
||||
border: 'hsl(150, 6%, 20%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(142, 35%, 53%)',
|
||||
secondary: 'hsl(145, 8%, 48%)',
|
||||
info: 'hsl(200, 35%, 58%)',
|
||||
success: 'hsl(142, 35%, 53%)',
|
||||
notice: 'hsl(46, 55%, 61%)',
|
||||
warning: 'hsl(24, 55%, 58%)',
|
||||
danger: 'hsl(358, 50%, 61%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const everforestLight: Theme = {
|
||||
id: 'everforest-light',
|
||||
label: 'Everforest Light',
|
||||
dark: false,
|
||||
base: {
|
||||
surface: 'hsl(40, 32%, 93%)',
|
||||
surfaceHighlight: 'hsl(40, 28%, 89%)',
|
||||
text: 'hsl(135, 8%, 35%)',
|
||||
textSubtle: 'hsl(135, 6%, 45%)',
|
||||
textSubtlest: 'hsl(135, 4%, 55%)',
|
||||
primary: 'hsl(128, 30%, 45%)',
|
||||
secondary: 'hsl(135, 6%, 45%)',
|
||||
info: 'hsl(200, 35%, 45%)',
|
||||
success: 'hsl(128, 30%, 45%)',
|
||||
notice: 'hsl(45, 70%, 40%)',
|
||||
warning: 'hsl(22, 60%, 48%)',
|
||||
danger: 'hsl(355, 55%, 50%)',
|
||||
},
|
||||
components: {
|
||||
sidebar: {
|
||||
surface: 'hsl(40, 30%, 91%)',
|
||||
border: 'hsl(40, 25%, 86%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(40, 30%, 89%)',
|
||||
border: 'hsl(40, 25%, 84%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,173 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const fleetLight: Theme = {
|
||||
id: 'fleet-light',
|
||||
label: 'Fleet Light',
|
||||
dark: false,
|
||||
base: {
|
||||
surface: '#FFFFFF',
|
||||
surfaceHighlight: '#F8F8F9',
|
||||
surfaceActive: '#EEEFF0',
|
||||
border: '#18191B33',
|
||||
text: '#090909',
|
||||
textSubtle: '#6E747B',
|
||||
textSubtlest: '#898E94',
|
||||
primary: '#1D61BA',
|
||||
secondary: '#6E747B',
|
||||
info: '#4B8DEC',
|
||||
success: '#169068',
|
||||
notice: '#B07203',
|
||||
warning: '#B07203',
|
||||
danger: '#E1465E',
|
||||
},
|
||||
components: {
|
||||
sidebar: {
|
||||
surface: '#EEEFF0',
|
||||
border: '#18191B33',
|
||||
},
|
||||
appHeader: {
|
||||
surface: '#EEEFF0',
|
||||
border: '#18191B33',
|
||||
},
|
||||
responsePane: {
|
||||
surface: '#FFFFFF',
|
||||
border: '#18191B33',
|
||||
},
|
||||
dialog: {
|
||||
surface: '#FFFFFF',
|
||||
border: '#18191B33',
|
||||
},
|
||||
button: {
|
||||
surface: '#F8F8F9',
|
||||
text: '#090909',
|
||||
primary: '#2A7DEB',
|
||||
secondary: '#6E747B',
|
||||
info: '#4B8DEC',
|
||||
success: '#169068',
|
||||
notice: '#B07203',
|
||||
warning: '#B07203',
|
||||
danger: '#E1465E',
|
||||
},
|
||||
editor: {
|
||||
primary: '#5511BF',
|
||||
secondary: '#A31D8D',
|
||||
info: '#14646E',
|
||||
success: '#086E14',
|
||||
notice: '#616605',
|
||||
warning: '#747576',
|
||||
danger: '#1749BD',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const fleetDarkPurple: Theme = {
|
||||
id: 'fleet-dark-purple',
|
||||
label: 'Fleet Dark Purple',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: '#1C1827',
|
||||
surfaceHighlight: '#262136',
|
||||
surfaceActive: '#3E3852',
|
||||
border: '#3E3852',
|
||||
text: '#E0E1E4',
|
||||
textSubtle: '#E0E1E480',
|
||||
textSubtlest: '#E0E1E44D',
|
||||
primary: '#B174D9',
|
||||
secondary: '#E0E1E480',
|
||||
info: '#4B8DEC',
|
||||
success: '#169068',
|
||||
notice: '#B07203',
|
||||
warning: '#B07203',
|
||||
danger: '#E1465E',
|
||||
},
|
||||
components: {
|
||||
appHeader: {
|
||||
surface: '#13101B',
|
||||
border: '#3E3852',
|
||||
},
|
||||
responsePane: {
|
||||
surface: '#1C1827',
|
||||
border: '#3E3852',
|
||||
},
|
||||
dialog: {
|
||||
surface: '#262136',
|
||||
border: '#3E3852',
|
||||
},
|
||||
button: {
|
||||
surface: '#262136',
|
||||
text: '#E0E1E4',
|
||||
primary: '#A660D4',
|
||||
secondary: '#E0E1E480',
|
||||
info: '#4B8DEC',
|
||||
success: '#169068',
|
||||
notice: '#B07203',
|
||||
warning: '#B07203',
|
||||
danger: '#E1465E',
|
||||
},
|
||||
editor: {
|
||||
primary: '#C7A65D',
|
||||
secondary: '#93A6F5',
|
||||
info: '#E09B70',
|
||||
success: '#62A362',
|
||||
notice: '#85A658',
|
||||
warning: '#7e7d86',
|
||||
danger: '#4DACF0',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const fleetDark: Theme = {
|
||||
id: 'fleet-dark',
|
||||
label: 'Fleet Dark',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: '#18191B',
|
||||
surfaceHighlight: '#252629',
|
||||
surfaceActive: '#3E4147',
|
||||
border: '#3E4147',
|
||||
text: '#E0E1E4',
|
||||
textSubtle: '#898E94',
|
||||
textSubtlest: '#646B71',
|
||||
primary: '#4B8DEC',
|
||||
secondary: '#898E94',
|
||||
info: '#4B8DEC',
|
||||
success: '#169068',
|
||||
notice: '#B07203',
|
||||
warning: '#B07203',
|
||||
danger: '#E1465E',
|
||||
},
|
||||
components: {
|
||||
appHeader: {
|
||||
surface: '#090909',
|
||||
border: '#3E4147',
|
||||
},
|
||||
responsePane: {
|
||||
surface: '#18191B',
|
||||
border: '#3E4147',
|
||||
},
|
||||
dialog: {
|
||||
surface: '#252629',
|
||||
border: '#3E4147',
|
||||
},
|
||||
button: {
|
||||
surface: '#252629',
|
||||
text: '#E0E1E4',
|
||||
primary: '#2A7DEB',
|
||||
secondary: '#898E94',
|
||||
info: '#4B8DEC',
|
||||
success: '#169068',
|
||||
notice: '#B07203',
|
||||
warning: '#B07203',
|
||||
danger: '#E1465E',
|
||||
},
|
||||
editor: {
|
||||
primary: '#EBC88D',
|
||||
secondary: '#AF9CFF',
|
||||
info: '#82D2CE',
|
||||
success: '#A8C5A0',
|
||||
notice: '#C7A65D',
|
||||
warning: '#909194',
|
||||
danger: '#87C3FF',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,46 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const githubDarkDimmed: Theme = {
|
||||
id: 'github-dark-dimmed',
|
||||
label: 'GitHub Dark Dimmed',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(215, 15%, 16%)',
|
||||
surfaceHighlight: 'hsl(215, 13%, 20%)',
|
||||
text: 'hsl(212, 15%, 78%)',
|
||||
textSubtle: 'hsl(212, 10%, 55%)',
|
||||
textSubtlest: 'hsl(212, 8%, 42%)',
|
||||
primary: 'hsl(212, 80%, 65%)',
|
||||
secondary: 'hsl(212, 10%, 55%)',
|
||||
info: 'hsl(212, 80%, 65%)',
|
||||
success: 'hsl(140, 50%, 50%)',
|
||||
notice: 'hsl(42, 75%, 55%)',
|
||||
warning: 'hsl(27, 80%, 55%)',
|
||||
danger: 'hsl(355, 70%, 55%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(215, 15%, 13%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(215, 14%, 14%)',
|
||||
border: 'hsl(215, 12%, 19%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(215, 15%, 12%)',
|
||||
border: 'hsl(215, 12%, 17%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(215, 14%, 14%)',
|
||||
border: 'hsl(215, 12%, 19%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(212, 80%, 58%)',
|
||||
info: 'hsl(212, 80%, 58%)',
|
||||
success: 'hsl(140, 50%, 45%)',
|
||||
notice: 'hsl(42, 75%, 48%)',
|
||||
warning: 'hsl(27, 80%, 48%)',
|
||||
danger: 'hsl(355, 70%, 48%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,55 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const githubDark: Theme = {
|
||||
id: 'github-dark',
|
||||
label: 'GitHub',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(213,30%,7%)',
|
||||
surfaceHighlight: 'hsl(213,16%,13%)',
|
||||
text: 'hsl(212,27%,89%)',
|
||||
textSubtle: 'hsl(212,9%,57%)',
|
||||
textSubtlest: 'hsl(217,8%,45%)',
|
||||
border: 'hsl(215,21%,11%)',
|
||||
primary: 'hsl(262,78%,74%)',
|
||||
secondary: 'hsl(217,8%,50%)',
|
||||
info: 'hsl(215,84%,64%)',
|
||||
success: 'hsl(129,48%,52%)',
|
||||
notice: 'hsl(39,71%,58%)',
|
||||
warning: 'hsl(22,83%,60%)',
|
||||
danger: 'hsl(3,83%,65%)',
|
||||
},
|
||||
components: {
|
||||
button: {
|
||||
primary: 'hsl(262,79%,71%)',
|
||||
secondary: 'hsl(217,8%,45%)',
|
||||
info: 'hsl(215,84%,60%)',
|
||||
success: 'hsl(129,48%,47%)',
|
||||
notice: 'hsl(39,71%,53%)',
|
||||
warning: 'hsl(22,83%,56%)',
|
||||
danger: 'hsl(3,83%,61%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const githubLight: Theme = {
|
||||
id: 'github-light',
|
||||
label: 'GitHub',
|
||||
dark: false,
|
||||
base: {
|
||||
surface: 'hsl(0,0%,100%)',
|
||||
surfaceHighlight: 'hsl(210,29%,94%)',
|
||||
text: 'hsl(213,13%,14%)',
|
||||
textSubtle: 'hsl(212,9%,43%)',
|
||||
textSubtlest: 'hsl(203,8%,55%)',
|
||||
border: 'hsl(210,15%,92%)',
|
||||
borderSubtle: 'hsl(210,15%,92%)',
|
||||
primary: 'hsl(261,69%,59%)',
|
||||
secondary: 'hsl(212,8%,47%)',
|
||||
info: 'hsl(212,92%,48%)',
|
||||
success: 'hsl(137,66%,32%)',
|
||||
notice: 'hsl(40,100%,40%)',
|
||||
warning: 'hsl(24,100%,44%)',
|
||||
danger: 'hsl(356,71%,48%)',
|
||||
},
|
||||
};
|
||||
@@ -1,21 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const gruvbox: Theme = {
|
||||
id: 'gruvbox',
|
||||
label: 'Gruvbox',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(0,0%,16%)',
|
||||
surfaceHighlight: 'hsl(20,3%,19%)',
|
||||
text: 'hsl(53,74%,91%)',
|
||||
textSubtle: 'hsl(39,24%,66%)',
|
||||
textSubtlest: 'hsl(30,12%,51%)',
|
||||
primary: 'hsl(344,47%,68%)',
|
||||
secondary: 'hsl(157,16%,58%)',
|
||||
info: 'hsl(104,35%,62%)',
|
||||
success: 'hsl(61,66%,44%)',
|
||||
notice: 'hsl(42,95%,58%)',
|
||||
warning: 'hsl(27,99%,55%)',
|
||||
danger: 'hsl(6,96%,59%)',
|
||||
},
|
||||
};
|
||||
@@ -1,46 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const highContrast: Theme = {
|
||||
id: 'high-contrast',
|
||||
label: 'High Contrast Light',
|
||||
dark: false,
|
||||
base: {
|
||||
surface: 'white',
|
||||
surfaceHighlight: 'hsl(218,24%,93%)',
|
||||
text: 'black',
|
||||
textSubtle: 'hsl(217,24%,40%)',
|
||||
textSubtlest: 'hsl(217,24%,40%)',
|
||||
border: 'hsl(217,22%,50%)',
|
||||
borderSubtle: 'hsl(217,22%,60%)',
|
||||
primary: 'hsl(267,67%,47%)',
|
||||
secondary: 'hsl(218,18%,53%)',
|
||||
info: 'hsl(206,100%,36%)',
|
||||
success: 'hsl(155,100%,26%)',
|
||||
notice: 'hsl(45,100%,31%)',
|
||||
warning: 'hsl(30,99%,34%)',
|
||||
danger: 'hsl(334,100%,35%)',
|
||||
},
|
||||
};
|
||||
|
||||
export const highContrastDark: Theme = {
|
||||
id: 'high-contrast-dark',
|
||||
label: 'High Contrast Dark',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(0,0%,0%)',
|
||||
surfaceHighlight: 'hsl(0,0%,20%)',
|
||||
text: 'hsl(0,0%,100%)',
|
||||
textSubtle: 'hsl(0,0%,90%)',
|
||||
textSubtlest: 'hsl(0,0%,80%)',
|
||||
selection: 'hsl(276,100%,30%)',
|
||||
surfaceActive: 'hsl(276,100%,30%)',
|
||||
border: 'hsl(0,0%,60%)',
|
||||
primary: 'hsl(266,100%,85%)',
|
||||
secondary: 'hsl(242,20%,72%)',
|
||||
info: 'hsl(208,100%,83%)',
|
||||
success: 'hsl(150,100%,63%)',
|
||||
notice: 'hsl(49,100%,77%)',
|
||||
warning: 'hsl(28,100%,73%)',
|
||||
danger: 'hsl(343,100%,79%)',
|
||||
},
|
||||
};
|
||||
@@ -1,47 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const horizon: Theme = {
|
||||
id: 'horizon',
|
||||
label: 'Horizon',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(220, 16%, 13%)',
|
||||
surfaceHighlight: 'hsl(220, 14%, 18%)',
|
||||
text: 'hsl(220, 15%, 85%)',
|
||||
textSubtle: 'hsl(220, 10%, 55%)',
|
||||
textSubtlest: 'hsl(220, 8%, 45%)',
|
||||
primary: 'hsl(5, 85%, 68%)',
|
||||
secondary: 'hsl(220, 10%, 55%)',
|
||||
info: 'hsl(217, 70%, 68%)',
|
||||
success: 'hsl(92, 50%, 60%)',
|
||||
notice: 'hsl(34, 92%, 70%)',
|
||||
warning: 'hsl(20, 90%, 65%)',
|
||||
danger: 'hsl(355, 80%, 65%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(220, 16%, 10%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(220, 14%, 15%)',
|
||||
border: 'hsl(220, 14%, 19%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(220, 16%, 11%)',
|
||||
border: 'hsl(220, 14%, 17%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(220, 14%, 15%)',
|
||||
border: 'hsl(220, 14%, 19%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(5, 85%, 61%)',
|
||||
secondary: 'hsl(224,8%,53%)',
|
||||
info: 'hsl(217, 70%, 61%)',
|
||||
success: 'hsl(92, 50%, 53%)',
|
||||
notice: 'hsl(34, 92%, 63%)',
|
||||
warning: 'hsl(20, 90%, 58%)',
|
||||
danger: 'hsl(355, 80%, 58%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,58 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const hotdogStand: Theme = {
|
||||
id: 'hotdog-stand',
|
||||
label: 'Hotdog Stand',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(0,100%,50%)',
|
||||
surfaceHighlight: 'hsl(0,0%,0%)',
|
||||
text: 'hsl(0,0%,100%)',
|
||||
textSubtle: 'hsl(0,0%,100%)',
|
||||
textSubtlest: 'hsl(60,100%,50%)',
|
||||
border: 'hsl(0,0%,0%)',
|
||||
primary: 'hsl(60,100%,50%)',
|
||||
secondary: 'hsl(60,100%,50%)',
|
||||
info: 'hsl(60,100%,50%)',
|
||||
success: 'hsl(60,100%,50%)',
|
||||
notice: 'hsl(60,100%,50%)',
|
||||
warning: 'hsl(60,100%,50%)',
|
||||
danger: 'hsl(60,100%,50%)',
|
||||
},
|
||||
components: {
|
||||
appHeader: {
|
||||
surface: 'hsl(0,0%,0%)',
|
||||
text: 'hsl(0,0%,100%)',
|
||||
textSubtle: 'hsl(60,100%,50%)',
|
||||
textSubtlest: 'hsl(0,100%,50%)',
|
||||
},
|
||||
menu: {
|
||||
surface: 'hsl(0,0%,0%)',
|
||||
border: 'hsl(0,100%,50%)',
|
||||
surfaceHighlight: 'hsl(0,100%,50%)',
|
||||
text: 'hsl(0,0%,100%)',
|
||||
textSubtle: 'hsl(60,100%,50%)',
|
||||
textSubtlest: 'hsl(60,100%,50%)',
|
||||
},
|
||||
button: {
|
||||
surface: 'hsl(0,0%,0%)',
|
||||
text: 'hsl(0,0%,100%)',
|
||||
primary: 'hsl(0,0%,0%)',
|
||||
secondary: 'hsl(0,0%,100%)',
|
||||
info: 'hsl(0,0%,0%)',
|
||||
success: 'hsl(60,100%,50%)',
|
||||
notice: 'hsl(60,100%,50%)',
|
||||
warning: 'hsl(0,0%,0%)',
|
||||
danger: 'hsl(0,100%,50%)',
|
||||
},
|
||||
editor: {
|
||||
primary: 'hsl(0,0%,100%)',
|
||||
secondary: 'hsl(0,0%,100%)',
|
||||
info: 'hsl(0,0%,100%)',
|
||||
success: 'hsl(0,0%,100%)',
|
||||
notice: 'hsl(60,100%,50%)',
|
||||
warning: 'hsl(0,0%,100%)',
|
||||
danger: 'hsl(0,0%,100%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,39 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const materialDarker: Theme = {
|
||||
id: 'material-darker',
|
||||
label: 'Material Darker',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(0, 0%, 13%)',
|
||||
surfaceHighlight: 'hsl(0, 0%, 18%)',
|
||||
text: 'hsl(0, 0%, 93%)',
|
||||
textSubtle: 'hsl(0, 0%, 65%)',
|
||||
textSubtlest: 'hsl(0, 0%, 50%)',
|
||||
primary: 'hsl(262, 100%, 75%)',
|
||||
secondary: 'hsl(0, 0%, 60%)',
|
||||
info: 'hsl(224, 100%, 75%)',
|
||||
success: 'hsl(84, 60%, 73%)',
|
||||
notice: 'hsl(43, 100%, 70%)',
|
||||
warning: 'hsl(14, 85%, 70%)',
|
||||
danger: 'hsl(1, 77%, 59%)',
|
||||
},
|
||||
components: {
|
||||
sidebar: {
|
||||
surface: 'hsl(0, 0%, 11%)',
|
||||
border: 'hsl(0, 0%, 16%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(0, 0%, 9%)',
|
||||
border: 'hsl(0, 0%, 14%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(262, 100%, 68%)',
|
||||
info: 'hsl(224, 100%, 68%)',
|
||||
success: 'hsl(84, 60%, 66%)',
|
||||
notice: 'hsl(43, 100%, 63%)',
|
||||
warning: 'hsl(14, 85%, 63%)',
|
||||
danger: 'hsl(1, 77%, 52%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,43 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const materialOcean: Theme = {
|
||||
id: 'material-ocean',
|
||||
label: 'Material Ocean',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(230, 25%, 14%)',
|
||||
surfaceHighlight: 'hsl(230, 20%, 18%)',
|
||||
text: 'hsl(220, 53%, 85%)',
|
||||
textSubtle: 'hsl(228, 12%, 54%)',
|
||||
textSubtlest: 'hsl(228, 12%, 42%)',
|
||||
primary: 'hsl(262, 100%, 75%)',
|
||||
secondary: 'hsl(228, 12%, 60%)',
|
||||
info: 'hsl(224, 100%, 75%)',
|
||||
success: 'hsl(84, 60%, 73%)',
|
||||
notice: 'hsl(43, 100%, 70%)',
|
||||
warning: 'hsl(14, 85%, 70%)',
|
||||
danger: 'hsl(1, 77%, 59%)',
|
||||
},
|
||||
components: {
|
||||
sidebar: {
|
||||
surface: 'hsl(230, 25%, 12%)',
|
||||
border: 'hsl(230, 20%, 18%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(230, 25%, 10%)',
|
||||
border: 'hsl(230, 20%, 16%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(230, 25%, 12%)',
|
||||
border: 'hsl(230, 20%, 18%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(262, 100%, 68%)',
|
||||
info: 'hsl(224, 100%, 68%)',
|
||||
success: 'hsl(84, 60%, 66%)',
|
||||
notice: 'hsl(43, 100%, 63%)',
|
||||
warning: 'hsl(14, 85%, 63%)',
|
||||
danger: 'hsl(1, 77%, 52%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,45 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const materialPalenight: Theme = {
|
||||
id: 'material-palenight',
|
||||
label: 'Material Palenight',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: '#292D3E',
|
||||
surfaceHighlight: '#313850',
|
||||
text: '#BFC7D5',
|
||||
textSubtle: '#697098',
|
||||
textSubtlest: '#4E5579',
|
||||
primary: '#c792ea',
|
||||
secondary: '#697098',
|
||||
info: '#82AAFF',
|
||||
success: '#C3E88D',
|
||||
notice: '#FFCB6B',
|
||||
warning: '#F78C6C',
|
||||
danger: '#ff5572',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: '#232635',
|
||||
},
|
||||
sidebar: {
|
||||
surface: '#292D3E',
|
||||
},
|
||||
appHeader: {
|
||||
surface: '#282C3D',
|
||||
},
|
||||
responsePane: {
|
||||
surface: '#313850',
|
||||
border: '#3a3f58',
|
||||
},
|
||||
button: {
|
||||
primary: '#c792ea',
|
||||
secondary: '#697098',
|
||||
info: '#82AAFF',
|
||||
success: '#C3E88D',
|
||||
notice: '#FFCB6B',
|
||||
warning: '#F78C6C',
|
||||
danger: '#ff5572',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,217 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const monokaiPro: Theme = {
|
||||
id: 'monokai-pro',
|
||||
label: 'Monokai Pro',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(285,5%,17%)',
|
||||
text: 'hsl(60,25%,98%)',
|
||||
textSubtle: 'hsl(0,1%,75%)',
|
||||
textSubtlest: 'hsl(300,0%,57%)',
|
||||
primary: 'hsl(250,77%,78%)',
|
||||
secondary: 'hsl(0,1%,75%)',
|
||||
info: 'hsl(186,71%,69%)',
|
||||
success: 'hsl(90,59%,66%)',
|
||||
notice: 'hsl(45,100%,70%)',
|
||||
warning: 'hsl(20,96%,70%)',
|
||||
danger: 'hsl(345,100%,69%)',
|
||||
},
|
||||
components: {
|
||||
appHeader: {
|
||||
surface: 'hsl(300,5%,13%)',
|
||||
text: 'hsl(0,1%,75%)',
|
||||
textSubtle: 'hsl(300,0%,57%)',
|
||||
textSubtlest: 'hsl(300,1%,44%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(250,77%,70%)',
|
||||
secondary: 'hsl(0,1%,68%)',
|
||||
info: 'hsl(186,71%,62%)',
|
||||
success: 'hsl(90,59%,59%)',
|
||||
notice: 'hsl(45,100%,63%)',
|
||||
warning: 'hsl(20,96%,63%)',
|
||||
danger: 'hsl(345,100%,62%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const monokaiProClassic: Theme = {
|
||||
id: 'monokai-pro-classic',
|
||||
label: 'Monokai Pro Classic',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(70,8%,15%)',
|
||||
text: 'hsl(69,100%,97%)',
|
||||
textSubtle: 'hsl(65,9%,73%)',
|
||||
textSubtlest: 'hsl(66,4%,55%)',
|
||||
primary: 'hsl(261,100%,75%)',
|
||||
secondary: 'hsl(202,8%,72%)',
|
||||
info: 'hsl(190,81%,67%)',
|
||||
success: 'hsl(80,76%,53%)',
|
||||
notice: 'hsl(54,70%,68%)',
|
||||
warning: 'hsl(32,98%,56%)',
|
||||
danger: 'hsl(338,95%,56%)',
|
||||
},
|
||||
components: {
|
||||
appHeader: {
|
||||
surface: 'hsl(72,9%,11%)',
|
||||
text: 'hsl(202,8%,72%)',
|
||||
textSubtle: 'hsl(213,4%,48%)',
|
||||
textSubtlest: 'hsl(223,6%,44%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(261,100%,68%)',
|
||||
secondary: 'hsl(202,8%,65%)',
|
||||
info: 'hsl(190,81%,60%)',
|
||||
success: 'hsl(80,76%,48%)',
|
||||
notice: 'hsl(54,71%,61%)',
|
||||
warning: 'hsl(32,98%,50%)',
|
||||
danger: 'hsl(338,95%,50%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const monokaiProMachine: Theme = {
|
||||
id: 'monokai-pro-machine',
|
||||
label: 'Monokai Pro Machine',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(200,16%,18%)',
|
||||
text: 'hsl(173,24%,93%)',
|
||||
textSubtle: 'hsl(185,6%,57%)',
|
||||
textSubtlest: 'hsl(189,6%,45%)',
|
||||
primary: 'hsl(258,86%,80%)',
|
||||
secondary: 'hsl(175,9%,75%)',
|
||||
info: 'hsl(194,81%,72%)',
|
||||
success: 'hsl(98,67%,69%)',
|
||||
notice: 'hsl(52,100%,72%)',
|
||||
warning: 'hsl(28,100%,72%)',
|
||||
danger: 'hsl(353,100%,71%)',
|
||||
},
|
||||
components: {
|
||||
appHeader: {
|
||||
surface: 'hsl(196,16%,14%)',
|
||||
text: 'hsl(202,8%,72%)',
|
||||
textSubtle: 'hsl(213,4%,48%)',
|
||||
textSubtlest: 'hsl(223,6%,44%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(258,86%,72%)',
|
||||
secondary: 'hsl(175,9%,68%)',
|
||||
info: 'hsl(194,80%,65%)',
|
||||
success: 'hsl(98,67%,62%)',
|
||||
notice: 'hsl(52,100%,65%)',
|
||||
warning: 'hsl(28,100%,65%)',
|
||||
danger: 'hsl(353,100%,64%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const monokaiProOctagon: Theme = {
|
||||
id: 'monokai-pro-octagon',
|
||||
label: 'Monokai Pro Octagon',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(233,18%,19%)',
|
||||
text: 'hsl(173,24%,93%)',
|
||||
textSubtle: 'hsl(202,8%,72%)',
|
||||
textSubtlest: 'hsl(213,4%,48%)',
|
||||
primary: 'hsl(292,30%,70%)',
|
||||
secondary: 'hsl(202,8%,72%)',
|
||||
info: 'hsl(155,37%,72%)',
|
||||
success: 'hsl(75,60%,61%)',
|
||||
notice: 'hsl(44,100%,71%)',
|
||||
warning: 'hsl(23,100%,68%)',
|
||||
danger: 'hsl(352,100%,70%)',
|
||||
},
|
||||
components: {
|
||||
appHeader: {
|
||||
surface: 'hsl(235,18%,14%)',
|
||||
text: 'hsl(202,8%,72%)',
|
||||
textSubtle: 'hsl(213,4%,48%)',
|
||||
textSubtlest: 'hsl(223,6%,44%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(292,26%,63%)',
|
||||
secondary: 'hsl(201,7%,65%)',
|
||||
info: 'hsl(155,33%,65%)',
|
||||
success: 'hsl(75,54%,55%)',
|
||||
notice: 'hsl(44,90%,64%)',
|
||||
warning: 'hsl(23,90%,61%)',
|
||||
danger: 'hsl(352,90%,63%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const monokaiProRistretto: Theme = {
|
||||
id: 'monokai-pro-ristretto',
|
||||
label: 'Monokai Pro Ristretto',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(0,9%,16%)',
|
||||
text: 'hsl(351,100%,97%)',
|
||||
textSubtle: 'hsl(355,9%,74%)',
|
||||
textSubtlest: 'hsl(354,4%,56%)',
|
||||
primary: 'hsl(239,63%,79%)',
|
||||
secondary: 'hsl(355,9%,74%)',
|
||||
info: 'hsl(170,53%,69%)',
|
||||
success: 'hsl(88,57%,66%)',
|
||||
notice: 'hsl(41,92%,70%)',
|
||||
warning: 'hsl(13,85%,70%)',
|
||||
danger: 'hsl(349,97%,70%)',
|
||||
},
|
||||
components: {
|
||||
appHeader: {
|
||||
surface: 'hsl(0,8%,12%)',
|
||||
text: 'hsl(355,9%,74%)',
|
||||
textSubtle: 'hsl(354,4%,56%)',
|
||||
textSubtlest: 'hsl(353,4%,43%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(239,63%,71%)',
|
||||
secondary: 'hsl(355,9%,67%)',
|
||||
info: 'hsl(170,53%,62%)',
|
||||
success: 'hsl(88,57%,59%)',
|
||||
notice: 'hsl(41,92%,63%)',
|
||||
warning: 'hsl(13,86%,63%)',
|
||||
danger: 'hsl(349,97%,63%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const monokaiProSpectrum: Theme = {
|
||||
id: 'monokai-pro-spectrum',
|
||||
label: 'Monokai Pro Spectrum',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(0,0%,13%)',
|
||||
text: 'hsl(266,100%,97%)',
|
||||
textSubtle: 'hsl(264,7%,73%)',
|
||||
textSubtlest: 'hsl(266,3%,55%)',
|
||||
primary: 'hsl(247,61%,72%)',
|
||||
secondary: 'hsl(264,7%,73%)',
|
||||
info: 'hsl(188,74%,63%)',
|
||||
success: 'hsl(133,54%,66%)',
|
||||
notice: 'hsl(51,96%,69%)',
|
||||
warning: 'hsl(23,98%,66%)',
|
||||
danger: 'hsl(343,96%,68%)',
|
||||
},
|
||||
components: {
|
||||
appHeader: {
|
||||
surface: 'hsl(0,0%,10%)',
|
||||
text: 'hsl(264,7%,73%)',
|
||||
textSubtle: 'hsl(266,3%,55%)',
|
||||
textSubtlest: 'hsl(264,2%,41%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(247,61%,65%)',
|
||||
secondary: 'hsl(264,7%,66%)',
|
||||
info: 'hsl(188,74%,57%)',
|
||||
success: 'hsl(133,54%,59%)',
|
||||
notice: 'hsl(51,96%,62%)',
|
||||
warning: 'hsl(23,98%,59%)',
|
||||
danger: 'hsl(343,96%,61%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,28 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const moonlight: Theme = {
|
||||
id: 'moonlight',
|
||||
label: 'Moonlight',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(234,23%,17%)',
|
||||
text: 'hsl(225,71%,90%)',
|
||||
textSubtle: 'hsl(230,28%,62%)',
|
||||
textSubtlest: 'hsl(232,26%,43%)',
|
||||
primary: 'hsl(262,100%,82%)',
|
||||
secondary: 'hsl(232,18%,65%)',
|
||||
info: 'hsl(217,100%,74%)',
|
||||
success: 'hsl(174,66%,54%)',
|
||||
notice: 'hsl(35,100%,73%)',
|
||||
warning: 'hsl(17,100%,71%)',
|
||||
danger: 'hsl(356,100%,73%)',
|
||||
},
|
||||
components: {
|
||||
appHeader: {
|
||||
surface: 'hsl(233,23%,15%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(233,23%,15%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,78 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const nightOwl: Theme = {
|
||||
id: 'night-owl',
|
||||
label: 'Night Owl',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(207, 95%, 8%)',
|
||||
surfaceHighlight: 'hsl(207, 50%, 14%)',
|
||||
text: 'hsl(213, 50%, 90%)',
|
||||
textSubtle: 'hsl(213, 30%, 70%)',
|
||||
textSubtlest: 'hsl(213, 20%, 50%)',
|
||||
border: 'hsl(207, 50%, 14%)',
|
||||
primary: 'hsl(261, 51%, 51%)',
|
||||
secondary: 'hsl(213, 30%, 60%)',
|
||||
info: 'hsl(220, 100%, 75%)',
|
||||
success: 'hsl(145, 100%, 43%)',
|
||||
notice: 'hsl(62, 61%, 71%)',
|
||||
warning: 'hsl(4, 90%, 58%)',
|
||||
danger: 'hsl(4, 90%, 58%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(207, 95%, 6%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(207, 95%, 8%)',
|
||||
border: 'hsl(207, 50%, 14%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(207, 95%, 5%)',
|
||||
border: 'hsl(207, 50%, 12%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(207, 70%, 10%)',
|
||||
border: 'hsl(207, 50%, 14%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(261, 51%, 45%)',
|
||||
secondary: 'hsl(213, 30%, 60%)',
|
||||
info: 'hsl(220, 100%, 68%)',
|
||||
success: 'hsl(145, 100%, 38%)',
|
||||
notice: 'hsl(62, 61%, 64%)',
|
||||
warning: 'hsl(4, 90%, 52%)',
|
||||
danger: 'hsl(4, 90%, 52%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const lightOwl: Theme = {
|
||||
id: 'light-owl',
|
||||
label: 'Light Owl',
|
||||
dark: false,
|
||||
base: {
|
||||
surface: 'hsl(0, 0%, 98%)',
|
||||
surfaceHighlight: 'hsl(210, 18%, 94%)',
|
||||
text: 'hsl(224, 26%, 27%)',
|
||||
textSubtle: 'hsl(224, 15%, 45%)',
|
||||
textSubtlest: 'hsl(224, 10%, 55%)',
|
||||
primary: 'hsl(283, 100%, 41%)',
|
||||
secondary: 'hsl(224, 15%, 50%)',
|
||||
info: 'hsl(219, 75%, 40%)',
|
||||
success: 'hsl(145, 70%, 35%)',
|
||||
notice: 'hsl(36, 95%, 40%)',
|
||||
warning: 'hsl(0, 55%, 55%)',
|
||||
danger: 'hsl(0, 55%, 50%)',
|
||||
},
|
||||
components: {
|
||||
sidebar: {
|
||||
surface: 'hsl(210, 20%, 96%)',
|
||||
border: 'hsl(210, 15%, 90%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(210, 20%, 94%)',
|
||||
border: 'hsl(210, 15%, 88%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,47 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const noctisAzureus: Theme = {
|
||||
id: 'noctis-azureus',
|
||||
label: 'Noctis Azureus',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(210, 35%, 14%)',
|
||||
surfaceHighlight: 'hsl(210, 30%, 19%)',
|
||||
text: 'hsl(180, 45%, 85%)',
|
||||
textSubtle: 'hsl(180, 25%, 60%)',
|
||||
textSubtlest: 'hsl(180, 18%, 45%)',
|
||||
primary: 'hsl(175, 60%, 55%)',
|
||||
secondary: 'hsl(200, 70%, 65%)',
|
||||
info: 'hsl(200, 70%, 65%)',
|
||||
success: 'hsl(85, 55%, 60%)',
|
||||
notice: 'hsl(45, 90%, 60%)',
|
||||
warning: 'hsl(25, 85%, 58%)',
|
||||
danger: 'hsl(355, 75%, 62%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(210, 35%, 11%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(210, 33%, 12%)',
|
||||
border: 'hsl(210, 30%, 17%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(210, 35%, 10%)',
|
||||
border: 'hsl(210, 30%, 15%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(210, 33%, 12%)',
|
||||
border: 'hsl(210, 30%, 17%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(175, 60%, 48%)',
|
||||
secondary: 'hsl(200, 70%, 58%)',
|
||||
info: 'hsl(200, 70%, 58%)',
|
||||
success: 'hsl(85, 55%, 53%)',
|
||||
notice: 'hsl(45, 90%, 53%)',
|
||||
warning: 'hsl(25, 85%, 51%)',
|
||||
danger: 'hsl(355, 75%, 55%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,29 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const nord: Theme = {
|
||||
id: 'nord',
|
||||
label: 'Nord',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(220,16%,22%)',
|
||||
surfaceHighlight: 'hsl(220,14%,28%)',
|
||||
text: 'hsl(220,28%,93%)',
|
||||
textSubtle: 'hsl(220,26%,90%)',
|
||||
textSubtlest: 'hsl(220,24%,86%)',
|
||||
primary: 'hsl(193,38%,68%)',
|
||||
secondary: 'hsl(210,34%,63%)',
|
||||
info: 'hsl(174,25%,69%)',
|
||||
success: 'hsl(89,26%,66%)',
|
||||
notice: 'hsl(40,66%,73%)',
|
||||
warning: 'hsl(17,48%,64%)',
|
||||
danger: 'hsl(353,43%,56%)',
|
||||
},
|
||||
components: {
|
||||
sidebar: {
|
||||
backdrop: 'hsl(220,16%,22%)',
|
||||
},
|
||||
appHeader: {
|
||||
backdrop: 'hsl(220,14%,28%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,44 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const oneDarkPro: Theme = {
|
||||
id: 'one-dark-pro',
|
||||
label: 'One Dark Pro',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(220, 13%, 18%)',
|
||||
surfaceHighlight: 'hsl(220, 13%, 22%)',
|
||||
text: 'hsl(219, 14%, 71%)',
|
||||
textSubtle: 'hsl(219, 10%, 53%)',
|
||||
textSubtlest: 'hsl(220, 9%, 45%)',
|
||||
primary: 'hsl(286, 60%, 67%)',
|
||||
secondary: 'hsl(219, 14%, 60%)',
|
||||
info: 'hsl(207, 82%, 66%)',
|
||||
success: 'hsl(95, 38%, 62%)',
|
||||
notice: 'hsl(39, 67%, 69%)',
|
||||
warning: 'hsl(29, 54%, 61%)',
|
||||
danger: 'hsl(355, 65%, 65%)',
|
||||
},
|
||||
components: {
|
||||
sidebar: {
|
||||
surface: 'hsl(220, 13%, 16%)',
|
||||
border: 'hsl(220, 13%, 20%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(220, 13%, 14%)',
|
||||
border: 'hsl(220, 13%, 20%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(220, 13%, 16%)',
|
||||
border: 'hsl(220, 13%, 20%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(286, 60%, 60%)',
|
||||
secondary: 'hsl(219, 14%, 53%)',
|
||||
info: 'hsl(207, 82%, 59%)',
|
||||
success: 'hsl(95, 38%, 55%)',
|
||||
notice: 'hsl(39, 67%, 62%)',
|
||||
warning: 'hsl(29, 54%, 54%)',
|
||||
danger: 'hsl(355, 65%, 58%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,47 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const pandaSyntax: Theme = {
|
||||
id: 'panda',
|
||||
label: 'Panda Syntax',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(225, 15%, 15%)',
|
||||
surfaceHighlight: 'hsl(225, 12%, 20%)',
|
||||
text: 'hsl(0, 0%, 90%)',
|
||||
textSubtle: 'hsl(0, 0%, 65%)',
|
||||
textSubtlest: 'hsl(0, 0%, 50%)',
|
||||
primary: 'hsl(353, 95%, 70%)',
|
||||
secondary: 'hsl(0, 0%, 65%)',
|
||||
info: 'hsl(200, 85%, 65%)',
|
||||
success: 'hsl(175, 90%, 65%)',
|
||||
notice: 'hsl(40, 100%, 65%)',
|
||||
warning: 'hsl(40, 100%, 65%)',
|
||||
danger: 'hsl(0, 90%, 65%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(225, 15%, 12%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(225, 14%, 13%)',
|
||||
border: 'hsl(225, 12%, 18%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(225, 15%, 11%)',
|
||||
border: 'hsl(225, 12%, 16%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(225, 14%, 13%)',
|
||||
border: 'hsl(225, 12%, 18%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(353, 95%, 63%)',
|
||||
secondary: 'hsl(0, 0%, 58%)',
|
||||
info: 'hsl(200, 85%, 58%)',
|
||||
success: 'hsl(175, 90%, 58%)',
|
||||
notice: 'hsl(40, 100%, 58%)',
|
||||
warning: 'hsl(40, 100%, 58%)',
|
||||
danger: 'hsl(0, 90%, 58%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,18 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const relaxing: Theme = {
|
||||
id: 'relaxing',
|
||||
label: 'Relaxing',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(267,33%,17%)',
|
||||
text: 'hsl(275,49%,92%)',
|
||||
primary: 'hsl(267,84%,81%)',
|
||||
secondary: 'hsl(227,35%,80%)',
|
||||
info: 'hsl(217,92%,76%)',
|
||||
success: 'hsl(115,54%,76%)',
|
||||
notice: 'hsl(41,86%,83%)',
|
||||
warning: 'hsl(23,92%,75%)',
|
||||
danger: 'hsl(343,81%,75%)',
|
||||
},
|
||||
};
|
||||
@@ -1,111 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const rosePine: Theme = {
|
||||
id: 'rose-pine',
|
||||
label: 'Rosé Pine',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(249,22%,12%)',
|
||||
text: 'hsl(245,50%,91%)',
|
||||
textSubtle: 'hsl(248,15%,61%)',
|
||||
textSubtlest: 'hsl(249,12%,47%)',
|
||||
primary: 'hsl(267,57%,78%)',
|
||||
secondary: 'hsl(249,12%,47%)',
|
||||
info: 'hsl(199,49%,60%)',
|
||||
success: 'hsl(180,43%,73%)',
|
||||
notice: 'hsl(35,88%,72%)',
|
||||
warning: 'hsl(1,74%,79%)',
|
||||
danger: 'hsl(343,76%,68%)',
|
||||
},
|
||||
components: {
|
||||
responsePane: {
|
||||
surface: 'hsl(247,23%,15%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(247,23%,15%)',
|
||||
},
|
||||
menu: {
|
||||
surface: 'hsl(248,21%,26%)',
|
||||
textSubtle: 'hsl(248,15%,66%)',
|
||||
textSubtlest: 'hsl(249,12%,52%)',
|
||||
border: 'hsl(248,21%,35%)',
|
||||
borderSubtle: 'hsl(248,21%,33%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const rosePineMoon: Theme = {
|
||||
id: 'rose-pine-moon',
|
||||
label: 'Rosé Pine Moon',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(246,24%,17%)',
|
||||
text: 'hsl(245,50%,91%)',
|
||||
textSubtle: 'hsl(248,15%,61%)',
|
||||
textSubtlest: 'hsl(249,12%,47%)',
|
||||
primary: 'hsl(267,57%,78%)',
|
||||
secondary: 'hsl(248,15%,61%)',
|
||||
info: 'hsl(197,48%,60%)',
|
||||
success: 'hsl(197,48%,60%)',
|
||||
notice: 'hsl(35,88%,72%)',
|
||||
warning: 'hsl(2,66%,75%)',
|
||||
danger: 'hsl(343,76%,68%)',
|
||||
},
|
||||
components: {
|
||||
responsePane: {
|
||||
surface: 'hsl(247,24%,20%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(247,24%,20%)',
|
||||
},
|
||||
menu: {
|
||||
surface: 'hsl(248,21%,26%)',
|
||||
textSubtle: 'hsl(248,15%,61%)',
|
||||
textSubtlest: 'hsl(249,12%,55%)',
|
||||
border: 'hsl(248,21%,35%)',
|
||||
borderSubtle: 'hsl(248,21%,31%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const rosePineDawn: Theme = {
|
||||
id: 'rose-pine-dawn',
|
||||
label: 'Rosé Pine Dawn',
|
||||
dark: false,
|
||||
base: {
|
||||
surface: 'hsl(32,57%,95%)',
|
||||
border: 'hsl(10,9%,86%)',
|
||||
surfaceHighlight: 'hsl(25,35%,93%)',
|
||||
text: 'hsl(248,19%,40%)',
|
||||
textSubtle: 'hsl(248,12%,52%)',
|
||||
textSubtlest: 'hsl(257,9%,61%)',
|
||||
primary: 'hsl(271,27%,56%)',
|
||||
secondary: 'hsl(249,12%,47%)',
|
||||
info: 'hsl(197,52%,36%)',
|
||||
success: 'hsl(188,31%,45%)',
|
||||
notice: 'hsl(34,64%,49%)',
|
||||
warning: 'hsl(2,47%,64%)',
|
||||
danger: 'hsl(343,35%,55%)',
|
||||
},
|
||||
components: {
|
||||
responsePane: {
|
||||
border: 'hsl(20,12%,90%)',
|
||||
},
|
||||
sidebar: {
|
||||
border: 'hsl(20,12%,90%)',
|
||||
},
|
||||
appHeader: {
|
||||
border: 'hsl(20,12%,90%)',
|
||||
},
|
||||
input: {
|
||||
border: 'hsl(10,9%,86%)',
|
||||
},
|
||||
dialog: {
|
||||
border: 'hsl(20,12%,90%)',
|
||||
},
|
||||
menu: {
|
||||
surface: 'hsl(28,40%,92%)',
|
||||
border: 'hsl(10,9%,86%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,99 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const shadesOfPurple: Theme = {
|
||||
id: 'shades-of-purple',
|
||||
label: 'Shades of Purple',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: '#2D2B55',
|
||||
surfaceHighlight: '#1F1F41',
|
||||
text: '#FFFFFF',
|
||||
textSubtle: '#A599E9',
|
||||
textSubtlest: '#7E72C4',
|
||||
primary: '#FAD000',
|
||||
secondary: '#A599E9',
|
||||
info: '#80FFBB',
|
||||
success: '#3AD900',
|
||||
notice: '#FAD000',
|
||||
warning: '#FF9D00',
|
||||
danger: '#EC3A37F5',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: '#1E1E3F',
|
||||
},
|
||||
sidebar: {
|
||||
surface: '#222244',
|
||||
border: '#1E1E3F',
|
||||
},
|
||||
input: {
|
||||
border: '#7E72C4',
|
||||
},
|
||||
appHeader: {
|
||||
surface: '#1E1E3F',
|
||||
border: '#1E1E3F',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(240,33%,20%)',
|
||||
border: 'hsl(240,33%,20%)',
|
||||
},
|
||||
button: {
|
||||
primary: '#FAD000',
|
||||
secondary: '#A599E9',
|
||||
info: '#80FFBB',
|
||||
success: '#3AD900',
|
||||
notice: '#FAD000',
|
||||
warning: '#FF9D00',
|
||||
danger: '#EC3A37F5',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const shadesOfPurpleSuperDark: Theme = {
|
||||
id: 'shades-of-purple-super-dark',
|
||||
label: 'Shades of Purple (Super Dark)',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: '#191830',
|
||||
surfaceHighlight: '#1F1E3A',
|
||||
text: '#FFFFFF',
|
||||
textSubtle: '#A599E9',
|
||||
textSubtlest: '#7E72C4',
|
||||
primary: '#FAD000',
|
||||
secondary: '#A599E9',
|
||||
info: '#80FFBB',
|
||||
success: '#3AD900',
|
||||
notice: '#FAD000',
|
||||
warning: '#FF9D00',
|
||||
danger: '#EC3A37F5',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: '#15152b',
|
||||
},
|
||||
input: {
|
||||
border: '#2D2B55',
|
||||
},
|
||||
sidebar: {
|
||||
surface: '#131327',
|
||||
border: '#131327',
|
||||
},
|
||||
appHeader: {
|
||||
surface: '#15152a',
|
||||
border: '#15152a',
|
||||
},
|
||||
responsePane: {
|
||||
surface: '#131327',
|
||||
border: '#131327',
|
||||
},
|
||||
button: {
|
||||
primary: '#FAD000',
|
||||
secondary: '#A599E9',
|
||||
info: '#80FFBB',
|
||||
success: '#3AD900',
|
||||
notice: '#FAD000',
|
||||
warning: '#FF9D00',
|
||||
danger: '#EC3A37F5',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,47 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const slackAubergine: Theme = {
|
||||
id: 'slack-aubergine',
|
||||
label: 'Slack Aubergine',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(270, 25%, 18%)',
|
||||
surfaceHighlight: 'hsl(270, 22%, 24%)',
|
||||
text: 'hsl(0, 0%, 100%)',
|
||||
textSubtle: 'hsl(270, 15%, 75%)',
|
||||
textSubtlest: 'hsl(270, 12%, 58%)',
|
||||
primary: 'hsl(165, 100%, 40%)',
|
||||
secondary: 'hsl(270, 12%, 65%)',
|
||||
info: 'hsl(195, 95%, 55%)',
|
||||
success: 'hsl(145, 80%, 50%)',
|
||||
notice: 'hsl(43, 100%, 55%)',
|
||||
warning: 'hsl(43, 100%, 50%)',
|
||||
danger: 'hsl(0, 80%, 55%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(270, 25%, 14%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(270, 23%, 15%)',
|
||||
border: 'hsl(270, 22%, 22%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(270, 25%, 13%)',
|
||||
border: 'hsl(270, 22%, 20%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(270, 23%, 15%)',
|
||||
border: 'hsl(270, 22%, 22%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(165, 100%, 35%)',
|
||||
secondary: 'hsl(270, 12%, 58%)',
|
||||
info: 'hsl(195, 95%, 48%)',
|
||||
success: 'hsl(145, 80%, 45%)',
|
||||
notice: 'hsl(43, 100%, 48%)',
|
||||
warning: 'hsl(43, 100%, 45%)',
|
||||
danger: 'hsl(0, 80%, 48%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,77 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const solarizedDark: Theme = {
|
||||
id: 'solarized-dark',
|
||||
label: 'Solarized Dark',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: '#002b36',
|
||||
surfaceHighlight: '#073642',
|
||||
text: '#839496',
|
||||
textSubtle: '#657b83',
|
||||
textSubtlest: '#586e75',
|
||||
primary: '#268bd2',
|
||||
secondary: '#657b83',
|
||||
info: '#268bd2',
|
||||
success: '#859900',
|
||||
notice: '#b58900',
|
||||
warning: '#cb4b16',
|
||||
danger: '#dc322f',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: '#002b36',
|
||||
},
|
||||
sidebar: {
|
||||
surface: '#073642',
|
||||
border: 'hsl(192,81%,17%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: '#002b36',
|
||||
border: 'hsl(192,81%,16%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: '#073642',
|
||||
border: 'hsl(192,81%,17%)',
|
||||
},
|
||||
button: {
|
||||
primary: '#268bd2',
|
||||
secondary: '#657b83',
|
||||
info: '#268bd2',
|
||||
success: '#859900',
|
||||
notice: '#b58900',
|
||||
warning: '#cb4b16',
|
||||
danger: '#dc322f',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const solarizedLight: Theme = {
|
||||
id: 'solarized-light',
|
||||
label: 'Solarized Light',
|
||||
dark: false,
|
||||
base: {
|
||||
surface: '#fdf6e3',
|
||||
surfaceHighlight: '#eee8d5',
|
||||
text: '#657b83',
|
||||
textSubtle: '#839496',
|
||||
textSubtlest: '#93a1a1',
|
||||
primary: '#268bd2',
|
||||
secondary: '#839496',
|
||||
info: '#268bd2',
|
||||
success: '#859900',
|
||||
notice: '#b58900',
|
||||
warning: '#cb4b16',
|
||||
danger: '#dc322f',
|
||||
},
|
||||
components: {
|
||||
sidebar: {
|
||||
surface: '#eee8d5',
|
||||
border: '#d3cbb7',
|
||||
},
|
||||
appHeader: {
|
||||
surface: '#eee8d5',
|
||||
border: '#d3cbb7',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,56 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const synthwave84: Theme = {
|
||||
id: 'synthwave-84',
|
||||
label: "SynthWave '84",
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(253, 45%, 15%)',
|
||||
surfaceHighlight: 'hsl(253, 40%, 20%)',
|
||||
text: 'hsl(300, 50%, 90%)',
|
||||
textSubtle: 'hsl(280, 25%, 65%)',
|
||||
textSubtlest: 'hsl(280, 20%, 50%)',
|
||||
primary: 'hsl(177, 100%, 55%)',
|
||||
secondary: 'hsl(280, 20%, 60%)',
|
||||
info: 'hsl(320, 100%, 75%)',
|
||||
success: 'hsl(83, 100%, 60%)',
|
||||
notice: 'hsl(57, 100%, 60%)',
|
||||
warning: 'hsl(30, 100%, 60%)',
|
||||
danger: 'hsl(340, 100%, 65%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(253, 45%, 12%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(253, 42%, 18%)',
|
||||
border: 'hsl(253, 40%, 22%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(253, 45%, 11%)',
|
||||
border: 'hsl(253, 40%, 18%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(253, 42%, 18%)',
|
||||
border: 'hsl(253, 40%, 22%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(177, 100%, 48%)',
|
||||
secondary: 'hsl(280, 20%, 53%)',
|
||||
info: 'hsl(320, 100%, 68%)',
|
||||
success: 'hsl(83, 100%, 53%)',
|
||||
notice: 'hsl(57, 100%, 53%)',
|
||||
warning: 'hsl(30, 100%, 53%)',
|
||||
danger: 'hsl(340, 100%, 58%)',
|
||||
},
|
||||
editor: {
|
||||
primary: 'hsl(177, 100%, 55%)',
|
||||
secondary: 'hsl(280, 20%, 60%)',
|
||||
info: 'hsl(320, 100%, 75%)',
|
||||
success: 'hsl(83, 100%, 60%)',
|
||||
notice: 'hsl(57, 100%, 60%)',
|
||||
warning: 'hsl(30, 100%, 60%)',
|
||||
danger: 'hsl(340, 100%, 65%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,121 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const tokyoNight: Theme = {
|
||||
id: 'tokyo-night',
|
||||
label: 'Tokyo Night',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(235, 21%, 13%)',
|
||||
surfaceHighlight: 'hsl(235, 18%, 18%)',
|
||||
text: 'hsl(229, 28%, 76%)',
|
||||
textSubtle: 'hsl(232, 18%, 52%)',
|
||||
textSubtlest: 'hsl(234, 16%, 40%)',
|
||||
primary: 'hsl(266, 100%, 78%)',
|
||||
secondary: 'hsl(232, 18%, 52%)',
|
||||
info: 'hsl(217, 100%, 73%)',
|
||||
success: 'hsl(158, 57%, 63%)',
|
||||
notice: 'hsl(40, 67%, 65%)',
|
||||
warning: 'hsl(25, 75%, 58%)',
|
||||
danger: 'hsl(358, 100%, 70%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(235, 21%, 11%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(235, 21%, 11%)',
|
||||
border: 'hsl(235, 18%, 16%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(235, 21%, 9%)',
|
||||
border: 'hsl(235, 18%, 14%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(235, 21%, 11%)',
|
||||
border: 'hsl(235, 18%, 16%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(266, 100%, 71%)',
|
||||
info: 'hsl(217, 100%, 66%)',
|
||||
success: 'hsl(158, 57%, 56%)',
|
||||
notice: 'hsl(40, 67%, 58%)',
|
||||
warning: 'hsl(25, 75%, 52%)',
|
||||
danger: 'hsl(358, 100%, 63%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const tokyoNightStorm: Theme = {
|
||||
id: 'tokyo-night-storm',
|
||||
label: 'Tokyo Night Storm',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(232, 25%, 17%)',
|
||||
surfaceHighlight: 'hsl(232, 22%, 22%)',
|
||||
text: 'hsl(229, 28%, 76%)',
|
||||
textSubtle: 'hsl(232, 18%, 52%)',
|
||||
textSubtlest: 'hsl(234, 16%, 40%)',
|
||||
primary: 'hsl(266, 100%, 78%)',
|
||||
secondary: 'hsl(232, 18%, 52%)',
|
||||
info: 'hsl(217, 100%, 73%)',
|
||||
success: 'hsl(158, 57%, 63%)',
|
||||
notice: 'hsl(40, 67%, 65%)',
|
||||
warning: 'hsl(25, 75%, 58%)',
|
||||
danger: 'hsl(358, 100%, 70%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(232, 25%, 14%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(232, 25%, 14%)',
|
||||
border: 'hsl(232, 22%, 20%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(232, 25%, 12%)',
|
||||
border: 'hsl(232, 22%, 18%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(232, 25%, 14%)',
|
||||
border: 'hsl(232, 22%, 20%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(266, 100%, 71%)',
|
||||
info: 'hsl(217, 100%, 66%)',
|
||||
success: 'hsl(158, 57%, 56%)',
|
||||
notice: 'hsl(40, 67%, 58%)',
|
||||
warning: 'hsl(25, 75%, 52%)',
|
||||
danger: 'hsl(358, 100%, 63%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const tokyoNightDay: Theme = {
|
||||
id: 'tokyo-night-day',
|
||||
label: 'Tokyo Night Day',
|
||||
dark: false,
|
||||
base: {
|
||||
surface: 'hsl(212, 100%, 98%)',
|
||||
surfaceHighlight: 'hsl(212, 60%, 93%)',
|
||||
text: 'hsl(233, 26%, 27%)',
|
||||
textSubtle: 'hsl(232, 18%, 45%)',
|
||||
textSubtlest: 'hsl(232, 12%, 55%)',
|
||||
primary: 'hsl(290, 80%, 45%)',
|
||||
secondary: 'hsl(232, 18%, 50%)',
|
||||
info: 'hsl(217, 88%, 52%)',
|
||||
success: 'hsl(160, 75%, 35%)',
|
||||
notice: 'hsl(41, 80%, 40%)',
|
||||
warning: 'hsl(20, 80%, 48%)',
|
||||
danger: 'hsl(359, 65%, 48%)',
|
||||
},
|
||||
components: {
|
||||
sidebar: {
|
||||
surface: 'hsl(212, 60%, 95%)',
|
||||
border: 'hsl(212, 40%, 88%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(212, 60%, 93%)',
|
||||
border: 'hsl(212, 40%, 86%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,44 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const triangle: Theme = {
|
||||
id: 'triangle',
|
||||
dark: true,
|
||||
label: 'Triangle',
|
||||
base: {
|
||||
surface: 'rgb(0,0,0)',
|
||||
surfaceHighlight: 'rgb(21,21,21)',
|
||||
surfaceActive: 'rgb(31,31,31)',
|
||||
text: 'rgb(237,237,237)',
|
||||
textSubtle: 'rgb(161,161,161)',
|
||||
textSubtlest: 'rgb(115,115,115)',
|
||||
border: 'rgb(31,31,31)',
|
||||
primary: 'rgb(196,114,251)',
|
||||
secondary: 'rgb(161,161,161)',
|
||||
info: 'rgb(71,168,255)',
|
||||
success: 'rgb(0,202,81)',
|
||||
notice: 'rgb(255,175,0)',
|
||||
warning: '#FF4C8D',
|
||||
danger: '#fd495a',
|
||||
},
|
||||
components: {
|
||||
editor: {
|
||||
danger: '#FF4C8D',
|
||||
warning: '#fd495a',
|
||||
},
|
||||
dialog: {
|
||||
surface: 'rgb(10,10,10)',
|
||||
border: 'rgb(31,31,31)',
|
||||
},
|
||||
sidebar: {
|
||||
border: 'rgb(31,31,31)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'rgb(10,10,10)',
|
||||
border: 'rgb(31,31,31)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'rgb(10,10,10)',
|
||||
border: 'rgb(31,31,31)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,77 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const vitesseDark: Theme = {
|
||||
id: 'vitesse-dark',
|
||||
label: 'Vitesse Dark',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(220, 13%, 10%)',
|
||||
surfaceHighlight: 'hsl(220, 12%, 15%)',
|
||||
text: 'hsl(220, 10%, 80%)',
|
||||
textSubtle: 'hsl(220, 8%, 55%)',
|
||||
textSubtlest: 'hsl(220, 6%, 42%)',
|
||||
primary: 'hsl(143, 50%, 55%)',
|
||||
secondary: 'hsl(220, 8%, 55%)',
|
||||
info: 'hsl(214, 60%, 65%)',
|
||||
success: 'hsl(143, 50%, 55%)',
|
||||
notice: 'hsl(45, 65%, 65%)',
|
||||
warning: 'hsl(30, 60%, 60%)',
|
||||
danger: 'hsl(355, 60%, 60%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(220, 13%, 7%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(220, 12%, 8%)',
|
||||
border: 'hsl(220, 10%, 14%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(220, 13%, 6%)',
|
||||
border: 'hsl(220, 10%, 12%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(220, 12%, 8%)',
|
||||
border: 'hsl(220, 10%, 14%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(143, 50%, 48%)',
|
||||
secondary: 'hsl(220, 8%, 48%)',
|
||||
info: 'hsl(214, 60%, 58%)',
|
||||
success: 'hsl(143, 50%, 48%)',
|
||||
notice: 'hsl(45, 65%, 58%)',
|
||||
warning: 'hsl(30, 60%, 53%)',
|
||||
danger: 'hsl(355, 60%, 53%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const vitesseLight: Theme = {
|
||||
id: 'vitesse-light',
|
||||
label: 'Vitesse Light',
|
||||
dark: false,
|
||||
base: {
|
||||
surface: 'hsl(0, 0%, 100%)',
|
||||
surfaceHighlight: 'hsl(40, 20%, 96%)',
|
||||
text: 'hsl(0, 0%, 24%)',
|
||||
textSubtle: 'hsl(0, 0%, 45%)',
|
||||
textSubtlest: 'hsl(0, 0%, 55%)',
|
||||
primary: 'hsl(143, 40%, 40%)',
|
||||
secondary: 'hsl(0, 0%, 45%)',
|
||||
info: 'hsl(214, 50%, 48%)',
|
||||
success: 'hsl(143, 40%, 40%)',
|
||||
notice: 'hsl(40, 60%, 42%)',
|
||||
warning: 'hsl(25, 60%, 48%)',
|
||||
danger: 'hsl(345, 50%, 48%)',
|
||||
},
|
||||
components: {
|
||||
sidebar: {
|
||||
surface: 'hsl(40, 20%, 97%)',
|
||||
border: 'hsl(40, 15%, 92%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(40, 20%, 95%)',
|
||||
border: 'hsl(40, 15%, 90%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,47 +0,0 @@
|
||||
import type { Theme } from '@yaakapp/api';
|
||||
|
||||
export const winterIsComing: Theme = {
|
||||
id: 'winter-is-coming',
|
||||
label: 'Winter is Coming',
|
||||
dark: true,
|
||||
base: {
|
||||
surface: 'hsl(216, 50%, 10%)',
|
||||
surfaceHighlight: 'hsl(216, 40%, 15%)',
|
||||
text: 'hsl(210, 20%, 88%)',
|
||||
textSubtle: 'hsl(210, 15%, 60%)',
|
||||
textSubtlest: 'hsl(210, 10%, 45%)',
|
||||
primary: 'hsl(176, 85%, 60%)',
|
||||
secondary: 'hsl(210, 15%, 60%)',
|
||||
info: 'hsl(210, 65%, 65%)',
|
||||
success: 'hsl(100, 65%, 55%)',
|
||||
notice: 'hsl(45, 100%, 65%)',
|
||||
warning: 'hsl(30, 90%, 55%)',
|
||||
danger: 'hsl(350, 100%, 65%)',
|
||||
},
|
||||
components: {
|
||||
dialog: {
|
||||
surface: 'hsl(216, 50%, 7%)',
|
||||
},
|
||||
sidebar: {
|
||||
surface: 'hsl(216, 45%, 12%)',
|
||||
border: 'hsl(216, 40%, 17%)',
|
||||
},
|
||||
appHeader: {
|
||||
surface: 'hsl(216, 50%, 8%)',
|
||||
border: 'hsl(216, 40%, 14%)',
|
||||
},
|
||||
responsePane: {
|
||||
surface: 'hsl(216, 45%, 12%)',
|
||||
border: 'hsl(216, 40%, 17%)',
|
||||
},
|
||||
button: {
|
||||
primary: 'hsl(176, 85%, 53%)',
|
||||
secondary: 'hsl(210, 15%, 53%)',
|
||||
info: 'hsl(210, 65%, 58%)',
|
||||
success: 'hsl(100, 65%, 48%)',
|
||||
notice: 'hsl(45, 100%, 58%)',
|
||||
warning: 'hsl(30, 90%, 48%)',
|
||||
danger: 'hsl(350, 100%, 58%)',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,28 +1,13 @@
|
||||
const { readdirSync, cpSync, existsSync } = require('node:fs');
|
||||
const { readdirSync, cpSync } = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const pluginsDir = path.join(__dirname, '..', 'plugins');
|
||||
const externalPluginsDir = path.join(__dirname, '..', 'plugins-external');
|
||||
|
||||
// Get list of external (non-bundled) plugins
|
||||
const externalPlugins = new Set();
|
||||
if (existsSync(externalPluginsDir)) {
|
||||
for (const name of readdirSync(externalPluginsDir)) {
|
||||
if (!name.startsWith('.')) {
|
||||
externalPlugins.add(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log('Copying Yaak plugins to', pluginsDir);
|
||||
|
||||
for (const name of readdirSync(pluginsDir)) {
|
||||
const dir = path.join(pluginsDir, name);
|
||||
if (name.startsWith('.')) continue;
|
||||
if (externalPlugins.has(name)) {
|
||||
console.log(`Skipping ${name} (external plugin)`);
|
||||
continue;
|
||||
}
|
||||
const destDir = path.join(__dirname, '../src-tauri/vendored/plugins/', name);
|
||||
console.log(`Copying ${name} to ${destDir}`);
|
||||
cpSync(path.join(dir, 'package.json'), path.join(destDir, 'package.json'));
|
||||
|
||||
70
src-tauri/Cargo.lock
generated
70
src-tauri/Cargo.lock
generated
@@ -964,10 +964,29 @@ version = "0.18.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747"
|
||||
dependencies = [
|
||||
"percent-encoding",
|
||||
"time",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cookie_store"
|
||||
version = "0.21.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2eac901828f88a5241ee0600950ab981148a18f2f756900ffba1b125ca6a3ef9"
|
||||
dependencies = [
|
||||
"cookie",
|
||||
"document-features",
|
||||
"idna",
|
||||
"log",
|
||||
"publicsuffix",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"time",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core-foundation"
|
||||
version = "0.9.4"
|
||||
@@ -1364,6 +1383,15 @@ dependencies = [
|
||||
"const-random",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "document-features"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d"
|
||||
dependencies = [
|
||||
"litrs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "downcast-rs"
|
||||
version = "1.2.1"
|
||||
@@ -3014,6 +3042,12 @@ version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956"
|
||||
|
||||
[[package]]
|
||||
name = "litrs"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
version = "0.4.13"
|
||||
@@ -4255,6 +4289,12 @@ dependencies = [
|
||||
"prost",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "psl-types"
|
||||
version = "2.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "33cb294fe86a74cbcf50d4445b37da762029549ebeea341421c7c70370f86cac"
|
||||
|
||||
[[package]]
|
||||
name = "ptr_meta"
|
||||
version = "0.1.4"
|
||||
@@ -4275,6 +4315,16 @@ dependencies = [
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "publicsuffix"
|
||||
version = "2.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f42ea446cab60335f76979ec15e12619a2165b5ae2c12166bef27d283a9fadf"
|
||||
dependencies = [
|
||||
"idna",
|
||||
"psl-types",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quick-xml"
|
||||
version = "0.32.0"
|
||||
@@ -4583,6 +4633,8 @@ dependencies = [
|
||||
"async-compression",
|
||||
"base64 0.22.1",
|
||||
"bytes",
|
||||
"cookie",
|
||||
"cookie_store",
|
||||
"encoding_rs",
|
||||
"futures-core",
|
||||
"futures-util",
|
||||
@@ -4623,6 +4675,18 @@ dependencies = [
|
||||
"webpki-roots",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "reqwest_cookie_store"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0b36498c7452f11b1833900f31fbb01fc46be20992a50269c88cf59d79f54e9"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"cookie_store",
|
||||
"reqwest",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rfd"
|
||||
version = "0.15.3"
|
||||
@@ -7843,6 +7907,7 @@ dependencies = [
|
||||
"openssl-sys",
|
||||
"rand 0.9.1",
|
||||
"reqwest",
|
||||
"reqwest_cookie_store",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
@@ -7974,7 +8039,6 @@ dependencies = [
|
||||
"async-trait",
|
||||
"brotli 7.0.0",
|
||||
"bytes",
|
||||
"cookie",
|
||||
"flate2",
|
||||
"futures-util",
|
||||
"hyper-util",
|
||||
@@ -7982,6 +8046,7 @@ dependencies = [
|
||||
"mime_guess",
|
||||
"regex",
|
||||
"reqwest",
|
||||
"reqwest_cookie_store",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
@@ -7989,7 +8054,6 @@ dependencies = [
|
||||
"tokio",
|
||||
"tokio-util",
|
||||
"tower-service",
|
||||
"url",
|
||||
"urlencoding",
|
||||
"yaak-common",
|
||||
"yaak-models",
|
||||
@@ -8151,6 +8215,7 @@ dependencies = [
|
||||
"futures-util",
|
||||
"log",
|
||||
"md5 0.8.0",
|
||||
"reqwest_cookie_store",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tauri",
|
||||
@@ -8158,7 +8223,6 @@ dependencies = [
|
||||
"thiserror 2.0.17",
|
||||
"tokio",
|
||||
"tokio-tungstenite",
|
||||
"url",
|
||||
"yaak-http",
|
||||
"yaak-models",
|
||||
"yaak-plugins",
|
||||
|
||||
@@ -55,7 +55,8 @@ log = { workspace = true }
|
||||
md5 = "0.8.0"
|
||||
mime_guess = "2.0.5"
|
||||
rand = "0.9.0"
|
||||
reqwest = { workspace = true, features = ["multipart", "gzip", "brotli", "deflate", "json", "rustls-tls-manual-roots-no-provider", "socks", "http2"] }
|
||||
reqwest = { workspace = true, features = ["multipart", "cookies", "gzip", "brotli", "deflate", "json", "rustls-tls-manual-roots-no-provider", "socks", "http2"] }
|
||||
reqwest_cookie_store = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true, features = ["raw_value"] }
|
||||
tauri = { workspace = true, features = ["devtools", "protocol-asset"] }
|
||||
@@ -97,6 +98,7 @@ chrono = "0.4.42"
|
||||
hex = "0.4.3"
|
||||
keyring = "3.6.3"
|
||||
reqwest = "0.12.20"
|
||||
reqwest_cookie_store = "0.8.0"
|
||||
rustls = { version = "0.23.34", default-features = false }
|
||||
rustls-platform-verifier = "0.6.2"
|
||||
serde = "1.0.228"
|
||||
|
||||
@@ -1,26 +1,23 @@
|
||||
use crate::error::Error::GenericError;
|
||||
use crate::error::Result;
|
||||
use crate::render::render_http_request;
|
||||
use log::{debug, warn};
|
||||
use std::pin::Pin;
|
||||
use crate::response_err;
|
||||
use log::debug;
|
||||
use reqwest_cookie_store::{CookieStore, CookieStoreMutex};
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
use tauri::{AppHandle, Manager, Runtime, WebviewWindow};
|
||||
use tokio::fs::{File, create_dir_all};
|
||||
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWriteExt};
|
||||
use tokio::io::{AsyncReadExt, AsyncWriteExt};
|
||||
use tokio::sync::Mutex;
|
||||
use tokio::sync::watch::Receiver;
|
||||
use tokio_util::bytes::Bytes;
|
||||
use yaak_http::client::{
|
||||
HttpConnectionOptions, HttpConnectionProxySetting, HttpConnectionProxySettingAuth,
|
||||
};
|
||||
use yaak_http::cookies::CookieStore;
|
||||
use yaak_http::manager::HttpConnectionManager;
|
||||
use yaak_http::sender::ReqwestSender;
|
||||
use yaak_http::tee_reader::TeeReader;
|
||||
use yaak_http::transaction::HttpTransaction;
|
||||
use yaak_http::types::{
|
||||
SendableBody, SendableHttpRequest, SendableHttpRequestOptions, append_query_params,
|
||||
};
|
||||
use yaak_models::blob_manager::{BlobManagerExt, BodyChunk};
|
||||
use yaak_http::types::{SendableHttpRequest, SendableHttpRequestOptions, append_query_params};
|
||||
use yaak_models::models::{
|
||||
CookieJar, Environment, HttpRequest, HttpResponse, HttpResponseEvent, HttpResponseHeader,
|
||||
HttpResponseState, ProxySetting, ProxySettingAuth,
|
||||
@@ -35,55 +32,6 @@ use yaak_plugins::template_callback::PluginTemplateCallback;
|
||||
use yaak_templates::RenderOptions;
|
||||
use yaak_tls::find_client_certificate;
|
||||
|
||||
/// Chunk size for storing request bodies (1MB)
|
||||
const REQUEST_BODY_CHUNK_SIZE: usize = 1024 * 1024;
|
||||
|
||||
/// Context for managing response state during HTTP transactions.
|
||||
/// Handles both persisted responses (stored in DB) and ephemeral responses (in-memory only).
|
||||
struct ResponseContext<R: Runtime> {
|
||||
app_handle: AppHandle<R>,
|
||||
response: HttpResponse,
|
||||
update_source: UpdateSource,
|
||||
}
|
||||
|
||||
impl<R: Runtime> ResponseContext<R> {
|
||||
fn new(app_handle: AppHandle<R>, response: HttpResponse, update_source: UpdateSource) -> Self {
|
||||
Self { app_handle, response, update_source }
|
||||
}
|
||||
|
||||
/// Whether this response is persisted (has a non-empty ID)
|
||||
fn is_persisted(&self) -> bool {
|
||||
!self.response.id.is_empty()
|
||||
}
|
||||
|
||||
/// Update the response state. For persisted responses, fetches from DB, applies the
|
||||
/// closure, and updates the DB. For ephemeral responses, just applies the closure
|
||||
/// to the in-memory response.
|
||||
fn update<F>(&mut self, func: F) -> Result<()>
|
||||
where
|
||||
F: FnOnce(&mut HttpResponse),
|
||||
{
|
||||
if self.is_persisted() {
|
||||
let r = self.app_handle.with_tx(|tx| {
|
||||
let mut r = tx.get_http_response(&self.response.id)?;
|
||||
func(&mut r);
|
||||
tx.update_http_response_if_id(&r, &self.update_source)?;
|
||||
Ok(r)
|
||||
})?;
|
||||
self.response = r;
|
||||
Ok(())
|
||||
} else {
|
||||
func(&mut self.response);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the current response state
|
||||
fn response(&self) -> &HttpResponse {
|
||||
&self.response
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn send_http_request<R: Runtime>(
|
||||
window: &WebviewWindow<R>,
|
||||
unrendered_request: &HttpRequest,
|
||||
@@ -114,38 +62,25 @@ pub async fn send_http_request_with_context<R: Runtime>(
|
||||
plugin_context: &PluginContext,
|
||||
) -> Result<HttpResponse> {
|
||||
let app_handle = window.app_handle().clone();
|
||||
let response = Arc::new(Mutex::new(og_response.clone()));
|
||||
let update_source = UpdateSource::from_window(window);
|
||||
let mut response_ctx =
|
||||
ResponseContext::new(app_handle.clone(), og_response.clone(), update_source);
|
||||
|
||||
// Execute the inner send logic and handle errors consistently
|
||||
let start = Instant::now();
|
||||
let result = send_http_request_inner(
|
||||
window,
|
||||
unrendered_request,
|
||||
og_response,
|
||||
environment,
|
||||
cookie_jar,
|
||||
cancelled_rx,
|
||||
plugin_context,
|
||||
&mut response_ctx,
|
||||
)
|
||||
.await;
|
||||
|
||||
match result {
|
||||
Ok(response) => Ok(response),
|
||||
Err(e) => {
|
||||
let error = e.to_string();
|
||||
let elapsed = start.elapsed().as_millis() as i32;
|
||||
warn!("Failed to send request: {error:?}");
|
||||
let _ = response_ctx.update(|r| {
|
||||
r.state = HttpResponseState::Closed;
|
||||
r.elapsed = elapsed;
|
||||
if r.elapsed_headers == 0 {
|
||||
r.elapsed_headers = elapsed;
|
||||
}
|
||||
r.error = Some(error);
|
||||
});
|
||||
Ok(response_ctx.response().clone())
|
||||
Ok(response_err(&app_handle, &*response.lock().await, e.to_string(), &update_source))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -153,24 +88,26 @@ pub async fn send_http_request_with_context<R: Runtime>(
|
||||
async fn send_http_request_inner<R: Runtime>(
|
||||
window: &WebviewWindow<R>,
|
||||
unrendered_request: &HttpRequest,
|
||||
og_response: &HttpResponse,
|
||||
environment: Option<Environment>,
|
||||
cookie_jar: Option<CookieJar>,
|
||||
cancelled_rx: &Receiver<bool>,
|
||||
plugin_context: &PluginContext,
|
||||
response_ctx: &mut ResponseContext<R>,
|
||||
) -> Result<HttpResponse> {
|
||||
let app_handle = window.app_handle().clone();
|
||||
let plugin_manager = app_handle.state::<PluginManager>();
|
||||
let connection_manager = app_handle.state::<HttpConnectionManager>();
|
||||
let settings = window.db().get_settings();
|
||||
let workspace_id = &unrendered_request.workspace_id;
|
||||
let folder_id = unrendered_request.folder_id.as_deref();
|
||||
let environment_id = environment.map(|e| e.id);
|
||||
let workspace = window.db().get_workspace(workspace_id)?;
|
||||
let wrk_id = &unrendered_request.workspace_id;
|
||||
let fld_id = unrendered_request.folder_id.as_deref();
|
||||
let env_id = environment.map(|e| e.id);
|
||||
let resp_id = og_response.id.clone();
|
||||
let workspace = window.db().get_workspace(wrk_id)?;
|
||||
let response = Arc::new(Mutex::new(og_response.clone()));
|
||||
let update_source = UpdateSource::from_window(window);
|
||||
let (resolved, auth_context_id) = resolve_http_request(window, unrendered_request)?;
|
||||
let cb = PluginTemplateCallback::new(window.app_handle(), &plugin_context, RenderPurpose::Send);
|
||||
let env_chain =
|
||||
window.db().resolve_environments(&workspace.id, folder_id, environment_id.as_deref())?;
|
||||
let env_chain = window.db().resolve_environments(&workspace.id, fld_id, env_id.as_deref())?;
|
||||
let request = render_http_request(&resolved, env_chain, &cb, &RenderOptions::throw()).await?;
|
||||
|
||||
// Build the sendable request using the new SendableHttpRequest type
|
||||
@@ -211,14 +148,28 @@ async fn send_http_request_inner<R: Runtime>(
|
||||
let client_certificate =
|
||||
find_client_certificate(&sendable_request.url, &settings.client_certificates);
|
||||
|
||||
// Create cookie store if a cookie jar is specified
|
||||
let maybe_cookie_store = match cookie_jar.clone() {
|
||||
// Add cookie store if specified
|
||||
let maybe_cookie_manager = match cookie_jar.clone() {
|
||||
Some(CookieJar { id, .. }) => {
|
||||
// NOTE: We need to refetch the cookie jar because a chained request might have
|
||||
// NOTE: WE need to refetch the cookie jar because a chained request might have
|
||||
// updated cookies when we rendered the request.
|
||||
let cj = window.db().get_cookie_jar(&id)?;
|
||||
let cookie_store = CookieStore::from_cookies(cj.cookies.clone());
|
||||
Some((cookie_store, cj))
|
||||
// HACK: Can't construct Cookie without serde, so we have to do this
|
||||
let cookies = cj
|
||||
.cookies
|
||||
.iter()
|
||||
.filter_map(|cookie| {
|
||||
let json_cookie = serde_json::to_value(cookie).ok()?;
|
||||
serde_json::from_value(json_cookie).ok()?
|
||||
})
|
||||
.map(|c| Ok(c))
|
||||
.collect::<Vec<Result<_>>>();
|
||||
|
||||
let cookie_store = CookieStore::from_cookies(cookies, true)?;
|
||||
let cookie_store = CookieStoreMutex::new(cookie_store);
|
||||
let cookie_store = Arc::new(cookie_store);
|
||||
let cookie_provider = Arc::clone(&cookie_store);
|
||||
Some((cookie_provider, cj))
|
||||
}
|
||||
None => None,
|
||||
};
|
||||
@@ -228,6 +179,7 @@ async fn send_http_request_inner<R: Runtime>(
|
||||
id: plugin_context.id.clone(),
|
||||
validate_certificates: workspace.setting_validate_certificates,
|
||||
proxy: proxy_setting,
|
||||
cookie_provider: maybe_cookie_manager.as_ref().map(|(p, _)| Arc::clone(&p)),
|
||||
client_certificate,
|
||||
})
|
||||
.await?;
|
||||
@@ -243,48 +195,35 @@ async fn send_http_request_inner<R: Runtime>(
|
||||
)
|
||||
.await?;
|
||||
|
||||
let cookie_store = maybe_cookie_store.as_ref().map(|(cs, _)| cs.clone());
|
||||
let result = execute_transaction(
|
||||
let start_for_cancellation = Instant::now();
|
||||
let final_resp = execute_transaction(
|
||||
client,
|
||||
sendable_request,
|
||||
response_ctx,
|
||||
response.clone(),
|
||||
&resp_id,
|
||||
&app_handle,
|
||||
&update_source,
|
||||
cancelled_rx.clone(),
|
||||
cookie_store,
|
||||
)
|
||||
.await;
|
||||
|
||||
// Wait for blob writing to complete and check for errors
|
||||
let final_result = match result {
|
||||
Ok((response, maybe_blob_write_handle)) => {
|
||||
// Check if blob writing failed
|
||||
if let Some(handle) = maybe_blob_write_handle {
|
||||
if let Ok(Err(e)) = handle.await {
|
||||
// Update response with the storage error
|
||||
let _ = response_ctx.update(|r| {
|
||||
let error_msg =
|
||||
format!("Request succeeded but failed to store request body: {}", e);
|
||||
r.error = Some(match &r.error {
|
||||
Some(existing) => format!("{}; {}", existing, error_msg),
|
||||
None => error_msg,
|
||||
});
|
||||
});
|
||||
}
|
||||
match final_resp {
|
||||
Ok(r) => Ok(r),
|
||||
Err(e) => match app_handle.db().get_http_response(&resp_id) {
|
||||
Ok(mut r) => {
|
||||
r.state = HttpResponseState::Closed;
|
||||
r.elapsed = start_for_cancellation.elapsed().as_millis() as i32;
|
||||
r.elapsed_headers = start_for_cancellation.elapsed().as_millis() as i32;
|
||||
r.error = Some(e.to_string());
|
||||
app_handle
|
||||
.db()
|
||||
.update_http_response_if_id(&r, &UpdateSource::from_window(window))
|
||||
.expect("Failed to update response");
|
||||
Ok(r)
|
||||
}
|
||||
Ok(response)
|
||||
}
|
||||
Err(e) => Err(e),
|
||||
};
|
||||
|
||||
// Persist cookies back to the database after the request completes
|
||||
if let Some((cookie_store, mut cj)) = maybe_cookie_store {
|
||||
let cookies = cookie_store.get_all_cookies();
|
||||
cj.cookies = cookies;
|
||||
if let Err(e) = window.db().upsert_cookie_jar(&cj, &UpdateSource::Background) {
|
||||
warn!("Failed to persist cookies to database: {}", e);
|
||||
}
|
||||
_ => Err(GenericError("Ephemeral request was cancelled".to_string())),
|
||||
},
|
||||
}
|
||||
|
||||
final_result
|
||||
}
|
||||
|
||||
pub fn resolve_http_request<R: Runtime>(
|
||||
@@ -306,21 +245,15 @@ pub fn resolve_http_request<R: Runtime>(
|
||||
|
||||
async fn execute_transaction<R: Runtime>(
|
||||
client: reqwest::Client,
|
||||
mut sendable_request: SendableHttpRequest,
|
||||
response_ctx: &mut ResponseContext<R>,
|
||||
sendable_request: SendableHttpRequest,
|
||||
response: Arc<Mutex<HttpResponse>>,
|
||||
response_id: &String,
|
||||
app_handle: &AppHandle<R>,
|
||||
update_source: &UpdateSource,
|
||||
mut cancelled_rx: Receiver<bool>,
|
||||
cookie_store: Option<CookieStore>,
|
||||
) -> Result<(HttpResponse, Option<tauri::async_runtime::JoinHandle<Result<()>>>)> {
|
||||
let app_handle = &response_ctx.app_handle.clone();
|
||||
let response_id = response_ctx.response().id.clone();
|
||||
let workspace_id = response_ctx.response().workspace_id.clone();
|
||||
let is_persisted = response_ctx.is_persisted();
|
||||
|
||||
) -> Result<HttpResponse> {
|
||||
let sender = ReqwestSender::with_client(client);
|
||||
let transaction = match cookie_store {
|
||||
Some(cs) => HttpTransaction::with_cookie_store(sender, cs),
|
||||
None => HttpTransaction::new(sender),
|
||||
};
|
||||
let transaction = HttpTransaction::new(sender);
|
||||
let start = Instant::now();
|
||||
|
||||
// Capture request headers before sending
|
||||
@@ -330,85 +263,30 @@ async fn execute_transaction<R: Runtime>(
|
||||
.map(|(name, value)| HttpResponseHeader { name: name.clone(), value: value.clone() })
|
||||
.collect();
|
||||
|
||||
// Update response with headers info
|
||||
response_ctx.update(|r| {
|
||||
{
|
||||
// Update response with headers info and mark as connected
|
||||
let mut r = response.lock().await;
|
||||
r.url = sendable_request.url.clone();
|
||||
r.request_headers = request_headers;
|
||||
})?;
|
||||
r.request_headers = request_headers.clone();
|
||||
app_handle.db().update_http_response_if_id(&r, &update_source)?;
|
||||
}
|
||||
|
||||
// Create bounded channel for receiving events and spawn a task to store them in DB
|
||||
// Buffer size of 100 events provides back pressure if DB writes are slow
|
||||
// Create channel for receiving events and spawn a task to store them in DB
|
||||
let (event_tx, mut event_rx) =
|
||||
tokio::sync::mpsc::channel::<yaak_http::sender::HttpResponseEvent>(100);
|
||||
tokio::sync::mpsc::unbounded_channel::<yaak_http::sender::HttpResponseEvent>();
|
||||
|
||||
// Write events to DB in a task (only for persisted responses)
|
||||
if is_persisted {
|
||||
// Write events to DB in a task
|
||||
{
|
||||
let response_id = response_id.clone();
|
||||
let workspace_id = response.lock().await.workspace_id.clone();
|
||||
let app_handle = app_handle.clone();
|
||||
let update_source = response_ctx.update_source.clone();
|
||||
let workspace_id = workspace_id.clone();
|
||||
let update_source = update_source.clone();
|
||||
tokio::spawn(async move {
|
||||
while let Some(event) = event_rx.recv().await {
|
||||
let db_event = HttpResponseEvent::new(&response_id, &workspace_id, event.into());
|
||||
let _ = app_handle.db().upsert_http_response_event(&db_event, &update_source);
|
||||
let _ = app_handle.db().upsert(&db_event, &update_source);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// For ephemeral responses, just drain the events
|
||||
tokio::spawn(async move { while event_rx.recv().await.is_some() {} });
|
||||
};
|
||||
|
||||
// Capture request body as it's sent (only for persisted responses)
|
||||
let body_id = format!("{}.request", response_id);
|
||||
let maybe_blob_write_handle = match sendable_request.body {
|
||||
Some(SendableBody::Bytes(bytes)) => {
|
||||
if is_persisted {
|
||||
write_bytes_to_db_sync(response_ctx, &body_id, bytes.clone())?;
|
||||
}
|
||||
sendable_request.body = Some(SendableBody::Bytes(bytes));
|
||||
None
|
||||
}
|
||||
Some(SendableBody::Stream(stream)) => {
|
||||
// Wrap stream with TeeReader to capture data as it's read
|
||||
// Use unbounded channel to ensure all data is captured without blocking the HTTP request
|
||||
let (body_chunk_tx, body_chunk_rx) = tokio::sync::mpsc::unbounded_channel::<Vec<u8>>();
|
||||
let tee_reader = TeeReader::new(stream, body_chunk_tx);
|
||||
let pinned: Pin<Box<dyn AsyncRead + Send + 'static>> = Box::pin(tee_reader);
|
||||
|
||||
let handle = if is_persisted {
|
||||
// Spawn task to write request body chunks to blob DB
|
||||
let app_handle = app_handle.clone();
|
||||
let response_id = response_id.clone();
|
||||
let workspace_id = workspace_id.clone();
|
||||
let body_id = body_id.clone();
|
||||
let update_source = response_ctx.update_source.clone();
|
||||
Some(tauri::async_runtime::spawn(async move {
|
||||
write_stream_chunks_to_db(
|
||||
app_handle,
|
||||
&body_id,
|
||||
&workspace_id,
|
||||
&response_id,
|
||||
&update_source,
|
||||
body_chunk_rx,
|
||||
)
|
||||
.await
|
||||
}))
|
||||
} else {
|
||||
// For ephemeral responses, just drain the body chunks
|
||||
tauri::async_runtime::spawn(async move {
|
||||
let mut rx = body_chunk_rx;
|
||||
while rx.recv().await.is_some() {}
|
||||
});
|
||||
None
|
||||
};
|
||||
|
||||
sendable_request.body = Some(SendableBody::Stream(pinned));
|
||||
handle
|
||||
}
|
||||
None => {
|
||||
sendable_request.body = None;
|
||||
None
|
||||
}
|
||||
};
|
||||
|
||||
// Execute the transaction with cancellation support
|
||||
@@ -419,42 +297,44 @@ async fn execute_transaction<R: Runtime>(
|
||||
.await?;
|
||||
|
||||
// Prepare the response path before consuming the body
|
||||
let dir = app_handle.path().app_data_dir()?;
|
||||
let base_dir = dir.join("responses");
|
||||
create_dir_all(&base_dir).await?;
|
||||
|
||||
let body_path = if response_id.is_empty() {
|
||||
// Ephemeral responses: use OS temp directory for automatic cleanup
|
||||
let temp_dir = std::env::temp_dir().join("yaak-ephemeral-responses");
|
||||
create_dir_all(&temp_dir).await?;
|
||||
temp_dir.join(uuid::Uuid::new_v4().to_string())
|
||||
base_dir.join(uuid::Uuid::new_v4().to_string())
|
||||
} else {
|
||||
// Persisted responses: use app data directory
|
||||
let dir = app_handle.path().app_data_dir()?;
|
||||
let base_dir = dir.join("responses");
|
||||
create_dir_all(&base_dir).await?;
|
||||
base_dir.join(&response_id)
|
||||
};
|
||||
|
||||
// Extract metadata before consuming the body (headers are available immediately)
|
||||
// Url might change, so update again
|
||||
response_ctx.update(|r| {
|
||||
let headers: Vec<HttpResponseHeader> = http_response
|
||||
.headers
|
||||
.iter()
|
||||
.map(|(name, value)| HttpResponseHeader { name: name.clone(), value: value.clone() })
|
||||
.collect();
|
||||
|
||||
{
|
||||
// Update response with headers info and mark as connected
|
||||
let mut r = response.lock().await;
|
||||
r.body_path = Some(body_path.to_string_lossy().to_string());
|
||||
r.elapsed_headers = start.elapsed().as_millis() as i32;
|
||||
r.status = http_response.status as i32;
|
||||
r.status_reason = http_response.status_reason.clone();
|
||||
r.url = http_response.url.clone();
|
||||
r.status_reason = http_response.status_reason.clone().clone();
|
||||
r.url = http_response.url.clone().clone();
|
||||
r.remote_addr = http_response.remote_addr.clone();
|
||||
r.version = http_response.version.clone();
|
||||
r.headers = http_response
|
||||
.headers
|
||||
.iter()
|
||||
.map(|(name, value)| HttpResponseHeader { name: name.clone(), value: value.clone() })
|
||||
.collect();
|
||||
r.version = http_response.version.clone().clone();
|
||||
r.headers = headers.clone();
|
||||
r.content_length = http_response.content_length.map(|l| l as i32);
|
||||
r.state = HttpResponseState::Connected;
|
||||
r.request_headers = http_response
|
||||
.request_headers
|
||||
.iter()
|
||||
.map(|(n, v)| HttpResponseHeader { name: n.clone(), value: v.clone() })
|
||||
.collect();
|
||||
})?;
|
||||
r.state = HttpResponseState::Connected;
|
||||
app_handle.db().update_http_response_if_id(&r, &update_source)?;
|
||||
}
|
||||
|
||||
// Get the body stream for manual consumption
|
||||
let mut body_stream = http_response.into_body_stream()?;
|
||||
@@ -468,14 +348,10 @@ async fn execute_transaction<R: Runtime>(
|
||||
.await
|
||||
.map_err(|e| GenericError(format!("Failed to open file: {}", e)))?;
|
||||
|
||||
// Stream body to file, with throttled DB updates to avoid excessive writes
|
||||
// Stream body to file, updating DB on each chunk
|
||||
let mut written_bytes: usize = 0;
|
||||
let mut last_update_time = start;
|
||||
let mut buf = [0u8; 8192];
|
||||
|
||||
// Throttle settings: update DB at most every 100ms
|
||||
const UPDATE_INTERVAL_MS: u128 = 100;
|
||||
|
||||
loop {
|
||||
// Check for cancellation. If we already have headers/body, just close cleanly without error
|
||||
if *cancelled_rx.borrow() {
|
||||
@@ -502,17 +378,11 @@ async fn execute_transaction<R: Runtime>(
|
||||
.map_err(|e| GenericError(format!("Failed to flush file: {}", e)))?;
|
||||
written_bytes += n;
|
||||
|
||||
// Throttle DB updates: only update if enough time has passed
|
||||
let now = Instant::now();
|
||||
let elapsed_since_update = now.duration_since(last_update_time).as_millis();
|
||||
|
||||
if elapsed_since_update >= UPDATE_INTERVAL_MS {
|
||||
response_ctx.update(|r| {
|
||||
r.elapsed = start.elapsed().as_millis() as i32;
|
||||
r.content_length = Some(written_bytes as i32);
|
||||
})?;
|
||||
last_update_time = now;
|
||||
}
|
||||
// Update response in DB with progress
|
||||
let mut r = response.lock().await;
|
||||
r.elapsed = start.elapsed().as_millis() as i32; // Approx until the end
|
||||
r.content_length = Some(written_bytes as i32);
|
||||
app_handle.db().update_http_response_if_id(&r, &update_source)?;
|
||||
}
|
||||
Err(e) => {
|
||||
return Err(GenericError(format!("Failed to read response body: {}", e)));
|
||||
@@ -520,108 +390,17 @@ async fn execute_transaction<R: Runtime>(
|
||||
}
|
||||
}
|
||||
|
||||
// Final update with closed state and accurate byte count
|
||||
response_ctx.update(|r| {
|
||||
r.elapsed = start.elapsed().as_millis() as i32;
|
||||
r.content_length = Some(written_bytes as i32);
|
||||
r.state = HttpResponseState::Closed;
|
||||
})?;
|
||||
// Final update with closed state
|
||||
let mut resp = response.lock().await.clone();
|
||||
resp.elapsed = start.elapsed().as_millis() as i32;
|
||||
resp.state = HttpResponseState::Closed;
|
||||
resp.body_path = Some(
|
||||
body_path.to_str().ok_or(GenericError(format!("Invalid path {body_path:?}",)))?.to_string(),
|
||||
);
|
||||
|
||||
Ok((response_ctx.response().clone(), maybe_blob_write_handle))
|
||||
}
|
||||
app_handle.db().update_http_response_if_id(&resp, &update_source)?;
|
||||
|
||||
fn write_bytes_to_db_sync<R: Runtime>(
|
||||
response_ctx: &mut ResponseContext<R>,
|
||||
body_id: &str,
|
||||
data: Bytes,
|
||||
) -> Result<()> {
|
||||
if data.is_empty() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
// Write in chunks if data is large
|
||||
let mut offset = 0;
|
||||
let mut chunk_index = 0;
|
||||
while offset < data.len() {
|
||||
let end = std::cmp::min(offset + REQUEST_BODY_CHUNK_SIZE, data.len());
|
||||
let chunk_data = data.slice(offset..end).to_vec();
|
||||
let chunk = BodyChunk::new(body_id, chunk_index, chunk_data);
|
||||
response_ctx.app_handle.blobs().insert_chunk(&chunk)?;
|
||||
offset = end;
|
||||
chunk_index += 1;
|
||||
}
|
||||
|
||||
// Update the response with the total request body size
|
||||
response_ctx.update(|r| {
|
||||
r.request_content_length = Some(data.len() as i32);
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn write_stream_chunks_to_db<R: Runtime>(
|
||||
app_handle: AppHandle<R>,
|
||||
body_id: &str,
|
||||
workspace_id: &str,
|
||||
response_id: &str,
|
||||
update_source: &UpdateSource,
|
||||
mut rx: tokio::sync::mpsc::UnboundedReceiver<Vec<u8>>,
|
||||
) -> Result<()> {
|
||||
let mut buffer = Vec::with_capacity(REQUEST_BODY_CHUNK_SIZE);
|
||||
let mut chunk_index = 0;
|
||||
let mut total_bytes: usize = 0;
|
||||
|
||||
while let Some(data) = rx.recv().await {
|
||||
total_bytes += data.len();
|
||||
buffer.extend_from_slice(&data);
|
||||
|
||||
// Flush when buffer reaches chunk size
|
||||
while buffer.len() >= REQUEST_BODY_CHUNK_SIZE {
|
||||
debug!("Writing chunk {chunk_index} to DB");
|
||||
let chunk_data: Vec<u8> = buffer.drain(..REQUEST_BODY_CHUNK_SIZE).collect();
|
||||
let chunk = BodyChunk::new(body_id, chunk_index, chunk_data);
|
||||
app_handle.blobs().insert_chunk(&chunk)?;
|
||||
app_handle.db().upsert_http_response_event(
|
||||
&HttpResponseEvent::new(
|
||||
response_id,
|
||||
workspace_id,
|
||||
yaak_http::sender::HttpResponseEvent::ChunkSent {
|
||||
bytes: REQUEST_BODY_CHUNK_SIZE,
|
||||
}
|
||||
.into(),
|
||||
),
|
||||
update_source,
|
||||
)?;
|
||||
chunk_index += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Flush remaining data
|
||||
if !buffer.is_empty() {
|
||||
let chunk = BodyChunk::new(body_id, chunk_index, buffer);
|
||||
debug!("Flushing remaining data {chunk_index} {}", chunk.data.len());
|
||||
app_handle.blobs().insert_chunk(&chunk)?;
|
||||
app_handle.db().upsert_http_response_event(
|
||||
&HttpResponseEvent::new(
|
||||
response_id,
|
||||
workspace_id,
|
||||
yaak_http::sender::HttpResponseEvent::ChunkSent { bytes: chunk.data.len() }.into(),
|
||||
),
|
||||
update_source,
|
||||
)?;
|
||||
}
|
||||
|
||||
// Update the response with the total request body size
|
||||
app_handle.with_tx(|tx| {
|
||||
debug!("Updating final body length {total_bytes}");
|
||||
if let Ok(mut response) = tx.get_http_response(&response_id) {
|
||||
response.request_content_length = Some(total_bytes as i32);
|
||||
tx.update_http_response_if_id(&response, update_source)?;
|
||||
}
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
Ok(())
|
||||
Ok(resp)
|
||||
}
|
||||
|
||||
async fn apply_authentication<R: Runtime>(
|
||||
|
||||
@@ -32,7 +32,6 @@ use yaak_common::window::WorkspaceWindowTrait;
|
||||
use yaak_grpc::manager::GrpcHandle;
|
||||
use yaak_grpc::{Code, ServiceDefinition, serialize_message};
|
||||
use yaak_mac_window::AppHandleMacWindowExt;
|
||||
use yaak_models::blob_manager::BlobManagerExt;
|
||||
use yaak_models::models::{
|
||||
AnyModel, CookieJar, Environment, GrpcConnection, GrpcConnectionState, GrpcEvent,
|
||||
GrpcEventType, GrpcRequest, HttpRequest, HttpResponse, HttpResponseEvent, HttpResponseState,
|
||||
@@ -41,15 +40,12 @@ use yaak_models::models::{
|
||||
use yaak_models::query_manager::QueryManagerExt;
|
||||
use yaak_models::util::{BatchUpsertResult, UpdateSource, get_workspace_export_resources};
|
||||
use yaak_plugins::events::{
|
||||
CallFolderActionArgs, CallFolderActionRequest, CallGrpcRequestActionArgs,
|
||||
CallGrpcRequestActionRequest, CallHttpRequestActionArgs, CallHttpRequestActionRequest,
|
||||
CallWebsocketRequestActionArgs, CallWebsocketRequestActionRequest, CallWorkspaceActionArgs,
|
||||
CallWorkspaceActionRequest, Color, FilterResponse, GetFolderActionsResponse,
|
||||
GetGrpcRequestActionsResponse, GetHttpAuthenticationConfigResponse,
|
||||
GetHttpAuthenticationSummaryResponse, GetHttpRequestActionsResponse,
|
||||
GetTemplateFunctionConfigResponse, GetTemplateFunctionSummaryResponse,
|
||||
GetWebsocketRequestActionsResponse, GetWorkspaceActionsResponse, InternalEvent,
|
||||
InternalEventPayload, JsonPrimitive, PluginContext, RenderPurpose, ShowToastRequest,
|
||||
CallGrpcRequestActionArgs, CallGrpcRequestActionRequest, CallHttpRequestActionArgs,
|
||||
CallHttpRequestActionRequest, Color, FilterResponse, GetGrpcRequestActionsResponse,
|
||||
GetHttpAuthenticationConfigResponse, GetHttpAuthenticationSummaryResponse,
|
||||
GetHttpRequestActionsResponse, GetTemplateFunctionConfigResponse,
|
||||
GetTemplateFunctionSummaryResponse, InternalEvent, InternalEventPayload, JsonPrimitive,
|
||||
PluginContext, RenderPurpose, ShowToastRequest,
|
||||
};
|
||||
use yaak_plugins::manager::PluginManager;
|
||||
use yaak_plugins::plugin_meta::PluginMetadata;
|
||||
@@ -788,7 +784,7 @@ async fn cmd_http_response_body<R: Runtime>(
|
||||
) -> YaakResult<FilterResponse> {
|
||||
let body_path = match response.body_path {
|
||||
None => {
|
||||
return Ok(FilterResponse { content: String::new(), error: None });
|
||||
return Err(GenericError("Response body path not set".to_string()));
|
||||
}
|
||||
Some(p) => p,
|
||||
};
|
||||
@@ -813,23 +809,6 @@ async fn cmd_http_response_body<R: Runtime>(
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn cmd_http_request_body<R: Runtime>(
|
||||
app_handle: AppHandle<R>,
|
||||
response_id: &str,
|
||||
) -> YaakResult<Option<Vec<u8>>> {
|
||||
let body_id = format!("{}.request", response_id);
|
||||
let chunks = app_handle.blobs().get_chunks(&body_id)?;
|
||||
|
||||
if chunks.is_empty() {
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
// Concatenate all chunks
|
||||
let body: Vec<u8> = chunks.into_iter().flat_map(|c| c.data).collect();
|
||||
Ok(Some(body))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn cmd_get_sse_events(file_path: &str) -> YaakResult<Vec<ServerSentEvent>> {
|
||||
let body = fs::read(file_path)?;
|
||||
@@ -856,7 +835,9 @@ async fn cmd_get_http_response_events<R: Runtime>(
|
||||
app_handle: AppHandle<R>,
|
||||
response_id: &str,
|
||||
) -> YaakResult<Vec<HttpResponseEvent>> {
|
||||
let events: Vec<HttpResponseEvent> = app_handle.db().list_http_response_events(response_id)?;
|
||||
use yaak_models::models::HttpResponseEventIden;
|
||||
let events: Vec<HttpResponseEvent> =
|
||||
app_handle.db().find_many(HttpResponseEventIden::ResponseId, response_id, None)?;
|
||||
Ok(events)
|
||||
}
|
||||
|
||||
@@ -876,78 +857,6 @@ async fn cmd_http_request_actions<R: Runtime>(
|
||||
Ok(plugin_manager.get_http_request_actions(&window).await?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn cmd_websocket_request_actions<R: Runtime>(
|
||||
window: WebviewWindow<R>,
|
||||
plugin_manager: State<'_, PluginManager>,
|
||||
) -> YaakResult<Vec<GetWebsocketRequestActionsResponse>> {
|
||||
Ok(plugin_manager.get_websocket_request_actions(&window).await?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn cmd_call_websocket_request_action<R: Runtime>(
|
||||
window: WebviewWindow<R>,
|
||||
req: CallWebsocketRequestActionRequest,
|
||||
plugin_manager: State<'_, PluginManager>,
|
||||
) -> YaakResult<()> {
|
||||
let websocket_request = window.db().get_websocket_request(&req.args.websocket_request.id)?;
|
||||
Ok(plugin_manager
|
||||
.call_websocket_request_action(
|
||||
&window,
|
||||
CallWebsocketRequestActionRequest {
|
||||
args: CallWebsocketRequestActionArgs { websocket_request },
|
||||
..req
|
||||
},
|
||||
)
|
||||
.await?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn cmd_workspace_actions<R: Runtime>(
|
||||
window: WebviewWindow<R>,
|
||||
plugin_manager: State<'_, PluginManager>,
|
||||
) -> YaakResult<Vec<GetWorkspaceActionsResponse>> {
|
||||
Ok(plugin_manager.get_workspace_actions(&window).await?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn cmd_call_workspace_action<R: Runtime>(
|
||||
window: WebviewWindow<R>,
|
||||
req: CallWorkspaceActionRequest,
|
||||
plugin_manager: State<'_, PluginManager>,
|
||||
) -> YaakResult<()> {
|
||||
let workspace = window.db().get_workspace(&req.args.workspace.id)?;
|
||||
Ok(plugin_manager
|
||||
.call_workspace_action(
|
||||
&window,
|
||||
CallWorkspaceActionRequest { args: CallWorkspaceActionArgs { workspace }, ..req },
|
||||
)
|
||||
.await?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn cmd_folder_actions<R: Runtime>(
|
||||
window: WebviewWindow<R>,
|
||||
plugin_manager: State<'_, PluginManager>,
|
||||
) -> YaakResult<Vec<GetFolderActionsResponse>> {
|
||||
Ok(plugin_manager.get_folder_actions(&window).await?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn cmd_call_folder_action<R: Runtime>(
|
||||
window: WebviewWindow<R>,
|
||||
req: CallFolderActionRequest,
|
||||
plugin_manager: State<'_, PluginManager>,
|
||||
) -> YaakResult<()> {
|
||||
let folder = window.db().get_folder(&req.args.folder.id)?;
|
||||
Ok(plugin_manager
|
||||
.call_folder_action(
|
||||
&window,
|
||||
CallFolderActionRequest { args: CallFolderActionArgs { folder }, ..req },
|
||||
)
|
||||
.await?)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn cmd_grpc_request_actions<R: Runtime>(
|
||||
window: WebviewWindow<R>,
|
||||
@@ -1206,7 +1115,6 @@ async fn cmd_send_http_request<R: Runtime>(
|
||||
// that has not yet been saved in the DB.
|
||||
request: HttpRequest,
|
||||
) -> YaakResult<HttpResponse> {
|
||||
let blobs = app_handle.blob_manager();
|
||||
let response = app_handle.db().upsert_http_response(
|
||||
&HttpResponse {
|
||||
request_id: request.id.clone(),
|
||||
@@ -1214,7 +1122,6 @@ async fn cmd_send_http_request<R: Runtime>(
|
||||
..Default::default()
|
||||
},
|
||||
&UpdateSource::from_window(&window),
|
||||
&blobs,
|
||||
)?;
|
||||
|
||||
let (cancel_tx, mut cancel_rx) = tokio::sync::watch::channel(false);
|
||||
@@ -1260,7 +1167,6 @@ async fn cmd_send_http_request<R: Runtime>(
|
||||
..resp
|
||||
},
|
||||
&UpdateSource::from_window(&window),
|
||||
&blobs,
|
||||
)?
|
||||
}
|
||||
};
|
||||
@@ -1268,6 +1174,23 @@ async fn cmd_send_http_request<R: Runtime>(
|
||||
Ok(r)
|
||||
}
|
||||
|
||||
fn response_err<R: Runtime>(
|
||||
app_handle: &AppHandle<R>,
|
||||
response: &HttpResponse,
|
||||
error: String,
|
||||
update_source: &UpdateSource,
|
||||
) -> HttpResponse {
|
||||
warn!("Failed to send request: {error:?}");
|
||||
let mut response = response.clone();
|
||||
response.state = HttpResponseState::Closed;
|
||||
response.error = Some(error.clone());
|
||||
response = app_handle
|
||||
.db()
|
||||
.update_http_response_if_id(&response, update_source)
|
||||
.expect("Failed to update response");
|
||||
response
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
async fn cmd_install_plugin<R: Runtime>(
|
||||
directory: &str,
|
||||
@@ -1536,9 +1459,6 @@ pub fn run() {
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
cmd_call_http_authentication_action,
|
||||
cmd_call_http_request_action,
|
||||
cmd_call_websocket_request_action,
|
||||
cmd_call_workspace_action,
|
||||
cmd_call_folder_action,
|
||||
cmd_call_grpc_request_action,
|
||||
cmd_check_for_updates,
|
||||
cmd_create_grpc_request,
|
||||
@@ -1548,7 +1468,6 @@ pub fn run() {
|
||||
cmd_delete_send_history,
|
||||
cmd_dismiss_notification,
|
||||
cmd_export_data,
|
||||
cmd_http_request_body,
|
||||
cmd_http_response_body,
|
||||
cmd_format_json,
|
||||
cmd_get_http_authentication_summaries,
|
||||
@@ -1560,9 +1479,6 @@ pub fn run() {
|
||||
cmd_grpc_reflect,
|
||||
cmd_grpc_request_actions,
|
||||
cmd_http_request_actions,
|
||||
cmd_websocket_request_actions,
|
||||
cmd_workspace_actions,
|
||||
cmd_folder_actions,
|
||||
cmd_import_data,
|
||||
cmd_install_plugin,
|
||||
cmd_metadata,
|
||||
|
||||
@@ -12,8 +12,7 @@ use log::error;
|
||||
use tauri::{AppHandle, Emitter, Manager, Runtime};
|
||||
use tauri_plugin_clipboard_manager::ClipboardExt;
|
||||
use yaak_common::window::WorkspaceWindowTrait;
|
||||
use yaak_models::blob_manager::BlobManagerExt;
|
||||
use yaak_models::models::{AnyModel, HttpResponse, Plugin};
|
||||
use yaak_models::models::{HttpResponse, Plugin};
|
||||
use yaak_models::queries::any_request::AnyRequest;
|
||||
use yaak_models::query_manager::QueryManagerExt;
|
||||
use yaak_models::util::UpdateSource;
|
||||
@@ -21,10 +20,9 @@ use yaak_plugins::error::Error::PluginErr;
|
||||
use yaak_plugins::events::{
|
||||
Color, DeleteKeyValueResponse, EmptyPayload, ErrorResponse, FindHttpResponsesResponse,
|
||||
GetCookieValueResponse, GetHttpRequestByIdResponse, GetKeyValueResponse, Icon, InternalEvent,
|
||||
InternalEventPayload, ListCookieNamesResponse, ListHttpRequestsResponse, ListWorkspacesResponse,
|
||||
RenderGrpcRequestResponse, RenderHttpRequestResponse, SendHttpRequestResponse,
|
||||
SetKeyValueResponse, ShowToastRequest, TemplateRenderResponse, WindowInfoResponse,
|
||||
WindowNavigateEvent, WorkspaceInfo,
|
||||
InternalEventPayload, ListCookieNamesResponse, RenderGrpcRequestResponse,
|
||||
RenderHttpRequestResponse, SendHttpRequestResponse, SetKeyValueResponse, ShowToastRequest,
|
||||
TemplateRenderResponse, WindowInfoResponse, WindowNavigateEvent,
|
||||
};
|
||||
use yaak_plugins::plugin_handle::PluginHandle;
|
||||
use yaak_plugins::template_callback::PluginTemplateCallback;
|
||||
@@ -62,95 +60,6 @@ pub(crate) async fn handle_plugin_event<R: Runtime>(
|
||||
http_responses,
|
||||
})))
|
||||
}
|
||||
InternalEventPayload::ListHttpRequestsRequest(req) => {
|
||||
let w = get_window_from_plugin_context(app_handle, &plugin_context)?;
|
||||
let workspace = workspace_from_window(&w)
|
||||
.ok_or(PluginErr("Failed to get workspace from window".into()))?;
|
||||
|
||||
let http_requests = if let Some(folder_id) = req.folder_id {
|
||||
app_handle.db().list_http_requests_for_folder_recursive(&folder_id)?
|
||||
} else {
|
||||
app_handle.db().list_http_requests(&workspace.id)?
|
||||
};
|
||||
|
||||
Ok(Some(InternalEventPayload::ListHttpRequestsResponse(ListHttpRequestsResponse {
|
||||
http_requests,
|
||||
})))
|
||||
}
|
||||
InternalEventPayload::ListFoldersRequest(_req) => {
|
||||
let w = get_window_from_plugin_context(app_handle, &plugin_context)?;
|
||||
let workspace = workspace_from_window(&w)
|
||||
.ok_or(PluginErr("Failed to get workspace from window".into()))?;
|
||||
let folders = app_handle.db().list_folders(&workspace.id)?;
|
||||
|
||||
Ok(Some(InternalEventPayload::ListFoldersResponse(
|
||||
yaak_plugins::events::ListFoldersResponse { folders },
|
||||
)))
|
||||
}
|
||||
InternalEventPayload::UpsertModelRequest(req) => {
|
||||
use AnyModel::*;
|
||||
let model = match &req.model {
|
||||
HttpRequest(m) => {
|
||||
HttpRequest(app_handle.db().upsert_http_request(m, &UpdateSource::Plugin)?)
|
||||
}
|
||||
GrpcRequest(m) => {
|
||||
GrpcRequest(app_handle.db().upsert_grpc_request(m, &UpdateSource::Plugin)?)
|
||||
}
|
||||
WebsocketRequest(m) => WebsocketRequest(
|
||||
app_handle.db().upsert_websocket_request(m, &UpdateSource::Plugin)?,
|
||||
),
|
||||
Folder(m) => Folder(app_handle.db().upsert_folder(m, &UpdateSource::Plugin)?),
|
||||
Environment(m) => {
|
||||
Environment(app_handle.db().upsert_environment(m, &UpdateSource::Plugin)?)
|
||||
}
|
||||
Workspace(m) => {
|
||||
Workspace(app_handle.db().upsert_workspace(m, &UpdateSource::Plugin)?)
|
||||
}
|
||||
_ => {
|
||||
return Err(PluginErr("Upsert not supported for this model type".into()).into())
|
||||
}
|
||||
};
|
||||
|
||||
Ok(Some(InternalEventPayload::UpsertModelResponse(
|
||||
yaak_plugins::events::UpsertModelResponse { model },
|
||||
)))
|
||||
}
|
||||
InternalEventPayload::DeleteModelRequest(req) => {
|
||||
let model = match req.model.as_str() {
|
||||
"http_request" => AnyModel::HttpRequest(
|
||||
app_handle
|
||||
.db()
|
||||
.delete_http_request_by_id(&req.id, &UpdateSource::Plugin)?,
|
||||
),
|
||||
"grpc_request" => AnyModel::GrpcRequest(
|
||||
app_handle
|
||||
.db()
|
||||
.delete_grpc_request_by_id(&req.id, &UpdateSource::Plugin)?,
|
||||
),
|
||||
"websocket_request" => AnyModel::WebsocketRequest(
|
||||
app_handle
|
||||
.db()
|
||||
.delete_websocket_request_by_id(&req.id, &UpdateSource::Plugin)?,
|
||||
),
|
||||
"folder" => AnyModel::Folder(
|
||||
app_handle
|
||||
.db()
|
||||
.delete_folder_by_id(&req.id, &UpdateSource::Plugin)?,
|
||||
),
|
||||
"environment" => AnyModel::Environment(
|
||||
app_handle
|
||||
.db()
|
||||
.delete_environment_by_id(&req.id, &UpdateSource::Plugin)?,
|
||||
),
|
||||
_ => {
|
||||
return Err(PluginErr("Delete not supported for this model type".into()).into())
|
||||
}
|
||||
};
|
||||
|
||||
Ok(Some(InternalEventPayload::DeleteModelResponse(
|
||||
yaak_plugins::events::DeleteModelResponse { model },
|
||||
)))
|
||||
}
|
||||
InternalEventPayload::GetHttpRequestByIdRequest(req) => {
|
||||
let http_request = app_handle.db().get_http_request(&req.id).ok();
|
||||
Ok(Some(InternalEventPayload::GetHttpRequestByIdResponse(GetHttpRequestByIdResponse {
|
||||
@@ -285,7 +194,6 @@ pub(crate) async fn handle_plugin_event<R: Runtime>(
|
||||
let http_response = if http_request.id.is_empty() {
|
||||
HttpResponse::default()
|
||||
} else {
|
||||
let blobs = window.blob_manager();
|
||||
window.db().upsert_http_response(
|
||||
&HttpResponse {
|
||||
request_id: http_request.id.clone(),
|
||||
@@ -293,7 +201,6 @@ pub(crate) async fn handle_plugin_event<R: Runtime>(
|
||||
..Default::default()
|
||||
},
|
||||
&UpdateSource::Plugin,
|
||||
&blobs,
|
||||
)?
|
||||
};
|
||||
|
||||
@@ -445,25 +352,6 @@ pub(crate) async fn handle_plugin_event<R: Runtime>(
|
||||
environment_id,
|
||||
})))
|
||||
}
|
||||
|
||||
InternalEventPayload::ListWorkspacesRequest(_) => {
|
||||
let mut workspaces = Vec::new();
|
||||
|
||||
for (_, window) in app_handle.webview_windows() {
|
||||
if let Some(workspace) = workspace_from_window(&window) {
|
||||
workspaces.push(WorkspaceInfo {
|
||||
id: workspace.id.clone(),
|
||||
name: workspace.name.clone(),
|
||||
label: window.label().to_string(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Ok(Some(InternalEventPayload::ListWorkspacesResponse(ListWorkspacesResponse {
|
||||
workspaces,
|
||||
})))
|
||||
}
|
||||
|
||||
_ => Ok(None),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,16 +9,15 @@ async-compression = { version = "0.4", features = ["tokio", "gzip", "deflate", "
|
||||
async-trait = "0.1"
|
||||
brotli = "7"
|
||||
bytes = "1.5.0"
|
||||
cookie = "0.18.1"
|
||||
flate2 = "1"
|
||||
futures-util = "0.3"
|
||||
url = "2"
|
||||
zstd = "0.13"
|
||||
hyper-util = { version = "0.1.17", default-features = false, features = ["client-legacy"] }
|
||||
log = { workspace = true }
|
||||
mime_guess = "2.0.5"
|
||||
regex = "1.11.1"
|
||||
reqwest = { workspace = true, features = ["rustls-tls-manual-roots-no-provider", "socks", "http2", "stream"] }
|
||||
reqwest = { workspace = true, features = ["cookies", "rustls-tls-manual-roots-no-provider", "socks", "http2", "stream"] }
|
||||
reqwest_cookie_store = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true }
|
||||
tauri = { workspace = true }
|
||||
|
||||
@@ -2,6 +2,8 @@ use crate::dns::LocalhostResolver;
|
||||
use crate::error::Result;
|
||||
use log::{debug, info, warn};
|
||||
use reqwest::{Client, Proxy, redirect};
|
||||
use reqwest_cookie_store::CookieStoreMutex;
|
||||
use std::sync::Arc;
|
||||
use yaak_tls::{ClientCertificateConfig, get_tls_config};
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -27,6 +29,7 @@ pub struct HttpConnectionOptions {
|
||||
pub id: String,
|
||||
pub validate_certificates: bool,
|
||||
pub proxy: HttpConnectionProxySetting,
|
||||
pub cookie_provider: Option<Arc<CookieStoreMutex>>,
|
||||
pub client_certificate: Option<ClientCertificateConfig>,
|
||||
}
|
||||
|
||||
@@ -50,6 +53,11 @@ impl HttpConnectionOptions {
|
||||
// Configure DNS resolver
|
||||
client = client.dns_resolver(LocalhostResolver::new());
|
||||
|
||||
// Configure cookie provider
|
||||
if let Some(p) = &self.cookie_provider {
|
||||
client = client.cookie_provider(Arc::clone(&p));
|
||||
}
|
||||
|
||||
// Configure proxy
|
||||
match self.proxy.clone() {
|
||||
HttpConnectionProxySetting::System => { /* Default */ }
|
||||
|
||||
@@ -1,484 +0,0 @@
|
||||
//! Custom cookie handling for HTTP requests
|
||||
//!
|
||||
//! This module provides cookie storage and matching functionality that was previously
|
||||
//! delegated to reqwest. It implements RFC 6265 cookie domain and path matching.
|
||||
|
||||
use log::debug;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
||||
use url::Url;
|
||||
use yaak_models::models::{Cookie, CookieDomain, CookieExpires};
|
||||
|
||||
/// A thread-safe cookie store that can be shared across requests
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CookieStore {
|
||||
cookies: Arc<Mutex<Vec<Cookie>>>,
|
||||
}
|
||||
|
||||
impl Default for CookieStore {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl CookieStore {
|
||||
/// Create a new empty cookie store
|
||||
pub fn new() -> Self {
|
||||
Self { cookies: Arc::new(Mutex::new(Vec::new())) }
|
||||
}
|
||||
|
||||
/// Create a cookie store from existing cookies
|
||||
pub fn from_cookies(cookies: Vec<Cookie>) -> Self {
|
||||
Self { cookies: Arc::new(Mutex::new(cookies)) }
|
||||
}
|
||||
|
||||
/// Get all cookies (for persistence)
|
||||
pub fn get_all_cookies(&self) -> Vec<Cookie> {
|
||||
self.cookies.lock().unwrap().clone()
|
||||
}
|
||||
|
||||
/// Get the Cookie header value for the given URL
|
||||
pub fn get_cookie_header(&self, url: &Url) -> Option<String> {
|
||||
let cookies = self.cookies.lock().unwrap();
|
||||
let now = SystemTime::now();
|
||||
|
||||
let matching_cookies: Vec<_> = cookies
|
||||
.iter()
|
||||
.filter(|cookie| self.cookie_matches(cookie, url, &now))
|
||||
.filter_map(|cookie| {
|
||||
// Parse the raw cookie to get name=value
|
||||
parse_cookie_name_value(&cookie.raw_cookie)
|
||||
})
|
||||
.collect();
|
||||
|
||||
if matching_cookies.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(
|
||||
matching_cookies
|
||||
.into_iter()
|
||||
.map(|(name, value)| format!("{}={}", name, value))
|
||||
.collect::<Vec<_>>()
|
||||
.join("; "),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse Set-Cookie headers and add cookies to the store
|
||||
pub fn store_cookies_from_response(&self, url: &Url, set_cookie_headers: &[String]) {
|
||||
let mut cookies = self.cookies.lock().unwrap();
|
||||
|
||||
for header_value in set_cookie_headers {
|
||||
if let Some(cookie) = parse_set_cookie(header_value, url) {
|
||||
// Remove any existing cookie with the same name and domain
|
||||
cookies.retain(|existing| !cookies_match(existing, &cookie));
|
||||
debug!(
|
||||
"Storing cookie: {} for domain {:?}",
|
||||
parse_cookie_name_value(&cookie.raw_cookie)
|
||||
.map(|(n, _)| n)
|
||||
.unwrap_or_else(|| "unknown".to_string()),
|
||||
cookie.domain
|
||||
);
|
||||
cookies.push(cookie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if a cookie matches the given URL
|
||||
fn cookie_matches(&self, cookie: &Cookie, url: &Url, now: &SystemTime) -> bool {
|
||||
// Check expiration
|
||||
if let CookieExpires::AtUtc(expiry_str) = &cookie.expires {
|
||||
if let Ok(expiry) = parse_cookie_date(expiry_str) {
|
||||
if expiry < *now {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check domain
|
||||
let url_host = match url.host_str() {
|
||||
Some(h) => h.to_lowercase(),
|
||||
None => return false,
|
||||
};
|
||||
|
||||
let domain_matches = match &cookie.domain {
|
||||
CookieDomain::HostOnly(domain) => url_host == domain.to_lowercase(),
|
||||
CookieDomain::Suffix(domain) => {
|
||||
let domain_lower = domain.to_lowercase();
|
||||
url_host == domain_lower || url_host.ends_with(&format!(".{}", domain_lower))
|
||||
}
|
||||
// NotPresent and Empty should never occur in practice since we always set domain
|
||||
// when parsing Set-Cookie headers. Treat as non-matching to be safe.
|
||||
CookieDomain::NotPresent | CookieDomain::Empty => false,
|
||||
};
|
||||
|
||||
if !domain_matches {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check path
|
||||
let (cookie_path, _) = &cookie.path;
|
||||
let url_path = url.path();
|
||||
|
||||
path_matches(url_path, cookie_path)
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse name=value from a cookie string (raw_cookie format)
|
||||
fn parse_cookie_name_value(raw_cookie: &str) -> Option<(String, String)> {
|
||||
// The raw_cookie typically looks like "name=value" or "name=value; attr1; attr2=..."
|
||||
let first_part = raw_cookie.split(';').next()?;
|
||||
let mut parts = first_part.splitn(2, '=');
|
||||
let name = parts.next()?.trim().to_string();
|
||||
let value = parts.next().unwrap_or("").trim().to_string();
|
||||
|
||||
if name.is_empty() { None } else { Some((name, value)) }
|
||||
}
|
||||
|
||||
/// Parse a Set-Cookie header into a Cookie
|
||||
fn parse_set_cookie(header_value: &str, request_url: &Url) -> Option<Cookie> {
|
||||
let parsed = cookie::Cookie::parse(header_value).ok()?;
|
||||
|
||||
let raw_cookie = format!("{}={}", parsed.name(), parsed.value());
|
||||
|
||||
// Determine domain
|
||||
let domain = if let Some(domain_attr) = parsed.domain() {
|
||||
// Domain attribute present - this is a suffix match
|
||||
let domain = domain_attr.trim_start_matches('.').to_lowercase();
|
||||
|
||||
// Reject single-component domains (TLDs) except localhost
|
||||
if is_single_component_domain(&domain) && !is_localhost(&domain) {
|
||||
debug!("Rejecting cookie with single-component domain: {}", domain);
|
||||
return None;
|
||||
}
|
||||
|
||||
CookieDomain::Suffix(domain)
|
||||
} else {
|
||||
// No domain attribute - host-only cookie
|
||||
CookieDomain::HostOnly(request_url.host_str().unwrap_or("").to_lowercase())
|
||||
};
|
||||
|
||||
// Determine expiration
|
||||
let expires = if let Some(max_age) = parsed.max_age() {
|
||||
let duration = Duration::from_secs(max_age.whole_seconds().max(0) as u64);
|
||||
let expiry = SystemTime::now() + duration;
|
||||
let expiry_secs = expiry.duration_since(UNIX_EPOCH).unwrap_or_default().as_secs();
|
||||
CookieExpires::AtUtc(format!("{}", expiry_secs))
|
||||
} else if let Some(expires_time) = parsed.expires() {
|
||||
match expires_time {
|
||||
cookie::Expiration::DateTime(dt) => {
|
||||
let timestamp = dt.unix_timestamp();
|
||||
CookieExpires::AtUtc(format!("{}", timestamp))
|
||||
}
|
||||
cookie::Expiration::Session => CookieExpires::SessionEnd,
|
||||
}
|
||||
} else {
|
||||
CookieExpires::SessionEnd
|
||||
};
|
||||
|
||||
// Determine path
|
||||
let path = if let Some(path_attr) = parsed.path() {
|
||||
(path_attr.to_string(), true)
|
||||
} else {
|
||||
// Default path is the directory of the request URI
|
||||
let default_path = default_cookie_path(request_url.path());
|
||||
(default_path, false)
|
||||
};
|
||||
|
||||
Some(Cookie { raw_cookie, domain, expires, path })
|
||||
}
|
||||
|
||||
/// Get the default cookie path from a request path (RFC 6265 Section 5.1.4)
|
||||
fn default_cookie_path(request_path: &str) -> String {
|
||||
if request_path.is_empty() || !request_path.starts_with('/') {
|
||||
return "/".to_string();
|
||||
}
|
||||
|
||||
// Find the last slash
|
||||
if let Some(last_slash) = request_path.rfind('/') {
|
||||
if last_slash == 0 { "/".to_string() } else { request_path[..last_slash].to_string() }
|
||||
} else {
|
||||
"/".to_string()
|
||||
}
|
||||
}
|
||||
|
||||
/// Check if a request path matches a cookie path (RFC 6265 Section 5.1.4)
|
||||
fn path_matches(request_path: &str, cookie_path: &str) -> bool {
|
||||
if request_path == cookie_path {
|
||||
return true;
|
||||
}
|
||||
|
||||
if request_path.starts_with(cookie_path) {
|
||||
// Cookie path must end with / or the char after cookie_path in request_path must be /
|
||||
if cookie_path.ends_with('/') {
|
||||
return true;
|
||||
}
|
||||
if request_path.chars().nth(cookie_path.len()) == Some('/') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
/// Check if two cookies match (same name and domain)
|
||||
fn cookies_match(a: &Cookie, b: &Cookie) -> bool {
|
||||
let name_a = parse_cookie_name_value(&a.raw_cookie).map(|(n, _)| n);
|
||||
let name_b = parse_cookie_name_value(&b.raw_cookie).map(|(n, _)| n);
|
||||
|
||||
if name_a != name_b {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check domain match
|
||||
match (&a.domain, &b.domain) {
|
||||
(CookieDomain::HostOnly(d1), CookieDomain::HostOnly(d2)) => {
|
||||
d1.to_lowercase() == d2.to_lowercase()
|
||||
}
|
||||
(CookieDomain::Suffix(d1), CookieDomain::Suffix(d2)) => {
|
||||
d1.to_lowercase() == d2.to_lowercase()
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
|
||||
/// Parse a cookie date string (Unix timestamp in our format)
|
||||
fn parse_cookie_date(date_str: &str) -> Result<SystemTime, ()> {
|
||||
let timestamp: i64 = date_str.parse().map_err(|_| ())?;
|
||||
let duration = Duration::from_secs(timestamp.max(0) as u64);
|
||||
Ok(UNIX_EPOCH + duration)
|
||||
}
|
||||
|
||||
/// Check if a domain is a single-component domain (TLD)
|
||||
/// e.g., "com", "org", "net" - domains without any dots
|
||||
fn is_single_component_domain(domain: &str) -> bool {
|
||||
// Empty or only dots
|
||||
let trimmed = domain.trim_matches('.');
|
||||
if trimmed.is_empty() {
|
||||
return true;
|
||||
}
|
||||
// IPv6 addresses use colons, not dots - don't consider them single-component
|
||||
if domain.contains(':') {
|
||||
return false;
|
||||
}
|
||||
!trimmed.contains('.')
|
||||
}
|
||||
|
||||
/// Check if a domain is localhost or a localhost variant
|
||||
fn is_localhost(domain: &str) -> bool {
|
||||
let lower = domain.to_lowercase();
|
||||
lower == "localhost"
|
||||
|| lower.ends_with(".localhost")
|
||||
|| lower == "127.0.0.1"
|
||||
|| lower == "::1"
|
||||
|| lower == "[::1]"
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_parse_cookie_name_value() {
|
||||
assert_eq!(
|
||||
parse_cookie_name_value("session=abc123"),
|
||||
Some(("session".to_string(), "abc123".to_string()))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_cookie_name_value("name=value; Path=/; HttpOnly"),
|
||||
Some(("name".to_string(), "value".to_string()))
|
||||
);
|
||||
assert_eq!(parse_cookie_name_value("empty="), Some(("empty".to_string(), "".to_string())));
|
||||
assert_eq!(parse_cookie_name_value(""), None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_path_matches() {
|
||||
assert!(path_matches("/", "/"));
|
||||
assert!(path_matches("/foo", "/"));
|
||||
assert!(path_matches("/foo/bar", "/foo"));
|
||||
assert!(path_matches("/foo/bar", "/foo/"));
|
||||
assert!(!path_matches("/foobar", "/foo"));
|
||||
assert!(!path_matches("/foo", "/foo/bar"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_default_cookie_path() {
|
||||
assert_eq!(default_cookie_path("/"), "/");
|
||||
assert_eq!(default_cookie_path("/foo"), "/");
|
||||
assert_eq!(default_cookie_path("/foo/bar"), "/foo");
|
||||
assert_eq!(default_cookie_path("/foo/bar/baz"), "/foo/bar");
|
||||
assert_eq!(default_cookie_path(""), "/");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cookie_store_basic() {
|
||||
let store = CookieStore::new();
|
||||
let url = Url::parse("https://example.com/path").unwrap();
|
||||
|
||||
// Initially empty
|
||||
assert!(store.get_cookie_header(&url).is_none());
|
||||
|
||||
// Add a cookie
|
||||
store.store_cookies_from_response(&url, &["session=abc123".to_string()]);
|
||||
|
||||
// Should now have the cookie
|
||||
let header = store.get_cookie_header(&url);
|
||||
assert_eq!(header, Some("session=abc123".to_string()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cookie_domain_matching() {
|
||||
let store = CookieStore::new();
|
||||
let url = Url::parse("https://example.com/").unwrap();
|
||||
|
||||
// Cookie with domain attribute (suffix match)
|
||||
store.store_cookies_from_response(
|
||||
&url,
|
||||
&["domain_cookie=value; Domain=example.com".to_string()],
|
||||
);
|
||||
|
||||
// Should match example.com
|
||||
assert!(store.get_cookie_header(&url).is_some());
|
||||
|
||||
// Should match subdomain
|
||||
let subdomain_url = Url::parse("https://sub.example.com/").unwrap();
|
||||
assert!(store.get_cookie_header(&subdomain_url).is_some());
|
||||
|
||||
// Should not match different domain
|
||||
let other_url = Url::parse("https://other.com/").unwrap();
|
||||
assert!(store.get_cookie_header(&other_url).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cookie_path_matching() {
|
||||
let store = CookieStore::new();
|
||||
let url = Url::parse("https://example.com/api/v1").unwrap();
|
||||
|
||||
// Cookie with path
|
||||
store.store_cookies_from_response(&url, &["api_cookie=value; Path=/api".to_string()]);
|
||||
|
||||
// Should match /api/v1
|
||||
assert!(store.get_cookie_header(&url).is_some());
|
||||
|
||||
// Should match /api
|
||||
let api_url = Url::parse("https://example.com/api").unwrap();
|
||||
assert!(store.get_cookie_header(&api_url).is_some());
|
||||
|
||||
// Should not match /other
|
||||
let other_url = Url::parse("https://example.com/other").unwrap();
|
||||
assert!(store.get_cookie_header(&other_url).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cookie_replacement() {
|
||||
let store = CookieStore::new();
|
||||
let url = Url::parse("https://example.com/").unwrap();
|
||||
|
||||
// Add a cookie
|
||||
store.store_cookies_from_response(&url, &["session=old".to_string()]);
|
||||
assert_eq!(store.get_cookie_header(&url), Some("session=old".to_string()));
|
||||
|
||||
// Replace with new value
|
||||
store.store_cookies_from_response(&url, &["session=new".to_string()]);
|
||||
assert_eq!(store.get_cookie_header(&url), Some("session=new".to_string()));
|
||||
|
||||
// Should only have one cookie
|
||||
assert_eq!(store.get_all_cookies().len(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_single_component_domain() {
|
||||
// Single-component domains (TLDs)
|
||||
assert!(is_single_component_domain("com"));
|
||||
assert!(is_single_component_domain("org"));
|
||||
assert!(is_single_component_domain("net"));
|
||||
assert!(is_single_component_domain("localhost")); // Still single-component, but allowed separately
|
||||
|
||||
// Multi-component domains
|
||||
assert!(!is_single_component_domain("example.com"));
|
||||
assert!(!is_single_component_domain("sub.example.com"));
|
||||
assert!(!is_single_component_domain("co.uk"));
|
||||
|
||||
// Edge cases
|
||||
assert!(is_single_component_domain("")); // Empty is treated as single-component
|
||||
assert!(is_single_component_domain(".")); // Only dots
|
||||
assert!(is_single_component_domain("..")); // Only dots
|
||||
|
||||
// IPv6 addresses (have colons, not dots)
|
||||
assert!(!is_single_component_domain("::1")); // IPv6 localhost
|
||||
assert!(!is_single_component_domain("[::1]")); // Bracketed IPv6
|
||||
assert!(!is_single_component_domain("2001:db8::1")); // IPv6 address
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_localhost() {
|
||||
// Localhost variants
|
||||
assert!(is_localhost("localhost"));
|
||||
assert!(is_localhost("LOCALHOST")); // Case-insensitive
|
||||
assert!(is_localhost("sub.localhost"));
|
||||
assert!(is_localhost("app.sub.localhost"));
|
||||
|
||||
// IP localhost
|
||||
assert!(is_localhost("127.0.0.1"));
|
||||
assert!(is_localhost("::1"));
|
||||
assert!(is_localhost("[::1]"));
|
||||
|
||||
// Not localhost
|
||||
assert!(!is_localhost("example.com"));
|
||||
assert!(!is_localhost("localhost.com")); // .com domain, not localhost
|
||||
assert!(!is_localhost("notlocalhost"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_reject_tld_cookies() {
|
||||
let store = CookieStore::new();
|
||||
let url = Url::parse("https://example.com/").unwrap();
|
||||
|
||||
// Try to set a cookie with Domain=com (TLD)
|
||||
store.store_cookies_from_response(&url, &["bad=cookie; Domain=com".to_string()]);
|
||||
|
||||
// Should be rejected - no cookies stored
|
||||
assert_eq!(store.get_all_cookies().len(), 0);
|
||||
assert!(store.get_cookie_header(&url).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_allow_localhost_cookies() {
|
||||
let store = CookieStore::new();
|
||||
let url = Url::parse("http://localhost:3000/").unwrap();
|
||||
|
||||
// Cookie with Domain=localhost should be allowed
|
||||
store.store_cookies_from_response(&url, &["session=abc; Domain=localhost".to_string()]);
|
||||
|
||||
// Should be accepted
|
||||
assert_eq!(store.get_all_cookies().len(), 1);
|
||||
assert!(store.get_cookie_header(&url).is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_allow_127_0_0_1_cookies() {
|
||||
let store = CookieStore::new();
|
||||
let url = Url::parse("http://127.0.0.1:8080/").unwrap();
|
||||
|
||||
// Cookie without Domain attribute (host-only) should work
|
||||
store.store_cookies_from_response(&url, &["session=xyz".to_string()]);
|
||||
|
||||
// Should be accepted
|
||||
assert_eq!(store.get_all_cookies().len(), 1);
|
||||
assert!(store.get_cookie_header(&url).is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_allow_normal_domain_cookies() {
|
||||
let store = CookieStore::new();
|
||||
let url = Url::parse("https://example.com/").unwrap();
|
||||
|
||||
// Cookie with valid domain should be allowed
|
||||
store.store_cookies_from_response(&url, &["session=abc; Domain=example.com".to_string()]);
|
||||
|
||||
// Should be accepted
|
||||
assert_eq!(store.get_all_cookies().len(), 1);
|
||||
assert!(store.get_cookie_header(&url).is_some());
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ use tauri::{Manager, Runtime};
|
||||
|
||||
mod chained_reader;
|
||||
pub mod client;
|
||||
pub mod cookies;
|
||||
pub mod decompress;
|
||||
pub mod dns;
|
||||
pub mod error;
|
||||
@@ -12,7 +11,6 @@ pub mod manager;
|
||||
pub mod path_placeholders;
|
||||
mod proto;
|
||||
pub mod sender;
|
||||
pub mod tee_reader;
|
||||
pub mod transaction;
|
||||
pub mod types;
|
||||
|
||||
|
||||
@@ -110,12 +110,12 @@ pub struct BodyStats {
|
||||
/// An AsyncRead wrapper that sends chunk events as data is read
|
||||
pub struct TrackingRead<R> {
|
||||
inner: R,
|
||||
event_tx: mpsc::Sender<HttpResponseEvent>,
|
||||
event_tx: mpsc::UnboundedSender<HttpResponseEvent>,
|
||||
ended: bool,
|
||||
}
|
||||
|
||||
impl<R> TrackingRead<R> {
|
||||
pub fn new(inner: R, event_tx: mpsc::Sender<HttpResponseEvent>) -> Self {
|
||||
pub fn new(inner: R, event_tx: mpsc::UnboundedSender<HttpResponseEvent>) -> Self {
|
||||
Self { inner, event_tx, ended: false }
|
||||
}
|
||||
}
|
||||
@@ -131,9 +131,8 @@ impl<R: AsyncRead + Unpin> AsyncRead for TrackingRead<R> {
|
||||
if let Poll::Ready(Ok(())) = &result {
|
||||
let bytes_read = buf.filled().len() - before;
|
||||
if bytes_read > 0 {
|
||||
// Ignore send errors - receiver may have been dropped or channel is full
|
||||
let _ =
|
||||
self.event_tx.try_send(HttpResponseEvent::ChunkReceived { bytes: bytes_read });
|
||||
// Ignore send errors - receiver may have been dropped
|
||||
let _ = self.event_tx.send(HttpResponseEvent::ChunkReceived { bytes: bytes_read });
|
||||
} else if !self.ended {
|
||||
self.ended = true;
|
||||
}
|
||||
@@ -312,7 +311,7 @@ pub trait HttpSender: Send + Sync {
|
||||
async fn send(
|
||||
&self,
|
||||
request: SendableHttpRequest,
|
||||
event_tx: mpsc::Sender<HttpResponseEvent>,
|
||||
event_tx: mpsc::UnboundedSender<HttpResponseEvent>,
|
||||
) -> Result<HttpResponse>;
|
||||
}
|
||||
|
||||
@@ -339,11 +338,11 @@ impl HttpSender for ReqwestSender {
|
||||
async fn send(
|
||||
&self,
|
||||
request: SendableHttpRequest,
|
||||
event_tx: mpsc::Sender<HttpResponseEvent>,
|
||||
event_tx: mpsc::UnboundedSender<HttpResponseEvent>,
|
||||
) -> Result<HttpResponse> {
|
||||
// Helper to send events (ignores errors if receiver is dropped or channel is full)
|
||||
// Helper to send events (ignores errors if receiver is dropped)
|
||||
let send_event = |event: HttpResponseEvent| {
|
||||
let _ = event_tx.try_send(event);
|
||||
let _ = event_tx.send(event);
|
||||
};
|
||||
|
||||
// Parse the HTTP method
|
||||
|
||||
@@ -1,159 +0,0 @@
|
||||
use std::io;
|
||||
use std::pin::Pin;
|
||||
use std::task::{Context, Poll};
|
||||
use tokio::io::{AsyncRead, ReadBuf};
|
||||
use tokio::sync::mpsc;
|
||||
|
||||
/// A reader that forwards all read data to a channel while also returning it to the caller.
|
||||
/// This allows capturing request body data as it's being sent.
|
||||
/// Uses an unbounded channel to ensure all data is captured without blocking the request.
|
||||
pub struct TeeReader<R> {
|
||||
inner: R,
|
||||
tx: mpsc::UnboundedSender<Vec<u8>>,
|
||||
}
|
||||
|
||||
impl<R> TeeReader<R> {
|
||||
pub fn new(inner: R, tx: mpsc::UnboundedSender<Vec<u8>>) -> Self {
|
||||
Self { inner, tx }
|
||||
}
|
||||
}
|
||||
|
||||
impl<R: AsyncRead + Unpin> AsyncRead for TeeReader<R> {
|
||||
fn poll_read(
|
||||
mut self: Pin<&mut Self>,
|
||||
cx: &mut Context<'_>,
|
||||
buf: &mut ReadBuf<'_>,
|
||||
) -> Poll<io::Result<()>> {
|
||||
let before_len = buf.filled().len();
|
||||
|
||||
match Pin::new(&mut self.inner).poll_read(cx, buf) {
|
||||
Poll::Ready(Ok(())) => {
|
||||
let after_len = buf.filled().len();
|
||||
if after_len > before_len {
|
||||
// Data was read, send a copy to the channel
|
||||
let data = buf.filled()[before_len..after_len].to_vec();
|
||||
// Send to unbounded channel - this never blocks
|
||||
// Ignore error if receiver is closed
|
||||
let _ = self.tx.send(data);
|
||||
}
|
||||
Poll::Ready(Ok(()))
|
||||
}
|
||||
Poll::Ready(Err(e)) => Poll::Ready(Err(e)),
|
||||
Poll::Pending => Poll::Pending,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::io::Cursor;
|
||||
use tokio::io::AsyncReadExt;
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_tee_reader_captures_all_data() {
|
||||
let data = b"Hello, World!";
|
||||
let cursor = Cursor::new(data.to_vec());
|
||||
let (tx, mut rx) = mpsc::unbounded_channel();
|
||||
|
||||
let mut tee = TeeReader::new(cursor, tx);
|
||||
let mut output = Vec::new();
|
||||
tee.read_to_end(&mut output).await.unwrap();
|
||||
|
||||
// Verify the reader returns the correct data
|
||||
assert_eq!(output, data);
|
||||
|
||||
// Verify the channel received the data
|
||||
let mut captured = Vec::new();
|
||||
while let Ok(chunk) = rx.try_recv() {
|
||||
captured.extend(chunk);
|
||||
}
|
||||
assert_eq!(captured, data);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_tee_reader_with_chunked_reads() {
|
||||
let data = b"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
let cursor = Cursor::new(data.to_vec());
|
||||
let (tx, mut rx) = mpsc::unbounded_channel();
|
||||
|
||||
let mut tee = TeeReader::new(cursor, tx);
|
||||
|
||||
// Read in small chunks
|
||||
let mut buf = [0u8; 5];
|
||||
let mut output = Vec::new();
|
||||
loop {
|
||||
let n = tee.read(&mut buf).await.unwrap();
|
||||
if n == 0 {
|
||||
break;
|
||||
}
|
||||
output.extend_from_slice(&buf[..n]);
|
||||
}
|
||||
|
||||
// Verify the reader returns the correct data
|
||||
assert_eq!(output, data);
|
||||
|
||||
// Verify the channel received all chunks
|
||||
let mut captured = Vec::new();
|
||||
while let Ok(chunk) = rx.try_recv() {
|
||||
captured.extend(chunk);
|
||||
}
|
||||
assert_eq!(captured, data);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_tee_reader_empty_data() {
|
||||
let data: Vec<u8> = vec![];
|
||||
let cursor = Cursor::new(data.clone());
|
||||
let (tx, mut rx) = mpsc::unbounded_channel();
|
||||
|
||||
let mut tee = TeeReader::new(cursor, tx);
|
||||
let mut output = Vec::new();
|
||||
tee.read_to_end(&mut output).await.unwrap();
|
||||
|
||||
// Verify empty output
|
||||
assert!(output.is_empty());
|
||||
|
||||
// Verify no data was sent to channel
|
||||
assert!(rx.try_recv().is_err());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_tee_reader_works_when_receiver_dropped() {
|
||||
let data = b"Hello, World!";
|
||||
let cursor = Cursor::new(data.to_vec());
|
||||
let (tx, rx) = mpsc::unbounded_channel();
|
||||
|
||||
// Drop the receiver before reading
|
||||
drop(rx);
|
||||
|
||||
let mut tee = TeeReader::new(cursor, tx);
|
||||
let mut output = Vec::new();
|
||||
|
||||
// Should still work even though receiver is dropped
|
||||
tee.read_to_end(&mut output).await.unwrap();
|
||||
assert_eq!(output, data);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_tee_reader_large_data() {
|
||||
// Test with 1MB of data
|
||||
let data: Vec<u8> = (0..1024 * 1024).map(|i| (i % 256) as u8).collect();
|
||||
let cursor = Cursor::new(data.clone());
|
||||
let (tx, mut rx) = mpsc::unbounded_channel();
|
||||
|
||||
let mut tee = TeeReader::new(cursor, tx);
|
||||
let mut output = Vec::new();
|
||||
tee.read_to_end(&mut output).await.unwrap();
|
||||
|
||||
// Verify the reader returns the correct data
|
||||
assert_eq!(output, data);
|
||||
|
||||
// Verify the channel received all data
|
||||
let mut captured = Vec::new();
|
||||
while let Ok(chunk) = rx.try_recv() {
|
||||
captured.extend(chunk);
|
||||
}
|
||||
assert_eq!(captured, data);
|
||||
}
|
||||
}
|
||||
@@ -1,42 +1,24 @@
|
||||
use crate::cookies::CookieStore;
|
||||
use crate::error::Result;
|
||||
use crate::sender::{HttpResponse, HttpResponseEvent, HttpSender, RedirectBehavior};
|
||||
use crate::types::SendableHttpRequest;
|
||||
use log::debug;
|
||||
use tokio::sync::mpsc;
|
||||
use tokio::sync::watch::Receiver;
|
||||
use url::Url;
|
||||
|
||||
/// HTTP Transaction that manages the lifecycle of a request, including redirect handling
|
||||
pub struct HttpTransaction<S: HttpSender> {
|
||||
sender: S,
|
||||
max_redirects: usize,
|
||||
cookie_store: Option<CookieStore>,
|
||||
}
|
||||
|
||||
impl<S: HttpSender> HttpTransaction<S> {
|
||||
/// Create a new transaction with default settings
|
||||
pub fn new(sender: S) -> Self {
|
||||
Self { sender, max_redirects: 10, cookie_store: None }
|
||||
Self { sender, max_redirects: 10 }
|
||||
}
|
||||
|
||||
/// Create a new transaction with custom max redirects
|
||||
pub fn with_max_redirects(sender: S, max_redirects: usize) -> Self {
|
||||
Self { sender, max_redirects, cookie_store: None }
|
||||
}
|
||||
|
||||
/// Create a new transaction with a cookie store
|
||||
pub fn with_cookie_store(sender: S, cookie_store: CookieStore) -> Self {
|
||||
Self { sender, max_redirects: 10, cookie_store: Some(cookie_store) }
|
||||
}
|
||||
|
||||
/// Create a new transaction with custom max redirects and a cookie store
|
||||
pub fn with_options(
|
||||
sender: S,
|
||||
max_redirects: usize,
|
||||
cookie_store: Option<CookieStore>,
|
||||
) -> Self {
|
||||
Self { sender, max_redirects, cookie_store }
|
||||
Self { sender, max_redirects }
|
||||
}
|
||||
|
||||
/// Execute the request with cancellation support.
|
||||
@@ -46,7 +28,7 @@ impl<S: HttpSender> HttpTransaction<S> {
|
||||
&self,
|
||||
request: SendableHttpRequest,
|
||||
mut cancelled_rx: Receiver<bool>,
|
||||
event_tx: mpsc::Sender<HttpResponseEvent>,
|
||||
event_tx: mpsc::UnboundedSender<HttpResponseEvent>,
|
||||
) -> Result<HttpResponse> {
|
||||
let mut redirect_count = 0;
|
||||
let mut current_url = request.url;
|
||||
@@ -54,9 +36,9 @@ impl<S: HttpSender> HttpTransaction<S> {
|
||||
let mut current_headers = request.headers;
|
||||
let mut current_body = request.body;
|
||||
|
||||
// Helper to send events (ignores errors if receiver is dropped or channel is full)
|
||||
// Helper to send events (ignores errors if receiver is dropped)
|
||||
let send_event = |event: HttpResponseEvent| {
|
||||
let _ = event_tx.try_send(event);
|
||||
let _ = event_tx.send(event);
|
||||
};
|
||||
|
||||
loop {
|
||||
@@ -65,32 +47,11 @@ impl<S: HttpSender> HttpTransaction<S> {
|
||||
return Err(crate::error::Error::RequestCanceledError);
|
||||
}
|
||||
|
||||
// Inject cookies into headers if we have a cookie store
|
||||
let headers_with_cookies = if let Some(cookie_store) = &self.cookie_store {
|
||||
let mut headers = current_headers.clone();
|
||||
if let Ok(url) = Url::parse(¤t_url) {
|
||||
if let Some(cookie_header) = cookie_store.get_cookie_header(&url) {
|
||||
debug!("Injecting Cookie header: {}", cookie_header);
|
||||
// Check if there's already a Cookie header and merge if so
|
||||
if let Some(existing) =
|
||||
headers.iter_mut().find(|h| h.0.eq_ignore_ascii_case("cookie"))
|
||||
{
|
||||
existing.1 = format!("{}; {}", existing.1, cookie_header);
|
||||
} else {
|
||||
headers.push(("Cookie".to_string(), cookie_header));
|
||||
}
|
||||
}
|
||||
}
|
||||
headers
|
||||
} else {
|
||||
current_headers.clone()
|
||||
};
|
||||
|
||||
// Build request for this iteration
|
||||
let req = SendableHttpRequest {
|
||||
url: current_url.clone(),
|
||||
method: current_method.clone(),
|
||||
headers: headers_with_cookies,
|
||||
headers: current_headers.clone(),
|
||||
body: current_body,
|
||||
options: request.options.clone(),
|
||||
};
|
||||
@@ -109,23 +70,6 @@ impl<S: HttpSender> HttpTransaction<S> {
|
||||
}
|
||||
};
|
||||
|
||||
// Parse Set-Cookie headers and store cookies
|
||||
if let Some(cookie_store) = &self.cookie_store {
|
||||
if let Ok(url) = Url::parse(¤t_url) {
|
||||
let set_cookie_headers: Vec<String> = response
|
||||
.headers
|
||||
.iter()
|
||||
.filter(|(k, _)| k.eq_ignore_ascii_case("set-cookie"))
|
||||
.map(|(_, v)| v.clone())
|
||||
.collect();
|
||||
|
||||
if !set_cookie_headers.is_empty() {
|
||||
debug!("Storing {} cookies from response", set_cookie_headers.len());
|
||||
cookie_store.store_cookies_from_response(&url, &set_cookie_headers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !Self::is_redirect(response.status) {
|
||||
// Not a redirect - return the response for caller to consume body
|
||||
return Ok(response);
|
||||
@@ -292,7 +236,7 @@ mod tests {
|
||||
async fn send(
|
||||
&self,
|
||||
_request: SendableHttpRequest,
|
||||
_event_tx: mpsc::Sender<HttpResponseEvent>,
|
||||
_event_tx: mpsc::UnboundedSender<HttpResponseEvent>,
|
||||
) -> Result<HttpResponse> {
|
||||
let mut responses = self.responses.lock().await;
|
||||
if responses.is_empty() {
|
||||
@@ -332,7 +276,7 @@ mod tests {
|
||||
};
|
||||
|
||||
let (_tx, rx) = tokio::sync::watch::channel(false);
|
||||
let (event_tx, _event_rx) = mpsc::channel(100);
|
||||
let (event_tx, _event_rx) = mpsc::unbounded_channel();
|
||||
let result = transaction.execute_with_cancellation(request, rx, event_tx).await.unwrap();
|
||||
assert_eq!(result.status, 200);
|
||||
|
||||
@@ -365,7 +309,7 @@ mod tests {
|
||||
};
|
||||
|
||||
let (_tx, rx) = tokio::sync::watch::channel(false);
|
||||
let (event_tx, _event_rx) = mpsc::channel(100);
|
||||
let (event_tx, _event_rx) = mpsc::unbounded_channel();
|
||||
let result = transaction.execute_with_cancellation(request, rx, event_tx).await.unwrap();
|
||||
assert_eq!(result.status, 200);
|
||||
|
||||
@@ -397,7 +341,7 @@ mod tests {
|
||||
};
|
||||
|
||||
let (_tx, rx) = tokio::sync::watch::channel(false);
|
||||
let (event_tx, _event_rx) = mpsc::channel(100);
|
||||
let (event_tx, _event_rx) = mpsc::unbounded_channel();
|
||||
let result = transaction.execute_with_cancellation(request, rx, event_tx).await;
|
||||
if let Err(crate::error::Error::RequestError(msg)) = result {
|
||||
assert!(msg.contains("Maximum redirect limit"));
|
||||
@@ -444,210 +388,4 @@ mod tests {
|
||||
let result = HttpTransaction::<MockSender>::extract_base_path("https://example.com/");
|
||||
assert_eq!(result.unwrap(), "https://example.com");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_cookie_injection() {
|
||||
// Create a mock sender that verifies the Cookie header was injected
|
||||
struct CookieVerifyingSender {
|
||||
expected_cookie: String,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl HttpSender for CookieVerifyingSender {
|
||||
async fn send(
|
||||
&self,
|
||||
request: SendableHttpRequest,
|
||||
_event_tx: mpsc::Sender<HttpResponseEvent>,
|
||||
) -> Result<HttpResponse> {
|
||||
// Verify the Cookie header was injected
|
||||
let cookie_header =
|
||||
request.headers.iter().find(|(k, _)| k.eq_ignore_ascii_case("cookie"));
|
||||
|
||||
assert!(cookie_header.is_some(), "Cookie header should be present");
|
||||
assert!(
|
||||
cookie_header.unwrap().1.contains(&self.expected_cookie),
|
||||
"Cookie header should contain expected value"
|
||||
);
|
||||
|
||||
let body_stream: Pin<Box<dyn AsyncRead + Send>> =
|
||||
Box::pin(std::io::Cursor::new(vec![]));
|
||||
Ok(HttpResponse::new(
|
||||
200,
|
||||
None,
|
||||
HashMap::new(),
|
||||
HashMap::new(),
|
||||
None,
|
||||
"https://example.com".to_string(),
|
||||
None,
|
||||
Some("HTTP/1.1".to_string()),
|
||||
body_stream,
|
||||
ContentEncoding::Identity,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
use yaak_models::models::{Cookie, CookieDomain, CookieExpires};
|
||||
|
||||
// Create a cookie store with a test cookie
|
||||
let cookie = Cookie {
|
||||
raw_cookie: "session=abc123".to_string(),
|
||||
domain: CookieDomain::HostOnly("example.com".to_string()),
|
||||
expires: CookieExpires::SessionEnd,
|
||||
path: ("/".to_string(), false),
|
||||
};
|
||||
let cookie_store = CookieStore::from_cookies(vec![cookie]);
|
||||
|
||||
let sender = CookieVerifyingSender { expected_cookie: "session=abc123".to_string() };
|
||||
let transaction = HttpTransaction::with_cookie_store(sender, cookie_store);
|
||||
|
||||
let request = SendableHttpRequest {
|
||||
url: "https://example.com/api".to_string(),
|
||||
method: "GET".to_string(),
|
||||
headers: vec![],
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let (_tx, rx) = tokio::sync::watch::channel(false);
|
||||
let (event_tx, _event_rx) = mpsc::channel(100);
|
||||
let result = transaction.execute_with_cancellation(request, rx, event_tx).await;
|
||||
assert!(result.is_ok());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_set_cookie_parsing() {
|
||||
// Create a cookie store
|
||||
let cookie_store = CookieStore::new();
|
||||
|
||||
// Mock sender that returns a Set-Cookie header
|
||||
struct SetCookieSender;
|
||||
|
||||
#[async_trait]
|
||||
impl HttpSender for SetCookieSender {
|
||||
async fn send(
|
||||
&self,
|
||||
_request: SendableHttpRequest,
|
||||
_event_tx: mpsc::Sender<HttpResponseEvent>,
|
||||
) -> Result<HttpResponse> {
|
||||
let mut headers = HashMap::new();
|
||||
headers.insert("set-cookie".to_string(), "session=xyz789; Path=/".to_string());
|
||||
|
||||
let body_stream: Pin<Box<dyn AsyncRead + Send>> =
|
||||
Box::pin(std::io::Cursor::new(vec![]));
|
||||
Ok(HttpResponse::new(
|
||||
200,
|
||||
None,
|
||||
headers,
|
||||
HashMap::new(),
|
||||
None,
|
||||
"https://example.com".to_string(),
|
||||
None,
|
||||
Some("HTTP/1.1".to_string()),
|
||||
body_stream,
|
||||
ContentEncoding::Identity,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
let sender = SetCookieSender;
|
||||
let transaction = HttpTransaction::with_cookie_store(sender, cookie_store.clone());
|
||||
|
||||
let request = SendableHttpRequest {
|
||||
url: "https://example.com/login".to_string(),
|
||||
method: "POST".to_string(),
|
||||
headers: vec![],
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let (_tx, rx) = tokio::sync::watch::channel(false);
|
||||
let (event_tx, _event_rx) = mpsc::channel(100);
|
||||
let result = transaction.execute_with_cancellation(request, rx, event_tx).await;
|
||||
assert!(result.is_ok());
|
||||
|
||||
// Verify the cookie was stored
|
||||
let cookies = cookie_store.get_all_cookies();
|
||||
assert_eq!(cookies.len(), 1);
|
||||
assert!(cookies[0].raw_cookie.contains("session=xyz789"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_cookies_across_redirects() {
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
// Create a cookie store
|
||||
let cookie_store = CookieStore::new();
|
||||
|
||||
// Track request count
|
||||
let request_count = Arc::new(AtomicUsize::new(0));
|
||||
let request_count_clone = request_count.clone();
|
||||
|
||||
struct RedirectWithCookiesSender {
|
||||
request_count: Arc<AtomicUsize>,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl HttpSender for RedirectWithCookiesSender {
|
||||
async fn send(
|
||||
&self,
|
||||
request: SendableHttpRequest,
|
||||
_event_tx: mpsc::Sender<HttpResponseEvent>,
|
||||
) -> Result<HttpResponse> {
|
||||
let count = self.request_count.fetch_add(1, Ordering::SeqCst);
|
||||
|
||||
let (status, headers) = if count == 0 {
|
||||
// First request: return redirect with Set-Cookie
|
||||
let mut h = HashMap::new();
|
||||
h.insert("location".to_string(), "https://example.com/final".to_string());
|
||||
h.insert("set-cookie".to_string(), "redirect_cookie=value1".to_string());
|
||||
(302, h)
|
||||
} else {
|
||||
// Second request: verify cookie was sent
|
||||
let cookie_header =
|
||||
request.headers.iter().find(|(k, _)| k.eq_ignore_ascii_case("cookie"));
|
||||
|
||||
assert!(cookie_header.is_some(), "Cookie header should be present on redirect");
|
||||
assert!(
|
||||
cookie_header.unwrap().1.contains("redirect_cookie=value1"),
|
||||
"Redirect cookie should be included"
|
||||
);
|
||||
|
||||
(200, HashMap::new())
|
||||
};
|
||||
|
||||
let body_stream: Pin<Box<dyn AsyncRead + Send>> =
|
||||
Box::pin(std::io::Cursor::new(vec![]));
|
||||
Ok(HttpResponse::new(
|
||||
status,
|
||||
None,
|
||||
headers,
|
||||
HashMap::new(),
|
||||
None,
|
||||
"https://example.com".to_string(),
|
||||
None,
|
||||
Some("HTTP/1.1".to_string()),
|
||||
body_stream,
|
||||
ContentEncoding::Identity,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
let sender = RedirectWithCookiesSender { request_count: request_count_clone };
|
||||
let transaction = HttpTransaction::with_cookie_store(sender, cookie_store);
|
||||
|
||||
let request = SendableHttpRequest {
|
||||
url: "https://example.com/start".to_string(),
|
||||
method: "GET".to_string(),
|
||||
headers: vec![],
|
||||
options: crate::types::SendableHttpRequestOptions {
|
||||
follow_redirects: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let (_tx, rx) = tokio::sync::watch::channel(false);
|
||||
let (event_tx, _event_rx) = mpsc::channel(100);
|
||||
let result = transaction.execute_with_cancellation(request, rx, event_tx).await;
|
||||
assert!(result.is_ok());
|
||||
assert_eq!(request_count.load(Ordering::SeqCst), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,14 +326,8 @@ async fn build_multipart_body(
|
||||
|
||||
if file_path.is_empty() {
|
||||
// Text field
|
||||
let header = if !content_type.is_empty() {
|
||||
format!(
|
||||
"Content-Disposition: form-data; name=\"{}\"\r\nContent-Type: {}\r\n\r\n{}",
|
||||
name, content_type, value
|
||||
)
|
||||
} else {
|
||||
format!("Content-Disposition: form-data; name=\"{}\"\r\n\r\n{}", name, value)
|
||||
};
|
||||
let header =
|
||||
format!("Content-Disposition: form-data; name=\"{}\"\r\n\r\n{}", name, value);
|
||||
let header_bytes = header.into_bytes();
|
||||
total_size += header_bytes.len();
|
||||
readers.push(ReaderType::Bytes(header_bytes));
|
||||
|
||||
@@ -38,7 +38,7 @@ export type HttpRequest = { model: "http_request", id: string, createdAt: string
|
||||
|
||||
export type HttpRequestHeader = { enabled?: boolean, name: string, value: string, id?: string, };
|
||||
|
||||
export type HttpResponse = { model: "http_response", id: string, createdAt: string, updatedAt: string, workspaceId: string, requestId: string, bodyPath: string | null, contentLength: number | null, contentLengthCompressed: number | null, elapsed: number, elapsedHeaders: number, error: string | null, headers: Array<HttpResponseHeader>, remoteAddr: string | null, requestContentLength: number | null, requestHeaders: Array<HttpResponseHeader>, status: number, statusReason: string | null, state: HttpResponseState, url: string, version: string | null, };
|
||||
export type HttpResponse = { model: "http_response", id: string, createdAt: string, updatedAt: string, workspaceId: string, requestId: string, bodyPath: string | null, contentLength: number | null, contentLengthCompressed: number | null, elapsed: number, elapsedHeaders: number, error: string | null, headers: Array<HttpResponseHeader>, remoteAddr: string | null, requestHeaders: Array<HttpResponseHeader>, status: number, statusReason: string | null, state: HttpResponseState, url: string, version: string | null, };
|
||||
|
||||
export type HttpResponseEvent = { model: "http_response_event", id: string, createdAt: string, updatedAt: string, workspaceId: string, responseId: string, event: HttpResponseEventData, };
|
||||
|
||||
@@ -47,7 +47,7 @@ export type HttpResponseEvent = { model: "http_response_event", id: string, crea
|
||||
* This mirrors `yaak_http::sender::HttpResponseEvent` but with serde support.
|
||||
* The `From` impl is in yaak-http to avoid circular dependencies.
|
||||
*/
|
||||
export type HttpResponseEventData = { "type": "setting", name: string, value: string, } | { "type": "info", message: string, } | { "type": "redirect", url: string, status: number, behavior: string, } | { "type": "send_url", method: string, path: string, } | { "type": "receive_url", version: string, status: string, } | { "type": "header_up", name: string, value: string, } | { "type": "header_down", name: string, value: string, } | { "type": "chunk_sent", bytes: number, } | { "type": "chunk_received", bytes: number, };
|
||||
export type HttpResponseEventData = { "type": "start_request" } | { "type": "end_request" } | { "type": "setting", name: string, value: string, } | { "type": "info", message: string, } | { "type": "redirect", url: string, status: number, behavior: string, } | { "type": "send_url", method: string, path: string, } | { "type": "receive_url", version: string, status: string, } | { "type": "header_up", name: string, value: string, } | { "type": "header_down", name: string, value: string, } | { "type": "chunk_sent", bytes: number, } | { "type": "chunk_received", bytes: number, };
|
||||
|
||||
export type HttpResponseHeader = { name: string, value: string, };
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
CREATE TABLE body_chunks
|
||||
(
|
||||
id TEXT PRIMARY KEY,
|
||||
body_id TEXT NOT NULL,
|
||||
chunk_index INTEGER NOT NULL,
|
||||
data BLOB NOT NULL,
|
||||
created_at DATETIME DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')) NOT NULL,
|
||||
|
||||
UNIQUE (body_id, chunk_index)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_body_chunks_body_id ON body_chunks (body_id, chunk_index);
|
||||
@@ -1,2 +0,0 @@
|
||||
ALTER TABLE http_responses
|
||||
ADD COLUMN request_content_length INTEGER;
|
||||
@@ -1,372 +0,0 @@
|
||||
use crate::error::Result;
|
||||
use crate::util::generate_prefixed_id;
|
||||
use include_dir::{Dir, include_dir};
|
||||
use log::{debug, info};
|
||||
use r2d2::Pool;
|
||||
use r2d2_sqlite::SqliteConnectionManager;
|
||||
use rusqlite::{OptionalExtension, params};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use tauri::{Manager, Runtime, State};
|
||||
|
||||
static BLOB_MIGRATIONS_DIR: Dir = include_dir!("$CARGO_MANIFEST_DIR/blob_migrations");
|
||||
|
||||
/// A chunk of body data stored in the blob database.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct BodyChunk {
|
||||
pub id: String,
|
||||
pub body_id: String,
|
||||
pub chunk_index: i32,
|
||||
pub data: Vec<u8>,
|
||||
}
|
||||
|
||||
impl BodyChunk {
|
||||
pub fn new(body_id: impl Into<String>, chunk_index: i32, data: Vec<u8>) -> Self {
|
||||
Self { id: generate_prefixed_id("bc"), body_id: body_id.into(), chunk_index, data }
|
||||
}
|
||||
}
|
||||
|
||||
/// Extension trait for accessing the blob manager from app handle.
|
||||
pub trait BlobManagerExt<'a, R> {
|
||||
fn blob_manager(&'a self) -> State<'a, BlobManager>;
|
||||
fn blobs(&'a self) -> BlobContext;
|
||||
}
|
||||
|
||||
impl<'a, R: Runtime, M: Manager<R>> BlobManagerExt<'a, R> for M {
|
||||
fn blob_manager(&'a self) -> State<'a, BlobManager> {
|
||||
self.state::<BlobManager>()
|
||||
}
|
||||
|
||||
fn blobs(&'a self) -> BlobContext {
|
||||
let manager = self.state::<BlobManager>();
|
||||
manager.inner().connect()
|
||||
}
|
||||
}
|
||||
|
||||
/// Manages the blob database connection pool.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct BlobManager {
|
||||
pool: Arc<Mutex<Pool<SqliteConnectionManager>>>,
|
||||
}
|
||||
|
||||
impl BlobManager {
|
||||
pub fn new(pool: Pool<SqliteConnectionManager>) -> Self {
|
||||
Self { pool: Arc::new(Mutex::new(pool)) }
|
||||
}
|
||||
|
||||
pub fn connect(&self) -> BlobContext {
|
||||
let conn = self
|
||||
.pool
|
||||
.lock()
|
||||
.expect("Failed to gain lock on blob DB")
|
||||
.get()
|
||||
.expect("Failed to get blob DB connection from pool");
|
||||
BlobContext { conn }
|
||||
}
|
||||
}
|
||||
|
||||
/// Context for blob database operations.
|
||||
pub struct BlobContext {
|
||||
conn: r2d2::PooledConnection<SqliteConnectionManager>,
|
||||
}
|
||||
|
||||
impl BlobContext {
|
||||
/// Insert a single chunk.
|
||||
pub fn insert_chunk(&self, chunk: &BodyChunk) -> Result<()> {
|
||||
self.conn.execute(
|
||||
"INSERT INTO body_chunks (id, body_id, chunk_index, data) VALUES (?1, ?2, ?3, ?4)",
|
||||
params![chunk.id, chunk.body_id, chunk.chunk_index, chunk.data],
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Get all chunks for a body, ordered by chunk_index.
|
||||
pub fn get_chunks(&self, body_id: &str) -> Result<Vec<BodyChunk>> {
|
||||
let mut stmt = self.conn.prepare(
|
||||
"SELECT id, body_id, chunk_index, data FROM body_chunks
|
||||
WHERE body_id = ?1 ORDER BY chunk_index ASC",
|
||||
)?;
|
||||
|
||||
let chunks = stmt
|
||||
.query_map(params![body_id], |row| {
|
||||
Ok(BodyChunk {
|
||||
id: row.get(0)?,
|
||||
body_id: row.get(1)?,
|
||||
chunk_index: row.get(2)?,
|
||||
data: row.get(3)?,
|
||||
})
|
||||
})?
|
||||
.collect::<std::result::Result<Vec<_>, _>>()?;
|
||||
|
||||
Ok(chunks)
|
||||
}
|
||||
|
||||
/// Delete all chunks for a body.
|
||||
pub fn delete_chunks(&self, body_id: &str) -> Result<()> {
|
||||
self.conn.execute("DELETE FROM body_chunks WHERE body_id = ?1", params![body_id])?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Delete all chunks matching a body_id prefix (e.g., "rs_abc123.%" to delete all bodies for a response).
|
||||
pub fn delete_chunks_like(&self, body_id_prefix: &str) -> Result<()> {
|
||||
self.conn
|
||||
.execute("DELETE FROM body_chunks WHERE body_id LIKE ?1", params![body_id_prefix])?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/// Get total size of a body without loading data.
|
||||
impl BlobContext {
|
||||
pub fn get_body_size(&self, body_id: &str) -> Result<usize> {
|
||||
let size: i64 = self
|
||||
.conn
|
||||
.query_row(
|
||||
"SELECT COALESCE(SUM(LENGTH(data)), 0) FROM body_chunks WHERE body_id = ?1",
|
||||
params![body_id],
|
||||
|row| row.get(0),
|
||||
)
|
||||
.unwrap_or(0);
|
||||
Ok(size as usize)
|
||||
}
|
||||
|
||||
/// Check if a body exists.
|
||||
pub fn body_exists(&self, body_id: &str) -> Result<bool> {
|
||||
let count: i64 = self
|
||||
.conn
|
||||
.query_row(
|
||||
"SELECT COUNT(*) FROM body_chunks WHERE body_id = ?1",
|
||||
params![body_id],
|
||||
|row| row.get(0),
|
||||
)
|
||||
.unwrap_or(0);
|
||||
Ok(count > 0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Run migrations for the blob database.
|
||||
pub fn migrate_blob_db(pool: &Pool<SqliteConnectionManager>) -> Result<()> {
|
||||
info!("Running blob database migrations");
|
||||
|
||||
// Create migrations tracking table
|
||||
pool.get()?.execute(
|
||||
"CREATE TABLE IF NOT EXISTS _blob_migrations (
|
||||
version TEXT PRIMARY KEY,
|
||||
description TEXT NOT NULL,
|
||||
applied_at DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL
|
||||
)",
|
||||
[],
|
||||
)?;
|
||||
|
||||
// Read and sort all .sql files
|
||||
let mut entries: Vec<_> = BLOB_MIGRATIONS_DIR
|
||||
.entries()
|
||||
.iter()
|
||||
.filter(|e| e.path().extension().map(|ext| ext == "sql").unwrap_or(false))
|
||||
.collect();
|
||||
|
||||
entries.sort_by_key(|e| e.path());
|
||||
|
||||
let mut ran_migrations = 0;
|
||||
for entry in &entries {
|
||||
let filename = entry.path().file_name().unwrap().to_str().unwrap();
|
||||
let version = filename.split('_').next().unwrap();
|
||||
|
||||
// Check if already applied
|
||||
let already_applied: Option<i64> = pool
|
||||
.get()?
|
||||
.query_row("SELECT 1 FROM _blob_migrations WHERE version = ?", [version], |r| r.get(0))
|
||||
.optional()?;
|
||||
|
||||
if already_applied.is_some() {
|
||||
debug!("Skipping already applied blob migration: {}", filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
let sql =
|
||||
entry.as_file().unwrap().contents_utf8().expect("Failed to read blob migration file");
|
||||
|
||||
info!("Applying blob migration: {}", filename);
|
||||
let conn = pool.get()?;
|
||||
conn.execute_batch(sql)?;
|
||||
|
||||
// Record migration
|
||||
conn.execute(
|
||||
"INSERT INTO _blob_migrations (version, description) VALUES (?, ?)",
|
||||
params![version, filename],
|
||||
)?;
|
||||
|
||||
ran_migrations += 1;
|
||||
}
|
||||
|
||||
if ran_migrations == 0 {
|
||||
info!("No blob migrations to run");
|
||||
} else {
|
||||
info!("Ran {} blob migration(s)", ran_migrations);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn create_test_pool() -> Pool<SqliteConnectionManager> {
|
||||
let manager = SqliteConnectionManager::memory();
|
||||
let pool = Pool::builder().max_size(1).build(manager).unwrap();
|
||||
migrate_blob_db(&pool).unwrap();
|
||||
pool
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_insert_and_get_chunks() {
|
||||
let pool = create_test_pool();
|
||||
let manager = BlobManager::new(pool);
|
||||
let ctx = manager.connect();
|
||||
|
||||
let body_id = "rs_test123.request";
|
||||
let chunk1 = BodyChunk::new(body_id, 0, b"Hello, ".to_vec());
|
||||
let chunk2 = BodyChunk::new(body_id, 1, b"World!".to_vec());
|
||||
|
||||
ctx.insert_chunk(&chunk1).unwrap();
|
||||
ctx.insert_chunk(&chunk2).unwrap();
|
||||
|
||||
let chunks = ctx.get_chunks(body_id).unwrap();
|
||||
assert_eq!(chunks.len(), 2);
|
||||
assert_eq!(chunks[0].chunk_index, 0);
|
||||
assert_eq!(chunks[0].data, b"Hello, ");
|
||||
assert_eq!(chunks[1].chunk_index, 1);
|
||||
assert_eq!(chunks[1].data, b"World!");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_chunks_ordered_by_index() {
|
||||
let pool = create_test_pool();
|
||||
let manager = BlobManager::new(pool);
|
||||
let ctx = manager.connect();
|
||||
|
||||
let body_id = "rs_test123.request";
|
||||
|
||||
// Insert out of order
|
||||
ctx.insert_chunk(&BodyChunk::new(body_id, 2, b"C".to_vec())).unwrap();
|
||||
ctx.insert_chunk(&BodyChunk::new(body_id, 0, b"A".to_vec())).unwrap();
|
||||
ctx.insert_chunk(&BodyChunk::new(body_id, 1, b"B".to_vec())).unwrap();
|
||||
|
||||
let chunks = ctx.get_chunks(body_id).unwrap();
|
||||
assert_eq!(chunks.len(), 3);
|
||||
assert_eq!(chunks[0].data, b"A");
|
||||
assert_eq!(chunks[1].data, b"B");
|
||||
assert_eq!(chunks[2].data, b"C");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_delete_chunks() {
|
||||
let pool = create_test_pool();
|
||||
let manager = BlobManager::new(pool);
|
||||
let ctx = manager.connect();
|
||||
|
||||
let body_id = "rs_test123.request";
|
||||
ctx.insert_chunk(&BodyChunk::new(body_id, 0, b"data".to_vec())).unwrap();
|
||||
|
||||
assert!(ctx.body_exists(body_id).unwrap());
|
||||
|
||||
ctx.delete_chunks(body_id).unwrap();
|
||||
|
||||
assert!(!ctx.body_exists(body_id).unwrap());
|
||||
assert_eq!(ctx.get_chunks(body_id).unwrap().len(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_delete_chunks_like() {
|
||||
let pool = create_test_pool();
|
||||
let manager = BlobManager::new(pool);
|
||||
let ctx = manager.connect();
|
||||
|
||||
// Insert chunks for same response but different body types
|
||||
ctx.insert_chunk(&BodyChunk::new("rs_abc.request", 0, b"req".to_vec())).unwrap();
|
||||
ctx.insert_chunk(&BodyChunk::new("rs_abc.response", 0, b"resp".to_vec())).unwrap();
|
||||
ctx.insert_chunk(&BodyChunk::new("rs_other.request", 0, b"other".to_vec())).unwrap();
|
||||
|
||||
// Delete all bodies for rs_abc
|
||||
ctx.delete_chunks_like("rs_abc.%").unwrap();
|
||||
|
||||
// rs_abc bodies should be gone
|
||||
assert!(!ctx.body_exists("rs_abc.request").unwrap());
|
||||
assert!(!ctx.body_exists("rs_abc.response").unwrap());
|
||||
|
||||
// rs_other should still exist
|
||||
assert!(ctx.body_exists("rs_other.request").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_body_size() {
|
||||
let pool = create_test_pool();
|
||||
let manager = BlobManager::new(pool);
|
||||
let ctx = manager.connect();
|
||||
|
||||
let body_id = "rs_test123.request";
|
||||
ctx.insert_chunk(&BodyChunk::new(body_id, 0, b"Hello".to_vec())).unwrap();
|
||||
ctx.insert_chunk(&BodyChunk::new(body_id, 1, b"World".to_vec())).unwrap();
|
||||
|
||||
let size = ctx.get_body_size(body_id).unwrap();
|
||||
assert_eq!(size, 10); // "Hello" + "World" = 10 bytes
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_body_size_empty() {
|
||||
let pool = create_test_pool();
|
||||
let manager = BlobManager::new(pool);
|
||||
let ctx = manager.connect();
|
||||
|
||||
let size = ctx.get_body_size("nonexistent").unwrap();
|
||||
assert_eq!(size, 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_body_exists() {
|
||||
let pool = create_test_pool();
|
||||
let manager = BlobManager::new(pool);
|
||||
let ctx = manager.connect();
|
||||
|
||||
assert!(!ctx.body_exists("rs_test.request").unwrap());
|
||||
|
||||
ctx.insert_chunk(&BodyChunk::new("rs_test.request", 0, b"data".to_vec())).unwrap();
|
||||
|
||||
assert!(ctx.body_exists("rs_test.request").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multiple_bodies_isolated() {
|
||||
let pool = create_test_pool();
|
||||
let manager = BlobManager::new(pool);
|
||||
let ctx = manager.connect();
|
||||
|
||||
ctx.insert_chunk(&BodyChunk::new("body1", 0, b"data1".to_vec())).unwrap();
|
||||
ctx.insert_chunk(&BodyChunk::new("body2", 0, b"data2".to_vec())).unwrap();
|
||||
|
||||
let chunks1 = ctx.get_chunks("body1").unwrap();
|
||||
let chunks2 = ctx.get_chunks("body2").unwrap();
|
||||
|
||||
assert_eq!(chunks1.len(), 1);
|
||||
assert_eq!(chunks1[0].data, b"data1");
|
||||
assert_eq!(chunks2.len(), 1);
|
||||
assert_eq!(chunks2[0].data, b"data2");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_large_chunk() {
|
||||
let pool = create_test_pool();
|
||||
let manager = BlobManager::new(pool);
|
||||
let ctx = manager.connect();
|
||||
|
||||
// 1MB chunk
|
||||
let large_data: Vec<u8> = (0..1024 * 1024).map(|i| (i % 256) as u8).collect();
|
||||
let body_id = "rs_large.request";
|
||||
|
||||
ctx.insert_chunk(&BodyChunk::new(body_id, 0, large_data.clone())).unwrap();
|
||||
|
||||
let chunks = ctx.get_chunks(body_id).unwrap();
|
||||
assert_eq!(chunks.len(), 1);
|
||||
assert_eq!(chunks[0].data, large_data);
|
||||
assert_eq!(ctx.get_body_size(body_id).unwrap(), 1024 * 1024);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
use crate::blob_manager::BlobManagerExt;
|
||||
use crate::error::Error::GenericError;
|
||||
use crate::error::Result;
|
||||
use crate::models::{AnyModel, GraphQlIntrospection, GrpcEvent, Settings, WebsocketEvent};
|
||||
@@ -9,7 +8,6 @@ use tauri::{AppHandle, Runtime, WebviewWindow};
|
||||
#[tauri::command]
|
||||
pub(crate) fn upsert<R: Runtime>(window: WebviewWindow<R>, model: AnyModel) -> Result<String> {
|
||||
let db = window.db();
|
||||
let blobs = window.blob_manager();
|
||||
let source = &UpdateSource::from_window(&window);
|
||||
let id = match model {
|
||||
AnyModel::CookieJar(m) => db.upsert_cookie_jar(&m, source)?.id,
|
||||
@@ -17,7 +15,7 @@ pub(crate) fn upsert<R: Runtime>(window: WebviewWindow<R>, model: AnyModel) -> R
|
||||
AnyModel::Folder(m) => db.upsert_folder(&m, source)?.id,
|
||||
AnyModel::GrpcRequest(m) => db.upsert_grpc_request(&m, source)?.id,
|
||||
AnyModel::HttpRequest(m) => db.upsert_http_request(&m, source)?.id,
|
||||
AnyModel::HttpResponse(m) => db.upsert_http_response(&m, source, &blobs)?.id,
|
||||
AnyModel::HttpResponse(m) => db.upsert_http_response(&m, source)?.id,
|
||||
AnyModel::KeyValue(m) => db.upsert_key_value(&m, source)?.id,
|
||||
AnyModel::Plugin(m) => db.upsert_plugin(&m, source)?.id,
|
||||
AnyModel::Settings(m) => db.upsert_settings(&m, source)?.id,
|
||||
@@ -32,7 +30,6 @@ pub(crate) fn upsert<R: Runtime>(window: WebviewWindow<R>, model: AnyModel) -> R
|
||||
|
||||
#[tauri::command]
|
||||
pub(crate) fn delete<R: Runtime>(window: WebviewWindow<R>, model: AnyModel) -> Result<String> {
|
||||
let blobs = window.blob_manager();
|
||||
// Use transaction for deletions because it might recurse
|
||||
window.with_tx(|tx| {
|
||||
let source = &UpdateSource::from_window(&window);
|
||||
@@ -43,7 +40,7 @@ pub(crate) fn delete<R: Runtime>(window: WebviewWindow<R>, model: AnyModel) -> R
|
||||
AnyModel::GrpcConnection(m) => tx.delete_grpc_connection(&m, source)?.id,
|
||||
AnyModel::GrpcRequest(m) => tx.delete_grpc_request(&m, source)?.id,
|
||||
AnyModel::HttpRequest(m) => tx.delete_http_request(&m, source)?.id,
|
||||
AnyModel::HttpResponse(m) => tx.delete_http_response(&m, source, &blobs)?.id,
|
||||
AnyModel::HttpResponse(m) => tx.delete_http_response(&m, source)?.id,
|
||||
AnyModel::Plugin(m) => tx.delete_plugin(&m, source)?.id,
|
||||
AnyModel::WebsocketConnection(m) => tx.delete_websocket_connection(&m, source)?.id,
|
||||
AnyModel::WebsocketRequest(m) => tx.delete_websocket_request(&m, source)?.id,
|
||||
|
||||
@@ -67,7 +67,7 @@ impl<'a> DbContext<'a> {
|
||||
.expect("Failed to run find on DB")
|
||||
}
|
||||
|
||||
pub(crate) fn find_all<'s, M>(&self) -> Result<Vec<M>>
|
||||
pub fn find_all<'s, M>(&self) -> Result<Vec<M>>
|
||||
where
|
||||
M: Into<AnyModel> + Clone + UpsertModelInfo,
|
||||
{
|
||||
@@ -82,7 +82,7 @@ impl<'a> DbContext<'a> {
|
||||
Ok(items.map(|v| v.unwrap()).collect())
|
||||
}
|
||||
|
||||
pub(crate) fn find_many<'s, M>(
|
||||
pub fn find_many<'s, M>(
|
||||
&self,
|
||||
col: impl IntoColumnRef,
|
||||
value: impl Into<SimpleExpr>,
|
||||
@@ -115,7 +115,7 @@ impl<'a> DbContext<'a> {
|
||||
Ok(items.map(|v| v.unwrap()).collect())
|
||||
}
|
||||
|
||||
pub(crate) fn upsert<M>(&self, model: &M, source: &UpdateSource) -> Result<M>
|
||||
pub fn upsert<M>(&self, model: &M, source: &UpdateSource) -> Result<M>
|
||||
where
|
||||
M: Into<AnyModel> + From<AnyModel> + UpsertModelInfo + Clone,
|
||||
{
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use crate::blob_manager::{BlobManager, migrate_blob_db};
|
||||
use crate::commands::*;
|
||||
use crate::migrate::migrate_db;
|
||||
use crate::query_manager::QueryManager;
|
||||
@@ -15,7 +14,6 @@ use tauri_plugin_dialog::{DialogExt, MessageDialogKind};
|
||||
|
||||
mod commands;
|
||||
|
||||
pub mod blob_manager;
|
||||
mod connection_or_tx;
|
||||
pub mod db_context;
|
||||
pub mod error;
|
||||
@@ -52,9 +50,7 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||
create_dir_all(app_path.clone()).expect("Problem creating App directory!");
|
||||
|
||||
let db_file_path = app_path.join("db.sqlite");
|
||||
let blob_db_file_path = app_path.join("blobs.sqlite");
|
||||
|
||||
// Main database pool
|
||||
let manager = SqliteConnectionManager::file(db_file_path);
|
||||
let pool = Pool::builder()
|
||||
.max_size(100) // Up from 10 (just in case)
|
||||
@@ -72,26 +68,7 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
|
||||
return Err(Box::from(e.to_string()));
|
||||
};
|
||||
|
||||
// Blob database pool
|
||||
let blob_manager = SqliteConnectionManager::file(blob_db_file_path);
|
||||
let blob_pool = Pool::builder()
|
||||
.max_size(50)
|
||||
.connection_timeout(Duration::from_secs(10))
|
||||
.build(blob_manager)
|
||||
.unwrap();
|
||||
|
||||
if let Err(e) = migrate_blob_db(&blob_pool) {
|
||||
error!("Failed to run blob database migration {e:?}");
|
||||
app_handle
|
||||
.dialog()
|
||||
.message(e.to_string())
|
||||
.kind(MessageDialogKind::Error)
|
||||
.blocking_show();
|
||||
return Err(Box::from(e.to_string()));
|
||||
};
|
||||
|
||||
app_handle.manage(SqliteConnection::new(pool.clone()));
|
||||
app_handle.manage(BlobManager::new(blob_pool));
|
||||
|
||||
{
|
||||
let (tx, rx) = mpsc::channel();
|
||||
|
||||
@@ -1329,7 +1329,6 @@ pub struct HttpResponse {
|
||||
pub error: Option<String>,
|
||||
pub headers: Vec<HttpResponseHeader>,
|
||||
pub remote_addr: Option<String>,
|
||||
pub request_content_length: Option<i32>,
|
||||
pub request_headers: Vec<HttpResponseHeader>,
|
||||
pub status: i32,
|
||||
pub status_reason: Option<String>,
|
||||
@@ -1383,7 +1382,6 @@ impl UpsertModelInfo for HttpResponse {
|
||||
(StatusReason, self.status_reason.into()),
|
||||
(Url, self.url.into()),
|
||||
(Version, self.version.into()),
|
||||
(RequestContentLength, self.request_content_length.into()),
|
||||
])
|
||||
}
|
||||
|
||||
@@ -1398,7 +1396,6 @@ impl UpsertModelInfo for HttpResponse {
|
||||
HttpResponseIden::Error,
|
||||
HttpResponseIden::Headers,
|
||||
HttpResponseIden::RemoteAddr,
|
||||
HttpResponseIden::RequestContentLength,
|
||||
HttpResponseIden::RequestHeaders,
|
||||
HttpResponseIden::State,
|
||||
HttpResponseIden::Status,
|
||||
@@ -1434,7 +1431,6 @@ impl UpsertModelInfo for HttpResponse {
|
||||
state: serde_json::from_str(format!(r#""{state}""#).as_str()).unwrap(),
|
||||
body_path: r.get("body_path")?,
|
||||
headers: serde_json::from_str(headers.as_str()).unwrap_or_default(),
|
||||
request_content_length: r.get("request_content_length").unwrap_or_default(),
|
||||
request_headers: serde_json::from_str(
|
||||
r.get::<_, String>("request_headers").unwrap_or_default().as_str(),
|
||||
)
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
use crate::db_context::DbContext;
|
||||
use crate::error::Result;
|
||||
use crate::models::{HttpResponseEvent, HttpResponseEventIden};
|
||||
use crate::util::UpdateSource;
|
||||
|
||||
impl<'a> DbContext<'a> {
|
||||
pub fn list_http_response_events(&self, response_id: &str) -> Result<Vec<HttpResponseEvent>> {
|
||||
self.find_many(HttpResponseEventIden::ResponseId, response_id, None)
|
||||
}
|
||||
|
||||
pub fn upsert_http_response_event(
|
||||
&self,
|
||||
http_response_event: &HttpResponseEvent,
|
||||
source: &UpdateSource,
|
||||
) -> Result<HttpResponseEvent> {
|
||||
self.upsert(http_response_event, source)
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
use crate::blob_manager::BlobManager;
|
||||
use crate::db_context::DbContext;
|
||||
use crate::error::Result;
|
||||
use crate::models::{HttpResponse, HttpResponseIden, HttpResponseState};
|
||||
@@ -59,7 +58,6 @@ impl<'a> DbContext<'a> {
|
||||
&self,
|
||||
http_response: &HttpResponse,
|
||||
source: &UpdateSource,
|
||||
blob_manager: &BlobManager,
|
||||
) -> Result<HttpResponse> {
|
||||
// Delete the body file if it exists
|
||||
if let Some(p) = http_response.body_path.clone() {
|
||||
@@ -68,13 +66,6 @@ impl<'a> DbContext<'a> {
|
||||
};
|
||||
}
|
||||
|
||||
// Delete request body blobs (pattern: {response_id}.request)
|
||||
let blob_ctx = blob_manager.connect();
|
||||
let body_id = format!("{}.request", http_response.id);
|
||||
if let Err(e) = blob_ctx.delete_chunks(&body_id) {
|
||||
error!("Failed to delete request body blobs: {}", e);
|
||||
}
|
||||
|
||||
Ok(self.delete(http_response, source)?)
|
||||
}
|
||||
|
||||
@@ -82,13 +73,12 @@ impl<'a> DbContext<'a> {
|
||||
&self,
|
||||
http_response: &HttpResponse,
|
||||
source: &UpdateSource,
|
||||
blob_manager: &BlobManager,
|
||||
) -> Result<HttpResponse> {
|
||||
let responses = self.list_http_responses_for_request(&http_response.request_id, None)?;
|
||||
|
||||
for m in responses.iter().skip(MAX_HISTORY_ITEMS - 1) {
|
||||
debug!("Deleting old HTTP response {}", http_response.id);
|
||||
self.delete_http_response(&m, source, blob_manager)?;
|
||||
self.delete_http_response(&m, source)?;
|
||||
}
|
||||
|
||||
self.upsert(http_response, source)
|
||||
|
||||
@@ -8,7 +8,6 @@ mod grpc_connections;
|
||||
mod grpc_events;
|
||||
mod grpc_requests;
|
||||
mod http_requests;
|
||||
mod http_response_events;
|
||||
mod http_responses;
|
||||
mod key_values;
|
||||
mod plugin_key_values;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,53 +1,18 @@
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type AnyModel = CookieJar | Environment | Folder | GraphQlIntrospection | GrpcConnection | GrpcEvent | GrpcRequest | HttpRequest | HttpResponse | HttpResponseEvent | KeyValue | Plugin | Settings | SyncState | WebsocketConnection | WebsocketEvent | WebsocketRequest | Workspace | WorkspaceMeta;
|
||||
|
||||
export type ClientCertificate = { host: string, port: number | null, crtFile: string | null, keyFile: string | null, pfxFile: string | null, passphrase: string | null, enabled?: boolean, };
|
||||
|
||||
export type Cookie = { raw_cookie: string, domain: CookieDomain, expires: CookieExpires, path: [string, boolean], };
|
||||
|
||||
export type CookieDomain = { "HostOnly": string } | { "Suffix": string } | "NotPresent" | "Empty";
|
||||
|
||||
export type CookieExpires = { "AtUtc": string } | "SessionEnd";
|
||||
|
||||
export type CookieJar = { model: "cookie_jar", id: string, createdAt: string, updatedAt: string, workspaceId: string, cookies: Array<Cookie>, name: string, };
|
||||
|
||||
export type EditorKeymap = "default" | "vim" | "vscode" | "emacs";
|
||||
|
||||
export type EncryptedKey = { encryptedKey: string, };
|
||||
|
||||
export type Environment = { model: "environment", id: string, workspaceId: string, createdAt: string, updatedAt: string, name: string, public: boolean, parentModel: string, parentId: string | null, variables: Array<EnvironmentVariable>, color: string | null, sortPriority: number, };
|
||||
|
||||
export type EnvironmentVariable = { enabled?: boolean, name: string, value: string, id?: string, };
|
||||
|
||||
export type Folder = { model: "folder", id: string, createdAt: string, updatedAt: string, workspaceId: string, folderId: string | null, authentication: Record<string, any>, authenticationType: string | null, description: string, headers: Array<HttpRequestHeader>, name: string, sortPriority: number, };
|
||||
|
||||
export type GraphQlIntrospection = { model: "graphql_introspection", id: string, createdAt: string, updatedAt: string, workspaceId: string, requestId: string, content: string | null, };
|
||||
|
||||
export type GrpcConnection = { model: "grpc_connection", id: string, createdAt: string, updatedAt: string, workspaceId: string, requestId: string, elapsed: number, error: string | null, method: string, service: string, status: number, state: GrpcConnectionState, trailers: { [key in string]?: string }, url: string, };
|
||||
|
||||
export type GrpcConnectionState = "initialized" | "connected" | "closed";
|
||||
|
||||
export type GrpcEvent = { model: "grpc_event", id: string, createdAt: string, updatedAt: string, workspaceId: string, requestId: string, connectionId: string, content: string, error: string | null, eventType: GrpcEventType, metadata: { [key in string]?: string }, status: number | null, };
|
||||
|
||||
export type GrpcEventType = "info" | "error" | "client_message" | "server_message" | "connection_start" | "connection_end";
|
||||
|
||||
export type GrpcRequest = { model: "grpc_request", id: string, createdAt: string, updatedAt: string, workspaceId: string, folderId: string | null, authenticationType: string | null, authentication: Record<string, any>, description: string, message: string, metadata: Array<HttpRequestHeader>, method: string | null, name: string, service: string | null, sortPriority: number, url: string, };
|
||||
|
||||
export type HttpRequest = { model: "http_request", id: string, createdAt: string, updatedAt: string, workspaceId: string, folderId: string | null, authentication: Record<string, any>, authenticationType: string | null, body: Record<string, any>, bodyType: string | null, description: string, headers: Array<HttpRequestHeader>, method: string, name: string, sortPriority: number, url: string, urlParameters: Array<HttpUrlParameter>, };
|
||||
|
||||
export type HttpRequestHeader = { enabled?: boolean, name: string, value: string, id?: string, };
|
||||
|
||||
export type HttpResponse = { model: "http_response", id: string, createdAt: string, updatedAt: string, workspaceId: string, requestId: string, bodyPath: string | null, contentLength: number | null, contentLengthCompressed: number | null, elapsed: number, elapsedHeaders: number, error: string | null, headers: Array<HttpResponseHeader>, remoteAddr: string | null, requestContentLength: number | null, requestHeaders: Array<HttpResponseHeader>, status: number, statusReason: string | null, state: HttpResponseState, url: string, version: string | null, };
|
||||
|
||||
export type HttpResponseEvent = { model: "http_response_event", id: string, createdAt: string, updatedAt: string, workspaceId: string, responseId: string, event: HttpResponseEventData, };
|
||||
|
||||
/**
|
||||
* Serializable representation of HTTP response events for DB storage.
|
||||
* This mirrors `yaak_http::sender::HttpResponseEvent` but with serde support.
|
||||
* The `From` impl is in yaak-http to avoid circular dependencies.
|
||||
*/
|
||||
export type HttpResponseEventData = { "type": "setting", name: string, value: string, } | { "type": "info", message: string, } | { "type": "redirect", url: string, status: number, behavior: string, } | { "type": "send_url", method: string, path: string, } | { "type": "receive_url", version: string, status: string, } | { "type": "header_up", name: string, value: string, } | { "type": "header_down", name: string, value: string, } | { "type": "chunk_sent", bytes: number, } | { "type": "chunk_received", bytes: number, };
|
||||
export type HttpResponse = { model: "http_response", id: string, createdAt: string, updatedAt: string, workspaceId: string, requestId: string, bodyPath: string | null, contentLength: number | null, contentLengthCompressed: number | null, elapsed: number, elapsedHeaders: number, error: string | null, headers: Array<HttpResponseHeader>, remoteAddr: string | null, requestHeaders: Array<HttpResponseHeader>, status: number, statusReason: string | null, state: HttpResponseState, url: string, version: string | null, };
|
||||
|
||||
export type HttpResponseHeader = { name: string, value: string, };
|
||||
|
||||
@@ -55,28 +20,6 @@ export type HttpResponseState = "initialized" | "connected" | "closed";
|
||||
|
||||
export type HttpUrlParameter = { enabled?: boolean, name: string, value: string, id?: string, };
|
||||
|
||||
export type KeyValue = { model: "key_value", id: string, createdAt: string, updatedAt: string, key: string, namespace: string, value: string, };
|
||||
|
||||
export type Plugin = { model: "plugin", id: string, createdAt: string, updatedAt: string, checkedAt: string | null, directory: string, enabled: boolean, url: string | null, };
|
||||
|
||||
export type ProxySetting = { "type": "enabled", http: string, https: string, auth: ProxySettingAuth | null, bypass: string, disabled: boolean, } | { "type": "disabled" };
|
||||
|
||||
export type ProxySettingAuth = { user: string, password: string, };
|
||||
|
||||
export type Settings = { model: "settings", id: string, createdAt: string, updatedAt: string, appearance: string, clientCertificates: Array<ClientCertificate>, coloredMethods: boolean, editorFont: string | null, editorFontSize: number, editorKeymap: EditorKeymap, editorSoftWrap: boolean, hideWindowControls: boolean, useNativeTitlebar: boolean, interfaceFont: string | null, interfaceFontSize: number, interfaceScale: number, openWorkspaceNewWindow: boolean | null, proxy: ProxySetting | null, themeDark: string, themeLight: string, updateChannel: string, hideLicenseBadge: boolean, autoupdate: boolean, autoDownloadUpdates: boolean, checkNotifications: boolean, };
|
||||
|
||||
export type SyncState = { model: "sync_state", id: string, workspaceId: string, createdAt: string, updatedAt: string, flushedAt: string, modelId: string, checksum: string, relPath: string, syncDir: string, };
|
||||
|
||||
export type WebsocketConnection = { model: "websocket_connection", id: string, createdAt: string, updatedAt: string, workspaceId: string, requestId: string, elapsed: number, error: string | null, headers: Array<HttpResponseHeader>, state: WebsocketConnectionState, status: number, url: string, };
|
||||
|
||||
export type WebsocketConnectionState = "initialized" | "connected" | "closing" | "closed";
|
||||
|
||||
export type WebsocketEvent = { model: "websocket_event", id: string, createdAt: string, updatedAt: string, workspaceId: string, requestId: string, connectionId: string, isServer: boolean, message: Array<number>, messageType: WebsocketEventType, };
|
||||
|
||||
export type WebsocketEventType = "binary" | "close" | "frame" | "open" | "ping" | "pong" | "text";
|
||||
|
||||
export type WebsocketRequest = { model: "websocket_request", id: string, createdAt: string, updatedAt: string, workspaceId: string, folderId: string | null, authentication: Record<string, any>, authenticationType: string | null, description: string, headers: Array<HttpRequestHeader>, message: string, name: string, sortPriority: number, url: string, urlParameters: Array<HttpUrlParameter>, };
|
||||
|
||||
export type Workspace = { model: "workspace", id: string, createdAt: string, updatedAt: string, authentication: Record<string, any>, authenticationType: string | null, description: string, headers: Array<HttpRequestHeader>, name: string, encryptionKeyChallenge: string | null, settingValidateCertificates: boolean, settingFollowRedirects: boolean, settingRequestTimeout: number, };
|
||||
|
||||
export type WorkspaceMeta = { model: "workspace_meta", id: string, workspaceId: string, createdAt: string, updatedAt: string, encryptionKey: EncryptedKey | null, settingSyncDir: string | null, };
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user