feat: add s5 login and register endpoints

This commit is contained in:
Derrick Hammer 2024-01-16 10:16:43 -05:00
parent 13ca22d80e
commit 28444ca456
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 23 additions and 3 deletions

View File

@ -15,4 +15,8 @@ type HTTPService interface {
type HTTPHandler interface {
SmallFileUpload(context *jape.Context)
AccountRegisterChallenge(context *jape.Context)
AccountRegister(context *jape.Context)
AccountLoginChallenge(context *jape.Context)
AccountLogin(context *jape.Context)
}

View File

@ -30,9 +30,13 @@ func NewHTTP(node interfaces.Node) interfaces.HTTPService {
func (h *HTTPImpl) GetHttpRouter() *httprouter.Router {
mux := jape.Mux(map[string]jape.Handler{
"GET /s5/version": h.versionHandler,
"GET /s5/p2p": h.p2pHandler,
"POST /s5/upload": h.uploadHandler,
"GET /s5/version": h.versionHandler,
"GET /s5/p2p": h.p2pHandler,
"POST /s5/upload": h.uploadHandler,
"GET /account/register": h.accountRegisterChallengeHandler,
"POST /account/register": h.accountRegisterHandler,
"GET /account/login": h.accountLoginChallengeHandler,
"POST /account/login": h.accountLoginHandler,
})
return mux
@ -92,3 +96,15 @@ func (h *HTTPImpl) p2pHandler(ctx jape.Context) {
func (h *HTTPImpl) uploadHandler(context jape.Context) {
h.handler.SmallFileUpload(&context)
}
func (h *HTTPImpl) accountRegisterChallengeHandler(context jape.Context) {
h.handler.AccountRegisterChallenge(&context)
}
func (h *HTTPImpl) accountRegisterHandler(context jape.Context) {
h.handler.AccountRegisterChallenge(&context)
}
func (h *HTTPImpl) accountLoginChallengeHandler(context jape.Context) {
h.handler.AccountLoginChallenge(&context)
}
func (h *HTTPImpl) accountLoginHandler(context jape.Context) {
h.handler.AccountLoginChallenge(&context)
}