fix: trim whitespace from network sync URL and API key; clarify source URL format in UI
Copy-paste often adds trailing whitespace that breaks the API key comparison. Updated placeholder and description to show the correct URL format (no port number). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -574,7 +574,12 @@ router.get("/network-sync-config", (req, res) => {
|
|||||||
router.put("/network-sync-config", (req: Request, res: Response): any => {
|
router.put("/network-sync-config", (req: Request, res: Response): any => {
|
||||||
if (!req.user?.id) return res.status(401).json({ error: "Unauthorized" });
|
if (!req.user?.id) return res.status(401).json({ error: "Unauthorized" });
|
||||||
const { enabled, syncHour, sourceUrl, apiKey } = req.body;
|
const { enabled, syncHour, sourceUrl, apiKey } = req.body;
|
||||||
const updated = writeSyncConfig({ enabled, syncHour, sourceUrl, apiKey });
|
const updated = writeSyncConfig({
|
||||||
|
enabled,
|
||||||
|
syncHour,
|
||||||
|
sourceUrl: typeof sourceUrl === "string" ? sourceUrl.trim() : sourceUrl,
|
||||||
|
apiKey: typeof apiKey === "string" ? apiKey.trim() : apiKey,
|
||||||
|
});
|
||||||
res.json(updated);
|
res.json(updated);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -92,8 +92,8 @@ export function NetworkBackupManager() {
|
|||||||
const res = await apiRequest("PUT", "/api/database-management/network-sync-config", {
|
const res = await apiRequest("PUT", "/api/database-management/network-sync-config", {
|
||||||
enabled,
|
enabled,
|
||||||
syncHour,
|
syncHour,
|
||||||
sourceUrl,
|
sourceUrl: sourceUrl.trim(),
|
||||||
apiKey: receiverApiKey,
|
apiKey: receiverApiKey.trim(),
|
||||||
});
|
});
|
||||||
return res.json();
|
return res.json();
|
||||||
},
|
},
|
||||||
@@ -191,7 +191,7 @@ export function NetworkBackupManager() {
|
|||||||
<p className="text-xs text-gray-500">
|
<p className="text-xs text-gray-500">
|
||||||
Configure this machine to pull a fresh copy of the database and all uploaded
|
Configure this machine to pull a fresh copy of the database and all uploaded
|
||||||
files (patient photos, cloud storage, documents) from another PC at a scheduled
|
files (patient photos, cloud storage, documents) from another PC at a scheduled
|
||||||
time each day. Enter the source PC's local IP address and its Backup Key.
|
time each day. Enter the source PC's URL (e.g. http://192.168.0.94 — no port number) and the Backup Key shown in the source PC's Network Backup section.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{/* Enable toggle + time picker on same row */}
|
{/* Enable toggle + time picker on same row */}
|
||||||
@@ -229,7 +229,7 @@ export function NetworkBackupManager() {
|
|||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<label className="text-xs font-medium text-gray-600">Source PC URL</label>
|
<label className="text-xs font-medium text-gray-600">Source PC URL</label>
|
||||||
<Input
|
<Input
|
||||||
placeholder="http://192.168.0.94:3000"
|
placeholder="http://192.168.0.94"
|
||||||
value={sourceUrl}
|
value={sourceUrl}
|
||||||
onChange={(e) => setSourceUrl(e.target.value)}
|
onChange={(e) => setSourceUrl(e.target.value)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user