fix(frontend): use relative URLs to support reverse proxy subpath (/sync/)

This commit is contained in:
Antigravity committed 2026-10-12 12:18:04 +03:00
1 parent b36445d203
commit c098376aa4
2 files changed
+6 -6

No files matched your search

+4 -4
View File
@@ -19,7 +19,7 @@ document.addEventListener("DOMContentLoaded", () => {
if (!url) return; if (!url) return;
try { try {
const res = await fetch("/api/download", { const res = await fetch("api/download", {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ url }) body: JSON.stringify({ url })
@@ -40,7 +40,7 @@ document.addEventListener("DOMContentLoaded", () => {
syncLikesBtn.addEventListener("click", async () => { syncLikesBtn.addEventListener("click", async () => {
if (!confirm("Запустить синхронизацию плейлиста «Мне нравится» из Яндекс Музыки?")) return; if (!confirm("Запустить синхронизацию плейлиста «Мне нравится» из Яндекс Музыки?")) return;
try { try {
const res = await fetch("/api/sync/yandex-likes", { method: "POST" }); const res = await fetch("api/sync/yandex-likes", { method: "POST" });
const data = await res.json(); const data = await res.json();
if (data.task_id) { if (data.task_id) {
fetchTasks(); fetchTasks();
@@ -52,7 +52,7 @@ document.addEventListener("DOMContentLoaded", () => {
async function fetchTasks() { async function fetchTasks() {
try { try {
const res = await fetch("/api/tasks"); const res = await fetch("api/tasks");
const tasks = await res.json(); const tasks = await res.json();
renderTasks(tasks); renderTasks(tasks);
} catch (err) { } catch (err) {
@@ -87,7 +87,7 @@ document.addEventListener("DOMContentLoaded", () => {
async function fetchHistory() { async function fetchHistory() {
try { try {
const res = await fetch("/api/history"); const res = await fetch("api/history");
const data = await res.json(); const data = await res.json();
if (tracksCount) tracksCount.textContent = `Загружено: ${data.total || 0}`; if (tracksCount) tracksCount.textContent = `Загружено: ${data.total || 0}`;
renderHistory(data.tracks || []); renderHistory(data.tracks || []);
+2 -2
View File
@@ -4,7 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Navidrome Music Sync</title> <title>Navidrome Music Sync</title>
<link rel="stylesheet" href="/static/style.css"> <link rel="stylesheet" href="static/style.css">
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
@@ -83,6 +83,6 @@
</footer> </footer>
</div> </div>
<script src="/static/app.js"></script> <script src="static/app.js"></script>
</body> </body>
</html> </html>