Skip to content

TagSpaces is an offline, open source, document manager with tagging support

chore: adjusting csp and webpack templating

Ilian Sapundshiev466d79edc3b8
diff --git a/.erb/configs/webpack.config.cordova.dev.ts b/.erb/configs/webpack.config.cordova.dev.ts
index 16d356b8c..71968bd5c 100644
--- a/.erb/configs/webpack.config.cordova.dev.ts
+++ b/.erb/configs/webpack.config.cordova.dev.ts
@@ -245,7 +245,10 @@ const configuration: webpack.Configuration = {
new HtmlWebpackPlugin({
filename: path.join('index.html'),
- template: path.join(webpackPaths.srcRendererPath, 'appd.html'),
+ template: path.join(webpackPaths.srcRendererPath, 'index.ejs'),
+ templateParameters: {
+ csp: "connect-src files: *; default-src 'self' ; object-src 'none' ; font-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline' data: blob: ; media-src * blob: ; img-src * blob: data: content:;",
+ },
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
diff --git a/.erb/configs/webpack.config.cordova.prod.ts b/.erb/configs/webpack.config.cordova.prod.ts
index 95cfa356b..2a5131b5b 100644
--- a/.erb/configs/webpack.config.cordova.prod.ts
+++ b/.erb/configs/webpack.config.cordova.prod.ts
@@ -262,7 +262,10 @@ const configuration: webpack.Configuration = {
new HtmlWebpackPlugin({
filename: path.join('index.html'),
- template: path.join(webpackPaths.srcRendererPath, 'appd.html'),
+ template: path.join(webpackPaths.srcRendererPath, 'index.ejs'),
+ templateParameters: {
+ csp: "connect-src files: *; default-src 'self' ; object-src 'none' ; font-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline' data: blob: ; media-src * blob: ; img-src * blob: data: content:;",
+ },
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
diff --git a/.erb/configs/webpack.config.renderer.dev.ts b/.erb/configs/webpack.config.renderer.dev.ts
index bcdd100e6..ad1a435b7 100644
--- a/.erb/configs/webpack.config.renderer.dev.ts
+++ b/.erb/configs/webpack.config.renderer.dev.ts
@@ -168,7 +168,10 @@ const configuration: webpack.Configuration = {
new HtmlWebpackPlugin({
filename: path.join('index.html'),
- template: path.join(webpackPaths.srcRendererPath, 'appd.html'),
+ template: path.join(webpackPaths.srcRendererPath, 'index.ejs'),
+ templateParameters: {
+ csp: "connect-src files: *; default-src 'self' ; object-src 'none' ; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline' data: blob: ; media-src * blob: ; img-src * blob: data: content:;",
+ },
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
diff --git a/.erb/configs/webpack.config.renderer.prod.ts b/.erb/configs/webpack.config.renderer.prod.ts
index 2311c0ebe..926b36ee3 100644
--- a/.erb/configs/webpack.config.renderer.prod.ts
+++ b/.erb/configs/webpack.config.renderer.prod.ts
@@ -131,6 +131,9 @@ const configuration: webpack.Configuration = {
new HtmlWebpackPlugin({
filename: 'index.html',
template: path.join(webpackPaths.srcRendererPath, 'index.ejs'),
+ templateParameters: {
+ csp: "connect-src files: *; default-src 'self' ; object-src 'none' ; font-src 'self'; script-src 'self' ; style-src 'self' 'unsafe-inline' data: blob: ; media-src * blob: ; img-src * blob: data: content:;",
+ },
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
diff --git a/.erb/configs/webpack.config.web.dev.ts b/.erb/configs/webpack.config.web.dev.ts
index ce2e42b77..13c4f129c 100644
--- a/.erb/configs/webpack.config.web.dev.ts
+++ b/.erb/configs/webpack.config.web.dev.ts
@@ -206,7 +206,7 @@ const configuration: webpack.Configuration = {
new HtmlWebpackPlugin({
filename: path.join('index.html'),
- template: path.join(webpackPaths.srcRendererPath, 'appd.html'),
+ template: path.join(webpackPaths.srcRendererPath, '../../web/index.html'),
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
diff --git a/.erb/configs/webpack.config.web.prod.ts b/.erb/configs/webpack.config.web.prod.ts
index edda93b52..78177f2cb 100644
--- a/.erb/configs/webpack.config.web.prod.ts
+++ b/.erb/configs/webpack.config.web.prod.ts
@@ -264,7 +264,7 @@ const configuration: webpack.Configuration = {
new HtmlWebpackPlugin({
filename: path.join('index.html'),
- template: path.join(webpackPaths.srcRendererPath, 'appd.html'),
+ template: path.join(webpackPaths.srcRendererPath, '../../web/index.html'),
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
diff --git a/src/renderer/appd.html b/src/renderer/appd.html
deleted file mode 100644
index 5828234c8..000000000
--- a/src/renderer/appd.html
+++ /dev/null
@@ -1,93 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>TagSpaces Desktop Dev</title>
- <meta
- http-equiv="Content-Security-Policy"
- content="connect-src files: *; default-src 'self' ; object-src 'none' ; font-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline' data: blob: ; media-src * blob: ; img-src * blob: data: content:;"
- />
- <meta charset="utf-8" />
- <meta name="format-detection" content="telephone=yes" />
- <meta name="msapplication-tap-highlight" content="no" />
- <meta
- name="viewport"
- content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width"
- />
- <!-- script type="text/javascript" src="./node_modules/@tagspaces/pro/extconfig.template.js"></script-->
- <script type="text/javascript" src="./extconfig.js"></script>
- </head>
- <body
- style="overflow: hidden; margin: 0; padding: 0; background-color: rgb(88, 88, 88);"
- >
- <div id="root">
- <div
- style="text-align: center; width: 100%; height: 100%; font-size: 1.4em; position:absolute; z-index: 999999; user-select: none; -webkit-user-select: none; -moz-user-select: none; -webkit-app-region: drag"
- class="appBackgroundTile"
- >
- <div
- style="top:45%; width: 100%; text-align: center; position:absolute;"
- >
- <svg
- style="vertical-align: middle"
- xmlns="http://www.w3.org/2000/svg"
- version="1.1"
- width="100"
- height="100"
- >
- <g
- id="layer1"
- transform="matrix(0.33346217,0,0,0.33346217,-0.01300084,-250.91)"
- >
- <rect
- style="fill:none;fill-opacity:1;stroke:none"
- id="rect3052-8-1"
- width="299.42227"
- height="299.42227"
- x="-0.019505024"
- y="752.95935"
- />
- <path
- style="fill:#ffffff;fill-opacity:1;stroke:none"
- d="m 181.90177,787.75394 70.88695,43.53834 C 180.29225,977.67059 187.41436,950.59754 124.58989,989.154 L 65.05006,905.90077 Z"
- id="rect3052-8-2-2"
- />
- <ellipse
- style="fill:#616577;fill-opacity:1;stroke:none"
- id="path4875-4-7-5-6-2"
- cx="192.4187"
- cy="851.11481"
- rx="15.970615"
- ry="15.782593"
- />
- <path
- style="fill:none;stroke:#a466aa;stroke-width:27.50978279;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 159.73623,964.91671 134.54529,941.61879"
- id="path3108-5-39-8"
- />
- <path
- style="fill:none;stroke:#ffffff;stroke-width:34.19813538;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 162.16161,795.17204 90.03628,0.34544 0,86.1724 -115.50748,117.79375 -88.457192,-81.6665 z"
- id="path3923-1-1-4-9-8"
- />
- <path
- style="fill:#f7901e;fill-opacity:1;stroke:#33b5be;stroke-width:27.50978279;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 204.81469,910.87834 -50.38182,-45.3016"
- id="path3108-9-1-76-7"
- />
- <path
- style="fill:#616577;fill-opacity:1;stroke:#f7901e;stroke-width:27.50978279;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 182.93838,938.7066 144.48907,904.40668"
- id="path3108-0-7-9-8"
- />
- <path
- style="fill:none;stroke:#616577;stroke-width:31.96374702;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 164.34385,800.70161 83.03644,0 0,79.10209 -110.49206,113.42316 -82.031957,-75.83333 z"
- id="path3923-1-1-4-9"
- />
- </g>
- </svg>
- </div>
- </div>
- </div>
- </body>
-</html>
diff --git a/src/renderer/index.ejs b/src/renderer/index.ejs
index 2d153f8ee..2a2fd9cbe 100644
--- a/src/renderer/index.ejs
+++ b/src/renderer/index.ejs
@@ -4,14 +4,14 @@
<title>TagSpaces Desktop</title>
<meta
http-equiv="Content-Security-Policy"
- content="connect-src files: *; default-src 'self' ; object-src 'none' ; script-src 'self' 'unsafe-inline' ; style-src 'self' 'unsafe-inline' data: blob: ; media-src * blob: ; img-src * blob: data: content:;"
- />
- <meta charset="utf-8" />
- <meta name="format-detection" content="telephone=yes" />
- <meta name="msapplication-tap-highlight" content="no" />
+ content="<%= csp %>"
+ >
+ <meta charset="utf-8">
+ <meta name="format-detection" content="telephone=yes">
+ <meta name="msapplication-tap-highlight" content="no">
<meta
name="viewport"
- content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width"
+ content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"
/>
<script type="text/javascript" src="./extconfig.js"></script>
</head>
@@ -88,4 +88,3 @@
</div>
</body>
</html>
-
diff --git a/web/index.html b/web/index.html
index 83756063f..4c94e8456 100644
--- a/web/index.html
+++ b/web/index.html
@@ -1,14 +1,15 @@
<!DOCTYPE html>
<html>
-
<head>
<title>TagSpaces Web</title>
- <meta http-equiv="Content-Security-Policy"
- content="connect-src *; default-src 'self' ; object-src 'none' ; script-src 'self' 'unsafe-inline' ; style-src 'self' 'unsafe-inline' data: blob: ; media-src * blob: ; img-src * blob: data: content:;">
+ <meta
+ http-equiv="Content-Security-Policy"
+ content="connect-src *; default-src 'self' ; object-src 'none' ; script-src 'self' 'unsafe-inline' ; style-src 'self' 'unsafe-inline' data: blob: ; media-src * blob: ; img-src * blob: data: content:;"
+ >
+ <meta charset="utf-8">
<meta name="format-detection" content="telephone=yes">
<meta name="msapplication-tap-highlight" content="no">
<meta name="robots" content="noindex">
- <meta charset="utf-8">
<meta
name="viewport"
content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"
@@ -45,34 +46,68 @@
<div id="root">
<div
style="text-align: center; width: 100%; height: 100%; font-size: 1.4em; position:absolute; z-index: 999999; background-color: #F5F5F5; user-select: none; -webkit-user-select: none; -moz-user-select: none; -webkit-app-region: drag"
- class="appBackgroundTile">
- <div style="top:45%; width: 100%; text-align: center; position:absolute;">
- <svg style="vertical-align: middle" xmlns="http://www.w3.org/2000/svg" version="1.1" width="100" height="100">
- <g id="layer1" transform="matrix(0.33346217,0,0,0.33346217,-0.01300084,-250.91)">
- <rect style="fill:none;fill-opacity:1;stroke:none" id="rect3052-8-1" width="299.42227" height="299.42227"
- x="-0.019505024" y="752.95935" />
- <path style="fill:#ffffff;fill-opacity:1;stroke:none"
+ class="appBackgroundTile"
+ >
+ <div
+ style="top:45%; width: 100%; text-align: center; position:absolute;"
+ >
+ <svg
+ style="vertical-align: middle"
+ xmlns="http://www.w3.org/2000/svg"
+ version="1.1"
+ width="100"
+ height="100"
+ >
+ <g
+ id="layer1"
+ transform="matrix(0.33346217,0,0,0.33346217,-0.01300084,-250.91)"
+ >
+ <rect
+ style="fill:none;fill-opacity:1;stroke:none"
+ id="rect3052-8-1"
+ width="299.42227"
+ height="299.42227"
+ x="-0.019505024"
+ y="752.95935"
+ />
+ <path
+ style="fill:#ffffff;fill-opacity:1;stroke:none"
d="m 181.90177,787.75394 70.88695,43.53834 C 180.29225,977.67059 187.41436,950.59754 124.58989,989.154 L 65.05006,905.90077 Z"
- id="rect3052-8-2-2" />
- <ellipse style="fill:#616577;fill-opacity:1;stroke:none" id="path4875-4-7-5-6-2" cx="192.4187"
- cy="851.11481" rx="15.970615" ry="15.782593" />
+ id="rect3052-8-2-2"
+ />
+ <ellipse
+ style="fill:#616577;fill-opacity:1;stroke:none"
+ id="path4875-4-7-5-6-2"
+ cx="192.4187"
+ cy="851.11481"
+ rx="15.970615"
+ ry="15.782593"
+ />
<path
style="fill:none;stroke:#a466aa;stroke-width:27.50978279;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 159.73623,964.91671 134.54529,941.61879" id="path3108-5-39-8" />
+ d="M 159.73623,964.91671 134.54529,941.61879"
+ id="path3108-5-39-8"
+ />
<path
style="fill:none;stroke:#ffffff;stroke-width:34.19813538;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 162.16161,795.17204 90.03628,0.34544 0,86.1724 -115.50748,117.79375 -88.457192,-81.6665 z"
- id="path3923-1-1-4-9-8" />
+ id="path3923-1-1-4-9-8"
+ />
<path
style="fill:#f7901e;fill-opacity:1;stroke:#33b5be;stroke-width:27.50978279;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="m 204.81469,910.87834 -50.38182,-45.3016" id="path3108-9-1-76-7" />
+ d="m 204.81469,910.87834 -50.38182,-45.3016"
+ id="path3108-9-1-76-7"
+ />
<path
style="fill:#616577;fill-opacity:1;stroke:#f7901e;stroke-width:27.50978279;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- d="M 182.93838,938.7066 144.48907,904.40668" id="path3108-0-7-9-8" />
+ d="M 182.93838,938.7066 144.48907,904.40668"
+ id="path3108-0-7-9-8"
+ />
<path
style="fill:none;stroke:#616577;stroke-width:31.96374702;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 164.34385,800.70161 83.03644,0 0,79.10209 -110.49206,113.42316 -82.031957,-75.83333 z"
- id="path3923-1-1-4-9" />
+ id="path3923-1-1-4-9"
+ />
</g>
</svg>
</div>
@@ -80,5 +115,4 @@
</div>
<script type="text/javascript" src="dist/bundle.js"></script>
</body>
-
</html>