run prettier and update lib

This commit is contained in:
vorotamoroz
2025-02-12 03:44:46 +00:00
parent 7b385aab9e
commit 45ceca8bb6
6 changed files with 765 additions and 663 deletions

Submodule src/lib updated: 90ace6de16...d94133d964

View File

@@ -93,9 +93,12 @@ export class ModuleCheckRemoteSize extends AbstractModule implements ICoreModule
LOG_LEVEL_INFO LOG_LEVEL_INFO
); );
} else { } else {
this._log($msg("moduleCheckRemoteSize.logCurrentStorageSize", { this._log(
$msg("moduleCheckRemoteSize.logCurrentStorageSize", {
measuredSize: sizeToHumanReadable(estimatedSize), measuredSize: sizeToHumanReadable(estimatedSize),
}), LOG_LEVEL_INFO); }),
LOG_LEVEL_INFO
);
} }
} }
} }

View File

@@ -13,7 +13,7 @@ import { $msg } from "src/lib/src/common/i18n.ts";
export class ModuleMigration extends AbstractModule implements ICoreModule { export class ModuleMigration extends AbstractModule implements ICoreModule {
async migrateDisableBulkSend() { async migrateDisableBulkSend() {
if (this.settings.sendChunksBulk) { if (this.settings.sendChunksBulk) {
this._log($msg('moduleMigration.logBulkSendCorrupted'), LOG_LEVEL_NOTICE); this._log($msg("moduleMigration.logBulkSendCorrupted"), LOG_LEVEL_NOTICE);
this.settings.sendChunksBulk = false; this.settings.sendChunksBulk = false;
this.settings.sendChunksBulkMaxSize = 1; this.settings.sendChunksBulkMaxSize = 1;
await this.saveSettings(); await this.saveSettings();
@@ -24,10 +24,13 @@ export class ModuleMigration extends AbstractModule implements ICoreModule {
const current = SETTING_VERSION_SUPPORT_CASE_INSENSITIVE; const current = SETTING_VERSION_SUPPORT_CASE_INSENSITIVE;
// Check each migrations(old -> current) // Check each migrations(old -> current)
if (!(await this.migrateToCaseInsensitive(old, current))) { if (!(await this.migrateToCaseInsensitive(old, current))) {
this._log($msg('moduleMigration.logMigrationFailed', { this._log(
$msg("moduleMigration.logMigrationFailed", {
old: old.toString(), old: old.toString(),
current: current.toString() current: current.toString(),
}), LOG_LEVEL_NOTICE); }),
LOG_LEVEL_NOTICE
);
return; return;
} }
} }
@@ -67,10 +70,10 @@ export class ModuleMigration extends AbstractModule implements ICoreModule {
remoteChecked = true; remoteChecked = true;
} }
} else { } else {
this._log($msg('moduleMigration.logFetchRemoteTweakFailed'), LOG_LEVEL_INFO); this._log($msg("moduleMigration.logFetchRemoteTweakFailed"), LOG_LEVEL_INFO);
} }
} catch (ex) { } catch (ex) {
this._log($msg('moduleMigration.logRemoteTweakUnavailable'), LOG_LEVEL_INFO); this._log($msg("moduleMigration.logRemoteTweakUnavailable"), LOG_LEVEL_INFO);
this._log(ex, LOG_LEVEL_VERBOSE); this._log(ex, LOG_LEVEL_VERBOSE);
} }
@@ -81,18 +84,21 @@ export class ModuleMigration extends AbstractModule implements ICoreModule {
this.settings.handleFilenameCaseSensitive = true; this.settings.handleFilenameCaseSensitive = true;
this.settings.doNotUseFixedRevisionForChunks = true; this.settings.doNotUseFixedRevisionForChunks = true;
this.settings.settingVersion = SETTING_VERSION_SUPPORT_CASE_INSENSITIVE; this.settings.settingVersion = SETTING_VERSION_SUPPORT_CASE_INSENSITIVE;
this._log($msg('moduleMigration.logMigratedSameBehaviour', { this._log(
current: current.toString() $msg("moduleMigration.logMigratedSameBehaviour", {
}), LOG_LEVEL_INFO); current: current.toString(),
}),
LOG_LEVEL_INFO
);
await this.saveSettings(); await this.saveSettings();
return true; return true;
} }
const message = $msg('moduleMigration.msgFetchRemoteAgain'); const message = $msg("moduleMigration.msgFetchRemoteAgain");
const OPTION_FETCH = $msg('moduleMigration.optionYesFetchAgain'); const OPTION_FETCH = $msg("moduleMigration.optionYesFetchAgain");
const DISMISS = $msg('moduleMigration.optionNoAskAgain'); const DISMISS = $msg("moduleMigration.optionNoAskAgain");
const options = [OPTION_FETCH, DISMISS]; const options = [OPTION_FETCH, DISMISS];
const ret = await this.core.confirm.confirmWithMessage( const ret = await this.core.confirm.confirmWithMessage(
$msg('moduleMigration.titleCaseSensitivity'), $msg("moduleMigration.titleCaseSensitivity"),
message, message,
options, options,
DISMISS, DISMISS,
@@ -107,7 +113,7 @@ export class ModuleMigration extends AbstractModule implements ICoreModule {
await this.core.rebuilder.scheduleFetch(); await this.core.rebuilder.scheduleFetch();
return; return;
} catch (ex) { } catch (ex) {
this._log($msg('moduleMigration.logRedflag2CreationFail'), LOG_LEVEL_VERBOSE); this._log($msg("moduleMigration.logRedflag2CreationFail"), LOG_LEVEL_VERBOSE);
this._log(ex, LOG_LEVEL_VERBOSE); this._log(ex, LOG_LEVEL_VERBOSE);
} }
return false; return false;
@@ -116,19 +122,25 @@ export class ModuleMigration extends AbstractModule implements ICoreModule {
} }
} }
const ENABLE_BOTH = $msg('moduleMigration.optionEnableBoth'); const ENABLE_BOTH = $msg("moduleMigration.optionEnableBoth");
const ENABLE_FILENAME_CASE_INSENSITIVE = $msg('moduleMigration.optionEnableFilenameCaseInsensitive'); const ENABLE_FILENAME_CASE_INSENSITIVE = $msg("moduleMigration.optionEnableFilenameCaseInsensitive");
const ENABLE_FIXED_REVISION_FOR_CHUNKS = $msg('moduleMigration.optionEnableFixedRevisionForChunks'); const ENABLE_FIXED_REVISION_FOR_CHUNKS = $msg("moduleMigration.optionEnableFixedRevisionForChunks");
const ADJUST_TO_REMOTE = $msg('moduleMigration.optionAdjustRemote'); const ADJUST_TO_REMOTE = $msg("moduleMigration.optionAdjustRemote");
const KEEP = $msg('moduleMigration.optionKeepPreviousBehaviour'); const KEEP = $msg("moduleMigration.optionKeepPreviousBehaviour");
const DISMISS = $msg('moduleMigration.optionDecideLater'); const DISMISS = $msg("moduleMigration.optionDecideLater");
const message = $msg('moduleMigration.msgSinceV02321'); const message = $msg("moduleMigration.msgSinceV02321");
const options = [ENABLE_BOTH, ENABLE_FILENAME_CASE_INSENSITIVE, ENABLE_FIXED_REVISION_FOR_CHUNKS]; const options = [ENABLE_BOTH, ENABLE_FILENAME_CASE_INSENSITIVE, ENABLE_FIXED_REVISION_FOR_CHUNKS];
if (remoteChecked) { if (remoteChecked) {
options.push(ADJUST_TO_REMOTE); options.push(ADJUST_TO_REMOTE);
} }
options.push(KEEP, DISMISS); options.push(KEEP, DISMISS);
const ret = await this.core.confirm.confirmWithMessage($msg('moduleMigration.titleCaseSensitivity'), message, options, DISMISS, 40); const ret = await this.core.confirm.confirmWithMessage(
$msg("moduleMigration.titleCaseSensitivity"),
message,
options,
DISMISS,
40
);
console.dir(ret); console.dir(ret);
switch (ret) { switch (ret) {
case ENABLE_BOTH: case ENABLE_BOTH:
@@ -160,14 +172,14 @@ export class ModuleMigration extends AbstractModule implements ICoreModule {
} }
async initialMessage() { async initialMessage() {
const message = $msg('moduleMigration.msgInitialSetup', { const message = $msg("moduleMigration.msgInitialSetup", {
URI_DOC: $msg('moduleMigration.docUri'), URI_DOC: $msg("moduleMigration.docUri"),
}); });
const USE_SETUP = $msg('moduleMigration.optionHaveSetupUri'); const USE_SETUP = $msg("moduleMigration.optionHaveSetupUri");
const NEXT = $msg('moduleMigration.optionNoSetupUri'); const NEXT = $msg("moduleMigration.optionNoSetupUri");
const ret = await this.core.confirm.askSelectStringDialogue(message, [USE_SETUP, NEXT], { const ret = await this.core.confirm.askSelectStringDialogue(message, [USE_SETUP, NEXT], {
title: $msg('moduleMigration.titleWelcome'), title: $msg("moduleMigration.titleWelcome"),
defaultAction: USE_SETUP, defaultAction: USE_SETUP,
}); });
if (ret === USE_SETUP) { if (ret === USE_SETUP) {
@@ -180,13 +192,13 @@ export class ModuleMigration extends AbstractModule implements ICoreModule {
} }
async askAgainForSetupURI() { async askAgainForSetupURI() {
const message = $msg('moduleMigration.msgRecommendSetupUri', { URI_DOC: $msg('moduleMigration.docUri') }); const message = $msg("moduleMigration.msgRecommendSetupUri", { URI_DOC: $msg("moduleMigration.docUri") });
const USE_MINIMAL = $msg('moduleMigration.optionSetupWizard'); const USE_MINIMAL = $msg("moduleMigration.optionSetupWizard");
const USE_SETUP = $msg('moduleMigration.optionManualSetup'); const USE_SETUP = $msg("moduleMigration.optionManualSetup");
const NEXT = $msg('moduleMigration.optionRemindNextLaunch'); const NEXT = $msg("moduleMigration.optionRemindNextLaunch");
const ret = await this.core.confirm.askSelectStringDialogue(message, [USE_MINIMAL, USE_SETUP, NEXT], { const ret = await this.core.confirm.askSelectStringDialogue(message, [USE_MINIMAL, USE_SETUP, NEXT], {
title: $msg('moduleMigration.titleRecommendSetupUri'), title: $msg("moduleMigration.titleRecommendSetupUri"),
defaultAction: USE_MINIMAL, defaultAction: USE_MINIMAL,
}); });
if (ret === USE_MINIMAL) { if (ret === USE_MINIMAL) {
@@ -204,7 +216,7 @@ export class ModuleMigration extends AbstractModule implements ICoreModule {
async $everyOnFirstInitialize(): Promise<boolean> { async $everyOnFirstInitialize(): Promise<boolean> {
if (!this.localDatabase.isReady) { if (!this.localDatabase.isReady) {
this._log($msg('moduleMigration.logLocalDatabaseNotReady'), LOG_LEVEL_NOTICE); this._log($msg("moduleMigration.logLocalDatabaseNotReady"), LOG_LEVEL_NOTICE);
return false; return false;
} }
if (this.settings.isConfigured) { if (this.settings.isConfigured) {
@@ -214,7 +226,7 @@ export class ModuleMigration extends AbstractModule implements ICoreModule {
if (!this.settings.isConfigured) { if (!this.settings.isConfigured) {
// Case sensitivity // Case sensitivity
if (!(await this.initialMessage()) || !(await this.askAgainForSetupURI())) { if (!(await this.initialMessage()) || !(await this.askAgainForSetupURI())) {
this._log($msg('moduleMigration.logSetupCancelled'), LOG_LEVEL_NOTICE); this._log($msg("moduleMigration.logSetupCancelled"), LOG_LEVEL_NOTICE);
return false; return false;
} }
} }

View File

@@ -218,13 +218,10 @@ export class LiveSyncSetting extends Setting {
await this.commitValue(value); await this.commitValue(value);
} else { } else {
this.setTooltip( this.setTooltip(
$msg( $msg("liveSyncSetting.valueShouldBeInRange", {
"liveSyncSetting.valueShouldBeInRange",
{
min: opt.clampMin?.toString() || "~", min: opt.clampMin?.toString() || "~",
max: opt.clampMax?.toString() || "~", max: opt.clampMax?.toString() || "~",
} })
)
); );
text.inputEl.toggleClass("sls-item-invalid-value", true); text.inputEl.toggleClass("sls-item-invalid-value", true);
lastError = true; lastError = true;
@@ -373,7 +370,9 @@ export class LiveSyncSetting extends Setting {
if (this.holdValue && this.selfKey) { if (this.holdValue && this.selfKey) {
const isDirty = LiveSyncSetting.env.isDirty(this.selfKey); const isDirty = LiveSyncSetting.env.isDirty(this.selfKey);
const alt = isDirty const alt = isDirty
? $msg("liveSyncSetting.originalValue", { value: String(LiveSyncSetting.env.initialSettings?.[this.selfKey] ?? "") }) ? $msg("liveSyncSetting.originalValue", {
value: String(LiveSyncSetting.env.initialSettings?.[this.selfKey] ?? ""),
})
: ""; : "";
this.controlEl.toggleClass("sls-item-dirty", isDirty); this.controlEl.toggleClass("sls-item-dirty", isDirty);
if (!this.hasPassword) { if (!this.hasPassword) {

View File

@@ -384,7 +384,12 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
const status = await replicator.getRemoteStatus(trialSetting); const status = await replicator.getRemoteStatus(trialSetting);
if (status) { if (status) {
if (status.estimatedSize) { if (status.estimatedSize) {
Logger($msg("obsidianLiveSyncSettingTab.logEstimatedSize", { size: sizeToHumanReadable(status.estimatedSize) }), LOG_LEVEL_NOTICE); Logger(
$msg("obsidianLiveSyncSettingTab.logEstimatedSize", {
size: sizeToHumanReadable(status.estimatedSize),
}),
LOG_LEVEL_NOTICE
);
} }
} }
} }
@@ -464,7 +469,9 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
// And modified. // And modified.
this.plugin.confirm.askInPopup( this.plugin.confirm.askInPopup(
`config-reloaded-${k}`, `config-reloaded-${k}`,
$msg("obsidianLiveSyncSettingTab.msgSettingModified", { setting: getConfName(k as AllSettingItemKey) }), $msg("obsidianLiveSyncSettingTab.msgSettingModified", {
setting: getConfName(k as AllSettingItemKey),
}),
(anchor) => { (anchor) => {
anchor.text = $msg("obsidianLiveSyncSettingTab.optionHere"); anchor.text = $msg("obsidianLiveSyncSettingTab.optionHere");
anchor.addEventListener("click", () => { anchor.addEventListener("click", () => {
@@ -632,9 +639,12 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
if (result == OPTION_FETCH) { if (result == OPTION_FETCH) {
if (!(await checkWorkingPassphrase())) { if (!(await checkWorkingPassphrase())) {
if ( if (
(await this.plugin.confirm.askYesNoDialog($msg("obsidianLiveSyncSettingTab.msgAreYouSureProceed"), { (await this.plugin.confirm.askYesNoDialog(
$msg("obsidianLiveSyncSettingTab.msgAreYouSureProceed"),
{
defaultOption: "No", defaultOption: "No",
})) != "yes" }
)) != "yes"
) )
return; return;
} }
@@ -664,9 +674,14 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
(el) => { (el) => {
el.addClass("wizardHidden"); el.addClass("wizardHidden");
el.createEl("label", { text: $msg("obsidianLiveSyncSettingTab.msgChangesNeedToBeApplied") }); el.createEl("label", { text: $msg("obsidianLiveSyncSettingTab.msgChangesNeedToBeApplied") });
void this.addEl(el, "button", { text: $msg("obsidianLiveSyncSettingTab.optionApply"), cls: "mod-warning" }, (buttonEl) => { void this.addEl(
el,
"button",
{ text: $msg("obsidianLiveSyncSettingTab.optionApply"), cls: "mod-warning" },
(buttonEl) => {
buttonEl.addEventListener("click", () => fireAndForget(async () => await confirmRebuild())); buttonEl.addEventListener("click", () => fireAndForget(async () => await confirmRebuild()));
}); }
);
}, },
visibleOnly(() => isNeedRebuildLocal() || isNeedRebuildRemote()) visibleOnly(() => isNeedRebuildLocal() || isNeedRebuildRemote())
); );
@@ -828,10 +843,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
// Logger($msg("obsidianLiveSyncSettingTab.logDatabaseConnected"), LOG_LEVEL_NOTICE); // Logger($msg("obsidianLiveSyncSettingTab.logDatabaseConnected"), LOG_LEVEL_NOTICE);
return true; return true;
} else { } else {
Logger( Logger($msg("obsidianLiveSyncSettingTab.logPassphraseNotCompatible"), LOG_LEVEL_NOTICE);
$msg("obsidianLiveSyncSettingTab.logPassphraseNotCompatible"),
LOG_LEVEL_NOTICE
);
return false; return false;
} }
} }
@@ -875,14 +887,15 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
}; };
// Panes // Panes
void addPane(containerEl, $msg("obsidianLiveSyncSettingTab.panelChangeLog"), "💬", 100, false).then((paneEl) => { void addPane(containerEl, $msg("obsidianLiveSyncSettingTab.panelChangeLog"), "💬", 100, false).then(
(paneEl) => {
const informationDivEl = this.createEl(paneEl, "div", { text: "" }); const informationDivEl = this.createEl(paneEl, "div", { text: "" });
const tmpDiv = createDiv(); const tmpDiv = createDiv();
// tmpDiv.addClass("sls-header-button"); // tmpDiv.addClass("sls-header-button");
tmpDiv.addClass("op-warn-info"); tmpDiv.addClass("op-warn-info");
tmpDiv.innerHTML = `<p>${$msg("obsidianLiveSyncSettingTab.msgNewVersionNote")}</p><button>${$msg("obsidianLiveSyncSettingTab.optionOkReadEverything")}</button>` tmpDiv.innerHTML = `<p>${$msg("obsidianLiveSyncSettingTab.msgNewVersionNote")}</p><button>${$msg("obsidianLiveSyncSettingTab.optionOkReadEverything")}</button>`;
if (lastVersion > (this.editingSettings?.lastReadUpdates || 0)) { if (lastVersion > (this.editingSettings?.lastReadUpdates || 0)) {
const informationButtonDiv = informationDivEl.appendChild(tmpDiv); const informationButtonDiv = informationDivEl.appendChild(tmpDiv);
informationButtonDiv.querySelector("button")?.addEventListener("click", () => { informationButtonDiv.querySelector("button")?.addEventListener("click", () => {
@@ -896,7 +909,8 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
fireAndForget(() => fireAndForget(() =>
MarkdownRenderer.render(this.plugin.app, updateInformation, informationDivEl, "/", this.plugin) MarkdownRenderer.render(this.plugin.app, updateInformation, informationDivEl, "/", this.plugin)
); );
}); }
);
void addPane(containerEl, $msg("obsidianLiveSyncSettingTab.panelSetup"), "🧙‍♂️", 110, false).then((paneEl) => { void addPane(containerEl, $msg("obsidianLiveSyncSettingTab.panelSetup"), "🧙‍♂️", 110, false).then((paneEl) => {
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleQuickSetup")).then((paneEl) => { void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleQuickSetup")).then((paneEl) => {
@@ -1077,7 +1091,8 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
void loadMarkdownPage(topPath); void loadMarkdownPage(topPath);
}); });
}); });
void addPane(containerEl, $msg("obsidianLiveSyncSettingTab.panelGeneralSettings"), "⚙️", 20, false).then((paneEl) => { void addPane(containerEl, $msg("obsidianLiveSyncSettingTab.panelGeneralSettings"), "⚙️", 20, false).then(
(paneEl) => {
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleAppearance")).then((paneEl) => { void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleAppearance")).then((paneEl) => {
const languages = Object.fromEntries([ const languages = Object.fromEntries([
["", $msg("obsidianLiveSyncSettingTab.defaultLanguage")], ["", $msg("obsidianLiveSyncSettingTab.defaultLanguage")],
@@ -1110,7 +1125,8 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
this.changeDisplay("0"); this.changeDisplay("0");
}) })
); );
}); }
);
let checkResultDiv: HTMLDivElement; let checkResultDiv: HTMLDivElement;
const checkConfig = async (checkResultDiv: HTMLDivElement | undefined) => { const checkConfig = async (checkResultDiv: HTMLDivElement | undefined) => {
Logger($msg("obsidianLiveSyncSettingTab.logCheckingDbConfig"), LOG_LEVEL_INFO); Logger($msg("obsidianLiveSyncSettingTab.logCheckingDbConfig"), LOG_LEVEL_INFO);
@@ -1159,11 +1175,17 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
value value
); );
if (res.status == 200) { if (res.status == 200) {
Logger($msg("obsidianLiveSyncSettingTab.logCouchDbConfigUpdated", { title }), LOG_LEVEL_NOTICE); Logger(
$msg("obsidianLiveSyncSettingTab.logCouchDbConfigUpdated", { title }),
LOG_LEVEL_NOTICE
);
checkResultDiv.removeChild(x); checkResultDiv.removeChild(x);
await checkConfig(checkResultDiv); await checkConfig(checkResultDiv);
} else { } else {
Logger($msg("obsidianLiveSyncSettingTab.logCouchDbConfigFail", { title }), LOG_LEVEL_NOTICE); Logger(
$msg("obsidianLiveSyncSettingTab.logCouchDbConfigFail", { title }),
LOG_LEVEL_NOTICE
);
Logger(res.text, LOG_LEVEL_VERBOSE); Logger(res.text, LOG_LEVEL_VERBOSE);
} }
}); });
@@ -1254,7 +1276,11 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
if (responseConfig?.cors?.credentials != "true") { if (responseConfig?.cors?.credentials != "true") {
isSuccessful = false; isSuccessful = false;
addResult($msg("obsidianLiveSyncSettingTab.errCorsCredentials")); addResult($msg("obsidianLiveSyncSettingTab.errCorsCredentials"));
addConfigFixButton($msg("obsidianLiveSyncSettingTab.msgSetCorsCredentials"), "cors/credentials", "true"); addConfigFixButton(
$msg("obsidianLiveSyncSettingTab.msgSetCorsCredentials"),
"cors/credentials",
"true"
);
} else { } else {
addResult($msg("obsidianLiveSyncSettingTab.okCorsCredentials")); addResult($msg("obsidianLiveSyncSettingTab.okCorsCredentials"));
} }
@@ -1329,7 +1355,8 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
return isSuccessful; return isSuccessful;
}; };
void addPane(containerEl, $msg("obsidianLiveSyncSettingTab.panelRemoteConfiguration"), "🛰️", 0, false).then((paneEl) => { void addPane(containerEl, $msg("obsidianLiveSyncSettingTab.panelRemoteConfiguration"), "🛰️", 0, false).then(
(paneEl) => {
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleRemoteServer")).then((paneEl) => { void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleRemoteServer")).then((paneEl) => {
// const containerRemoteDatabaseEl = containerEl.createDiv(); // const containerRemoteDatabaseEl = containerEl.createDiv();
new Setting(paneEl).autoWireDropDown("remoteType", { new Setting(paneEl).autoWireDropDown("remoteType", {
@@ -1341,7 +1368,12 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
onUpdate: enableOnlySyncDisabled, onUpdate: enableOnlySyncDisabled,
}); });
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleMinioS3R2"), undefined, onlyOnMinIO).then((paneEl) => { void addPanel(
paneEl,
$msg("obsidianLiveSyncSettingTab.titleMinioS3R2"),
undefined,
onlyOnMinIO
).then((paneEl) => {
const syncWarnMinio = this.createEl(paneEl, "div", { const syncWarnMinio = this.createEl(paneEl, "div", {
text: "", text: "",
}); });
@@ -1369,7 +1401,9 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
new Setting(paneEl).autoWireText("bucket", { holdValue: true }); new Setting(paneEl).autoWireText("bucket", { holdValue: true });
new Setting(paneEl).autoWireToggle("useCustomRequestHandler", { holdValue: true }); new Setting(paneEl).autoWireToggle("useCustomRequestHandler", { holdValue: true });
new Setting(paneEl).setName($msg("obsidianLiveSyncSettingTab.nameTestConnection")).addButton((button) => new Setting(paneEl)
.setName($msg("obsidianLiveSyncSettingTab.nameTestConnection"))
.addButton((button) =>
button button
.setButtonText($msg("obsidianLiveSyncSettingTab.btnTest")) .setButtonText($msg("obsidianLiveSyncSettingTab.btnTest"))
.setDisabled(false) .setDisabled(false)
@@ -1392,7 +1426,12 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
.addOnUpdate(onlyOnMinIO); .addOnUpdate(onlyOnMinIO);
}); });
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleCouchDB"), undefined, onlyOnCouchDB).then((paneEl) => { void addPanel(
paneEl,
$msg("obsidianLiveSyncSettingTab.titleCouchDB"),
undefined,
onlyOnCouchDB
).then((paneEl) => {
if (this.plugin.$$isMobile()) { if (this.plugin.$$isMobile()) {
this.createEl( this.createEl(
paneEl, paneEl,
@@ -1486,7 +1525,9 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
}); });
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleNotification")).then((paneEl) => { void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleNotification")).then((paneEl) => {
paneEl.addClass("wizardHidden"); paneEl.addClass("wizardHidden");
new Setting(paneEl).autoWireNumeric("notifyThresholdOfRemoteStorageSize", {}).setClass("wizardHidden"); new Setting(paneEl)
.autoWireNumeric("notifyThresholdOfRemoteStorageSize", {})
.setClass("wizardHidden");
}); });
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.panelPrivacyEncryption")).then((paneEl) => { void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.panelPrivacyEncryption")).then((paneEl) => {
@@ -1522,7 +1563,8 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
.setDisabled(false) .setDisabled(false)
.onClick(async () => { .onClick(async () => {
const trialSetting = { ...this.initialSettings, ...this.editingSettings }; const trialSetting = { ...this.initialSettings, ...this.editingSettings };
const newTweaks = await this.plugin.$$checkAndAskUseRemoteConfiguration(trialSetting); const newTweaks =
await this.plugin.$$checkAndAskUseRemoteConfiguration(trialSetting);
if (newTweaks.result !== false) { if (newTweaks.result !== false) {
this.editingSettings = { ...this.editingSettings, ...newTweaks.result }; this.editingSettings = { ...this.editingSettings, ...newTweaks.result };
this.requestUpdate(); this.requestUpdate();
@@ -1540,7 +1582,10 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
if ( if (
(await this.plugin.confirm.askYesNoDialog( (await this.plugin.confirm.askYesNoDialog(
$msg("obsidianLiveSyncSettingTab.msgConfigCheckFailed"), $msg("obsidianLiveSyncSettingTab.msgConfigCheckFailed"),
{ defaultOption: "No", title: $msg("obsidianLiveSyncSettingTab.titleRemoteConfigCheckFailed") } {
defaultOption: "No",
title: $msg("obsidianLiveSyncSettingTab.titleRemoteConfigCheckFailed"),
}
)) == "no" )) == "no"
) { ) {
return; return;
@@ -1552,7 +1597,10 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
if ( if (
(await this.plugin.confirm.askYesNoDialog( (await this.plugin.confirm.askYesNoDialog(
$msg("obsidianLiveSyncSettingTab.msgEnableEncryptionRecommendation"), $msg("obsidianLiveSyncSettingTab.msgEnableEncryptionRecommendation"),
{ defaultOption: "No", title: $msg("obsidianLiveSyncSettingTab.titleEncryptionNotEnabled") } {
defaultOption: "No",
title: $msg("obsidianLiveSyncSettingTab.titleEncryptionNotEnabled"),
}
)) == "no" )) == "no"
) { ) {
return; return;
@@ -1565,7 +1613,10 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
if ( if (
(await this.plugin.confirm.askYesNoDialog( (await this.plugin.confirm.askYesNoDialog(
$msg("obsidianLiveSyncSettingTab.msgInvalidPassphrase"), $msg("obsidianLiveSyncSettingTab.msgInvalidPassphrase"),
{ defaultOption: "No", title: $msg("obsidianLiveSyncSettingTab.titleEncryptionPassphraseInvalid") } {
defaultOption: "No",
title: $msg("obsidianLiveSyncSettingTab.titleEncryptionPassphraseInvalid"),
}
)) == "no" )) == "no"
) { ) {
return; return;
@@ -1596,8 +1647,10 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
changeDisplay("30"); changeDisplay("30");
}) })
); );
}); }
void addPane(containerEl, $msg("obsidianLiveSyncSettingTab.titleSyncSettings"), "🔄", 30, false).then((paneEl) => { );
void addPane(containerEl, $msg("obsidianLiveSyncSettingTab.titleSyncSettings"), "🔄", 30, false).then(
(paneEl) => {
if (this.editingSettings.versionUpFlash != "") { if (this.editingSettings.versionUpFlash != "") {
const c = this.createEl( const c = this.createEl(
paneEl, paneEl,
@@ -1607,7 +1660,11 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
cls: "op-warn sls-setting-hidden", cls: "op-warn sls-setting-hidden",
}, },
(el) => { (el) => {
this.createEl(el, "button", { text: $msg("obsidianLiveSyncSettingTab.btnGotItAndUpdated") }, (e) => { this.createEl(
el,
"button",
{ text: $msg("obsidianLiveSyncSettingTab.btnGotItAndUpdated") },
(e) => {
e.addClass("mod-cta"); e.addClass("mod-cta");
e.addEventListener("click", () => { e.addEventListener("click", () => {
fireAndForget(async () => { fireAndForget(async () => {
@@ -1616,7 +1673,8 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
c.remove(); c.remove();
}); });
}); });
}); }
);
}, },
visibleOnly(() => !this.isConfiguredAs("versionUpFlash", "")) visibleOnly(() => !this.isConfiguredAs("versionUpFlash", ""))
); );
@@ -1717,7 +1775,10 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
if ( if (
(await this.plugin.confirm.askYesNoDialog( (await this.plugin.confirm.askYesNoDialog(
$msg("obsidianLiveSyncSettingTab.msgGenerateSetupURI"), $msg("obsidianLiveSyncSettingTab.msgGenerateSetupURI"),
{ defaultOption: "Yes", title: $msg("obsidianLiveSyncSettingTab.titleCongratulations") } {
defaultOption: "Yes",
title: $msg("obsidianLiveSyncSettingTab.titleCongratulations"),
}
)) == "yes" )) == "yes"
) { ) {
eventHub.emitEvent(EVENT_REQUEST_COPY_SETUP_URI); eventHub.emitEvent(EVENT_REQUEST_COPY_SETUP_URI);
@@ -1812,13 +1873,25 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
}); });
}); });
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleDeletionPropagation"), undefined, undefined, LEVEL_ADVANCED).then((paneEl) => { void addPanel(
paneEl,
$msg("obsidianLiveSyncSettingTab.titleDeletionPropagation"),
undefined,
undefined,
LEVEL_ADVANCED
).then((paneEl) => {
paneEl.addClass("wizardHidden"); paneEl.addClass("wizardHidden");
new Setting(paneEl).setClass("wizardHidden").autoWireToggle("trashInsteadDelete"); new Setting(paneEl).setClass("wizardHidden").autoWireToggle("trashInsteadDelete");
new Setting(paneEl).setClass("wizardHidden").autoWireToggle("doNotDeleteFolder"); new Setting(paneEl).setClass("wizardHidden").autoWireToggle("doNotDeleteFolder");
}); });
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleConflictResolution"), undefined, undefined, LEVEL_ADVANCED).then((paneEl) => { void addPanel(
paneEl,
$msg("obsidianLiveSyncSettingTab.titleConflictResolution"),
undefined,
undefined,
LEVEL_ADVANCED
).then((paneEl) => {
paneEl.addClass("wizardHidden"); paneEl.addClass("wizardHidden");
new Setting(paneEl).setClass("wizardHidden").autoWireToggle("resolveConflictsByNewerFile"); new Setting(paneEl).setClass("wizardHidden").autoWireToggle("resolveConflictsByNewerFile");
@@ -1828,7 +1901,13 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
new Setting(paneEl).setClass("wizardHidden").autoWireToggle("showMergeDialogOnlyOnActive"); new Setting(paneEl).setClass("wizardHidden").autoWireToggle("showMergeDialogOnlyOnActive");
}); });
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleSyncSettingsViaMarkdown"), undefined, undefined, LEVEL_ADVANCED).then((paneEl) => { void addPanel(
paneEl,
$msg("obsidianLiveSyncSettingTab.titleSyncSettingsViaMarkdown"),
undefined,
undefined,
LEVEL_ADVANCED
).then((paneEl) => {
paneEl.addClass("wizardHidden"); paneEl.addClass("wizardHidden");
new Setting(paneEl) new Setting(paneEl)
@@ -1840,7 +1919,13 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
new Setting(paneEl).autoWireToggle("notifyAllSettingSyncFile"); new Setting(paneEl).autoWireToggle("notifyAllSettingSyncFile");
}); });
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleHiddenFiles"), undefined, undefined, LEVEL_ADVANCED).then((paneEl) => { void addPanel(
paneEl,
$msg("obsidianLiveSyncSettingTab.titleHiddenFiles"),
undefined,
undefined,
LEVEL_ADVANCED
).then((paneEl) => {
paneEl.addClass("wizardHidden"); paneEl.addClass("wizardHidden");
const LABEL_ENABLED = $msg("obsidianLiveSyncSettingTab.labelEnabled"); const LABEL_ENABLED = $msg("obsidianLiveSyncSettingTab.labelEnabled");
@@ -1859,7 +1944,9 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
.setName($msg("obsidianLiveSyncSettingTab.nameDisableHiddenFileSync")) .setName($msg("obsidianLiveSyncSettingTab.nameDisableHiddenFileSync"))
.setClass("wizardHidden") .setClass("wizardHidden")
.addButton((button) => { .addButton((button) => {
button.setButtonText($msg("obsidianLiveSyncSettingTab.btnDisable")).onClick(async () => { button
.setButtonText($msg("obsidianLiveSyncSettingTab.btnDisable"))
.onClick(async () => {
this.editingSettings.syncInternalFiles = false; this.editingSettings.syncInternalFiles = false;
await this.saveAllDirtySettings(); await this.saveAllDirtySettings();
this.display(); this.display();
@@ -1902,7 +1989,8 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
acceptZero: true, acceptZero: true,
}); });
}); });
}); }
);
void addPane(containerEl, "Selector", "🚦", 33, false, LEVEL_ADVANCED).then((paneEl) => { void addPane(containerEl, "Selector", "🚦", 33, false, LEVEL_ADVANCED).then((paneEl) => {
void addPanel(paneEl, "Normal Files").then((paneEl) => { void addPanel(paneEl, "Normal Files").then((paneEl) => {
paneEl.addClass("wizardHidden"); paneEl.addClass("wizardHidden");

View File

@@ -24,7 +24,7 @@ export class ModuleLiveSyncMain extends AbstractModule implements ICoreModule {
const ANSWER_RESUME = $msg("moduleLiveSyncMain.optionResumeAndRestart"); const ANSWER_RESUME = $msg("moduleLiveSyncMain.optionResumeAndRestart");
const message = $msg("moduleLiveSyncMain.msgScramEnabled", { const message = $msg("moduleLiveSyncMain.msgScramEnabled", {
fileWatchingStatus: this.settings.suspendFileWatching ? "suspended" : "active", fileWatchingStatus: this.settings.suspendFileWatching ? "suspended" : "active",
parseReplicationStatus: this.settings.suspendParseReplicationResult ? "suspended" : "active" parseReplicationStatus: this.settings.suspendParseReplicationResult ? "suspended" : "active",
}); });
if ( if (
(await this.core.confirm.askSelectStringDialogue(message, [ANSWER_KEEP, ANSWER_RESUME], { (await this.core.confirm.askSelectStringDialogue(message, [ANSWER_KEEP, ANSWER_RESUME], {