diff --git a/.env-example b/.env-example index ded2eab..914b654 100644 --- a/.env-example +++ b/.env-example @@ -8,7 +8,6 @@ App_HTTP_HOST=localhost App_HTTP_PORT=8080 App_USE_HTTPS=false App_USE_LETSENCRYPT=false -App_USE_CORESERVICES=false APP_LETSENCRYPT_EMAIL=mail@example.com App_HTTPS_HOSTS=example.com, www.example.com App_REDIRECT_HTTP_TO_HTTPS=false @@ -49,7 +48,7 @@ POSTGRES_SSL_MODE=disable POSTGRES_TIMEZONE=America/Argentina/Buenos_Aires #_____ SQLITE _____# -SQLITE_DB_PATH=storage/sqlite/sqlite.db +SQLITE_DB_PATH=storage/sqlite.db ####################################### ###### CACHE ###### diff --git a/.gitignore b/.gitignore index 84146d5..8d4682e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,3 @@ logs/* tls/* !tls/.gitkeep .DS_Store -storage/sqlite/* diff --git a/controllers/authentication.go b/controllers/authentication.go index 9e7e940..25c7b31 100644 --- a/controllers/authentication.go +++ b/controllers/authentication.go @@ -425,28 +425,8 @@ func SetNewPassword(c *core.Context) *core.Response { } func Signout(c *core.Context) *core.Response { - - // check if template engine is enable - TemplateEnableStr := os.Getenv("TEMPLATE_ENABLE") - if TemplateEnableStr == "" { - TemplateEnableStr = "false" - } - TemplateEnable, _ := strconv.ParseBool(TemplateEnableStr) - - token := "" - - if TemplateEnable { - // get cookie - usercookie, err := c.GetCookie() - if err != nil { - - } - token = usercookie.Token - } else { - tokenRaw := c.GetHeader("Authorization") - token = strings.TrimSpace(strings.Replace(tokenRaw, "Bearer", "", 1)) - } - + tokenRaw := c.GetHeader("Authorization") + token := strings.TrimSpace(strings.Replace(tokenRaw, "Bearer", "", 1)) if token == "" { return c.Response.SetStatusCode(http.StatusUnauthorized).Json(c.MapToJson(map[string]interface{}{ "message": "unauthorized", diff --git a/controllers/themedemo.go b/controllers/themedemo.go index bbde3c6..22ba5a5 100644 --- a/controllers/themedemo.go +++ b/controllers/themedemo.go @@ -6,7 +6,6 @@ package controllers import ( "fmt" - "math/rand/v2" "os" "strconv" @@ -643,9 +642,7 @@ func Themecontent(c *core.Context) *core.Response { // first, include all compoments type templateData struct { - ContentTable components.ContentTable - ContentTabledetail components.ContentTabledetail - ContentGraph components.ContentGraph + ContentTable components.ContentTable } // TABLES @@ -689,40 +686,6 @@ func Themecontent(c *core.Context) *core.Response { allTd = append(allTd, vals) } - // for td items in table detail - var allTdetail []components.ContentTabledetailTD - // table detail - var thd components.ContentTabledetailTD - thd.Caption = "Continent" - thd.Value = "Asia" - allTdetail = append(allTdetail, thd) - thd.Caption = "Country" - thd.Value = "South Korea" - allTdetail = append(allTdetail, thd) - thd.Caption = "Capital" - thd.Value = "Seoul" - allTdetail = append(allTdetail, thd) - thd.Caption = "Details" - thd.ValueType = "href" // column type href - thd.Value = components.ContentHref{ - Text: "edit", - Link: "#", - } - allTdetail = append(allTdetail, thd) - thd.Caption = "Notifications" - thd.ValueType = "badge" // column type href - thd.Value = components.ContentBadge{ - Text: "success", - TypeClass: "success", - } - allTdetail = append(allTdetail, thd) - - // random values for pie - one := rand.IntN(50) - two := rand.IntN(50) - three := rand.IntN(50) - valuesgraph := fmt.Sprintf("%d|%d|%d", one, two, three) - // now fill data of the components tmplData := templateData{ ContentTable: components.ContentTable{ @@ -730,19 +693,7 @@ func Themecontent(c *core.Context) *core.Response { AllTH: allTh, AllTD: allTd, }, - ContentTabledetail: components.ContentTabledetail{ - ID: "table_demodetail", - Title: "Sample table detail", - HeadClass: "table-warning", - AllTD: allTdetail, - }, - ContentGraph: components.ContentGraph{ - Graph: "pie", - Labels: "Berlin|Paris|Venecia", - Values: valuesgraph, - }, } - return c.Response.Template("custom_theme_contentpage.html", tmplData) } else { diff --git a/go.mod b/go.mod index 6f6869e..2243d4d 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module git.smarteching.com/goffee/cup replace ( - git.smarteching.com/goffee/core => ../core - git.smarteching.com/goffee/cup/config => ./config git.smarteching.com/goffee/cup/handlers => ./handlers git.smarteching.com/goffee/cup/middlewares => ./middlewares @@ -20,7 +18,6 @@ require ( ) require ( - git.smarteching.com/zeni/go-chart/v2 v2.1.4 // indirect github.com/SparkPost/gosparkpost v0.2.0 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect @@ -29,7 +26,6 @@ require ( github.com/go-ozzo/ozzo-validation v3.6.0+incompatible // indirect github.com/go-sql-driver/mysql v1.7.0 // indirect github.com/golang-jwt/jwt/v5 v5.0.0 // indirect - github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect github.com/harranali/mailing v1.2.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect @@ -46,9 +42,8 @@ require ( github.com/sendgrid/rest v2.6.9+incompatible // indirect github.com/sendgrid/sendgrid-go v3.12.0+incompatible // indirect golang.org/x/crypto v0.11.0 // indirect - golang.org/x/image v0.21.0 // indirect golang.org/x/net v0.10.0 // indirect - golang.org/x/text v0.19.0 // indirect + golang.org/x/text v0.14.0 // indirect gorm.io/driver/mysql v1.5.1 // indirect gorm.io/driver/postgres v1.5.2 // indirect gorm.io/driver/sqlite v1.5.2 // indirect diff --git a/go.sum b/go.sum index fe35bfa..e052570 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -git.smarteching.com/zeni/go-chart/v2 v2.1.4 h1:pF06+F6eqJLIG8uMiTVPR5TygPGMjM/FHMzTxmu5V/Q= -git.smarteching.com/zeni/go-chart/v2 v2.1.4/go.mod h1:b3ueW9h3pGGXyhkormZAvilHaG4+mQti+bMNPdQBeOQ= +git.smarteching.com/goffee/core v1.7.3 h1:GlZ7B/QwAQ6eSQcYBtqlglZoqA7tFYiXqvV2z27xuQY= +git.smarteching.com/goffee/core v1.7.3/go.mod h1:QQNIHVN6qjJBtq42WCQMrLYN9oFE3wm26SLU8ZxNTec= github.com/SparkPost/gosparkpost v0.2.0 h1:yzhHQT7cE+rqzd5tANNC74j+2x3lrPznqPJrxC1yR8s= github.com/SparkPost/gosparkpost v0.2.0/go.mod h1:S9WKcGeou7cbPpx0kTIgo8Q69WZvUmVeVzbD+djalJ4= github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= @@ -35,8 +35,6 @@ github.com/go-test/deep v1.0.2/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3a github.com/gogs/chardet v0.0.0-20150115103509-2404f7772561/go.mod h1:Pcatq5tYkCW2Q6yrR2VRHlbHpZ/R4/7qyL1TCF7vl14= github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= -github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -93,16 +91,14 @@ github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXl golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= -golang.org/x/image v0.21.0 h1:c5qV36ajHpdj4Qi0GnE0jUc/yuo33OLFaa0d+crTD5s= -golang.org/x/image v0.21.0/go.mod h1:vUbsLavqK/W303ZroQQVKQ+Af3Yl6Uz1Ppu5J/cLz78= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= 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/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/routes.go b/routes.go index 00f1906..610fbcb 100644 --- a/routes.go +++ b/routes.go @@ -36,9 +36,6 @@ func registerRoutes() { controller.Get("/dashboard", controllers.WelcomeToDashboard, hooks.AuthCheck) - // templates demos - controller.Get("/signout", controllers.Signout) - controller.Get("/appsample", controllers.AppSample, hooks.AuthCheck) controller.Post("/appsample", controllers.AppSample, hooks.AuthCheck) diff --git a/storage/sqlite.db b/storage/sqlite.db new file mode 100644 index 0000000..b10cc17 Binary files /dev/null and b/storage/sqlite.db differ diff --git a/storage/sqlite/sqlite.db b/storage/sqlite/sqlite.db deleted file mode 100644 index 97751be..0000000 Binary files a/storage/sqlite/sqlite.db and /dev/null differ diff --git a/storage/templates/custom_theme_contentpage.html b/storage/templates/custom_theme_contentpage.html index 67b35f9..e1d71e9 100644 --- a/storage/templates/custom_theme_contentpage.html +++ b/storage/templates/custom_theme_contentpage.html @@ -8,15 +8,6 @@
{{template "content_table" .ContentTable}}
-
-
-

Pie chart

- {{template "content_graph" .ContentGraph}} -
-
- {{template "content_tabledetail" .ContentTabledetail}} -
-
{{template "page_footer"}}