Maintenance: Improve clipboard handling of website chat

antifascista-stable-5.0
Thorsten Eckel 11 months ago
parent b1e8b3afae
commit b125b3603e
  1. 16
      public/assets/chat/Dockerfile
  2. 5
      public/assets/chat/README.md
  3. 8
      public/assets/chat/build.sh
  4. 6
      public/assets/chat/chat-no-jquery.coffee
  5. 352
      public/assets/chat/chat-no-jquery.js
  6. 2
      public/assets/chat/chat-no-jquery.min.js
  7. 4
      public/assets/chat/chat.coffee
  8. 3
      public/assets/chat/chat.css
  9. 352
      public/assets/chat/chat.js
  10. 2
      public/assets/chat/chat.min.js
  11. 5
      public/assets/chat/docker-entrypoint.sh
  12. 6
      public/assets/chat/gulpfile.js
  13. 3
      public/assets/chat/purify.min.js

@ -0,0 +1,16 @@
FROM node:8-alpine
ENV GULP_DIR "/tmp/gulp"
RUN apk update && apk add bash
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
CMD bash # If you want to override CMD
RUN npm install -g gulp
COPY docker-entrypoint.sh /
# enable volume to generate build files into the hosts FS
VOLUME ["$GULP_DIR"]
# start
ENTRYPOINT ["/docker-entrypoint.sh"]

@ -0,0 +1,5 @@
# Zammad Chat build
This folder contains a `docker` image and the required files to build the Zammad Chat from coffeescript and eco files. This workaround is required for now because of the outdated NodeJS 8 dependency.
The build process can easily be started by executing the `build.sh` file. There is nothing more to it except of having `docker` installed and running.

@ -0,0 +1,8 @@
#!/bin/bash
set -o errexit
set -o pipefail
docker build --no-cache -t zammad/chat-build:latest .
docker run --rm -v "$(pwd)/:/tmp/gulp" zammad/chat-build:latest

@ -762,7 +762,11 @@ do(window) ->
console.log('p', docType, text)
if docType is 'html'
html = document.createElement('div')
html.innerHTML = text
# can't log because might contain malicious content
# @log.debug 'HTML clipboard', text
sanitized = DOMPurify.sanitize(text)
@log.debug 'sanitized HTML clipboard', sanitized
html.innerHTML = sanitized
match = false
htmlTmp = text
regex = new RegExp('<(/w|w)\:[A-Za-z]')

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -718,7 +718,9 @@ do($ = window.jQuery, window) ->
text = text.replace(/<div><\/div>/g, '<div><br></div>')
console.log('p', docType, text)
if docType is 'html'
html = $("<div>#{text}</div>")
sanitized = DOMPurify.sanitize(text)
@log.debug 'sanitized HTML clipboard', sanitized
html = $("<div>#{sanitized}</div>")
match = false
htmlTmp = text
regex = new RegExp('<(/w|w)\:[A-Za-z]')

@ -314,6 +314,7 @@
line-height: 1.4em;
font-size: inherit;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border: none;
background: none;
@ -329,6 +330,7 @@
.zammad-chat-button {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
font-family: inherit;
font-size: inherit;
@ -349,6 +351,7 @@
.zammad-chat-button:disabled,
.zammad-chat-input:disabled {
cursor: not-allowed;
opacity: 0.3; }
.zammad-chat-is-hidden {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,5 @@
#!/bin/bash
cd "${GULP_DIR}" || exit
gulp js css no-jquery

@ -25,11 +25,14 @@ gulp.task('js', function(){
var templates = gulp.src('views/*.eco')
.pipe(eco({namespace: 'zammadChatTemplates'}));
var purify = gulp.src('purify.min.js');
var js = gulp.src('chat.coffee')
.pipe(plumber())
.pipe(coffee({bare: true}).on('error', gutil.log));
return merge(templates, js)
.add(purify)
.pipe(concat('chat.js'))
.pipe(gulp.dest('./'))
.pipe(uglify())
@ -42,11 +45,14 @@ gulp.task('no-jquery', function(){
var templates = gulp.src('views/*.eco')
.pipe(eco({namespace: 'zammadChatTemplates'}));
var purify = gulp.src('purify.min.js');
var js = gulp.src('chat-no-jquery.coffee')
.pipe(plumber())
.pipe(coffee({bare: true}).on('error', gutil.log));
return merge(templates, js)
.add(purify)
.pipe(concat('chat-no-jquery.js'))
.pipe(gulp.dest('./'))
.pipe(uglify())

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save