|
|
|
@ -1,22 +1,24 @@
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"cake_crm/internal/app"
|
|
|
|
|
"cake_crm/internal/modules/messenger/telegram"
|
|
|
|
|
"cake_crm/internal/modules/storage/storage_file"
|
|
|
|
|
"cake_crm/internal/services/cart"
|
|
|
|
|
"cake_crm/internal/services/order"
|
|
|
|
|
proto "cake_crm/proto"
|
|
|
|
|
"context"
|
|
|
|
|
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
|
"google.golang.org/grpc/credentials/insecure"
|
|
|
|
|
"log"
|
|
|
|
|
"net"
|
|
|
|
|
"net/http"
|
|
|
|
|
"os"
|
|
|
|
|
"strconv"
|
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
"github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
|
|
|
|
"google.golang.org/grpc"
|
|
|
|
|
"google.golang.org/grpc/credentials/insecure"
|
|
|
|
|
|
|
|
|
|
"cake_crm/internal/app"
|
|
|
|
|
"cake_crm/internal/modules/messenger/telegram"
|
|
|
|
|
"cake_crm/internal/modules/storage/storage_file"
|
|
|
|
|
"cake_crm/internal/services/cart"
|
|
|
|
|
"cake_crm/internal/services/order"
|
|
|
|
|
proto "cake_crm/proto"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
@ -102,6 +104,12 @@ func main() {
|
|
|
|
|
|
|
|
|
|
func cors(h http.Handler) http.Handler {
|
|
|
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
ua := r.Header.Get("User-Agent")
|
|
|
|
|
if !strings.HasPrefix(ua, "crabs") {
|
|
|
|
|
w.WriteHeader(403)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
|
|
|
|
w.Header().Set("Access-Control-Allow-Methods", "GET, POST, PATCH, DELETE")
|
|
|
|
|
w.Header().Set("Access-Control-Allow-Headers", "Accept, Content-Type, Content-Length, Accept-Encoding, Authorization, ResponseType")
|
|
|
|
|