Various helpers for the tildeverse.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

68 lignes
2.0 KiB

  1. {{define "where"}}
  2. <html>
  3. <head>
  4. <title>$ where</title>
  5. <link type="text/css" rel="stylesheet" href="tilde.css" />
  6. <style type="text/css">
  7. div.user {
  8. margin: 0;
  9. width: 50em;
  10. }
  11. div.user h2 {
  12. margin: 0;
  13. padding: 4px 0;
  14. }
  15. div.user h2 a {
  16. padding-top: 4px;
  17. padding-bottom: 4px;
  18. }
  19. span.time {
  20. margin-top: 10px;
  21. float: right;
  22. color: #999;
  23. }
  24. iframe {
  25. width: 100%;
  26. height: 50em;
  27. }
  28. p.emph {
  29. font-size: 1.2em;
  30. }
  31. </style>
  32. </head>
  33. <body id="hello" class="user-list">
  34. <h1>$ where</h1> <span class="updated"><a href="/~bear/">&uarr; up</a></span>
  35. <p>Last Updated: <time datetime="{{.Updated}}">{{.UpdatedForHumans}}</time></p>
  36. <h3>Users online now</h3>
  37. {{range .Users}}
  38. <div class="user">
  39. <h2><a href="/~{{.Name}}/">~{{.Name}}</a></h2> <span class="location">{{Location .Region .Country}} </span> <span class="time">{{.CurrentTime}}</span>
  40. </div>
  41. {{end}}
  42. <h3>To add yourself</h3>
  43. <p>
  44. <strong>Anonymously</strong>: create a `.somewhere` file in your home dir with <code>touch ~/.somewhere</code>
  45. </p>
  46. <p>
  47. <strong>Publicly</strong>: create a `.here` file in your home dir with <code>touch ~/.here</code>
  48. </p>
  49. <h3>Map - <a href="/~bear/map.html">full screen</a> - <a href="/~bear/where.json">data</a></h3>
  50. <iframe src="/~bear/map.html"></iframe>
  51. <h3>How does it work?</h3>
  52. <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>
  53. <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>
  54. </body>
  55. </html>
  56. {{end}}