diff --git a/README.md b/README.md index efd6b230d..929a0c295 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Textcavator is primarily intended for academic research and higher education. We ## Contents -This repository contains the source code for the Textcavator web application, which consists of a Django backend and Angular frontend. +This repository contains the source code for the Textcavator web application, which consists of a [Django backend](/backend/) and [Angular frontend](/frontend/). It also contains [developer documentation](/documentation/), [functional tests](/functional-tests/), and a [test app for embedding Textcavator](/iframe-test-app/). For corpora included in Textcavator, the backend includes a definition file that specifies how to read the source files, and how this data should be structured and presented in Textcavator. This repository does _not_ include the source data itself, beyond a few sample files for testing. diff --git a/backend/ianalyzer/settings.py b/backend/ianalyzer/settings.py index 3b4ff3e32..96e9921c8 100644 --- a/backend/ianalyzer/settings.py +++ b/backend/ianalyzer/settings.py @@ -25,6 +25,8 @@ ALLOWED_HOSTS = [] +X_FRAME_OPTIONS = 'ALLOW' + # Database # https://docs.djangoproject.com/en/3.0/ref/settings/#databases diff --git a/iframe-test-app/README.md b/iframe-test-app/README.md new file mode 100644 index 000000000..146f654ba --- /dev/null +++ b/iframe-test-app/README.md @@ -0,0 +1,17 @@ +# iframe test app + +This is a minimal setup to test embedding Textcavator in another site using an iframe. It serves a web page that embeds your Textcavator development server. You can use it to test the layout, or try out the workflow in an embedded frame. + +## Usage + +The test app is run using `server.py`. It requires Python to use, no dependencies. + +To run, start your Texcavator development server. Then run the container app by running: + +```sh +python server.py +``` + +The container app will run at http://localhost:9000/ . Use ctrl + C to quit. + +To direct the iframe to a specific corpus, you can include a query parameter `corpus` in the URL with the corpus name, e.g. http://localhost:9000/?corpus=troonredes . diff --git a/iframe-test-app/index.html b/iframe-test-app/index.html new file mode 100644 index 000000000..71de510cd --- /dev/null +++ b/iframe-test-app/index.html @@ -0,0 +1,62 @@ + + + + + + + + Container app + + + + + +
+
+
+
+
+ +
+ + Utrecht University + +
+
+
+
+
+

Textcavator container

+
+
+
+
+
+
+
+ +
+
+
+
+ + + + + diff --git a/iframe-test-app/main.js b/iframe-test-app/main.js new file mode 100644 index 000000000..29aeebb6c --- /dev/null +++ b/iframe-test-app/main.js @@ -0,0 +1,10 @@ +var url = new URL(window.location); +var corpus = url.searchParams.get('corpus'); + +var appUrl = new URL('http://localhost:4200'); +if (corpus) { + appUrl.pathname = `/search/${corpus}/`; +} + +var iframe = document.getElementById('textcavator-iframe'); +iframe.setAttribute('src', appUrl.toString()); diff --git a/iframe-test-app/server.py b/iframe-test-app/server.py new file mode 100644 index 000000000..4b27d55dc --- /dev/null +++ b/iframe-test-app/server.py @@ -0,0 +1,9 @@ +from http.server import HTTPServer, SimpleHTTPRequestHandler + +ADDRESS = ('', 9000) + +server = HTTPServer(ADDRESS, SimpleHTTPRequestHandler) + +if __name__ == '__main__': + print(f'Starting server at http://localhost:{server.server_port}') + server.serve_forever() diff --git a/iframe-test-app/solis.png b/iframe-test-app/solis.png new file mode 100644 index 000000000..22b4dd58a Binary files /dev/null and b/iframe-test-app/solis.png differ diff --git a/iframe-test-app/style.css b/iframe-test-app/style.css new file mode 100644 index 000000000..6cd477f4b --- /dev/null +++ b/iframe-test-app/style.css @@ -0,0 +1,3 @@ +.frame-container { + height: 90vh; +}