<commit_before>package api

import (
	"crypto/md5"
	"crypto/sha1"
	"net/http"
	"os"

	"github.com/FederationOfFathers/dashboard/db"
	"github.com/gorilla/handlers"
	"github.com/gorilla/mux"
	"github.com/gorilla/securecookie"
	"go.uber.org/zap"
)

var ListenOn = ":8866"
var Router = mux.NewRouter()
var Logger *zap.Logger

var DB *db.DB

func Run() {
	jwtSecretBytes = []byte(JWTSecret)
	s := sha1.New()
	m := md5.New()
	s.Write(jwtSecretBytes)
	m.Write(jwtSecretBytes)
	cookie = securecookie.New(s.Sum(nil), m.Sum(nil))
	Logger.Fatal(
		"error starting API http server",
		zap.String("listenOn", ListenOn),
		zap.Error(http.ListenAndServe(ListenOn,
			handlers.ProxyHeaders(
				handlers.CompressHandler(
					handlers.CombinedLoggingHandler(os.Stdout,
						handlers.CORS(
							handlers.AllowCredentials(),
							handlers.AllowedHeaders([]string{
								"Content-Type",
								"Authorization",
								"X-Requested-With",
							}),
							handlers.AllowedMethods([]string{
								"GET",
								"HEAD",
								"PUT",
								"POST",
								"DELETE",
							}),
							handlers.AllowedOrigins([]string{
								"http://ui.fofgaming.com",
								"https://ui.fofgaming.com",
								"http://dev.fofgaming.com",
								"https://dev.fofgaming.com",
								"http://127.0.0.1",
								"http://localhost",
							}),
						)(Router),
					),
				),
			),
		)))
}<commit_msg>allow dev ui port<commit_after>package api

import (
	"crypto/md5"
	"crypto/sha1"
	"net/http"
	"os"

	"github.com/FederationOfFathers/dashboard/db"
	"github.com/gorilla/handlers"
	"github.com/gorilla/mux"
	"github.com/gorilla/securecookie"
	"go.uber.org/zap"
)

var ListenOn = ":8866"
var Router = mux.NewRouter()
var Logger *zap.Logger

var DB *db.DB

func Run() {
	jwtSecretBytes = []byte(JWTSecret)
	s := sha1.New()
	m := md5.New()
	s.Write(jwtSecretBytes)
	m.Write(jwtSecretBytes)
	cookie = securecookie.New(s.Sum(nil), m.Sum(nil))
	Logger.Fatal(
		"error starting API http server",
		zap.String("listenOn", ListenOn),
		zap.Error(http.ListenAndServe(ListenOn,
			handlers.ProxyHeaders(
				handlers.CompressHandler(
					handlers.CombinedLoggingHandler(os.Stdout,
						handlers.CORS(
							handlers.AllowCredentials(),
							handlers.AllowedHeaders([]string{
								"Content-Type",
								"Authorization",
								"X-Requested-With",
							}),
							handlers.AllowedMethods([]string{
								"GET",
								"HEAD",
								"PUT",
								"POST",
								"DELETE",
							}),
							handlers.AllowedOrigins([]string{
								"http://ui.fofgaming.com",
								"https://ui.fofgaming.com",
								"http://dev.fofgaming.com",
								"https://dev.fofgaming.com",
								"http://127.0.0.1:3000",
								"http://localhost:3000",
								"http://127.0.0.1",
								"http://localhost",
							}),
						)(Router),
					),
				),
			),
		)))
}
{'fraction_non_alphanumeric': 0.16996466431095406, 'fraction_numerical': 0.014840989399293287, 'mean_word_length': 2.5972045743329097, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 3, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '850509', 'n_tokens_mistral': 1412, 'n_tokens_neox': 1050, 'n_words': 143}