Skip to content
Snippets Groups Projects
Commit 5449139e authored by Benguria Elguezabal, Gorka's avatar Benguria Elguezabal, Gorka
Browse files

public release

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 1510 additions and 0 deletions
.git/
bin
/etc/build/*.min.js
classes
node_modules
.vscode/settings.json
src/main/webapp/WEB-INF/lib/animal-sniffer-annotations-*.jar
src/main/webapp/WEB-INF/lib/annotations-*.jar
src/main/webapp/WEB-INF/lib/api-common-*.jar
src/main/webapp/WEB-INF/lib/auto-value-annotations-*.jar
src/main/webapp/WEB-INF/lib/bcpkix-jdk15on-*.jar
src/main/webapp/WEB-INF/lib/bcprov-jdk15on-*.jar
src/main/webapp/WEB-INF/lib/checker-qual-*.jar
src/main/webapp/WEB-INF/lib/conscrypt-openjdk-uber-*.jar
src/main/webapp/WEB-INF/lib/error_prone_annotations-*.jar
src/main/webapp/WEB-INF/lib/failureaccess-*.jar
src/main/webapp/WEB-INF/lib/gax-*.jar
src/main/webapp/WEB-INF/lib/gax-grpc-*.jar
src/main/webapp/WEB-INF/lib/google-auth-library-credentials-*.jar
src/main/webapp/WEB-INF/lib/google-auth-library-oauth2-http-*.jar
src/main/webapp/WEB-INF/lib/google-cloud-secretmanager-*.jar
src/main/webapp/WEB-INF/lib/google-http-client-*.jar
src/main/webapp/WEB-INF/lib/google-http-client-gson-*.jar
src/main/webapp/WEB-INF/lib/grpc-alts-*.jar
src/main/webapp/WEB-INF/lib/grpc-api-*.jar
src/main/webapp/WEB-INF/lib/grpc-auth-*.jar
src/main/webapp/WEB-INF/lib/grpc-context-*.jar
src/main/webapp/WEB-INF/lib/grpc-core-*.jar
src/main/webapp/WEB-INF/lib/grpc-grpclb-*.jar
src/main/webapp/WEB-INF/lib/grpc-netty-shaded-*.jar
src/main/webapp/WEB-INF/lib/grpc-protobuf-*.jar
src/main/webapp/WEB-INF/lib/grpc-protobuf-lite-*.jar
src/main/webapp/WEB-INF/lib/grpc-services-*.jar
src/main/webapp/WEB-INF/lib/grpc-stub-*.jar
src/main/webapp/WEB-INF/lib/grpc-xds-*.jar
src/main/webapp/WEB-INF/lib/guava-*-jre.jar
src/main/webapp/WEB-INF/lib/httpcore-*.jar
src/main/webapp/WEB-INF/lib/j2objc-annotations-*.jar
src/main/webapp/WEB-INF/lib/javax.annotation-api-*.jar
src/main/webapp/WEB-INF/lib/jsr305-*.jar
src/main/webapp/WEB-INF/lib/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
src/main/webapp/WEB-INF/lib/opencensus-api-*.jar
src/main/webapp/WEB-INF/lib/opencensus-contrib-http-util-*.jar
src/main/webapp/WEB-INF/lib/opencensus-proto-*.jar
src/main/webapp/WEB-INF/lib/perfmark-api-*.jar
src/main/webapp/WEB-INF/lib/proto-google-cloud-secretmanager-v1-*.jar
src/main/webapp/WEB-INF/lib/proto-google-cloud-secretmanager-v1beta1-*.jar
src/main/webapp/WEB-INF/lib/proto-google-common-protos-*.jar
src/main/webapp/WEB-INF/lib/proto-google-iam-v1-*.jar
src/main/webapp/WEB-INF/lib/protobuf-java-*.jar
src/main/webapp/WEB-INF/lib/protobuf-java-util-*.jar
src/main/webapp/WEB-INF/lib/re2j-*.jar
src/main/webapp/WEB-INF/lib/threetenbp-*.jar
.idea
src/main/webapp/js/app.min.js
src/main/webapp/js/extensions.min.js
src/main/webapp/js/orgchart.min.js
src/main/webapp/js/stencils.min.js
src/main/webapp/js/viewer-static.min.js
src/main/webapp/js/viewer.min.js
stages:
- build_and_push
- redeploy
build_and_push:
image: docker/compose:latest
stage: build_and_push
services:
- docker:dind
script:
- docker build -t fokus_ujmt . --tag 094360380/wp4-user-journey-modeling-tool:fe
- docker login docker.io -u "$DOCKER_REGISTRY_USER" -p "$DOCKER_REGISTRY_PASSWORD"
- docker push 094360380/wp4-user-journey-modeling-tool:fe
tags:
- docker
only:
- kubernetes
redeploy_at_k8s:
image: alpine/k8s:1.21.5
stage: redeploy
script:
- kubectl config set-cluster local --server="${K8S_SERVER}"
- kubectl config set clusters.local.certificate-authority-data "${K8S_CERTIFICATE_AUTHORITY_DATA}"
- kubectl config set-credentials local --token="${K8S_USER_TOKEN}"
- kubectl config set-context local --cluster=local --user=local
- kubectl config use-context local
- kubectl --insecure-skip-tls-verify version
- kubectl get deployments ujmt-fe -n ujmt-dev --insecure-skip-tls-verify
- kubectl rollout restart deployment ujmt-fe -n ujmt-dev --insecure-skip-tls-verify
tags:
- docker
only:
- kubernetes
when: manual
FROM openjdk:11-jdk-slim AS build
# modified by Fraunhofer FOKUS, taken and copied from
# https://github.com/jgraph/docker-drawio/blob/dev/main/Dockerfile
RUN apt-get update -y && \
# this solves some weird issue with openjdk-11-jdk-headless
# https://github.com/nextcloud/docker/issues/380
mkdir -p /usr/share/man/man1 && \
apt-get install -y \
ant \
git
# Fraunhofer FOKUS: do not clone the repo but build it from
# the sources within - a bit slower but cleaner
# creating all directories in a way we don't have to
# modify the Dockerfile at another place
RUN mkdir /tmp/drawio
WORKDIR /tmp/drawio
ADD . ./
RUN cd etc/build/ && \
ant war
# end of FOKUS modification
FROM tomcat:9-jre11-openjdk-slim
LABEL maintainer="JGraph Ltd"
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
certbot \
curl \
xmlstarlet \
unzip && \
apt-get autoremove -y --purge && \
apt-get clean && \
rm -r /var/lib/apt/lists/*
COPY --from=build /tmp/drawio/build/draw.war /tmp
# Extract draw.io war & Update server.xml to set Draw.io webapp to root
RUN mkdir -p $CATALINA_HOME/webapps/draw && \
unzip /tmp/draw.war -d $CATALINA_HOME/webapps/draw && \
rm -rf /tmp/draw.war /tmp/drawio && \
cd $CATALINA_HOME && \
xmlstarlet ed \
-P -S -L \
-i '/Server/Service/Engine/Host/Valve' -t 'elem' -n 'Context' \
-i '/Server/Service/Engine/Host/Context' -t 'attr' -n 'path' -v '/' \
-i '/Server/Service/Engine/Host/Context[@path="/"]' -t 'attr' -n 'docBase' -v 'draw' \
-s '/Server/Service/Engine/Host/Context[@path="/"]' -t 'elem' -n 'WatchedResource' -v 'WEB-INF/web.xml' \
conf/server.xml
# Copy docker-entrypoint
COPY docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
WORKDIR $CATALINA_HOME
EXPOSE 8080 8443
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["catalina.sh", "run"]
LICENSE 0 → 100644
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
# UJMT Frontend
This is the frontend of the User Journey Modeling Tool (UJMT).
[[_TOC_]]
## Purpose
1. model user journeys using service catalogue
2. send models to backend
## Technicalities
| thing | content |
|---|---|
| Contact | Anna Opaska, Ekkart Kleinod |
| Language | Javascript |
| Base | [diagrams.net](https://www.diagrams.net) (formally DrawIO), [github](https://github.com/jgraph/drawio) |
## CI/CD
### dockerhub
Repository
- <https://hub.docker.com/repository/docker/094360380/wp4-user-journey-modeling-tool>
Tags
- wp4-user-journey-modeling-tool:fe
- wp4-user-journey-modeling-tool:pr
- wp4-user-journey-modeling-tool:be
## Local testing
### Build image
~~~script
$ ./ujmt_build_image.sh
~~~
### Run UJMT
~~~script
$ ./ujmt_run.sh
~~~
UJMT should be running at:
<http://localhost:8080/?https=0&splash=0&p=ujmt>
### Stop UJMT
~~~script
$ ./ujmt_stop.sh
~~~
16.2.4
\ No newline at end of file
#!/bin/bash
#set -e
# modified by Fraunhofer FOKUS, taken and copied from
# https://github.com/jgraph/docker-drawio/blob/dev/main/docker-entrypoint.sh
# Fraunhofer FOKUS: set variables to our needs
# the use of the variables is changed in the code as well
# DRAWIO_CSP_HEADER sets generated header - for UJMT: added 127.0.0.1 https://*.cape-suite.eu
DRAWIO_CSP_HEADER=${DRAWIO_CSP_HEADER:-"default-src \'self\'; script-src \'self\' https://storage.googleapis.com https://apis.google.com https://docs.google.com https://code.jquery.com \'unsafe-inline\'; connect-src \'self\' 127.0.0.1 https://ujmt-pr-ujmt-dev.k8s.across-h2020.eu https://ujmt-be-ujmt-dev.k8s.across-h2020.eu https://*.draw.io https://*.cape-suite.eu https://*.dropboxapi.com https://api.trello.com https://api.github.com https://raw.githubusercontent.com https://*.googleapis.com https://*.googleusercontent.com https://graph.microsoft.com https://*.1drv.com https://*.sharepoint.com https://gitlab.com https://*.google.com https://fonts.gstatic.com https://fonts.googleapis.com; img-src * data:; media-src * data:; font-src * about:; style-src \'self\' \'unsafe-inline\' https://fonts.googleapis.com; frame-src \'self\' https://*.google.com;"}
#DRAWIO_BASE_URL is path to base of deployment - for UJMT: <host>/drawio
DRAWIO_BASE_URL=${DRAWIO_BASE_URL:-"https://ujmt-fe-ujmt-dev.k8s.across-h2020.eu"}
#DRAWIO_VIEWER_URL is path to the viewer js - for UJMT: <host>/drawio/js/viewer.min.js
DRAWIO_VIEWER_URL=${DRAWIO_VIEWER_URL:-"https://ujmt-fe-ujmt-dev.k8s.across-h2020.eu/js/viewer.min.js"}
#UJMT_SC_URL is path to the proxy - for UJMT: <host>/proxy
UJMT_SC_URL=${UJMT_SC_URL:-"https://ujmt-pr-ujmt-dev.k8s.across-h2020.eu"}
# UJMT_BACKEND_URL is path to the backend - for UJMT: <host>/ujmt-backend
UJMT_BACKEND_URL=${UJMT_BACKEND_URL:-"https://ujmt-be-ujmt-dev.k8s.across-h2020.eu"}
# end of variable changes
LETS_ENCRYPT_ENABLED=${LETS_ENCRYPT_ENABLED:-false}
PUBLIC_DNS=${PUBLIC_DNS:-'draw.example.com'}
ORGANISATION_UNIT=${ORGANISATION_UNIT:-'Cloud Native Application'}
ORGANISATION=${ORGANISATION:-'example inc'}
CITY=${CITY:-'Paris'}
STATE=${STATE:-'Paris'}
COUNTRY_CODE=${COUNTRY_CODE:-'FR'}
KEYSTORE_PASS=${KEYSTORE_PASS:-'V3ry1nS3cur3P4ssw0rd'}
KEY_PASS=${KEY_PASS:-$KEYSTORE_PASS}
echo "Init PreConfig.js"
#Add CSP to prevent calls to draw.io
echo "(function() {" > $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo " try {" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo " var s = document.createElement('meta');" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
# Fraunhofer FOKUS: one modified line
echo " s.setAttribute('content', '${DRAWIO_CSP_HEADER}');" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo " s.setAttribute('http-equiv', 'Content-Security-Policy');" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo " var t = document.getElementsByTagName('meta')[0];" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo " t.parentNode.insertBefore(s, t);" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo " } catch (e) {} // ignore" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo "})();" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
#Overrides of global vars need to be pre-loaded
if [[ "${DRAWIO_SELF_CONTAINED}" ]]; then
echo "window.EXPORT_URL = '/service/0'; //This points to ExportProxyServlet which uses the local export server at port 8000. This proxy configuration allows https requests to the export server via Tomcat." >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo "window.PLANT_URL = '/service/1';" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
fi
# Fraunhofer FOKUS: one modified line
echo "window.DRAWIO_BASE_URL = '${DRAWIO_BASE_URL}';" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo "window.DRAWIO_VIEWER_URL = '${DRAWIO_VIEWER_URL}';" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
# Fraunhofer FOKUS: two new lines
echo "window.UJMT_SC_URL = '${UJMT_SC_URL}';" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo "window.UJMT_BACKEND_URL = '${UJMT_BACKEND_URL}';" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo "window.DRAW_MATH_URL = 'math';" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
#Custom draw.io configurations. For more details, https://desk.draw.io/support/solutions/articles/16000058316
echo "window.DRAWIO_CONFIG = ${DRAWIO_CONFIG:-null};" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
#Real-time configuration
if [[ "${DRAWIO_IOT_ENDPOINT}" ]]; then
echo "urlParams['sync'] = 'auto'; //Enable Real-Time" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo "window.MXPUSHER_IOT_ENDPOINNT = '${DRAWIO_MXPUSHER_ENDPOINT}'; //Specifies the IoT endpoint" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo "window.DRAWIO_PUSHER_MODE = 2;" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
mkdir -p $CATALINA_HOME/webapps/draw/WEB-INF/aws_iot_auth
echo -n "${DRAWIO_IOT_CERT_PEM}" > $CATALINA_HOME/webapps/draw/WEB-INF/aws_iot_auth/mxPusherSrv.cert.pem
echo -n "${DRAWIO_IOT_PRIVATE_KEY}" > $CATALINA_HOME/webapps/draw/WEB-INF/aws_iot_auth/mxPusherSrv.private.key
echo -n "${DRAWIO_IOT_ROOT_CA}" > $CATALINA_HOME/webapps/draw/WEB-INF/aws_iot_auth/root-CA.crt
echo -n "${DRAWIO_IOT_ENDPOINT}" > $CATALINA_HOME/webapps/draw/WEB-INF/aws_iot_auth/endpoint_url
else
echo "urlParams['sync'] = 'manual'; //Disable Real-Time" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
fi
#Disable unsupported services
echo "urlParams['db'] = '0'; //dropbox" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo "urlParams['gh'] = '0'; //github" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo "urlParams['tr'] = '0'; //trello" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
#Google Drive
if [[ -z "${DRAWIO_GOOGLE_CLIENT_ID}" ]]; then
echo "urlParams['gapi'] = '0'; //Google Drive" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
else
#Google drive application id and client id for the editor
echo "window.DRAWIO_GOOGLE_APP_ID = '${DRAWIO_GOOGLE_APP_ID}'; " >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo "window.DRAWIO_GOOGLE_CLIENT_ID = '${DRAWIO_GOOGLE_CLIENT_ID}'; " >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo -n "${DRAWIO_GOOGLE_CLIENT_ID}" > $CATALINA_HOME/webapps/draw/WEB-INF/google_client_id
echo -n "${DRAWIO_GOOGLE_CLIENT_SECRET}" > $CATALINA_HOME/webapps/draw/WEB-INF/google_client_secret
#If you want to use the editor as a viewer also, you can create another app with read-only access. You can use the same info as above if write-access is not an issue.
if [[ "${DRAWIO_GOOGLE_VIEWER_CLIENT_ID}" ]]; then
echo "window.DRAWIO_GOOGLE_VIEWER_APP_ID = '${DRAWIO_GOOGLE_VIEWER_APP_ID}'; " >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo "window.DRAWIO_GOOGLE_VIEWER_CLIENT_ID = '${DRAWIO_GOOGLE_VIEWER_CLIENT_ID}'; " >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo -n "/:::/${DRAWIO_GOOGLE_VIEWER_CLIENT_ID}" >> $CATALINA_HOME/webapps/draw/WEB-INF/google_client_id
echo -n "/:::/${DRAWIO_GOOGLE_VIEWER_CLIENT_SECRET}" >> $CATALINA_HOME/webapps/draw/WEB-INF/google_client_secret
fi
fi
#Microsoft OneDrive
if [[ -z "${DRAWIO_MSGRAPH_CLIENT_ID}" ]]; then
echo "urlParams['od'] = '0'; //OneDrive" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
else
#Google drive application id and client id for the editor
echo "window.DRAWIO_MSGRAPH_CLIENT_ID = '${DRAWIO_MSGRAPH_CLIENT_ID}'; " >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo -n "${DRAWIO_MSGRAPH_CLIENT_ID}" > $CATALINA_HOME/webapps/draw/WEB-INF/msgraph_client_id
echo -n "${DRAWIO_MSGRAPH_CLIENT_SECRET}" > $CATALINA_HOME/webapps/draw/WEB-INF/msgraph_client_secret
fi
#Gitlab
if [[ -z "${DRAWIO_GITLAB_ID}" ]]; then
echo "urlParams['gl'] = '0'; //Gitlab" >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
else
#Gitlab url and id for the editor
echo "window.DRAWIO_GITLAB_URL = '${DRAWIO_GITLAB_URL}'; " >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo "window.DRAWIO_GITLAB_ID = '${DRAWIO_GITLAB_ID}'; " >> $CATALINA_HOME/webapps/draw/js/PreConfig.js
#Gitlab server flow auth (since 14.6.7)
echo -n "${DRAWIO_GITLAB_URL}/oauth/token" > $CATALINA_HOME/webapps/draw/WEB-INF/gitlab_auth_url
echo -n "${DRAWIO_GITLAB_ID}" > $CATALINA_HOME/webapps/draw/WEB-INF/gitlab_client_id
echo -n "${DRAWIO_GITLAB_SECRET}" > $CATALINA_HOME/webapps/draw/WEB-INF/gitlab_client_secret
fi
cat $CATALINA_HOME/webapps/draw/js/PreConfig.js
echo "Init PostConfig.js"
#null'ing of global vars need to be after init.js
echo "window.VSD_CONVERT_URL = null;" > $CATALINA_HOME/webapps/draw/js/PostConfig.js
echo "window.ICONSEARCH_PATH = null;" >> $CATALINA_HOME/webapps/draw/js/PostConfig.js
echo "EditorUi.enableLogging = false; //Disable logging" >> $CATALINA_HOME/webapps/draw/js/PostConfig.js
#This requires subscription with cloudconvert.com
if [[ -z "${DRAWIO_CLOUD_CONVERT_APIKEY}" ]]; then
echo "window.EMF_CONVERT_URL = null;" >> $CATALINA_HOME/webapps/draw/js/PostConfig.js
else
echo "window.EMF_CONVERT_URL = '/convert';" >> $CATALINA_HOME/webapps/draw/js/PostConfig.js
echo -n "${DRAWIO_CLOUD_CONVERT_APIKEY}" > $CATALINA_HOME/webapps/draw/WEB-INF/cloud_convert_api_key
fi
if [[ "${DRAWIO_SELF_CONTAINED}" ]]; then
echo "EditorUi.enablePlantUml = true; //Enables PlantUML" >> $CATALINA_HOME/webapps/draw/js/PostConfig.js
fi
#Treat this domain as a draw.io domain
echo "App.prototype.isDriveDomain = function() { return true; }" >> $CATALINA_HOME/webapps/draw/js/PostConfig.js
cat $CATALINA_HOME/webapps/draw/js/PostConfig.js
if ! [ -f $CATALINA_HOME/.keystore ] && [ "$LETS_ENCRYPT_ENABLED" == "true" ]; then
echo "Generating Let's Encrypt certificate"
keytool -genkey -noprompt -alias tomcat -dname "CN=${PUBLIC_DNS}, OU=${ORGANISATION_UNIT}, O=${ORGANISATION}, L=${CITY}, S=${STATE}, C=${COUNTRY_CODE}" -keystore $CATALINA_HOME/.keystore -storepass "${KEYSTORE_PASS}" -KeySize 2048 -keypass "${KEY_PASS}" -keyalg RSA -storetype pkcs12
keytool -list -keystore $CATALINA_HOME/.keystore -v -storepass "${KEYSTORE_PASS}"
keytool -certreq -alias tomcat -file request.csr -keystore $CATALINA_HOME/.keystore -storepass "${KEYSTORE_PASS}"
certbot certonly --csr $CATALINA_HOME/request.csr --standalone --register-unsafely-without-email --agree-tos
keytool -import -trustcacerts -alias tomcat -file 0001_chain.pem -keystore $CATALINA_HOME/.keystore -storepass "${KEYSTORE_PASS}"
fi
if ! [ -f $CATALINA_HOME/.keystore ] && [ "$LETS_ENCRYPT_ENABLED" == "false" ]; then
echo "Generating Self-Signed certificate"
keytool -genkey -noprompt -alias selfsigned -dname "CN=${PUBLIC_DNS}, OU=${ORGANISATION_UNIT}, O=${ORGANISATION}, L=${CITY}, S=${STATE}, C=${COUNTRY_CODE}" -keystore $CATALINA_HOME/.keystore -storepass "${KEYSTORE_PASS}" -KeySize 2048 -keypass "${KEY_PASS}" -keyalg RSA -validity 3600 -storetype pkcs12
keytool -list -keystore $CATALINA_HOME/.keystore -v -storepass "${KEYSTORE_PASS}"
fi
# Update SSL port configuration if it does'nt exists
#
UUID="$(cat /dev/urandom | tr -dc 'a-zA-Z' | fold -w 1 | head -n 1)$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 7 | head -n 1)"
VAR=$(cat conf/server.xml | grep "$CATALINA_HOME/.keystore")
if [ -f $CATALINA_HOME/.keystore ] && [ -z $VAR ]; then
echo "Append https connector to server.xml"
xmlstarlet ed \
-P -S -L \
-s '/Server/Service' -t 'elem' -n "${UUID}" \
-i "/Server/Service/${UUID}" -t 'attr' -n 'port' -v '8443' \
-i "/Server/Service/${UUID}" -t 'attr' -n 'protocol' -v 'org.apache.coyote.http11.Http11NioProtocol' \
-i "/Server/Service/${UUID}" -t 'attr' -n 'SSLEnabled' -v 'true' \
-i "/Server/Service/${UUID}" -t 'attr' -n 'maxThreads' -v '150' \
-i "/Server/Service/${UUID}" -t 'attr' -n 'scheme' -v 'https' \
-i "/Server/Service/${UUID}" -t 'attr' -n 'secure' -v 'true' \
-i "/Server/Service/${UUID}" -t 'attr' -n 'clientAuth' -v 'false' \
-i "/Server/Service/${UUID}" -t 'attr' -n 'sslProtocol' -v 'TLS' \
-i "/Server/Service/${UUID}" -t 'attr' -n 'KeystoreFile' -v "$CATALINA_HOME/.keystore" \
-i "/Server/Service/${UUID}" -t 'attr' -n 'KeystorePass' -v "${KEY_PASS}" \
-i "/Server/Service/${UUID}" -t 'attr' -n 'defaultSSLHostConfigName' -v "${PUBLIC_DNS:-'draw.example.com'}" \
-s "/Server/Service/${UUID}" -t 'elem' -n 'SSLHostConfig' \
-i "/Server/Service/${UUID}/SSLHostConfig" -t 'attr' -n 'hostName' -v "${PUBLIC_DNS:-'draw.example.com'}" \
-i "/Server/Service/${UUID}/SSLHostConfig" -t 'attr' -n 'protocols' -v 'TLSv1.2' \
-s "/Server/Service/${UUID}/SSLHostConfig" -t 'elem' -n 'Certificate' \
-i "/Server/Service/${UUID}/SSLHostConfig/Certificate" -t 'attr' -n 'certificateKeystoreFile' -v "$CATALINA_HOME/.keystore" \
-i "/Server/Service/${UUID}/SSLHostConfig/Certificate" -t 'attr' -n 'certificateKeystorePassword' -v "${KEY_PASS}" \
-r "/Server/Service/${UUID}" -v 'Connector' \
conf/server.xml
fi
exec "$@"
File added
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.zip.Deflater;
public class Xml2Js
{
/**
*
*/
protected static final int IO_BUFFER_SIZE = 4 * 1024;
/**
*
*/
public static String CHARSET_FOR_URL_ENCODING = "UTF-8";
/**
*
* @param path
* @return
*/
public List<String> walk(File base, File root) throws IOException
{
if (root == null)
{
root = base;
}
List<String> result = new LinkedList<String>();
String basePath = base.getCanonicalPath();
File[] list = root.listFiles();
if (list != null)
{
for (File f : list)
{
if (f.isDirectory())
{
result.addAll(walk(base, f));
}
else if (f.getCanonicalPath().toLowerCase().endsWith(".xml"))
{
String name = f.getCanonicalPath()
.substring(basePath.length() + 1);
result.add(
"f['" + name + "'] = '" + processFile(f) + "';\n");
}
}
}
return result;
}
/**
*
* @param file
* @return
* @throws IOException
*/
public static String processFile(File file) throws IOException
{
System.out.println("Processing " + file.getCanonicalPath() + "...");
Deflater deflater = new Deflater(Deflater.DEFAULT_COMPRESSION, true);
byte[] inBytes = encodeURIComponent(
readInputStream(new FileInputStream(file)),
CHARSET_FOR_URL_ENCODING).getBytes("UTF-8");
deflater.setInput(inBytes);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(
inBytes.length);
deflater.finish();
byte[] buffer = new byte[IO_BUFFER_SIZE];
while (!deflater.finished())
{
int count = deflater.deflate(buffer); // returns the generated code... index
outputStream.write(buffer, 0, count);
}
outputStream.close();
return encodeToString(outputStream.toByteArray(), false);
}
/**
*
* @param stream
* @return
* @throws IOException
*/
public static String readInputStream(InputStream stream) throws IOException
{
BufferedReader reader = new BufferedReader(
new InputStreamReader(stream));
StringBuffer result = new StringBuffer();
String tmp = reader.readLine();
while (tmp != null)
{
result.append(tmp.trim());
tmp = reader.readLine();
}
reader.close();
return result.toString();
}
public static String encodeURIComponent(String s, String charset)
{
if (s == null)
{
return null;
}
else
{
String result;
try
{
result = URLEncoder.encode(s, charset).replaceAll("\\+", "%20")
.replaceAll("\\%21", "!").replaceAll("\\%27", "'")
.replaceAll("\\%28", "(").replaceAll("\\%29", ")")
.replaceAll("\\%7E", "~");
}
catch (UnsupportedEncodingException e)
{
// This exception should never occur
result = s;
}
return result;
}
}
private static final char[] CA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
.toCharArray();
private static final int[] IA = new int[256];
static
{
Arrays.fill(IA, -1);
for (int i = 0, iS = CA.length; i < iS; i++)
IA[CA[i]] = i;
IA['='] = 0;
}
// ****************************************************************************************
// * char[] version
// ****************************************************************************************
/** Encodes a raw byte array into a BASE64 <code>char[]</code> representation i accordance with RFC 2045.
* @param sArr The bytes to convert. If <code>null</code> or length 0 an empty array will be returned.
* @param lineSep Optional "\r\n" after 76 characters, unless end of file.<br>
* No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a
* little faster.
* @return A BASE64 encoded array. Never <code>null</code>.
*/
public final static char[] encodeToChar(byte[] sArr, boolean lineSep)
{
// Check special case
int sLen = sArr != null ? sArr.length : 0;
if (sLen == 0)
return new char[0];
int eLen = (sLen / 3) * 3; // Length of even 24-bits.
int cCnt = ((sLen - 1) / 3 + 1) << 2; // Returned character count
int dLen = cCnt + (lineSep ? (cCnt - 1) / 76 << 1 : 0); // Length of returned array
char[] dArr = new char[dLen];
// Encode even 24-bits
for (int s = 0, d = 0, cc = 0; s < eLen;)
{
// Copy next three bytes into lower 24 bits of int, paying attension to sign.
int i = (sArr[s++] & 0xff) << 16 | (sArr[s++] & 0xff) << 8
| (sArr[s++] & 0xff);
// Encode the int into four chars
dArr[d++] = CA[(i >>> 18) & 0x3f];
dArr[d++] = CA[(i >>> 12) & 0x3f];
dArr[d++] = CA[(i >>> 6) & 0x3f];
dArr[d++] = CA[i & 0x3f];
// Add optional line separator
if (lineSep && ++cc == 19 && d < dLen - 2)
{
dArr[d++] = '\r';
dArr[d++] = '\n';
cc = 0;
}
}
// Pad and encode last bits if source isn't even 24 bits.
int left = sLen - eLen; // 0 - 2.
if (left > 0)
{
// Prepare the int
int i = ((sArr[eLen] & 0xff) << 10)
| (left == 2 ? ((sArr[sLen - 1] & 0xff) << 2) : 0);
// Set last four chars
dArr[dLen - 4] = CA[i >> 12];
dArr[dLen - 3] = CA[(i >>> 6) & 0x3f];
dArr[dLen - 2] = left == 2 ? CA[i & 0x3f] : '=';
dArr[dLen - 1] = '=';
}
return dArr;
}
// ****************************************************************************************
// * String version
// ****************************************************************************************
/** Encodes a raw byte array into a BASE64 <code>String</code> representation i accordance with RFC 2045.
* @param sArr The bytes to convert. If <code>null</code> or length 0 an empty array will be returned.
* @param lineSep Optional "\r\n" after 76 characters, unless end of file.<br>
* No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a
* little faster.
* @return A BASE64 encoded array. Never <code>null</code>.
*/
public final static String encodeToString(byte[] sArr, boolean lineSep)
{
// Reuse char[] since we can't create a String incrementally anyway and StringBuffer/Builder would be slower.
return new String(encodeToChar(sArr, lineSep));
}
/**
* Main
*/
public static void main(String[] args)
{
if (args.length < 2)
{
System.out.println("Usage: xml2js path file");
}
else
{
try
{
Xml2Js fw = new Xml2Js();
// Generates result
StringBuffer result = new StringBuffer();
result.append("(function() {\nvar f = {};\n");
List<String> files = fw
.walk(new File(new File(".").getCanonicalPath()
+ File.separator + args[0]), null);
Iterator<String> it = files.iterator();
while (it.hasNext())
{
result.append(it.next());
}
result.append("\n");
result.append("var l = mxStencilRegistry.loadStencil;\n\n");
result.append(
"mxStencilRegistry.loadStencil = function(filename, fn)\n{\n");
result.append(" var t = f[filename.substring(STENCIL_PATH.length + 1)];\n");
result.append(" var s = null;\n");
result.append(" if (t != null) {\n");
result.append(" t = pako.inflateRaw(Uint8Array.from(atob(t), function (c) {\n");
result.append(" return c.charCodeAt(0);\n");
result.append(" }), {to: 'string'});\n");
result.append(" s = decodeURIComponent(t);\n");
result.append(" }\n");
result.append(" if (fn != null && s != null) {\n");
result.append(
" window.setTimeout(function(){fn(mxUtils.parseXml(s))}, 0);\n");
result.append(" } else {\n");
result.append(
" return (s != null) ? mxUtils.parseXml(s) : l.apply(this, arguments)\n");
result.append(" }\n");
result.append("};\n");
result.append("})();\n");
FileWriter writer = new FileWriter(
new File(new File(".").getCanonicalPath()
+ File.separator + args[1]));
writer.write(result.toString());
writer.flush();
writer.close();
}
catch (IOException ex)
{
ex.printStackTrace();
}
}
}
}
jscompiler=${basedir}/compiler.jar
src.dir=${basedir}/../../src/main/java
war.dir=${basedir}/../../src/main/webapp
grapheditor.dir=${war.dir}/js/grapheditor
javac.dir=${war.dir}/WEB-INF/classes
build.dir=${basedir}/../../build
war.name=draw.war
<?xml version="1.0"?>
<project basedir="." default="all">
<property file="build.properties.local" />
<property file="build.properties" />
<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask" classpath="${jscompiler}" />
<target name="merge">
<concat destfile="${basedir}/../../build/shapes.js" fixlastline="yes" append="no">
<fileset dir="${war.dir}/shapes" includes="**/*.js"/>
<fileset dir="${war.dir}/stencils" includes="**/*.js"/>
</concat>
<java fork="false" classname="Xml2Js" classpath=".">
<arg value="../../src/main/webapp/stencils"/>
<arg value="../../src/main/webapp/js/stencils.min.js"/>
</java>
<jscomp compilationLevel="simple" debug="false" forceRecompile="true" output="${war.dir}/js/shapes-14-6-5.min.js">
<sources dir="${basedir}/../../build">
<file name="shapes.js" />
</sources>
</jscomp>
<tstamp>
<format property="time.stamp" pattern="MM/dd/yyyy hh:mm aa" unit="hour"/>
</tstamp>
<delete dir="${basedir}/../../build"/>
</target>
<target name="app" depends="merge">
<delete file="${basedir}/.tmp0.js"/>
<echo file="${basedir}/.tmp0.js">
window.PROXY_URL = window.PROXY_URL || 'https://viewer.diagrams.net/proxy';
window.SHAPES_PATH = window.SHAPES_PATH || 'https://viewer.diagrams.net/shapes';
window.STENCIL_PATH = window.STENCIL_PATH || 'https://viewer.diagrams.net/stencils';
window.GRAPH_IMAGE_PATH = window.GRAPH_IMAGE_PATH || 'https://viewer.diagrams.net/img';
window.mxImageBasePath = window.mxImageBasePath || 'https://viewer.diagrams.net/mxgraph/images';
window.mxBasePath = window.mxBasePath || 'https://viewer.diagrams.net/mxgraph/';
window.mxLoadStylesheets = window.mxLoadStylesheets || false;
</echo>
<delete file="${basedir}/.tmp1.js"/>
<copy file="${war.dir}/styles/default.xml" tofile="${basedir}/.tmp1.xml" overwrite="true"/>
<replaceregexp file="${basedir}/.tmp1.xml" match="${line.separator}" flags="g" replace=""/>
<replaceregexp file="${basedir}/.tmp1.xml" match="\t" flags="g" replace=""/>
<replaceregexp file="${basedir}/.tmp1.xml" match="'" flags="g" replace="\\\\'" byline="true"/>
<delete file="${basedir}/Graph-Stylesheet.js"/>
<echo file="${basedir}/Graph-Stylesheet.js">Graph.prototype.defaultThemes['default-style2'] = mxUtils.parseXml(`</echo>
<concat destfile="${basedir}/Graph-Stylesheet.js" fixlastline="no" append="true">
<filelist dir="${basedir}" files=".tmp1.xml"/>
</concat>
<echo file="${basedir}/Graph-Stylesheet.js" append="true">`).documentElement;</echo>
<echo file="${basedir}/Graph-Stylesheet.js" append="true">Graph.prototype.defaultThemes['darkTheme'] = Graph.prototype.defaultThemes['default-style2'];</echo>
<delete file="${basedir}/.tmp2.xml"/>
<copy file="${war.dir}/resources/dia.txt" tofile="${basedir}/.tmp2.xml" overwrite="true"/>
<replaceregexp file="${basedir}/.tmp2.xml" match="${line.separator}" flags="g" replace="\\\\n"/>
<replaceregexp file="${basedir}/.tmp2.xml" match="'" flags="g" replace="\\\\'" byline="true"/>
<delete file="${basedir}/Graph-Resources.js"/>
<echo file="${basedir}/Graph-Resources.js">mxResources.parse(`</echo>
<concat destfile="${basedir}/Graph-Resources.js" fixlastline="no" append="true">
<filelist dir="${basedir}" files=".tmp2.xml"/>
</concat>
<echo file="${basedir}/Graph-Resources.js" append="true">`);</echo>
<jscomp compilationLevel="simple" forceRecompile="true" debug="false" output="${basedir}/grapheditor.min.js">
<sources dir="${grapheditor.dir}">
<file name="Editor.js" />
<file name="EditorUi.js" />
<file name="Sidebar.js" />
<file name="Graph.js" />
<file name="Format.js" />
<file name="Shapes.js" />
<file name="Actions.js" />
<file name="Menus.js" />
<file name="Toolbar.js" />
<file name="Dialogs.js" />
</sources>
</jscomp>
<jscomp compilationLevel="simple" debug="false" forceRecompile="true" output="${basedir}/sidebar.min.js">
<sources dir="${war.dir}/js/diagramly/sidebar">
<file name="Sidebar.js" />
<file name="Sidebar-ActiveDirectory.js" />
<file name="Sidebar-Advanced.js" />
<file name="Sidebar-AlliedTelesis.js" />
<file name="Sidebar-Android.js" />
<file name="Sidebar-ArchiMate.js" />
<file name="Sidebar-ArchiMate3.js" />
<file name="Sidebar-Arrows2.js" />
<file name="Sidebar-Atlassian.js" />
<file name="Sidebar-AWS.js" />
<file name="Sidebar-AWS3.js" />
<file name="Sidebar-AWS3D.js" />
<file name="Sidebar-AWS4.js" />
<file name="Sidebar-AWS4b.js" />
<file name="Sidebar-Azure.js" />
<file name="Sidebar-Azure2.js" />
<file name="Sidebar-Basic.js" />
<file name="Sidebar-Bootstrap.js" />
<file name="Sidebar-BPMN.js" />
<file name="Sidebar-C4.js" />
<file name="Sidebar-Cabinet.js" />
<file name="Sidebar-Cisco.js" />
<file name="Sidebar-Cisco19.js" />
<file name="Sidebar-CiscoSafe.js" />
<file name="Sidebar-Citrix.js" />
<file name="Sidebar-Cumulus.js" />
<file name="Sidebar-DFD.js" />
<file name="Sidebar-EIP.js" />
<file name="Sidebar-Electrical.js" />
<file name="Sidebar-ER.js" />
<file name="Sidebar-Floorplan.js" />
<file name="Sidebar-Flowchart.js" />
<file name="Sidebar-FluidPower.js" />
<file name="Sidebar-GCP.js" />
<file name="Sidebar-GCP2.js" />
<file name="Sidebar-GCPIcons.js" />
<file name="Sidebar-Gmdl.js" />
<file name="Sidebar-IBM.js" />
<file name="Sidebar-Infographic.js" />
<file name="Sidebar-Ios.js" />
<file name="Sidebar-Ios7.js" />
<file name="Sidebar-Kubernetes.js" />
<file name="Sidebar-LeanMapping.js" />
<file name="Sidebar-Mockup.js" />
<file name="Sidebar-MSCAE.js" />
<file name="Sidebar-Network.js" />
<file name="Sidebar-Office.js" />
<file name="Sidebar-PID.js" />
<file name="Sidebar-Rack.js" />
<file name="Sidebar-Signs.js" />
<file name="Sidebar-Sitemap.js" />
<file name="Sidebar-Sysml.js" />
<file name="Sidebar-ThreatModeling.js" />
<file name="Sidebar-UML25.js" />
<file name="Sidebar-Veeam.js" />
<file name="Sidebar-Veeam2.js" />
<file name="Sidebar-VVD.js" />
<file name="Sidebar-WebIcons.js" />
</sources>
</jscomp>
<jscomp compilationLevel="simple" debug="false" forceRecompile="true" output="${basedir}/client.min.js">
<sources dir="${war.dir}/js/deflate">
<file name="base64.js" />
</sources>
<sources dir="${war.dir}/js/diagramly">
<file name="Init.js" />
</sources>
<sources dir="${grapheditor.dir}">
<file name="Init.js" />
</sources>
<sources dir="${war.dir}/mxgraph">
<file name="mxClient.js" />
</sources>
<sources dir="${war.dir}/js/jscolor">
<file name="jscolor.js" />
</sources>
</jscomp>
<jscomp compilationLevel="simple" forceRecompile="true" debug="false" output="${basedir}/.tmp0.min.js">
<sources dir="${basedir}">
<file name=".tmp0.js"/>
</sources>
</jscomp>
<jscomp compilationLevel="simple" forceRecompile="true" debug="false" output="${basedir}/.tmp1.js">
<sources dir="${grapheditor.dir}">
<file name="Editor.js" />
<file name="EditorUi.js" />
<file name="Graph.js" />
<file name="Shapes.js" />
<file name="Actions.js" />
</sources>
<sources dir="${war.dir}/js/diagramly">
<file name="DrawioFile.js" />
<file name="LocalFile.js" />
<file name="Editor.js" />
<file name="EditorUi.js" />
<file name="Pages.js" />
<file name="Trees.js" />
<file name="Minimal.js" />
<file name="DrawioComment.js" />
<file name="DrawioUser.js" />
</sources>
<sources dir="${basedir}">
<file name="Graph-Resources.js" />
<file name="Graph-Stylesheet.js" />
</sources>
<sources dir="${war.dir}/js/diagramly">
<file name="GraphViewer.js" />
</sources>
</jscomp>
<concat destfile="${basedir}/base-viewer.min.js" fixlastline="yes" append="no">
<filelist dir="${basedir}" files=".tmp0.min.js"/>
<filelist dir="${war.dir}/js/spin" files="spin.min.js"/>
<filelist dir="${war.dir}/js/sanitizer" files="sanitizer.min.js"/>
<filelist dir="${war.dir}/js/deflate" files="pako.min.js"/>
<filelist dir="${war.dir}/js/rough" files="rough.min.js"/>
<filelist dir="${basedir}" files="client.min.js,.tmp1.js"/>
</concat>
<loadfile property="version" srcFile="../../VERSION"/>
<replace file="${basedir}/base-viewer.min.js" token="@DRAWIO-VERSION@" value="${version}"/>
<echo file="${basedir}/.tmp2.js">
(function()
{
Editor.initMath();
GraphViewer.initCss();
if (window.onDrawioViewerLoad != null)
{
window.onDrawioViewerLoad();
}
else
{
GraphViewer.processElements();
}
})();
</echo>
<jscomp compilationLevel="simple" forceRecompile="true" debug="false" output="${basedir}/.tmp2.min.js">
<sources dir="${basedir}">
<file name=".tmp2.js"/>
</sources>
</jscomp>
<concat destfile="${war.dir}/js/viewer.min.js" fixlastline="yes" append="no">
<filelist dir="${basedir}" files="base-viewer.min.js,.tmp2.min.js"/>
</concat>
<!-- Disables eval for JS (uses shapes-14-6-5.min.js) and registers PWA -->
<echo file="${basedir}/.tmp3.js">
mxStencilRegistry.allowEval = false;
(function()
{
try
{
if (Editor.enableServiceWorker)
{
navigator.serviceWorker.register('/service-worker.js');
}
}
catch (e)
{
if (window.console != null)
{
console.error(e);
}
}
})();
</echo>
<concat destfile="${war.dir}/js/viewer-static.min.js" fixlastline="yes" append="no">
<filelist dir="${basedir}" files="base-viewer.min.js"/>
<filelist dir="${war.dir}/js" files="shapes-14-6-5.min.js"/>
<filelist dir="${basedir}" files=".tmp3.js,.tmp2.min.js"/>
</concat>
<delete file="${war.dir}/js/extensions.min.js"/>
<delete file="${basedir}/.tmp0.js"/>
<delete file="${basedir}/.tmp0.min.js"/>
<delete file="${basedir}/.tmp1.js"/>
<delete file="${basedir}/.tmp2.js"/>
<delete file="${basedir}/.tmp2.min.js"/>
<delete file="${basedir}/.tmp3.js"/>
<delete file="${basedir}/.tmp1.xml"/>
<delete file="${basedir}/.tmp2.xml"/>
<jscomp compilationLevel="simple" debug="false" forceRecompile="true" output="${basedir}/.tmp1.js">
<sources dir="${war.dir}/js/diagramly">
<file name="DrawioFile.js" />
<file name="LocalFile.js" />
<file name="LocalLibrary.js" />
<file name="StorageFile.js" />
<file name="StorageLibrary.js" />
<file name="RemoteFile.js" />
<file name="RemoteLibrary.js" />
<file name="UrlLibrary.js" />
<file name="EmbedFile.js" />
<file name="Dialogs.js" />
<file name="Editor.js" />
<file name="EditorUi.js" />
<file name="DiffSync.js" />
<file name="Settings.js" />
<file name="DrawioFileSync.js" />
<file name="App.js" />
<file name="Menus.js" />
<file name="Pages.js" />
<file name="Trees.js" />
<file name="Minimal.js" />
<file name="DistanceGuides.js" />
<file name="mxRuler.js" />
<file name="mxFreehand.js" />
<file name="DrawioUser.js" />
<file name="DrawioComment.js" />
</sources>
<sources dir="${basedir}">
<file name="Graph-Stylesheet.js" />
</sources>
</jscomp>
<concat destfile="${basedir}/base.min.js" fixlastline="yes" append="no">
<filelist dir="${war.dir}/js/spin" files="spin.min.js"/>
<filelist dir="${war.dir}/js/sanitizer" files="sanitizer.min.js"/>
<filelist dir="${war.dir}/js/cryptojs" files="aes.min.js"/>
<filelist dir="${war.dir}/js/deflate" files="pako.min.js"/>
<filelist dir="${war.dir}/js/croppie" files="croppie.min.js"/>
<filelist dir="${war.dir}/js/rough" files="rough.min.js"/>
<filelist dir="${basedir}" files="client.min.js,grapheditor.min.js,sidebar.min.js,.tmp1.js"/>
</concat>
<replace file="${basedir}/base.min.js" token="@DRAWIO-VERSION@" value="${version}"/>
<jscomp compilationLevel="simple" debug="false" forceRecompile="true" output="${war.dir}/js/extensions.min.js">
<sources dir="${war.dir}/js/diagramly">
<file name="Extensions.js" />
</sources>
<sources dir="${war.dir}/js/diagramly/vsdx">
<file name="VsdxExport.js" />
<file name="mxVsdxCanvas2D.js" />
<file name="bmpDecoder.js" />
<file name="importer.js" />
</sources>
<sources dir="${war.dir}/js/diagramly/graphml">
<file name="mxGraphMlCodec.js" />
</sources>
</jscomp>
<delete file="${war.dir}/js/orgchart.min.js"/>
<concat destfile="${war.dir}/js/orgchart.min.js" fixlastline="yes" append="no">
<filelist dir="${war.dir}/js/orgchart" files="bridge.min.js,bridge.collections.min.js,OrgChart.Layout.min.js"/>
</concat>
<jscomp compilationLevel="simple" debug="false" forceRecompile="true" output="${basedir}/.tmp3.js">
<sources dir="${war.dir}/js/orgchart">
<file name="mxOrgChartLayout.js" />
</sources>
</jscomp>
<concat destfile="${war.dir}/js/orgchart.min.js" fixlastline="yes" append="yes">
<filelist dir="${basedir}" files=".tmp3.js"/>
</concat>
<delete file="${basedir}/.tmp3.js"/>
<concat destfile="${war.dir}/js/extensions.min.js" fixlastline="yes" append="yes">
<fileset file="${war.dir}/js/jszip/jszip.min.js"/>
<fileset file="${war.dir}/js/mermaid/mermaid.min.js"/>
<fileset file="${war.dir}/js/orgchart.min.js"/>
</concat>
<delete file="${basedir}/.tmp1.js"/>
<jscomp compilationLevel="simple" debug="false" forceRecompile="true" output="${basedir}/.tmp1.js">
<sources dir="${war.dir}/js/diagramly">
<file name="DrawioFile.js" />
<file name="LocalFile.js" />
<file name="LocalLibrary.js" />
<file name="StorageFile.js" />
<file name="StorageLibrary.js" />
<file name="RemoteFile.js" />
<file name="RemoteLibrary.js" />
<file name="UrlLibrary.js" />
<file name="EmbedFile.js" />
<file name="Dialogs.js" />
<file name="Editor.js" />
<file name="EditorUi.js" />
<file name="DiffSync.js" />
<file name="Settings.js" />
<file name="DrawioFileSync.js" />
</sources>
<sources dir="${basedir}">
<file name="Graph-Stylesheet.js" />
</sources>
<sources dir="${war.dir}/js/diagramly/util">
<file name="mxAsyncCanvas.js" />
<file name="mxJsCanvas.js" />
</sources>
<sources dir="${war.dir}/js/diagramly">
<file name="DrawioClient.js" />
<file name="DrawioUser.js" />
<file name="DriveFile.js" />
<file name="DriveLibrary.js" />
<file name="DriveClient.js" />
<file name="DropboxFile.js" />
<file name="DropboxLibrary.js" />
<file name="DropboxClient.js" />
<file name="OneDriveFile.js" />
<file name="OneDriveLibrary.js" />
<file name="OneDriveClient.js" />
<file name="GitHubFile.js" />
<file name="GitHubLibrary.js" />
<file name="GitHubClient.js" />
<file name="TrelloFile.js" />
<file name="TrelloLibrary.js" />
<file name="TrelloClient.js" />
<file name="GitLabFile.js" />
<file name="GitLabLibrary.js" />
<file name="GitLabClient.js" />
<file name="NotionFile.js" />
<file name="NotionLibrary.js" />
<file name="NotionClient.js" />
<file name="DrawioComment.js" />
<file name="DriveComment.js" />
</sources>
<sources dir="${war.dir}/js/onedrive">
<file name="mxODPicker.js" />
</sources>
<sources dir="${war.dir}/js/diagramly">
<file name="App.js" />
<file name="Menus.js" />
<file name="Pages.js" />
<file name="Trees.js" />
<file name="Minimal.js" />
<file name="DistanceGuides.js" />
<file name="mxRuler.js" />
<file name="mxFreehand.js" />
</sources>
</jscomp>
<concat destfile="${war.dir}/js/app.min.js" fixlastline="yes" append="no">
<filelist dir="${war.dir}/js/spin" files="spin.min.js"/>
<filelist dir="${war.dir}/js/sanitizer" files="sanitizer.min.js"/>
<filelist dir="${war.dir}/js/cryptojs" files="aes.min.js"/>
<filelist dir="${war.dir}/js/deflate" files="pako.min.js"/>
<filelist dir="${war.dir}/js/croppie" files="croppie.min.js"/>
<filelist dir="${war.dir}/js/rough" files="rough.min.js"/>
<filelist dir="${basedir}" files="client.min.js,grapheditor.min.js,sidebar.min.js,.tmp1.js"/>
</concat>
<replace file="${war.dir}/js/app.min.js" token="@DRAWIO-VERSION@" value="${version}"/>
<delete file="${basedir}/Graph-Stylesheet.js"/>
<delete file="${basedir}/Graph-Resources.js"/>
<delete file="${basedir}/grapheditor.min.js"/>
<delete file="${basedir}/sidebar.min.js"/>
<delete file="${basedir}/client.min.js"/>
<delete file="${basedir}/.tmp1.js"/>
</target>
<target name="all" depends="app">
</target>
<!-- ================== Stand-alone war creation ============================= -->
<path id="javac.class.path">
<fileset dir="${war.dir}/WEB-INF/lib" />
</path>
<target name="javac" description="Java compilation">
<mkdir dir="${javac.dir}"/>
<javac includeantruntime="false" srcdir="${src.dir}" excludes="**/EmbedServlet2.java" destdir="${javac.dir}">
<classpath refid="javac.class.path" />
</javac>
<copy todir="${javac.dir}" file="${src.dir}/log4j.properties" />
</target>
<target name="clean" description="Cleans build directories">
<delete dir="${javac.dir}"/>
<delete dir="${build.dir}"/>
<delete file="${basedir}/base.min.js"/>
<delete file="${basedir}/base-viewer.min.js"/>
</target>
<target name="war" depends="app, javac" description="Create the stand-alone war file">
<zip destfile="${build.dir}/${war.name}" basedir="${war.dir}" >
</zip>
</target>
</project>
File added
Our collection of docker images and docker-compose files are in [jgraph/docker-drawio repository](https://github.com/jgraph/docker-drawio)
In that repository:
* draw.io docker image that is always up-to-date with draw.io releases
* draw.io export server image which allow exporting draw.io diagrams to pdf and images
* docker-compose to run draw.io with the export server
* docker-compose to run draw.io integrated within nextcloud
* docker-compose to run draw.io with PlantUML support
* docker-compose to run draw.io self-contained without any dependency on draw.io website (with the export server, plantUml, Google Drive support, OneDrive support, and EMF conversion support (for VSDX export)
* And more...
\ No newline at end of file
# Notion draw.io Extension
To deploy, zip all the files in this directory (except the README.md) and deploy to:
https://chrome.google.com/u/2/webstore/devconsole/...
\ No newline at end of file
'use strict';
chrome.runtime.onInstalled.addListener(function()
{
chrome.declarativeContent.onPageChanged.removeRules(undefined, function()
{
chrome.declarativeContent.onPageChanged.addRules([{
conditions: [new chrome.declarativeContent.PageStateMatcher({
pageUrl: {hostSuffix: '.notion.so'},
})],
actions: [new chrome.declarativeContent.ShowPageAction()]
}]);
});
});
chrome.tabs.onActivated.addListener(function(activeInfo)
{
let tabId = activeInfo.tabId;
chrome.tabs.get(tabId, tab => {
if (tab.url && new URL(tab.url).host.indexOf('.notion.so') > 0)
{
chrome.storage.local.set({ notionTabId: tabId });
}
});
});
chrome.runtime.onConnect.addListener(function(port)
{
//Popup messages
port.onMessage.addListener(function(msg)
{
chrome.storage.local.get(['notionTabId'], ({ notionTabId }) =>
{
if (notionTabId != null)
{
try
{
chrome.tabs.sendMessage(notionTabId, msg, function(resp)
{
console.log(resp);
port.postMessage(resp);
});
}
catch(e)
{
if (e.message.indexOf('disconnected') >= 0)
{
port.postMessage({msg: 'NotionDisconnected', error: true});
}
else
{
port.postMessage({msg: 'Exception', errMsg: e.message, error: true});
}
}
}
else
{
port.postMessage({msg: 'NotionNotFound', error: true, origMsg: msg});
}
});
});
});
This diff is collapsed.
etc/notionExtension/images/logo128.png

8.27 KiB

etc/notionExtension/images/logo16.png

2.11 KiB

etc/notionExtension/images/logo32.png

3.76 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment