Add export recipe

Change-Id: I5dd2dce3a83fdab0702f11dea45287847a4e0b8b

Update Kalamar to v0.64

Change-Id: Ie5ea8d6bb02b8aa910e736ed04c4b63a9a628aed

Add CSP exception

Better add another stub in the future.

Change-Id: Id641b9679c00b76019e6b315e864e56566672f85

Pin export plugin to 0.3.4

Change-Id: I0fbd3af58474b6d3ce911ef5db79a620e1b2f5e4

Add export plugin config via env variables

Change-Id: I3a641142480568941b07d3039a030b3a0e49d99f

Fix export icon escaping

Change-Id: I893b4da02969e2040d9a43bc6998015ecd1679f0

Update Readme.md with explort plugin instructions

Change-Id: I38c1335f10c1b676f03e4d1a97985c27f29aad44

Bump actions/cache from 4 to 5

Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Closes #17

Change-Id: I7df4dc89e16985c88922b1d6607eb749f507e924

Bump actions/checkout from 4 to 6

Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Closes #15

Change-Id: Iac23c6ef1526c0d18ae0d5fa715c137172149c6d
diff --git a/.github/workflows/ci_test.yml b/.github/workflows/ci_test.yml
index 47fa673..ff341dd 100644
--- a/.github/workflows/ci_test.yml
+++ b/.github/workflows/ci_test.yml
@@ -6,7 +6,7 @@
   test:
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/checkout@v4
+      - uses: actions/checkout@v6
       - name: Set up data directory
         run: mkdir -p data
       - name: Convert TEI input to KorAP-XML
@@ -43,7 +43,7 @@
         run: test $(curl --silent 'http://localhost:64543?q=geht&ql=poliqarp&cq=corpusSigle=DCK' | grep -c snippet) -gt 10
 
       - name: Checkout KorAP/KorAP-E2E-Tests
-        uses: actions/checkout@v4
+        uses: actions/checkout@v6
         with:
           repository: KorAP/KorAP-E2E-Tests
           path: KorAP-E2E-Tests
@@ -57,7 +57,7 @@
         working-directory: ./KorAP-E2E-Tests
         run: npm ci
       - name: Setup cache for Chromium binary
-        uses: actions/cache@v4
+        uses: actions/cache@v5
         with:
           path: ~/.cache/puppeteer/chrome
           key: ubuntu-latest-chromium-${{ hashFiles('packages/puppeteer-core/src/revisions.ts') }}
diff --git a/Readme.md b/Readme.md
index 9483bc3..926f0d5 100644
--- a/Readme.md
+++ b/Readme.md
@@ -34,6 +34,12 @@
 to start the example image and the service with Linux
 (See [here](#Windows) for more information on Windows).
 
+To include the export plugin, add the export profile:
+
+```shell
+COMPOSE_PROFILES="export" INDEX='example-index' docker compose -p korap --profile=lite --profile=example --profile=export up
+```
+
 Otherwise it's possible to download the sample index provided by
 [Kustvakt](https://github.com/KorAP/Kustvakt/tree/master/sample-index).
 To download, intialize and run KorAP pointing to that index folder
diff --git a/compose.yaml b/compose.yaml
index 46b318c..898ba0b 100644
--- a/compose.yaml
+++ b/compose.yaml
@@ -9,15 +9,38 @@
       - "example-index:/kustvakt/index"
     restart: "no"
   kalamar:
-    image: "korap/kalamar:latest"
+    image: "korap/kalamar:v0.64"
     ports:
       - "64543:64543"
     environment:
       KALAMAR_API: "http://kustvakt:8089/api/"
+      COMPOSE_PROFILES: ${COMPOSE_PROFILES}
     depends_on:
       - kustvakt
     profiles:
       - lite
+    entrypoint: []
+    command: >
+      sh -c '
+        if echo "$$COMPOSE_PROFILES" | grep -q "export"; then
+          echo "Hacking in selective CSP policy...";
+          if ! grep -q "script-src.*unsafe-inline" /kalamar/kalamar.production.conf; then
+            cat /kalamar/kalamar.production.conf | perl -pe "s/\\{/\\{CSP=>{q!frame-src!=>[q!self!]},/" > /kalamar/kalamar.production.tmp.conf;
+            mv /kalamar/kalamar.production.tmp.conf /kalamar/kalamar.production.conf;
+          fi;
+          # Should better be retrieved by the export plugin service using curl
+          PLUGINJSON="{ name => \"Export\", desc => \"Exports Kalamar results\", embed => [{ panel => \"result\", title => \"exports KWICs and snippets\" , icon => \"\134x{f019}\", classes => [\"button-icon\",\"plugin\"], onClick => { action => \"addWidget\", template => \"/plugin/export/export\", permissions => [\"forms\",\"scripts\", \"downloads\" ]}}]},";
+          PLUGINPROXY="{ root_path => \"/plugin/export/\", mount => \"http://kalamar-export:7777/\", service => \"export-plugin-proxy\" },";
+          if ! grep -F -q "/plugin/export/export" /kalamar/kalamar.production.conf; then
+            cat /kalamar/kalamar.production.conf | perl -pe "s!\047PLUGIN_STUB\047!$$PLUGINJSON\047PLUGIN_STUB\047!;" > /kalamar/kalamar.production.tmp.conf;
+            mv /kalamar/kalamar.production.tmp.conf /kalamar/kalamar.production.conf
+          fi;
+          if ! grep -F -q "export-plugin-proxy" /kalamar/kalamar.production.conf; then
+            cat /kalamar/kalamar.production.conf | perl -pe "s!\047PROXY_STUB\047!$$PLUGINPROXY\047PROXY_STUB\047!;" > /kalamar/kalamar.production.tmp.conf;
+            mv /kalamar/kalamar.production.tmp.conf /kalamar/kalamar.production.conf
+          fi;
+          cat /kalamar/kalamar.production.conf;
+        fi || true; perl script/kalamar daemon -l http://0.0.0.0:64543'
     restart: "unless-stopped"
   full-init:
     image: "korap/kalamar:latest"
@@ -50,6 +73,21 @@
       - full
     restart: "unless-stopped"
     user: root
+  kalamar-export:
+    image: "korap/kalamar-plugin-export:0.3.4"
+    environment:
+      KALAMAR_EXPORT_API_HOST: "kustvakt"
+      KALAMAR_EXPORT_API_PORT: "8089"
+      KALAMAR_EXPORT_API_SCHEME: "http"
+      KALAMAR_EXPORT_ASSET_HOST: "localhost"
+      KALAMAR_EXPORT_ASSET_PORT: "64543"
+      KALAMAR_EXPORT_ASSET_SCHEME: "http"
+      KALAMAR_EXPORT_SERVER_SCHEME: "http"
+      KALAMAR_EXPORT_SERVER_HOST: "0.0.0.0"
+      KALAMAR_EXPORT_SERVER_PORT: "7777"
+    profiles:
+      - export
+    restart: "unless-stopped"
   kustvakt:
     image: "korap/kustvakt:latest"
     expose: