| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- package main
- import (
- "net/http"
- )
- func init() {
- http.Handle("/", http.FileServer(http.Dir("/root/go/src/iaun.cn/sendpackage/static/")))
- // user+auth
- http.HandleFunc("/api/auth/login", loginHandler)
- http.HandleFunc("/api/auth/login/cookie", cookieLoginHandler)
- http.HandleFunc("/api/auth/register", registerHandler)
- http.HandleFunc("/api/user/get", getUserInfoHandler)
- // url
- http.HandleFunc("/api/url/set", setUrlHandler)
- http.HandleFunc("/api/url/get", getUrlHandler)
- // ak sk
- http.HandleFunc("/api/key/set", setKeyHandler)
- http.HandleFunc("/api/key/get", getKeyHandler)
- // log
- http.HandleFunc("/api/log/get", getLogHandler)
- // http.HandleFunc("/api/log/get/admin", getLogAdminHandler)
- http.HandleFunc("/api/log/get/details", getLogDetailsHandler)
- // admin
- http.HandleFunc("/api/admin/login", adminLoginHandler)
- http.HandleFunc("/api/admin/get", adminGetDataHandler)
- http.HandleFunc("/api/admin/login/cookie", adminCookieLoginHandler)
- http.HandleFunc("/api/admin/key/get", adminGetKeyHandler)
- }
- func loginHandler(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- f_login(w, r)
- }
- func cookieLoginHandler(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- f_cookieLogin(w, r)
- }
- func registerHandler(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- f_register(w, r)
- }
- func getUserInfoHandler(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- f_getUserInfo(w, r)
- }
- func setUrlHandler(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- f_setUrl(w, r)
- }
- func getUrlHandler(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- f_getUrl(w, r)
- }
- func setKeyHandler(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- f_setKey(w, r)
- }
- func getKeyHandler(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- f_getKey(w, r)
- }
- func getLogHandler(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- f_getLog(w, r)
- }
- // func getLogAdminHandler(w http.ResponseWriter, r *http.Request) {
- // w.Header().Set("Content-Type", "application/json")
- // f_getLogAdmin(w, r)
- // }
- func getLogDetailsHandler(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- f_getLogDetails(w, r)
- }
- func adminLoginHandler(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- f_adminLogin(w, r)
- }
- func adminGetDataHandler(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- f_adminGetData(w, r)
- }
- func adminCookieLoginHandler(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- f_adminCookieLogin(w, r)
- }
- func adminGetKeyHandler(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "application/json")
- f_adminGetKey(w, r)
- }
|