2018-05-27 22:40:42 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gorilla/mux"
|
|
|
|
)
|
|
|
|
|
2018-07-24 14:46:02 +08:00
|
|
|
func apiRouterInit(router *mux.Router) error {
|
2018-05-27 22:40:42 +08:00
|
|
|
router.HandleFunc("/api/owner/new", ownerNewHandler).Methods("POST")
|
|
|
|
router.HandleFunc("/api/owner/confirm-hex", ownerConfirmHexHandler).Methods("GET")
|
|
|
|
router.HandleFunc("/api/owner/login", ownerLoginHandler).Methods("POST")
|
|
|
|
router.HandleFunc("/api/owner/self", ownerSelfHandler).Methods("POST")
|
2020-01-03 05:41:07 +08:00
|
|
|
router.HandleFunc("/api/owner/delete", ownerDeleteHandler).Methods("POST")
|
2018-05-27 22:40:42 +08:00
|
|
|
|
|
|
|
router.HandleFunc("/api/domain/new", domainNewHandler).Methods("POST")
|
2018-06-03 23:27:08 +08:00
|
|
|
router.HandleFunc("/api/domain/delete", domainDeleteHandler).Methods("POST")
|
2019-04-14 09:02:40 +08:00
|
|
|
router.HandleFunc("/api/domain/clear", domainClearHandler).Methods("POST")
|
2019-04-21 11:25:35 +08:00
|
|
|
router.HandleFunc("/api/domain/sso/new", domainSsoSecretNewHandler).Methods("POST")
|
2018-05-27 22:40:42 +08:00
|
|
|
router.HandleFunc("/api/domain/list", domainListHandler).Methods("POST")
|
|
|
|
router.HandleFunc("/api/domain/update", domainUpdateHandler).Methods("POST")
|
|
|
|
router.HandleFunc("/api/domain/moderator/new", domainModeratorNewHandler).Methods("POST")
|
|
|
|
router.HandleFunc("/api/domain/moderator/delete", domainModeratorDeleteHandler).Methods("POST")
|
2018-06-04 00:05:44 +08:00
|
|
|
router.HandleFunc("/api/domain/statistics", domainStatisticsHandler).Methods("POST")
|
2018-06-14 16:58:11 +08:00
|
|
|
router.HandleFunc("/api/domain/import/disqus", domainImportDisqusHandler).Methods("POST")
|
2020-02-01 15:12:21 +08:00
|
|
|
router.HandleFunc("/api/domain/import/commento", domainImportCommentoHandler).Methods("POST")
|
2019-01-31 15:06:11 +08:00
|
|
|
router.HandleFunc("/api/domain/export/begin", domainExportBeginHandler).Methods("POST")
|
|
|
|
router.HandleFunc("/api/domain/export/download", domainExportDownloadHandler).Methods("GET")
|
2018-05-27 22:40:42 +08:00
|
|
|
|
2018-06-20 11:29:55 +08:00
|
|
|
router.HandleFunc("/api/commenter/token/new", commenterTokenNewHandler).Methods("GET")
|
2018-06-11 01:15:56 +08:00
|
|
|
router.HandleFunc("/api/commenter/new", commenterNewHandler).Methods("POST")
|
|
|
|
router.HandleFunc("/api/commenter/login", commenterLoginHandler).Methods("POST")
|
2018-05-27 22:40:42 +08:00
|
|
|
router.HandleFunc("/api/commenter/self", commenterSelfHandler).Methods("POST")
|
2019-12-05 13:57:10 +08:00
|
|
|
router.HandleFunc("/api/commenter/update", commenterUpdateHandler).Methods("POST")
|
2019-02-23 11:20:55 +08:00
|
|
|
router.HandleFunc("/api/commenter/photo", commenterPhotoHandler).Methods("GET")
|
2019-02-19 05:30:54 +08:00
|
|
|
|
2019-06-06 16:27:42 +08:00
|
|
|
router.HandleFunc("/api/forgot", forgotHandler).Methods("POST")
|
|
|
|
router.HandleFunc("/api/reset", resetHandler).Methods("POST")
|
|
|
|
|
2019-02-19 05:30:54 +08:00
|
|
|
router.HandleFunc("/api/email/get", emailGetHandler).Methods("POST")
|
|
|
|
router.HandleFunc("/api/email/update", emailUpdateHandler).Methods("POST")
|
2019-02-19 05:43:18 +08:00
|
|
|
router.HandleFunc("/api/email/moderate", emailModerateHandler).Methods("GET")
|
2018-05-27 22:40:42 +08:00
|
|
|
|
|
|
|
router.HandleFunc("/api/oauth/google/redirect", googleRedirectHandler).Methods("GET")
|
|
|
|
router.HandleFunc("/api/oauth/google/callback", googleCallbackHandler).Methods("GET")
|
|
|
|
|
2019-01-31 10:15:16 +08:00
|
|
|
router.HandleFunc("/api/oauth/github/redirect", githubRedirectHandler).Methods("GET")
|
|
|
|
router.HandleFunc("/api/oauth/github/callback", githubCallbackHandler).Methods("GET")
|
|
|
|
|
2022-10-11 00:01:30 +08:00
|
|
|
router.HandleFunc("/api/oauth/authentik/redirect", authentikRedirectHandler).Methods("GET")
|
|
|
|
router.HandleFunc("/api/oauth/authentik/callback", authentikCallbackHandler).Methods("GET")
|
|
|
|
|
2019-02-23 10:23:24 +08:00
|
|
|
router.HandleFunc("/api/oauth/twitter/redirect", twitterRedirectHandler).Methods("GET")
|
|
|
|
router.HandleFunc("/api/oauth/twitter/callback", twitterCallbackHandler).Methods("GET")
|
|
|
|
|
2019-02-23 10:54:08 +08:00
|
|
|
router.HandleFunc("/api/oauth/gitlab/redirect", gitlabRedirectHandler).Methods("GET")
|
|
|
|
router.HandleFunc("/api/oauth/gitlab/callback", gitlabCallbackHandler).Methods("GET")
|
|
|
|
|
2019-04-21 08:34:25 +08:00
|
|
|
router.HandleFunc("/api/oauth/sso/redirect", ssoRedirectHandler).Methods("GET")
|
|
|
|
router.HandleFunc("/api/oauth/sso/callback", ssoCallbackHandler).Methods("GET")
|
|
|
|
|
2018-05-27 22:40:42 +08:00
|
|
|
router.HandleFunc("/api/comment/new", commentNewHandler).Methods("POST")
|
2019-05-16 01:46:51 +08:00
|
|
|
router.HandleFunc("/api/comment/edit", commentEditHandler).Methods("POST")
|
2018-05-27 22:40:42 +08:00
|
|
|
router.HandleFunc("/api/comment/list", commentListHandler).Methods("POST")
|
2018-09-23 12:42:16 +08:00
|
|
|
router.HandleFunc("/api/comment/count", commentCountHandler).Methods("POST")
|
2018-05-27 22:40:42 +08:00
|
|
|
router.HandleFunc("/api/comment/vote", commentVoteHandler).Methods("POST")
|
|
|
|
router.HandleFunc("/api/comment/approve", commentApproveHandler).Methods("POST")
|
|
|
|
router.HandleFunc("/api/comment/delete", commentDeleteHandler).Methods("POST")
|
|
|
|
|
2018-07-05 13:06:52 +08:00
|
|
|
router.HandleFunc("/api/page/update", pageUpdateHandler).Methods("POST")
|
|
|
|
|
2018-05-27 22:40:42 +08:00
|
|
|
return nil
|
|
|
|
}
|