Compare commits

...

4 commits

8 changed files with 54 additions and 32 deletions

View file

@ -177,3 +177,13 @@ BORG_SERVER_PUBKEYS = [
),
]
```
## Webserver Config / Content-Security-Policy
This page by itself does not load external sources and does not use inline javascript/styling.
It only loads javascript, CSS and images.
Therefore the following Content-Security-Policy should work fine in the standard cases:
```
Content-Security-Policy "default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self';"
```

View file

@ -120,7 +120,7 @@ STATICFILES_DIRS = [
BASE_DIR / "static",
]
RELEASE_VERSION = "0.14"
RELEASE_VERSION = "0.15"
# Import settings from configuration.py
try:

View file

@ -1,3 +1,9 @@
body {
display: flex;
flex-direction: column;
height: 100vh;
}
.pixelart {
image-rendering: crisp-edges;
}
@ -6,3 +12,7 @@
min-width: 32px;
min-height: 32px;
}
.word-break-break-all {
word-break: break-all;
}

View file

@ -0,0 +1,24 @@
//
// Activation script for the bulma burger menu.
// Copied from https://bulma.io/documentation/components/navbar/
//
document.addEventListener('DOMContentLoaded', () => {
// Get all "navbar-burger" elements
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
// Add a click event on each of them
$navbarBurgers.forEach( el => {
el.addEventListener('click', () => {
// Get the target from the "data-target" attribute
const target = el.dataset.target;
const $target = document.getElementById(target);
// Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
el.classList.toggle('is-active');
$target.classList.toggle('is-active');
});
});
});

View file

@ -2,37 +2,15 @@
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" href="{% static 'vendored/css/bulma.min.css' %}">
<link rel="stylesheet" href="{% static 'vendored/css/bulma.min.css' %}">
<link rel="stylesheet" href="{% static 'webui/css/webui.css' %}">
<link rel="icon" href="{% static 'webui/logo.png'%}" type="image/png"/>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Community Backup</title>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', () => {
// Get all "navbar-burger" elements
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
// Add a click event on each of them
$navbarBurgers.forEach( el => {
el.addEventListener('click', () => {
// Get the target from the "data-target" attribute
const target = el.dataset.target;
const $target = document.getElementById(target);
// Toggle the "is-active" class on both the "navbar-burger" and the "navbar-menu"
el.classList.toggle('is-active');
$target.classList.toggle('is-active');
});
});
});
</script>
<script type="text/javascript" src={% static 'webui/js/webui.js' %}></script>
</head>
<body style="display: flex; flex-direction: column; height: 100vh">
<body>
<nav class="navbar" role="navigation" aria-label="main navigation" >
<div class="navbar-brand">
<a class="navbar-item" href="/"><img id="logo" class="pixelart" src="{% static 'webui/logo.png' %}" alt="The logo if Community Backup, a pixelated hard disk platter and head."/> Community Backup</a>

View file

@ -28,8 +28,8 @@
{% for repo in object_list %}
<tr>
<td>{{ repo.name }}</td>
<td style="word-break: break-all"><code>{{ repo.truncated_key }}</code></td>
<td style="word-break: break-all"><code>{{ repo.repo_url }}</code></td>
<td class="word-break-break-all"><code>{{ repo.truncated_key }}</code></td>
<td class="word-break-break-all"><code>{{ repo.repo_url }}</code></td>
<td>{% if repo.used_quota < 0 %}not initialized{% else %}{{ repo.used_quota }}/{{ repo.quota }} GB{% endif %}</td>
<td>
<div class="field is-grouped">
@ -51,8 +51,8 @@
</header>
<div class="card-content">
{% for key, fingerprint in BORG_SERVER_PUBKEYS %}
<span style="word-break: break-all"><code>{{ key }}</code></span><br>
<span style="word-break: break-all"><code>{{ fingerprint }}</code></span>
<span class="word-break-break-all"><code>{{ key }}</code></span><br>
<span class="word-break-break-all"><code>{{ fingerprint }}</code></span>
{% if not forloop.last %}
<hr>
{% endif %}

View file

@ -1,6 +1,6 @@
[project]
name = "community_backup"
version = "0.14"
version = "0.15"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.13"

2
uv.lock generated
View file

@ -13,7 +13,7 @@ wheels = [
[[package]]
name = "community-backup"
version = "0.14"
version = "0.15"
source = { virtual = "." }
dependencies = [
{ name = "crispy-bulma" },