mirror of
https://codeberg.org/scip/ephemerup.git
synced 2025-12-18 21:11:04 +01:00
changes:
- added working upload formm which can also create an upload
- cleaned up auth.go
- enhanced server/SetupAuthStore() to also look up form ids
- added form template (put into .go file by Makefile
This commit is contained in:
21
api/utils.go
21
api/utils.go
@@ -55,7 +55,7 @@ func Ts() string {
|
||||
|
||||
If there's no apicontext in the session, assume unauth user, return ""
|
||||
*/
|
||||
func GetApicontext(c *fiber.Ctx) (string, error) {
|
||||
func SessionGetApicontext(c *fiber.Ctx) (string, error) {
|
||||
sess, err := Sessionstore.Get(c)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Unable to initialize session store from context: " + err.Error())
|
||||
@@ -69,6 +69,25 @@ func GetApicontext(c *fiber.Ctx) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
/*
|
||||
Retrieve the formid (aka onetime api key) from the session. It is
|
||||
configured if an upload request has been successfully authenticated
|
||||
using a onetime key.
|
||||
*/
|
||||
func SessionGetFormId(c *fiber.Ctx) (string, error) {
|
||||
sess, err := Sessionstore.Get(c)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Unable to initialize session store from context: " + err.Error())
|
||||
}
|
||||
|
||||
formid := sess.Get("formid")
|
||||
if formid != nil {
|
||||
return formid.(string), nil
|
||||
}
|
||||
|
||||
return "", nil
|
||||
}
|
||||
|
||||
/*
|
||||
Calculate if time is up based on start time.Time and
|
||||
duration. Returns true if time is expired. Start time comes from
|
||||
|
||||
Reference in New Issue
Block a user