Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ bin/watch.sh
src/public
src/resources
src/.hugo_build.lock

node_modules/
13 changes: 4 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
FROM alpine:latest

ARG HUGO_BASEURL
ENV HUGO_BASEURL ${HUGO_BASEURL:-https://bisonrelay.org/}
ENV HUGO_VERSION 0.134.0
ENV HUGO_BASEURL="${HUGO_BASEURL:-https://bisonrelay.org/}"
ENV HUGO_VERSION="0.152.2"

LABEL description="gohugo build"
LABEL version="1.0"
LABEL maintainer="jholdstock@decred.org"

WORKDIR /tmp

Expand All @@ -23,15 +22,11 @@ COPY ./ /root/
RUN bin/build-hugo.sh

# Serve image (stable nginx version)
# This cannot use Alpine because test/Dockerfile builds on this image and
# expects it to have apt-get.
FROM nginx:1.26
FROM nginx:1.28

LABEL description="bisonrelay-web server"
LABEL description="bisonrelay web server"
LABEL version="1.0"
LABEL maintainer="jholdstock@decred.org"

COPY conf/nginx.conf /etc/nginx/conf.d/default.conf

# /usr/share/nginx/html is also hardcoded in test/run-test.sh
COPY --from=0 /root/src/public/ /usr/share/nginx/html
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,39 @@
# bisonrelay-web
# decred-staging — bisonrelay site

## Overview
This is one of three independent Hugo projects under `decred-staging/`. It is
the source for the staging build of the Bison Relay site.

This is the code for the [bisonrelay.org](https://bisonrelay.org) website.
It is built using the static site generator [Hugo](https://gohugo.io/) and
utilizes [Docker](https://www.docker.com/) for testing and deployment.
It is built with [Hugo](https://gohugo.io/) (extended, v0.152.2) and uses
[Docker](https://www.docker.com/) for deployment, mirroring the `dcrweb-master`
template.

Currently English-only; the i18n infrastructure is in place so additional
languages can be added by dropping a new file into `transifex_catalogs/` and
adding an entry to `src/config.yml`.

## Development

To start a development web server at <http://localhost:1313>:
Start a local development web server at <http://localhost:1313>:

```sh
./bin/watch.sh
```

Run the HTML validator to ensure all of the generated files are syntactically
correct:

```sh
./bin/test.sh
```

## Deployment with Docker

```sh
# Build the companyzero/bisonrelay-web image.
# Build the image.
./bin/build.sh

# Start the container.
docker run -d -p <local port>:80 companyzero/bisonrelay-web:latest
docker run -d -p <local port>:80 decred/bisonrelay-web:latest
```

## License
## Editing content

Translation strings are defined in `transifex_catalogs/<lang>.json`
(flat `key: value` pairs). All copy is referenced from the page templates via
`{{ T "key" }}`.

bisonrelay-web is licensed under the liberal ISC License.
Page templates live in `src/layouts/`. Common chrome (head, header, footer)
is in `src/layouts/_default/baseof.html` and `src/layouts/partials/`.
12 changes: 6 additions & 6 deletions bin/build.sh
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,25 @@
set -e

echo ""
echo "========================================="
echo " Building bisonrelay-web docker image "
echo "========================================="
echo "==================================="
echo " Building bisonrelay docker image "
echo "==================================="
echo ""


IMAGE_NAME=companyzero/bisonrelay-web
IMAGE_NAME=decred/bisonrelay-web

if [ "$1" != "" ]; then
IMAGE_NAME=$1
fi

docker build --build-arg HUGO_BASEURL=https://bisonrelay.org -t $IMAGE_NAME .
docker build --build-arg HUGO_BASEURL=$HUGO_BASEURL -t $IMAGE_NAME .

echo ""
echo "==================="
echo " Build complete"
echo "==================="
echo ""
echo "You can now run bisonrelay-web with the following command:"
echo "You can now run the site with the following command:"
echo " docker run -d --rm -p <local port>:80 $IMAGE_NAME:latest"
echo ""
2 changes: 1 addition & 1 deletion bin/i18n-convert-transifex-hugo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ for i in transifex_catalogs/*.json; do
fi
rm -rf src/content/$lang
cp -r src/content/en src/content/$lang
done
done
37 changes: 0 additions & 37 deletions bin/test.sh

This file was deleted.

4 changes: 0 additions & 4 deletions bin/transifex_pull.sh

This file was deleted.

6 changes: 0 additions & 6 deletions bin/transifex_push.sh

This file was deleted.

8 changes: 0 additions & 8 deletions bin/tx-config.sh

This file was deleted.

9 changes: 8 additions & 1 deletion bin/watch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@ bin/i18n-convert-transifex-hugo.sh
# Remove old hugo output before building
rm -rf src/public src/resources

HUGO=hugo
if [[ ! $(type -P ${HUGO}) ]]; then
HUGO="go run -v -tags extended github.com/gohugoio/hugo@v0.152.2"
fi

${HUGO} version

# Serve site
# --buildFuture include content with publishdate in the future
# --buildDrafts include content marked as draft
# --disableFastRender enables full re-renders on changes
# --source filesystem path to read files relative from
# --baseURL hostname (and path) to the root
hugo server \
${HUGO} server \
--buildFuture \
--buildDrafts \
--disableFastRender \
Expand Down
7 changes: 3 additions & 4 deletions conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ server {
server_name localhost;

charset utf-8;

# Hide Version
server_tokens off;

# Security Headers
add_header X-Content-Type-Options "nosniff" always;
add_header X-Frame-Options "DENY" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "no-referrer" always;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
Expand All @@ -31,7 +31,6 @@ server {
error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
Expand Down
1 change: 0 additions & 1 deletion src/archetypes/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

1 change: 0 additions & 1 deletion src/assets/images/dl-icons/android.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/assets/images/dl-icons/apple-disabled.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/assets/images/dl-icons/apple.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/assets/images/dl-icons/linux.svg

This file was deleted.

1 change: 0 additions & 1 deletion src/assets/images/dl-icons/windows.svg

This file was deleted.

7 changes: 0 additions & 7 deletions src/assets/js/bootstrap.bundle-5.0.2.min.js

This file was deleted.

97 changes: 97 additions & 0 deletions src/assets/js/download.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
// Download page: OS selector and GUI/CLI interface choice.
// Guarded by querySelectorAll, so it is a no-op on pages without these elements.
document.addEventListener("DOMContentLoaded", () => {

const osGrid = document.getElementById("osGrid");
if (!osGrid) {
return;
}

// OS click
document.querySelectorAll(".os-btn").forEach(btn => {
btn.addEventListener("click", () => {
const target = btn.dataset.target;

// Hide OS buttons
osGrid.classList.add("hidden");

// Hide all OS sections
document.querySelectorAll(".os-section").forEach(section => {
section.classList.add("hidden");
});

// Show selected OS
document.getElementById(target).classList.remove("hidden");
});
});

// Back to OS list
document.querySelectorAll(".back-os").forEach(btn => {
btn.addEventListener("click", () => {

const section = btn.closest(".os-section");

// Hide all download panels
section.querySelectorAll(".download-panel").forEach(panel => {
panel.classList.add("hidden");
});

// Show all option buttons again
section.querySelectorAll(".option-item").forEach(item => {
item.classList.remove("hidden");
});

section.querySelectorAll(".option-title").forEach(item => {
item.classList.remove("hidden");
});

// Hide current OS section
section.classList.add("hidden");

// Show OS grid
document.getElementById("osGrid").classList.remove("hidden");
});
});

// Inner option click
document.querySelectorAll(".option-btn").forEach(btn => {
btn.addEventListener("click", () => {

const parent = btn.closest(".options-wrapper");
const target = btn.dataset.target;

// hide all option buttons
parent.querySelectorAll(".option-item").forEach(item => {
item.classList.add("hidden");
});

parent.querySelectorAll(".option-title").forEach(item => {
item.classList.add("hidden");
});

// show selected option
document.getElementById(target).classList.remove("hidden");
});
});

// Back to option list
document.querySelectorAll(".back-option").forEach(btn => {
btn.addEventListener("click", () => {

const section = btn.closest(".os-section");

section.querySelectorAll(".download-panel").forEach(panel => {
panel.classList.add("hidden");
});

section.querySelectorAll(".option-item").forEach(item => {
item.classList.remove("hidden");
});

section.querySelectorAll(".option-title").forEach(item => {
item.classList.remove("hidden");
});
});
});

});
Loading