forked from jriou/coller
feat: Rename password by encryption key
Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
parent
634326190c
commit
8e1dd686d3
16 changed files with 118 additions and 117 deletions
|
@ -16,10 +16,10 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
passwordLength = internal.MIN_PASSWORD_LENGTH
|
||||
supportedOSes = []string{"linux", "darwin"}
|
||||
supportedArches = []string{"amd64", "arm64"}
|
||||
supportedClients = []string{"coller", "copier"}
|
||||
encryptionKeyLength = internal.MIN_ENCRYPTION_KEY_LENGTH
|
||||
supportedOSes = []string{"linux", "darwin"}
|
||||
supportedArches = []string{"amd64", "arm64"}
|
||||
supportedClients = []string{"coller", "copier"}
|
||||
)
|
||||
|
||||
type Server struct {
|
||||
|
@ -41,8 +41,8 @@ func NewServer(logger *slog.Logger, db *Database, config *Config, version string
|
|||
}, nil
|
||||
}
|
||||
|
||||
func (s *Server) SetPasswordLength(length int) {
|
||||
passwordLength = length
|
||||
func (s *Server) SetEncryptionKeyLength(length int) {
|
||||
encryptionKeyLength = length
|
||||
}
|
||||
|
||||
func (s *Server) SetMetrics(metrics *Metrics) {
|
||||
|
@ -100,7 +100,7 @@ func (s *Server) Start() error {
|
|||
|
||||
// API
|
||||
r.Path("/api/note").Handler(&CreateNoteHandler{logger: s.logger, db: s.db, maxUploadSize: s.config.MaxUploadSize}).Methods("POST")
|
||||
r.Path("/{id:[a-zA-Z0-9]+}/{password:[a-zA-Z0-9]+}").Handler(&GetProtectedNoteHandler{logger: s.logger, db: s.db}).Methods("GET")
|
||||
r.Path("/{id:[a-zA-Z0-9]+}/{encryptionKey:[a-zA-Z0-9]+}").Handler(&GetProtectedNoteHandler{logger: s.logger, db: s.db}).Methods("GET")
|
||||
r.Path("/{id:[a-zA-Z0-9]+}").Handler(&GetNoteHandler{logger: s.logger, db: s.db}).Methods("GET")
|
||||
|
||||
// Web pages
|
||||
|
@ -150,7 +150,7 @@ func (s *Server) Start() error {
|
|||
logger: s.logger,
|
||||
db: s.db,
|
||||
}
|
||||
r.Path("/{id:[a-zA-Z0-9]+}/{password:[a-zA-Z0-9]+}.html").Handler(protectedWebNoteHandler).Methods("GET")
|
||||
r.Path("/{id:[a-zA-Z0-9]+}/{encryptionKey:[a-zA-Z0-9]+}.html").Handler(protectedWebNoteHandler).Methods("GET")
|
||||
|
||||
webNoteHandler := &GetWebNoteHandler{
|
||||
Templates: templates,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue