Show owner name on index page

Change-Id: Ic845283da88eea57a43a13ea13b2993070856102
This commit is contained in:
Brad Fitzpatrick 2012-12-11 18:41:23 -08:00
parent f0dfc6b6b7
commit abb0e307d6
4 changed files with 15 additions and 3 deletions

View File

@ -9,6 +9,7 @@
"/": {
"handler": "root",
"handlerArgs": {
"ownerName": ["_env", "${USER}-dev"],
"blobRoot": "/bs-and-maybe-also-index/",
"searchRoot": "/my-search/",
"stealth": false

View File

@ -20,6 +20,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"os/user"
"time"
"camlistore.org/pkg/auth"
@ -34,6 +35,8 @@ type RootHandler struct {
// clients.
Stealth bool
OwnerName string // for display purposes only
// URL prefixes (path or full URL) to the primary blob and
// search root.
BlobRoot string
@ -50,9 +53,14 @@ func init() {
}
func newRootFromConfig(ld blobserver.Loader, conf jsonconfig.Obj) (h http.Handler, err error) {
u, err := user.Current()
if err != nil {
return
}
root := &RootHandler{
BlobRoot: conf.OptionalString("blobRoot", ""),
SearchRoot: conf.OptionalString("searchRoot", ""),
OwnerName: conf.OptionalString("ownerName", u.Name),
}
root.Stealth = conf.OptionalBool("stealth", false)
if err = conf.Validate(); err != nil {
@ -106,8 +114,9 @@ func (rh *RootHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
func (rh *RootHandler) serveDiscovery(rw http.ResponseWriter, req *http.Request) {
m := map[string]interface{}{
"blobRoot": rh.BlobRoot,
"searchRoot": rh.SearchRoot,
"blobRoot": rh.BlobRoot,
"searchRoot": rh.SearchRoot,
"ownerName": rh.OwnerName,
}
if gener, ok := rh.Storage.(blobserver.Generationer); ok {
initTime, gen, err := gener.StorageGeneration()

View File

@ -11,7 +11,7 @@
<link rel="stylesheet" href="index.css">
</head>
<body class="camli-ui-index">
<h1>Recent Permanodes</h1>
<h1 id="topTitle">Recent Permanodes</h1>
<div id='toolbar'>
<input type='button' id='btnList' value="list"><input type='button' id='btnThumbs' value="thm">

View File

@ -28,6 +28,8 @@ function indexOnLoad() {
selGo.addEventListener("change", function(e) {
window.location = goTargets[selGo.value];
});
setTextContent($("topTitle"), Camli.config.ownerName + "'s Vault");
}
var lastSelIndex = 0;