Maint master
authorRadek Czajka <radekczajka@wolnelektury.pl>
Wed, 25 Nov 2026 09:58:33 +0000 (10:58 +0100)
committerRadek Czajka <radekczajka@wolnelektury.pl>
Wed, 25 Nov 2026 09:58:33 +0000 (10:58 +0100)
Dockerfile
src/cover/tests.py
src/documents/templates/documents/book_text.html
src/redakcja/context_processors.py
src/redakcja/settings/defaults.py
src/redakcja/static/js/wiki/view_editor_wysiwyg.js
src/redakcja/static/js/wiki/view_properties.js
src/redakcja/static/js/wiki/wikiapi.js
src/redakcja/static/js/wiki/xslt.js
src/redakcja/templates/base.html

index c62efe4..e4fcb80 100644 (file)
@@ -54,11 +54,11 @@ ARG GID=8200
 COPY scripts/nginx.conf /etc/nginx/conf.d/default.conf
 
 RUN addgroup -g $GID app && addgroup nginx app
-COPY --from=static-builder /app/src/static /app/var/static
+COPY --from=static-builder /app/var/static /app/var/static
 
 
 
 
 FROM prod-base AS prod
 
-COPY --from=static-builder /app/src/static/staticfiles.json /app/src/static/staticfiles.json
+COPY --from=static-builder /app/var/static/staticfiles.json /app/var/static/staticfiles.json
index 5436100..910b0df 100644 (file)
@@ -126,13 +126,13 @@ class CoverPreviewTest(TestCase):
     def test_preview_from_bad_xml(self):
         response = self.client.post('/cover/preview/', data={"xml": ''})
         self.assertEqual(response.status_code, 200)
-        self.assertEqual(response.content, b'/media/static/img/sample_cover.png')
+        self.assertEqual(response.content, b'/static/img/sample_cover.png')
 
     @patch('cover.views.make_cover')
     def test_preview_from_minimal_xml(self, make_cover):
         response = self.client.post('/cover/preview/', data={"xml": SAMPLE_XML})
         self.assertEqual(response.status_code, 200)
-        self.assertIn(b'/media/dynamic/cover/preview/', response.content)
+        self.assertIn(b'/media/cover/preview/', response.content)
 
     def test_bad_book(self):
         response = self.client.get('/cover/preview/test/')
@@ -221,4 +221,4 @@ class TestCover(TestCase):
         
     def test_image_file(self):
         response = self.client.get('/cover/image/1/file/')
-        self.assertRegex(response['Location'], r'^/media/dynamic/cover/image/')
+        self.assertRegex(response['Location'], r'^/media/cover/image/')
index a88aad5..c17c1da 100644 (file)
@@ -21,7 +21,7 @@
             </ul>
         </div>
         <div id="header">
-            <a href="/"><img src="/media/static/img/logo-220.png" alt="Wolne Lektury" /></a>
+            <a href="/"><img src="/static/img/logo-220.png" alt="Wolne Lektury" /></a>
         </div>
         {{ html|safe }}
     </body>
index e750fd2..1eba280 100644 (file)
@@ -4,17 +4,7 @@
 def settings(request):
     from django.conf import settings
 
-    if settings.SHOW_APP_VERSION:
-        import subprocess
-        process = subprocess.Popen(["git", "show", "--oneline"], stdout=subprocess.PIPE)
-        data, _err = process.communicate()
-        # get app version
-        VERSION = data.splitlines()[0].split()[0]
-    else:
-        VERSION = ''
-
     return {
         'MEDIA_URL': settings.MEDIA_URL,
         'STATIC_URL': settings.STATIC_URL,
-        'APP_VERSION': VERSION,
     }
index 11edc51..2be9aa5 100644 (file)
@@ -3,8 +3,6 @@
 #
 import os
 
-PROJECT_ROOT = os.path.realpath(os.path.dirname(os.path.dirname(__file__)))
-
 DATABASES = {
     'default': {
         'ENGINE': 'django.db.backends.postgresql',
@@ -46,25 +44,21 @@ USE_L10N = True
 
 # Absolute path to the directory that holds media.
 # Example: "/home/media/media.lawrence.com/"
-MEDIA_ROOT = PROJECT_ROOT + '/media/dynamic'
-STATIC_ROOT = PROJECT_ROOT + '/../static/'
-CATALOGUE_REPO_PATH = MEDIA_ROOT + '/repo'
-CATALOGUE_IMAGE_REPO_PATH = MEDIA_ROOT + '/imgrepo'
+MEDIA_ROOT = '/app/var/media'
+STATIC_ROOT = '/app/var/static'
+CATALOGUE_REPO_PATH = '/app/var/dvcs'
+CATALOGUE_IMAGE_REPO_PATH = '/app/var/dvcs-img'
 
 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
 # trailing slash if there is a path component (optional in other cases).
 # Examples: "http://media.lawrence.com", "http://example.com/media/"
-MEDIA_URL = '/media/dynamic/'
-STATIC_URL = '/media/static/'
+MEDIA_URL = '/media/'
+STATIC_URL = '/static/'
 
 SESSION_COOKIE_NAME = "redakcja_sessionid"
 
 IMAGE_DIR = 'images/'
 
-BROKER_URL = 'django://'
-
-SHOW_APP_VERSION = False
-
 CAS_SERVER_URL = None
 CAS_APPLY_ATTRIBUTES_TO_USER = True
 CAS_RENAME_ATTRIBUTES = {
index afd8108..1c9f2ed 100644 (file)
            let self = this;
             xml2html({
                 xml: this.doc.text,
-                base: this.doc.getBase(),
                 success: function(element){
 
                     var htmlView = $('#html-view');
index 6ae6e57..be027e0 100644 (file)
@@ -1,8 +1,5 @@
 (function($){
 
-    let w = function() {};
-    w = console.log;
-
     const elementDefs = {
         "ilustr": {
             "attributes": [
                     html2text({
                         element: self.$edited[0],
                         success: function(xml) {
-                            w(222)
                             let $xmlelem = $($.parseXML(xml));
-                            w(333, $xmlelem)
-                            w($input.data('property'), $input.val());
                             $xmlelem.contents().attr($input.data('property'), inputval);
-                            w(444, $xmlelem)
                             let newxml = (new XMLSerializer()).serializeToString($xmlelem[0]);
-                            w(555, newxml)
                             xml2html({
                                 xml: newxml,
-                                base: self.doc.getBase(),
                                 success: function(html) {
                                     let htmlElem = $(html);
                                     self.$edited.replaceWith(htmlElem);
index 5675913..a420e3b 100644 (file)
             text = $.trim(text.replace(/\s{2,}/g, ' '));
             return text.length;
         }
-
-        /* Temporary workaround for relative images. */
-        getBase() {
-            return '/media/dynamic/images/' + this.galleryLink + '/';
-        }
     }
 
     $.wikiapi.WikiDocument = WikiDocument;
index 922a3ba..00854a7 100644 (file)
@@ -60,17 +60,10 @@ function xml2html(options) {
             source.text('');
             options.error(error.text(), source_text);
         } else {
-            let galleryUrl = new URL(
-                options.base,
-                window.location.href
-            );
             $("img", $(doc.childNodes)).each(function() {
                 $(this).attr(
                     'src',
-                    new URL(
-                        $(this).attr('src'),
-                        galleryUrl
-                    )
+                    $(this).attr('src'),
                 );
             })
 
index 01fb09b..e212e89 100644 (file)
@@ -19,7 +19,6 @@
        </div>
     </div>
 
-    <!-- version: {{ APP_VERSION }} -->
     {% block maincontent %} {% endblock %}
     <script
         src="https://code.jquery.com/jquery-1.9.1.min.js"