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

feat: adds restrictive content security policies #2507

Merged
merged 7 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions packages/desktop/public/about.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@font-face {
font-family: 'Silka';
font-style: normal;
font-weight: 500;
font-display: swap;
src: url('./assets/fonts/silka/silka-medium-webfont.woff2') format('woff2');
}

body,
html {
width: 100%;
height: 100%;
user-select: none;
-webkit-user-drag: none;
overflow: hidden;
}

body {
margin: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: #ffffff;
background-color: #161926;
font-size: 11px;
font-family: 'Silka';
}

#app-icon {
margin-top: 20px;
-webkit-user-drag: none;
}

#app-version {
margin-bottom: 0.05rem;
}

#footer {
margin-bottom: 30px;
}
80 changes: 24 additions & 56 deletions packages/desktop/public/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,68 +6,36 @@
name="viewport"
content="width=device-width, initial-scale=1, user-scalable=no"
/>
<meta
http-equiv="Content-Security-Policy"
content="
default-src 'self';
connect-src 'self';
img-src 'self';
base-uri 'self';
form-action 'none';
frame-src 'none';
worker-src 'none';
script-src-elem 'self';
script-src-attr 'none';
style-src-elem 'self';
style-src-attr 'none';
object-src 'none';
media-src 'self';
font-src 'self';
manifest-src 'self';
navigate-to 'self';
upgrade-insecure-requests;
"
/>
<title></title>
<style>
@font-face {
font-family: 'Silka';
font-style: normal;
font-weight: 500;
font-display: swap;
src: url('./assets/fonts/silka/silka-medium-webfont.woff2') format('woff2');
}

body,

html {
width: 100%;
height: 100%;
user-select: none;
-webkit-user-drag: none;
overflow: hidden;
}

body {
margin: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: #ffffff;
background-color: #161926;
font-size: 11px;
font-family: 'Silka';
}

#app-icon {
margin-top: 20px;
-webkit-user-drag: none;
}

#app-version {
margin-bottom: 0.05rem;
}

#footer {
margin-bottom: 30px;
}
</style>
<link rel="stylesheet" href="about.css">
</head>
<body>
<img id="app-icon" alt="App icon" height="70" width="70" />
<h2 id="title"></h2>
<p id="app-version"></p>

<p id="footer"></p>
<!-- https://github.com/electron/electron/issues/2863 -->
<script>var exports = exports || {};</script>

<script>
window.about.getData().then((aboutData) => {
document.getElementById('title').textContent = aboutData.appName
document.getElementById('app-icon').src = aboutData.iconPath
document.getElementById('app-version').textContent = aboutData.version
document.getElementById('footer').textContent = `Bloom Labs Ltd. ${new Date().getFullYear()}`
})
</script>
<script src="about.js"></script>
</body>
</html>
9 changes: 9 additions & 0 deletions packages/desktop/public/about.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// https://github.com/electron/electron/issues/2863
var exports = exports || {}

window.about.getData().then((aboutData) => {
document.getElementById('title').textContent = aboutData.appName
document.getElementById('app-icon').src = aboutData.iconPath
document.getElementById('app-version').textContent = aboutData.version
document.getElementById('footer').textContent = `Bloom Labs Ltd. ${new Date().getFullYear()}`
})
111 changes: 111 additions & 0 deletions packages/desktop/public/error.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
@font-face {
font-family: 'Silka';
font-style: normal;
font-weight: 500;
font-display: swap;
src: url('./assets/fonts/silka/silka-medium-webfont.woff2') format('woff2');
}

* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body,
html {
width: 100%;
height: 100%;
user-select: none;
-webkit-user-drag: none;
overflow: hidden;
}

body {
display: flex;
justify-content: stretch;
color: #ffffff;
background-color: #161926;
font-size: 11px;
font-family: 'Silka';
}

a {
color: #b196ef;
}

hr {
width: 100%;
border: 0;
border-top: 1px solid #212537;
margin: 1.5rem 0;
}

button {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
border: 0px solid rgb(150, 108, 230);
box-sizing: border-box;
cursor: pointer;
border-radius: 3rem;
padding-left: 1.5rem;
padding-right: 1.5rem;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
height: 3rem;
background-color: rgb(150, 108, 230);
width: fit-content;
color: white;
font-family: Silka;
font-size: 16px;
}

.content {
flex: 1;
display: flex;
margin: 2rem;
display: flex;
flex-direction: column;
}

#app-icon {
-webkit-user-drag: none;
margin: 1rem 0;
}

#title {
margin: 1rem 0;
}

#diagnostics {
margin: 1rem 0;
}

#details {
margin: 1rem 0;
flex: 1;
overflow-y: auto;
white-space: pre-line;
min-height: 50px;
}

.help {
color: #c4d1e8;
font-size: 0.8rem;
line-height: 1.5rem;
}

::-webkit-scrollbar {
width: 8px;
}

::-webkit-scrollbar-thumb {
background-color: #d8e3f5;
border-radius: 10px;
}

::-webkit-scrollbar-track {
background-color: transparent;
}
Loading
Loading