Allow editing node publicStreamUrl in admin.
Helps fix typos like node01 vs node1 without re-enrolling. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
974b3124d0
commit
dcc10fc7d3
1 changed files with 20 additions and 3 deletions
|
|
@ -29,13 +29,14 @@ export default function NodesPage() {
|
||||||
const [enrollName, setEnrollName] = useState("");
|
const [enrollName, setEnrollName] = useState("");
|
||||||
const [enrollLocation, setEnrollLocation] = useState("");
|
const [enrollLocation, setEnrollLocation] = useState("");
|
||||||
const [enrollToken, setEnrollToken] = useState("");
|
const [enrollToken, setEnrollToken] = useState("");
|
||||||
const [publicUrl, setPublicUrl] = useState("https://node01.vonas.nl");
|
const [publicUrl, setPublicUrl] = useState("https://node1.example.com");
|
||||||
const [moviesPath, setMoviesPath] = useState("/mnt/user/movies");
|
const [moviesPath, setMoviesPath] = useState("/mnt/user/movies");
|
||||||
const [seriesPath, setSeriesPath] = useState("/mnt/user/series");
|
const [seriesPath, setSeriesPath] = useState("/mnt/user/series");
|
||||||
const [copied, setCopied] = useState(false);
|
const [copied, setCopied] = useState(false);
|
||||||
const [editId, setEditId] = useState<string | null>(null);
|
const [editId, setEditId] = useState<string | null>(null);
|
||||||
const [editName, setEditName] = useState("");
|
const [editName, setEditName] = useState("");
|
||||||
const [editLocation, setEditLocation] = useState("");
|
const [editLocation, setEditLocation] = useState("");
|
||||||
|
const [editPublicUrl, setEditPublicUrl] = useState("");
|
||||||
|
|
||||||
function loadNodes() {
|
function loadNodes() {
|
||||||
fetch("/api/v1/admin/nodes", { credentials: "include" })
|
fetch("/api/v1/admin/nodes", { credentials: "include" })
|
||||||
|
|
@ -114,7 +115,11 @@ export default function NodesPage() {
|
||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ name: editName, location: editLocation }),
|
body: JSON.stringify({
|
||||||
|
name: editName,
|
||||||
|
location: editLocation,
|
||||||
|
publicStreamUrl: editPublicUrl.trim().replace(/\/$/, ""),
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
setEditId(null);
|
setEditId(null);
|
||||||
loadNodes();
|
loadNodes();
|
||||||
|
|
@ -150,7 +155,7 @@ export default function NodesPage() {
|
||||||
</div>
|
</div>
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label>Publieke node-URL (NPM)</label>
|
<label>Publieke node-URL (NPM)</label>
|
||||||
<input value={publicUrl} onChange={(e) => setPublicUrl(e.target.value)} placeholder="https://node01.vonas.nl" />
|
<input value={publicUrl} onChange={(e) => setPublicUrl(e.target.value)} placeholder="https://node1.example.com" />
|
||||||
</div>
|
</div>
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label>Unraid films-pad</label>
|
<label>Unraid films-pad</label>
|
||||||
|
|
@ -194,6 +199,17 @@ export default function NodesPage() {
|
||||||
<label>Locatie</label>
|
<label>Locatie</label>
|
||||||
<input value={editLocation} onChange={(e) => setEditLocation(e.target.value)} />
|
<input value={editLocation} onChange={(e) => setEditLocation(e.target.value)} />
|
||||||
</div>
|
</div>
|
||||||
|
<div className="form-group">
|
||||||
|
<label>Publieke stream-URL (NPM)</label>
|
||||||
|
<input
|
||||||
|
value={editPublicUrl}
|
||||||
|
onChange={(e) => setEditPublicUrl(e.target.value)}
|
||||||
|
placeholder="https://node1.example.com"
|
||||||
|
/>
|
||||||
|
<p style={{ color: "#a1a1aa", fontSize: "0.8rem", marginTop: 6 }}>
|
||||||
|
Zet dit ook in de node-container als MEDIA_NODE_PUBLIC_URL, anders overschrijft de volgende HELLO dit weer.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<div style={{ display: "flex", gap: 8 }}>
|
<div style={{ display: "flex", gap: 8 }}>
|
||||||
<button onClick={saveEdit}>Opslaan</button>
|
<button onClick={saveEdit}>Opslaan</button>
|
||||||
<button onClick={() => setEditId(null)} style={{ background: "#374151" }}>Annuleren</button>
|
<button onClick={() => setEditId(null)} style={{ background: "#374151" }}>Annuleren</button>
|
||||||
|
|
@ -234,6 +250,7 @@ export default function NodesPage() {
|
||||||
setEditId(node.id);
|
setEditId(node.id);
|
||||||
setEditName(node.name);
|
setEditName(node.name);
|
||||||
setEditLocation(node.location ?? "");
|
setEditLocation(node.location ?? "");
|
||||||
|
setEditPublicUrl(node.publicStreamUrl);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Edit
|
Edit
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue