Skip to content

Commit 1262f0b

Browse files
committed
add X_FRAME_OPTIONS env
1 parent 9e593ea commit 1262f0b

File tree

2 files changed

+39
-31
lines changed

2 files changed

+39
-31
lines changed

config/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
DEMO = os.environ.get("DEMO") == "1"
2121
# Build paths inside the project like this: BASE_DIR / 'subdir'.
2222
BASE_DIR = Path(__file__).resolve().parent.parent
23-
23+
X_FRAME_OPTIONS = os.environ.get('X_FRAME_OPTIONS', 'DENY')
2424

2525
# Quick-start development settings - unsuitable for production
2626
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/

templates/admin/base_site.html

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
{% extends "admin/base_site.html" %}
2-
3-
{% block extrahead %}
4-
{{ block.super }}
1+
{% extends "admin/base_site.html" %} {% block extrahead %} {{ block.super }}
52
<style>
63
.svg-icon {
74
width: 1em;
@@ -32,55 +29,66 @@
3229
</style>
3330
<script>
3431
function checkUpdate() {
35-
const versionElement = document.querySelector('#footer [data-version]');
36-
const currentVersion = versionElement ? versionElement.getAttribute('data-version') : null;
37-
const updateButton = document.getElementById('update-button');
38-
const updateStatus = document.getElementById('update-status');
32+
const versionElement = document.querySelector("#footer [data-version]");
33+
const currentVersion = versionElement
34+
? versionElement.getAttribute("data-version")
35+
: null;
36+
const updateButton = document.getElementById("update-button");
37+
const updateStatus = document.getElementById("update-status");
3938

4039
if (!currentVersion) {
41-
updateStatus.textContent = ' Unable to get current version';
40+
updateStatus.textContent = " Unable to get current version";
4241
return;
4342
}
4443

45-
updateButton.classList.add('rotating');
46-
updateStatus.textContent = ' Checking...';
44+
updateButton.classList.add("rotating");
45+
updateStatus.textContent = " Checking...";
4746

48-
fetch('https://api.github.com/repos/rss-translator/RSS-Translator/releases/latest')
49-
.then(response => {
47+
fetch(
48+
"https://api.github.com/repos/rss-translator/RSS-Translator/releases/latest",
49+
)
50+
.then((response) => {
5051
if (!response.ok) {
51-
throw new Error('Network error');
52+
throw new Error("Network error");
5253
}
5354
return response.json();
5455
})
55-
.then(data => {
56+
.then((data) => {
5657
const latestVersion = data.tag_name;
5758
if (latestVersion !== currentVersion) {
5859
updateStatus.innerHTML = ` <a href="${data.html_url}" target="_blank">Update available (${latestVersion})</a>`;
5960
} else {
60-
updateStatus.textContent = ' Up to date';
61+
updateStatus.textContent = " Up to date";
6162
}
6263
})
63-
.catch(error => {
64-
console.error('Update check failed:', error);
65-
updateStatus.textContent = ' Check Failed';
64+
.catch((error) => {
65+
console.error("Update check failed:", error);
66+
updateStatus.textContent = " Check Failed";
6667
})
6768
.finally(() => {
68-
updateButton.classList.remove('rotating');
69+
updateButton.classList.remove("rotating");
6970
});
7071
}
7172
</script>
72-
{% endblock %}
73-
74-
{% block footer %}
75-
<div id="footer" style="text-align: center;">
76-
<a href="https://rsstranslator.com" title="RSS Translator">RSS Translator</a> ·
77-
<a href="https://afdian.com/a/versun" title="Donate">Donate</a> ·
78-
Version: <span data-version="2025.5.13">2025.5.13</span>
79-
<svg id="update-button" class="svg-icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
80-
onclick="checkUpdate()">
73+
{% endblock %} {% block footer %}
74+
<div id="footer" style="text-align: center">
75+
<a href="https://rsstranslator.com" title="RSS Translator"
76+
>RSS Translator</a
77+
>
78+
· <a href="https://afdian.com/a/versun" title="Donate">Donate</a> · Version:
79+
<span data-version="2025.5.24">2025.5.24</span>
80+
<svg
81+
id="update-button"
82+
class="svg-icon"
83+
viewBox="0 0 1024 1024"
84+
version="1.1"
85+
xmlns="http://www.w3.org/2000/svg"
86+
onclick="checkUpdate()"
87+
>
8188
<title>Check Updates</title>
8289
<path
83-
d="M783.568 328C724.571 241.095 624.953 184 512 184c-181.15 0-328 146.85-328 328h-72c0-220.914 179.086-400 400-400 135.738 0 255.685 67.611 328 170.994V128c0-8.837 7.163-16 16-16h48a8 8 0 0 1 8 8v248c0 17.673-14.327 32-32 32H632a8 8 0 0 1-8-8v-48c0-8.837 7.163-16 16-16h143.568zM240.432 696C299.429 782.905 399.047 840 512 840c181.15 0 328-146.85 328-328h72c0 220.914-179.086 400-400 400-135.738 0-255.685-67.611-328-170.994V896c0 8.837-7.163 16-16 16h-48a8 8 0 0 1-8-8V656c0-17.673 14.327-32 32-32h248a8 8 0 0 1 8 8v48c0 8.837-7.163 16-16 16H240.432z" />
90+
d="M783.568 328C724.571 241.095 624.953 184 512 184c-181.15 0-328 146.85-328 328h-72c0-220.914 179.086-400 400-400 135.738 0 255.685 67.611 328 170.994V128c0-8.837 7.163-16 16-16h48a8 8 0 0 1 8 8v248c0 17.673-14.327 32-32 32H632a8 8 0 0 1-8-8v-48c0-8.837 7.163-16 16-16h143.568zM240.432 696C299.429 782.905 399.047 840 512 840c181.15 0 328-146.85 328-328h72c0 220.914-179.086 400-400 400-135.738 0-255.685-67.611-328-170.994V896c0 8.837-7.163 16-16 16h-48a8 8 0 0 1-8-8V656c0-17.673 14.327-32 32-32h248a8 8 0 0 1 8 8v48c0 8.837-7.163 16-16 16H240.432z"
91+
/>
8492
</svg>
8593
<span id="update-status"></span>
8694
</div>

0 commit comments

Comments
 (0)