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