Skip to content

Commit

Permalink
Merge pull request #1 from caido/ef-frontend-sdk
Browse files Browse the repository at this point in the history
Add frontend sdk doc
  • Loading branch information
Sytten authored Sep 16, 2024
2 parents 688c648 + afa84b0 commit fcb55ce
Show file tree
Hide file tree
Showing 16 changed files with 517 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .vitepress/sidebars/concepts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const conceptsSidebar: DefaultTheme.SidebarItem[] = [
link: "/concepts/essentials/plugins/frontend",
},
{
text: "(WIP) Backend",
text: "Backend",
link: "/concepts/essentials/plugins/backend",
},
],
Expand Down
2 changes: 1 addition & 1 deletion .vitepress/sidebars/reference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const referenceSidebar: DefaultTheme.SidebarItem[] = [
link: "/reference/sdks/backend_sdk",
},
{
text: "Frontend (WIP)",
text: "Frontend",
link: "/reference/sdks/frontend_sdk",
},
],
Expand Down
Binary file added src/_images/add_page_sdk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/_images/create_finding_sdk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/_images/create_scope_sdk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/_images/register_command_sdk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/_images/register_menu_sdk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/_images/toast_message_sdk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/_images/update_scope_sdk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 19 additions & 1 deletion src/concepts/essentials/plugins/backend.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Plugin Backend (WIP)
# Plugin Backend

The backend component of Caido is the server responsible for data processing, storage and business logic.

Expand All @@ -7,3 +7,21 @@ Backend development allows you to:
- Extend the server-side functionality of the Caido application.
- Interact with the application's data, databases and infrastructure.
- Handle authentication, authorization and data calls.

For advanced documentation on this topic - click [here](/reference/sdks/backend_sdk.md).

### `APISDK`

Used to send events to the frontend and register backend functions.

`sdk.api.send`

`sdk.api.register`

### `EventsSDK`

Registers a callback to an intercepted request or response. Callbacks are asynchronous and cannot modify the request or response objects.

`sdk.events.onInterceptRequest`

`sdk.events.onInterceptResponse`
30 changes: 17 additions & 13 deletions src/concepts/essentials/plugins/frontend.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,27 @@ Frontend development allows you to:
- Provide additional features and customization options.
- Handle user interactions, render data and communicate with the backend server via Caido's API.

## Frontend Interfaces

_For advanced documentation on this topic - click [here](/reference/sdks/frontend_sdk.md)._

`ui` - Used to create visual elements. Content options for each element are also provided. These elements provide a way to sectionalize the user-interface of your plugin.
`sdk.navigation` - Used to create pages in the application and navigate to them.

`sdk.sidebar` - Used to add an entry to the left-hand navigation menu in the Caido user-interface to navigate between pages.

`sdk.ui` - Used to create visual elements. Content options for each element are also provided. These elements provide a way to sectionalize the user-interface of your plugin.

`scopes` - Used to set, create, update and delete **target scoping rules**, ensuring your plugin is directed at desired hosts.
`sdk.scopes` - Used to set, create, update and delete [Scope Presets](https://docs.caido.io/reference/features/overview/scope), ensuring your plugin is directed at desired hosts.

`commands` - Used to register **actions** to expose functionality, bind actions to the user-interface and implement business logic.
`sdk.findings` - Used to create [Findings](https://docs.caido.io/reference/features/logging/findings).

`menu` - Used to register right-click **context menu** actions/options and create a plugin specific **settings page**, allowing quick access to your plugin functionality.
`sdk.commands` - Used to register actions to expose functionality, bind actions to the user-interface and implement business logic.

`navigation` - Used to create pages in the application, giving your plugin its own **tab**.
`sdk.menu` - Used to register right-click context menu actions/options and create a plugin specific settings page, allowing quick access to your plugin functionality.

`window` - Used to interact with **text** within the application environment, allowing text selection, replacement, read permission designations, focusing and editor related messaging.
`sdk.window` - Used to interact with text within the application environment, allowing text selection, replacement, read permission designations, focusing and editor related messaging.

`storage` - Used to **persist data** across different sessions or instances.
`sdk.storage` - Used to persist data across different sessions or instances.

`sdk.shortcuts` - Used to register a command shortcut.

::: info
Caido has heavily referenced [Visual Studio Code's Command Model](https://code.visualstudio.com/api/extension-guides/command).
Expand All @@ -42,16 +46,16 @@ Caido convieniently offers a plugin starterkit that can serve as a skeleton mode

::: info

- For documentation on the tooling files shared by all plugin starterkits offered by Caido - click [here](../tooling.md).
- The frontend starterkit can be found [here](https://github.com/caido/starterkit-plugin-frontend).
:::
- For documentation on the tooling files shared by all plugin starterkits offered by Caido - click [here](/concepts/essentials/tooling.md).
- The starterkit can be found [here](https://github.com/caido/starterkit-plugin).
:::

### Frontend Starterkit Directories

The `public` directory stores the `styles.css` file used to stylize elements of your plugin.

The `src` directory stores the following files:

- `index.ts` file is acts as the entrypoint file (_the initial script that is loaded and executed, setting up the necessary resources and handling further logic and interactions with the plugin_). Within this file - an `init` function export is required in order to initialize the plugin. The init function receives a `caido` object of type `Caido` which is the SDK (_importable from `@caido/sdk-frontend`_) used to interact with the frontend application. Click [here](https://github.com/caido/sdk-frontend/blob/main/src/types/index.d.ts) for the full type definition.
- `index.ts` file is acts as the entrypoint file (_the initial script that is loaded and executed, setting up the necessary resources and handling further logic and interactions with the plugin_). Within this file - an `init` function export is required in order to initialize the plugin. The init function receives a `caido` object of type `Caido` which is the SDK (_importable from `@caido/sdk-frontend`_) used to interact with the frontend application. Click [here](https://github.com/caido/sdk-js/blob/main/packages/sdk-frontend/src/types/index.d.ts) for the full type definition.

- `types.ts`: This file allows you the ability to declare new types usable in your plugin.
3 changes: 1 addition & 2 deletions src/concepts/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@

- **[Plugins](./essentials/plugins/index.md)** - foundational knowledge on Plugins.
- **[Frontend](./essentials/plugins/frontend.md)** - the frontend component
- **[(WIP) Backend](./essentials/plugins/backend.md)** - the backend component.

- **[Backend](./essentials/plugins/backend.md)** - the backend component.
- **[Tooling](./essentials/tooling.md)** - tools for the ease of Plugin development.
Binary file modified src/public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/public/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
## SDKs

- **[Backend SDK](./sdks/backend_sdk.md)** - Backend Software Development Kit.
- **[Frontend SDK (WIP)](./sdks/frontend_sdk.md)** - Frontend Software Development Kit.
- **[Frontend SDK](./sdks/frontend_sdk.md)** - Frontend Software Development Kit.
Loading

0 comments on commit fcb55ce

Please sign in to comment.