feat: add s5 login and register endpoints
This commit is contained in:
parent
13ca22d80e
commit
28444ca456
|
@ -15,4 +15,8 @@ type HTTPService interface {
|
||||||
|
|
||||||
type HTTPHandler interface {
|
type HTTPHandler interface {
|
||||||
SmallFileUpload(context *jape.Context)
|
SmallFileUpload(context *jape.Context)
|
||||||
|
AccountRegisterChallenge(context *jape.Context)
|
||||||
|
AccountRegister(context *jape.Context)
|
||||||
|
AccountLoginChallenge(context *jape.Context)
|
||||||
|
AccountLogin(context *jape.Context)
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,9 +30,13 @@ func NewHTTP(node interfaces.Node) interfaces.HTTPService {
|
||||||
|
|
||||||
func (h *HTTPImpl) GetHttpRouter() *httprouter.Router {
|
func (h *HTTPImpl) GetHttpRouter() *httprouter.Router {
|
||||||
mux := jape.Mux(map[string]jape.Handler{
|
mux := jape.Mux(map[string]jape.Handler{
|
||||||
"GET /s5/version": h.versionHandler,
|
"GET /s5/version": h.versionHandler,
|
||||||
"GET /s5/p2p": h.p2pHandler,
|
"GET /s5/p2p": h.p2pHandler,
|
||||||
"POST /s5/upload": h.uploadHandler,
|
"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
|
return mux
|
||||||
|
@ -92,3 +96,15 @@ func (h *HTTPImpl) p2pHandler(ctx jape.Context) {
|
||||||
func (h *HTTPImpl) uploadHandler(context jape.Context) {
|
func (h *HTTPImpl) uploadHandler(context jape.Context) {
|
||||||
h.handler.SmallFileUpload(&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)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue