-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add eslint * Add validate workflow
- Loading branch information
Showing
15 changed files
with
2,818 additions
and
778 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Validate | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
pull_request: | ||
|
||
env: | ||
NODE_VERSION: 20 | ||
PNPM_VERSION: 9 | ||
|
||
jobs: | ||
validate: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Checkout project | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
|
||
- name: Setup pnpm | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: ${{ env.PNPM_VERSION }} | ||
run_install: false | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Typecheck | ||
run: pnpm typecheck | ||
|
||
- name: Lint | ||
run: pnpm lint | ||
|
||
- name: Build | ||
run: pnpm build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { defaultConfig } from "@caido/eslint-config"; | ||
|
||
export default [ | ||
...defaultConfig({ | ||
stylistic: false, | ||
compat: false, | ||
}), | ||
]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import type { DefineAPI, SDK } from "caido:plugin"; | ||
|
||
export type API = DefineAPI<{}>; | ||
export type API = DefineAPI<never>; | ||
|
||
export function init(sdk: SDK<API>) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
interface Response { | ||
protocol: string; | ||
uniqueId: string; // Converted to camelCase for consistency | ||
fullId: string; // Converted to camelCase for consistency | ||
qType: string; // Query type | ||
rawRequest: string; | ||
rawResponse: string; | ||
remoteAddress: string; | ||
timestamp: string; // Use Date type for parsing if necessary | ||
protocol: string; | ||
uniqueId: string; // Converted to camelCase for consistency | ||
fullId: string; // Converted to camelCase for consistency | ||
qType: string; // Query type | ||
rawRequest: string; | ||
rawResponse: string; | ||
remoteAddress: string; | ||
timestamp: string; // Use Date type for parsing if necessary | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,66 @@ | ||
import { Classic } from "@caido/primevue"; | ||
import { createPinia } from "pinia"; | ||
import PrimeVue from "primevue/config"; | ||
import { createApp, ref } from "vue"; | ||
|
||
import App from "./views/App.vue"; | ||
|
||
import "./styles/index.css"; | ||
|
||
import { createPinia } from "pinia"; | ||
import { SDKPlugin } from "./plugins/sdk"; | ||
import "./styles/index.css"; | ||
import type { FrontendSDK } from "./types"; | ||
import App from "./views/App.vue"; | ||
|
||
const eventBus = new EventTarget(); | ||
export default eventBus; | ||
|
||
// This is the entry point for the frontend plugin | ||
export let QuickSSRFBtn: any; | ||
export let QuickSSRFBtn: ReturnType<FrontendSDK["sidebar"]["registerItem"]>; | ||
export const QuickSSRFBtnCount = ref(0); | ||
export const init = (sdk: FrontendSDK) => { | ||
const app = createApp(App); | ||
const pinia = createPinia(); | ||
app.use(pinia); | ||
// Load the PrimeVue component library | ||
app.use(PrimeVue, { | ||
unstyled: true, | ||
pt: Classic, | ||
}); | ||
|
||
// Provide the FrontendSDK | ||
app.use(SDKPlugin, sdk); | ||
|
||
// Create the root element for the app | ||
const root = document.createElement("div"); | ||
Object.assign(root.style, { | ||
height: "100%", | ||
width: "100%", | ||
}); | ||
const event = new CustomEvent("updateSelected"); | ||
|
||
// Set the ID of the root element | ||
// We use the manifest ID to ensure that the ID is unique per-plugin | ||
// This is necessary to prevent styling conflicts between plugins | ||
// The value here should be the same as the prefixWrap plugin in postcss.config.js | ||
root.id = `plugin--quickssrf`; | ||
|
||
// Mount the app to the root element | ||
app.mount(root); | ||
|
||
// Add the page to the navigation | ||
// Make sure to use a unique name for the page | ||
sdk.navigation.addPage("/quickssrf", { | ||
body: root, | ||
onEnter: () => { | ||
QuickSSRFBtnCount.value = 0; | ||
QuickSSRFBtn.setCount(QuickSSRFBtnCount.value); | ||
eventBus.dispatchEvent(event); | ||
}, | ||
}); | ||
|
||
QuickSSRFBtn = sdk.sidebar.registerItem("QuickSSRF", "/quickssrf", { | ||
icon: "fas fa-globe", | ||
}); | ||
QuickSSRFBtn.setCount(QuickSSRFBtnCount.value); | ||
const app = createApp(App); | ||
const pinia = createPinia(); | ||
app.use(pinia); | ||
// Load the PrimeVue component library | ||
app.use(PrimeVue, { | ||
unstyled: true, | ||
pt: Classic, | ||
}); | ||
|
||
// Provide the FrontendSDK | ||
app.use(SDKPlugin, sdk); | ||
|
||
// Create the root element for the app | ||
const root = document.createElement("div"); | ||
Object.assign(root.style, { | ||
height: "100%", | ||
width: "100%", | ||
}); | ||
const event = new CustomEvent("updateSelected"); | ||
|
||
/* | ||
* Set the ID of the root element | ||
* We use the manifest ID to ensure that the ID is unique per-plugin | ||
* This is necessary to prevent styling conflicts between plugins | ||
* The value here should be the same as the prefixWrap plugin in postcss.config.js | ||
*/ | ||
root.id = "plugin--quickssrf"; | ||
|
||
// Mount the app to the root element | ||
app.mount(root); | ||
|
||
/* | ||
* Add the page to the navigation | ||
* Make sure to use a unique name for the page | ||
*/ | ||
sdk.navigation.addPage("/quickssrf", { | ||
body: root, | ||
onEnter: () => { | ||
QuickSSRFBtnCount.value = 0; | ||
QuickSSRFBtn.setCount(QuickSSRFBtnCount.value); | ||
eventBus.dispatchEvent(event); | ||
}, | ||
}); | ||
|
||
QuickSSRFBtn = sdk.sidebar.registerItem("QuickSSRF", "/quickssrf", { | ||
icon: "fas fa-globe", | ||
}); | ||
QuickSSRFBtn.setCount(QuickSSRFBtnCount.value); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
import { type InjectionKey, type Plugin, inject } from "vue"; | ||
import { inject, type InjectionKey, type Plugin } from "vue"; | ||
|
||
import type { FrontendSDK } from "@/types"; | ||
|
||
const KEY: InjectionKey<FrontendSDK> = Symbol("FrontendSDK"); | ||
|
||
// This is the plugin that will provide the FrontendSDK to VueJS | ||
// To access the frontend SDK from within a component, use the `useSDK` function. | ||
/* | ||
* This is the plugin that will provide the FrontendSDK to VueJS | ||
* To access the frontend SDK from within a component, use the `useSDK` function. | ||
*/ | ||
export const SDKPlugin: Plugin = (app, sdk: FrontendSDK) => { | ||
app.provide(KEY, sdk); | ||
app.provide(KEY, sdk); | ||
}; | ||
|
||
// This is the function that will be used to access the FrontendSDK from within a component. | ||
export const useSDK = () => { | ||
return inject(KEY) as FrontendSDK; | ||
return inject(KEY) as FrontendSDK; | ||
}; |
Oops, something went wrong.