Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Attic disclaimer #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Docker image that serves static content via NGINX, with autoindex enabled.
FROM nginx:alpine
MAINTAINER XSF Editors <[email protected]>
LABEL org.opencontainers.image.authors="[email protected]"
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
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
```
12 changes: 12 additions & 0 deletions content/attic.css
Original file line number Diff line number Diff line change
@@ -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;
}
23 changes: 23 additions & 0 deletions content/attic.js
Original file line number Diff line number Diff line change
@@ -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.&nbsp;";
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.&nbsp;";

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`;
}
});
3 changes: 3 additions & 0 deletions deploy/nginx.vh.default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ server {
location / {
autoindex on;
root /usr/share/nginx/html;
proxy_set_header Accept-Encoding "";
sub_filter '</head>' '<script src="/attic.js"></script><link rel="stylesheet" href="/attic.css"></head>';
sub_filter_once on;
#index index.html index.htm;
}

Expand Down