فهرست منبع

Hosting: Require application/wasm mimetype

Danilo Bargen 6 سال پیش
والد
کامیت
1e59c046ea
4فایلهای تغییر یافته به همراه27 افزوده شده و 4 حذف شده
  1. 7 0
      CHANGELOG.md
  2. 6 0
      docker/entrypoint.sh
  3. 2 2
      docs/docker.md
  4. 12 2
      docs/self_hosting.md

+ 7 - 0
CHANGELOG.md

@@ -4,6 +4,13 @@ This changelog lists the most important changes for each released version. For
 the full log, please refer to the git commit history.
 the full log, please refer to the git commit history.
 
 
 
 
+### Unreleased
+
+**NOTE:** If you are self-hosting threema-web, then you need to make sure to
+set the proper MIME type for `.wasm` (WebAssembly) files. See
+`docs/self_hosting.md` for more details.
+
+
 ### [v2.1.7][v2.1.7] (2019-02-07)
 ### [v2.1.7][v2.1.7] (2019-02-07)
 
 
 Changes:
 Changes:

+ 6 - 0
docker/entrypoint.sh

@@ -10,5 +10,11 @@ fi
 sed -i -E "s/SALTYRTC_PORT:\s*[^,]*,/SALTYRTC_PORT:${SALTYRTC_PORT},/g" *.bundle.js
 sed -i -E "s/SALTYRTC_PORT:\s*[^,]*,/SALTYRTC_PORT:${SALTYRTC_PORT},/g" *.bundle.js
 sed -i -E "s/SALTYRTC_SERVER_KEY:\s*\"[^\"]*\",/SALTYRTC_SERVER_KEY:\"${SALTYRTC_SERVER_KEY}\",/g" *.bundle.js
 sed -i -E "s/SALTYRTC_SERVER_KEY:\s*\"[^\"]*\",/SALTYRTC_SERVER_KEY:\"${SALTYRTC_SERVER_KEY}\",/g" *.bundle.js
 
 
+# Add nginx mime type for wasm
+# See https://trac.nginx.org/nginx/ticket/1606
+if ! grep -q application/wasm "/etc/nginx/mime.types"; then
+    sed -i '2aapplication/wasm wasm;' /etc/nginx/mime.types
+fi
+
 echo "Starting Threema Web..."
 echo "Starting Threema Web..."
 exec nginx -g 'daemon off;'
 exec nginx -g 'daemon off;'

+ 2 - 2
docs/docker.md

@@ -5,11 +5,11 @@ A Docker image with Threema Web is published on Docker Hub at
 
 
 Alternatively you can build the image yourself:
 Alternatively you can build the image yourself:
 
 
-    $ docker build . -t threema/threema-web:v2.1
+    $ docker build . -t threema/threema-web:master
 
 
 To run the Docker image:
 To run the Docker image:
 
 
-    $ docker run --rm -p 8080:80 threema/threema-web
+    $ docker run --rm -p 8080:80 threema/threema-web:master
 
 
 Now you can open `http://localhost:8080/` in your browser to use Threema Web.
 Now you can open `http://localhost:8080/` in your browser to use Threema Web.
 
 

+ 12 - 2
docs/self_hosting.md

@@ -19,8 +19,18 @@ issue](https://github.com/threema-ch/threema-web/issues) on Github.
 
 
 Threema Web is a web application written in TypeScript with AngularJS 1. All
 Threema Web is a web application written in TypeScript with AngularJS 1. All
 that is required to host it is a web server that can deliver static content via
 that is required to host it is a web server that can deliver static content via
-https. We recommend using Nginx. Additionally, to build the release version
-yourself, a recent version of npm is required.
+https. We recommend using Nginx. Additionally, to build the
+release version yourself, a recent version of npm is required.
+
+*Note:* The web server needs to set the proper MIME type for `*.wasm`
+(WebAssembly) files. When using Nginx, add the following line to the types in
+`/etc/nginx/mime.types`:
+
+    application/wasm    wasm;
+
+When using Python,
+[someting like this](https://gist.github.com/dbrgn/6bf88d32b1b44b1b1d4140f92b8a7a0a)
+should work.
 
 
 ### Building from source
 ### Building from source