2015-02-11 04:40:44 +00:00
{{define "where"}}
< html >
< head >
< title > $ where< / title >
< link type = "text/css" rel = "stylesheet" href = "tilde.css" / >
< style type = "text/css" >
div.user {
margin: 0;
2015-02-11 05:09:10 +00:00
width: 50em;
2015-02-11 04:40:44 +00:00
}
div.user h2 {
margin: 0;
2015-02-18 05:26:31 +00:00
padding: 4px 0;
}
div.user h2 a {
padding-top: 4px;
padding-bottom: 4px;
2015-02-11 04:40:44 +00:00
}
2015-02-11 05:09:10 +00:00
span.time {
2015-02-18 05:26:31 +00:00
margin-top: 10px;
2015-02-11 05:09:10 +00:00
float: right;
color: #999;
}
2015-02-18 05:26:31 +00:00
iframe {
width: 100%;
height: 50em;
}
p.emph {
font-size: 1.2em;
}
2015-02-11 04:40:44 +00:00
< / style >
< / head >
< body id = "hello" class = "user-list" >
< h1 > $ where< / h1 > < span class = "updated" > < a href = "/~bear/" > ↑ up< / a > < / span >
< p > Last Updated: < time datetime = "{{.Updated}}" > {{.UpdatedForHumans}}< / time > < / p >
2015-02-19 00:27:14 +00:00
< h3 > Users online now< / h3 >
2015-02-11 04:40:44 +00:00
{{range .Users}}
< div class = "user" >
2015-02-11 05:09:10 +00:00
< h2 > < a href = "/~{{.Name}}/" > ~{{.Name}}< / a > < / h2 > < span class = "location" > {{Location .Region .Country}} < / span > < span class = "time" > {{.CurrentTime}}< / span >
2015-02-11 04:40:44 +00:00
< / div >
{{end}}
2015-02-19 00:27:14 +00:00
< h3 > To add yourself< / h3 >
< p >
< strong > Anonymously< / strong > : create a `.somewhere` file in your home dir with < code > touch ~/.somewhere< / code >
< / p >
< p >
< strong > Publicly< / strong > : create a `.here` file in your home dir with < code > touch ~/.here< / code >
< / p >
< h3 > Map - < a href = "/~bear/map.html" > full screen< / a > - < a href = "/~bear/where.json" > data< / a > < / h3 >
2015-02-18 05:26:31 +00:00
< iframe src = "/~bear/map.html" > < / iframe >
2015-02-18 05:48:28 +00:00
< h3 > How does it work?< / h3 >
2015-02-19 00:27:14 +00:00
< p > Every 15 minutes this program runs `who --ips` and then looks up IP geo info on opted-in, logged in users. It hits Google's geocode API with the "[Region], [Country]" data it found to get general coordinates, and generates < a href = "where.json" > this data< / a > , stripping out usernames for anonymous users. When viewing the map, an AJAJ request is made to get the data and the points are added to the map.< / p >
< p style = "margin-bottom: 4em;" > You can see for yourself in the < a href = "https://github.com/thebaer/tildes/blob/master/where/where.go" > GitHub project< / a > , where contributions are welcome!< / p >
2015-02-18 05:48:28 +00:00
2015-02-18 05:26:31 +00:00
2015-02-11 04:40:44 +00:00
< / body >
< / html >
{{end}}