|
1 |
| -{% extends "admin/base_site.html" %} |
2 |
| - |
3 |
| -{% block extrahead %} |
4 |
| -{{ block.super }} |
| 1 | +{% extends "admin/base_site.html" %} {% block extrahead %} {{ block.super }} |
5 | 2 | <style>
|
6 | 3 | .svg-icon {
|
7 | 4 | width: 1em;
|
|
32 | 29 | </style>
|
33 | 30 | <script>
|
34 | 31 | 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"); |
39 | 38 |
|
40 | 39 | if (!currentVersion) {
|
41 |
| - updateStatus.textContent = ' Unable to get current version'; |
| 40 | + updateStatus.textContent = " Unable to get current version"; |
42 | 41 | return;
|
43 | 42 | }
|
44 | 43 |
|
45 |
| - updateButton.classList.add('rotating'); |
46 |
| - updateStatus.textContent = ' Checking...'; |
| 44 | + updateButton.classList.add("rotating"); |
| 45 | + updateStatus.textContent = " Checking..."; |
47 | 46 |
|
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) => { |
50 | 51 | if (!response.ok) {
|
51 |
| - throw new Error('Network error'); |
| 52 | + throw new Error("Network error"); |
52 | 53 | }
|
53 | 54 | return response.json();
|
54 | 55 | })
|
55 |
| - .then(data => { |
| 56 | + .then((data) => { |
56 | 57 | const latestVersion = data.tag_name;
|
57 | 58 | if (latestVersion !== currentVersion) {
|
58 | 59 | updateStatus.innerHTML = ` <a href="${data.html_url}" target="_blank">Update available (${latestVersion})</a>`;
|
59 | 60 | } else {
|
60 |
| - updateStatus.textContent = ' Up to date'; |
| 61 | + updateStatus.textContent = " Up to date"; |
61 | 62 | }
|
62 | 63 | })
|
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"; |
66 | 67 | })
|
67 | 68 | .finally(() => {
|
68 |
| - updateButton.classList.remove('rotating'); |
| 69 | + updateButton.classList.remove("rotating"); |
69 | 70 | });
|
70 | 71 | }
|
71 | 72 | </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 | + > |
81 | 88 | <title>Check Updates</title>
|
82 | 89 | <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 | + /> |
84 | 92 | </svg>
|
85 | 93 | <span id="update-status"></span>
|
86 | 94 | </div>
|
|
0 commit comments