Skip to content

Commit fc4d182

Browse files
authored
Merge pull request #3 from caktus/merge-upstream
Update from upstream repo
2 parents 855760e + e6b1b89 commit fc4d182

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2377
-51
lines changed

.circleci/config.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: 2
22
jobs:
33
build:
44
machine:
5-
image: ubuntu-2004:202201-02
5+
image: ubuntu-2004:current
66

77
steps:
88
- checkout
@@ -30,11 +30,16 @@ jobs:
3030
docker compose up -d
3131
CONTAINER_NAME=$(docker inspect -f '{{.Name}}' $(docker compose ps -q nginx) | cut -c2-)
3232
docker run --network container:$CONTAINER_NAME \
33-
appropriate/curl -4 --insecure --retry 30 --retry-delay 10 --retry-connrefused https://localhost/ \
33+
appropriate/curl -4 --insecure --retry 30 --retry-delay 10 --retry-connrefused https://localhost/ -H 'Host: local' \
3434
| tee /dev/tty \
3535
| grep -q 'ODK Central'
3636
docker run --network container:$CONTAINER_NAME \
37-
appropriate/curl -4 --insecure --retry 20 --retry-delay 2 --retry-connrefused https://localhost/v1/projects \
37+
appropriate/curl -4 --insecure --retry 20 --retry-delay 2 --retry-connrefused https://localhost/v1/projects -H 'Host: local' \
3838
| tee /dev/tty \
3939
| grep -q '\[\]'
40-
docker compose exec -T service npx pm2 list | grep -c "online" | grep -q 4 || exit 1
40+
- run:
41+
name: Verify pm2
42+
command: |
43+
docker compose exec -T service npx pm2 list \
44+
| tee /dev/tty \
45+
| grep -c "online" | grep -q 4

.env.template

+6
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,9 @@ HTTPS_PORT=443
3939
# SENTRY_ORG_SUBDOMAIN=
4040
# SENTRY_KEY=
4141
# SENTRY_PROJECT=
42+
43+
# Optional: configure S3-compatible storage for binary files
44+
# S3_SERVER=
45+
# S3_ACCESS_KEY=
46+
# S3_SECRET_KEY=
47+
# S3_BUCKET_NAME=

.github/workflows/ghcr.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: GHCR
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [master]
7+
tags: ["v*.*.*"]
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
12+
jobs:
13+
build-push-image:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
19+
strategy:
20+
matrix:
21+
image: [nginx, service]
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
fetch-tags: true
29+
submodules: recursive
30+
31+
- name: Log into registry ${{ env.REGISTRY }}
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ${{ env.REGISTRY }}
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
38+
- name: Extract Docker metadata
39+
id: meta
40+
uses: docker/metadata-action@v5
41+
with:
42+
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/central-${{ matrix.image }}
43+
44+
- name: Set up QEMU emulator for multi-arch images
45+
uses: docker/setup-qemu-action@v3
46+
47+
- name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@v3
49+
50+
- name: Build and push ${{ matrix.image }} Docker image
51+
uses: docker/build-push-action@v5
52+
with:
53+
file: ${{ matrix.image }}.dockerfile
54+
context: .
55+
push: true
56+
tags: ${{ steps.meta.outputs.tags }}
57+
labels: ${{ steps.meta.outputs.labels }}
58+
platforms: 'linux/amd64,linux/arm64'

.github/workflows/test-nginx.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Test nginx config
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
build:
9+
timeout-minutes: 10
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
fetch-tags: true
16+
submodules: recursive
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: 22.12.0
20+
- run: cd test && npm i
21+
- run: cd test && ./run-tests.sh
22+
23+
- if: always()
24+
run: docker logs test-nginx-1 || true
25+
- if: always()
26+
run: docker logs test-service-1 || true
27+
- if: always()
28+
run: docker logs test-enketo-1 || true

client

Submodule client updated 479 files

docker-compose.yml

+11-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ services:
2626
POSTGRES_PASSWORD: odk
2727
POSTGRES_DB: odk
2828
mail:
29-
image: "ixdotai/smtp:v0.5.2"
29+
image: "ixdotai/smtp:v0.5.4"
3030
volumes:
3131
- ./files/mail/rsa.private:/etc/exim4/dkim.key.temp:ro
3232
environment:
@@ -73,15 +73,17 @@ services:
7373
- SENTRY_ORG_SUBDOMAIN=${SENTRY_ORG_SUBDOMAIN:-o130137}
7474
- SENTRY_KEY=${SENTRY_KEY:-3cf75f54983e473da6bd07daddf0d2ee}
7575
- SENTRY_PROJECT=${SENTRY_PROJECT:-1298632}
76+
- S3_SERVER=${S3_SERVER:-}
77+
- S3_ACCESS_KEY=${S3_ACCESS_KEY:-}
78+
- S3_SECRET_KEY=${S3_SECRET_KEY:-}
79+
- S3_BUCKET_NAME=${S3_BUCKET_NAME:-}
7680
command: [ "wait-for-it", "${DB_HOST:-postgres14}:5432", "--", "./start-odk.sh" ]
7781
restart: always
7882
logging:
7983
driver: local
8084
nginx:
8185
build:
8286
context: .
83-
args:
84-
- OIDC_ENABLED=${OIDC_ENABLED:-false}
8587
dockerfile: nginx.dockerfile
8688
depends_on:
8789
- service
@@ -95,6 +97,11 @@ services:
9597
- SENTRY_ORG_SUBDOMAIN=${SENTRY_ORG_SUBDOMAIN:-o130137}
9698
- SENTRY_KEY=${SENTRY_KEY:-3cf75f54983e473da6bd07daddf0d2ee}
9799
- SENTRY_PROJECT=${SENTRY_PROJECT:-1298632}
100+
- OIDC_ENABLED=${OIDC_ENABLED:-false}
101+
volumes:
102+
- ./files/local/customssl/:/etc/customssl/live/local/:ro
103+
- ./files/nginx/odk.conf.template:/usr/share/odk/nginx/odk.conf.template:ro
104+
- ./files/nginx/client-config.json.template:/usr/share/odk/nginx/client-config.json.template:ro
98105
ports:
99106
- "${HTTP_PORT:-80}:80"
100107
- "${HTTPS_PORT:-443}:443"
@@ -106,7 +113,7 @@ services:
106113
options:
107114
max-file: "30"
108115
pyxform:
109-
image: 'ghcr.io/getodk/pyxform-http:v2.0.3'
116+
image: 'ghcr.io/getodk/pyxform-http:v3.0.0'
110117
restart: always
111118
secrets:
112119
volumes:

docs/news.html

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
</head>
88
<body>
99
<div class="news-item">
10-
<span class="item-date">2024/04/29</span>
11-
<a href="https://forum.getodk.org/t/odk-central-v2024-1-add-entities-by-uploading-a-csv/46616" target="_blank">
12-
ODK Central v2024.1
10+
<span class="item-date">2024/12/17</span>
11+
<a href="https://forum.getodk.org/t/odk-central-v2024-3-year-end-goodies/51515" target="_blank">
12+
ODK Central v2024.3
1313
</a>
1414
</div>
1515
<div class="news-item">
16-
<span class="item-date">2024/01/29</span>
17-
<a href="https://forum.getodk.org/t/odk-central-v2023-5-entity-updates-via-submissions/44311/2" target="_blank">
18-
ODK Central v2023.5.1
16+
<span class="item-date">2024/10/17</span>
17+
<a href="https://forum.getodk.org/t/odk-central-v2024-2-submission-deletes-and-s3-media-storage/49742/3" target="_blank">
18+
ODK Central v2024.2.1
1919
</a>
2020
</div>
2121
<script defer src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon='{"token": "81f288331d6e4638be205e0e63388165"}'></script>

docs/outdated-version.html

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<!DOCTYPE html>
2+
<html>
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<title>ODK Central</title>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
10+
<body>
11+
<!-- this page is rendered in an iframe of size 600x250 -->
12+
<div class="outdated-version" style="display: none;">
13+
<h1 class="heading"></h1>
14+
<p>
15+
<span class="sentence1"></span>
16+
<span class="sentence2"></span>
17+
</p>
18+
<script defer src='https://static.cloudflareinsights.com/beacon.min.js'
19+
data-cf-beacon='{"token": "81f288331d6e4638be205e0e63388165"}'></script>
20+
</div>
21+
22+
<script>
23+
const i18n = {
24+
"en": {
25+
"heading": "You’re using a significantly outdated version of ODK Central",
26+
"sentence1": "Upgrade now to protect your data and take advantage of the latest features.",
27+
"sentence2": "If you don't want to maintain Central, try {OdkCloudLink}."
28+
},
29+
"fr": {
30+
"heading": "Vous utilisez une version ancienne d'ODK Central",
31+
"sentence1": "Effectuez une mise à jour pour protéger vos données et profiter des fonctionnalités les plus récentes.",
32+
"sentence2": "Si vous préférez ne pas être responsable des mises à jours, essayez {OdkCloudLink}."
33+
},
34+
"es": {
35+
"heading": "Está utilizando una versión significativamente obsoleta de ODK Central",
36+
"sentence1": "Actualízate ahora para proteger tus datos y aprovechar las últimas funciones.",
37+
"sentence2": "Si no quiere mantener Central, pruebe con {OdkCloudLink}."
38+
},
39+
"cs": {
40+
"heading": "Používáte výrazně zastaralou verzi ODK Central",
41+
"sentence1": "Aktualizujte nyní, abyste ochránili svá data a využili nejnovější funkce.",
42+
"sentence2": "Pokud nechcete spravovat Central, vyzkoušejte {OdkCloudLink}."
43+
},
44+
"de": {
45+
"heading": "Sie verwenden eine deutlich veraltete Version von ODK Central",
46+
"sentence1": "Aktualisieren Sie jetzt, um Ihre Daten zu schützen und die neuesten Funktionen zu nutzen.",
47+
"sentence2": "Wenn Sie Central nicht warten möchten, probieren Sie {OdkCloudLink} aus."
48+
},
49+
"id": {
50+
"heading": "Anda menggunakan versi ODK Central yang sangat usang",
51+
"sentence1": "Perbarui sekarang untuk melindungi data Anda dan memanfaatkan fitur terbaru.",
52+
"sentence2": "Jika Anda tidak ingin memelihara Central, coba {OdkCloudLink}."
53+
},
54+
"it": {
55+
"heading": "Si sta utilizzando una versione significativamente obsoleta di ODK Central",
56+
"sentence1": "Eseguite subito l'aggiornamento per proteggere i vostri dati e sfruttare le funzioni più recenti.",
57+
"sentence2": "Se non si vuole mantenere Central, provare con {OdkCloudLink}."
58+
},
59+
"ja": {
60+
"heading": "ODK Central の大幅に古いバージョンを使用しています",
61+
"sentence1": "データを保護し、最新の機能を利用するために今すぐアップグレードしてください。",
62+
"sentence2": "Central を管理したくない場合は、{OdkCloudLink} を試してください。"
63+
},
64+
"sw": {
65+
"heading": "Unatumia toleo la ODK Central ambalo limepitwa sana na wakati",
66+
"sentence1": "Sasisha sasa ili kulinda data zako na kutumia vipengele vipya zaidi.",
67+
"sentence2": "Kama hutaki kudumisha Central, jaribu {OdkCloudLink}."
68+
},
69+
"zh-Hant": {
70+
"heading": "您正在使用一个明显过时的 ODK Central 版本",
71+
"sentence1": "立即升级以保护您的数据并利用最新功能。",
72+
"sentence2": "如果您不想维护 Central,请尝试 {OdkCloudLink}。"
73+
}
74+
};
75+
76+
const getTranslatedText = (key, lang) => {
77+
if(i18n[lang] && i18n[lang][key])
78+
return i18n[lang][key];
79+
else
80+
return i18n['en'][key];
81+
};
82+
83+
const odkCloudLink = document.createElement('a');
84+
odkCloudLink.href = "https://getodk.org/#success-stories";
85+
odkCloudLink.target = "_blank";
86+
odkCloudLink.textContent = "ODK Cloud";
87+
88+
document.addEventListener('DOMContentLoaded', () => {
89+
const queryParams = new URLSearchParams(location.search);
90+
const lang = queryParams.get('lang');
91+
92+
document.querySelector('.heading').textContent = getTranslatedText('heading', lang);
93+
document.querySelector('.sentence1').textContent = getTranslatedText('sentence1', lang);
94+
95+
// Safer method to place hyperlink instead of using innerHTML
96+
const parts = getTranslatedText('sentence2', lang).split('{OdkCloudLink}');
97+
document.querySelector('.sentence2').textContent = '';
98+
document.querySelector('.sentence2').appendChild(document.createTextNode(parts[0]));
99+
document.querySelector('.sentence2').appendChild(odkCloudLink);
100+
document.querySelector('.sentence2').appendChild(document.createTextNode(parts[1]));
101+
102+
// default style of .outdated-version is display:none, following line makes it visible
103+
document.querySelector('.outdated-version').style = 'display: flex;'
104+
});
105+
</script>
106+
</body>
107+
108+
</html>

docs/style.css

+18
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,21 @@ a:focus {
6060
.news-item a {
6161
margin-left: 82px;
6262
}
63+
64+
.outdated-version {
65+
display: flex;
66+
flex-direction: column;
67+
height: 250px;
68+
justify-content: center;
69+
gap: 20px;
70+
}
71+
72+
.outdated-version h1 {
73+
margin: 0;
74+
font-size: 30px;
75+
}
76+
77+
.outdated-version p {
78+
margin: 0;
79+
font-size: 18px;
80+
}

enketo.dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ghcr.io/enketo/enketo:7.2.0
1+
FROM ghcr.io/enketo/enketo:7.5.0
22

33
ENV ENKETO_SRC_DIR=/srv/src/enketo/packages/enketo-express
44
WORKDIR ${ENKETO_SRC_DIR}
+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"oidcEnabled": $OIDC_ENABLED
3+
}

files/nginx/common-headers.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# They are included here to ease interpretation of violation reports.
77
#
88
# N.B. a separate CSP is defined for Enketo in odk.conf.template
9-
add_header Content-Security-Policy-Report-Only "default-src 'none'; connect-src 'self'; font-src 'self'; frame-src 'self' https://getodk.github.io/central/news.html; img-src *; manifest-src 'none'; media-src 'none'; object-src 'none'; script-src 'self'; style-src 'self'; style-src-attr 'unsafe-inline'; report-uri /csp-report";
9+
add_header Content-Security-Policy-Report-Only "default-src 'none'; connect-src 'self'; font-src 'self'; frame-src 'self' https://getodk.github.io/central/news.html; img-src * data:; manifest-src 'none'; media-src 'none'; object-src 'none'; script-src 'self'; style-src 'self'; style-src-attr 'unsafe-inline'; report-uri /csp-report";
1010

1111
# If changing these headers, please apply the same updates to enketo
1212
# location(s) in odk.conf.template

0 commit comments

Comments
 (0)