From: Raxel Gutierrez Date: Tue, 17 Aug 2021 21:33:49 +0000 (+0000) Subject: static: add JS Cookie library to get csrftoken for client-side requests X-Git-Tag: v3.1.0~83 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8f4a658d8436f804b5599707bab2582f85e81c3;p=thirdparty%2Fpatchwork.git static: add JS Cookie library to get csrftoken for client-side requests Currently in Patchwork, requests are made only through older methods via form submissions, which means the UI is rendered strictly server-side. This lags behind more modern and versatile approaches that use JavaScript to send requests and dynamically update the UI based on the respective responses. In order to make REST API requests on the client-side secure from CSRF attacks, add the JS Cookie library which allows the CSRF token to be passed in the request header. A following patch that introduces the `rest.js` module will make use of the JS Cookie library in this patch. The library is a recommendation from Django docs [1]. The files for the library can be downloaded in the releases page of the GitHub [2]. [1] https://docs.djangoproject.com/en/3.2/ref/csrf/#ajax [2] https://github.com/js-cookie/js-cookie/releases Signed-off-by: Raxel Gutierrez Reviewed-by: Daniel Axtens Reviewed-by: Stephen Finucane --- diff --git a/htdocs/README.rst b/htdocs/README.rst index 62f15c23..128dc7c2 100644 --- a/htdocs/README.rst +++ b/htdocs/README.rst @@ -122,6 +122,15 @@ js :GitHub: jQuery plug-in to drag and drop rows in HTML tables :Version: ??? +``js.cookie.min.js`` + + Library used to handle cookies. + + This is used to get the ``csrftoken`` cookie for AJAX requests in JavaScript. + + :GitHub: https://github.com/js-cookie/js-cookie/ + :Version: 3.0.0 + ``selectize.min.js`` Selectize is the hybrid of a ``textbox`` and ``