Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | cmd/hancock: no longer publishing via ipfs |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
d2f81cb81eceacb0df10ce6d823ce0e7 |
User & Date: | dnc 2020-01-03 17:27:23 |
Context
2020-01-03
| ||
17:28 | cmd/hancock: command helper, parse args with help mode support check-in: 62d0ed9c79 user: dnc tags: trunk | |
17:27 | cmd/hancock: no longer publishing via ipfs check-in: d2f81cb81e user: dnc tags: trunk | |
17:24 | cmd/hancock: publish from local to remote store refactor testimony and publish operations, testimony to local (or remote) store, later publish from local to remote check-in: 88140a8c62 user: dnc tags: trunk | |
Changes
Deleted cmd/hancock/ipfs.go.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
// Copyright (C) 2019 David N. Cohen // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see <https://www.gnu.org/licenses/>. package main import ( "bytes" "fmt" "io/ioutil" "mime/multipart" "net/http" ) // IPFS helper functions // https://docs.ipfs.io/reference/api/http/#api-v0-add func ipfsAdd(ipfs string, b []byte, name string) error { buf := &bytes.Buffer{} mp := multipart.NewWriter(buf) part, err := mp.CreateFormFile("path", name) if err != nil { return err } _, err = part.Write(b) if err != nil { return err } err = mp.Close() if err != nil { return err } uri := ipfs + "/api/v0/add?raw-leaves=true&pin=false" // TODO(dnc) pin by default req, err := http.NewRequest("POST", uri, buf) req.Header.Set("Content-Type", mp.FormDataContentType()) resp, err := http.DefaultClient.Do(req) if err != nil { return err } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { return err } if resp.StatusCode != http.StatusOK { err = fmt.Errorf("%s %s", uri, resp.Status) } //command.Debug(uri, resp.Status) //command.Debug(string(body)) _ = body return err } |
< < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |