stale
This commit is contained in:
parent
5f0f478668
commit
0abb87eb5f
6 changed files with 25 additions and 39 deletions
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
async function fetchData() {
|
||||
try {
|
||||
const res = await fetch("http://localhost:8002/api/status");
|
||||
const res = await fetch("/api/status");
|
||||
if (!res.ok) throw new Error("Failed to fetch status");
|
||||
const data = await res.json();
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
if (!confirm("Start full library scan?")) return;
|
||||
scanning = true;
|
||||
try {
|
||||
await fetch("http://localhost:8002/api/scan", { method: "POST" });
|
||||
await fetch("/api/scan", { method: "POST" });
|
||||
dispatch("scan");
|
||||
// Reset scanning state after a bit since it's async background
|
||||
setTimeout(() => (scanning = false), 2000);
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
checkingOrphans = true;
|
||||
orphanResult = "Measuring quantum fluctuations (scanning)...";
|
||||
try {
|
||||
const res = await fetch("http://localhost:8002/api/check-orphans", {
|
||||
const res = await fetch("/api/check-orphans", {
|
||||
method: "POST",
|
||||
});
|
||||
const data = await res.json();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<script lang="ts">
|
||||
import { onMount, onDestroy } from "svelte";
|
||||
|
||||
export let endpoint = "http://localhost:8002/api/logs";
|
||||
export let endpoint = "/api/logs";
|
||||
export let title = "SYSTEM_LOGS";
|
||||
|
||||
let logs: string[] = [];
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
async function startScan() {
|
||||
scanning = true;
|
||||
try {
|
||||
await fetch("http://localhost:8002/api/recovery/scan", {
|
||||
await fetch("/api/recovery/scan", {
|
||||
method: "POST",
|
||||
});
|
||||
pollResults();
|
||||
|
|
@ -25,9 +25,7 @@
|
|||
if (pollInterval) clearInterval(pollInterval);
|
||||
pollInterval = setInterval(async () => {
|
||||
try {
|
||||
const res = await fetch(
|
||||
"http://localhost:8002/api/recovery/poll",
|
||||
);
|
||||
const res = await fetch("/api/recovery/poll");
|
||||
const data = await res.json();
|
||||
status = data.status;
|
||||
if (data.status === "done") {
|
||||
|
|
@ -53,14 +51,11 @@
|
|||
// Implementation mirrors existing JS logic
|
||||
if (!isBatch && !confirm("Recover this file?")) return;
|
||||
try {
|
||||
const res = await fetch(
|
||||
"http://localhost:8002/api/recovery/start",
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({ filepath: path }),
|
||||
headers: { "Content-Type": "application/json" },
|
||||
},
|
||||
);
|
||||
const res = await fetch("/api/recovery/start", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ filepath: path }),
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
const d = await res.json();
|
||||
if (!isBatch) {
|
||||
alert(d.message);
|
||||
|
|
@ -74,14 +69,11 @@
|
|||
async function deleteFile(path: string) {
|
||||
if (!confirm("Delete file? This cannot be undone.")) return;
|
||||
try {
|
||||
const res = await fetch(
|
||||
"http://localhost:8002/api/recovery/delete",
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({ filepath: path }),
|
||||
headers: { "Content-Type": "application/json" },
|
||||
},
|
||||
);
|
||||
const res = await fetch("/api/recovery/delete", {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ filepath: path }),
|
||||
headers: { "Content-Type": "application/json" },
|
||||
});
|
||||
const d = await res.json();
|
||||
if (d.success) {
|
||||
alert("Deleted.");
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
async function fetchStats() {
|
||||
try {
|
||||
const res = await fetch("http://localhost:8002/api/status");
|
||||
const res = await fetch("/api/status");
|
||||
if (!res.ok) return;
|
||||
const data = await res.json();
|
||||
stats = {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
loading = true;
|
||||
try {
|
||||
const res = await fetch(
|
||||
`http://localhost:8002/api/transcode/videos?page=${p}&per_page=100`,
|
||||
`/api/transcode/videos?page=${p}&per_page=100`,
|
||||
);
|
||||
const data = await res.json();
|
||||
videos = data.videos || [];
|
||||
|
|
@ -29,14 +29,11 @@
|
|||
async function startTranscode(filepath: string) {
|
||||
if (!confirm("Start transcoding?")) return;
|
||||
try {
|
||||
const res = await fetch(
|
||||
"http://localhost:8002/api/transcode/start",
|
||||
{
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ filepath }),
|
||||
},
|
||||
);
|
||||
const res = await fetch("/api/transcode/start", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ filepath }),
|
||||
});
|
||||
const d = await res.json();
|
||||
alert(d.message);
|
||||
} catch (e) {
|
||||
|
|
@ -49,7 +46,7 @@
|
|||
if (!confirm("Scan for missing videos?")) return;
|
||||
loading = true;
|
||||
try {
|
||||
const res = await fetch("http://localhost:8002/api/check-orphans", {
|
||||
const res = await fetch("/api/check-orphans", {
|
||||
method: "POST",
|
||||
});
|
||||
const d = await res.json();
|
||||
|
|
@ -179,10 +176,7 @@
|
|||
</div>
|
||||
|
||||
<div class="lg:col-span-1">
|
||||
<LogViewer
|
||||
endpoint="http://localhost:8002/api/transcode/logs"
|
||||
title="TRANSCODE_LOGS"
|
||||
/>
|
||||
<LogViewer endpoint="/api/transcode/logs" title="TRANSCODE_LOGS" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue