mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-09-29 14:02:31 +00:00
Use profile storage for TURN source settings
This commit is contained in:
@@ -72,14 +72,3 @@ export function validateIceServerSourceConfiguration(
|
||||
export function getIceServerSourceDefinition(id: string): IceServerSourceDefinition | undefined {
|
||||
return iceServerSourceDefinitions.find((definition) => definition.id === id);
|
||||
}
|
||||
|
||||
/** Validate the selected settings projection, including an unavailable encrypted source. */
|
||||
export function validateTurnSettings(settings: {
|
||||
readonly P2P_iceServerSource?: IceServerSourceDescriptorLike | null;
|
||||
readonly encryptedP2PIceServerSource?: string;
|
||||
}): string | undefined {
|
||||
if (!settings.P2P_iceServerSource && settings.encryptedP2PIceServerSource) {
|
||||
return "TURN configuration could not be decrypted.";
|
||||
}
|
||||
return validateIceServerSourceConfiguration(settings.P2P_iceServerSource);
|
||||
}
|
||||
|
||||
@@ -2,17 +2,9 @@ import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
iceServerSourceDefinitions,
|
||||
validateIceServerSourceConfiguration,
|
||||
validateTurnSettings,
|
||||
} from "./iceServerSources";
|
||||
|
||||
describe("ICE server source catalogue", () => {
|
||||
it("blocks an unavailable encrypted source instead of presenting manual settings as valid", () => {
|
||||
expect(validateTurnSettings({ encryptedP2PIceServerSource: "private-ciphertext" })).toBe(
|
||||
"TURN configuration could not be decrypted."
|
||||
);
|
||||
expect(validateTurnSettings({})).toBeUndefined();
|
||||
});
|
||||
|
||||
it("describes the Cloudflare fields without owning manual TURN fields", () => {
|
||||
expect(iceServerSourceDefinitions).toEqual([
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user