mirror of https://github.com/perkeep/perkeep.git
include file modtimes in filembed
Change-Id: I9255071c163664bd9b00786df65e630668e227d0
This commit is contained in:
parent
00be809cde
commit
a98c59f082
|
@ -18,7 +18,6 @@ package fileembed
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
|
@ -28,8 +27,6 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
var binaryModTime = statBinaryModTime()
|
||||
|
||||
type Files struct {
|
||||
// Optional environment variable key to override
|
||||
OverrideEnv string
|
||||
|
@ -42,22 +39,32 @@ type Files struct {
|
|||
SlurpToMemory bool
|
||||
|
||||
lk sync.Mutex
|
||||
file map[string]string
|
||||
file map[string]*staticFile
|
||||
}
|
||||
|
||||
type staticFile struct {
|
||||
name string
|
||||
contents string
|
||||
modtime time.Time
|
||||
}
|
||||
|
||||
// Add adds a file to the file set.
|
||||
func (f *Files) Add(filename, body string) {
|
||||
func (f *Files) Add(filename, contents string, modtime time.Time) {
|
||||
f.lk.Lock()
|
||||
defer f.lk.Unlock()
|
||||
f.add(filename, body)
|
||||
f.add(filename, &staticFile{
|
||||
name: filename,
|
||||
contents: contents,
|
||||
modtime: modtime,
|
||||
})
|
||||
}
|
||||
|
||||
// f.lk must be locked
|
||||
func (f *Files) add(filename, body string) {
|
||||
func (f *Files) add(filename string, sf *staticFile) {
|
||||
if f.file == nil {
|
||||
f.file = make(map[string]string)
|
||||
f.file = make(map[string]*staticFile)
|
||||
}
|
||||
f.file[filename] = body
|
||||
f.file[filename] = sf
|
||||
}
|
||||
|
||||
func (f *Files) Open(filename string) (http.File, error) {
|
||||
|
@ -66,11 +73,11 @@ func (f *Files) Open(filename string) (http.File, error) {
|
|||
}
|
||||
f.lk.Lock()
|
||||
defer f.lk.Unlock()
|
||||
s, ok := f.file[filename]
|
||||
sf, ok := f.file[filename]
|
||||
if !ok {
|
||||
return f.openFallback(filename)
|
||||
}
|
||||
return &file{name: filename, s: s}, nil
|
||||
return &fileHandle{sf: sf}, nil
|
||||
}
|
||||
|
||||
// f.lk is held
|
||||
|
@ -88,22 +95,29 @@ func (f *Files) openFallback(filename string) (http.File, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fi, err := of.Stat()
|
||||
|
||||
s := string(bs)
|
||||
f.add(filename, s)
|
||||
return &file{name: filename, s: s}, nil
|
||||
sf := &staticFile{
|
||||
name: filename,
|
||||
contents: s,
|
||||
modtime: fi.ModTime(),
|
||||
}
|
||||
f.add(filename, sf)
|
||||
return &fileHandle{sf: sf}, nil
|
||||
}
|
||||
return of, nil
|
||||
}
|
||||
|
||||
type file struct {
|
||||
name string
|
||||
s string
|
||||
|
||||
type fileHandle struct {
|
||||
sf *staticFile
|
||||
off int64
|
||||
closed bool
|
||||
}
|
||||
|
||||
func (f *file) Close() error {
|
||||
var _ http.File = (*fileHandle)(nil)
|
||||
|
||||
func (f *fileHandle) Close() error {
|
||||
if f.closed {
|
||||
return os.ErrInvalid
|
||||
}
|
||||
|
@ -111,27 +125,27 @@ func (f *file) Close() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (f *file) Read(p []byte) (n int, err error) {
|
||||
if f.off >= int64(len(f.s)) {
|
||||
func (f *fileHandle) Read(p []byte) (n int, err error) {
|
||||
if f.off >= int64(len(f.sf.contents)) {
|
||||
return 0, io.EOF
|
||||
}
|
||||
n = copy(p, f.s[f.off:])
|
||||
n = copy(p, f.sf.contents[f.off:])
|
||||
f.off += int64(n)
|
||||
return
|
||||
}
|
||||
|
||||
func (f *file) Readdir(int) ([]os.FileInfo, error) {
|
||||
func (f *fileHandle) Readdir(int) ([]os.FileInfo, error) {
|
||||
return nil, errors.New("not directory")
|
||||
}
|
||||
|
||||
func (f *file) Seek(offset int64, whence int) (int64, error) {
|
||||
func (f *fileHandle) Seek(offset int64, whence int) (int64, error) {
|
||||
switch whence {
|
||||
case os.SEEK_SET:
|
||||
f.off = offset
|
||||
case os.SEEK_CUR:
|
||||
f.off += offset
|
||||
case os.SEEK_END:
|
||||
f.off = int64(len(f.s)) + offset
|
||||
f.off = int64(len(f.sf.contents)) + offset
|
||||
default:
|
||||
return 0, os.ErrInvalid
|
||||
}
|
||||
|
@ -141,31 +155,15 @@ func (f *file) Seek(offset int64, whence int) (int64, error) {
|
|||
return f.off, nil
|
||||
}
|
||||
|
||||
type fileInfo struct {
|
||||
name string
|
||||
size int64
|
||||
modtime time.Time
|
||||
func (f *fileHandle) Stat() (os.FileInfo, error) {
|
||||
return f.sf, nil
|
||||
}
|
||||
|
||||
func (fi *fileInfo) Name() string { return fi.name }
|
||||
func (fi *fileInfo) Size() int64 { return fi.size }
|
||||
func (fi *fileInfo) Mode() os.FileMode { return 0444 }
|
||||
func (fi *fileInfo) ModTime() time.Time { return fi.modtime }
|
||||
func (fi *fileInfo) IsDir() bool { return false }
|
||||
func (fi *fileInfo) Sys() interface{} { return nil }
|
||||
var _ os.FileInfo = (*staticFile)(nil)
|
||||
|
||||
func (f *file) Stat() (os.FileInfo, error) {
|
||||
return &fileInfo{
|
||||
name: f.name,
|
||||
size: int64(len(f.s)),
|
||||
modtime: binaryModTime,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func statBinaryModTime() time.Time {
|
||||
fi, err := os.Stat(os.Args[0])
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("Failed to stat binary %q: %v", os.Args[0], err))
|
||||
}
|
||||
return fi.ModTime()
|
||||
}
|
||||
func (f *staticFile) Name() string { return f.name }
|
||||
func (f *staticFile) Size() int64 { return int64(len(f.contents)) }
|
||||
func (f *staticFile) Mode() os.FileMode { return 0444 }
|
||||
func (f *staticFile) ModTime() time.Time { return f.modtime }
|
||||
func (f *staticFile) IsDir() bool { return false }
|
||||
func (f *staticFile) Sys() interface{} { return nil }
|
||||
|
|
|
@ -49,6 +49,7 @@ func main() {
|
|||
if err != nil {
|
||||
log.Fatalf("Error parsing %s/fileembed.go: %v", dir, err)
|
||||
}
|
||||
|
||||
for _, fileName := range matchingFiles(filePattern) {
|
||||
embedName := "zembed_" + fileName + ".go"
|
||||
fi, err := os.Stat(fileName)
|
||||
|
@ -68,7 +69,8 @@ func main() {
|
|||
fmt.Fprintf(&b, "// THIS FILE IS AUTO-GENERATED FROM %s\n", fileName)
|
||||
fmt.Fprintf(&b, "// DO NOT EDIT.\n")
|
||||
fmt.Fprintf(&b, "package %s\n", pkgName)
|
||||
fmt.Fprintf(&b, "func init() {\n\tFiles.Add(%q, %q);\n}\n", fileName, bs)
|
||||
fmt.Fprintf(&b, "import \"time\"\n")
|
||||
fmt.Fprintf(&b, "func init() {\n\tFiles.Add(%q, %q, time.Unix(0, %d));\n}\n", fileName, bs, fi.ModTime().UnixNano())
|
||||
if err := ioutil.WriteFile(embedName, b.Bytes(), 0644); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,7 @@
|
|||
// THIS FILE IS AUTO-GENERATED FROM SHA1.js
|
||||
// DO NOT EDIT.
|
||||
package ui
|
||||
import "time"
|
||||
func init() {
|
||||
Files.Add("SHA1.js", "// From http://code.google.com/p/crypto-js/\r\n// License: http://www.opensource.org/licenses/bsd-license.php\r\n//\r\n// Copyright (c) 2009, Jeff Mott. All rights reserved.\r\n// \r\n// Redistribution and use in source and binary forms, with or without\r\n// modification, are permitted provided that the following conditions are met:\r\n// \r\n// Redistributions of source code must retain the above copyright notice, this\r\n// list of conditions and the following disclaimer. Redistributions in binary\r\n// form must reproduce the above copyright notice, this list of conditions and\r\n// the following disclaimer in the documentation and/or other materials provided\r\n// with the distribution. Neither the name Crypto-JS nor the names of its\r\n// contributors may be used to endorse or promote products derived from this\r\n// software without specific prior written permission. THIS SOFTWARE IS PROVIDED\r\n// BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED\r\n// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r\n// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO\r\n// EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\r\n// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r\n// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r\n// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r\n// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n\r\n(function(){\r\n\r\n// Shortcuts\r\nvar C = Crypto,\r\n util = C.util,\r\n charenc = C.charenc,\r\n UTF8 = charenc.UTF8,\r\n Binary = charenc.Binary;\r\n\r\n// Public API\r\nvar SHA1 = C.SHA1 = function (message, options) {\r\n\tvar digestbytes = util.wordsToBytes(SHA1._sha1(message));\r\n\treturn options && options.asBytes ? digestbytes :\r\n\t options && options.asString ? Binary.bytesToString(digestbytes) :\r\n\t util.bytesToHex(digestbytes);\r\n};\r\n\r\n// The core\r\nSHA1._sha1 = function (message) {\r\n\r\n\t// Convert to byte array\r\n\tif (message.constructor == String) message = UTF8.stringToBytes(message);\r\n\t/* else, assume byte array already */\r\n\r\n\tvar m = util.bytesToWords(message),\r\n\t l = message.length * 8,\r\n\t w = [],\r\n\t H0 = 1732584193,\r\n\t H1 = -271733879,\r\n\t H2 = -1732584194,\r\n\t H3 = 271733878,\r\n\t H4 = -1009589776;\r\n\r\n\t// Padding\r\n\tm[l >> 5] |= 0x80 << (24 - l % 32);\r\n\tm[((l + 64 >>> 9) << 4) + 15] = l;\r\n\r\n\tfor (var i = 0; i < m.length; i += 16) {\r\n\r\n\t\tvar a = H0,\r\n\t\t b = H1,\r\n\t\t c = H2,\r\n\t\t d = H3,\r\n\t\t e = H4;\r\n\r\n\t\tfor (var j = 0; j < 80; j++) {\r\n\r\n\t\t\tif (j < 16) w[j] = m[i + j];\r\n\t\t\telse {\r\n\t\t\t\tvar n = w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16];\r\n\t\t\t\tw[j] = (n << 1) | (n >>> 31);\r\n\t\t\t}\r\n\r\n\t\t\tvar t = ((H0 << 5) | (H0 >>> 27)) + H4 + (w[j] >>> 0) + (\r\n\t\t\t j < 20 ? (H1 & H2 | ~H1 & H3) + 1518500249 :\r\n\t\t\t j < 40 ? (H1 ^ H2 ^ H3) + 1859775393 :\r\n\t\t\t j < 60 ? (H1 & H2 | H1 & H3 | H2 & H3) - 1894007588 :\r\n\t\t\t (H1 ^ H2 ^ H3) - 899497514);\r\n\r\n\t\t\tH4 = H3;\r\n\t\t\tH3 = H2;\r\n\t\t\tH2 = (H1 << 30) | (H1 >>> 2);\r\n\t\t\tH1 = H0;\r\n\t\t\tH0 = t;\r\n\r\n\t\t}\r\n\r\n\t\tH0 += a;\r\n\t\tH1 += b;\r\n\t\tH2 += c;\r\n\t\tH3 += d;\r\n\t\tH4 += e;\r\n\r\n\t}\r\n\r\n\treturn [H0, H1, H2, H3, H4];\r\n\r\n};\r\n\r\n// Package private blocksize\r\nSHA1._blocksize = 16;\r\n\r\n})();\r\n");
|
||||
Files.Add("SHA1.js", "// From http://code.google.com/p/crypto-js/\r\n// License: http://www.opensource.org/licenses/bsd-license.php\r\n//\r\n// Copyright (c) 2009, Jeff Mott. All rights reserved.\r\n// \r\n// Redistribution and use in source and binary forms, with or without\r\n// modification, are permitted provided that the following conditions are met:\r\n// \r\n// Redistributions of source code must retain the above copyright notice, this\r\n// list of conditions and the following disclaimer. Redistributions in binary\r\n// form must reproduce the above copyright notice, this list of conditions and\r\n// the following disclaimer in the documentation and/or other materials provided\r\n// with the distribution. Neither the name Crypto-JS nor the names of its\r\n// contributors may be used to endorse or promote products derived from this\r\n// software without specific prior written permission. THIS SOFTWARE IS PROVIDED\r\n// BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED\r\n// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r\n// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO\r\n// EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\r\n// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r\n// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\r\n// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\r\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\r\n// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\n\r\n(function(){\r\n\r\n// Shortcuts\r\nvar C = Crypto,\r\n util = C.util,\r\n charenc = C.charenc,\r\n UTF8 = charenc.UTF8,\r\n Binary = charenc.Binary;\r\n\r\n// Public API\r\nvar SHA1 = C.SHA1 = function (message, options) {\r\n\tvar digestbytes = util.wordsToBytes(SHA1._sha1(message));\r\n\treturn options && options.asBytes ? digestbytes :\r\n\t options && options.asString ? Binary.bytesToString(digestbytes) :\r\n\t util.bytesToHex(digestbytes);\r\n};\r\n\r\n// The core\r\nSHA1._sha1 = function (message) {\r\n\r\n\t// Convert to byte array\r\n\tif (message.constructor == String) message = UTF8.stringToBytes(message);\r\n\t/* else, assume byte array already */\r\n\r\n\tvar m = util.bytesToWords(message),\r\n\t l = message.length * 8,\r\n\t w = [],\r\n\t H0 = 1732584193,\r\n\t H1 = -271733879,\r\n\t H2 = -1732584194,\r\n\t H3 = 271733878,\r\n\t H4 = -1009589776;\r\n\r\n\t// Padding\r\n\tm[l >> 5] |= 0x80 << (24 - l % 32);\r\n\tm[((l + 64 >>> 9) << 4) + 15] = l;\r\n\r\n\tfor (var i = 0; i < m.length; i += 16) {\r\n\r\n\t\tvar a = H0,\r\n\t\t b = H1,\r\n\t\t c = H2,\r\n\t\t d = H3,\r\n\t\t e = H4;\r\n\r\n\t\tfor (var j = 0; j < 80; j++) {\r\n\r\n\t\t\tif (j < 16) w[j] = m[i + j];\r\n\t\t\telse {\r\n\t\t\t\tvar n = w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16];\r\n\t\t\t\tw[j] = (n << 1) | (n >>> 31);\r\n\t\t\t}\r\n\r\n\t\t\tvar t = ((H0 << 5) | (H0 >>> 27)) + H4 + (w[j] >>> 0) + (\r\n\t\t\t j < 20 ? (H1 & H2 | ~H1 & H3) + 1518500249 :\r\n\t\t\t j < 40 ? (H1 ^ H2 ^ H3) + 1859775393 :\r\n\t\t\t j < 60 ? (H1 & H2 | H1 & H3 | H2 & H3) - 1894007588 :\r\n\t\t\t (H1 ^ H2 ^ H3) - 899497514);\r\n\r\n\t\t\tH4 = H3;\r\n\t\t\tH3 = H2;\r\n\t\t\tH2 = (H1 << 30) | (H1 >>> 2);\r\n\t\t\tH1 = H0;\r\n\t\t\tH0 = t;\r\n\r\n\t\t}\r\n\r\n\t\tH0 += a;\r\n\t\tH1 += b;\r\n\t\tH2 += c;\r\n\t\tH3 += d;\r\n\t\tH4 += e;\r\n\r\n\t}\r\n\r\n\treturn [H0, H1, H2, H3, H4];\r\n\r\n};\r\n\r\n// Package private blocksize\r\nSHA1._blocksize = 16;\r\n\r\n})();\r\n", time.Unix(0, 1307659868000000000));
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,7 @@
|
|||
// THIS FILE IS AUTO-GENERATED FROM blobinfo.html
|
||||
// DO NOT EDIT.
|
||||
package ui
|
||||
import "time"
|
||||
func init() {
|
||||
Files.Add("blobinfo.html", "<html>\n<head>\n <title>Blob info</title>\n <script src=\"camli.js\"></script>\n <script src=\"?camli.mode=config&cb=onConfiguration\"></script>\n <script src=\"blobinfo.js\"></script>\n <link rel=\"stylesheet\" href=\"camli.css\">\n</head>\n<body class=\"camli-ui-blobinfo\">\n <div class=\"camli-nav\"><a href=\"./\">Home</a></div>\n <h1>Blob Contents</h1>\n\n <div id=\"thumbnail\"></div>\n <span id=\"editspan\" class=\"camli-nav\" style=\"display: none;\"><a href=\"#\" id=\"editlink\">edit</a></span>\n <span id=\"blobdownload\" class=\"camli-nav\"></span>\n <span id=\"blobdescribe\" class=\"camli-nav\"></span>\n <span id=\"blobbrowse\" class=\"camli-nav\"></span>\n\n <pre id=\"blobdata\"></pre>\n\n <h1>Indexer Metadata</h1>\n <pre id=\"blobmeta\"></pre>\n\n <div id=\"claimsdiv\" style=\"visibility: hidden\">\n <h1>Mutation Claims</h1>\n <pre id=\"claims\"></pre>\n </div>\n\n</body>\n</html>\n");
|
||||
Files.Add("blobinfo.html", "<html>\n<head>\n <title>Blob info</title>\n <script src=\"camli.js\"></script>\n <script src=\"?camli.mode=config&cb=onConfiguration\"></script>\n <script src=\"blobinfo.js\"></script>\n <link rel=\"stylesheet\" href=\"camli.css\">\n</head>\n<body class=\"camli-ui-blobinfo\">\n <div class=\"camli-nav\"><a href=\"./\">Home</a></div>\n <h1>Blob Contents</h1>\n\n <div id=\"thumbnail\"></div>\n <span id=\"editspan\" class=\"camli-nav\" style=\"display: none;\"><a href=\"#\" id=\"editlink\">edit</a></span>\n <span id=\"blobdownload\" class=\"camli-nav\"></span>\n <span id=\"blobdescribe\" class=\"camli-nav\"></span>\n <span id=\"blobbrowse\" class=\"camli-nav\"></span>\n\n <pre id=\"blobdata\"></pre>\n\n <h1>Indexer Metadata</h1>\n <pre id=\"blobmeta\"></pre>\n\n <div id=\"claimsdiv\" style=\"visibility: hidden\">\n <h1>Mutation Claims</h1>\n <pre id=\"claims\"></pre>\n </div>\n\n</body>\n</html>\n", time.Unix(0, 1311540591000000000));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// THIS FILE IS AUTO-GENERATED FROM blobinfo.js
|
||||
// DO NOT EDIT.
|
||||
package ui
|
||||
import "time"
|
||||
func init() {
|
||||
Files.Add("blobinfo.js", "/*\nCopyright 2011 Google Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n// Gets the |p| query parameter, assuming that it looks like a blobref.\nfunction getBlobParam() {\n var blobRef = getQueryParam('b');\n return (blobRef && isPlausibleBlobRef(blobRef)) ? blobRef : null;\n}\n\nfunction blobInfoUpdate(bmap) {\n var blobmeta = document.getElementById('blobmeta');\n var bd = document.getElementById(\"blobdownload\")\n bd.innerHTML = \"\";\n var blobref = getBlobParam();\n if (!blobref) {\n alert(\"no blobref?\");\n return;\n }\n var binfo = bmap[blobref];\n if (!binfo) {\n blobmeta.innerHTML = \"(not found)\";\n return;\n }\n blobmeta.innerHTML = JSON.stringify(binfo, null, 2);\n if (binfo.camliType || (binfo.type && binfo.type.indexOf(\"text/\") == 0)) {\n camliGetBlobContents(\n blobref,\n {\n success: function(data) {\n document.getElementById(\"blobdata\").innerHTML = linkifyBlobRefs(data);\n var bb = document.getElementById('blobbrowse');\n if (binfo.camliType != \"directory\") {\n bb.style.visibility = 'hidden';\n } else {\n bb.innerHTML = \"<a href='?d=\" + blobref + \"'>browse</a>\";\n }\n if (binfo.camliType == \"file\") {\n try {\n finfo = JSON.parse(data);\n bd.innerHTML = \"<a href=''></a>\";\n var fileName = finfo.fileName || blobref;\n bd.firstChild.href = \"./download/\" + blobref + \"/\" + fileName;\n if (binfo.file.mimeType.indexOf(\"image/\") == 0) {\n document.getElementById(\"thumbnail\").innerHTML = \"<img src='./thumbnail/\" + blobref + \"/\" + fileName + \"?mw=200&mh=200'>\";\n } else {\n document.getElementById(\"thumbnail\").innerHTML = \"\";\n }\n bd.firstChild.innerText = fileName;\n bd.innerHTML = \"download: \" + bd.innerHTML;\n } catch (x) {\n }\n }\n },\n fail: alert\n });\n } else {\n document.getElementById(\"blobdata\").innerHTML = \"<em>Unknown/binary data</em>\";\n }\n bd.innerHTML = \"<a href='\" + camliBlobURL(blobref) + \"'>download</a>\";\n\n if (binfo.camliType && binfo.camliType == \"permanode\") {\n document.getElementById(\"editspan\").style.display = \"inline\";\n document.getElementById(\"editlink\").href = \"./?p=\" + blobref;\n\n var claims = document.getElementById(\"claimsdiv\");\n claims.style.visibility = \"\";\n camliGetPermanodeClaims(\n blobref,\n {\n success: function(data) {\n document.getElementById(\"claims\").innerHTML = linkifyBlobRefs(JSON.stringify(data, null, 2));\n },\n fail: function(msg) {\n alert(msg);\n }\n });\n }\n\n}\n\nfunction blobInfoOnLoad() {\n var blobref = getBlobParam();\n if (!blobref) {\n return\n }\n var blobmeta = document.getElementById('blobmeta');\n blobmeta.innerText = \"(loading)\";\n\n var blobdescribe = document.getElementById('blobdescribe');\n blobdescribe.innerHTML = \"<a href='\" + camliDescribeBlogURL(blobref) + \"'>describe</a>\";\n camliDescribeBlob(\n blobref,\n {\n success: blobInfoUpdate,\n fail: function(msg) {\n alert(\"Error describing blob \" + blobref + \": \" + msg);\n }\n }\n );\n}\n\nwindow.addEventListener(\"load\", blobInfoOnLoad);\n");
|
||||
Files.Add("blobinfo.js", "/*\nCopyright 2011 Google Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n// Gets the |p| query parameter, assuming that it looks like a blobref.\nfunction getBlobParam() {\n var blobRef = getQueryParam('b');\n return (blobRef && isPlausibleBlobRef(blobRef)) ? blobRef : null;\n}\n\nfunction blobInfoUpdate(bmap) {\n var blobmeta = document.getElementById('blobmeta');\n var bd = document.getElementById(\"blobdownload\")\n bd.innerHTML = \"\";\n var blobref = getBlobParam();\n if (!blobref) {\n alert(\"no blobref?\");\n return;\n }\n var binfo = bmap[blobref];\n if (!binfo) {\n blobmeta.innerHTML = \"(not found)\";\n return;\n }\n blobmeta.innerHTML = JSON.stringify(binfo, null, 2);\n if (binfo.camliType || (binfo.type && binfo.type.indexOf(\"text/\") == 0)) {\n camliGetBlobContents(\n blobref,\n {\n success: function(data) {\n document.getElementById(\"blobdata\").innerHTML = linkifyBlobRefs(data);\n var bb = document.getElementById('blobbrowse');\n if (binfo.camliType != \"directory\") {\n bb.style.visibility = 'hidden';\n } else {\n bb.innerHTML = \"<a href='?d=\" + blobref + \"'>browse</a>\";\n }\n if (binfo.camliType == \"file\") {\n try {\n finfo = JSON.parse(data);\n bd.innerHTML = \"<a href=''></a>\";\n var fileName = finfo.fileName || blobref;\n bd.firstChild.href = \"./download/\" + blobref + \"/\" + fileName;\n if (binfo.file.mimeType.indexOf(\"image/\") == 0) {\n document.getElementById(\"thumbnail\").innerHTML = \"<img src='./thumbnail/\" + blobref + \"/\" + fileName + \"?mw=200&mh=200'>\";\n } else {\n document.getElementById(\"thumbnail\").innerHTML = \"\";\n }\n bd.firstChild.innerText = fileName;\n bd.innerHTML = \"download: \" + bd.innerHTML;\n } catch (x) {\n }\n }\n },\n fail: alert\n });\n } else {\n document.getElementById(\"blobdata\").innerHTML = \"<em>Unknown/binary data</em>\";\n }\n bd.innerHTML = \"<a href='\" + camliBlobURL(blobref) + \"'>download</a>\";\n\n if (binfo.camliType && binfo.camliType == \"permanode\") {\n document.getElementById(\"editspan\").style.display = \"inline\";\n document.getElementById(\"editlink\").href = \"./?p=\" + blobref;\n\n var claims = document.getElementById(\"claimsdiv\");\n claims.style.visibility = \"\";\n camliGetPermanodeClaims(\n blobref,\n {\n success: function(data) {\n document.getElementById(\"claims\").innerHTML = linkifyBlobRefs(JSON.stringify(data, null, 2));\n },\n fail: function(msg) {\n alert(msg);\n }\n });\n }\n\n}\n\nfunction blobInfoOnLoad() {\n var blobref = getBlobParam();\n if (!blobref) {\n return\n }\n var blobmeta = document.getElementById('blobmeta');\n blobmeta.innerText = \"(loading)\";\n\n var blobdescribe = document.getElementById('blobdescribe');\n blobdescribe.innerHTML = \"<a href='\" + camliDescribeBlogURL(blobref) + \"'>describe</a>\";\n camliDescribeBlob(\n blobref,\n {\n success: blobInfoUpdate,\n fail: function(msg) {\n alert(\"Error describing blob \" + blobref + \": \" + msg);\n }\n }\n );\n}\n\nwindow.addEventListener(\"load\", blobInfoOnLoad);\n", time.Unix(0, 1311540591000000000));
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,7 @@
|
|||
// THIS FILE IS AUTO-GENERATED FROM disco.html
|
||||
// DO NOT EDIT.
|
||||
package ui
|
||||
import "time"
|
||||
func init() {
|
||||
Files.Add("disco.html", "<html>\n<head>\n <title>Camlistored UI</title>\n <script src=\"camli.js\"></script>\n <script src=\"sigdebug.js\"></script>\n <script src=\"./?camli.mode=config&cb=onConfiguration\"></script>\n<script>\n\n// Or get configuration info like this:\nfunction discover() {\n var xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function() {\n if (xhr.readyState != 4) { return; }\n if (xhr.status != 200) {\n console.log(\"no status 200; got \" + xhr.status);\n return;\n }\n disco = JSON.parse(xhr.responseText);\n document.getElementById(\"discores\").innerHTML = \"<pre>\" + JSON.stringify(disco, null, 2) + \"</pre>\";\n };\n xhr.open(\"GET\", \"./?camli.mode=config\", true);\n xhr.send();\n}\n\n\n</script>\n</head>\n<body>\n <form>\n <h2>Root Discovery</h2>\n <p><input type=\"button\" id=\"discobtn\" onclick=\"discover()\" value=\"Do Discovery\" /></p>\n <div id=\"discores\" style=\"border: 2px solid gray\">(discovery results)</div>\n\n\n <h2>Signing Discovery</h2>\n <p><input type=\"button\" id=\"sigdiscobtn\" onclick=\"discoverJsonSign()\" value=\"Do jsonSign discovery\" /></p>\n <div id=\"sigdiscores\" style=\"border: 2px solid gray\">(jsonsign discovery results)</div>\n </form>\n</body>\n</html>\n");
|
||||
Files.Add("disco.html", "<html>\n<head>\n <title>Camlistored UI</title>\n <script src=\"camli.js\"></script>\n <script src=\"sigdebug.js\"></script>\n <script src=\"./?camli.mode=config&cb=onConfiguration\"></script>\n<script>\n\n// Or get configuration info like this:\nfunction discover() {\n var xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function() {\n if (xhr.readyState != 4) { return; }\n if (xhr.status != 200) {\n console.log(\"no status 200; got \" + xhr.status);\n return;\n }\n disco = JSON.parse(xhr.responseText);\n document.getElementById(\"discores\").innerHTML = \"<pre>\" + JSON.stringify(disco, null, 2) + \"</pre>\";\n };\n xhr.open(\"GET\", \"./?camli.mode=config\", true);\n xhr.send();\n}\n\n\n</script>\n</head>\n<body>\n <form>\n <h2>Root Discovery</h2>\n <p><input type=\"button\" id=\"discobtn\" onclick=\"discover()\" value=\"Do Discovery\" /></p>\n <div id=\"discores\" style=\"border: 2px solid gray\">(discovery results)</div>\n\n\n <h2>Signing Discovery</h2>\n <p><input type=\"button\" id=\"sigdiscobtn\" onclick=\"discoverJsonSign()\" value=\"Do jsonSign discovery\" /></p>\n <div id=\"sigdiscores\" style=\"border: 2px solid gray\">(jsonsign discovery results)</div>\n </form>\n</body>\n</html>\n", time.Unix(0, 1309407835000000000));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// THIS FILE IS AUTO-GENERATED FROM filetree.html
|
||||
// DO NOT EDIT.
|
||||
package ui
|
||||
import "time"
|
||||
func init() {
|
||||
Files.Add("filetree.html", "<!doctype html>\n<html>\n<head>\n <title>Gallery</title>\n <script src=\"base64.js\"></script>\n <script src=\"Crypto.js\"></script>\n <script src=\"SHA1.js\"></script>\n <script src=\"camli.js\"></script>\n <script src=\"?camli.mode=config&cb=onConfiguration\"></script>\n <script src=\"filetree.js\"></script>\n <link rel=\"stylesheet\" href=\"camli.css\">\n</head>\n<body class=\"camli-ui-permanode\">\n <div class=\"camli-nav\"><a href=\"./\">Home</a></div>\n <h1>FileTree for <span id=\"curDir\" class=\"camli-nav\"></span> </h1>\n\n <div id=\"children\"></div>\n\n</body>\n</html>\n");
|
||||
Files.Add("filetree.html", "<!doctype html>\n<html>\n<head>\n <title>Gallery</title>\n <script src=\"base64.js\"></script>\n <script src=\"Crypto.js\"></script>\n <script src=\"SHA1.js\"></script>\n <script src=\"camli.js\"></script>\n <script src=\"?camli.mode=config&cb=onConfiguration\"></script>\n <script src=\"filetree.js\"></script>\n <link rel=\"stylesheet\" href=\"camli.css\">\n</head>\n<body class=\"camli-ui-permanode\">\n <div class=\"camli-nav\"><a href=\"./\">Home</a></div>\n <h1>FileTree for <span id=\"curDir\" class=\"camli-nav\"></span> </h1>\n\n <div id=\"children\"></div>\n\n</body>\n</html>\n", time.Unix(0, 1311540591000000000));
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,7 @@
|
|||
// THIS FILE IS AUTO-GENERATED FROM gallery.html
|
||||
// DO NOT EDIT.
|
||||
package ui
|
||||
import "time"
|
||||
func init() {
|
||||
Files.Add("gallery.html", "<!doctype html>\n<html>\n<head>\n <title>Gallery</title>\n <script src=\"base64.js\"></script>\n <script src=\"Crypto.js\"></script>\n <script src=\"SHA1.js\"></script>\n <script src=\"camli.js\"></script>\n <script src=\"?camli.mode=config&cb=onConfiguration\"></script>\n <script src=\"gallery.js\"></script>\n <link rel=\"stylesheet\" href=\"camli.css\">\n</head>\n<body class=\"camli-ui-permanode\">\n <div class=\"camli-nav\"><a href=\"./\">Home</a></div>\n <h1>Gallery</h1>\n\n <p>\n Permalink:\n <span id=\"permanode\"></span>\n <span id=\"permanodeBlob\" class=\"camli-nav\"></span>\n </p>\n\n <div id=\"members\"></div>\n\n</body>\n</html>\n");
|
||||
Files.Add("gallery.html", "<!doctype html>\n<html>\n<head>\n <title>Gallery</title>\n <script src=\"base64.js\"></script>\n <script src=\"Crypto.js\"></script>\n <script src=\"SHA1.js\"></script>\n <script src=\"camli.js\"></script>\n <script src=\"?camli.mode=config&cb=onConfiguration\"></script>\n <script src=\"gallery.js\"></script>\n <link rel=\"stylesheet\" href=\"camli.css\">\n</head>\n<body class=\"camli-ui-permanode\">\n <div class=\"camli-nav\"><a href=\"./\">Home</a></div>\n <h1>Gallery</h1>\n\n <p>\n Permalink:\n <span id=\"permanode\"></span>\n <span id=\"permanodeBlob\" class=\"camli-nav\"></span>\n </p>\n\n <div id=\"members\"></div>\n\n</body>\n</html>\n", time.Unix(0, 1309849899000000000));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// THIS FILE IS AUTO-GENERATED FROM gallery.js
|
||||
// DO NOT EDIT.
|
||||
package ui
|
||||
import "time"
|
||||
func init() {
|
||||
Files.Add("gallery.js", "/*\nCopyright 2011 Google Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n// Gets the |g| query parameter, assuming that it looks like a blobref.\n\nfunction getPermanodeParam() {\n var blobRef = getQueryParam('g');\n return (blobRef && isPlausibleBlobRef(blobRef)) ? blobRef : null;\n}\n\n// pn: child permanode\n// des: describe response of root permanode\nfunction addMember(pn, des) {\n var membersDiv = document.getElementById(\"members\");\n var ul;\n if (membersDiv.innerHTML == \"\") {\n membersDiv.appendChild(document.createTextNode(\"Members:\"));\n ul = document.createElement(\"ul\");\n membersDiv.appendChild(ul);\n } else {\n ul = membersDiv.firstChild.nextSibling;\n }\n var li = document.createElement(\"li\");\n var a = document.createElement(\"a\");\n a.href = \"./?p=\" + pn;\n a.innerHTML = camliBlobThumbnail(pn, des, 100, 100);\n\n li.appendChild(a);\n ul.appendChild(li);\n}\n\nfunction onMemberDescribed(bmap, jres, member) {\n\taddMember(member, jres)\n}\n\nfunction onBlobDescribed(jres) {\n var permanode = getPermanodeParam();\n if (!jres[permanode]) {\n alert(\"didn't get blob \" + permanode);\n return;\n }\n var permanodeObject = jres[permanode].permanode;\n if (!permanodeObject) {\n alert(\"blob \" + permanode + \" isn't a permanode\");\n return;\n }\n\n document.getElementById('members').innerHTML = '';\n var members = permanodeObject.attr.camliMember;\n if (members && members.length > 0) {\n for (idx in members) {\n var member = members[idx];\n camliDescribeBlob(\n member,\n {\n success: addMember(member, jres),\n fail: function(msg) {\n alert(\"Error describing blob \" + blobref + \": \" + msg);\n }\n }\n ); \n \n }\n }\n}\n\nfunction buildGallery() {\n camliDescribeBlob(getPermanodeParam(), {\n success: onBlobDescribed,\n failure: function(msg) {\n alert(\"failed to get blob description: \" + msg);\n }\n });\n}\n\nfunction galleryPageOnLoad(e) {\n var permanode = getPermanodeParam();\n if (permanode) {\n document.getElementById('permanode').innerHTML = \"<a href='./?p=\" + permanode + \"'>\" + permanode + \"</a>\";\n document.getElementById('permanodeBlob').innerHTML = \"<a href='./?b=\" + permanode + \"'>view blob</a>\";\n }\n\n buildGallery();\n}\n\nwindow.addEventListener(\"load\", galleryPageOnLoad);\n");
|
||||
Files.Add("gallery.js", "/*\nCopyright 2011 Google Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n// Gets the |g| query parameter, assuming that it looks like a blobref.\n\nfunction getPermanodeParam() {\n var blobRef = getQueryParam('g');\n return (blobRef && isPlausibleBlobRef(blobRef)) ? blobRef : null;\n}\n\n// pn: child permanode\n// des: describe response of root permanode\nfunction addMember(pn, des) {\n var membersDiv = document.getElementById(\"members\");\n var ul;\n if (membersDiv.innerHTML == \"\") {\n membersDiv.appendChild(document.createTextNode(\"Members:\"));\n ul = document.createElement(\"ul\");\n membersDiv.appendChild(ul);\n } else {\n ul = membersDiv.firstChild.nextSibling;\n }\n var li = document.createElement(\"li\");\n var a = document.createElement(\"a\");\n a.href = \"./?p=\" + pn;\n a.innerHTML = camliBlobThumbnail(pn, des, 100, 100);\n\n li.appendChild(a);\n ul.appendChild(li);\n}\n\nfunction onMemberDescribed(bmap, jres, member) {\n\taddMember(member, jres)\n}\n\nfunction onBlobDescribed(jres) {\n var permanode = getPermanodeParam();\n if (!jres[permanode]) {\n alert(\"didn't get blob \" + permanode);\n return;\n }\n var permanodeObject = jres[permanode].permanode;\n if (!permanodeObject) {\n alert(\"blob \" + permanode + \" isn't a permanode\");\n return;\n }\n\n document.getElementById('members').innerHTML = '';\n var members = permanodeObject.attr.camliMember;\n if (members && members.length > 0) {\n for (idx in members) {\n var member = members[idx];\n camliDescribeBlob(\n member,\n {\n success: addMember(member, jres),\n fail: function(msg) {\n alert(\"Error describing blob \" + blobref + \": \" + msg);\n }\n }\n ); \n \n }\n }\n}\n\nfunction buildGallery() {\n camliDescribeBlob(getPermanodeParam(), {\n success: onBlobDescribed,\n failure: function(msg) {\n alert(\"failed to get blob description: \" + msg);\n }\n });\n}\n\nfunction galleryPageOnLoad(e) {\n var permanode = getPermanodeParam();\n if (permanode) {\n document.getElementById('permanode').innerHTML = \"<a href='./?p=\" + permanode + \"'>\" + permanode + \"</a>\";\n document.getElementById('permanodeBlob').innerHTML = \"<a href='./?b=\" + permanode + \"'>view blob</a>\";\n }\n\n buildGallery();\n}\n\nwindow.addEventListener(\"load\", galleryPageOnLoad);\n", time.Unix(0, 1309849899000000000));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// THIS FILE IS AUTO-GENERATED FROM home.html
|
||||
// DO NOT EDIT.
|
||||
package ui
|
||||
import "time"
|
||||
func init() {
|
||||
Files.Add("home.html", "<html>\n<head>\n <title>Camlistored UI</title>\n <script type=\"text/javascript\" src=\"base64.js\"></script>\n <script type=\"text/javascript\" src=\"Crypto.js\"></script>\n <script type=\"text/javascript\" src=\"SHA1.js\"></script>\n <script src=\"camli.js\"></script>\n <script src=\"home.js\"></script>\n <script src=\"?camli.mode=config&cb=onConfiguration\"></script>\n <link rel=\"stylesheet\" href=\"camli.css\">\n</head>\n<body class=\"camli-ui-index\">\n <h1>Camlistored UI</h1>\n <p class=\"camli-nav\"\n ><strong>Debug:</strong>\n <a href=\"disco.html\">discovery</a> |\n <a href=\"signing.html\">signing</a></p>\n\n <button id=\"btnNew\">New</button> - create a new item or collection \n\n <h2>Recent Objects</h2>\n <ul id=\"recent\"></ul>\n\n <h2>Search</h2>\n <form id=\"formSearch\">\n <p>\n <input id=\"inputSearch\" placeholder=\"tag1\">\n <input type=\"submit\" id=\"btnSearch\" value=\"Search\">\n </form>\n\n <h2>Upload</h2>\n <form method=\"POST\" id=\"uploadform\" enctype=\"multipart/form-data\">\n <input type=\"file\" id=\"fileinput\" multiple=\"true\" name=\"file\" disabled=\"true\">\n <input type=\"submit\" id=\"filesubmit\" value=\"Upload\" disabled=\"true\">\n <input type=\"checkbox\" name=\"rollsum\" id=\"chkrollsum\" value=\"1\">\n <label for=\"chkrollsum\">Use rolling checksum for boundaries</label>\n </form>\n\n</body>\n</html>\n");
|
||||
Files.Add("home.html", "<html>\n<head>\n <title>Camlistored UI</title>\n <script type=\"text/javascript\" src=\"base64.js\"></script>\n <script type=\"text/javascript\" src=\"Crypto.js\"></script>\n <script type=\"text/javascript\" src=\"SHA1.js\"></script>\n <script src=\"camli.js\"></script>\n <script src=\"home.js\"></script>\n <script src=\"?camli.mode=config&cb=onConfiguration\"></script>\n <link rel=\"stylesheet\" href=\"camli.css\">\n</head>\n<body class=\"camli-ui-index\">\n <h1>Camlistored UI</h1>\n <p class=\"camli-nav\"\n ><strong>Debug:</strong>\n <a href=\"disco.html\">discovery</a> |\n <a href=\"signing.html\">signing</a></p>\n\n <button id=\"btnNew\">New</button> - create a new item or collection \n\n <h2>Recent Objects</h2>\n <ul id=\"recent\"></ul>\n\n <h2>Search</h2>\n <form id=\"formSearch\">\n <p>\n <input id=\"inputSearch\" placeholder=\"tag1\">\n <input type=\"submit\" id=\"btnSearch\" value=\"Search\">\n </form>\n\n <h2>Upload</h2>\n <form method=\"POST\" id=\"uploadform\" enctype=\"multipart/form-data\">\n <input type=\"file\" id=\"fileinput\" multiple=\"true\" name=\"file\" disabled=\"true\">\n <input type=\"submit\" id=\"filesubmit\" value=\"Upload\" disabled=\"true\">\n <input type=\"checkbox\" name=\"rollsum\" id=\"chkrollsum\" value=\"1\">\n <label for=\"chkrollsum\">Use rolling checksum for boundaries</label>\n </form>\n\n</body>\n</html>\n", time.Unix(0, 1312665089000000000));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// THIS FILE IS AUTO-GENERATED FROM home.js
|
||||
// DO NOT EDIT.
|
||||
package ui
|
||||
import "time"
|
||||
func init() {
|
||||
Files.Add("home.js", "/*\nCopyright 2011 Google Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n// CamliHome namespace to contain the global vars\nvar CamliHome = {};\n\nfunction btnCreateNewPermanode(e) {\n camliCreateNewPermanode(\n {\n success: function(blobref) {\n window.location = \"./?p=\" + blobref;\n },\n fail: function(msg) {\n alert(\"create permanode failed: \" + msg);\n }\n });\n}\n\nfunction handleFormSearch(e) {\n e.stopPropagation();\n e.preventDefault();\n\n var input = document.getElementById(\"inputSearch\");\n var btn = document.getElementById(\"btnSearch\");\n\n if (input.value == \"\") {\n return;\n }\n\n var query = input.value.split(/\\s*,\\s*/);\n window.location = \"./search.html?q=\" + query[0] + \"&t=tag\";\n}\n\nfunction indexOnLoad(e) {\n var btnNew = document.getElementById(\"btnNew\");\n if (!btnNew) {\n alert(\"missing btnNew\");\n }\n btnNew.addEventListener(\"click\", btnCreateNewPermanode);\n camliGetRecentlyUpdatedPermanodes({ success: indexBuildRecentlyUpdatedPermanodes });\n formSearch.addEventListener(\"submit\", handleFormSearch);\n\n if (disco && disco.uploadHelper) {\n var uploadForm = document.getElementById(\"uploadform\");\n uploadform.action = disco.uploadHelper;\n document.getElementById(\"fileinput\").disabled = false;\n document.getElementById(\"filesubmit\").disabled = false;\n var chkRollSum = document.getElementById(\"chkrollsum\");\n chkRollSum.addEventListener(\"change\", function (e) {\n if (chkRollSum.checked) {\n if (disco.uploadHelper.indexOf(\"?\") == -1) {\n uploadform.action = disco.uploadHelper + \"?rollsum=1\";\n } else {\n uploadform.action = disco.uploadHelper + \"&rollsum=1\";\n }\n } else {\n uploadform.action = disco.uploadHelper;\n }\n });\n }\n}\n\nfunction indexBuildRecentlyUpdatedPermanodes(searchRes) {\n var div = document.getElementById(\"recent\");\n div.innerHTML = \"\";\n for (var i = 0; i < searchRes.recent.length; i++) {\n var result = searchRes.recent[i]; \n var pdiv = document.createElement(\"li\");\n var alink = document.createElement(\"a\");\n alink.href = \"./?p=\" + result.blobref;\n alink.innerText = camliBlobTitle(result.blobref, searchRes);\n pdiv.appendChild(alink);\n div.appendChild(pdiv);\n }\n}\n\nwindow.addEventListener(\"load\", indexOnLoad);\n");
|
||||
Files.Add("home.js", "/*\nCopyright 2011 Google Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n*/\n\n// CamliHome namespace to contain the global vars\nvar CamliHome = {};\n\nfunction btnCreateNewPermanode(e) {\n camliCreateNewPermanode(\n {\n success: function(blobref) {\n window.location = \"./?p=\" + blobref;\n },\n fail: function(msg) {\n alert(\"create permanode failed: \" + msg);\n }\n });\n}\n\nfunction handleFormSearch(e) {\n e.stopPropagation();\n e.preventDefault();\n\n var input = document.getElementById(\"inputSearch\");\n var btn = document.getElementById(\"btnSearch\");\n\n if (input.value == \"\") {\n return;\n }\n\n var query = input.value.split(/\\s*,\\s*/);\n window.location = \"./search.html?q=\" + query[0] + \"&t=tag\";\n}\n\nfunction indexOnLoad(e) {\n var btnNew = document.getElementById(\"btnNew\");\n if (!btnNew) {\n alert(\"missing btnNew\");\n }\n btnNew.addEventListener(\"click\", btnCreateNewPermanode);\n camliGetRecentlyUpdatedPermanodes({ success: indexBuildRecentlyUpdatedPermanodes });\n formSearch.addEventListener(\"submit\", handleFormSearch);\n\n if (disco && disco.uploadHelper) {\n var uploadForm = document.getElementById(\"uploadform\");\n uploadform.action = disco.uploadHelper;\n document.getElementById(\"fileinput\").disabled = false;\n document.getElementById(\"filesubmit\").disabled = false;\n var chkRollSum = document.getElementById(\"chkrollsum\");\n chkRollSum.addEventListener(\"change\", function (e) {\n if (chkRollSum.checked) {\n if (disco.uploadHelper.indexOf(\"?\") == -1) {\n uploadform.action = disco.uploadHelper + \"?rollsum=1\";\n } else {\n uploadform.action = disco.uploadHelper + \"&rollsum=1\";\n }\n } else {\n uploadform.action = disco.uploadHelper;\n }\n });\n }\n}\n\nfunction indexBuildRecentlyUpdatedPermanodes(searchRes) {\n var div = document.getElementById(\"recent\");\n div.innerHTML = \"\";\n for (var i = 0; i < searchRes.recent.length; i++) {\n var result = searchRes.recent[i]; \n var pdiv = document.createElement(\"li\");\n var alink = document.createElement(\"a\");\n alink.href = \"./?p=\" + result.blobref;\n alink.innerText = camliBlobTitle(result.blobref, searchRes);\n pdiv.appendChild(alink);\n div.appendChild(pdiv);\n }\n}\n\nwindow.addEventListener(\"load\", indexOnLoad);\n", time.Unix(0, 1323566533000000000));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// THIS FILE IS AUTO-GENERATED FROM permanode.html
|
||||
// DO NOT EDIT.
|
||||
package ui
|
||||
import "time"
|
||||
func init() {
|
||||
Files.Add("permanode.html", "<!doctype html>\n<html>\n<head>\n <title>Permanode</title>\n <script src=\"base64.js\"></script>\n <script src=\"Crypto.js\"></script>\n <script src=\"SHA1.js\"></script>\n <script src=\"camli.js\"></script>\n <script src=\"?camli.mode=config&cb=onConfiguration\"></script>\n <script src=\"permanode.js\"></script>\n <link rel=\"stylesheet\" href=\"camli.css\">\n</head>\n<body class=\"camli-ui-permanode\">\n <div class=\"camli-nav\"><a href=\"./\">Home</a></div>\n <h1>Permanode</h1>\n\n <p>\n Permalink:\n <span id=\"permanode\"></span>\n <span id=\"permanodeBlob\" class=\"camli-nav\"></span>\n </p>\n\n <form id=\"formTitle\">\n <p>\n Title: <input type=\"text\" id=\"inputTitle\" size=\"30\" value=\"(loading)\" disabled=\"disabled\">\n <input type=\"submit\" id=\"btnSaveTitle\" value=\"Save\" disabled=\"disabled\">\n </p>\n </form>\n\n <form id=\"formTags\">\n <p>\n <label for=\"inputNewTag\">Tags:</label>\n <span id=\"spanTags\"></span>\n <input id=\"inputNewTag\" placeholder=\"tag1, tag2, tag3\">\n <input type=\"submit\" id=\"btnAddTag\" value=\"Add Tag(s)\">\n </form>\n\n <form id=\"formAccess\">\n <p>Access:\n <select id=\"selectAccess\" disabled=\"disabled\">\n <option value=\"private\">Private</option>\n <option value=\"public\">Public</option>\n </select>\n <input type=\"submit\" id=\"btnSaveAccess\" value=\"Save\" disabled=\"disabled\">\n\n ... with URL: <select id=\"selectPublishRoot\">\n <option value=\"\"></option>\n </select>\n <input type=\"text\" id=\"publishSuffix\" size=\"40\">\n <input type=\"submit\" id=\"btnSavePublish\" value=\"Set URL\">\n </p>\n </form>\n\n <div id=\"existingPaths\"></div>\n\n <div id=\"members\"></div>\n\n <form id=\"formType\">\n <p>Type:\n <select id='type'>\n <option value=''>(None / auto)</option>\n <option value='_other'>(Other)</option>\n <option value=\"root\">Root (of a hierarchy)</option>\n <option value=\"collection\">Collection (e.g. directory, gallery)</option>\n <option value=\"file\">File</option>\n <option value=\"collection\">File Collection / Gallery</option>\n <option value=\"microblog\">Microblog Post</option>\n <option value=\"blog\">Blog Post</option>\n </select>\n </p>\n </form>\n\n <p>\n <button id=\"btnGallery\"> Show gallery </button> \n </p>\n\n <div id=\"content\"></div>\n\n <div id=\"dnd\" class=\"camli-dnd\">\n <form id=\"fileForm\">\n <input type=\"file\" id=\"fileInput\" multiple=\"true\" onchange=\"\">\n <input type=\"submit\" id=\"fileUploadBtn\" value=\"Upload\">\n </form>\n <p>\n <em>or drag & drop files here</em>\n </p>\n <pre id=\"info\"></pre>\n </div>\n\n <h3>Current object attributes</h3>\n <pre id=\"debugattrs\" style=\"font-size: 8pt\"></pre>\n\n</body>\n</html>\n");
|
||||
Files.Add("permanode.html", "<!doctype html>\n<html>\n<head>\n <title>Permanode</title>\n <script src=\"base64.js\"></script>\n <script src=\"Crypto.js\"></script>\n <script src=\"SHA1.js\"></script>\n <script src=\"camli.js\"></script>\n <script src=\"?camli.mode=config&cb=onConfiguration\"></script>\n <script src=\"permanode.js\"></script>\n <link rel=\"stylesheet\" href=\"camli.css\">\n</head>\n<body class=\"camli-ui-permanode\">\n <div class=\"camli-nav\"><a href=\"./\">Home</a></div>\n <h1>Permanode</h1>\n\n <p>\n Permalink:\n <span id=\"permanode\"></span>\n <span id=\"permanodeBlob\" class=\"camli-nav\"></span>\n </p>\n\n <form id=\"formTitle\">\n <p>\n Title: <input type=\"text\" id=\"inputTitle\" size=\"30\" value=\"(loading)\" disabled=\"disabled\">\n <input type=\"submit\" id=\"btnSaveTitle\" value=\"Save\" disabled=\"disabled\">\n </p>\n </form>\n\n <form id=\"formTags\">\n <p>\n <label for=\"inputNewTag\">Tags:</label>\n <span id=\"spanTags\"></span>\n <input id=\"inputNewTag\" placeholder=\"tag1, tag2, tag3\">\n <input type=\"submit\" id=\"btnAddTag\" value=\"Add Tag(s)\">\n </form>\n\n <form id=\"formAccess\">\n <p>Access:\n <select id=\"selectAccess\" disabled=\"disabled\">\n <option value=\"private\">Private</option>\n <option value=\"public\">Public</option>\n </select>\n <input type=\"submit\" id=\"btnSaveAccess\" value=\"Save\" disabled=\"disabled\">\n\n ... with URL: <select id=\"selectPublishRoot\">\n <option value=\"\"></option>\n </select>\n <input type=\"text\" id=\"publishSuffix\" size=\"40\">\n <input type=\"submit\" id=\"btnSavePublish\" value=\"Set URL\">\n </p>\n </form>\n\n <div id=\"existingPaths\"></div>\n\n <div id=\"members\"></div>\n\n <form id=\"formType\">\n <p>Type:\n <select id='type'>\n <option value=''>(None / auto)</option>\n <option value='_other'>(Other)</option>\n <option value=\"root\">Root (of a hierarchy)</option>\n <option value=\"collection\">Collection (e.g. directory, gallery)</option>\n <option value=\"file\">File</option>\n <option value=\"collection\">File Collection / Gallery</option>\n <option value=\"microblog\">Microblog Post</option>\n <option value=\"blog\">Blog Post</option>\n </select>\n </p>\n </form>\n\n <p>\n <button id=\"btnGallery\"> Show gallery </button> \n </p>\n\n <div id=\"content\"></div>\n\n <div id=\"dnd\" class=\"camli-dnd\">\n <form id=\"fileForm\">\n <input type=\"file\" id=\"fileInput\" multiple=\"true\" onchange=\"\">\n <input type=\"submit\" id=\"fileUploadBtn\" value=\"Upload\">\n </form>\n <p>\n <em>or drag & drop files here</em>\n </p>\n <pre id=\"info\"></pre>\n </div>\n\n <h3>Current object attributes</h3>\n <pre id=\"debugattrs\" style=\"font-size: 8pt\"></pre>\n\n</body>\n</html>\n", time.Unix(0, 1309849899000000000));
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,7 @@
|
|||
// THIS FILE IS AUTO-GENERATED FROM pics.js
|
||||
// DO NOT EDIT.
|
||||
package ui
|
||||
import "time"
|
||||
func init() {
|
||||
Files.Add("pics.js", "\n// jquery-colorbox browsable photo gallery\n\nfunction addColorboxen() {\n $(document).ready(function() {\n $('li > a').each(function() {\n this.setAttribute('rel', 'camligroup');\n })\n $('a[rel=\"camligroup\"]').colorbox({\n transition:'none',\n width: '75%',\n height: '75%',\n top: '30px',\n open: false,\n href: function() {\n return $(this).parent().find('.camlifile a').attr('href');\n },\n title: function() {\n return $($(this).parent().find('a').get(0)).text();\n }\n });\n });\n}\n\nvar titleInput, editLink;\nfunction init() {\n $(document).ready(function() {\n // Before the images are loaded, rewrite the urls to include the square\n // parameter.\n $('li img').each(function() {\n this.src = this.src + '&square=1';\n });\n\n if (camliViewIsOwner) {\n $('body').addClass('camliadmin');\n\n editLink = $(document.createElement('a'));\n editLink.attr('#');\n editLink.addClass('pics-edit');\n editLink.html('edit title');\n editLink.click(function(e) {\n editTitle();\n e.stopPropagation();\n e.preventDefault();\n });\n\n titleInput = $(document.createElement('input'));\n titleInput.blur(function() {\n saveImgTitle($(this));\n });\n titleInput.bind('keypress', function(e) {\n if (e.keyCode == 13) {\n saveImgTitle($(this));\n }\n });\n\n $('li').mouseenter(function(e) {\n $(this).find('img').after(editLink);\n editLink.show();\n });\n $('li').mouseleave(function(e) {\n editLink.hide();\n });\n }\n });\n}\n\nfunction editTitle() {\n var titleSpan = editLink.next();\n titleInput.val(titleSpan.text());\n titleSpan.parent().after(titleInput);\n titleInput.show();\n titleInput.focus();\n titleInput.select();\n titleSpan.hide();\n editLink.hide();\n}\n\nfunction saveImgTitle(titleInput) {\n var spanTitle = titleInput.parent().find('a span');\n var spanText = spanTitle.text();\n var newVal = titleInput.val();\n if (spanText != newVal) {\n spanTitle.text(newVal);\n var blobRef = titleInput.parent().attr('id').replace(/^camli-/, '');\n camliNewSetAttributeClaim(\n blobRef,\n \"title\",\n newVal,\n {\n success: function() {\n titleInput.hide();\n spanTitle.show();\n spanTitle.effect('highlight', {}, 300);\n },\n fail: function(msg) {\n alert(msg);\n }\n });\n }\n titleInput.hide();\n spanTitle.show();\n}\n\n// Installs jQuery and the colorbox library along with an onload listener\n// to fire the init function above.\nif (typeof window['jQuery'] == 'undefined') {\n document.write('<link media=\"screen\" rel=\"stylesheet\" href=\"//colorpowered.com/colorbox/core/example1/colorbox.css\">');\n document.write('<scr'+'ipt src=\"//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js\" onload=\"init()\"></sc'+'ript>');\n document.write('<scr'+'ipt src=\"//ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.js\"></sc'+'ript>');\n document.write('<scr'+'ipt src=\"//colorpowered.com/colorbox/core/colorbox/jquery.colorbox.js\" onload=\"addColorboxen()\"></sc'+'ript>');\n}\n");
|
||||
Files.Add("pics.js", "\n// jquery-colorbox browsable photo gallery\n\nfunction addColorboxen() {\n $(document).ready(function() {\n $('li > a').each(function() {\n this.setAttribute('rel', 'camligroup');\n })\n $('a[rel=\"camligroup\"]').colorbox({\n transition:'none',\n width: '75%',\n height: '75%',\n top: '30px',\n open: false,\n href: function() {\n return $(this).parent().find('.camlifile a').attr('href');\n },\n title: function() {\n return $($(this).parent().find('a').get(0)).text();\n }\n });\n });\n}\n\nvar titleInput, editLink;\nfunction init() {\n $(document).ready(function() {\n // Before the images are loaded, rewrite the urls to include the square\n // parameter.\n $('li img').each(function() {\n this.src = this.src + '&square=1';\n });\n\n if (camliViewIsOwner) {\n $('body').addClass('camliadmin');\n\n editLink = $(document.createElement('a'));\n editLink.attr('#');\n editLink.addClass('pics-edit');\n editLink.html('edit title');\n editLink.click(function(e) {\n editTitle();\n e.stopPropagation();\n e.preventDefault();\n });\n\n titleInput = $(document.createElement('input'));\n titleInput.blur(function() {\n saveImgTitle($(this));\n });\n titleInput.bind('keypress', function(e) {\n if (e.keyCode == 13) {\n saveImgTitle($(this));\n }\n });\n\n $('li').mouseenter(function(e) {\n $(this).find('img').after(editLink);\n editLink.show();\n });\n $('li').mouseleave(function(e) {\n editLink.hide();\n });\n }\n });\n}\n\nfunction editTitle() {\n var titleSpan = editLink.next();\n titleInput.val(titleSpan.text());\n titleSpan.parent().after(titleInput);\n titleInput.show();\n titleInput.focus();\n titleInput.select();\n titleSpan.hide();\n editLink.hide();\n}\n\nfunction saveImgTitle(titleInput) {\n var spanTitle = titleInput.parent().find('a span');\n var spanText = spanTitle.text();\n var newVal = titleInput.val();\n if (spanText != newVal) {\n spanTitle.text(newVal);\n var blobRef = titleInput.parent().attr('id').replace(/^camli-/, '');\n camliNewSetAttributeClaim(\n blobRef,\n \"title\",\n newVal,\n {\n success: function() {\n titleInput.hide();\n spanTitle.show();\n spanTitle.effect('highlight', {}, 300);\n },\n fail: function(msg) {\n alert(msg);\n }\n });\n }\n titleInput.hide();\n spanTitle.show();\n}\n\n// Installs jQuery and the colorbox library along with an onload listener\n// to fire the init function above.\nif (typeof window['jQuery'] == 'undefined') {\n document.write('<link media=\"screen\" rel=\"stylesheet\" href=\"//colorpowered.com/colorbox/core/example1/colorbox.css\">');\n document.write('<scr'+'ipt src=\"//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js\" onload=\"init()\"></sc'+'ript>');\n document.write('<scr'+'ipt src=\"//ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.js\"></sc'+'ript>');\n document.write('<scr'+'ipt src=\"//colorpowered.com/colorbox/core/colorbox/jquery.colorbox.js\" onload=\"addColorboxen()\"></sc'+'ript>');\n}\n", time.Unix(0, 1310770714000000000));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// THIS FILE IS AUTO-GENERATED FROM search.html
|
||||
// DO NOT EDIT.
|
||||
package ui
|
||||
import "time"
|
||||
func init() {
|
||||
Files.Add("search.html", "<html>\n<head>\n <title>Camlistored UI</title>\n <script type=\"text/javascript\" src=\"Crypto.js\"></script>\n <script type=\"text/javascript\" src=\"SHA1.js\"></script>\n <script src=\"camli.js\"></script>\n <script src=\"?camli.mode=config&cb=onConfiguration\"></script>\n <script src=\"search.js\"></script>\n <link rel=\"stylesheet\" href=\"camli.css\">\n</head>\n<body>\n <div class=\"camli-nav\"><a href=\"./\">Home</a></div>\n\n <h1>Search</h1>\n\n <h2>In all attributes</h2>\n <form id=\"formAnyAttr\">\n <input id=\"inputAnyAttr\" placeholder=\"attrValue1\">\n <input type=\"submit\" id=\"btnAnyAttr\" value=\"Search\">\n </form>\n\n <h2>By Tag</h2>\n <form id=\"formTags\">\n <input id=\"inputTag\" placeholder=\"tag1\">\n <input type=\"submit\" id=\"btnTagged\" value=\"Search\">\n </form>\n\n <h2>By Title</h2>\n <form id=\"formTitles\">\n <input id=\"inputTitle\" placeholder=\"title1\">\n <input type=\"submit\" id=\"btnTitle\" value=\"Search\">\n </form>\n\n <h3 id=\"titleRes\">Search</h3>\n <div id=\"divRes\">\n</div>\n <p>\n <form id=\"formAddToCollec\">\n <input id=\"inputCollec\" placeholder=\"collection's permanode\">\n <input type=\"submit\" id=\"btnAddToCollec\" value=\"Add to collection\"> or\n </form>\n <button id=\"btnNewCollec\">Create new collection</button>\n </p>\n\n</body>\n</html>\n");
|
||||
Files.Add("search.html", "<html>\n<head>\n <title>Camlistored UI</title>\n <script type=\"text/javascript\" src=\"Crypto.js\"></script>\n <script type=\"text/javascript\" src=\"SHA1.js\"></script>\n <script src=\"camli.js\"></script>\n <script src=\"?camli.mode=config&cb=onConfiguration\"></script>\n <script src=\"search.js\"></script>\n <link rel=\"stylesheet\" href=\"camli.css\">\n</head>\n<body>\n <div class=\"camli-nav\"><a href=\"./\">Home</a></div>\n\n <h1>Search</h1>\n\n <h2>In all attributes</h2>\n <form id=\"formAnyAttr\">\n <input id=\"inputAnyAttr\" placeholder=\"attrValue1\">\n <input type=\"submit\" id=\"btnAnyAttr\" value=\"Search\">\n </form>\n\n <h2>By Tag</h2>\n <form id=\"formTags\">\n <input id=\"inputTag\" placeholder=\"tag1\">\n <input type=\"submit\" id=\"btnTagged\" value=\"Search\">\n </form>\n\n <h2>By Title</h2>\n <form id=\"formTitles\">\n <input id=\"inputTitle\" placeholder=\"title1\">\n <input type=\"submit\" id=\"btnTitle\" value=\"Search\">\n </form>\n\n <h3 id=\"titleRes\">Search</h3>\n <div id=\"divRes\">\n</div>\n <p>\n <form id=\"formAddToCollec\">\n <input id=\"inputCollec\" placeholder=\"collection's permanode\">\n <input type=\"submit\" id=\"btnAddToCollec\" value=\"Add to collection\"> or\n </form>\n <button id=\"btnNewCollec\">Create new collection</button>\n </p>\n\n</body>\n</html>\n", time.Unix(0, 1316041554000000000));
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,7 @@
|
|||
// THIS FILE IS AUTO-GENERATED FROM sigdebug.js
|
||||
// DO NOT EDIT.
|
||||
package ui
|
||||
import "time"
|
||||
func init() {
|
||||
Files.Add("sigdebug.js", "var sigdisco = null;\n\nfunction discoverJsonSign() {\n var xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function() {\n if (xhr.readyState != 4) { return; }\n if (xhr.status != 200) {\n console.log(\"no status 200; got \" + xhr.status);\n return;\n }\n sigdisco = JSON.parse(xhr.responseText);\n document.getElementById(\"sigdiscores\").innerHTML = \"<pre>\" + JSON.stringify(sigdisco, null, 2) + \"</pre>\";\n };\n xhr.open(\"GET\", disco.jsonSignRoot + \"/camli/sig/discovery\", true);\n xhr.send();\n}\n\nfunction addKeyRef() {\n if (!sigdisco) {\n alert(\"must do jsonsign discovery first\"); \n return;\n }\n clearta = document.getElementById(\"clearjson\");\n var j;\n try {\n j = JSON.parse(clearta.value);\n } catch (x) {\n alert(x);\n return\n }\n j.camliSigner = sigdisco.publicKeyBlobRef;\n clearta.value = JSON.stringify(j);\n}\n\nfunction doSign() {\n if (!sigdisco) {\n alert(\"must do jsonsign discovery first\");\n return;\n }\n clearta = document.getElementById(\"clearjson\");\n\n var xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function() {\n if (xhr.readyState != 4) { return; }\n if (xhr.status != 200) {\n alert(\"got status \" + xhr.status)\n return;\n }\n document.getElementById(\"signedjson\").value = xhr.responseText;\n };\n xhr.open(\"POST\", sigdisco.signHandler, true);\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n xhr.send(\"json=\" + encodeURIComponent(clearta.value));\n}\n\nfunction doVerify() {\n if (!sigdisco) {\n alert(\"must do jsonsign discovery first\");\n return;\n }\n\n signedta = document.getElementById(\"signedjson\");\n\n var xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function() {\n if (xhr.readyState != 4) { return; }\n if (xhr.status != 200) {\n alert(\"got status \" + xhr.status)\n return;\n }\n document.getElementById(\"verifyinfo\").innerHTML = \"<pre>\" + xhr.responseText + \"</pre>\";\n };\n xhr.open(\"POST\", sigdisco.verifyHandler, true);\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n xhr.send(\"sjson=\" + encodeURIComponent(signedta.value));\n}\n");
|
||||
Files.Add("sigdebug.js", "var sigdisco = null;\n\nfunction discoverJsonSign() {\n var xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function() {\n if (xhr.readyState != 4) { return; }\n if (xhr.status != 200) {\n console.log(\"no status 200; got \" + xhr.status);\n return;\n }\n sigdisco = JSON.parse(xhr.responseText);\n document.getElementById(\"sigdiscores\").innerHTML = \"<pre>\" + JSON.stringify(sigdisco, null, 2) + \"</pre>\";\n };\n xhr.open(\"GET\", disco.jsonSignRoot + \"/camli/sig/discovery\", true);\n xhr.send();\n}\n\nfunction addKeyRef() {\n if (!sigdisco) {\n alert(\"must do jsonsign discovery first\"); \n return;\n }\n clearta = document.getElementById(\"clearjson\");\n var j;\n try {\n j = JSON.parse(clearta.value);\n } catch (x) {\n alert(x);\n return\n }\n j.camliSigner = sigdisco.publicKeyBlobRef;\n clearta.value = JSON.stringify(j);\n}\n\nfunction doSign() {\n if (!sigdisco) {\n alert(\"must do jsonsign discovery first\");\n return;\n }\n clearta = document.getElementById(\"clearjson\");\n\n var xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function() {\n if (xhr.readyState != 4) { return; }\n if (xhr.status != 200) {\n alert(\"got status \" + xhr.status)\n return;\n }\n document.getElementById(\"signedjson\").value = xhr.responseText;\n };\n xhr.open(\"POST\", sigdisco.signHandler, true);\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n xhr.send(\"json=\" + encodeURIComponent(clearta.value));\n}\n\nfunction doVerify() {\n if (!sigdisco) {\n alert(\"must do jsonsign discovery first\");\n return;\n }\n\n signedta = document.getElementById(\"signedjson\");\n\n var xhr = new XMLHttpRequest();\n xhr.onreadystatechange = function() {\n if (xhr.readyState != 4) { return; }\n if (xhr.status != 200) {\n alert(\"got status \" + xhr.status)\n return;\n }\n document.getElementById(\"verifyinfo\").innerHTML = \"<pre>\" + xhr.responseText + \"</pre>\";\n };\n xhr.open(\"POST\", sigdisco.verifyHandler, true);\n xhr.setRequestHeader(\"Content-Type\", \"application/x-www-form-urlencoded\");\n xhr.send(\"sjson=\" + encodeURIComponent(signedta.value));\n}\n", time.Unix(0, 1309407835000000000));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// THIS FILE IS AUTO-GENERATED FROM signing.html
|
||||
// DO NOT EDIT.
|
||||
package ui
|
||||
import "time"
|
||||
func init() {
|
||||
Files.Add("signing.html", "<html>\n<head>\n <title>Camlistored UI</title>\n <script src=\"camli.js\"></script>\n <script src=\"sigdebug.js\"></script>\n <script src=\"./?camli.mode=config&cb=onConfiguration\"></script>\n</head>\n<body>\n <h1>Signing Debug</h1>\n <form>\n <p><input type=\"button\" id=\"sigdiscobtn\" onclick=\"discoverJsonSign()\" value=\"Do jsonSign discovery\" /></p>\n <div id=\"sigdiscores\" style=\"border: 2px solid gray\">(jsonsign discovery results)</div>\n\n <table>\n <tr align='left'>\n <th>JSON blob to sign: <input type='button' id='addkeyref' onclick='addKeyRef()' value=\"Add keyref\"/></th>\n <th></th>\n <th>Signed blob:</th>\n <th></th>\n <th>Verification details:</th>\n </tr>\n <tr>\n <td><textarea id='clearjson' rows=10 cols=40>{\"camliVersion\": 1,\n \"camliType\": \"whatever\",\n \"foo\": \"bar\"\n}</textarea></td>\n <td valign='middle'><input type='button' id='sign' onclick='doSign()' value=\"Sign >>\" /></td>\n <td><textarea id=\"signedjson\" rows=10 cols=40></textarea></td>\n <td valign='middle'><input type='button' id='sign' onclick='doVerify()' value=\"Verify >>\" /></td>\n <td><div id='verifyinfo'></div></td>\n </tr>\n </table>\n </form>\n\n</body>\n</html>\n");
|
||||
Files.Add("signing.html", "<html>\n<head>\n <title>Camlistored UI</title>\n <script src=\"camli.js\"></script>\n <script src=\"sigdebug.js\"></script>\n <script src=\"./?camli.mode=config&cb=onConfiguration\"></script>\n</head>\n<body>\n <h1>Signing Debug</h1>\n <form>\n <p><input type=\"button\" id=\"sigdiscobtn\" onclick=\"discoverJsonSign()\" value=\"Do jsonSign discovery\" /></p>\n <div id=\"sigdiscores\" style=\"border: 2px solid gray\">(jsonsign discovery results)</div>\n\n <table>\n <tr align='left'>\n <th>JSON blob to sign: <input type='button' id='addkeyref' onclick='addKeyRef()' value=\"Add keyref\"/></th>\n <th></th>\n <th>Signed blob:</th>\n <th></th>\n <th>Verification details:</th>\n </tr>\n <tr>\n <td><textarea id='clearjson' rows=10 cols=40>{\"camliVersion\": 1,\n \"camliType\": \"whatever\",\n \"foo\": \"bar\"\n}</textarea></td>\n <td valign='middle'><input type='button' id='sign' onclick='doSign()' value=\"Sign >>\" /></td>\n <td><textarea id=\"signedjson\" rows=10 cols=40></textarea></td>\n <td valign='middle'><input type='button' id='sign' onclick='doVerify()' value=\"Verify >>\" /></td>\n <td><div id='verifyinfo'></div></td>\n </tr>\n </table>\n </form>\n\n</body>\n</html>\n", time.Unix(0, 1307659868000000000));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue