Documentation ¶
Index ¶
- Variables
- func CheckAndDownloadWebGUIRelease(checkUpdate bool, forceUpdate bool, fetchURL string, cacheDir string) (err error)
- func CreatePathIfNotExist(path string) (err error)
- func DownloadFile(filepath string, url string) (err error)
- func GetLatestReleaseURL(fetchURL string) (string, string, int, error)
- func ServePluginOK(w http.ResponseWriter, r *http.Request, pluginsMatchResult []string) (ok bool)
- func ServePluginWithReferrerOK(w http.ResponseWriter, r *http.Request, path string) (ok bool)
- func Unzip(src, dest string) (err error)
- type PackageJSON
- type Plugins
- type RcloneConfig
Constants ¶
This section is empty.
Variables ¶
var ( // PluginsMatch is used for matching author and plugin name in the url path PluginsMatch = regexp.MustCompile(`^plugins\/([^\/]*)\/([^\/\?]+)[\/]?(.*)$`) // PluginsPath is the base path where webgui plugins are stored PluginsPath string )
Functions ¶
func CheckAndDownloadWebGUIRelease ¶
func CheckAndDownloadWebGUIRelease(checkUpdate bool, forceUpdate bool, fetchURL string, cacheDir string) (err error)
CheckAndDownloadWebGUIRelease is a helper function to download and setup latest release of rclone-webui-react
func CreatePathIfNotExist ¶
CreatePathIfNotExist creates the path to a folder if it does not exist
func DownloadFile ¶
DownloadFile is a helper function to download a file from url to the filepath
func GetLatestReleaseURL ¶
GetLatestReleaseURL returns the latest release details of the rclone-webui-react
func ServePluginOK ¶
ServePluginOK checks the plugin url and uses reverse proxy to allow redirection for content not being served by rclone
func ServePluginWithReferrerOK ¶
ServePluginWithReferrerOK check if redirectReferrer is set for the referred a plugin, if yes, sends a redirect to actual url. This function is useful for plugins to refer to absolute paths when the referrer in http.Request is set
Types ¶
type PackageJSON ¶
type PackageJSON struct { Name string `json:"name"` Version string `json:"version"` Description string `json:"description"` Author string `json:"author"` Copyright string `json:"copyright"` License string `json:"license"` Private bool `json:"private"` Homepage string `json:"homepage"` TestURL string `json:"testUrl"` Repository struct { Type string `json:"type"` URL string `json:"url"` } `json:"repository"` Bugs struct { URL string `json:"url"` } `json:"bugs"` Rclone RcloneConfig `json:"rclone"` }
PackageJSON is the structure of package.json of a plugin
type Plugins ¶
type Plugins struct { LoadedPlugins map[string]PackageJSON `json:"loadedPlugins"` // contains filtered or unexported fields }
Plugins represents the structure how plugins are saved onto disk
func (*Plugins) GetPluginByName ¶
func (p *Plugins) GetPluginByName(name string) (out *PackageJSON, err error)
GetPluginByName returns the plugin object for the key (author/plugin-name)