Skip to content

Commit

Permalink
fix: Several fixes for the frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
its-laika committed Mar 26, 2024
1 parent d7be831 commit 42a6583
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docker/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ http {
listen 8080;
server_name _;

add_header Content-Security-Policy "default-src 'self' 'unsafe-inline';";
add_header Content-Security-Policy "default-src 'self' 'unsafe-inline' data:;";
add_header Permissions-Policy "geolocation=(), midi=(), camera=(), usb=(), payment=(), vr=(), speaker=(), ambient-light-sensor=(), gyroscope=(), microphone=(), usb=(), interest-cohort=()";
add_header Referer "no-referrer";
add_header Referrer-Policy "no-referrer";
Expand Down
1 change: 1 addition & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ COPY --from=install /app/node_modules/handlebars/dist/handlebars.min.js dist
COPY --from=install /app/node_modules/bootstrap/dist/js/bootstrap.min.js dist
COPY --from=install /app/node_modules/bootstrap/dist/js/bootstrap.min.js.map dist
COPY --from=install /app/node_modules/bootstrap/dist/css/bootstrap.min.css dist
COPY --from=install /app/node_modules/bootstrap/dist/css/bootstrap.min.css.map dist
COPY src/index.html dist
COPY src/privacy-policy.html dist
COPY src/main.js dist
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"copy-dependencies": "rm -rf dist && rsync -av --exclude='*.handlebars' src/ dist/ && cp node_modules/handlebars/dist/handlebars.min.js dist/ && cp node_modules/bootstrap/dist/js/bootstrap.min.js dist && cp node_modules/bootstrap/dist/js/bootstrap.min.js.map dist && cp node_modules/bootstrap/dist/css/bootstrap.min.css dist",
"copy-dependencies": "rm -rf dist && rsync -av --exclude='*.handlebars' src/ dist/ && cp node_modules/handlebars/dist/handlebars.min.js dist/ && cp node_modules/bootstrap/dist/js/bootstrap.min.js dist && cp node_modules/bootstrap/dist/js/bootstrap.min.js.map dist && cp node_modules/bootstrap/dist/css/bootstrap.min.css dist && cp node_modules/bootstrap/dist/css/bootstrap.min.css.map dist",
"compile": "handlebars src/table.handlebars -f dist/table.handlebars.compiled.js",
"dev": "npm run copy-dependencies && npm run compile && cd dist && python3 -m http.server 8080"
},
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>above_me</title>
<link rel="icon" href="data:;base64,iVBORw0KGgo=">

<link rel="stylesheet" href="bootstrap.min.css">
<link rel="stylesheet" href="style.css">
Expand Down Expand Up @@ -37,16 +38,16 @@ <h3>See what's flying right above you!</h1>
</div>
</div>

<div class="alert alert-danger" role="alert" id="no-position-available">
<div class="alert alert-danger status-message" role="alert" id="no-position-available">
Error. Position for your device could not be loaded. Please check if you gave permission to this site to
access your position.
</div>

<div class="alert alert-danger" role="alert" id="http-error">
<div class="alert alert-danger status-message" role="alert" id="http-error">
Error. Could not fetch data. Open the developer console for more information.
</div>

<div class="alert alert-info" role="alert" id="loading-position">
<div class="alert alert-info status-message" role="alert" id="loading-position">
Loading position...
</div>

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function submit(event) {
document.getElementById('http-error').style.display = 'inherit';
document.getElementById('http-error').style.display = 'none';

if (event) {
event.preventDefault();
Expand Down Expand Up @@ -35,7 +35,7 @@ function submit(event) {
.then(states =>
Handlebars.templates.table({ states })
)
.then((html) => {
.then(html => {
document.getElementById('table-container').innerHTML = html;
})
.catch(error => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ form .button-container {
white-space: nowrap;
}

.alert {
.status-message {
display: none;
}

Expand Down

0 comments on commit 42a6583

Please sign in to comment.