Skip to content

Plugins

Nite edited this page May 19, 2023 · 5 revisions

What are plugins?

With plugins, everyone can add features they want to seekr and share them. Right now they are backend-only.

Plugins are currently NOT supported for windows

How to install plugins

To be added...

Creating custom plugins

If you want to create a custom plugin yourself, use this guide.

Make sure you have seekr-cli installed. It will be needed to bundle your plugin later. If you dont have it currently installed, follow these steps:

  1. Noone knows how to do this, probably added later

Now that seekr-cli is installed, we can continue.

Lets get started with the file structure. For the sake of this guide, lets make a browser-port plugin, to change the web port.

├── browser-port
│   ├── manifesto.json
│   ├── plugin.go

Inside manifesto.json insert the following. (This part will later show on the plugin store, which is coming soon)

{
  "name": "BrowserPort",
  "version": "1.0.0",
  "description": "change the BrowserPort",
  "author": "9glenda"
}

Now we will get to the actual coding part. In plugin.go paste the following:

package main

import (
	"fmt"

	"github.com/seekr-osint/seekr/api"
	"net/http"

	"github.com/gin-gonic/gin"
)

func Main() error { // This is ran when the plugin is loaded and this function has to exist
	return nil
}

// Everything below here is optional, meaning it does not have to exist

func PreParser(apiConfig api.ApiConfig) (api.ApiConfig, error) { // Ran before seekr modifies the config
	fmt.Printf("running config parser\n")
	apiConfig.Server.Port = uint16(8080)
	return apiConfig, nil
}

func PostParser(apiConfig api.ApiConfig) (api.ApiConfig, error) { // Ran after seekr modifies the config
	fmt.Printf("running post parse config parser\nadded /plug api call\n")
	apiConfig.GinRouter.GET("/plug", func(c *gin.Context) {
		c.String(http.StatusOK, "Hello, World!")
	})
	return apiConfig, nil
}

Use this command to bundle your plugin source code to a .bundle file:

seekr-cli bundle