Add build-vault-url helper. Rewrite fetch-controller and websocket-manager (plus their tests). Update server-config and sync-service to consume the new error types and the regenerated API types from previous chunks.
8 lines
416 B
TypeScript
8 lines
416 B
TypeScript
import type { Settings } from "../persistence/settings";
|
|
|
|
export function buildVaultUrl(settings: Settings, path: string): string {
|
|
const { vaultName, remoteUri } = settings.getSettings();
|
|
const remoteUriWithoutTrailingSlash = remoteUri.replace(/\/+$/, "");
|
|
const encodedVaultName = encodeURIComponent(vaultName.trim());
|
|
return `${remoteUriWithoutTrailingSlash}/vaults/${encodedVaultName}${path}`;
|
|
}
|