This commit is contained in:
Aaron Meihm 2017-05-04 10:09:45 -05:00
Родитель 2e4636992c
Коммит d03adf8910
3 изменённых файлов: 79 добавлений и 3 удалений

60
page.go
Просмотреть файл

@ -24,7 +24,7 @@ var mainTmpl = `<html>
<div>
<h1>MIG self-service portal</h1>
</div>
<div>
<div class="intro">
<p>Welcome, <i>{{.RemoteUser}}.</i></p>
<p>This is the self-service portal for <a href="http://mig.mozilla.org">Mozilla
Investigator</a>. Here you can download MIG for your workstation devices, and create
@ -36,6 +36,7 @@ var mainTmpl = `<html>
displayed upon initial creation.</p>
</div>
<div>
<h2>Generate install keys</h2>
<table>
<thead>
<tr>
@ -49,12 +50,62 @@ var mainTmpl = `<html>
</tbody>
</table>
</div>
<div>
<h2>Download the MIG installer</h2>
<div>
<form id="osform" autocomplete=off>
<select id="osselect">
<option selected value="unset">Select an operating system...</option>
<option value="windows">Windows</option>
<option value="linux">Linux</option>
<option value="osx">Mac OSX</option>
</select>
</form>
</div>
<div class="osdet" id="windows">
<p>
Download the installer from <a href="{{.DownloadWin}}">{{.DownloadWin}}</a>
</p>
<p>
Run the installer, and enter your new key exactly as shown when prompted.
</p>
</div>
<div class="osdet" id="osx">
<p>
Download the installer from <a href="{{.DownloadOSX}}">{{.DownloadOSX}}</a>
</p>
<p>
Run the installer, and enter your new key exactly as shown when prompted.
</p>
</div>
<div class="osdet" id="linux">
<p>
Packages for Linux are available as either an RPM or a DEB package. On Linux, the
installation of MIG is not fully automated to better support various distributions.
Download the desired package format from a link below.
</p>
<p>
<li>RPM <a href="{{.DownloadLinuxRPM}}">{{.DownloadLinuxRPM}}</a>
<li>DEB <a href="{{.DownloadLinuxDEB}}">{{.DownloadLinuxDEB}}</a>
</p>
<p>
After installing the package, create /etc/mig/mig-loader.key and place your generated
key in this file. Following this, schedule /sbin/mig-loader to run periodically as root (for example
once per day), this will fetch the agent and keep it up to date. You can run it once manually
to initially kick the process off.
</p>
</div>
</div>
</body>
</html>
`
type templateData struct {
RemoteUser string
RemoteUser string
DownloadWin string
DownloadLinuxRPM string
DownloadLinuxDEB string
DownloadOSX string
}
func (t *templateData) importFromRequest(r requestDetails) {
@ -66,6 +117,11 @@ func renderMainPage(rdetails requestDetails) (string, error) {
tdata := templateData{}
tdata.importFromRequest(rdetails)
// Add additional data from the configuration file
tdata.DownloadWin = cfg.DownloadWin
tdata.DownloadOSX = cfg.DownloadOSX
tdata.DownloadLinuxRPM = cfg.DownloadLinuxRPM
tdata.DownloadLinuxDEB = cfg.DownloadLinuxDEB
t, err := template.New("main").Parse(mainTmpl)
if err != nil {
return "", err

Просмотреть файл

@ -7,9 +7,20 @@ h1 {
font-size: 24px;
}
p {
h2 {
font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace;
font-size: 16px;
}
p, li {
font-family: "Open Sans",sans-serif;
}
div.intro, div.osdet {
background-color: #e0e0e0;
border-radius: 25px;
max-width: 80%;
padding: 4px;
}
table, th, td {

Просмотреть файл

@ -99,6 +99,15 @@ function loadKeys() {
$.ajax({url: "/keystatus", success: keyParser});
}
function osDetails() {
$(".osdet").hide();
$("#osselect").change(function() {
$(".osdet").hide();
$("#" + $(this).val()).show();
});
}
$(document).ready(function() {
osDetails();
loadKeys();
});