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 22, 2021
2 parents 5874748 + 3ba2fe9 commit 2e3947b
Show file tree
Hide file tree
Showing 19 changed files with 1,108 additions and 465 deletions.
1,064 changes: 606 additions & 458 deletions assets.go

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ func AuthHandle(next echo.HandlerFunc) echo.HandlerFunc {
}
}
}
if firstRun && url == `/` {
c.Request().URL.Path = `install`
}
// TODO: JWT user
var user *User
for _, user = range storage.Users {
Expand Down
3 changes: 3 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ var (
JWTKey: lib.UniqueName(12),
},
}
firstRun bool
)

func defDir(dir, def string) string {
Expand Down Expand Up @@ -156,6 +157,8 @@ func LoadConfig() {
// Install creates config and data file on the first execution
func Install() {
var err error

firstRun = true
scripts = make(map[string]*Script)
for _, tpl := range _escDirs["../eonza-assets/init"] {
var script Script
Expand Down
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.10.0"
Version = "1.11.0"
// DefPort is the default web-server port
DefPort = 3234
// DefTheme is the default web-server theme
Expand Down
21 changes: 21 additions & 0 deletions cron.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright 2021 Alexey Krivonogov. All rights reserved.
// Use of this source code is governed by a MIT license
// that can be found in the LICENSE file.

package main

import (
"github.com/kataras/golog"
"github.com/robfig/cron/v3"
)

var (
cronJobs = cron.New() //cron.New(cron.WithSeconds())
)

func RunCron() {
if _, err := cronJobs.AddFunc(`0 * * * *`, AutoCheckUpdate); err != nil {
golog.Error(err)
}
cronJobs.Start()
}
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/alecthomas/chroma v0.8.2
github.com/alecthomas/colour v0.1.0 // indirect
github.com/alecthomas/repr v0.0.0-20201120212035-bb82daffcca2 // indirect
github.com/atotto/clipboard v0.1.2
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/dlclark/regexp2 v1.4.0 // indirect
github.com/gentee/gentee v1.20.0
Expand All @@ -15,6 +16,7 @@ require (
github.com/kr/text v0.2.0 // indirect
github.com/labstack/echo/v4 v4.1.17
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/robfig/cron/v3 v3.0.1
github.com/sergi/go-diff v1.1.0 // indirect
github.com/stretchr/testify v1.6.1 // indirect
github.com/yuin/goldmark v1.3.0
Expand Down
5 changes: 5 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkx
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ=
github.com/alecthomas/repr v0.0.0-20201120212035-bb82daffcca2 h1:G5TeG64Ox4OWq2YwlsxS7nOedU8vbGgNRTRDAjGvDCk=
github.com/alecthomas/repr v0.0.0-20201120212035-bb82daffcca2/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8=
github.com/atotto/clipboard v0.1.2 h1:YZCtFu5Ie8qX2VmVTBnrqLSiU9XOWwqNRmdT3gIQzbY=
github.com/atotto/clipboard v0.1.2/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/daaku/go.zipexe v1.0.0/go.mod h1:z8IiR6TsVLEYKwXAoE/I+8ys/sDkgTzSL0CLnGVd57E=
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ=
Expand Down Expand Up @@ -88,6 +90,9 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
Expand Down
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ func main() {
if err := LoadCustomAsset(cfg.AssetsDir, cfg.HTTP.Theme); err != nil {
golog.Fatal(err)
}
LoadNotifications()
InitScripts()
CreateSysTray()
RunCron()
e = RunServer(WebSettings{
Port: cfg.HTTP.Port,
Open: cfg.HTTP.Open,
Expand Down
5 changes: 4 additions & 1 deletion make.g
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ run {
// $ go install -ldflags "-s -w -X main.VerType=%{vertype} -X main.CompileDate=%{Format(`YYYY-MM-DD`,Now())}"
$ cp ${GOPATH}/bin/eonza /home/ak/app/eonza-dev/eonza
$ cp ${GOPATH}/bin/eonza /home/ak/app/eonza/eonza
// $ cp ${GOPATH}/bin/eonza /home/ak/app/eonza-install/eonza
// $ rm /home/ak/app/eonza-install/eonza.yaml
// $ rm /home/ak/app/eonza-install/eonza.eox
$ /home/ak/app/eonza-dev/eonza
// $ /home/ak/app/eonza/eonza
// $ /home/ak/app/eonza-install/eonza

$ cp ${GOPATH}/bin/eonza /home/ak/app/eonza-dev/ez
// $ /home/ak/app/eonza-dev/ez con
Expand Down
Loading

0 comments on commit 2e3947b

Please sign in to comment.