editor

package
v3.0.0-rc.2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

README

Package information

Editor Plugin is just a bridge between Iris and alm-tools.

alm-tools is a typescript online IDE/Editor, made by @basarat one of the top contributors of the Typescript.

Iris gives you the opportunity to edit your client-side using the alm-tools editor, via the editor plugin.

This plugin starts it's own server, if Iris server is using TLS then the editor will use the same key and cert.

How to use


package main

import (
	"github.com/kataras/iris"
	"github.com/kataras/iris/config"
	"github.com/kataras/iris/plugin/editor"
)

func main(){
	editorConfig:= config.Editor {
		Host: "127.0.0.1",
		Port: 4444,
		WorkingDir: "/path/to/the/client/side/directory",
		Username: "myusername",
		Password: "mypassword"

	}

	iris.Plugins.Add(editor.New(editorConfig))

	iris.Get("/", func (ctx *iris.Context){})

	iris.Listen(":8080")
}


Note for username, password: The Authorization specifies the authentication mechanism (in this case Basic) followed by the username and password. Although, the string aHR0cHdhdGNoOmY= may look encrypted it is simply a base64 encoded version of :. Would be readily available to anyone who could intercept the HTTP request. Read more.

The editor can't work if the directory doesn't contains a tsconfig.json.

If you are using the typescript plugin you don't have to call the .Dir(...)

Documentation

Index

Constants

View Source
const (
	// Name the name of the Plugin, which is "EditorPlugin"
	Name = "EditorPlugin"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin is an Editor Plugin the struct which implements the iris.IPlugin it holds a logger from the iris' station username,password for basic auth directory which the client side code is keyfile,certfile for TLS listening and a host which is listening for

func New

func New(cfg ...config.Editor) *Plugin

New creates and returns an Editor Plugin instance

func (*Plugin) Dir

func (e *Plugin) Dir(workingDir string) *Plugin

Dir sets the directory which the client side source code alive

func (*Plugin) GetDescription

func (e *Plugin) GetDescription() string

GetDescription EditorPlugin is a bridge between Iris and the alm-tools, the browser-based IDE for client-side sources.

func (*Plugin) GetName

func (e *Plugin) GetName() string

GetName returns the name of the Plugin

func (*Plugin) Port

func (e *Plugin) Port(port int) *Plugin

Port sets the port (int) for the editor plugin's standalone server

func (*Plugin) PreClose

func (e *Plugin) PreClose(s *iris.Framework)

PreClose kills the editor's server when Iris is closed

func (*Plugin) PreListen

func (e *Plugin) PreListen(s *iris.Framework)

PreListen runs before the server's listens, saves the keyfile,certfile and the host from the Iris station to listen for

func (*Plugin) SetEnable

func (e *Plugin) SetEnable(enable bool)

SetEnable if true enables the editor plugin, otherwise disables it

func (*Plugin) User

func (e *Plugin) User(username string, password string) *Plugin

User set a user, accepts two parameters: username (string), string (string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL