Compare commits
4 commits
5471b20f7b
...
49108672c8
| Author | SHA1 | Date | |
|---|---|---|---|
| 49108672c8 | |||
| 6013d0bcab | |||
| 26f3d5d033 | |||
| 5813d200dc |
8 changed files with 54 additions and 32 deletions
10
README.md
10
README.md
|
|
@ -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';"
|
||||
```
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ STATICFILES_DIRS = [
|
|||
BASE_DIR / "static",
|
||||
]
|
||||
|
||||
RELEASE_VERSION = "0.14"
|
||||
RELEASE_VERSION = "0.15"
|
||||
|
||||
# Import settings from configuration.py
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
24
community_backup/static/webui/js/webui.js
Normal file
24
community_backup/static/webui/js/webui.js
Normal 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');
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -8,31 +8,9 @@
|
|||
<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>
|
||||
|
|
|
|||
|
|
@ -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 %}
|
||||
|
|
|
|||
|
|
@ -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
2
uv.lock
generated
|
|
@ -13,7 +13,7 @@ wheels = [
|
|||
|
||||
[[package]]
|
||||
name = "community-backup"
|
||||
version = "0.14"
|
||||
version = "0.15"
|
||||
source = { virtual = "." }
|
||||
dependencies = [
|
||||
{ name = "crispy-bulma" },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue