| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- 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)
- }
- 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)
- }
|