Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Replace pkg.cfssl.org with 'Packages' tab (#1050)
  • Loading branch information
cbroglie committed Mar 18, 2020
1 parent 44db4a7 commit e9f28f7
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,5 +1,5 @@
dist/*
cli/serve/static.rice-box.go
cli/serve/rice-box.go
coverage.txt
profile.out
bin
Expand Down
17 changes: 13 additions & 4 deletions Makefile
Expand Up @@ -7,26 +7,35 @@ export GOPROXY := off
.PHONY: all
all: bin/cfssl bin/cfssl-bundle bin/cfssl-certinfo bin/cfssl-newkey bin/cfssl-scan bin/cfssljson bin/mkbundle bin/multirootca

bin/%: $(shell find . -type f -name '*.go')
bin/%: $(shell find . -type f -name '*.go') cli/serve/rice-box.go
@mkdir -p $(dir $@)
go build -ldflags $(LDFLAGS) -o $@ ./cmd/$(@F)

cli/serve/rice-box.go: bin/rice $(shell find cli/serve/static -type f)
cli/serve/rice-box.go:
./bin/rice embed-go -i=./cli/serve

.PHONY: install
install: install-cfssl install-cfssl-bundle install-cfssl-certinfo install-cfssl-newkey install-cfssl-scan install-cfssljson install-mkbundle install-multirootca

.PHONY: install-%
install-%:
go install ./cmd/$(@F:install-%=%)

bin/rice: $(shell find . -type f -name '*.go')
.PHONY: serve
serve: bin/cfssl
serve:
./bin/cfssl serve

bin/rice: $(shell find vendor -type f -name '*.go')
@mkdir -p $(dir $@)
go build -o $@ ./vendor/github.com/GeertJohan/go.rice/rice

bin/golint: $(shell find . -type f -name '*.go')
bin/golint: $(shell find vendor -type f -name '*.go')
@mkdir -p $(dir $@)
go build -o $@ ./vendor/golang.org/x/lint/golint

bin/goose: $(shell find . -type f -name '*.go')
bin/goose: $(shell find vendor -type f -name '*.go')
@mkdir -p $(dir $@)
go build -o $@ ./vendor/bitbucket.org/liamstask/goose/cmd/goose

Expand Down
5 changes: 3 additions & 2 deletions cli/serve/serve.go
Expand Up @@ -108,8 +108,9 @@ func (hb *httpBox) Open(name string) (http.File, error) {
// staticBox is the box containing all static assets.
var staticBox = &httpBox{
redirects: map[string]string{
"/scan": "/index.html",
"/bundle": "/index.html",
"/scan": "/index.html",
"/bundle": "/index.html",
"/packages": "/index.html",
},
}

Expand Down
22 changes: 20 additions & 2 deletions cli/serve/static/assets/cfssl.js
Expand Up @@ -121,7 +121,7 @@
navLink('a', '/bundle', Tformat('bundle.title'))
]),
m('ul.nav.navbar-nav.navbar-right', [
m('li', m('a[href="https://pkg.cfssl.org"]', Tformat('common.packages'))),
navLink('a', '/packages', Tformat('common.packages')),
m('li', m('a[href="https://github.com/cloudflare/cfssl"]', 'GitHub')),
])
])
Expand Down Expand Up @@ -237,6 +237,23 @@
}
};

var packages = {
controller: function() {
page.title(Tformat('common.packages'));
return;
},
view: function() {
return appWrapper([
m('h1.page-header', Tformat('common.packages')),
m('ul', [
m('li', m('a[href="https://github.com/cloudflare/cfssl/releases"]', 'Download binaries (GitHub)')),
m('li', m('a[href="https://hub.docker.com/r/cloudflare/cfssl"]', 'Docker images')),
m('li', m('a[href="https://pkg.cloudflare.com/"]', 'Install from apt or yum'))
])
]);
}
};

var scan = {
vm: {
init: function(domain) {
Expand Down Expand Up @@ -708,7 +725,8 @@
'/bundle': bundle,
'/bundle/:domain': bundle,
'/scan': scan,
'/scan/:domain': scan
'/scan/:domain': scan,
'/packages': packages
});

window.scan = scan;
Expand Down

0 comments on commit e9f28f7

Please sign in to comment.