aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2022-10-25 13:40:49 +0000
committerr <r@freesoftwareextremist.com>2022-10-25 14:14:46 +0000
commit887ed241d64ba5db3fd3d87194fb5595e5ad7d73 (patch)
tree40fe52d870ac31dce139ceb11b40e0161bf10946 /main.go
parentb4ccde54a70495937a5667950363cbf2c24d40bf (diff)
downloadbloat-887ed241d64ba5db3fd3d87194fb5595e5ad7d73.tar.gz
bloat-887ed241d64ba5db3fd3d87194fb5595e5ad7d73.zip
Use cookies for session storage
Remove the server side session storage and store all the session related data in the client side cookies. This decreases the exposure of the auth tokens. It also simplifies the installation process as bloat no longer requires write access to the filesystem. This is a breaking change, all the existing sessions will stop working.
Diffstat (limited to 'main.go')
-rw-r--r--main.go24
1 files changed, 1 insertions, 23 deletions
diff --git a/main.go b/main.go
index 3b5ccba..b717b7d 100644
--- a/main.go
+++ b/main.go
@@ -12,9 +12,7 @@ import (
"bloat/config"
"bloat/renderer"
- "bloat/repo"
"bloat/service"
- "bloat/util"
)
var (
@@ -48,26 +46,6 @@ func main() {
errExit(err)
}
- err = os.Mkdir(config.DatabasePath, 0755)
- if err != nil && !os.IsExist(err) {
- errExit(err)
- }
-
- sessionDBPath := filepath.Join(config.DatabasePath, "session")
- sessionDB, err := util.NewDatabse(sessionDBPath)
- if err != nil {
- errExit(err)
- }
-
- appDBPath := filepath.Join(config.DatabasePath, "app")
- appDB, err := util.NewDatabse(appDBPath)
- if err != nil {
- errExit(err)
- }
-
- sessionRepo := repo.NewSessionRepo(sessionDB)
- appRepo := repo.NewAppRepo(appDB)
-
customCSS := config.CustomCSS
if len(customCSS) > 0 && !strings.HasPrefix(customCSS, "http://") &&
!strings.HasPrefix(customCSS, "https://") {
@@ -89,7 +67,7 @@ func main() {
s := service.NewService(config.ClientName, config.ClientScope,
config.ClientWebsite, customCSS, config.SingleInstance,
- config.PostFormats, renderer, sessionRepo, appRepo)
+ config.PostFormats, renderer)
handler := service.NewHandler(s, logger, config.StaticDirectory)
logger.Println("listening on", config.ListenAddress)