fix(frontend): use relative URLs to support reverse proxy subpath (/sync/)
This commit is contained in:
1 parent
b36445d203
commit
c098376aa4
2 files changed
+6
-6
No files matched your search
+4
-4
@@ -19,7 +19,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
if (!url) return;
|
||||
|
||||
try {
|
||||
const res = await fetch("/api/download", {
|
||||
const res = await fetch("api/download", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ url })
|
||||
@@ -40,7 +40,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
syncLikesBtn.addEventListener("click", async () => {
|
||||
if (!confirm("Запустить синхронизацию плейлиста «Мне нравится» из Яндекс Музыки?")) return;
|
||||
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();
|
||||
if (data.task_id) {
|
||||
fetchTasks();
|
||||
@@ -52,7 +52,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
async function fetchTasks() {
|
||||
try {
|
||||
const res = await fetch("/api/tasks");
|
||||
const res = await fetch("api/tasks");
|
||||
const tasks = await res.json();
|
||||
renderTasks(tasks);
|
||||
} catch (err) {
|
||||
@@ -87,7 +87,7 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
async function fetchHistory() {
|
||||
try {
|
||||
const res = await fetch("/api/history");
|
||||
const res = await fetch("api/history");
|
||||
const data = await res.json();
|
||||
if (tracksCount) tracksCount.textContent = `Загружено: ${data.total || 0}`;
|
||||
renderHistory(data.tracks || []);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<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.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||
@@ -83,6 +83,6 @@
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<script src="/static/app.js"></script>
|
||||
<script src="static/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user