From 9490372a4739a2c9b16aa9be8cf4ae9a2bd420e1 Mon Sep 17 00:00:00 2001 From: Marcus Rohrmoser Date: Sun, 31 Mar 2019 18:03:42 +0200 Subject: [PATCH] =?utf8?q?=F0=9F=90=B3.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bindata.go | 258 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ build.sh | 3 + pinboard.go | 261 +++++++++++++++++++++++++++--------------------------------- 3 files changed, 379 insertions(+), 143 deletions(-) create mode 100644 bindata.go diff --git a/bindata.go b/bindata.go new file mode 100644 index 0000000..4bb9c66 --- /dev/null +++ b/bindata.go @@ -0,0 +1,258 @@ +// Code generated by go-bindata. +// sources: +// doap.rdf +// openapi.yaml +// DO NOT EDIT! + +package main + +import ( + "bytes" + "compress/gzip" + "fmt" + "io" + "io/ioutil" + "os" + "path/filepath" + "strings" + "time" +) + +func bindataRead(data []byte, name string) ([]byte, error) { + gz, err := gzip.NewReader(bytes.NewBuffer(data)) + if err != nil { + return nil, fmt.Errorf("Read %q: %v", name, err) + } + + var buf bytes.Buffer + _, err = io.Copy(&buf, gz) + clErr := gz.Close() + + if err != nil { + return nil, fmt.Errorf("Read %q: %v", name, err) + } + if clErr != nil { + return nil, err + } + + return buf.Bytes(), nil +} + +type asset struct { + bytes []byte + info os.FileInfo +} + +type bindataFileInfo struct { + name string + size int64 + mode os.FileMode + modTime time.Time +} + +func (fi bindataFileInfo) Name() string { + return fi.name +} +func (fi bindataFileInfo) Size() int64 { + return fi.size +} +func (fi bindataFileInfo) Mode() os.FileMode { + return fi.mode +} +func (fi bindataFileInfo) ModTime() time.Time { + return fi.modTime +} +func (fi bindataFileInfo) IsDir() bool { + return false +} +func (fi bindataFileInfo) Sys() interface{} { + return nil +} + +var _doapRdf = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x93\x4f\x6f\xdb\x3c\x0c\xc6\xef\xf9\x14\x82\x0b\xbc\x37\x9b\x6d\xde\x1d\x96\x4c\x71\x0f\x5b\xf7\x07\x18\x86\x20\xfd\x04\x8a\xac\xc8\xdc\x2c\xd1\x20\xe5\x39\xbd\xec\xb3\x0f\xae\x12\x0f\x68\x73\x6a\x4e\x16\x28\x3f\x3f\x3e\x14\x49\x7d\x7f\x0c\x9d\xfa\xed\x58\x90\xe2\xa6\xb8\xab\x6e\x0b\xe5\xa2\xa5\x06\xa3\xdf\x14\x43\x3a\x94\xef\x8b\xfb\x7a\xa1\xb9\x39\xac\x77\x9f\x3e\xab\x63\xe8\xa2\xac\xb9\x39\x6c\x8a\x36\xa5\x7e\x0d\x30\x8e\x63\x35\xfe\x5f\x11\x7b\xb8\x5b\xad\x56\x70\xbb\x84\xe5\xb2\xe4\xe6\x50\xca\x53\x4c\xe6\x58\x46\xb9\x29\x16\x4a\x65\xe9\x2c\x1b\xc4\x1d\x86\x0e\xa3\xad\x2c\x05\x88\x02\x0d\x99\xfe\xa6\xa8\x17\x4a\xe9\x2d\xd3\x4f\x67\xd3\x74\x56\x4a\xef\x07\x5f\x36\x26\x99\xbd\x11\xa7\x26\x1f\xec\x84\x06\xb6\x2e\xb3\x64\x0d\x60\xa9\x71\x55\x60\xaa\xa2\x09\x0e\x02\x13\xf4\x18\xf7\x64\xb8\x79\x27\xad\x31\xdc\x21\xa0\xc8\xe0\xa4\x80\x13\xb4\xa5\xe0\x7a\xe3\xaf\x00\xce\xa8\x0e\xad\x8b\xd7\x58\x13\xb6\x10\x8c\x24\xc7\xf0\xfd\xdb\xc7\x87\x1f\x8f\x0f\x33\x3b\x18\x8c\xc9\x60\x74\x7c\x01\xbf\x06\x98\xc1\x7f\x82\x9b\x45\x53\xa0\x7e\x99\xa5\xb2\x1e\x35\x3c\x5f\xe5\xbf\x7a\x26\xcf\x26\x04\x8c\xbe\xec\x4c\xf4\x83\xf1\xae\xf6\x34\x1d\x35\x5c\xbc\xcc\x3a\x76\x3d\x09\x26\xe2\xa7\x1c\x50\x4a\x7f\xc1\xb4\x7b\x15\x9d\x3a\xc7\x34\x5e\xf1\x30\xe7\x82\xf2\x2b\x93\x35\x09\x29\xbe\x99\x56\x79\x4c\xff\x88\x1a\x2e\x98\xd6\xf0\xb2\x38\x2d\x2d\x71\x2a\x1b\x27\x96\xb1\x9f\xf2\xd7\xbb\x21\x2a\x69\x55\x72\x92\x54\x8e\x8a\x32\xde\x60\x94\xa4\xc2\xd0\x25\xec\x3b\xa7\xb6\x5f\xb7\xea\x3f\x13\xfa\x0f\xea\xd4\x28\x8f\xa9\x1d\xf6\xcf\xb3\x7e\x6e\xfb\x63\xfe\x9e\x97\x4f\x2a\x0d\xaf\xb3\x65\x17\x23\xfe\xc2\xb7\xcf\xd7\xa4\xce\x95\x6b\x98\x57\x4b\xc3\x69\xa5\xeb\xbf\x01\x00\x00\xff\xff\x00\x8c\x7e\x5d\x03\x04\x00\x00") + +func doapRdfBytes() ([]byte, error) { + return bindataRead( + _doapRdf, + "doap.rdf", + ) +} + +func doapRdf() (*asset, error) { + bytes, err := doapRdfBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "doap.rdf", size: 1027, mode: os.FileMode(420), modTime: time.Unix(1553807079, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +var _openapiYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xcc\x5a\xfd\x72\xdc\x36\x92\xff\x7f\x9e\xa2\xcb\x77\x55\x93\x54\x34\x9c\x0f\x4b\xb2\x35\x57\x57\x77\x3a\x2b\xce\xc9\xb1\xcf\x2a\x59\xca\xe5\x6e\x6b\x37\xd5\x43\x34\x87\xb0\x48\x80\x01\xc0\x19\x71\x6b\xdf\x67\x1f\x64\x5f\x6c\xab\x01\x72\xc8\xf9\xb2\xc7\xb2\x94\x64\xfe\x92\x08\xa0\xbb\xf1\x43\xa3\xbf\xd0\x83\xc1\xa0\xa7\x0b\x52\x58\xc8\x29\x3c\x8f\x46\xd1\xb8\x27\x55\xa2\xa7\x3d\x00\x27\x5d\x46\x53\xf8\x50\xce\x2c\x39\xd0\x09\xb8\x94\xe0\x4a\xaa\x99\x46\x23\xe0\xfc\xea\xb2\x07\x20\xc8\xc6\x46\x16\x4e\x6a\x35\x85\xbf\x0d\x7a\x00\x00\x37\x1b\xd3\x40\x5a\x40\x58\x62\x05\x4e\x83\x54\x8e\x0c\xc6\x0e\x0a\xa3\xe7\x06\x73\x74\x32\xc6\x2c\xab\x60\x29\x5d\x0a\x95\x2e\x0d\xcc\xb4\xbe\xcb\xd1\xdc\xd9\x23\x4f\x4e\x69\x47\x16\x50\x09\xd0\x2e\x25\xd3\x92\x16\xe8\x30\xea\xf9\x39\xff\x9b\x92\xa1\x05\x19\x28\xb4\xb5\x72\x96\xd1\x96\xac\x50\x5a\xb2\xfe\xab\xc5\x9c\xc0\x56\xca\xe1\xbd\xa7\x9a\x93\x4b\xb5\x00\x85\x39\xb3\xb1\x9e\x1e\xcf\xbb\xa0\x4c\xc6\x52\x97\x16\x7e\x1a\x33\x85\x08\x3e\x10\x81\x90\x49\x42\x86\x54\x4c\x16\x12\xa3\xf3\xce\xb4\x44\x1b\x40\x48\xca\x2c\x83\x4c\x5a\x46\xcc\xd3\x42\x43\x68\x61\xc9\x12\x7a\xba\xe7\x57\x97\x16\x84\x5c\x90\x99\x53\x2d\xfe\xeb\xd2\x95\x86\x40\x5a\x5b\x92\x85\x1c\x2b\x98\x91\x1f\x18\x00\x96\x4e\x0f\x12\x99\x65\xa0\x15\x0c\x0b\x6d\x9d\x1d\xce\xc9\x79\x66\xa5\xba\x53\x7a\xa9\xa0\x34\x99\xad\xa7\x2b\xad\xe0\xf6\xe6\x15\x38\x99\xd3\x5f\xb5\xa2\xe6\x3b\xa9\x38\xd3\xb6\x34\x64\xe1\x1b\x99\xe3\x9c\xec\x11\xb8\xb4\xcc\x67\x0a\x65\x66\xbf\xed\x01\xc4\x5a\x39\x8c\xdd\xd4\x2f\xa0\x1c\x65\x36\x85\xa2\x06\x70\x80\x85\xfc\xcf\xdc\xe8\x88\x41\xea\x01\x2c\xc8\x58\x7f\xe2\xfd\x71\xbf\x47\xf7\x8e\x8c\xc2\xec\x42\xc7\x76\xba\xa9\x12\x1b\xea\x52\x9a\x6c\x0a\xa9\x73\x85\x9d\x0e\x87\x0d\xf5\x48\xaa\x21\x16\x72\xd8\xb3\x64\x98\xf2\xb4\x37\x58\x9f\x28\x28\xd7\x51\xc3\x7e\x68\x53\x44\x93\xc9\xc1\x62\x14\x1d\x8f\x67\x2b\x2a\xc7\xf5\xf7\x28\x9e\xcb\xe1\x62\x7c\x30\x8d\xf1\x28\x9a\x7c\x15\x91\xb9\x6e\xff\xda\xb3\x0e\x0b\x19\x75\x77\xbb\x18\xf7\x0a\x74\xa9\x87\xeb\xd9\x10\x67\xba\x74\xcf\x02\xf0\x73\xaa\x4f\x00\xc0\xe1\xdc\x36\x7f\x0f\xc0\x4f\xaa\xff\xb3\x65\x9e\xa3\xa9\xa6\x80\x70\xf1\xfe\xfc\x0a\xae\x2f\x5e\x7f\xf7\xf3\xbb\xb7\xf5\xa8\x2e\xc8\x20\xa3\x7f\x29\xa6\x61\xd9\x85\xc6\xa2\x1e\x34\x64\x0b\xad\x2c\xad\x28\x03\xf4\x27\xa3\x51\xbf\xfd\x77\xe3\x00\x77\xb2\xe0\x1f\xeb\x0b\x29\xd7\x5d\x08\x80\x45\x91\xc9\xd8\x73\x1f\x1a\x91\x7c\x77\x9f\x67\xeb\x13\x00\x6c\x9c\x52\x8e\x9b\x5f\x01\x76\x4c\xf5\xb7\x1f\x73\x9a\x82\x11\xc9\xf4\xfa\xe2\xb5\x87\xab\xb4\x64\x18\xd1\x5f\x9c\xbe\x23\xf5\x39\xdc\x78\xf6\x26\x6c\xd7\xe4\x4a\xa3\x82\x35\xe0\xf1\xbe\xf5\x16\xc2\xd3\x83\x6f\xf8\x66\xe5\x78\x27\xd5\xdc\x7f\x65\xeb\x64\xbd\x75\xd2\xa5\x03\x84\x02\xad\x5d\x6a\x23\xbe\x8d\x76\xe2\x5d\xc8\x1b\x26\x53\x8f\x15\x68\x30\x27\xe7\x95\xba\x91\xe8\xd9\xbf\x1a\x4a\x9e\x4d\xe1\xd9\xbf\x0c\x63\x9d\x17\x5a\x91\x72\x76\xd8\xce\x1c\x26\xda\xe4\xe8\xae\xf8\xc3\xb3\x87\x1e\xdb\x39\x1b\x8e\x74\xe0\x3a\xb2\x1c\x74\x68\x8f\x76\x60\x64\xcb\xcc\x6d\x0d\xbb\xaa\xa0\x29\x58\x67\xa4\x9a\x6f\x0d\xd2\x3d\xe6\x05\x7b\x9c\x9f\xdf\xff\xf0\xf2\xf4\xfb\x17\x6f\x2e\xff\xef\xdd\xe5\x5e\x49\x3f\x5a\xad\x0e\x15\xb5\x30\x7c\x48\x4e\x76\xf1\x6b\x7f\x41\xd6\x5d\x23\x9f\x93\xa9\x7f\x32\x1a\xef\x3f\x83\xda\x1d\x36\xbf\x57\xa8\x94\x76\xe0\x28\xcb\x00\x83\xb2\x45\x70\x99\xe3\x5c\x2a\x02\x04\xeb\xd0\x51\x46\xd6\x42\x82\xff\xf8\x3b\x0a\x82\x54\x0a\x56\x42\x84\xda\xbc\xc0\x0c\xe3\x3b\x52\x02\x5c\x8a\x0e\x52\xb4\xa0\x34\x48\x41\xc8\xbe\xd9\x96\x71\xca\x64\x53\xbf\x84\xfd\x65\xab\xd3\xd1\x9a\x1c\xef\x55\x56\x81\x4c\xbc\x82\xc0\x12\x2d\x2f\x8d\xc9\xda\xa4\xcc\x8e\x82\x8b\x5d\x4a\x4b\xec\x8a\xf9\x56\x01\xc2\xf1\x68\x3c\x3c\x1e\x3d\x8f\x3e\xa7\x47\x8e\xee\xdd\xb0\xc8\x50\x1e\x7c\x2e\x87\xa9\xc3\xc9\x68\x5c\xdf\x4d\x2f\x32\x83\x68\xcb\xa2\xd0\xc6\x91\x38\xe2\x0b\x0c\xff\x7d\x73\x73\x05\xff\x85\x56\xc6\x91\x37\x11\xc1\x4d\xa2\x10\x9f\xb3\x0e\x7e\xe2\xa6\x79\x38\x17\x02\x70\x15\x85\x44\x70\x6e\xe6\x65\xce\x97\x34\xc4\x28\x36\x45\x41\xc2\x1f\xc6\xdc\xe8\x52\x09\xf6\xf0\x60\xe8\xd7\x52\x1a\x12\xbb\xad\x82\x10\x57\xda\xba\x47\x36\x0a\x07\xac\x2a\x4d\xb6\xb1\x24\x5c\xcf\x8e\x9e\xae\x70\x97\x6a\x0a\xbf\x96\x64\xaa\xde\x4e\x6d\xbe\xe1\x68\xb0\x89\x02\xa5\xa3\x3c\x82\x9b\x54\x5a\x48\x24\x65\x82\x43\xbc\x52\x25\xda\xb8\x52\xb1\x1a\x57\x9e\x8f\x80\x7e\x87\x44\xbf\x73\xc2\x6c\x63\x19\xc0\x25\x1a\x61\x81\x65\x47\x27\x67\x32\x93\xae\x0e\x04\x99\x89\x58\x45\x56\x21\x78\x08\xbf\x06\xe8\x29\x38\x53\x52\x6f\xbf\x8a\xed\x06\x27\xcc\xb3\x43\x1f\xdc\x6e\xc2\xc2\xa1\x8c\x12\x24\x0e\xc5\xe4\xa2\xfd\x67\x1d\x99\x57\x98\x65\xbc\xfd\x86\x60\xff\x53\x3b\xee\xc8\xec\xf7\xbe\x7b\xdf\x5f\xbc\x41\xba\x77\x9b\xfb\x63\xe5\x3f\x74\x6f\x6f\x43\x08\x0b\x65\xc1\x61\xfb\x78\x34\x5a\x5f\xfd\xc5\xe2\xe0\x7c\x4b\x09\xdd\xa1\xb2\xc4\x86\xfc\x5d\xf2\x61\xad\x87\xd2\xb1\xea\xb5\x57\xf4\x82\x12\x2c\x33\x67\x59\xd4\xb8\x34\x86\x94\xf3\x73\x23\xb8\x40\x47\xd6\x61\x5e\xd8\x8e\xa8\xb9\xf6\xb1\x38\x2a\x18\x8f\x20\x97\xaa\xf4\x19\x46\x4a\x28\xbc\x29\xf5\x61\x68\xe0\xb5\xe4\xc8\x7b\xc6\xd7\x9b\x73\xa0\x0e\xf5\x30\xa9\x43\x93\xa7\x3f\x18\x1d\x81\x8e\x98\xc0\x26\x44\x86\x8a\x0c\x63\x3a\x14\xa7\xeb\x30\x1d\x50\x55\x40\xf7\xd2\x3a\x76\x06\x0d\x4a\xcd\xc5\x92\x16\x6e\xaf\xdf\xae\x30\xe3\xab\x5b\x91\xed\x5a\xf7\x4b\xc6\xc0\xef\x56\xe9\xa3\x00\x81\x4b\x8d\x5e\xb2\x53\x21\x63\xb4\x61\xf7\xb1\x22\xeb\x19\x3d\x5c\x31\x2a\xb2\xbf\x28\xbd\xb9\x71\x9b\xa2\x39\xfc\x1e\xbe\xc3\x3b\x6a\x05\x2a\xca\x59\x26\xe3\xb5\x0d\xf6\x2b\xb2\x7d\x28\x95\xf7\xaf\x1c\xf2\x79\xf7\x49\x0a\x67\x59\x87\x4b\xc8\xfb\xfa\x16\x17\x04\xc8\xe7\xde\x24\xa2\xec\x50\x0b\x23\x17\xe8\xa8\x1f\x96\x5b\x72\x0c\xee\x11\x48\x05\xcb\x54\xc6\x29\xc4\x68\xd9\x64\x79\x96\x1d\x8a\xcc\x5c\xe9\xfe\x23\xc3\xe3\xb4\x21\xfc\x02\x78\x78\x0f\xbc\xb7\x15\x46\xc8\xf6\x9a\x69\xac\xc3\xf4\x78\x92\x1e\x12\xb1\xee\xa6\xb7\x5a\x39\xbc\xd0\xca\xdf\x88\x67\x6d\xde\xfb\x20\x87\xde\xc4\xfb\x5a\x11\x70\x70\xcf\xb7\xdf\x4f\xe4\x9c\x1a\xc1\x4a\x35\xcf\x08\x04\x56\x90\xa3\x8b\x7d\x04\xc5\x60\x61\xe3\xf7\x23\xb8\x4c\x56\x62\x2b\x0d\x7c\x5b\x99\x50\x69\x32\x46\x6d\x2e\x17\xa4\x8e\xea\xaf\x09\xe4\xda\x3a\x30\x14\xb3\x95\xe8\xdc\xbd\x60\x47\x4a\xdb\x86\x08\x6b\x67\x74\x99\xf8\x4c\x83\x44\xb8\xa6\x08\x15\xb9\x55\x82\x7f\x7b\xfd\xf6\xc8\x27\x93\xf0\xc3\xf7\x37\x5e\x36\xef\xbe\x7c\xf9\x62\x5e\x92\x6d\x6f\x1f\xa3\x11\xea\x12\x3c\xeb\xf6\x7a\x67\x52\x38\x27\xf7\x24\xe1\xc8\xca\xc9\x1c\xaa\x98\x89\xcc\x1c\x19\x98\x55\xb5\x97\x71\xa9\x21\xfa\x1d\xfd\x8c\xf1\x8a\x52\x27\x04\xad\x7f\x21\xc1\x8a\xe2\x2d\xa7\xc0\xea\xab\x8c\xfc\x03\x62\xb7\xf7\xc5\x96\x1f\xcf\xc9\xe1\xa1\x7b\x92\x2a\xce\x4a\xc1\x19\x46\x9c\xa2\x9a\xb3\x8d\x72\x14\x7b\x6f\x6a\xe5\x5c\x61\xa8\x3c\xf1\x3d\x60\xaa\x80\xce\x19\x39\x2b\xdd\xc3\x7d\xd9\x97\xdb\x81\x75\x9d\xd0\xfa\x89\x12\xd6\x4f\x8b\xed\x0d\x42\xd7\xda\x08\xca\xc8\xd1\x83\x0c\xce\x85\x5f\xda\x4d\x22\x76\x5d\xc3\xc0\xe0\x8f\x91\x18\x3c\xae\xb9\x66\x88\x0e\xb1\xd6\x9d\x9b\xbe\x65\xac\xd7\x2b\xa9\xdd\x5a\x8d\xb7\x71\x98\x69\x35\x6f\x73\x05\x55\xe6\x33\x32\x7e\xa2\xcc\xa9\x63\x0f\x53\xaa\x60\x49\x66\xdd\xf2\x6e\x5a\xc3\x9b\x56\x8e\xdf\xaf\x62\xc3\x51\x56\xd7\xf2\xfd\x86\xd5\x9a\x0d\xbe\x35\x12\x9f\x2c\x9a\x38\x9c\xef\xae\x98\x84\x9c\x1e\x8d\xc1\x6a\xe7\x38\x27\x48\x3b\x29\xb6\x8b\xf5\xec\x23\xc5\xdb\xc5\xa3\x43\xc4\x0a\xbf\x58\x97\x9b\xb0\xad\xff\xf6\xa0\xd1\xfe\x56\x66\x70\x23\xcd\xdc\x27\xb2\x54\x8e\xe6\x6b\xf9\xc0\xe6\xaf\x2d\x67\xec\x9d\xb4\x17\xd3\x47\x17\x7a\x25\x4c\xb0\xb6\xf5\x8d\x3d\xcc\xe2\xed\xba\xb4\x8d\xc1\x53\x6d\xda\xe1\x70\xfe\x09\xab\x77\xb3\x0a\x12\x7e\xdb\xf0\xe3\xb1\xaa\x07\x6d\x94\xf1\x04\x96\xd3\x10\x6f\xe5\x61\xc6\x93\x57\xf2\x39\x38\x9c\x1f\x71\x8c\x9a\xe8\x4c\x80\x74\xec\xe1\x9d\x3e\xe8\x80\x02\xf7\xa7\x3b\x20\x9d\x1d\x9c\xb8\xf4\x95\x66\x65\xf6\x51\x39\x47\xda\x4a\xbb\x90\x67\x59\x52\x56\x3a\xb9\xa0\xfe\x13\x9e\x6c\x23\xb0\xa2\xe5\xc1\xc1\x56\x02\x94\x17\xae\x3a\x62\x51\x7d\x22\xe1\x03\xff\x14\x8b\xa2\x53\x87\xff\x23\x2b\x61\x3b\xc4\x6b\x37\xcf\xbe\x73\xac\x0d\xe9\x80\x51\x18\xe8\xed\x06\x69\x73\x63\x9f\xde\x56\x20\x15\x76\xd6\x84\x29\xeb\xcc\x4a\x93\xed\xe1\xb4\x13\xd9\x2f\x63\x7f\x7b\xfd\x76\x9d\xf7\xfb\xc2\x1d\xca\xfe\x41\x9c\x36\xce\x8e\x8f\x61\xba\x2b\x43\x3c\x07\xc5\xc8\x64\xab\x05\xf5\xa4\xad\x28\xe1\x13\x11\xc2\xae\xe8\x60\x87\x5b\xd9\xfb\x86\xb3\xdf\xf9\xc6\x5a\xd0\xb6\x77\x6a\xfc\xcc\xd6\xc0\x00\x84\x56\xdb\x1e\x6a\x00\x56\xe7\x54\xdf\x1c\x4e\xa0\x97\x46\xef\x78\x1a\xd8\xe3\x09\xb7\xfd\x5f\x0d\x75\x98\xdc\x71\xaf\x3b\x1e\x1e\xd6\xb0\x0e\xe9\xe8\xe4\xe4\x84\x93\x26\x83\x31\xdf\x80\x08\xde\x61\x15\x4c\x90\x56\x0e\xa5\x82\x58\xe7\x39\x5a\xb6\xb2\xcb\x54\x3a\xb2\x05\xc6\x14\xc1\x55\x46\x68\xdb\xad\xcd\x08\x70\x89\xa1\xde\xe8\x42\xec\x3a\xa3\xb9\x54\x4a\x36\xf1\x2b\x42\x41\x46\xea\xf0\x8e\xe0\x0c\xa1\x23\xd1\xa9\x38\xf9\x2c\xdf\x19\x39\xef\xc6\x17\xb6\xa0\x58\x62\xb6\x9a\xe3\x70\x0e\x96\x72\x54\x4e\xc6\x75\x2d\xef\xf6\xfa\xed\xa1\xdb\x45\x0b\x82\x12\xa9\x48\x70\x2e\x7e\xfd\xfa\x15\x3c\x3f\x7b\x79\x1a\x71\x4c\xaa\x97\x24\x02\x8c\x64\xbd\x80\xa9\x73\x45\x28\x46\xd8\x23\xf8\x88\x0b\x0c\x74\x8e\x56\xa2\xe5\x28\x33\xa7\x8f\x20\x71\x85\x17\x3d\x91\x19\x45\xbe\x29\xe4\x03\x26\x68\xe4\xc0\xcb\x9e\xc8\x18\x12\x5a\xd1\xf6\x3d\x22\x35\xb7\x59\xe9\xbc\xd9\xec\x42\xd8\x81\x05\xc1\x56\x4a\xab\x2a\xf7\x85\x60\x16\x24\xec\x37\xb4\xab\x7c\xc5\x01\x43\xd6\xe8\x9a\xa3\x7b\xf7\x65\x94\x4e\x4f\x4e\x9e\x9f\x6e\xd2\x8a\xe0\x5c\x55\x7c\x0e\x76\x55\xff\xf1\xed\x1c\x99\x54\x77\x32\x91\x24\x60\x99\x76\xdc\x82\x90\xb6\xc8\xb0\x6a\xd2\x94\xa6\x26\x7c\xa8\x20\xfd\xa6\xef\xc3\x97\xbb\xbd\xc3\xf7\xef\x33\xde\x9c\x4e\x61\x32\x1a\x8f\x06\xe3\xc9\x60\x3c\xbe\x19\x9f\x4d\x8f\x5f\x4e\x47\x93\xff\x8f\xe0\x27\xcc\xa4\xef\xa4\x69\x15\xd6\xf8\x2a\x81\xb4\xf0\x06\x15\x8c\x8f\x60\x0c\xe7\x17\xbc\xc5\x37\xa8\x4a\x34\x15\x7f\x9a\x8c\x47\x23\xf8\x86\xcf\xc9\x12\xf9\x06\x1d\x98\x51\xa6\x97\xa1\xdd\x00\x92\xd0\xce\xb2\x92\xc5\x7e\x1b\x35\x7e\x7a\x15\x78\xf6\x77\xc9\xd3\x5f\x6d\xfc\x8b\x36\xed\x2b\x6f\xfb\xf7\x1b\xc1\x07\x0e\x8a\xc2\xbe\x58\xd5\x6b\x60\x59\xda\x36\x82\xd8\x25\x59\x18\x0b\x05\x8d\x43\x25\xe2\x6c\x34\x93\x8e\x0c\x66\xf5\xac\xba\xfa\xac\x4d\xb7\xbe\xda\xb2\x6b\xbe\xe5\xe2\xe4\x50\x1e\xcf\x27\xad\xaa\x41\x4a\xf7\x28\x28\x96\xec\x1a\xde\x5d\x9c\x40\x8a\x36\xf5\x8b\xea\x9c\x64\x9d\xe8\x7a\xa2\xb2\x51\x29\xf2\x43\x01\xc9\x06\xaf\x51\x14\x4d\xfe\xf2\x7c\xd2\xf1\xfe\x5f\x03\xc4\x47\xab\x55\x40\xe2\x3e\xcf\xb6\xa0\xe0\xd1\x15\x25\x5f\x94\x9e\xb2\xa9\xf7\x9f\x7c\x9d\x65\x9d\x75\x37\xc7\xdc\xe5\x98\xc4\x5a\x0a\xb8\xe7\xad\x79\xcb\x95\xec\x4f\xa2\x0e\xd1\x5d\xd8\x4e\xe3\x1e\x91\xf1\x92\x66\x82\x16\xab\x91\xd2\xb6\xa7\xfb\xc8\x9c\x3a\x6d\x33\x1b\x09\xfb\xce\x14\x7d\x83\x45\x88\x1f\x8a\xb6\xb2\xb5\x2f\x72\x48\x0d\x25\x1b\x4d\x04\xfb\x5a\x02\x76\xf8\xfc\x4f\xe5\xbb\xab\x9d\xb0\x83\x98\x0e\x87\xcb\xe5\x32\x4a\xf5\xd2\x69\xff\x96\x48\x51\xac\xa3\xf2\x6e\xe8\x4a\xa7\x8d\xc4\x2c\x3c\x97\x92\x91\x96\xa2\x22\x2d\xfe\x43\xe8\xfc\xdf\xc7\x1d\x7a\x5d\xc5\x7e\x5a\x71\xdf\xe0\x02\x3f\x78\x5e\x70\xf1\xfe\x1d\x18\xaa\xbb\x0d\xd7\x0e\x29\x3c\x2a\x3f\xb1\x24\x42\xe7\x3b\xd9\xb3\x7d\x79\x62\xd6\xf1\x68\xf2\xfc\xa5\x88\x47\xf1\xf1\x71\x32\x7a\x21\x90\x84\x38\xc3\x71\x22\xce\x66\x33\x41\x34\xeb\xbe\xd8\xe5\xe4\xf0\x89\xa5\x39\x9b\x9c\x9d\x9c\xe1\xd9\x69\x22\x4e\xcf\xc6\xc7\xa7\xf1\x49\x42\x2f\xe2\x99\xa0\x53\x3a\x79\x31\x19\x25\x93\xce\x2a\xdf\x3e\x63\x9f\x58\x9e\x93\x6e\x05\x69\xab\x66\xf4\x24\x7a\xd0\xc6\x79\x9b\x36\x28\x3c\x7c\x3f\xb1\x08\x9c\xcb\x9e\x0c\xc6\xe3\xc1\xe4\xe5\xcd\xe8\x64\x3a\x39\x9d\x8e\xce\xa2\xd1\x68\xe4\x8d\xae\xa5\xb8\x34\xd2\x55\x1f\x42\x90\x1a\x18\xf8\x66\xa0\xf3\xd2\xa5\xeb\x2e\x83\x8d\x41\x37\x57\xa3\x29\xcc\x78\xa6\xff\xc6\xd3\x7d\xf3\xde\x86\x9b\x29\xe4\x8f\x54\xed\xc9\xf8\x82\xa5\xc3\xd2\xa5\xbf\x74\x7b\xed\xf6\xf5\x81\x9d\x87\x1e\x26\xe2\x30\xbd\xee\x68\xf0\x8d\x4d\xbe\x43\xda\xa6\xda\x38\xd0\x05\xfe\x5a\x12\x48\xc1\x93\x12\xd9\xfa\x63\xf6\xbe\x2b\x42\x7d\x36\xd0\x9e\xf9\xcd\xfb\x1f\xbf\xff\x9f\x7e\xdd\x48\xcc\xbf\x5b\xcb\xf1\x67\x8c\x0a\x12\xe9\x9b\xc5\x48\x9a\x4e\x7f\xa3\x7f\xc9\xe2\x4f\xf5\x13\xb6\x85\x02\xe7\x21\x40\xaf\xfc\x2a\xce\xa1\xa9\x63\xb9\x11\x14\x2d\x9b\x06\x2c\xe7\x7b\x0b\xf8\xc8\xff\x2d\x84\x5b\x3e\xb0\x95\x6a\xc1\x71\xa4\x4f\x44\x3c\xed\xc2\xd0\xa2\xe9\x60\x69\x7a\xd0\x3a\x20\x54\xbc\xd6\x88\x41\x81\xc6\x55\x60\x39\x77\xea\xb6\x5c\xd6\x12\xf8\xe7\xd9\x19\xa5\x98\x25\xa0\x93\xb6\x95\x98\xb7\xde\x96\xab\xfd\x63\x27\x2a\xd0\xa5\xb3\x52\x50\xd3\xbd\xf1\xee\xf6\xc3\x8d\xef\x0d\xf3\x52\x6e\x80\x5e\xb7\x7c\x4b\x65\x5d\xe8\xf9\x68\xf3\x2a\xf6\x07\xf5\xfb\x6f\xfd\xdc\xd0\x34\x7c\x46\xf0\x93\xd4\x19\x3a\x6d\xda\x70\x7e\x96\xe9\xf8\x8e\x44\x10\xa2\xb4\xf5\xca\x76\xa7\x57\x97\x51\xaf\xd1\xcf\x69\x6f\xd0\x51\x31\xf8\xd3\x9f\x7b\x83\x8e\x9a\xf2\xff\xff\x0c\x00\x00\xff\xff\xaa\x67\xac\x1a\x8c\x2f\x00\x00") + +func openapiYamlBytes() ([]byte, error) { + return bindataRead( + _openapiYaml, + "openapi.yaml", + ) +} + +func openapiYaml() (*asset, error) { + bytes, err := openapiYamlBytes() + if err != nil { + return nil, err + } + + info := bindataFileInfo{name: "openapi.yaml", size: 12172, mode: os.FileMode(420), modTime: time.Unix(1553900462, 0)} + a := &asset{bytes: bytes, info: info} + return a, nil +} + +// Asset loads and returns the asset for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func Asset(name string) ([]byte, error) { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) + } + return a.bytes, nil + } + return nil, fmt.Errorf("Asset %s not found", name) +} + +// MustAsset is like Asset but panics when Asset would return an error. +// It simplifies safe initialization of global variables. +func MustAsset(name string) []byte { + a, err := Asset(name) + if err != nil { + panic("asset: Asset(" + name + "): " + err.Error()) + } + + return a +} + +// AssetInfo loads and returns the asset info for the given name. +// It returns an error if the asset could not be found or +// could not be loaded. +func AssetInfo(name string) (os.FileInfo, error) { + cannonicalName := strings.Replace(name, "\\", "/", -1) + if f, ok := _bindata[cannonicalName]; ok { + a, err := f() + if err != nil { + return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) + } + return a.info, nil + } + return nil, fmt.Errorf("AssetInfo %s not found", name) +} + +// AssetNames returns the names of the assets. +func AssetNames() []string { + names := make([]string, 0, len(_bindata)) + for name := range _bindata { + names = append(names, name) + } + return names +} + +// _bindata is a table, holding each asset generator, mapped to its name. +var _bindata = map[string]func() (*asset, error){ + "doap.rdf": doapRdf, + "openapi.yaml": openapiYaml, +} + +// AssetDir returns the file names below a certain +// directory embedded in the file by go-bindata. +// For example if you run go-bindata on data/... and data contains the +// following hierarchy: +// data/ +// foo.txt +// img/ +// a.png +// b.png +// then AssetDir("data") would return []string{"foo.txt", "img"} +// AssetDir("data/img") would return []string{"a.png", "b.png"} +// AssetDir("foo.txt") and AssetDir("notexist") would return an error +// AssetDir("") will return []string{"data"}. +func AssetDir(name string) ([]string, error) { + node := _bintree + if len(name) != 0 { + cannonicalName := strings.Replace(name, "\\", "/", -1) + pathList := strings.Split(cannonicalName, "/") + for _, p := range pathList { + node = node.Children[p] + if node == nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + } + } + if node.Func != nil { + return nil, fmt.Errorf("Asset %s not found", name) + } + rv := make([]string, 0, len(node.Children)) + for childName := range node.Children { + rv = append(rv, childName) + } + return rv, nil +} + +type bintree struct { + Func func() (*asset, error) + Children map[string]*bintree +} + +var _bintree = &bintree{nil, map[string]*bintree{ + "doap.rdf": &bintree{doapRdf, map[string]*bintree{}}, + "openapi.yaml": &bintree{openapiYaml, map[string]*bintree{}}, +}} + +// RestoreAsset restores an asset under the given directory +func RestoreAsset(dir, name string) error { + data, err := Asset(name) + if err != nil { + return err + } + info, err := AssetInfo(name) + if err != nil { + return err + } + err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) + if err != nil { + return err + } + err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) + if err != nil { + return err + } + err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) + if err != nil { + return err + } + return nil +} + +// RestoreAssets restores an asset under the given directory recursively +func RestoreAssets(dir, name string) error { + children, err := AssetDir(name) + // File + if err != nil { + return RestoreAsset(dir, name) + } + // Dir + for _, child := range children { + err = RestoreAssets(dir, filepath.Join(name, child)) + if err != nil { + return err + } + } + return nil +} + +func _filePath(dir, name string) string { + cannonicalName := strings.Replace(name, "\\", "/", -1) + return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) +} diff --git a/build.sh b/build.sh index 40c8f8e..adfee6c 100755 --- a/build.sh +++ b/build.sh @@ -13,12 +13,15 @@ parm="" # "-u" { "${say}" "go get" go get ${parm} \ + github.com/jteeuwen/go-bindata/... \ golang.org/x/net/html \ \ github.com/stretchr/testify \ github.com/yhat/scrape } +"$(go env GOPATH)/bin/go-bindata" doap.rdf openapi.yaml + PROG_NAME="pinboard4shaarli" VERSION="$(grep -F 'version = ' version.go | cut -d \" -f 2)" diff --git a/pinboard.go b/pinboard.go index f3f5bb0..1ed6ade 100644 --- a/pinboard.go +++ b/pinboard.go @@ -69,12 +69,12 @@ func main() { } /// $ ./pinboard4shaarli.cgi --help | -h | -? -/// $ ./pinboard4shaarli.cgi https://demo.shaarli.org/pinboard4shaarli.cgi/v1/about/ +/// $ ./pinboard4shaarli.cgi https://demo.shaarli.org/pinboard4shaarli.cgi/v1/about /// $ ./pinboard4shaarli.cgi 'https://uid:pwd@demo.shaarli.org/pinboard4shaarli.cgi/v1/posts/get?url=http://m.heise.de/12' /// $ ./pinboard4shaarli.cgi 'https://uid:pwd@demo.shaarli.org/pinboard4shaarli.cgi/v1/posts/add?url=http://m.heise.de/12&description=foo' /// todo /// $ ./pinboard4shaarli.cgi https://uid:pwd@demo.shaarli.org/pinboard4shaarli.cgi/v1/user/api_token -/// $ ./pinboard4shaarli.cgi https://demo.shaarli.org/pinboard4shaarli.cgi/v1/posts/get --auth_token=uid:XYZUUU --url=https://m.heise.de/foo +/// $ ./pinboard4shaarli.cgi --data-urlencode auth_token=uid:XYZUUU --data-urlencode url=https://m.heise.de/foo https://demo.shaarli.org/pinboard4shaarli.cgi/v1/posts/get /// func cli() bool { // test if we're running cli @@ -156,7 +156,7 @@ func handleMux(w http.ResponseWriter, r *http.Request) { base := *r.URL base.Path = path.Join(base.Path[0:len(base.Path)-len(path_info)], "..", "index.php") - w.Header().Set(http.CanonicalHeaderKey("X-Powered-By"), strings.Join([]string{"https://code.mro.name/mro/Shaarli-API-test", "#", version, "+", GitSHA1}, "")) + w.Header().Set(http.CanonicalHeaderKey("X-Powered-By"), strings.Join([]string{"https://code.mro.name/mro/pinboard4shaarli", "#", version, "+", GitSHA1}, "")) w.Header().Set(http.CanonicalHeaderKey("Content-Type"), "text/xml; charset=utf-8") // https://stackoverflow.com/a/18414432 @@ -171,52 +171,125 @@ func handleMux(w http.ResponseWriter, r *http.Request) { client := http.Client{Jar: jar} switch path_info { - case "", - "/about": + case "": base := *r.URL - base.Path = path.Join(base.Path[0:len(base.Path)-len(path_info)], "about") + "/" + base.Path = path.Join(base.Path[0:len(base.Path)-len(path_info)], "about") http.Redirect(w, r, base.Path, http.StatusFound) return - case "/about/": - // w.Header().Set(http.CanonicalHeaderKey("Content-Type"), "application/rdf+xml") - raw(` - - - 🛠 Pinboard API for Shaarlis - subset conforming https://pinboard.in/api/ - - - - - - - - - golang - microblogging - shaarli - nodb - api - pinboard - delicious - cgi - - - - - - - - - `, version, "+", GitSHA1, ` - `, GitSHA1, ` - … - - - -`) + case "/about": + w.Header().Set(http.CanonicalHeaderKey("Content-Type"), "application/rdf+xml") + if b, err := Asset("doap.rdf"); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + } else { + w.Write(b) + } + return + case "/v1/openapi.yaml": + w.Header().Set(http.CanonicalHeaderKey("Content-Type"), "text/x-yaml; charset=utf-8") + if b, err := Asset("openapi.yaml"); err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + } else { + w.Write(b) + } + return + case "/v1/posts/get": + // pretend to add, but don't actually do it, but return the form preset values. + uid, pwd, ok := r.BasicAuth() + if !ok { + http.Error(w, "Basic Pre-Authentication required.", http.StatusUnauthorized) + return + } + + if http.MethodGet != r.Method { + w.Header().Set(http.CanonicalHeaderKey("Allow"), http.MethodGet) + http.Error(w, "All API methods are GET requests, even when good REST habits suggest they should use a different verb.", http.StatusMethodNotAllowed) + return + } + + params := r.URL.Query() + if 1 != len(params["url"]) { + http.Error(w, "Required parameter missing: url", http.StatusBadRequest) + return + } + p_url := params["url"][0] + + /* + if 1 != len(params["description"]) { + http.Error(w, "Required parameter missing: description", http.StatusBadRequest) + return + } + p_description := params["description"][0] + + p_extended := "" + if 1 == len(params["extended"]) { + p_extended = params["extended"][0] + } + + p_tags := "" + if 1 == len(params["tags"]) { + p_tags = params["tags"][0] + } + */ + + v := url.Values{} + v.Set("post", p_url) + base.RawQuery = v.Encode() + + resp, err := client.Get(base.String()) + if err != nil { + http.Error(w, err.Error(), http.StatusBadGateway) + return + } + formLogi, err := formValuesFromReader(resp.Body, "loginform") + resp.Body.Close() + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + + formLogi.Set("login", uid) + formLogi.Set("password", pwd) + resp, err = client.PostForm(resp.Request.URL.String(), formLogi) + if err != nil { + http.Error(w, err.Error(), http.StatusBadGateway) + return + } + + formLink, err := formValuesFromReader(resp.Body, "linkform") + resp.Body.Close() + if err != nil { + http.Error(w, err.Error(), http.StatusBadGateway) + return + } + // if we do not have a linkform, auth must have failed. + if 0 == len(formLink) { + http.Error(w, "Authentication failed", http.StatusForbidden) + return + } + + fv := func(s string) string { return formLink.Get(s) } + + tim, err := time.ParseInLocation(ShaarliDate, fv("lf_linkdate"), time.Local) // can we do any better? + if err != nil { + http.Error(w, err.Error(), http.StatusBadGateway) + return + } + + raw(xml.Header) + elmS("posts", false, + "user", uid, + "dt", tim.Format(IsoDate), + "tag", fv("lf_tags")) + elmS("post", true, + "href", fv("lf_url"), + "hash", fv("lf_linkdate"), + "description", fv("lf_title"), + "extended", fv("lf_description"), + "tag", fv("lf_tags"), + "time", tim.Format(time.RFC3339), + "others", "0") + elmE("posts") return case "/v1/posts/add": @@ -359,105 +432,7 @@ func handleMux(w http.ResponseWriter, r *http.Request) { elmS("update", true, "time", "2011-03-24T19:02:07Z") return - case "/v1/posts/get": - // pretend to add, but don't actually do it, but return the form preset values. - uid, pwd, ok := r.BasicAuth() - if !ok { - http.Error(w, "Basic Pre-Authentication required.", http.StatusUnauthorized) - return - } - - if http.MethodGet != r.Method { - w.Header().Set(http.CanonicalHeaderKey("Allow"), http.MethodGet) - http.Error(w, "All API methods are GET requests, even when good REST habits suggest they should use a different verb.", http.StatusMethodNotAllowed) - return - } - params := r.URL.Query() - if 1 != len(params["url"]) { - http.Error(w, "Required parameter missing: url", http.StatusBadRequest) - return - } - p_url := params["url"][0] - - /* - if 1 != len(params["description"]) { - http.Error(w, "Required parameter missing: description", http.StatusBadRequest) - return - } - p_description := params["description"][0] - - p_extended := "" - if 1 == len(params["extended"]) { - p_extended = params["extended"][0] - } - - p_tags := "" - if 1 == len(params["tags"]) { - p_tags = params["tags"][0] - } - */ - - v := url.Values{} - v.Set("post", p_url) - base.RawQuery = v.Encode() - - resp, err := client.Get(base.String()) - if err != nil { - http.Error(w, err.Error(), http.StatusBadGateway) - return - } - formLogi, err := formValuesFromReader(resp.Body, "loginform") - resp.Body.Close() - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - - formLogi.Set("login", uid) - formLogi.Set("password", pwd) - resp, err = client.PostForm(resp.Request.URL.String(), formLogi) - if err != nil { - http.Error(w, err.Error(), http.StatusBadGateway) - return - } - - formLink, err := formValuesFromReader(resp.Body, "linkform") - resp.Body.Close() - if err != nil { - http.Error(w, err.Error(), http.StatusBadGateway) - return - } - // if we do not have a linkform, auth must have failed. - if 0 == len(formLink) { - http.Error(w, "Authentication failed", http.StatusForbidden) - return - } - - fv := func(s string) string { return formLink.Get(s) } - - tim, err := time.ParseInLocation(ShaarliDate, fv("lf_linkdate"), time.Local) // can we do any better? - if err != nil { - http.Error(w, err.Error(), http.StatusBadGateway) - return - } - - raw(xml.Header) - elmS("posts", false, - "user", uid, - "dt", tim.Format(IsoDate), - "tag", fv("lf_tags")) - elmS("post", true, - "href", fv("lf_url"), - "hash", fv("lf_linkdate"), - "description", fv("lf_title"), - "extended", fv("lf_description"), - "tag", fv("lf_tags"), - "time", tim.Format(time.RFC3339), - "others", "0") - elmE("posts") - - return case "/v1/posts/recent", "/v1/posts/dates", "/v1/posts/suggest", -- 2.11.4.GIT