diff --git a/Dockerfile b/Dockerfile index 86c9792..d185023 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # Docker image that serves static content via NGINX, with autoindex enabled. FROM nginx:alpine -MAINTAINER XSF Editors +LABEL org.opencontainers.image.authors="editor@xmpp.org" COPY deploy/nginx.vh.default.conf /etc/nginx/conf.d/default.conf COPY content /usr/share/nginx/html RUN rm /usr/share/nginx/html/index.html diff --git a/README.md b/README.md index 96635b5..df2cce1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,13 @@ -[![Docker Build Status](https://img.shields.io/docker/build/xmppxsf/xep-attic.svg)](https://hub.docker.com/r/xmppxsf/xep-attic/) - # xep-attic -Archive of old XEP versions, as published on [www.xmpp.org/extensions/attic/](https://www.xmpp.org/extensions/attic/) + +Archive of old XEP versions, as published on [xmpp.org/extensions/attic/](https://xmpp.org/extensions/attic/) + +## Building + +```shell +sudo docker build -t xep-attic:latest . +``` + +```shell +sudo docker run -t -p 80:80 xep-attic:latest +``` diff --git a/content/attic.css b/content/attic.css new file mode 100644 index 0000000..b7c3212 --- /dev/null +++ b/content/attic.css @@ -0,0 +1,12 @@ +#attic_notice { + position: fixed; + top: 0; + left: 0; + width: 100%; + margin: 0; + padding: 1em; + opacity: 0.95; + background-color: #ff8f2c; + color: #282828; + font-family: sans-serif; +} diff --git a/content/attic.js b/content/attic.js new file mode 100644 index 0000000..f695c3f --- /dev/null +++ b/content/attic.js @@ -0,0 +1,23 @@ +document.addEventListener("DOMContentLoaded", function () { + const notice = document.createElement("div"); + notice.id = "attic_notice"; + document.getElementsByTagName("body")[0].prepend(notice); + + const noticeText = document.createElement("strong"); + const link = document.createElement("a"); + notice.append(noticeText); + notice.append(link); + + if (window.location.pathname === "/extensions/attic/") { + noticeText.innerHTML = "Beware: You are browsing archived versions of XEPs. "; + link.innerText = "Browse latest versions"; + link.href = `${window.location.protocol}//${window.location.host}/extensions/` + } else { + noticeText.innerHTML = + "Beware: The content that is displayed here is an archived version of the document, that has been updated. "; + + const xepNumber = window.location.pathname.match(/\d{4}/)[0]; + link.innerText = "View latest version"; + link.href = `${window.location.protocol}//${window.location.host}/extensions/xep-${xepNumber}.html`; + } +}); diff --git a/deploy/nginx.vh.default.conf b/deploy/nginx.vh.default.conf index dd14928..fdcc957 100644 --- a/deploy/nginx.vh.default.conf +++ b/deploy/nginx.vh.default.conf @@ -8,6 +8,9 @@ server { location / { autoindex on; root /usr/share/nginx/html; + proxy_set_header Accept-Encoding ""; + sub_filter '' ''; + sub_filter_once on; #index index.html index.htm; }