mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-12 15:04:38 +01:00
Renamed signv2 to api and enabled it by default
This commit is contained in:
@@ -195,8 +195,8 @@
|
|||||||
"Enabled": true,
|
"Enabled": true,
|
||||||
"Port": 53312
|
"Port": 53312
|
||||||
},
|
},
|
||||||
"SignV2": {
|
"API": {
|
||||||
"Enabled": false,
|
"Enabled": true,
|
||||||
"Port": 8080,
|
"Port": 8080,
|
||||||
"PatchServer": "",
|
"PatchServer": "",
|
||||||
"Banners": [],
|
"Banners": [],
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ type Config struct {
|
|||||||
Courses []Course
|
Courses []Course
|
||||||
Database Database
|
Database Database
|
||||||
Sign Sign
|
Sign Sign
|
||||||
SignV2 SignV2
|
API API
|
||||||
Channel Channel
|
Channel Channel
|
||||||
Entrance Entrance
|
Entrance Entrance
|
||||||
}
|
}
|
||||||
@@ -237,29 +237,29 @@ type Sign struct {
|
|||||||
Port int
|
Port int
|
||||||
}
|
}
|
||||||
|
|
||||||
// SignV2 holds the new sign server config
|
// API holds server config
|
||||||
type SignV2 struct {
|
type API struct {
|
||||||
Enabled bool
|
Enabled bool
|
||||||
Port int
|
Port int
|
||||||
PatchServer string
|
PatchServer string
|
||||||
Banners []SignV2Banner
|
Banners []APISignBanner
|
||||||
Messages []SignV2Message
|
Messages []APISignMessage
|
||||||
Links []SignV2Link
|
Links []APISignLink
|
||||||
}
|
}
|
||||||
|
|
||||||
type SignV2Banner struct {
|
type APISignBanner struct {
|
||||||
Src string `json:"src"` // Displayed image URL
|
Src string `json:"src"` // Displayed image URL
|
||||||
Link string `json:"link"` // Link accessed on click
|
Link string `json:"link"` // Link accessed on click
|
||||||
}
|
}
|
||||||
|
|
||||||
type SignV2Message struct {
|
type APISignMessage struct {
|
||||||
Message string `json:"message"` // Displayed message
|
Message string `json:"message"` // Displayed message
|
||||||
Date int64 `json:"date"` // Displayed date
|
Date int64 `json:"date"` // Displayed date
|
||||||
Kind int `json:"kind"` // 0 for 'Default', 1 for 'New'
|
Kind int `json:"kind"` // 0 for 'Default', 1 for 'New'
|
||||||
Link string `json:"link"` // Link accessed on click
|
Link string `json:"link"` // Link accessed on click
|
||||||
}
|
}
|
||||||
|
|
||||||
type SignV2Link struct {
|
type APISignLink struct {
|
||||||
Name string `json:"name"` // Displayed name
|
Name string `json:"name"` // Displayed name
|
||||||
Icon string `json:"icon"` // Displayed icon. It will be cast as a monochrome color as long as it is transparent.
|
Icon string `json:"icon"` // Displayed icon. It will be cast as a monochrome color as long as it is transparent.
|
||||||
Link string `json:"link"` // Link accessed on click
|
Link string `json:"link"` // Link accessed on click
|
||||||
|
|||||||
22
main.go
22
main.go
@@ -10,11 +10,11 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"erupe-ce/server/api"
|
||||||
"erupe-ce/server/channelserver"
|
"erupe-ce/server/channelserver"
|
||||||
"erupe-ce/server/discordbot"
|
"erupe-ce/server/discordbot"
|
||||||
"erupe-ce/server/entranceserver"
|
"erupe-ce/server/entranceserver"
|
||||||
"erupe-ce/server/signserver"
|
"erupe-ce/server/signserver"
|
||||||
"erupe-ce/server/signv2server"
|
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
_ "github.com/lib/pq"
|
_ "github.com/lib/pq"
|
||||||
@@ -181,21 +181,21 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// New Sign server
|
// New Sign server
|
||||||
var newSignServer *signv2server.Server
|
var ApiServer *api.APIServer
|
||||||
if config.SignV2.Enabled {
|
if config.API.Enabled {
|
||||||
newSignServer = signv2server.NewServer(
|
ApiServer = api.NewAPIServer(
|
||||||
&signv2server.Config{
|
&api.Config{
|
||||||
Logger: logger.Named("sign"),
|
Logger: logger.Named("sign"),
|
||||||
ErupeConfig: _config.ErupeConfig,
|
ErupeConfig: _config.ErupeConfig,
|
||||||
DB: db,
|
DB: db,
|
||||||
})
|
})
|
||||||
err = newSignServer.Start()
|
err = ApiServer.Start()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
preventClose(fmt.Sprintf("SignV2: Failed to start, %s", err.Error()))
|
preventClose(fmt.Sprintf("API: Failed to start, %s", err.Error()))
|
||||||
}
|
}
|
||||||
logger.Info("SignV2: Started successfully")
|
logger.Info("API: Started successfully")
|
||||||
} else {
|
} else {
|
||||||
logger.Info("SignV2: Disabled")
|
logger.Info("API: Disabled")
|
||||||
}
|
}
|
||||||
|
|
||||||
var channels []*channelserver.Server
|
var channels []*channelserver.Server
|
||||||
@@ -273,8 +273,8 @@ func main() {
|
|||||||
signServer.Shutdown()
|
signServer.Shutdown()
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.SignV2.Enabled {
|
if config.API.Enabled {
|
||||||
newSignServer.Shutdown()
|
ApiServer.Shutdown()
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.Entrance.Enabled {
|
if config.Entrance.Enabled {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package signv2server
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -21,8 +21,8 @@ type Config struct {
|
|||||||
ErupeConfig *_config.Config
|
ErupeConfig *_config.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
// Server is the MHF custom launcher sign server.
|
// APIServer is Erupes Standard API interface
|
||||||
type Server struct {
|
type APIServer struct {
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
logger *zap.Logger
|
logger *zap.Logger
|
||||||
erupeConfig *_config.Config
|
erupeConfig *_config.Config
|
||||||
@@ -31,9 +31,9 @@ type Server struct {
|
|||||||
isShuttingDown bool
|
isShuttingDown bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewServer creates a new Server type.
|
// NewAPIServer creates a new Server type.
|
||||||
func NewServer(config *Config) *Server {
|
func NewAPIServer(config *Config) *APIServer {
|
||||||
s := &Server{
|
s := &APIServer{
|
||||||
logger: config.Logger,
|
logger: config.Logger,
|
||||||
erupeConfig: config.ErupeConfig,
|
erupeConfig: config.ErupeConfig,
|
||||||
db: config.DB,
|
db: config.DB,
|
||||||
@@ -43,7 +43,7 @@ func NewServer(config *Config) *Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Start starts the server in a new goroutine.
|
// Start starts the server in a new goroutine.
|
||||||
func (s *Server) Start() error {
|
func (s *APIServer) Start() error {
|
||||||
// Set up the routes responsible for serving the launcher HTML, serverlist, unique name check, and JP auth.
|
// Set up the routes responsible for serving the launcher HTML, serverlist, unique name check, and JP auth.
|
||||||
r := mux.NewRouter()
|
r := mux.NewRouter()
|
||||||
r.HandleFunc("/launcher", s.Launcher)
|
r.HandleFunc("/launcher", s.Launcher)
|
||||||
@@ -56,7 +56,7 @@ func (s *Server) Start() error {
|
|||||||
r.HandleFunc("/api/ss/bbs/{id}", s.ScreenShotGet)
|
r.HandleFunc("/api/ss/bbs/{id}", s.ScreenShotGet)
|
||||||
handler := handlers.CORS(handlers.AllowedHeaders([]string{"Content-Type"}))(r)
|
handler := handlers.CORS(handlers.AllowedHeaders([]string{"Content-Type"}))(r)
|
||||||
s.httpServer.Handler = handlers.LoggingHandler(os.Stdout, handler)
|
s.httpServer.Handler = handlers.LoggingHandler(os.Stdout, handler)
|
||||||
s.httpServer.Addr = fmt.Sprintf(":%d", s.erupeConfig.SignV2.Port)
|
s.httpServer.Addr = fmt.Sprintf(":%d", s.erupeConfig.API.Port)
|
||||||
|
|
||||||
serveError := make(chan error, 1)
|
serveError := make(chan error, 1)
|
||||||
go func() {
|
go func() {
|
||||||
@@ -76,7 +76,7 @@ func (s *Server) Start() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Shutdown exits the server gracefully.
|
// Shutdown exits the server gracefully.
|
||||||
func (s *Server) Shutdown() {
|
func (s *APIServer) Shutdown() {
|
||||||
s.logger.Debug("Shutting down")
|
s.logger.Debug("Shutting down")
|
||||||
|
|
||||||
s.Lock()
|
s.Lock()
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package signv2server
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -10,7 +10,7 @@ import (
|
|||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (s *Server) createNewUser(ctx context.Context, username string, password string) (uint32, uint32, error) {
|
func (s *APIServer) createNewUser(ctx context.Context, username string, password string) (uint32, uint32, error) {
|
||||||
// Create salted hash of user password
|
// Create salted hash of user password
|
||||||
passwordHash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
|
passwordHash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -32,7 +32,7 @@ func (s *Server) createNewUser(ctx context.Context, username string, password st
|
|||||||
return id, rights, err
|
return id, rights, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) createLoginToken(ctx context.Context, uid uint32) (uint32, string, error) {
|
func (s *APIServer) createLoginToken(ctx context.Context, uid uint32) (uint32, string, error) {
|
||||||
loginToken := token.Generate(16)
|
loginToken := token.Generate(16)
|
||||||
var tid uint32
|
var tid uint32
|
||||||
err := s.db.QueryRowContext(ctx, "INSERT INTO sign_sessions (user_id, token) VALUES ($1, $2) RETURNING id", uid, loginToken).Scan(&tid)
|
err := s.db.QueryRowContext(ctx, "INSERT INTO sign_sessions (user_id, token) VALUES ($1, $2) RETURNING id", uid, loginToken).Scan(&tid)
|
||||||
@@ -42,7 +42,7 @@ func (s *Server) createLoginToken(ctx context.Context, uid uint32) (uint32, stri
|
|||||||
return tid, loginToken, nil
|
return tid, loginToken, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) userIDFromToken(ctx context.Context, token string) (uint32, error) {
|
func (s *APIServer) userIDFromToken(ctx context.Context, token string) (uint32, error) {
|
||||||
var userID uint32
|
var userID uint32
|
||||||
err := s.db.QueryRowContext(ctx, "SELECT user_id FROM sign_sessions WHERE token = $1", token).Scan(&userID)
|
err := s.db.QueryRowContext(ctx, "SELECT user_id FROM sign_sessions WHERE token = $1", token).Scan(&userID)
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
@@ -53,7 +53,7 @@ func (s *Server) userIDFromToken(ctx context.Context, token string) (uint32, err
|
|||||||
return userID, nil
|
return userID, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) createCharacter(ctx context.Context, userID uint32) (Character, error) {
|
func (s *APIServer) createCharacter(ctx context.Context, userID uint32) (Character, error) {
|
||||||
var character Character
|
var character Character
|
||||||
err := s.db.GetContext(ctx, &character,
|
err := s.db.GetContext(ctx, &character,
|
||||||
"SELECT id, name, is_female, weapon_type, hr, gr, last_login FROM characters WHERE is_new_character = true AND user_id = $1 LIMIT 1",
|
"SELECT id, name, is_female, weapon_type, hr, gr, last_login FROM characters WHERE is_new_character = true AND user_id = $1 LIMIT 1",
|
||||||
@@ -78,7 +78,7 @@ func (s *Server) createCharacter(ctx context.Context, userID uint32) (Character,
|
|||||||
return character, err
|
return character, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) deleteCharacter(ctx context.Context, userID uint32, charID uint32) error {
|
func (s *APIServer) deleteCharacter(ctx context.Context, userID uint32, charID uint32) error {
|
||||||
var isNew bool
|
var isNew bool
|
||||||
err := s.db.QueryRow("SELECT is_new_character FROM characters WHERE id = $1", charID).Scan(&isNew)
|
err := s.db.QueryRow("SELECT is_new_character FROM characters WHERE id = $1", charID).Scan(&isNew)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -92,7 +92,7 @@ func (s *Server) deleteCharacter(ctx context.Context, userID uint32, charID uint
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) getCharactersForUser(ctx context.Context, uid uint32) ([]Character, error) {
|
func (s *APIServer) getCharactersForUser(ctx context.Context, uid uint32) ([]Character, error) {
|
||||||
var characters []Character
|
var characters []Character
|
||||||
err := s.db.SelectContext(
|
err := s.db.SelectContext(
|
||||||
ctx, &characters, `
|
ctx, &characters, `
|
||||||
@@ -107,7 +107,7 @@ func (s *Server) getCharactersForUser(ctx context.Context, uid uint32) ([]Charac
|
|||||||
return characters, nil
|
return characters, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) getReturnExpiry(uid uint32) time.Time {
|
func (s *APIServer) getReturnExpiry(uid uint32) time.Time {
|
||||||
var returnExpiry, lastLogin time.Time
|
var returnExpiry, lastLogin time.Time
|
||||||
s.db.Get(&lastLogin, "SELECT COALESCE(last_login, now()) FROM users WHERE id=$1", uid)
|
s.db.Get(&lastLogin, "SELECT COALESCE(last_login, now()) FROM users WHERE id=$1", uid)
|
||||||
if time.Now().Add((time.Hour * 24) * -90).After(lastLogin) {
|
if time.Now().Add((time.Hour * 24) * -90).After(lastLogin) {
|
||||||
@@ -124,7 +124,7 @@ func (s *Server) getReturnExpiry(uid uint32) time.Time {
|
|||||||
return returnExpiry
|
return returnExpiry
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) exportSave(ctx context.Context, uid uint32, cid uint32) (map[string]interface{}, error) {
|
func (s *APIServer) exportSave(ctx context.Context, uid uint32, cid uint32) (map[string]interface{}, error) {
|
||||||
row := s.db.QueryRowxContext(ctx, "SELECT * FROM characters WHERE id=$1 AND user_id=$2", cid, uid)
|
row := s.db.QueryRowxContext(ctx, "SELECT * FROM characters WHERE id=$1 AND user_id=$2", cid, uid)
|
||||||
result := make(map[string]interface{})
|
result := make(map[string]interface{})
|
||||||
err := row.MapScan(result)
|
err := row.MapScan(result)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package signv2server
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
@@ -30,9 +30,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type LauncherResponse struct {
|
type LauncherResponse struct {
|
||||||
Banners []_config.SignV2Banner `json:"banners"`
|
Banners []_config.APISignBanner `json:"banners"`
|
||||||
Messages []_config.SignV2Message `json:"messages"`
|
Messages []_config.APISignMessage `json:"messages"`
|
||||||
Links []_config.SignV2Link `json:"links"`
|
Links []_config.APISignLink `json:"links"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
@@ -75,7 +75,7 @@ type ExportData struct {
|
|||||||
Character map[string]interface{} `json:"character"`
|
Character map[string]interface{} `json:"character"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) newAuthData(userID uint32, userRights uint32, userTokenID uint32, userToken string, characters []Character) AuthData {
|
func (s *APIServer) newAuthData(userID uint32, userRights uint32, userTokenID uint32, userToken string, characters []Character) AuthData {
|
||||||
resp := AuthData{
|
resp := AuthData{
|
||||||
CurrentTS: uint32(channelserver.TimeAdjusted().Unix()),
|
CurrentTS: uint32(channelserver.TimeAdjusted().Unix()),
|
||||||
ExpiryTS: uint32(s.getReturnExpiry(userID).Unix()),
|
ExpiryTS: uint32(s.getReturnExpiry(userID).Unix()),
|
||||||
@@ -86,7 +86,7 @@ func (s *Server) newAuthData(userID uint32, userRights uint32, userTokenID uint3
|
|||||||
Token: userToken,
|
Token: userToken,
|
||||||
},
|
},
|
||||||
Characters: characters,
|
Characters: characters,
|
||||||
PatchServer: s.erupeConfig.SignV2.PatchServer,
|
PatchServer: s.erupeConfig.API.PatchServer,
|
||||||
Notices: []string{},
|
Notices: []string{},
|
||||||
}
|
}
|
||||||
if s.erupeConfig.DebugOptions.MaxLauncherHR {
|
if s.erupeConfig.DebugOptions.MaxLauncherHR {
|
||||||
@@ -112,16 +112,16 @@ func (s *Server) newAuthData(userID uint32, userRights uint32, userTokenID uint3
|
|||||||
return resp
|
return resp
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) Launcher(w http.ResponseWriter, r *http.Request) {
|
func (s *APIServer) Launcher(w http.ResponseWriter, r *http.Request) {
|
||||||
var respData LauncherResponse
|
var respData LauncherResponse
|
||||||
respData.Banners = s.erupeConfig.SignV2.Banners
|
respData.Banners = s.erupeConfig.API.Banners
|
||||||
respData.Messages = s.erupeConfig.SignV2.Messages
|
respData.Messages = s.erupeConfig.API.Messages
|
||||||
respData.Links = s.erupeConfig.SignV2.Links
|
respData.Links = s.erupeConfig.API.Links
|
||||||
w.Header().Add("Content-Type", "application/json")
|
w.Header().Add("Content-Type", "application/json")
|
||||||
json.NewEncoder(w).Encode(respData)
|
json.NewEncoder(w).Encode(respData)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) Login(w http.ResponseWriter, r *http.Request) {
|
func (s *APIServer) Login(w http.ResponseWriter, r *http.Request) {
|
||||||
ctx := r.Context()
|
ctx := r.Context()
|
||||||
var reqData struct {
|
var reqData struct {
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
@@ -173,7 +173,7 @@ func (s *Server) Login(w http.ResponseWriter, r *http.Request) {
|
|||||||
json.NewEncoder(w).Encode(respData)
|
json.NewEncoder(w).Encode(respData)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) Register(w http.ResponseWriter, r *http.Request) {
|
func (s *APIServer) Register(w http.ResponseWriter, r *http.Request) {
|
||||||
ctx := r.Context()
|
ctx := r.Context()
|
||||||
var reqData struct {
|
var reqData struct {
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
@@ -213,7 +213,7 @@ func (s *Server) Register(w http.ResponseWriter, r *http.Request) {
|
|||||||
json.NewEncoder(w).Encode(respData)
|
json.NewEncoder(w).Encode(respData)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) CreateCharacter(w http.ResponseWriter, r *http.Request) {
|
func (s *APIServer) CreateCharacter(w http.ResponseWriter, r *http.Request) {
|
||||||
ctx := r.Context()
|
ctx := r.Context()
|
||||||
var reqData struct {
|
var reqData struct {
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
@@ -242,7 +242,7 @@ func (s *Server) CreateCharacter(w http.ResponseWriter, r *http.Request) {
|
|||||||
json.NewEncoder(w).Encode(character)
|
json.NewEncoder(w).Encode(character)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) DeleteCharacter(w http.ResponseWriter, r *http.Request) {
|
func (s *APIServer) DeleteCharacter(w http.ResponseWriter, r *http.Request) {
|
||||||
ctx := r.Context()
|
ctx := r.Context()
|
||||||
var reqData struct {
|
var reqData struct {
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
@@ -267,7 +267,7 @@ func (s *Server) DeleteCharacter(w http.ResponseWriter, r *http.Request) {
|
|||||||
json.NewEncoder(w).Encode(struct{}{})
|
json.NewEncoder(w).Encode(struct{}{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) ExportSave(w http.ResponseWriter, r *http.Request) {
|
func (s *APIServer) ExportSave(w http.ResponseWriter, r *http.Request) {
|
||||||
ctx := r.Context()
|
ctx := r.Context()
|
||||||
var reqData struct {
|
var reqData struct {
|
||||||
Token string `json:"token"`
|
Token string `json:"token"`
|
||||||
@@ -295,7 +295,7 @@ func (s *Server) ExportSave(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.Header().Add("Content-Type", "application/json")
|
w.Header().Add("Content-Type", "application/json")
|
||||||
json.NewEncoder(w).Encode(save)
|
json.NewEncoder(w).Encode(save)
|
||||||
}
|
}
|
||||||
func (s *Server) ScreenShotGet(w http.ResponseWriter, r *http.Request) {
|
func (s *APIServer) ScreenShotGet(w http.ResponseWriter, r *http.Request) {
|
||||||
// Get the 'id' parameter from the URL
|
// Get the 'id' parameter from the URL
|
||||||
vars := mux.Vars(r)
|
vars := mux.Vars(r)
|
||||||
token := vars["id"]
|
token := vars["id"]
|
||||||
@@ -321,7 +321,7 @@ func (s *Server) ScreenShotGet(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (s *Server) ScreenShot(w http.ResponseWriter, r *http.Request) {
|
func (s *APIServer) ScreenShot(w http.ResponseWriter, r *http.Request) {
|
||||||
// Create a struct representing the XML result
|
// Create a struct representing the XML result
|
||||||
type Result struct {
|
type Result struct {
|
||||||
XMLName xml.Name `xml:"result"`
|
XMLName xml.Name `xml:"result"`
|
||||||
Reference in New Issue
Block a user