Skip to content

Commit

Permalink
Merge branch 'beta'
Browse files Browse the repository at this point in the history
  • Loading branch information
gentee committed Jan 15, 2022
2 parents 2473a2e + 8911563 commit c4256ac
Show file tree
Hide file tree
Showing 18 changed files with 377 additions and 111 deletions.
Binary file modified assets/packages.tar.gz
Binary file not shown.
Binary file modified assets/stdlib.tar.gz
Binary file not shown.
Binary file modified assets/web.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion const.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package main

const (
// Version of the application
Version = "1.24.0"
Version = "1.25.0"
// DefPort is the default web-server port
DefPort = 3234
// DefTheme is the default web-server theme
Expand Down
17 changes: 15 additions & 2 deletions gensource.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type Param struct {

type Advanced struct {
LogLevel int
Ref string
}

func (src *Source) Tree(tree []scriptTree) (string, error) {
Expand Down Expand Up @@ -160,6 +161,9 @@ func (src *Source) ScriptValues(script *Script, node scriptTree) ([]Param, []Par
more.LogLevel = level
}
}
if v, ok := advanced[`ref`]; ok {
more.Ref = fmt.Sprint(v)
}
}
for _, par := range script.Params {
var (
Expand Down Expand Up @@ -423,7 +427,14 @@ func (src *Source) Script(node scriptTree) (string, error) {
params = append(params, fmt.Sprintf("%s: %s", par.Name, par.Value))
}
}
out := fmt.Sprintf(" %s(%s)\r\n", idname, strings.Join(params, `,`))
var out string
if len(advanced.Ref) > 0 {
out = fmt.Sprintf(" pushref(%q)\r\n", advanced.Ref)
}
out += fmt.Sprintf(" %s(%s)\r\n", idname, strings.Join(params, `,`))
if len(advanced.Ref) > 0 {
out += " popref()\r\n"
}
/* if script.Settings.Name == Return {
out += " deinit();return\r\n"
}*/
Expand Down Expand Up @@ -458,7 +469,7 @@ func GenSource(script *Script, header *es.Header) (string, error) {
if script.Settings.LogLevel != es.LOG_INHERIT {
level = script.Settings.LogLevel
}
params = append(params, fmt.Sprintf("SetLogLevel(%d)\r\ninit()", level))
params = append(params, fmt.Sprintf("thread(%d)\r\ninit()", level))

if predef, err := src.Predefined(script); err != nil {
return ``, err
Expand Down Expand Up @@ -507,8 +518,10 @@ func GenSource(script *Script, header *es.Header) (string, error) {
if err != nil {
return ``, err
}
params = append(params, `pushref("*")`)
params = append(params, fmt.Sprintf("initcmd(%d,`form`, %s)\r\nForm( %[2]s )", level,
src.Value(string(outForm), false)))
params = append(params, `popref()`)
}
for _, par := range script.Params {
var ptype string
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/atotto/clipboard v0.1.4
github.com/boombuler/barcode v1.0.1 // indirect
github.com/gentee/eonza-pro v0.0.0-00010101000000-000000000000
github.com/gentee/gentee v1.21.0
github.com/gentee/gentee v1.22.0
github.com/gentee/systray v1.3.1
github.com/go-sql-driver/mysql v1.6.0
github.com/golang-jwt/jwt v3.2.2+incompatible
Expand All @@ -23,12 +23,12 @@ require (
github.com/xuri/excelize/v2 v2.4.1
github.com/yuin/goldmark v1.4.4
github.com/yuin/goldmark-highlighting v0.0.0-20210516132338-9216f9c5aa01
golang.org/x/crypto v0.0.0-20211115234514-b4de73f9ece8
golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c
golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b
golang.org/x/sys v0.0.0-20211210111614-af8b64212486
golang.org/x/text v0.3.7
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.64.0
gopkg.in/ini.v1 v1.66.2
gopkg.in/yaml.v2 v2.4.0
)

Expand Down
18 changes: 12 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ github.com/dlclark/regexp2 v1.1.6/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55k
github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/dlclark/regexp2 v1.4.0 h1:F1rxgk7p4uKjwIQxBs9oAXe5CqrXlCduYEJvrF4u93E=
github.com/dlclark/regexp2 v1.4.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc=
github.com/gentee/gentee v1.21.0 h1:JM3PiW/rIrzDWM40Qy29mjpyqmOQFwIlqgU8/U881QY=
github.com/gentee/gentee v1.21.0/go.mod h1:Qyf1jQ8a/yUyPEHrl1RTHKNSTJ923lsPnghIawrdDN4=
github.com/gentee/gentee v1.22.0 h1:/H5VQAAkd1fcp2C1/HPFrq4frMTfYtDLPpbbYoPzUzw=
github.com/gentee/gentee v1.22.0/go.mod h1:Qyf1jQ8a/yUyPEHrl1RTHKNSTJ923lsPnghIawrdDN4=
github.com/gentee/systray v1.3.1 h1:yLHp4v3WYXhdqlfeG32qzNNtqsO5YODwJwTefW4yewk=
github.com/gentee/systray v1.3.1/go.mod h1:vj38v/It1PQHccJKl+18Fh0T0Eitrij3ASRSkte6LWQ=
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY=
github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
Expand Down Expand Up @@ -104,16 +103,17 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211115234514-b4de73f9ece8 h1:5QRxNnVsaJP6NAse0UdkRgL3zHMvCRRkrDVLNdNpdy4=
golang.org/x/crypto v0.0.0-20211115234514-b4de73f9ece8/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b h1:QAqMVf3pSa6eeTsuklijukjXBlj7Es2QQplab+/RbQ4=
golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb h1:fqpd0EBDzlHRCjiphRR5Zo/RSWWQlWv34418dnEixWk=
golang.org/x/image v0.0.0-20210220032944-ac19c3e999fb/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210913180222-943fd674d43e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8 h1:/6y1LfuqNuQdHAm0jjtPtgRcxIxjVZgm5OTu8/QhZvk=
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sys v0.0.0-20181128092732-4ed8d59d0b35/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand All @@ -129,6 +129,8 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c h1:DHcbWVXeY+0Y8HHKR+rbLwnoh2F4tNCY7rTiHJ30RmA=
golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 h1:5hpz5aRr+W1erYCL5JRhSUBJRph7l9XkNveoExlrKYk=
golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -139,12 +141,16 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac h1:7zkz7BUtwNFFqcowJ+RIgu2MaV/MapERkDIy+mwPyjs=
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11 h1:GZokNIeuVkl3aZHJchRrr13WCsols02MLUcz1U9is6M=
golang.org/x/time v0.0.0-20211116232009-f0f3c7e86c11/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/ini.v1 v1.64.0 h1:Mj2zXEXcNb5joEiSA0zc3HZpTst/iyjNiR4CN8tDzOg=
gopkg.in/ini.v1 v1.64.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI=
gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
Expand Down
6 changes: 5 additions & 1 deletion notpro.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a MIT license
// that can be found in the LICENSE file.

// +build !pro
//go:build !pro

package main

Expand Down Expand Up @@ -130,5 +130,9 @@ func SecureConstants() map[string]string {
return nil
}

func IsAutoFill() bool {
return false
}

func ProApi(e *echo.Echo) {
}
8 changes: 6 additions & 2 deletions pro.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a MIT license
// that can be found in the LICENSE file.

// +build pro
//go:build pro

package main

Expand Down Expand Up @@ -101,6 +101,10 @@ func IsDecrypted() bool {
return pro.IsDecrypted()
}

func IsAutoFill() bool {
return pro.IsAutoFill()
}

func ValidateOTP(user users.User, otp string) error {
return pro.ValidateOTP(user, otp)
}
Expand All @@ -123,7 +127,7 @@ func ProInit(psw []byte, counter uint32) {
pro.CallbackPassCounter = StoragePassCounter
pro.CallbackTitle = GetTitle
pro.CallbackTrial = GetTrialMode
pro.LoadPro(psw, counter, cfg.path)
pro.LoadPro(psw, counter, cfg.path, cfg.Users.Dir)
}

func proSettingsHandle(c echo.Context) error {
Expand Down
26 changes: 14 additions & 12 deletions render.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,19 @@ type Render struct {

type RenderScript struct {
Task
Title string
IsScript bool
URLPort int
Start string
Finish string
CDN string
Nickname string
Role string
Source template.HTML
Stdout template.HTML
Logout template.HTML
Reports []script.Report
Title string
IsScript bool
IsAutoFill bool
URLPort int
Start string
Finish string
CDN string
Nickname string
Role string
Source template.HTML
Stdout template.HTML
Logout template.HTML
Reports []script.Report
}

var (
Expand Down Expand Up @@ -131,6 +132,7 @@ func RenderPage(c echo.Context, url string) (string, error) {
renderScript.Nickname = scriptTask.Header.User.Nickname
renderScript.Role = scriptTask.Header.Role.Name
renderScript.URLPort = scriptTask.Header.URLPort
renderScript.IsAutoFill = scriptTask.Header.IsAutoFill
} else {
renderScript.URLPort = cfg.HTTP.Port
renderScript.Task = *c.Get(`Task`).(*Task)
Expand Down
1 change: 1 addition & 0 deletions run.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ func systemRun(rs *RunScript) error {
Data: rs.Data,
Console: rs.Console,
IsPlayground: cfg.playground,
IsAutoFill: IsAutoFill(),
IP: rs.IP,
User: rs.User,
Role: rs.Role,
Expand Down
Loading

0 comments on commit c4256ac

Please sign in to comment.