Text data (about, URL of TOS) stored in plain text files
This commit is contained in:
parent
56302a5d47
commit
3b696d677e
14
Gopkg.lock
generated
14
Gopkg.lock
generated
@ -49,6 +49,12 @@
|
||||
revision = "259ab82a6cad3992b4e21ff5cac294ccb06474bc"
|
||||
version = "v1.7.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gobuffalo/packr"
|
||||
packages = ["."]
|
||||
revision = "5a2cbb54c4e7d482e3f518c56f1f86f133d5204f"
|
||||
version = "v1.13.7"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/gogo/protobuf"
|
||||
packages = ["proto"]
|
||||
@ -121,6 +127,12 @@
|
||||
packages = ["."]
|
||||
revision = "5b443b6471cea4b4f9f85025530c04c93233f76a"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/pkg/errors"
|
||||
packages = ["."]
|
||||
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
|
||||
version = "v0.8.0"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/prometheus/client_golang"
|
||||
packages = ["prometheus","prometheus/promhttp"]
|
||||
@ -196,6 +208,6 @@
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
analyzer-version = 1
|
||||
inputs-digest = "37517a6a6dbd6e924bf6761b562697a069e952f72f4d3ef984faf72738e91670"
|
||||
inputs-digest = "3a7b863bec3806ba9460f3961e2d6e8ff4b77e5f66d196b1f79bd37fa6bf8d82"
|
||||
solver-name = "gps-cdcl"
|
||||
solver-version = 1
|
||||
|
||||
31
api/text.go
Normal file
31
api/text.go
Normal file
@ -0,0 +1,31 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/gobuffalo/packr"
|
||||
)
|
||||
|
||||
var Text struct {
|
||||
BlockbookAbout, TOSLink string
|
||||
}
|
||||
|
||||
func init() {
|
||||
box := packr.NewBox("../static/text")
|
||||
if about, err := box.MustString("about"); err == nil {
|
||||
Text.BlockbookAbout = strings.TrimSpace(about)
|
||||
} else {
|
||||
panic(err)
|
||||
}
|
||||
if tosLink, err := box.MustString("tos_link"); err == nil {
|
||||
if _, err := url.ParseRequestURI(tosLink); err == nil {
|
||||
Text.TOSLink = strings.TrimSpace(tosLink)
|
||||
} else {
|
||||
panic(fmt.Sprint("tos_link is not valid URL:", err.Error()))
|
||||
}
|
||||
} else {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
@ -8,8 +8,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
const BlockbookAbout = "Blockbook - blockchain indexer for TREZOR wallet https://trezor.io/. Do not use for any other purpose."
|
||||
|
||||
type ApiError struct {
|
||||
Text string
|
||||
Public bool
|
||||
|
||||
@ -585,7 +585,7 @@ func (w *Worker) GetSystemInfo(internal bool) (*SystemInfo, error) {
|
||||
DbSize: w.db.DatabaseSizeOnDisk(),
|
||||
DbSizeFromColumns: dbs,
|
||||
DbColumns: dbc,
|
||||
About: BlockbookAbout,
|
||||
About: Text.BlockbookAbout,
|
||||
}
|
||||
glog.Info("GetSystemInfo finished in ", time.Since(start))
|
||||
return &SystemInfo{bi, ci}, nil
|
||||
|
||||
@ -32,8 +32,11 @@ RUN cd /opt/rocksdb && CFLAGS=-fPIC CXXFLAGS=-fPIC make -j 4 release
|
||||
RUN strip /opt/rocksdb/ldb /opt/rocksdb/sst_dump && \
|
||||
cp /opt/rocksdb/ldb /opt/rocksdb/sst_dump /build
|
||||
|
||||
# install build tools
|
||||
RUN go get github.com/golang/dep/cmd/dep
|
||||
RUN go get github.com/gobuffalo/packr/...
|
||||
|
||||
# download pre-loaded depencencies
|
||||
RUN \
|
||||
cleanup() { rm -rf $GOPATH/src/blockbook; } && \
|
||||
trap cleanup EXIT && \
|
||||
|
||||
@ -11,12 +11,12 @@ export BLOCKBOOK_SRC
|
||||
|
||||
all: build tools
|
||||
|
||||
build: prepare-sources
|
||||
build: prepare-sources generate-data
|
||||
cd $(BLOCKBOOK_SRC) && go build -o $(CURDIR)/blockbook -ldflags="-s -w $(LDFLAGS)" $(ARGS)
|
||||
cp $(CURDIR)/blockbook /out/blockbook
|
||||
chown $(PACKAGER) /out/blockbook
|
||||
|
||||
build-debug: prepare-sources
|
||||
build-debug: prepare-sources generate-data
|
||||
cd $(BLOCKBOOK_SRC) && go build -o $(CURDIR)/blockbook -ldflags="$(LDFLAGS)" $(ARGS)
|
||||
cp $(CURDIR)/blockbook /out/blockbook
|
||||
chown $(PACKAGER) /out/blockbook
|
||||
@ -25,13 +25,13 @@ tools:
|
||||
cp $(CURDIR)/{ldb,sst_dump} /out
|
||||
chown $(PACKAGER) /out/{ldb,sst_dump}
|
||||
|
||||
test: prepare-sources
|
||||
test: prepare-sources generate-data
|
||||
cd $(BLOCKBOOK_SRC) && go test -tags unittest `go list ./... | grep -vP '^blockbook/(contrib|tests)'` $(ARGS)
|
||||
|
||||
test-integration: prepare-sources
|
||||
test-integration: prepare-sources generate-data
|
||||
cd $(BLOCKBOOK_SRC) && go test -tags integration `go list blockbook/tests/...` $(ARGS)
|
||||
|
||||
test-all: prepare-sources
|
||||
test-all: prepare-sources generate-data
|
||||
cd $(BLOCKBOOK_SRC) && go test -tags 'unittest integration' `go list ./... | grep -v '^blockbook/contrib'` $(ARGS)
|
||||
|
||||
prepare-sources:
|
||||
@ -46,3 +46,6 @@ prepare-vendor:
|
||||
else \
|
||||
echo "Update of vendor not demanded, keeping version from src" ; \
|
||||
fi
|
||||
|
||||
generate-data:
|
||||
cd $(BLOCKBOOK_SRC) && packr clean && packr
|
||||
|
||||
@ -230,6 +230,7 @@ func (s *PublicServer) newTemplateData() *TemplateData {
|
||||
CoinShortcut: s.is.CoinShortcut,
|
||||
CoinLabel: s.is.CoinLabel,
|
||||
InternalExplorer: s.internalExplorer && !s.is.InitialSync,
|
||||
TOSLink: api.Text.TOSLink,
|
||||
}
|
||||
}
|
||||
|
||||
@ -325,6 +326,7 @@ type TemplateData struct {
|
||||
PrevPage int
|
||||
NextPage int
|
||||
PagingRange []int
|
||||
TOSLink string
|
||||
}
|
||||
|
||||
func parseTemplates() []*template.Template {
|
||||
|
||||
@ -592,7 +592,7 @@ func (s *SocketIoServer) getInfo() (res resultGetInfo, err error) {
|
||||
res.Result.Network = s.chain.GetNetworkName()
|
||||
res.Result.Subversion = s.chain.GetSubversion()
|
||||
res.Result.CoinName = s.chain.GetCoinName()
|
||||
res.Result.About = api.BlockbookAbout
|
||||
res.Result.About = api.Text.BlockbookAbout
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@ -73,7 +73,7 @@
|
||||
<a class="nav-link" href="http://satoshilabs.com/" target="_blank" rel="noopener noreferrer">© 2018 SatoshiLabs</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="https://wallet.trezor.io/tos.pdf" target="_blank" rel="noopener noreferrer">Terms</a>
|
||||
<a class="nav-link" href="{{- .TOSLink -}}" target="_blank" rel="noopener noreferrer">Terms</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="navbar-nav flex-row ml-md-auto d-none d-md-flex">
|
||||
@ -86,4 +86,4 @@
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
</html>
|
||||
|
||||
1
static/text/about
Normal file
1
static/text/about
Normal file
@ -0,0 +1 @@
|
||||
Blockbook - blockchain indexer for TREZOR wallet https://trezor.io/. Do not use for any other purpose.
|
||||
1
static/text/tos_link
Normal file
1
static/text/tos_link
Normal file
@ -0,0 +1 @@
|
||||
https://wallet.trezor.io/tos.pdf
|
||||
Loading…
Reference in New Issue
Block a user