<commit_before>package main

import (
	"./hostfile"
	"bufio"
	"code.google.com/p/gorilla/mux"
	"encoding/json"
	"fmt"
	"github.com/surma/gouuid"
	"github.com/surma/goappdata"
	"log"
	"net/http"
	"os"
	"os/exec"
	"strings"
)

var (
	blocklist = map[string]hostfile.Entry{}
)

func conditionalFailf(w http.ResponseWriter, cond bool, code int, sfmt string, v ...interface{}) bool {
	if cond {
		err := fmt.Sprintf(sfmt, v...)
		http.Error(w, err, code)
		log.Println(err)
	}
	return cond
}

func serveAPI(addr string) {
	r := mux.NewRouter()
	apirouter := r.PathPrefix("/api").Subrouter()
	apirouter.Path("/").Methods("GET").HandlerFunc(apiListHandler)
	apirouter.Path("/").Methods("POST").HandlerFunc(updateWrapper(apiAddHandler))
	apirouter.Path("/state").Methods("POST").HandlerFunc(authenticationWrapper(updateWrapper(apiSetStateHandler)))
	apirouter.Path("/state").Methods("GET").HandlerFunc(apiGetStateHandler)
	apirouter.Path("/{uuid:[0-9a-f-]+}").Methods("GET").HandlerFunc(apiListSingleHandler)
	apirouter.Path("/{uuid:[0-9a-f-]+}").Methods("DELETE").HandlerFunc(authenticationWrapper(updateWrapper(apiDeleteSingleHandler)))

	r.PathPrefix("/admin").Handler(http.StripPrefix("/admin", http.FileServer(http.Dir("./admin"))))

	e := http.ListenAndServe(addr, r)<commit_msg>Redirect from / to /admin<commit_after>package main

import (
	"./hostfile"
	"bufio"
	"code.google.com/p/gorilla/mux"
	"encoding/json"
	"fmt"
	"github.com/surma/gouuid"
	"github.com/surma/goappdata"
	"log"
	"net/http"
	"os"
	"os/exec"
	"strings"
)

var (
	blocklist = map[string]hostfile.Entry{}
)

func conditionalFailf(w http.ResponseWriter, cond bool, code int, sfmt string, v ...interface{}) bool {
	if cond {
		err := fmt.Sprintf(sfmt, v...)
		http.Error(w, err, code)
		log.Println(err)
	}
	return cond
}

func serveAPI(addr string) {
	r := mux.NewRouter()
	r.Path("/").Handler(http.RedirectHandler("/admin/", http.StatusMovedPermanently))
	apirouter := r.PathPrefix("/api").Subrouter()
	apirouter.Path("/").Methods("GET").HandlerFunc(apiListHandler)
	apirouter.Path("/").Methods("POST").HandlerFunc(updateWrapper(apiAddHandler))
	apirouter.Path("/state").Methods("POST").HandlerFunc(authenticationWrapper(updateWrapper(apiSetStateHandler)))
	apirouter.Path("/state").Methods("GET").HandlerFunc(apiGetStateHandler)
	apirouter.Path("/{uuid:[0-9a-f-]+}").Methods("GET").HandlerFunc(apiListSingleHandler)
	apirouter.Path("/{uuid:[0-9a-f-]+}").Methods("DELETE").HandlerFunc(authenticationWrapper(updateWrapper(apiDeleteSingleHandler)))

	r.PathPrefix("/admin/").Handler(http.StripPrefix("/admin", http.FileServer(http.Dir("./admin"))))

	e := http.ListenAndServe(addr, r)
{'fraction_non_alphanumeric': 0.19584905660377358, 'fraction_numerical': 0.0030188679245283017, 'mean_word_length': 5.976315789473684, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '4830323', 'n_tokens_mistral': 969, 'n_tokens_neox': 953, 'n_words': 122}