diff --git a/bin/acoeur.conf b/bin/acoeur.conf index ac63daf..a00c501 100644 --- a/bin/acoeur.conf +++ b/bin/acoeur.conf @@ -5,34 +5,28 @@ ServerSignature Off Protocols h2 h2c http/1.1 DocumentRoot /var/simpleWeb/apps/acoeur/public - - Require all granted - # Send back all headers, most importantly the eventual "authorization" one - Header always echo - # Do not send a 404 - Redirect 204 / - - # For development - Header always set authorization "test" - - - - - ServerName edit.acoeur - Protocols h2 h2c http/1.1 - - DocumentRoot /var/simpleWeb/apps/acoeur/content - - # This is special, anybody can see and edit it! - Require all granted - + Alias /edit /var/simpleWeb/apps/acoeur/content + + AuthUserFile /home/manu/Adata/.htaccessPasswords + AuthName "Quiz d'A Livr'Ouvert" + AuthType Basic + Require user mag manu amelie tiffany + + + Require all granted + + + Require all granted + + + Require all granted + + + Require all granted + + + Require all granted + CustomLog /var/simpleWeb/log/apache/acoeur.log combined - - # So that simple web editor can display eventual errors - Alias /app.log /var/simpleWeb/apps/acoeur/public/app.log - - Header set Access-Control-Allow-Origin acoeur - Header set Access-Control-Allow-Methods "HEAD, GET, POST, PUT, OPTIONS, DELETE" - Header set Access-Control-Allow-Headers * diff --git a/bin/apache_on_change.sh b/bin/apache_on_change.sh index be50648..14c1022 100755 --- a/bin/apache_on_change.sh +++ b/bin/apache_on_change.sh @@ -6,6 +6,9 @@ line="$1" url=$(echo "$line" | cut -d ' ' -f7) +# Remove the starting "/edit" part, which is an apache alias required to target the proper directory +url=${url#/edit*} + full="$(pwd)/content$url" dir=${full%/*} diff --git a/content/pages.txt b/content/pages.txt index 8c0fe7f..c7b2e42 100644 --- a/content/pages.txt +++ b/content/pages.txt @@ -1,8 +1,8 @@ /pages/doc/devoir.md:title: Devoir -/pages/doc/intro.md:title: Introduction /pages/doc/savoir.md:title: Savoir /pages/doc/vouloir.md:title: Vouloir /pages/doc/pouvoir.md:title: Pouvoir +/pages/doc/intro.md:title: Introduction /pages/1er-quiz/cff71434-fdaf-468f-838c-067059979299.md:title: Chapitre 3 - Les lettres de nulle part /pages/1er-quiz/b80fcc08-170e-4422-8498-ae1f97b47eda.md:title: Chapitre 5 - Le chemin de traverse /pages/1er-quiz/7c038015-c989-4024-a3cf-14b8557fdb0c.md:title: Chapitre 6 - Rendez-vous sur la voie 9 3/4 diff --git a/themes/acoeur/assets/js/author.js b/themes/acoeur/assets/js/author.js index 7cf3071..134eee3 100644 --- a/themes/acoeur/assets/js/author.js +++ b/themes/acoeur/assets/js/author.js @@ -10,7 +10,7 @@ document.querySelectorAll('aside#actions #create') .forEach(elt => elt.onclick = () => { const url = `${topSection}/${uuid()}` - fetch(`${document.body.dataset.editHost}/${url}.create`, { method: 'PUT', body: topSection }) + fetch(`/edit/${url}.create`, { method: 'PUT', body: topSection }) .then(() => sleep(1)) .then(() => window.location.assign('/' + url)) .catch(error => console.error(`Error creating #{topSection}`, error)) @@ -37,7 +37,7 @@ document.querySelectorAll('aside#actions input#file') document.querySelectorAll('.delete_image') .forEach(elt => elt.onclick = () => { if (confirm(elt.dataset.confirm)) - fetch(document.body.dataset.editHost + elt.dataset.target, { method: 'DELETE' }) + fetch('/edit/' + elt.dataset.target, { method: 'DELETE' }) + .then(() => elt.parentNode.remove()) .catch(error => console.error(error)) - .finally(() => elt.parentNode.remove()) }) diff --git a/themes/acoeur/assets/js/prop.js b/themes/acoeur/assets/js/prop.js index 1d14027..986efa4 100644 --- a/themes/acoeur/assets/js/prop.js +++ b/themes/acoeur/assets/js/prop.js @@ -18,7 +18,7 @@ const pages = document.getElementById('pages') prepareChoiceEdition = (node) => { // Load list of pages from which authors can select results' page if (node.list && !node.dataset.old && !pages.children.length) - fetch(`${editHost}/pages.txt`, { cache: 'no-store' }) + fetch('/pages.txt', { cache: 'no-store' }) .then(pages => pages.text()) .then(pages => pages.split('\n') .filter(line => line) diff --git a/themes/acoeur/assets/js/setup.js b/themes/acoeur/assets/js/setup.js index 82d7173..96eb0cd 100644 --- a/themes/acoeur/assets/js/setup.js +++ b/themes/acoeur/assets/js/setup.js @@ -1,9 +1,4 @@ -document.body.dataset.editHost = window.location.protocol - + '//edit.' - + window.location.host -document.body.dataset.editUrl = document.body.dataset.editHost - + '/' - + file.replace('.md', '') +document.body.dataset.editUrl = '/edit/' + file.replace('.md', '') const topSection = window.location.pathname.split('/')[1] if (topSection) document.body.classList.add(topSection) diff --git a/themes/acoeur/layouts/_default/pages.html b/themes/acoeur/layouts/_default/pages.html index c7a75c7..ba1f519 100644 --- a/themes/acoeur/layouts/_default/pages.html +++ b/themes/acoeur/layouts/_default/pages.html @@ -8,7 +8,7 @@ {{ else if .Parent.Parent.IsHome }}