Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove any external linked javascript dependency #101

Merged
merged 15 commits into from
Apr 22, 2021
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,6 @@ core
backend/backend-production.*

**/temp/**

# monaco editor
**/vs/loader.js
3 changes: 3 additions & 0 deletions backend/npx.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ app.get('/core-ui/*', (_, res) =>

app.use('/backend', handleRequest);

// serve Monaco editor static files
app.use('/vs', express.static(path.join(__dirname, 'vs')));

app.use('/', express.static(path.join(__dirname, 'core')));
app.get('/*', (_, res) =>
res.sendFile(path.join(__dirname + '/core/index.html')),
Expand Down
1 change: 1 addition & 0 deletions backend/vs
3 changes: 1 addition & 2 deletions core-ui/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ http {
location / {
access_log /dev/stdout combined if=$nonSuccessful;
#limit_req zone=mylimit burst=30; # we might consider using this feature; for now it destroys the performance completely
set $monacoEditorCdn https://cdn.jsdelivr.net;
try_files $uri$args $uri$args/ $uri $uri/ /;

add_header 'Cache-Control' 'public, max-age=300';
Expand All @@ -64,7 +63,7 @@ http {
add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains';
add_header X-XSS-Protection '1; mode=block';
add_header X-Frame-Options 'SAMEORIGIN';
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'sha256-7fF0zlMDaJyxa8K3gkd0Gnt657Obx/gdAct0hR/pdds=' $monacoEditorCdn data: blob:; style-src 'self' 'unsafe-inline' $monacoEditorCdn; connect-src 'self' * https://* wss://*; font-src 'self' $monacoEditorCdn data:; frame-ancestors https://*; object-src 'none'; media-src 'self'; form-action 'self'; img-src * data:; child-src * blob:; worker-src 'self' blob: data:;";
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'sha256-7fF0zlMDaJyxa8K3gkd0Gnt657Obx/gdAct0hR/pdds=' 'sha256-bjOtDHhqB+wVlyFDAxz9e0RvTn+EEec/Z4mpjUjNvAs=' data: blob:; style-src 'self' 'unsafe-inline'; connect-src 'self' * https://* wss://*; font-src 'self' data:; frame-ancestors https://*; object-src 'none'; media-src 'self'; form-action 'self'; img-src * data:; child-src * blob:; worker-src 'self' blob: data:;";

}

Expand Down
1 change: 1 addition & 0 deletions core-ui/public/vs
2 changes: 1 addition & 1 deletion core/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ testem.log
Thumbs.db
pkup.sh

src/assets/luigi-core
src/assets/libs
2 changes: 1 addition & 1 deletion core/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
src/assets/luigi-core
src/assets/libs
src/assets/luigiConfig.bundle.js
2 changes: 1 addition & 1 deletion core/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ARG app_name=core

COPY ./${app_name}/nginx/nginx.conf /etc/nginx/nginx.conf
COPY --from=builder /app/${app_name}/src /usr/share/nginx/html/
COPY --from=builder /app/${app_name}/src/assets/luigi-core /usr/share/nginx/html/assets/luigi-core
COPY --from=builder /app/${app_name}/src/assets/libs /usr/share/nginx/html/assets/libs
COPY --from=builder /app/${app_name}/licenses/ /app/licenses/
COPY --from=builder /app/${app_name}/nginx/conf.d /etc/nginx/conf.d/
COPY --from=builder /app/${app_name}/nginx/nginx.conf /etc/nginx/
Expand Down
2 changes: 1 addition & 1 deletion core/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ http {

add_header 'Cache-Control' 'public, max-age=300';
add_header X-Frame-Options 'SAMEORIGIN';
add_header Content-Security-Policy "default-src 'self'; script-src https://cdnjs.cloudflare.com/ajax/libs/js-yaml/4.0.0/js-yaml.js 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self' https://* wss://*; font-src 'self' data:; frame-ancestors 'self'; object-src 'none'; media-src 'self'; form-action 'self'; img-src * data:; child-src * blob:; worker-src 'self' blob:;";
add_header Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; connect-src 'self' https://* wss://*; font-src 'self' data:; frame-ancestors 'self'; object-src 'none'; media-src 'self'; form-action 'self'; img-src * data:; child-src * blob:; worker-src 'self' blob:;";
add_header X-Content-Type-Options 'nosniff';
add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains';
add_header X-XSS-Protection '1; mode=block';
Expand Down
4 changes: 2 additions & 2 deletions core/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link
charset="utf-8"
rel="stylesheet"
href="/assets/luigi-core/luigi.css"
href="/assets/libs/luigi-core/luigi.css"
/>
<style type="text/css" rel="stylesheet">
#app .fd-shellbar__title {
Expand All @@ -28,7 +28,7 @@
</head>

<body>
<script charset="utf-8" src="/assets/luigi-core/luigi.js"></script>
<script charset="utf-8" src="/assets/libs/luigi-core/luigi.js"></script>
<script charset="utf-8" src="/assets/config/config.js"></script>
<script charset="utf-8" src="/assets/luigiConfig.bundle.js"></script>
<div luigi-app-loading-indicator>
Expand Down
9 changes: 2 additions & 7 deletions core/src/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<meta name="description" content="" />
<meta name="keywords" content="logout" />

<link rel="stylesheet" href="/assets/luigi-core/luigi.css" />
<link rel="stylesheet" href="/assets/libs/luigi-core/luigi.css" />
<style type="text/css">
.fd-page {
height: 100vh;
Expand Down Expand Up @@ -123,12 +123,7 @@
color: #0854a0;
}
</style>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/js-yaml/4.0.0/js-yaml.js"
integrity="sha512-LcHBP6wEG9wiB9l6Ok0oHj/OiepnKTPKSIlIy9I21LPhfNFAQzEJVeEJ2sXYFK8p4V/UR+1/pTHo4Cw1yPK7NA=="
crossorigin="anonymous"
defer
></script>
<script src="/assets/libs/js-yaml/js-yaml.min.js"></script>
</head>

<body>
Expand Down
2 changes: 1 addition & 1 deletion core/src/logout.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<meta name="description" content="" />
<meta name="keywords" content="logout" />

<link rel="stylesheet" href="/assets/luigi-core/luigi.css" />
<link rel="stylesheet" href="/assets/libs/luigi-core/luigi.css" />

<style type="text/css">
.fd-page {
Expand Down
2 changes: 1 addition & 1 deletion core/src/nopermissions.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<title>Not enough permissions</title>

<link rel="stylesheet" href="/assets/luigi-core/luigi.css" />
<link rel="stylesheet" href="/assets/libs/luigi-core/luigi.css" />

<style type="text/css">
.fd-page {
Expand Down
6 changes: 5 additions & 1 deletion core/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ module.exports = {
},
plugins: [
new CopyWebpackPlugin([
{ from: './node_modules/@luigi-project/core', to: 'luigi-core' },
{ from: './node_modules/@luigi-project/core', to: 'libs/luigi-core' },
{
from: '../node_modules/js-yaml/dist/js-yaml.min.js',
to: 'libs/js-yaml',
},
]),
],
};
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"lodash.clonedeep": "^4.5.0",
"merge": "2.1.0",
"moment": "^2.24.0",
"monaco-editor": "^0.23.0",
"node-fetch": "^2.6.1",
"prop-types": "^15.7.2",
"property-expr": "^2.0.4",
Expand Down
2 changes: 1 addition & 1 deletion resources/web/deployment-service-catalog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
spec:
containers:
- name: service-catalog
image: eu.gcr.io/kyma-project/busola-service-catalog-ui:PR-104
image: eu.gcr.io/kyma-project/busola-service-catalog-ui:PR-101
imagePullPolicy: IfNotPresent
resources: {}
ports:
Expand Down
4 changes: 2 additions & 2 deletions resources/web/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
spec:
containers:
- name: busola
image: eu.gcr.io/kyma-project/busola-core:PR-104
image: eu.gcr.io/kyma-project/busola-core:PR-101
imagePullPolicy: Always
resources:
# limits:
Expand All @@ -34,7 +34,7 @@ spec:
- containerPort: 6080
- containerPort: 8080
- name: core-ui
image: eu.gcr.io/kyma-project/busola-core-ui:PR-104
image: eu.gcr.io/kyma-project/busola-core-ui:PR-101
imagePullPolicy: Always
resources:
# limits:
Expand Down
2 changes: 1 addition & 1 deletion service-catalog-ui/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ http {
add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains';
add_header X-XSS-Protection '1; mode=block';
add_header X-Frame-Options 'SAMEORIGIN';
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-eval' data: blob:; style-src 'self' 'unsafe-inline'; connect-src 'self' * https://* wss://*; font-src 'self' data:; frame-ancestors https://*; object-src 'none'; media-src 'self'; form-action 'self'; img-src * data:; child-src * blob:; worker-src 'self' blob: data:;";
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-eval' 'sha256-bjOtDHhqB+wVlyFDAxz9e0RvTn+EEec/Z4mpjUjNvAs=' data: blob:; style-src 'self' 'unsafe-inline'; connect-src 'self' * https://* wss://*; font-src 'self' data:; frame-ancestors https://*; object-src 'none'; media-src 'self'; form-action 'self'; img-src * data:; child-src * blob:; worker-src 'self' blob: data:;";
# allow unsafe-eval scripts because of "ajv" module - https://github.com/ajv-validator/ajv/issues/406
}

Expand Down
1 change: 1 addition & 0 deletions service-catalog-ui/public/vs
1 change: 1 addition & 0 deletions service-catalog-ui/vs
5 changes: 5 additions & 0 deletions shared/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@ export * from './components/ModalWithForm/ModalWithForm';

import * as CustomPropTypes from './typechecking/CustomPropTypes';
export { CustomPropTypes };

import { monaco } from '@monaco-editor/react';

// monaco editor - load from static files instead of from CDN
monaco.config({ paths: { vs: '/vs' } });
2 changes: 1 addition & 1 deletion shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"test:watch": "jest --watch",
"build": "webpack --env.production",
"start:kyma": "webpack --env.development --watch",
"build:npx": "echo no-op, done during bootstrap"
"build:npx": "ln -sf ../node_modules/monaco-editor/min/vs ../backend/vs"
},
"author": "hasselhoff-team@kyma",
"devDependencies": {
Expand Down