Skip to content

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

updating the csp for main and splash html

Ilian Sapundshievab749c8da1e5
diff --git a/app/app.html b/app/app.html
index f764a9601..79bcdfcc5 100644
--- a/app/app.html
+++ b/app/app.html
@@ -1,40 +1,19 @@
<!DOCTYPE html>
<html>
<head>
- <!--meta http-equiv="Content-Security-Policy" content="connect-src http://tagspaces.org/; default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;"-->
+ <title>TagSpaces Desktop</title>
+ <meta http-equiv="Content-Security-Policy" content="connect-src file: *; default-src 'self' ; script-src 'self' ; style-src 'self' 'unsafe-inline' data: blob: ; media-src *; img-src * data: content:;">
<meta charset="utf-8">
<meta name="format-detection" content="telephone=no">
<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">
- <style type="text/css">
- body {
- overflow: hidden; margin: 0; padding: 0;
- }
- #loadingLogo {
- top:45%; width: 100%; text-align: center; position:absolute;
- }
- #loading {
- 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;
- }
- </style>
- <script>
- (function() {
- if (!process.env.HOT) {
- const link = document.createElement('link');
- link.rel = 'stylesheet';
- link.href = './dist/style.css';
- document.getElementsByTagName('head')[0].appendChild(link);
- }
- }());
- </script>
+ <link rel="stylesheet" type="text/css" href="./dist/style.css">
+ <script defer type="text/javascript" src="./dist/bundle.js"></script>
</head>
- <body>
+ <body style="overflow: hidden; margin: 0; padding: 0;">
<div id="root">
- <div id="loading" class="appBackgroundTile" style="-webkit-app-region: drag">
- <div id="loadingLogo">
+ <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" />
@@ -55,25 +34,5 @@
</div>
</div>
</div>
- <script>
- {
- const scripts = [];
-
- // Dynamically insert the DLL script in development env in the renderer process
- if (process.env.NODE_ENV === 'development') {
- scripts.push('../dll/vendor.dll.js');
- }
-
- // Dynamically insert the bundled app script in the renderer process
- const port = process.env.PORT || 1212;
- scripts.push((process.env.HOT) ? 'http://localhost:' + port + '/dist/bundle.js' : './dist/bundle.js');
-
- document.write(
- scripts
- .map(script => '<script defer src="' + script + '"><\/script>')
- .join('')
- );
- }
- </script>
</body>
</html>
diff --git a/app/appd.html b/app/appd.html
new file mode 100644
index 000000000..fc111c23d
--- /dev/null
+++ b/app/appd.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>TagSpaces Desktop Dev</title>
+ <meta http-equiv="Content-Security-Policy" content="connect-src file: *; default-src 'self' ; script-src http://localhost:1212 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline' data: blob: ; media-src *; img-src * data: content:;">
+ <meta charset="utf-8">
+ <meta name="format-detection" content="telephone=no">
+ <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">
+ {
+ if (!process.env.HOT) {
+ const link = document.createElement('link');
+ link.rel = 'stylesheet';
+ link.href = './dist/style.css';
+ document.getElementsByTagName('head')[0].appendChild(link);
+ }
+
+ if (process.env.NODE_ENV === 'development') {
+ const script = document.createElement('script');
+ script.src = '../dll/vendor.dll.js';
+ script.type = 'text/javascript';
+ script.defer = true;
+ document.getElementsByTagName('head')[0].appendChild(script);
+ }
+
+ const port = process.env.PORT || 1212;
+ const bundleScript = document.createElement('script');
+ bundleScript.src = (process.env.HOT) ? 'http://localhost:' + port + '/dist/bundle.js' : './dist/bundle.js';
+ bundleScript.type = 'text/javascript';
+ bundleScript.defer = true;
+ document.getElementsByTagName('head')[0].appendChild(bundleScript);
+ }
+ </script>
+ </head>
+ <body style="overflow: hidden; margin: 0; padding: 0;">
+ <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" 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/app/main.dev.js b/app/main.dev.js
index fe2376870..e7c7b02c9 100644
--- a/app/main.dev.js
+++ b/app/main.dev.js
@@ -92,6 +92,7 @@ app.on('window-all-closed', () => {
app.on('ready', async () => {
let workerDevMode = false;
+ let mainHTML = `file://${__dirname}/app.html`;
if (process.env.NODE_ENV === 'development' || process.env.DEBUG_PROD === 'true') {
await installExtensions();
@@ -99,6 +100,7 @@ app.on('ready', async () => {
if (process.env.NODE_ENV === 'development') {
workerDevMode = true;
+ mainHTML = `file://${__dirname}/appd.html`;
}
const mainWindowState = windowStateKeeper({
@@ -122,7 +124,7 @@ app.on('ready', async () => {
createSplashWorker();
mainWindow = new BrowserWindow({
- show: false,
+ show: true,
x: mainWindowState.x,
y: mainWindowState.y,
width: mainWindowState.width,
@@ -130,8 +132,7 @@ app.on('ready', async () => {
icon: path.join(__dirname, 'assets/icons/128x128.png')
});
- const indexPath = `file://${__dirname}/app.html`;
- mainWindow.loadURL(indexPath);
+ mainWindow.loadURL(mainHTML);
mainWindow.setAutoHideMenuBar(true);
mainWindow.setMenuBarVisibility(false);
diff --git a/app/splash.html b/app/splash.html
index 6c6b37c72..bebdf0621 100644
--- a/app/splash.html
+++ b/app/splash.html
@@ -1,48 +1,36 @@
<!DOCTYPE html>
<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
- <meta http-equiv="Content-Security-Policy" content="default-src file: gap: http: https:; frame-src 'self' file: gap: http: https: ; img-src 'self' blob: file: data: http: https: ; media-src 'self' file: data: blob: ; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-eval'">
- <title>TagSpaces</title>
- <style type="text/css">
- body {
- overflow: hidden; margin: 0; padding: 0;
- }
- #loadingLogo {
- top:45%; width: 100%; text-align: center; position:absolute;
- }
- #loading {
- 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;
- }
- </style>
- <script type="text/javascript" src="dist/electron-worker.js"></script>
-</head>
-<body class="appbody" style="-webkit-app-region: drag">
-<div id="loading" class="appBackgroundTile" style="-webkit-app-region: drag">
- <div id="loadingLogo">
- <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>
-</body>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
+ <meta http-equiv="Content-Security-Policy" content="default-src 'self' file: ; script-src 'self' ; style-src 'self' 'unsafe-inline' data: blob: ; media-src 'self' file: data: blob: ; img-src 'self' blob: file: data: http: https: ;">
+ <!-- meta http-equiv="Content-Security-Policy" content="default-src file: gap: http: https:; frame-src 'self' file: gap: http: https: ; img-src 'self' blob: file: data: http: https: ; media-src 'self' file: data: blob: ; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-eval'" -->
+ <title>TagSpaces Worker</title>
+ <script type="text/javascript" src="dist/electron-worker.js"></script>
+ </head>
+ <body style="overflow: hidden; margin: 0; padding: 0; -webkit-app-region: drag">
+ <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" 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>