<commit_before>package main

import (
	"context"
	"flag"
	"fmt"
	"io"
	stdlog "log"
	"net/http"
	"net/url"
	"os"
	"path/filepath"
	"strconv"
	"strings"
	"time"

	"github.com/boltdb/bolt"
	"github.com/go-kit/kit/auth/basic"
	"github.com/go-kit/kit/log"
	httptransport "github.com/go-kit/kit/transport/http"
	"github.com/groob/finalizer/logutil"
	"github.com/micromdm/go4/env"
	"github.com/micromdm/go4/httputil"
	"github.com/micromdm/go4/version"
	scep "github.com/micromdm/scep/server"
	"github.com/pkg/errors"
	"golang.org/x/crypto/acme/autocert"

	"github.com/micromdm/micromdm/mdm"
	"github.com/micromdm/micromdm/mdm/enroll"
	httputil2 "github.com/micromdm/micromdm/pkg/httputil"
	"github.com/micromdm/micromdm/platform/apns"
	"github.com/micromdm/micromdm/platform/appstore"
	appsbuiltin "github.com/micromdm/micromdm/platform/appstore/builtin"
	"github.com/micromdm/micromdm/platform/blueprint"
	blueprintbuiltin "github.com/micromdm/micromdm/platform/blueprint/builtin"
	"github.com/micromdm/micromdm/platform/challenge"
	"github.com/micromdm/micromdm/platform/command"
	"github.com/micromdm/micromdm/platform/config"
	depapi "github.com/micromdm/micromdm/platform/dep"
	"github.com/micromdm/micromdm/platform/dep/sync"
	"github.com/micromdm/micromdm/platform/device"
	devicebuiltin "github.com/micromdm/micromdm/platform/device/builtin"
	"github.com/micromdm/micromdm/platform/profile"
	block "github.com/micromdm/micromdm/platform/remove"
	"github.com/micromdm/micromdm/platform/user"
	userbuiltin "github.com/micromdm/micromdm/platform/user/builtin"
	"github.com/micromdm/micromdm/server"
)

const homePage = `<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>MicroMDM</title>
  <style>
@font-face {
  font-family: system;
  font-weight: 900;
  src: local(".SFNSText-Heavy"), local(".HelveticaNeueDeskInterface-Heavy"), local(".LucidaGrandeUI"), local("Ubuntu Heavy"), local("Segoe UI Heavy"), local("Roboto-Heavy"), local("DroidSans"), local("Tahoma");
}

/* Global */
body {
  position: relative;
  font-family: "system", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
  margin: 0;
  text-align: center;
  font-size: 35px;
}

.enrollment {
  background: #4a9dff;
  color: #fff;
  padding: 15px;
  border-radius: 3px;
  font-size: 30px;
  text-decoration: none;
}
  </style>
 </head>
<body>

<h1>MicroMDM</h1>
<svg xmlns="http://www.w3.org/2000/svg" width="204" height="192" viewBox="0 0 51 48">
  <g fill="none" fill-rule="evenodd">
      <path fill="#366BE0" d="M34 38L0 20 34 0z"/>
      <path fill="#4A9DFF" d="M17 10l34 18-34 20z"/>
      <path fill="#80CFFF" d="M17 29L0 39l17 9zM51 28L34 38l17 9z"/>
  </g>
</svg>


<p><a class=enrollment href="mdm/enroll">Enroll a device</a></p>

</body>
</html>
`

func serve(args []string) error {
	flagset := flag.NewFlagSet("serve", flag.ExitOnError)
	var (
		flConfigPath             = flagset.String("config-path", env.String("MICROMDM_CONFIG_PATH", "/var/db/micromdm"), "Path to configuration directory")
		flServerURL              = flagset.String("server-url", env.String("MICROMDM_SERVER_URL", ""), "Public HTTPS url of your server")
		flAPIKey                 = flagset.String("api-key", env.String("MICROMDM_API_KEY", ""), "API Token for mdmctl command")
		flTLS                    = flagset.Bool("tls", env.Bool("MICROMDM_TLS", true), "Use https")<commit_msg>adding focusable and aria-hidden attributes (#751)<commit_after>package main

import (
	"context"
	"flag"
	"fmt"
	"io"
	stdlog "log"
	"net/http"
	"net/url"
	"os"
	"path/filepath"
	"strconv"
	"strings"
	"time"

	"github.com/boltdb/bolt"
	"github.com/go-kit/kit/auth/basic"
	"github.com/go-kit/kit/log"
	httptransport "github.com/go-kit/kit/transport/http"
	"github.com/groob/finalizer/logutil"
	"github.com/micromdm/go4/env"
	"github.com/micromdm/go4/httputil"
	"github.com/micromdm/go4/version"
	scep "github.com/micromdm/scep/server"
	"github.com/pkg/errors"
	"golang.org/x/crypto/acme/autocert"

	"github.com/micromdm/micromdm/mdm"
	"github.com/micromdm/micromdm/mdm/enroll"
	httputil2 "github.com/micromdm/micromdm/pkg/httputil"
	"github.com/micromdm/micromdm/platform/apns"
	"github.com/micromdm/micromdm/platform/appstore"
	appsbuiltin "github.com/micromdm/micromdm/platform/appstore/builtin"
	"github.com/micromdm/micromdm/platform/blueprint"
	blueprintbuiltin "github.com/micromdm/micromdm/platform/blueprint/builtin"
	"github.com/micromdm/micromdm/platform/challenge"
	"github.com/micromdm/micromdm/platform/command"
	"github.com/micromdm/micromdm/platform/config"
	depapi "github.com/micromdm/micromdm/platform/dep"
	"github.com/micromdm/micromdm/platform/dep/sync"
	"github.com/micromdm/micromdm/platform/device"
	devicebuiltin "github.com/micromdm/micromdm/platform/device/builtin"
	"github.com/micromdm/micromdm/platform/profile"
	block "github.com/micromdm/micromdm/platform/remove"
	"github.com/micromdm/micromdm/platform/user"
	userbuiltin "github.com/micromdm/micromdm/platform/user/builtin"
	"github.com/micromdm/micromdm/server"
)

const homePage = `<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>MicroMDM</title>
  <style>
@font-face {
  font-family: system;
  font-weight: 900;
  src: local(".SFNSText-Heavy"), local(".HelveticaNeueDeskInterface-Heavy"), local(".LucidaGrandeUI"), local("Ubuntu Heavy"), local("Segoe UI Heavy"), local("Roboto-Heavy"), local("DroidSans"), local("Tahoma");
}

/* Global */
body {
  position: relative;
  font-family: "system", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
  margin: 0;
  text-align: center;
  font-size: 35px;
}

.enrollment {
  background: #4a9dff;
  color: #fff;
  padding: 15px;
  border-radius: 3px;
  font-size: 30px;
  text-decoration: none;
}
  </style>
 </head>
<body>

<h1>MicroMDM</h1>
<svg xmlns="http://www.w3.org/2000/svg" width="204" height="192" viewBox="0 0 51 48" focusable="false" aria-hidden="true">
  <g fill="none" fill-rule="evenodd">
      <path fill="#366BE0" d="M34 38L0 20 34 0z"/>
      <path fill="#4A9DFF" d="M17 10l34 18-34 20z"/>
      <path fill="#80CFFF" d="M17 29L0 39l17 9zM51 28L34 38l17 9z"/>
  </g>
</svg>


<p><a class=enrollment href="mdm/enroll">Enroll a device</a></p>

</body>
</html>
`

func serve(args []string) error {
	flagset := flag.NewFlagSet("serve", flag.ExitOnError)
	var (
		flConfigPath             = flagset.String("config-path", env.String("MICROMDM_CONFIG_PATH", "/var/db/micromdm"), "Path to configuration directory")
		flServerURL              = flagset.String("server-url", env.String("MICROMDM_SERVER_URL", ""), "Public HTTPS url of your server")
		flAPIKey                 = flagset.String("api-key", env.String("MICROMDM_API_KEY", ""), "API Token for mdmctl command")
		flTLS                    = flagset.Bool("tls", env.Bool("MICROMDM_TLS", true), "Use https")
{'fraction_non_alphanumeric': 0.17076344707923655, 'fraction_numerical': 0.026171197223828803, 'mean_word_length': 4.542467948717949, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, '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': '5133999', 'n_tokens_mistral': 2915, 'n_tokens_neox': 2666, 'n_words': 412}