mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-03-30 13:45:19 +00:00
### Fixed (This should be backported to 0.25.22 if the beta phase is prolonged) - No longer larger files will not create a chunks during preparing `Reset Synchronisation on This Device`. ### Behaviour changes - Setup wizard is now more `goal-oriented`. Brand-new screens are introduced. - `Fetch everything` and `Rebuild everything` is now `Reset Synchronisation on This Device` and `Overwrite Server Data with This Device's Files`. - Remote configuration and E2EE settings are now separated to each modal dialogue. - Peer-to-Peer settings is also separated into its own modal dialogue. - Setup-URI, and Report for the Issue are now not copied to clipboard automatically. Instead, there are copy dialogue and buttons to copy them explicitly. - No longer optional features are introduced during the setup or `Reset Synchronisation on This Device`, `Overwrite Server Data with This Device's Files`. - We cannot preform `Fetch everything` and `Rebuild everything` (Removed, so the old name) without restarting Obsidian now. ### Miscellaneous - Setup QR Code generation is separated into a src/lib/src/API/processSetting.ts file. Please use it as a subrepository if you want to generate QR codes in your own application. - Setup-URI is also separated into a src/lib/src/API/processSetting.ts - Some direct access to web-APIs are now wrapped into the services layer. ### Dependency updates - Many dependencies are updated. Please see `package.json`. - As upgrading TypeScript, Fixed many UInt8Array<ArrayBuffer> and Uint8Array type mismatches.
79 lines
3.2 KiB
TypeScript
79 lines
3.2 KiB
TypeScript
import { escapeStringToHTML } from "octagonal-wheels/string";
|
|
import { E2EEAlgorithmNames, type ObsidianLiveSyncSettings } from "../../../lib/src/common/types";
|
|
import {
|
|
pickCouchDBSyncSettings,
|
|
pickBucketSyncSettings,
|
|
pickP2PSyncSettings,
|
|
pickEncryptionSettings,
|
|
} from "../../../lib/src/common/utils";
|
|
import { getConfig, type AllSettingItemKey } from "./settingConstants";
|
|
|
|
/**
|
|
* Generates a summary of P2P configuration settings
|
|
* @param setting Settings object
|
|
* @param additional Additional summary information to include
|
|
* @param showAdvanced Whether to include advanced settings
|
|
* @returns Summary object
|
|
*/
|
|
export function getP2PConfigSummary(
|
|
setting: ObsidianLiveSyncSettings,
|
|
additional: Record<string, string> = {},
|
|
showAdvanced = false
|
|
) {
|
|
const settingTable: Partial<ObsidianLiveSyncSettings> = pickP2PSyncSettings(setting);
|
|
return { ...getSummaryFromPartialSettings({ ...settingTable }, showAdvanced), ...additional };
|
|
}
|
|
/**
|
|
* Generates a summary of Object Storage configuration settings
|
|
* @param setting Settings object
|
|
* @param showAdvanced Whether to include advanced settings
|
|
* @returns Summary object
|
|
*/
|
|
export function getBucketConfigSummary(setting: ObsidianLiveSyncSettings, showAdvanced = false) {
|
|
const settingTable: Partial<ObsidianLiveSyncSettings> = pickBucketSyncSettings(setting);
|
|
return getSummaryFromPartialSettings(settingTable, showAdvanced);
|
|
}
|
|
/**
|
|
* Generates a summary of CouchDB configuration settings
|
|
* @param setting Settings object
|
|
* @param showAdvanced Whether to include advanced settings
|
|
* @returns Summary object
|
|
*/
|
|
export function getCouchDBConfigSummary(setting: ObsidianLiveSyncSettings, showAdvanced = false) {
|
|
const settingTable: Partial<ObsidianLiveSyncSettings> = pickCouchDBSyncSettings(setting);
|
|
return getSummaryFromPartialSettings(settingTable, showAdvanced);
|
|
}
|
|
|
|
/**
|
|
* Generates a summary of E2EE configuration settings
|
|
* @param setting Settings object
|
|
* @param showAdvanced Whether to include advanced settings
|
|
* @returns Summary object
|
|
*/
|
|
export function getE2EEConfigSummary(setting: ObsidianLiveSyncSettings, showAdvanced = false) {
|
|
const settingTable: Partial<ObsidianLiveSyncSettings> = pickEncryptionSettings(setting);
|
|
return getSummaryFromPartialSettings(settingTable, showAdvanced);
|
|
}
|
|
|
|
/**
|
|
* Converts partial settings into a summary object
|
|
* @param setting Partial settings object
|
|
* @param showAdvanced Whether to include advanced settings
|
|
* @returns Summary object
|
|
*/
|
|
export function getSummaryFromPartialSettings(setting: Partial<ObsidianLiveSyncSettings>, showAdvanced = false) {
|
|
const outputSummary: Record<string, string> = {};
|
|
for (const key of Object.keys(setting) as (keyof ObsidianLiveSyncSettings)[]) {
|
|
const config = getConfig(key as AllSettingItemKey);
|
|
if (!config) continue;
|
|
if (config.isAdvanced && !showAdvanced) continue;
|
|
const value =
|
|
key != "E2EEAlgorithm"
|
|
? `${setting[key]}`
|
|
: E2EEAlgorithmNames[`${setting[key]}` as keyof typeof E2EEAlgorithmNames];
|
|
const displayValue = config.isHidden ? "•".repeat(value.length) : escapeStringToHTML(value);
|
|
outputSummary[config.name] = displayValue;
|
|
}
|
|
return outputSummary;
|
|
}
|