mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2025-12-24 15:11:29 +00:00
Reemplazar $tf por $msg
This commit is contained in:
@@ -71,7 +71,7 @@ import { Semaphore } from "octagonal-wheels/concurrency/semaphore";
|
|||||||
import type { IObsidianModule } from "../../modules/AbstractObsidianModule.ts";
|
import type { IObsidianModule } from "../../modules/AbstractObsidianModule.ts";
|
||||||
import { EVENT_REQUEST_OPEN_PLUGIN_SYNC_DIALOG, eventHub } from "../../common/events.ts";
|
import { EVENT_REQUEST_OPEN_PLUGIN_SYNC_DIALOG, eventHub } from "../../common/events.ts";
|
||||||
import { PluginDialogModal } from "./PluginDialogModal.ts";
|
import { PluginDialogModal } from "./PluginDialogModal.ts";
|
||||||
import { $tf } from "src/lib/src/common/i18n.ts";
|
import { $msg } from "src/lib/src/common/i18n.ts";
|
||||||
|
|
||||||
const d = "\u200b";
|
const d = "\u200b";
|
||||||
const d2 = "\n";
|
const d2 = "\n";
|
||||||
@@ -447,7 +447,7 @@ export class ConfigSync extends LiveSyncCommands implements IObsidianModule {
|
|||||||
this.showPluginSyncModal();
|
this.showPluginSyncModal();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
this.addRibbonIcon("custom-sync", $tf("cmdConfigSync.showCustomizationSync"), () => {
|
this.addRibbonIcon("custom-sync", $msg("cmdConfigSync.showCustomizationSync"), () => {
|
||||||
this.showPluginSyncModal();
|
this.showPluginSyncModal();
|
||||||
}).addClass("livesync-ribbon-showcustom");
|
}).addClass("livesync-ribbon-showcustom");
|
||||||
eventHub.onEvent(EVENT_REQUEST_OPEN_PLUGIN_SYNC_DIALOG, () => this.showPluginSyncModal());
|
eventHub.onEvent(EVENT_REQUEST_OPEN_PLUGIN_SYNC_DIALOG, () => this.showPluginSyncModal());
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { $tf } from "../../lib/src/common/i18n";
|
import { $msg } from "../../lib/src/common/i18n";
|
||||||
import { LiveSyncLocalDB } from "../../lib/src/pouchdb/LiveSyncLocalDB.ts";
|
import { LiveSyncLocalDB } from "../../lib/src/pouchdb/LiveSyncLocalDB.ts";
|
||||||
import { initializeStores } from "../../common/stores.ts";
|
import { initializeStores } from "../../common/stores.ts";
|
||||||
import { AbstractModule } from "../AbstractModule.ts";
|
import { AbstractModule } from "../AbstractModule.ts";
|
||||||
@@ -13,7 +13,7 @@ export class ModuleLocalDatabaseObsidian extends AbstractModule implements ICore
|
|||||||
await this.localDatabase.close();
|
await this.localDatabase.close();
|
||||||
}
|
}
|
||||||
const vaultName = this.core.$$getVaultName();
|
const vaultName = this.core.$$getVaultName();
|
||||||
this._log($tf("moduleLocalDatabase.logWaitingForReady"));
|
this._log($msg("moduleLocalDatabase.logWaitingForReady"));
|
||||||
this.core.localDatabase = new LiveSyncLocalDB(vaultName, this.core);
|
this.core.localDatabase = new LiveSyncLocalDB(vaultName, this.core);
|
||||||
initializeStores(vaultName);
|
initializeStores(vaultName);
|
||||||
return await this.localDatabase.initializeDatabase();
|
return await this.localDatabase.initializeDatabase();
|
||||||
|
|||||||
@@ -2,24 +2,24 @@ import { LOG_LEVEL_INFO, LOG_LEVEL_NOTICE, LOG_LEVEL_VERBOSE } from "octagonal-w
|
|||||||
import { AbstractModule } from "../AbstractModule.ts";
|
import { AbstractModule } from "../AbstractModule.ts";
|
||||||
import { sizeToHumanReadable } from "octagonal-wheels/number";
|
import { sizeToHumanReadable } from "octagonal-wheels/number";
|
||||||
import type { ICoreModule } from "../ModuleTypes.ts";
|
import type { ICoreModule } from "../ModuleTypes.ts";
|
||||||
import { $tf } from "src/lib/src/common/i18n.ts";
|
import { $msg } from "src/lib/src/common/i18n.ts";
|
||||||
|
|
||||||
export class ModuleCheckRemoteSize extends AbstractModule implements ICoreModule {
|
export class ModuleCheckRemoteSize extends AbstractModule implements ICoreModule {
|
||||||
async $allScanStat(): Promise<boolean> {
|
async $allScanStat(): Promise<boolean> {
|
||||||
this._log($tf("moduleCheckRemoteSize.logCheckingStorageSizes"), LOG_LEVEL_VERBOSE);
|
this._log($msg("moduleCheckRemoteSize.logCheckingStorageSizes"), LOG_LEVEL_VERBOSE);
|
||||||
if (this.settings.notifyThresholdOfRemoteStorageSize < 0) {
|
if (this.settings.notifyThresholdOfRemoteStorageSize < 0) {
|
||||||
const message = $tf("moduleCheckRemoteSize.msgSetDBCapacity");
|
const message = $msg("moduleCheckRemoteSize.msgSetDBCapacity");
|
||||||
const ANSWER_0 = $tf("moduleCheckRemoteSize.optionNoWarn");
|
const ANSWER_0 = $msg("moduleCheckRemoteSize.optionNoWarn");
|
||||||
const ANSWER_800 = $tf("moduleCheckRemoteSize.option800MB");
|
const ANSWER_800 = $msg("moduleCheckRemoteSize.option800MB");
|
||||||
const ANSWER_2000 = $tf("moduleCheckRemoteSize.option2GB");
|
const ANSWER_2000 = $msg("moduleCheckRemoteSize.option2GB");
|
||||||
const ASK_ME_NEXT_TIME = $tf("moduleCheckRemoteSize.optionAskMeLater");
|
const ASK_ME_NEXT_TIME = $msg("moduleCheckRemoteSize.optionAskMeLater");
|
||||||
|
|
||||||
const ret = await this.core.confirm.askSelectStringDialogue(
|
const ret = await this.core.confirm.askSelectStringDialogue(
|
||||||
message,
|
message,
|
||||||
[ANSWER_0, ANSWER_800, ANSWER_2000, ASK_ME_NEXT_TIME],
|
[ANSWER_0, ANSWER_800, ANSWER_2000, ASK_ME_NEXT_TIME],
|
||||||
{
|
{
|
||||||
defaultAction: ASK_ME_NEXT_TIME,
|
defaultAction: ASK_ME_NEXT_TIME,
|
||||||
title: $tf("moduleCheckRemoteSize.titleDatabaseSizeNotify"),
|
title: $msg("moduleCheckRemoteSize.titleDatabaseSizeNotify"),
|
||||||
timeout: 40,
|
timeout: 40,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -41,28 +41,28 @@ export class ModuleCheckRemoteSize extends AbstractModule implements ICoreModule
|
|||||||
if (estimatedSize) {
|
if (estimatedSize) {
|
||||||
const maxSize = this.settings.notifyThresholdOfRemoteStorageSize * 1024 * 1024;
|
const maxSize = this.settings.notifyThresholdOfRemoteStorageSize * 1024 * 1024;
|
||||||
if (estimatedSize > maxSize) {
|
if (estimatedSize > maxSize) {
|
||||||
const message = $tf("moduleCheckRemoteSize.msgDatabaseGrowing", {
|
const message = $msg("moduleCheckRemoteSize.msgDatabaseGrowing", {
|
||||||
estimatedSize: sizeToHumanReadable(estimatedSize),
|
estimatedSize: sizeToHumanReadable(estimatedSize),
|
||||||
maxSize: sizeToHumanReadable(maxSize),
|
maxSize: sizeToHumanReadable(maxSize),
|
||||||
});
|
});
|
||||||
const newMax = ~~(estimatedSize / 1024 / 1024) + 100;
|
const newMax = ~~(estimatedSize / 1024 / 1024) + 100;
|
||||||
const ANSWER_ENLARGE_LIMIT = $tf("moduleCheckRemoteSize.optionIncreaseLimit", {
|
const ANSWER_ENLARGE_LIMIT = $msg("moduleCheckRemoteSize.optionIncreaseLimit", {
|
||||||
newMax: newMax.toString(),
|
newMax: newMax.toString(),
|
||||||
});
|
});
|
||||||
const ANSWER_REBUILD = $tf("moduleCheckRemoteSize.optionRebuildAll");
|
const ANSWER_REBUILD = $msg("moduleCheckRemoteSize.optionRebuildAll");
|
||||||
const ANSWER_IGNORE = $tf("moduleCheckRemoteSize.optionDismiss");
|
const ANSWER_IGNORE = $msg("moduleCheckRemoteSize.optionDismiss");
|
||||||
const ret = await this.core.confirm.askSelectStringDialogue(
|
const ret = await this.core.confirm.askSelectStringDialogue(
|
||||||
message,
|
message,
|
||||||
[ANSWER_ENLARGE_LIMIT, ANSWER_REBUILD, ANSWER_IGNORE],
|
[ANSWER_ENLARGE_LIMIT, ANSWER_REBUILD, ANSWER_IGNORE],
|
||||||
{
|
{
|
||||||
defaultAction: ANSWER_IGNORE,
|
defaultAction: ANSWER_IGNORE,
|
||||||
title: $tf("moduleCheckRemoteSize.titleDatabaseSizeLimitExceeded"),
|
title: $msg("moduleCheckRemoteSize.titleDatabaseSizeLimitExceeded"),
|
||||||
timeout: 60,
|
timeout: 60,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (ret == ANSWER_REBUILD) {
|
if (ret == ANSWER_REBUILD) {
|
||||||
const ret = await this.core.confirm.askYesNoDialog(
|
const ret = await this.core.confirm.askYesNoDialog(
|
||||||
$tf("moduleCheckRemoteSize.msgConfirmRebuild"),
|
$msg("moduleCheckRemoteSize.msgConfirmRebuild"),
|
||||||
{ defaultOption: "No" }
|
{ defaultOption: "No" }
|
||||||
);
|
);
|
||||||
if (ret == "yes") {
|
if (ret == "yes") {
|
||||||
@@ -73,7 +73,7 @@ export class ModuleCheckRemoteSize extends AbstractModule implements ICoreModule
|
|||||||
} else if (ret == ANSWER_ENLARGE_LIMIT) {
|
} else if (ret == ANSWER_ENLARGE_LIMIT) {
|
||||||
this.settings.notifyThresholdOfRemoteStorageSize = ~~(estimatedSize / 1024 / 1024) + 100;
|
this.settings.notifyThresholdOfRemoteStorageSize = ~~(estimatedSize / 1024 / 1024) + 100;
|
||||||
this._log(
|
this._log(
|
||||||
$tf("moduleCheckRemoteSize.logThresholdEnlarged", {
|
$msg("moduleCheckRemoteSize.logThresholdEnlarged", {
|
||||||
size: this.settings.notifyThresholdOfRemoteStorageSize.toString(),
|
size: this.settings.notifyThresholdOfRemoteStorageSize.toString(),
|
||||||
}),
|
}),
|
||||||
LOG_LEVEL_NOTICE
|
LOG_LEVEL_NOTICE
|
||||||
@@ -84,7 +84,7 @@ export class ModuleCheckRemoteSize extends AbstractModule implements ICoreModule
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._log(
|
this._log(
|
||||||
$tf("moduleCheckRemoteSize.logExceededWarning", {
|
$msg("moduleCheckRemoteSize.logExceededWarning", {
|
||||||
measuredSize: sizeToHumanReadable(estimatedSize),
|
measuredSize: sizeToHumanReadable(estimatedSize),
|
||||||
notifySize: sizeToHumanReadable(
|
notifySize: sizeToHumanReadable(
|
||||||
this.settings.notifyThresholdOfRemoteStorageSize * 1024 * 1024
|
this.settings.notifyThresholdOfRemoteStorageSize * 1024 * 1024
|
||||||
@@ -93,7 +93,7 @@ export class ModuleCheckRemoteSize extends AbstractModule implements ICoreModule
|
|||||||
LOG_LEVEL_INFO
|
LOG_LEVEL_INFO
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this._log($tf("moduleCheckRemoteSize.logCurrentStorageSize", {
|
this._log($msg("moduleCheckRemoteSize.logCurrentStorageSize", {
|
||||||
measuredSize: sizeToHumanReadable(estimatedSize),
|
measuredSize: sizeToHumanReadable(estimatedSize),
|
||||||
}), LOG_LEVEL_INFO);
|
}), LOG_LEVEL_INFO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
} from "./UILib/dialogs.ts";
|
} from "./UILib/dialogs.ts";
|
||||||
import { Notice } from "../../deps.ts";
|
import { Notice } from "../../deps.ts";
|
||||||
import type { Confirm } from "../interfaces/Confirm.ts";
|
import type { Confirm } from "../interfaces/Confirm.ts";
|
||||||
import { $tf } from "src/lib/src/common/i18n.ts";
|
import { $msg } from "src/lib/src/common/i18n.ts";
|
||||||
|
|
||||||
// This module cannot be a common module because it depends on Obsidian's API.
|
// This module cannot be a common module because it depends on Obsidian's API.
|
||||||
// However, we have to make compatible one for other platform.
|
// However, we have to make compatible one for other platform.
|
||||||
@@ -34,9 +34,9 @@ export class ModuleInputUIObsidian extends AbstractObsidianModule implements IOb
|
|||||||
message: string,
|
message: string,
|
||||||
opt: { title?: string; defaultOption?: "Yes" | "No"; timeout?: number } = {}
|
opt: { title?: string; defaultOption?: "Yes" | "No"; timeout?: number } = {}
|
||||||
): Promise<"yes" | "no"> {
|
): Promise<"yes" | "no"> {
|
||||||
const defaultTitle = $tf("moduleInputUIObsidian.defaultTitleConfirmation");
|
const defaultTitle = $msg("moduleInputUIObsidian.defaultTitleConfirmation");
|
||||||
const yesLabel = $tf("moduleInputUIObsidian.optionYes");
|
const yesLabel = $msg("moduleInputUIObsidian.optionYes");
|
||||||
const noLabel = $tf("moduleInputUIObsidian.optionNo");
|
const noLabel = $msg("moduleInputUIObsidian.optionNo");
|
||||||
const defaultOption = opt.defaultOption === "Yes" ? yesLabel : noLabel;
|
const defaultOption = opt.defaultOption === "Yes" ? yesLabel : noLabel;
|
||||||
const ret = await confirmWithMessageWithWideButton(
|
const ret = await confirmWithMessageWithWideButton(
|
||||||
this.plugin,
|
this.plugin,
|
||||||
@@ -58,7 +58,7 @@ export class ModuleInputUIObsidian extends AbstractObsidianModule implements IOb
|
|||||||
buttons: string[],
|
buttons: string[],
|
||||||
opt: { title?: string; defaultAction: (typeof buttons)[number]; timeout?: number }
|
opt: { title?: string; defaultAction: (typeof buttons)[number]; timeout?: number }
|
||||||
): Promise<(typeof buttons)[number] | false> {
|
): Promise<(typeof buttons)[number] | false> {
|
||||||
const defaultTitle = $tf("moduleInputUIObsidian.defaultTitleSelect");
|
const defaultTitle = $msg("moduleInputUIObsidian.defaultTitleSelect");
|
||||||
return confirmWithMessageWithWideButton(
|
return confirmWithMessageWithWideButton(
|
||||||
this.plugin,
|
this.plugin,
|
||||||
opt.title || defaultTitle,
|
opt.title || defaultTitle,
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ import {
|
|||||||
} from "../../common/events.ts";
|
} from "../../common/events.ts";
|
||||||
import { AbstractModule } from "../AbstractModule.ts";
|
import { AbstractModule } from "../AbstractModule.ts";
|
||||||
import type { ICoreModule } from "../ModuleTypes.ts";
|
import type { ICoreModule } from "../ModuleTypes.ts";
|
||||||
import { $tf } from "src/lib/src/common/i18n.ts";
|
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($tf('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,7 +24,7 @@ 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($tf('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);
|
||||||
@@ -67,10 +67,10 @@ export class ModuleMigration extends AbstractModule implements ICoreModule {
|
|||||||
remoteChecked = true;
|
remoteChecked = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this._log($tf('moduleMigration.logFetchRemoteTweakFailed'), LOG_LEVEL_INFO);
|
this._log($msg('moduleMigration.logFetchRemoteTweakFailed'), LOG_LEVEL_INFO);
|
||||||
}
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
this._log($tf('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 +81,18 @@ 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($tf('moduleMigration.logMigratedSameBehaviour', {
|
this._log($msg('moduleMigration.logMigratedSameBehaviour', {
|
||||||
current: current.toString()
|
current: current.toString()
|
||||||
}), LOG_LEVEL_INFO);
|
}), LOG_LEVEL_INFO);
|
||||||
await this.saveSettings();
|
await this.saveSettings();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const message = $tf('moduleMigration.msgFetchRemoteAgain');
|
const message = $msg('moduleMigration.msgFetchRemoteAgain');
|
||||||
const OPTION_FETCH = $tf('moduleMigration.optionYesFetchAgain');
|
const OPTION_FETCH = $msg('moduleMigration.optionYesFetchAgain');
|
||||||
const DISMISS = $tf('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(
|
||||||
$tf('moduleMigration.titleCaseSensitivity'),
|
$msg('moduleMigration.titleCaseSensitivity'),
|
||||||
message,
|
message,
|
||||||
options,
|
options,
|
||||||
DISMISS,
|
DISMISS,
|
||||||
@@ -107,7 +107,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($tf('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 +116,19 @@ export class ModuleMigration extends AbstractModule implements ICoreModule {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const ENABLE_BOTH = $tf('moduleMigration.optionEnableBoth');
|
const ENABLE_BOTH = $msg('moduleMigration.optionEnableBoth');
|
||||||
const ENABLE_FILENAME_CASE_INSENSITIVE = $tf('moduleMigration.optionEnableFilenameCaseInsensitive');
|
const ENABLE_FILENAME_CASE_INSENSITIVE = $msg('moduleMigration.optionEnableFilenameCaseInsensitive');
|
||||||
const ENABLE_FIXED_REVISION_FOR_CHUNKS = $tf('moduleMigration.optionEnableFixedRevisionForChunks');
|
const ENABLE_FIXED_REVISION_FOR_CHUNKS = $msg('moduleMigration.optionEnableFixedRevisionForChunks');
|
||||||
const ADJUST_TO_REMOTE = $tf('moduleMigration.optionAdjustRemote');
|
const ADJUST_TO_REMOTE = $msg('moduleMigration.optionAdjustRemote');
|
||||||
const KEEP = $tf('moduleMigration.optionKeepPreviousBehaviour');
|
const KEEP = $msg('moduleMigration.optionKeepPreviousBehaviour');
|
||||||
const DISMISS = $tf('moduleMigration.optionDecideLater');
|
const DISMISS = $msg('moduleMigration.optionDecideLater');
|
||||||
const message = $tf('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($tf('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 +160,14 @@ export class ModuleMigration extends AbstractModule implements ICoreModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async initialMessage() {
|
async initialMessage() {
|
||||||
const message = $tf('moduleMigration.msgInitialSetup', {
|
const message = $msg('moduleMigration.msgInitialSetup', {
|
||||||
URI_DOC: $tf('moduleMigration.docUri'),
|
URI_DOC: $msg('moduleMigration.docUri'),
|
||||||
});
|
});
|
||||||
const USE_SETUP = $tf('moduleMigration.optionHaveSetupUri');
|
const USE_SETUP = $msg('moduleMigration.optionHaveSetupUri');
|
||||||
const NEXT = $tf('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: $tf('moduleMigration.titleWelcome'),
|
title: $msg('moduleMigration.titleWelcome'),
|
||||||
defaultAction: USE_SETUP,
|
defaultAction: USE_SETUP,
|
||||||
});
|
});
|
||||||
if (ret === USE_SETUP) {
|
if (ret === USE_SETUP) {
|
||||||
@@ -180,13 +180,13 @@ export class ModuleMigration extends AbstractModule implements ICoreModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async askAgainForSetupURI() {
|
async askAgainForSetupURI() {
|
||||||
const message = $tf('moduleMigration.msgRecommendSetupUri', { URI_DOC: $tf('moduleMigration.docUri') });
|
const message = $msg('moduleMigration.msgRecommendSetupUri', { URI_DOC: $msg('moduleMigration.docUri') });
|
||||||
const USE_MINIMAL = $tf('moduleMigration.optionSetupWizard');
|
const USE_MINIMAL = $msg('moduleMigration.optionSetupWizard');
|
||||||
const USE_SETUP = $tf('moduleMigration.optionManualSetup');
|
const USE_SETUP = $msg('moduleMigration.optionManualSetup');
|
||||||
const NEXT = $tf('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: $tf('moduleMigration.titleRecommendSetupUri'),
|
title: $msg('moduleMigration.titleRecommendSetupUri'),
|
||||||
defaultAction: USE_MINIMAL,
|
defaultAction: USE_MINIMAL,
|
||||||
});
|
});
|
||||||
if (ret === USE_MINIMAL) {
|
if (ret === USE_MINIMAL) {
|
||||||
@@ -204,7 +204,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($tf('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 +214,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($tf('moduleMigration.logSetupCancelled'), LOG_LEVEL_NOTICE);
|
this._log($msg('moduleMigration.logSetupCancelled'), LOG_LEVEL_NOTICE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { fireAndForget } from "octagonal-wheels/promises";
|
|||||||
import { addIcon, type Editor, type MarkdownFileInfo, type MarkdownView } from "../../deps.ts";
|
import { addIcon, type Editor, type MarkdownFileInfo, type MarkdownView } from "../../deps.ts";
|
||||||
import { LOG_LEVEL_NOTICE, type FilePathWithPrefix } from "../../lib/src/common/types.ts";
|
import { LOG_LEVEL_NOTICE, type FilePathWithPrefix } from "../../lib/src/common/types.ts";
|
||||||
import { AbstractObsidianModule, type IObsidianModule } from "../AbstractObsidianModule.ts";
|
import { AbstractObsidianModule, type IObsidianModule } from "../AbstractObsidianModule.ts";
|
||||||
import { $tf } from "src/lib/src/common/i18n.ts";
|
import { $msg } from "src/lib/src/common/i18n.ts";
|
||||||
|
|
||||||
export class ModuleObsidianMenu extends AbstractObsidianModule implements IObsidianModule {
|
export class ModuleObsidianMenu extends AbstractObsidianModule implements IObsidianModule {
|
||||||
$everyOnloadStart(): Promise<boolean> {
|
$everyOnloadStart(): Promise<boolean> {
|
||||||
@@ -17,7 +17,7 @@ export class ModuleObsidianMenu extends AbstractObsidianModule implements IObsid
|
|||||||
</g>`
|
</g>`
|
||||||
);
|
);
|
||||||
|
|
||||||
this.addRibbonIcon("replicate", $tf("moduleObsidianMenu.replicate"), async () => {
|
this.addRibbonIcon("replicate", $msg("moduleObsidianMenu.replicate"), async () => {
|
||||||
await this.core.$$replicate(true);
|
await this.core.$$replicate(true);
|
||||||
}).addClass("livesync-ribbon-replicate");
|
}).addClass("livesync-ribbon-replicate");
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { logMessages } from "../../../lib/src/mock_and_interop/stores";
|
import { logMessages } from "../../../lib/src/mock_and_interop/stores";
|
||||||
import { reactive, type ReactiveInstance } from "../../../lib/src/dataobject/reactive";
|
import { reactive, type ReactiveInstance } from "../../../lib/src/dataobject/reactive";
|
||||||
import { Logger } from "../../../lib/src/common/logger";
|
import { Logger } from "../../../lib/src/common/logger";
|
||||||
import { $tf as tf, currentLang as lang } from "../../../lib/src/common/i18n.ts";
|
import { $msg as msg, currentLang as lang } from "../../../lib/src/common/i18n.ts";
|
||||||
|
|
||||||
let unsubscribe: () => void;
|
let unsubscribe: () => void;
|
||||||
let messages = [] as string[];
|
let messages = [] as string[];
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
const _logMessages = reactive(() => logMessages.value);
|
const _logMessages = reactive(() => logMessages.value);
|
||||||
_logMessages.onChanged(updateLog);
|
_logMessages.onChanged(updateLog);
|
||||||
Logger(tf("logPane.logWindowOpened", {}, lang));
|
Logger(msg("logPane.logWindowOpened", {}, lang));
|
||||||
unsubscribe = () => _logMessages.offChanged(updateLog);
|
unsubscribe = () => _logMessages.offChanged(updateLog);
|
||||||
});
|
});
|
||||||
onDestroy(() => {
|
onDestroy(() => {
|
||||||
@@ -32,20 +32,20 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="logpane">
|
<div class="logpane">
|
||||||
<!-- <h1>{tf("logPane.title", {}, lang)}</h1> -->
|
<!-- <h1>{msg("logPane.title", {}, lang)}</h1> -->
|
||||||
<div class="control">
|
<div class="control">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" bind:checked={wrapRight} />
|
<input type="checkbox" bind:checked={wrapRight} />
|
||||||
<span>{tf("logPane.wrap", {}, lang)}</span>
|
<span>{msg("logPane.wrap", {}, lang)}</span>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" bind:checked={autoScroll} />
|
<input type="checkbox" bind:checked={autoScroll} />
|
||||||
<span>{tf("logPane.autoScroll", {}, lang)}</span>
|
<span>{msg("logPane.autoScroll", {}, lang)}</span>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" bind:checked={suspended} />
|
<input type="checkbox" bind:checked={suspended} />
|
||||||
<span>{tf("logPane.pause", {}, lang)}</span>
|
<span>{msg("logPane.pause", {}, lang)}</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { ItemView, WorkspaceLeaf } from "obsidian";
|
import { ItemView, WorkspaceLeaf } from "obsidian";
|
||||||
import LogPaneComponent from "./LogPane.svelte";
|
import LogPaneComponent from "./LogPane.svelte";
|
||||||
import type ObsidianLiveSyncPlugin from "../../../main.ts";
|
import type ObsidianLiveSyncPlugin from "../../../main.ts";
|
||||||
import { $tf } from "src/lib/src/common/i18n.ts";
|
import { $msg } from "src/lib/src/common/i18n.ts";
|
||||||
export const VIEW_TYPE_LOG = "log-log";
|
export const VIEW_TYPE_LOG = "log-log";
|
||||||
//Log view
|
//Log view
|
||||||
export class LogPaneView extends ItemView {
|
export class LogPaneView extends ItemView {
|
||||||
@@ -26,7 +26,7 @@ export class LogPaneView extends ItemView {
|
|||||||
|
|
||||||
getDisplayText() {
|
getDisplayText() {
|
||||||
// TODO: This function is not reactive and does not update the title based on the current language
|
// TODO: This function is not reactive and does not update the title based on the current language
|
||||||
return $tf("logPane.title");
|
return $msg("logPane.title");
|
||||||
}
|
}
|
||||||
|
|
||||||
async onOpen() {
|
async onOpen() {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ import { LOG_LEVEL_NOTICE, setGlobalLogFunction } from "octagonal-wheels/common/
|
|||||||
import { QueueProcessor } from "octagonal-wheels/concurrency/processor";
|
import { QueueProcessor } from "octagonal-wheels/concurrency/processor";
|
||||||
import { LogPaneView, VIEW_TYPE_LOG } from "./Log/LogPaneView.ts";
|
import { LogPaneView, VIEW_TYPE_LOG } from "./Log/LogPaneView.ts";
|
||||||
import { serialized } from "octagonal-wheels/concurrency/lock";
|
import { serialized } from "octagonal-wheels/concurrency/lock";
|
||||||
import { $tf } from "src/lib/src/common/i18n.ts";
|
import { $msg } from "src/lib/src/common/i18n.ts";
|
||||||
|
|
||||||
// This module cannot be a core module because it depends on the Obsidian UI.
|
// This module cannot be a core module because it depends on the Obsidian UI.
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ export class ModuleLog extends AbstractObsidianModule implements IObsidianModule
|
|||||||
<path d="m106 346v44h70v-44zm45 16h-20v-8h20z"/>
|
<path d="m106 346v44h70v-44zm45 16h-20v-8h20z"/>
|
||||||
</g>`
|
</g>`
|
||||||
);
|
);
|
||||||
this.addRibbonIcon("view-log", $tf("moduleLog.showLog"), () => {
|
this.addRibbonIcon("view-log", $msg("moduleLog.showLog"), () => {
|
||||||
void this.core.$$showView(VIEW_TYPE_LOG);
|
void this.core.$$showView(VIEW_TYPE_LOG);
|
||||||
}).addClass("livesync-ribbon-showlog");
|
}).addClass("livesync-ribbon-showlog");
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import {
|
|||||||
type AllNumericItemKey,
|
type AllNumericItemKey,
|
||||||
type AllBooleanItemKey,
|
type AllBooleanItemKey,
|
||||||
} from "./settingConstants.ts";
|
} from "./settingConstants.ts";
|
||||||
import { $tf } from "src/lib/src/common/i18n.ts";
|
import { $msg } from "src/lib/src/common/i18n.ts";
|
||||||
|
|
||||||
export class LiveSyncSetting extends Setting {
|
export class LiveSyncSetting extends Setting {
|
||||||
autoWiredComponent?: TextComponent | ToggleComponent | DropdownComponent | ButtonComponent | TextAreaComponent;
|
autoWiredComponent?: TextComponent | ToggleComponent | DropdownComponent | ButtonComponent | TextAreaComponent;
|
||||||
@@ -87,7 +87,7 @@ export class LiveSyncSetting extends Setting {
|
|||||||
autoWireSetting(key: AllSettingItemKey, opt?: AutoWireOption) {
|
autoWireSetting(key: AllSettingItemKey, opt?: AutoWireOption) {
|
||||||
const conf = getConfig(key);
|
const conf = getConfig(key);
|
||||||
if (!conf) {
|
if (!conf) {
|
||||||
// throw new Error($tf("liveSyncSetting.errorNoSuchSettingItem", { key }));
|
// throw new Error($msg("liveSyncSetting.errorNoSuchSettingItem", { key }));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const name = `${conf.name}${statusDisplay(conf.status)}`;
|
const name = `${conf.name}${statusDisplay(conf.status)}`;
|
||||||
@@ -218,7 +218,7 @@ export class LiveSyncSetting extends Setting {
|
|||||||
await this.commitValue(value);
|
await this.commitValue(value);
|
||||||
} else {
|
} else {
|
||||||
this.setTooltip(
|
this.setTooltip(
|
||||||
$tf(
|
$msg(
|
||||||
"liveSyncSetting.valueShouldBeInRange",
|
"liveSyncSetting.valueShouldBeInRange",
|
||||||
{
|
{
|
||||||
min: opt.clampMin?.toString() || "~",
|
min: opt.clampMin?.toString() || "~",
|
||||||
@@ -277,7 +277,7 @@ export class LiveSyncSetting extends Setting {
|
|||||||
this.addButton((button) => {
|
this.addButton((button) => {
|
||||||
this.applyButtonComponent = button;
|
this.applyButtonComponent = button;
|
||||||
this.watchDirtyKeys = unique([...keys, ...this.watchDirtyKeys]);
|
this.watchDirtyKeys = unique([...keys, ...this.watchDirtyKeys]);
|
||||||
button.setButtonText(text ?? $tf("liveSyncSettings.btnApply"));
|
button.setButtonText(text ?? $msg("liveSyncSettings.btnApply"));
|
||||||
button.onClick(async () => {
|
button.onClick(async () => {
|
||||||
await LiveSyncSetting.env.saveSettings(keys);
|
await LiveSyncSetting.env.saveSettings(keys);
|
||||||
LiveSyncSetting.env.reloadAllSettings();
|
LiveSyncSetting.env.reloadAllSettings();
|
||||||
@@ -373,7 +373,7 @@ 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
|
||||||
? $tf("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) {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ import {
|
|||||||
getConfName,
|
getConfName,
|
||||||
} from "./settingConstants.ts";
|
} from "./settingConstants.ts";
|
||||||
import { SUPPORTED_I18N_LANGS, type I18N_LANGS } from "../../../lib/src/common/rosetta.ts";
|
import { SUPPORTED_I18N_LANGS, type I18N_LANGS } from "../../../lib/src/common/rosetta.ts";
|
||||||
import { $t, $tf } from "../../../lib/src/common/i18n.ts";
|
import { $t, $msg } from "../../../lib/src/common/i18n.ts";
|
||||||
import { Semaphore } from "octagonal-wheels/concurrency/semaphore";
|
import { Semaphore } from "octagonal-wheels/concurrency/semaphore";
|
||||||
import { LiveSyncSetting as Setting } from "./LiveSyncSetting.ts";
|
import { LiveSyncSetting as Setting } from "./LiveSyncSetting.ts";
|
||||||
import { fireAndForget, yieldNextAnimationFrame } from "octagonal-wheels/promises";
|
import { fireAndForget, yieldNextAnimationFrame } from "octagonal-wheels/promises";
|
||||||
@@ -117,11 +117,11 @@ type OnSavedHandler<T extends AllSettingItemKey> = {
|
|||||||
|
|
||||||
function getLevelStr(level: ConfigLevel) {
|
function getLevelStr(level: ConfigLevel) {
|
||||||
return level == LEVEL_POWER_USER
|
return level == LEVEL_POWER_USER
|
||||||
? $tf("obsidianLiveSyncSettingTab.levelPowerUser")
|
? $msg("obsidianLiveSyncSettingTab.levelPowerUser")
|
||||||
: level == LEVEL_ADVANCED
|
: level == LEVEL_ADVANCED
|
||||||
? $tf("obsidianLiveSyncSettingTab.levelAdvanced")
|
? $msg("obsidianLiveSyncSettingTab.levelAdvanced")
|
||||||
: level == LEVEL_EDGE_CASE
|
: level == LEVEL_EDGE_CASE
|
||||||
? $tf("obsidianLiveSyncSettingTab.levelEdgeCase")
|
? $msg("obsidianLiveSyncSettingTab.levelEdgeCase")
|
||||||
: "";
|
: "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -384,7 +384,7 @@ 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($tf("obsidianLiveSyncSettingTab.logEstimatedSize", { size: sizeToHumanReadable(status.estimatedSize) }), LOG_LEVEL_NOTICE);
|
Logger($msg("obsidianLiveSyncSettingTab.logEstimatedSize", { size: sizeToHumanReadable(status.estimatedSize) }), LOG_LEVEL_NOTICE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -464,9 +464,9 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
// And modified.
|
// And modified.
|
||||||
this.plugin.confirm.askInPopup(
|
this.plugin.confirm.askInPopup(
|
||||||
`config-reloaded-${k}`,
|
`config-reloaded-${k}`,
|
||||||
$tf("obsidianLiveSyncSettingTab.msgSettingModified", { setting: getConfName(k as AllSettingItemKey) }),
|
$msg("obsidianLiveSyncSettingTab.msgSettingModified", { setting: getConfName(k as AllSettingItemKey) }),
|
||||||
(anchor) => {
|
(anchor) => {
|
||||||
anchor.text = $tf("obsidianLiveSyncSettingTab.optionHere");
|
anchor.text = $msg("obsidianLiveSyncSettingTab.optionHere");
|
||||||
anchor.addEventListener("click", () => {
|
anchor.addEventListener("click", () => {
|
||||||
this.refreshSetting(k as AllSettingItemKey);
|
this.refreshSetting(k as AllSettingItemKey);
|
||||||
this.display();
|
this.display();
|
||||||
@@ -611,12 +611,12 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
Logger(`Passphrase is not valid, please fix it.`, LOG_LEVEL_NOTICE);
|
Logger(`Passphrase is not valid, please fix it.`, LOG_LEVEL_NOTICE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const OPTION_FETCH = $tf("obsidianLiveSyncSettingTab.optionFetchFromRemote");
|
const OPTION_FETCH = $msg("obsidianLiveSyncSettingTab.optionFetchFromRemote");
|
||||||
const OPTION_REBUILD_BOTH = $tf("obsidianLiveSyncSettingTab.optionRebuildBoth");
|
const OPTION_REBUILD_BOTH = $msg("obsidianLiveSyncSettingTab.optionRebuildBoth");
|
||||||
const OPTION_ONLY_SETTING = $tf("obsidianLiveSyncSettingTab.optionSaveOnlySettings");
|
const OPTION_ONLY_SETTING = $msg("obsidianLiveSyncSettingTab.optionSaveOnlySettings");
|
||||||
const OPTION_CANCEL = $tf("obsidianLiveSyncSettingTab.optionCancel");
|
const OPTION_CANCEL = $msg("obsidianLiveSyncSettingTab.optionCancel");
|
||||||
const title = $tf("obsidianLiveSyncSettingTab.titleRebuildRequired");
|
const title = $msg("obsidianLiveSyncSettingTab.titleRebuildRequired");
|
||||||
const note = $tf("obsidianLiveSyncSettingTab.msgRebuildRequired", {
|
const note = $msg("obsidianLiveSyncSettingTab.msgRebuildRequired", {
|
||||||
OPTION_REBUILD_BOTH,
|
OPTION_REBUILD_BOTH,
|
||||||
OPTION_FETCH,
|
OPTION_FETCH,
|
||||||
OPTION_ONLY_SETTING,
|
OPTION_ONLY_SETTING,
|
||||||
@@ -632,7 +632,7 @@ 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($tf("obsidianLiveSyncSettingTab.msgAreYouSureProceed"), {
|
(await this.plugin.confirm.askYesNoDialog($msg("obsidianLiveSyncSettingTab.msgAreYouSureProceed"), {
|
||||||
defaultOption: "No",
|
defaultOption: "No",
|
||||||
})) != "yes"
|
})) != "yes"
|
||||||
)
|
)
|
||||||
@@ -663,8 +663,8 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
{ cls: "sls-setting-menu-buttons" },
|
{ cls: "sls-setting-menu-buttons" },
|
||||||
(el) => {
|
(el) => {
|
||||||
el.addClass("wizardHidden");
|
el.addClass("wizardHidden");
|
||||||
el.createEl("label", { text: $tf("obsidianLiveSyncSettingTab.msgChangesNeedToBeApplied") });
|
el.createEl("label", { text: $msg("obsidianLiveSyncSettingTab.msgChangesNeedToBeApplied") });
|
||||||
void this.addEl(el, "button", { text: $tf("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()));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -821,15 +821,15 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
if (typeof db === "string") {
|
if (typeof db === "string") {
|
||||||
Logger($tf("obsidianLiveSyncSettingTab.logCheckPassphraseFailed", { db }), LOG_LEVEL_NOTICE);
|
Logger($msg("obsidianLiveSyncSettingTab.logCheckPassphraseFailed", { db }), LOG_LEVEL_NOTICE);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (await checkSyncInfo(db.db)) {
|
if (await checkSyncInfo(db.db)) {
|
||||||
// Logger($tf("obsidianLiveSyncSettingTab.logDatabaseConnected"), LOG_LEVEL_NOTICE);
|
// Logger($msg("obsidianLiveSyncSettingTab.logDatabaseConnected"), LOG_LEVEL_NOTICE);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
Logger(
|
Logger(
|
||||||
$tf("obsidianLiveSyncSettingTab.logPassphraseNotCompatible"),
|
$msg("obsidianLiveSyncSettingTab.logPassphraseNotCompatible"),
|
||||||
LOG_LEVEL_NOTICE
|
LOG_LEVEL_NOTICE
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
@@ -838,11 +838,11 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
};
|
};
|
||||||
const isPassphraseValid = async () => {
|
const isPassphraseValid = async () => {
|
||||||
if (this.editingSettings.encrypt && this.editingSettings.passphrase == "") {
|
if (this.editingSettings.encrypt && this.editingSettings.passphrase == "") {
|
||||||
Logger($tf("obsidianLiveSyncSettingTab.logEncryptionNoPassphrase"), LOG_LEVEL_NOTICE);
|
Logger($msg("obsidianLiveSyncSettingTab.logEncryptionNoPassphrase"), LOG_LEVEL_NOTICE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.editingSettings.encrypt && !(await testCrypt())) {
|
if (this.editingSettings.encrypt && !(await testCrypt())) {
|
||||||
Logger($tf("obsidianLiveSyncSettingTab.logEncryptionNoSupport"), LOG_LEVEL_NOTICE);
|
Logger($msg("obsidianLiveSyncSettingTab.logEncryptionNoSupport"), LOG_LEVEL_NOTICE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -852,11 +852,11 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
method: "localOnly" | "remoteOnly" | "rebuildBothByThisDevice" | "localOnlyWithChunks"
|
method: "localOnly" | "remoteOnly" | "rebuildBothByThisDevice" | "localOnlyWithChunks"
|
||||||
) => {
|
) => {
|
||||||
if (this.editingSettings.encrypt && this.editingSettings.passphrase == "") {
|
if (this.editingSettings.encrypt && this.editingSettings.passphrase == "") {
|
||||||
Logger($tf("obsidianLiveSyncSettingTab.logEncryptionNoPassphrase"), LOG_LEVEL_NOTICE);
|
Logger($msg("obsidianLiveSyncSettingTab.logEncryptionNoPassphrase"), LOG_LEVEL_NOTICE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.editingSettings.encrypt && !(await testCrypt())) {
|
if (this.editingSettings.encrypt && !(await testCrypt())) {
|
||||||
Logger($tf("obsidianLiveSyncSettingTab.logEncryptionNoSupport"), LOG_LEVEL_NOTICE);
|
Logger($msg("obsidianLiveSyncSettingTab.logEncryptionNoSupport"), LOG_LEVEL_NOTICE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this.editingSettings.encrypt) {
|
if (!this.editingSettings.encrypt) {
|
||||||
@@ -867,7 +867,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
await this.plugin.$allSuspendExtraSync();
|
await this.plugin.$allSuspendExtraSync();
|
||||||
this.reloadAllSettings();
|
this.reloadAllSettings();
|
||||||
this.editingSettings.isConfigured = true;
|
this.editingSettings.isConfigured = true;
|
||||||
Logger($tf("obsidianLiveSyncSettingTab.logRebuildNote"), LOG_LEVEL_NOTICE);
|
Logger($msg("obsidianLiveSyncSettingTab.logRebuildNote"), LOG_LEVEL_NOTICE);
|
||||||
await this.saveAllDirtySettings();
|
await this.saveAllDirtySettings();
|
||||||
this.closeSetting();
|
this.closeSetting();
|
||||||
await delay(2000);
|
await delay(2000);
|
||||||
@@ -875,14 +875,14 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
};
|
};
|
||||||
// Panes
|
// Panes
|
||||||
|
|
||||||
void addPane(containerEl, $tf("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>${$tf("obsidianLiveSyncSettingTab.msgNewVersionNote")}</p><button>${$tf("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", () => {
|
||||||
@@ -898,33 +898,33 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
void addPane(containerEl, $tf("obsidianLiveSyncSettingTab.panelSetup"), "🧙♂️", 110, false).then((paneEl) => {
|
void addPane(containerEl, $msg("obsidianLiveSyncSettingTab.panelSetup"), "🧙♂️", 110, false).then((paneEl) => {
|
||||||
void addPanel(paneEl, $tf("obsidianLiveSyncSettingTab.titleQuickSetup")).then((paneEl) => {
|
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleQuickSetup")).then((paneEl) => {
|
||||||
new Setting(paneEl)
|
new Setting(paneEl)
|
||||||
.setName($tf("obsidianLiveSyncSettingTab.nameConnectSetupURI"))
|
.setName($msg("obsidianLiveSyncSettingTab.nameConnectSetupURI"))
|
||||||
.setDesc($tf("obsidianLiveSyncSettingTab.descConnectSetupURI"))
|
.setDesc($msg("obsidianLiveSyncSettingTab.descConnectSetupURI"))
|
||||||
.addButton((text) => {
|
.addButton((text) => {
|
||||||
text.setButtonText($tf("obsidianLiveSyncSettingTab.btnUse")).onClick(() => {
|
text.setButtonText($msg("obsidianLiveSyncSettingTab.btnUse")).onClick(() => {
|
||||||
this.closeSetting();
|
this.closeSetting();
|
||||||
eventHub.emitEvent(EVENT_REQUEST_OPEN_SETUP_URI);
|
eventHub.emitEvent(EVENT_REQUEST_OPEN_SETUP_URI);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
new Setting(paneEl)
|
new Setting(paneEl)
|
||||||
.setName($tf("obsidianLiveSyncSettingTab.nameManualSetup"))
|
.setName($msg("obsidianLiveSyncSettingTab.nameManualSetup"))
|
||||||
.setDesc($tf("obsidianLiveSyncSettingTab.descManualSetup"))
|
.setDesc($msg("obsidianLiveSyncSettingTab.descManualSetup"))
|
||||||
.addButton((text) => {
|
.addButton((text) => {
|
||||||
text.setButtonText($tf("obsidianLiveSyncSettingTab.btnStart")).onClick(async () => {
|
text.setButtonText($msg("obsidianLiveSyncSettingTab.btnStart")).onClick(async () => {
|
||||||
await this.enableMinimalSetup();
|
await this.enableMinimalSetup();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
new Setting(paneEl)
|
new Setting(paneEl)
|
||||||
.setName($tf("obsidianLiveSyncSettingTab.nameEnableLiveSync"))
|
.setName($msg("obsidianLiveSyncSettingTab.nameEnableLiveSync"))
|
||||||
.setDesc($tf("obsidianLiveSyncSettingTab.descEnableLiveSync"))
|
.setDesc($msg("obsidianLiveSyncSettingTab.descEnableLiveSync"))
|
||||||
.addOnUpdate(visibleOnly(() => !this.isConfiguredAs("isConfigured", true)))
|
.addOnUpdate(visibleOnly(() => !this.isConfiguredAs("isConfigured", true)))
|
||||||
.addButton((text) => {
|
.addButton((text) => {
|
||||||
text.setButtonText($tf("obsidianLiveSyncSettingTab.btnEnable")).onClick(async () => {
|
text.setButtonText($msg("obsidianLiveSyncSettingTab.btnEnable")).onClick(async () => {
|
||||||
this.editingSettings.isConfigured = true;
|
this.editingSettings.isConfigured = true;
|
||||||
await this.saveAllDirtySettings();
|
await this.saveAllDirtySettings();
|
||||||
this.plugin.$$askReload();
|
this.plugin.$$askReload();
|
||||||
@@ -934,29 +934,29 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
|
|
||||||
void addPanel(
|
void addPanel(
|
||||||
paneEl,
|
paneEl,
|
||||||
$tf("obsidianLiveSyncSettingTab.titleSetupOtherDevices"),
|
$msg("obsidianLiveSyncSettingTab.titleSetupOtherDevices"),
|
||||||
undefined,
|
undefined,
|
||||||
visibleOnly(() => this.isConfiguredAs("isConfigured", true))
|
visibleOnly(() => this.isConfiguredAs("isConfigured", true))
|
||||||
).then((paneEl) => {
|
).then((paneEl) => {
|
||||||
new Setting(paneEl)
|
new Setting(paneEl)
|
||||||
.setName($tf("obsidianLiveSyncSettingTab.nameCopySetupURI"))
|
.setName($msg("obsidianLiveSyncSettingTab.nameCopySetupURI"))
|
||||||
.setDesc($tf("obsidianLiveSyncSettingTab.descCopySetupURI"))
|
.setDesc($msg("obsidianLiveSyncSettingTab.descCopySetupURI"))
|
||||||
.addButton((text) => {
|
.addButton((text) => {
|
||||||
text.setButtonText($tf("obsidianLiveSyncSettingTab.btnCopy")).onClick(() => {
|
text.setButtonText($msg("obsidianLiveSyncSettingTab.btnCopy")).onClick(() => {
|
||||||
// await this.plugin.addOnSetup.command_copySetupURI();
|
// await this.plugin.addOnSetup.command_copySetupURI();
|
||||||
eventHub.emitEvent(EVENT_REQUEST_COPY_SETUP_URI);
|
eventHub.emitEvent(EVENT_REQUEST_COPY_SETUP_URI);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
void addPanel(paneEl, $tf("obsidianLiveSyncSettingTab.titleReset")).then((paneEl) => {
|
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleReset")).then((paneEl) => {
|
||||||
new Setting(paneEl)
|
new Setting(paneEl)
|
||||||
.setName($tf("obsidianLiveSyncSettingTab.nameDiscardSettings"))
|
.setName($msg("obsidianLiveSyncSettingTab.nameDiscardSettings"))
|
||||||
.addButton((text) => {
|
.addButton((text) => {
|
||||||
text.setButtonText($tf("obsidianLiveSyncSettingTab.btnDiscard"))
|
text.setButtonText($msg("obsidianLiveSyncSettingTab.btnDiscard"))
|
||||||
.onClick(async () => {
|
.onClick(async () => {
|
||||||
if (
|
if (
|
||||||
(await this.plugin.confirm.askYesNoDialog(
|
(await this.plugin.confirm.askYesNoDialog(
|
||||||
$tf("obsidianLiveSyncSettingTab.msgDiscardConfirmation"),
|
$msg("obsidianLiveSyncSettingTab.msgDiscardConfirmation"),
|
||||||
{ defaultOption: "No" }
|
{ defaultOption: "No" }
|
||||||
)) == "yes"
|
)) == "yes"
|
||||||
) {
|
) {
|
||||||
@@ -974,7 +974,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
.addOnUpdate(visibleOnly(() => this.isConfiguredAs("isConfigured", true)));
|
.addOnUpdate(visibleOnly(() => this.isConfiguredAs("isConfigured", true)));
|
||||||
});
|
});
|
||||||
|
|
||||||
void addPanel(paneEl, $tf("obsidianLiveSyncSettingTab.titleExtraFeatures")).then((paneEl) => {
|
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleExtraFeatures")).then((paneEl) => {
|
||||||
new Setting(paneEl).autoWireToggle("useAdvancedMode");
|
new Setting(paneEl).autoWireToggle("useAdvancedMode");
|
||||||
|
|
||||||
new Setting(paneEl).autoWireToggle("usePowerUserMode");
|
new Setting(paneEl).autoWireToggle("usePowerUserMode");
|
||||||
@@ -985,17 +985,17 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
this.addOnSaved("useEdgeCaseMode", () => this.display());
|
this.addOnSaved("useEdgeCaseMode", () => this.display());
|
||||||
});
|
});
|
||||||
|
|
||||||
void addPanel(paneEl, $tf("obsidianLiveSyncSettingTab.titleOnlineTips")).then((paneEl) => {
|
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleOnlineTips")).then((paneEl) => {
|
||||||
// this.createEl(paneEl, "h3", { text: $tf("obsidianLiveSyncSettingTab.titleOnlineTips") });
|
// this.createEl(paneEl, "h3", { text: $msg("obsidianLiveSyncSettingTab.titleOnlineTips") });
|
||||||
const repo = "vrtmrz/obsidian-livesync";
|
const repo = "vrtmrz/obsidian-livesync";
|
||||||
const topPath = $tf("obsidianLiveSyncSettingTab.linkTroubleshooting");
|
const topPath = $msg("obsidianLiveSyncSettingTab.linkTroubleshooting");
|
||||||
const rawRepoURI = `https://raw.githubusercontent.com/${repo}/main`;
|
const rawRepoURI = `https://raw.githubusercontent.com/${repo}/main`;
|
||||||
this.createEl(
|
this.createEl(
|
||||||
paneEl,
|
paneEl,
|
||||||
"div",
|
"div",
|
||||||
"",
|
"",
|
||||||
(el) =>
|
(el) =>
|
||||||
(el.innerHTML = `<a href='https://github.com/${repo}/blob/main${topPath}' target="_blank">${$tf("obsidianLiveSyncSettingTab.linkOpenInBrowser")}</a>`)
|
(el.innerHTML = `<a href='https://github.com/${repo}/blob/main${topPath}' target="_blank">${$msg("obsidianLiveSyncSettingTab.linkOpenInBrowser")}</a>`)
|
||||||
);
|
);
|
||||||
const troubleShootEl = this.createEl(paneEl, "div", {
|
const troubleShootEl = this.createEl(paneEl, "div", {
|
||||||
text: "",
|
text: "",
|
||||||
@@ -1015,7 +1015,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
try {
|
try {
|
||||||
remoteTroubleShootMDSrc = await request(`${rawRepoURI}${basePath}/${filename}`);
|
remoteTroubleShootMDSrc = await request(`${rawRepoURI}${basePath}/${filename}`);
|
||||||
} catch (ex: any) {
|
} catch (ex: any) {
|
||||||
remoteTroubleShootMDSrc = `${$tf("obsidianLiveSyncSettingTab.logErrorOccurred")}\n${ex.toString()}`;
|
remoteTroubleShootMDSrc = `${$msg("obsidianLiveSyncSettingTab.logErrorOccurred")}\n${ex.toString()}`;
|
||||||
}
|
}
|
||||||
const remoteTroubleShootMD = remoteTroubleShootMDSrc.replace(
|
const remoteTroubleShootMD = remoteTroubleShootMDSrc.replace(
|
||||||
/\((.*?(.png)|(.jpg))\)/g,
|
/\((.*?(.png)|(.jpg))\)/g,
|
||||||
@@ -1024,7 +1024,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
// Render markdown
|
// Render markdown
|
||||||
await MarkdownRenderer.render(
|
await MarkdownRenderer.render(
|
||||||
this.plugin.app,
|
this.plugin.app,
|
||||||
`<a class='sls-troubleshoot-anchor'></a> [${$tf("obsidianLiveSyncSettingTab.linkTipsAndTroubleshooting")}](${topPath}) [${$tf("obsidianLiveSyncSettingTab.linkPageTop")}](${filename})\n\n${remoteTroubleShootMD}`,
|
`<a class='sls-troubleshoot-anchor'></a> [${$msg("obsidianLiveSyncSettingTab.linkTipsAndTroubleshooting")}](${topPath}) [${$msg("obsidianLiveSyncSettingTab.linkPageTop")}](${filename})\n\n${remoteTroubleShootMD}`,
|
||||||
troubleShootEl,
|
troubleShootEl,
|
||||||
`${rawRepoURI}`,
|
`${rawRepoURI}`,
|
||||||
this.plugin
|
this.plugin
|
||||||
@@ -1077,10 +1077,10 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
void loadMarkdownPage(topPath);
|
void loadMarkdownPage(topPath);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
void addPane(containerEl, $tf("obsidianLiveSyncSettingTab.panelGeneralSettings"), "⚙️", 20, false).then((paneEl) => {
|
void addPane(containerEl, $msg("obsidianLiveSyncSettingTab.panelGeneralSettings"), "⚙️", 20, false).then((paneEl) => {
|
||||||
void addPanel(paneEl, $tf("obsidianLiveSyncSettingTab.titleAppearance")).then((paneEl) => {
|
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleAppearance")).then((paneEl) => {
|
||||||
const languages = Object.fromEntries([
|
const languages = Object.fromEntries([
|
||||||
["", $tf("obsidianLiveSyncSettingTab.defaultLanguage")],
|
["", $msg("obsidianLiveSyncSettingTab.defaultLanguage")],
|
||||||
...SUPPORTED_I18N_LANGS.map((e) => [e, $t(`lang-${e}`)]),
|
...SUPPORTED_I18N_LANGS.map((e) => [e, $t(`lang-${e}`)]),
|
||||||
]) as Record<I18N_LANGS, string>;
|
]) as Record<I18N_LANGS, string>;
|
||||||
new Setting(paneEl).autoWireDropDown("displayLanguage", {
|
new Setting(paneEl).autoWireDropDown("displayLanguage", {
|
||||||
@@ -1093,7 +1093,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
});
|
});
|
||||||
new Setting(paneEl).autoWireToggle("showStatusOnStatusbar");
|
new Setting(paneEl).autoWireToggle("showStatusOnStatusbar");
|
||||||
});
|
});
|
||||||
void addPanel(paneEl, $tf("obsidianLiveSyncSettingTab.titleLogging")).then((paneEl) => {
|
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleLogging")).then((paneEl) => {
|
||||||
paneEl.addClass("wizardHidden");
|
paneEl.addClass("wizardHidden");
|
||||||
|
|
||||||
new Setting(paneEl).autoWireToggle("lessInformationInLog");
|
new Setting(paneEl).autoWireToggle("lessInformationInLog");
|
||||||
@@ -1104,7 +1104,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
});
|
});
|
||||||
new Setting(paneEl).setClass("wizardOnly").addButton((button) =>
|
new Setting(paneEl).setClass("wizardOnly").addButton((button) =>
|
||||||
button
|
button
|
||||||
.setButtonText($tf("obsidianLiveSyncSettingTab.btnNext"))
|
.setButtonText($msg("obsidianLiveSyncSettingTab.btnNext"))
|
||||||
.setCta()
|
.setCta()
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
this.changeDisplay("0");
|
this.changeDisplay("0");
|
||||||
@@ -1113,7 +1113,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
});
|
});
|
||||||
let checkResultDiv: HTMLDivElement;
|
let checkResultDiv: HTMLDivElement;
|
||||||
const checkConfig = async (checkResultDiv: HTMLDivElement | undefined) => {
|
const checkConfig = async (checkResultDiv: HTMLDivElement | undefined) => {
|
||||||
Logger($tf("obsidianLiveSyncSettingTab.logCheckingDbConfig"), LOG_LEVEL_INFO);
|
Logger($msg("obsidianLiveSyncSettingTab.logCheckingDbConfig"), LOG_LEVEL_INFO);
|
||||||
let isSuccessful = true;
|
let isSuccessful = true;
|
||||||
const emptyDiv = createDiv();
|
const emptyDiv = createDiv();
|
||||||
emptyDiv.innerHTML = "<span></span>";
|
emptyDiv.innerHTML = "<span></span>";
|
||||||
@@ -1129,10 +1129,10 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
if (isCloudantURI(this.editingSettings.couchDB_URI)) {
|
if (isCloudantURI(this.editingSettings.couchDB_URI)) {
|
||||||
Logger($tf("obsidianLiveSyncSettingTab.logCannotUseCloudant"), LOG_LEVEL_NOTICE);
|
Logger($msg("obsidianLiveSyncSettingTab.logCannotUseCloudant"), LOG_LEVEL_NOTICE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Tip: Add log for cloudant as Logger($tf("obsidianLiveSyncSettingTab.logServerConfigurationCheck"));
|
// Tip: Add log for cloudant as Logger($msg("obsidianLiveSyncSettingTab.logServerConfigurationCheck"));
|
||||||
const r = await requestToCouchDB(
|
const r = await requestToCouchDB(
|
||||||
this.editingSettings.couchDB_URI,
|
this.editingSettings.couchDB_URI,
|
||||||
this.editingSettings.couchDB_USER,
|
this.editingSettings.couchDB_USER,
|
||||||
@@ -1145,11 +1145,11 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
if (!checkResultDiv) return;
|
if (!checkResultDiv) return;
|
||||||
const tmpDiv = createDiv();
|
const tmpDiv = createDiv();
|
||||||
tmpDiv.addClass("ob-btn-config-fix");
|
tmpDiv.addClass("ob-btn-config-fix");
|
||||||
tmpDiv.innerHTML = `<label>${title}</label><button>${$tf("obsidianLiveSyncSettingTab.btnFix")}</button>`;
|
tmpDiv.innerHTML = `<label>${title}</label><button>${$msg("obsidianLiveSyncSettingTab.btnFix")}</button>`;
|
||||||
const x = checkResultDiv.appendChild(tmpDiv);
|
const x = checkResultDiv.appendChild(tmpDiv);
|
||||||
x.querySelector("button")?.addEventListener("click", () => {
|
x.querySelector("button")?.addEventListener("click", () => {
|
||||||
fireAndForget(async () => {
|
fireAndForget(async () => {
|
||||||
Logger($tf("obsidianLiveSyncSettingTab.logCouchDbConfigSet", { title, key, value }));
|
Logger($msg("obsidianLiveSyncSettingTab.logCouchDbConfigSet", { title, key, value }));
|
||||||
const res = await requestToCouchDB(
|
const res = await requestToCouchDB(
|
||||||
this.editingSettings.couchDB_URI,
|
this.editingSettings.couchDB_URI,
|
||||||
this.editingSettings.couchDB_USER,
|
this.editingSettings.couchDB_USER,
|
||||||
@@ -1159,104 +1159,104 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
value
|
value
|
||||||
);
|
);
|
||||||
if (res.status == 200) {
|
if (res.status == 200) {
|
||||||
Logger($tf("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($tf("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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.msgNotice"), ["ob-btn-config-head"]);
|
addResult($msg("obsidianLiveSyncSettingTab.msgNotice"), ["ob-btn-config-head"]);
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.msgIfConfigNotPersistent"), ["ob-btn-config-info"]);
|
addResult($msg("obsidianLiveSyncSettingTab.msgIfConfigNotPersistent"), ["ob-btn-config-info"]);
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.msgConfigCheck"), ["ob-btn-config-head"]);
|
addResult($msg("obsidianLiveSyncSettingTab.msgConfigCheck"), ["ob-btn-config-head"]);
|
||||||
|
|
||||||
// Admin check
|
// Admin check
|
||||||
// for database creation and deletion
|
// for database creation and deletion
|
||||||
if (!(this.editingSettings.couchDB_USER in responseConfig.admins)) {
|
if (!(this.editingSettings.couchDB_USER in responseConfig.admins)) {
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.warnNoAdmin"));
|
addResult($msg("obsidianLiveSyncSettingTab.warnNoAdmin"));
|
||||||
} else {
|
} else {
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.okAdminPrivileges"));
|
addResult($msg("obsidianLiveSyncSettingTab.okAdminPrivileges"));
|
||||||
}
|
}
|
||||||
// HTTP user-authorization check
|
// HTTP user-authorization check
|
||||||
if (responseConfig?.chttpd?.require_valid_user != "true") {
|
if (responseConfig?.chttpd?.require_valid_user != "true") {
|
||||||
isSuccessful = false;
|
isSuccessful = false;
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.errRequireValidUser"));
|
addResult($msg("obsidianLiveSyncSettingTab.errRequireValidUser"));
|
||||||
addConfigFixButton(
|
addConfigFixButton(
|
||||||
$tf("obsidianLiveSyncSettingTab.msgSetRequireValidUser"),
|
$msg("obsidianLiveSyncSettingTab.msgSetRequireValidUser"),
|
||||||
"chttpd/require_valid_user",
|
"chttpd/require_valid_user",
|
||||||
"true"
|
"true"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.okRequireValidUser"));
|
addResult($msg("obsidianLiveSyncSettingTab.okRequireValidUser"));
|
||||||
}
|
}
|
||||||
if (responseConfig?.chttpd_auth?.require_valid_user != "true") {
|
if (responseConfig?.chttpd_auth?.require_valid_user != "true") {
|
||||||
isSuccessful = false;
|
isSuccessful = false;
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.errRequireValidUserAuth"));
|
addResult($msg("obsidianLiveSyncSettingTab.errRequireValidUserAuth"));
|
||||||
addConfigFixButton(
|
addConfigFixButton(
|
||||||
$tf("obsidianLiveSyncSettingTab.msgSetRequireValidUserAuth"),
|
$msg("obsidianLiveSyncSettingTab.msgSetRequireValidUserAuth"),
|
||||||
"chttpd_auth/require_valid_user",
|
"chttpd_auth/require_valid_user",
|
||||||
"true"
|
"true"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.okRequireValidUserAuth"));
|
addResult($msg("obsidianLiveSyncSettingTab.okRequireValidUserAuth"));
|
||||||
}
|
}
|
||||||
// HTTPD check
|
// HTTPD check
|
||||||
// Check Authentication header
|
// Check Authentication header
|
||||||
if (!responseConfig?.httpd["WWW-Authenticate"]) {
|
if (!responseConfig?.httpd["WWW-Authenticate"]) {
|
||||||
isSuccessful = false;
|
isSuccessful = false;
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.errMissingWwwAuth"));
|
addResult($msg("obsidianLiveSyncSettingTab.errMissingWwwAuth"));
|
||||||
addConfigFixButton(
|
addConfigFixButton(
|
||||||
$tf("obsidianLiveSyncSettingTab.msgSetWwwAuth"),
|
$msg("obsidianLiveSyncSettingTab.msgSetWwwAuth"),
|
||||||
"httpd/WWW-Authenticate",
|
"httpd/WWW-Authenticate",
|
||||||
'Basic realm="couchdb"'
|
'Basic realm="couchdb"'
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.okWwwAuth"));
|
addResult($msg("obsidianLiveSyncSettingTab.okWwwAuth"));
|
||||||
}
|
}
|
||||||
if (responseConfig?.httpd?.enable_cors != "true") {
|
if (responseConfig?.httpd?.enable_cors != "true") {
|
||||||
isSuccessful = false;
|
isSuccessful = false;
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.errEnableCors"));
|
addResult($msg("obsidianLiveSyncSettingTab.errEnableCors"));
|
||||||
addConfigFixButton($tf("obsidianLiveSyncSettingTab.msgEnableCors"), "httpd/enable_cors", "true");
|
addConfigFixButton($msg("obsidianLiveSyncSettingTab.msgEnableCors"), "httpd/enable_cors", "true");
|
||||||
} else {
|
} else {
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.okEnableCors"));
|
addResult($msg("obsidianLiveSyncSettingTab.okEnableCors"));
|
||||||
}
|
}
|
||||||
// If the server is not cloudant, configure request size
|
// If the server is not cloudant, configure request size
|
||||||
if (!isCloudantURI(this.editingSettings.couchDB_URI)) {
|
if (!isCloudantURI(this.editingSettings.couchDB_URI)) {
|
||||||
// REQUEST SIZE
|
// REQUEST SIZE
|
||||||
if (Number(responseConfig?.chttpd?.max_http_request_size ?? 0) < 4294967296) {
|
if (Number(responseConfig?.chttpd?.max_http_request_size ?? 0) < 4294967296) {
|
||||||
isSuccessful = false;
|
isSuccessful = false;
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.errMaxRequestSize"));
|
addResult($msg("obsidianLiveSyncSettingTab.errMaxRequestSize"));
|
||||||
addConfigFixButton(
|
addConfigFixButton(
|
||||||
$tf("obsidianLiveSyncSettingTab.msgSetMaxRequestSize"),
|
$msg("obsidianLiveSyncSettingTab.msgSetMaxRequestSize"),
|
||||||
"chttpd/max_http_request_size",
|
"chttpd/max_http_request_size",
|
||||||
"4294967296"
|
"4294967296"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.okMaxRequestSize"));
|
addResult($msg("obsidianLiveSyncSettingTab.okMaxRequestSize"));
|
||||||
}
|
}
|
||||||
if (Number(responseConfig?.couchdb?.max_document_size ?? 0) < 50000000) {
|
if (Number(responseConfig?.couchdb?.max_document_size ?? 0) < 50000000) {
|
||||||
isSuccessful = false;
|
isSuccessful = false;
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.errMaxDocumentSize"));
|
addResult($msg("obsidianLiveSyncSettingTab.errMaxDocumentSize"));
|
||||||
addConfigFixButton(
|
addConfigFixButton(
|
||||||
$tf("obsidianLiveSyncSettingTab.msgSetMaxDocSize"),
|
$msg("obsidianLiveSyncSettingTab.msgSetMaxDocSize"),
|
||||||
"couchdb/max_document_size",
|
"couchdb/max_document_size",
|
||||||
"50000000"
|
"50000000"
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.okMaxDocumentSize"));
|
addResult($msg("obsidianLiveSyncSettingTab.okMaxDocumentSize"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// CORS check
|
// CORS check
|
||||||
// checking connectivity for mobile
|
// checking connectivity for mobile
|
||||||
if (responseConfig?.cors?.credentials != "true") {
|
if (responseConfig?.cors?.credentials != "true") {
|
||||||
isSuccessful = false;
|
isSuccessful = false;
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.errCorsCredentials"));
|
addResult($msg("obsidianLiveSyncSettingTab.errCorsCredentials"));
|
||||||
addConfigFixButton($tf("obsidianLiveSyncSettingTab.msgSetCorsCredentials"), "cors/credentials", "true");
|
addConfigFixButton($msg("obsidianLiveSyncSettingTab.msgSetCorsCredentials"), "cors/credentials", "true");
|
||||||
} else {
|
} else {
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.okCorsCredentials"));
|
addResult($msg("obsidianLiveSyncSettingTab.okCorsCredentials"));
|
||||||
}
|
}
|
||||||
const ConfiguredOrigins = ((responseConfig?.cors?.origins ?? "") + "").split(",");
|
const ConfiguredOrigins = ((responseConfig?.cors?.origins ?? "") + "").split(",");
|
||||||
if (
|
if (
|
||||||
@@ -1265,18 +1265,18 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
ConfiguredOrigins.indexOf("capacitor://localhost") !== -1 &&
|
ConfiguredOrigins.indexOf("capacitor://localhost") !== -1 &&
|
||||||
ConfiguredOrigins.indexOf("http://localhost") !== -1)
|
ConfiguredOrigins.indexOf("http://localhost") !== -1)
|
||||||
) {
|
) {
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.okCorsOrigins"));
|
addResult($msg("obsidianLiveSyncSettingTab.okCorsOrigins"));
|
||||||
} else {
|
} else {
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.errCorsOrigins"));
|
addResult($msg("obsidianLiveSyncSettingTab.errCorsOrigins"));
|
||||||
addConfigFixButton(
|
addConfigFixButton(
|
||||||
$tf("obsidianLiveSyncSettingTab.msgSetCorsOrigins"),
|
$msg("obsidianLiveSyncSettingTab.msgSetCorsOrigins"),
|
||||||
"cors/origins",
|
"cors/origins",
|
||||||
"app://obsidian.md,capacitor://localhost,http://localhost"
|
"app://obsidian.md,capacitor://localhost,http://localhost"
|
||||||
);
|
);
|
||||||
isSuccessful = false;
|
isSuccessful = false;
|
||||||
}
|
}
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.msgConnectionCheck"), ["ob-btn-config-head"]);
|
addResult($msg("obsidianLiveSyncSettingTab.msgConnectionCheck"), ["ob-btn-config-head"]);
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.msgCurrentOrigin", { origin: window.location.origin }));
|
addResult($msg("obsidianLiveSyncSettingTab.msgCurrentOrigin", { origin: window.location.origin }));
|
||||||
|
|
||||||
// Request header check
|
// Request header check
|
||||||
const origins = ["app://obsidian.md", "capacitor://localhost", "http://localhost"];
|
const origins = ["app://obsidian.md", "capacitor://localhost", "http://localhost"];
|
||||||
@@ -1293,35 +1293,35 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
return e;
|
return e;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.msgOriginCheck", { org }));
|
addResult($msg("obsidianLiveSyncSettingTab.msgOriginCheck", { org }));
|
||||||
if (responseHeaders["access-control-allow-credentials"] != "true") {
|
if (responseHeaders["access-control-allow-credentials"] != "true") {
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.errCorsNotAllowingCredentials"));
|
addResult($msg("obsidianLiveSyncSettingTab.errCorsNotAllowingCredentials"));
|
||||||
isSuccessful = false;
|
isSuccessful = false;
|
||||||
} else {
|
} else {
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.okCorsCredentialsForOrigin"));
|
addResult($msg("obsidianLiveSyncSettingTab.okCorsCredentialsForOrigin"));
|
||||||
}
|
}
|
||||||
if (responseHeaders["access-control-allow-origin"] != org) {
|
if (responseHeaders["access-control-allow-origin"] != org) {
|
||||||
addResult(
|
addResult(
|
||||||
$tf("obsidianLiveSyncSettingTab.warnCorsOriginUnmatched", {
|
$msg("obsidianLiveSyncSettingTab.warnCorsOriginUnmatched", {
|
||||||
from: origin,
|
from: origin,
|
||||||
to: responseHeaders["access-control-allow-origin"],
|
to: responseHeaders["access-control-allow-origin"],
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.okCorsOriginMatched"));
|
addResult($msg("obsidianLiveSyncSettingTab.okCorsOriginMatched"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.msgDone"), ["ob-btn-config-head"]);
|
addResult($msg("obsidianLiveSyncSettingTab.msgDone"), ["ob-btn-config-head"]);
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.msgConnectionProxyNote"), ["ob-btn-config-info"]);
|
addResult($msg("obsidianLiveSyncSettingTab.msgConnectionProxyNote"), ["ob-btn-config-info"]);
|
||||||
Logger($tf("obsidianLiveSyncSettingTab.logCheckingConfigDone"), LOG_LEVEL_INFO);
|
Logger($msg("obsidianLiveSyncSettingTab.logCheckingConfigDone"), LOG_LEVEL_INFO);
|
||||||
} catch (ex: any) {
|
} catch (ex: any) {
|
||||||
if (ex?.status == 401) {
|
if (ex?.status == 401) {
|
||||||
isSuccessful = false;
|
isSuccessful = false;
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.errAccessForbidden"));
|
addResult($msg("obsidianLiveSyncSettingTab.errAccessForbidden"));
|
||||||
addResult($tf("obsidianLiveSyncSettingTab.errCannotContinueTest"));
|
addResult($msg("obsidianLiveSyncSettingTab.errCannotContinueTest"));
|
||||||
Logger($tf("obsidianLiveSyncSettingTab.logCheckingConfigDone"), LOG_LEVEL_INFO);
|
Logger($msg("obsidianLiveSyncSettingTab.logCheckingConfigDone"), LOG_LEVEL_INFO);
|
||||||
} else {
|
} else {
|
||||||
Logger($tf("obsidianLiveSyncSettingTab.logCheckingConfigFailed"), LOG_LEVEL_NOTICE);
|
Logger($msg("obsidianLiveSyncSettingTab.logCheckingConfigFailed"), LOG_LEVEL_NOTICE);
|
||||||
Logger(ex);
|
Logger(ex);
|
||||||
isSuccessful = false;
|
isSuccessful = false;
|
||||||
}
|
}
|
||||||
@@ -1329,23 +1329,23 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
return isSuccessful;
|
return isSuccessful;
|
||||||
};
|
};
|
||||||
|
|
||||||
void addPane(containerEl, $tf("obsidianLiveSyncSettingTab.panelRemoteConfiguration"), "🛰️", 0, false).then((paneEl) => {
|
void addPane(containerEl, $msg("obsidianLiveSyncSettingTab.panelRemoteConfiguration"), "🛰️", 0, false).then((paneEl) => {
|
||||||
void addPanel(paneEl, $tf("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", {
|
||||||
holdValue: true,
|
holdValue: true,
|
||||||
options: {
|
options: {
|
||||||
[REMOTE_COUCHDB]: $tf("obsidianLiveSyncSettingTab.optionCouchDB"),
|
[REMOTE_COUCHDB]: $msg("obsidianLiveSyncSettingTab.optionCouchDB"),
|
||||||
[REMOTE_MINIO]: $tf("obsidianLiveSyncSettingTab.optionMinioS3R2"),
|
[REMOTE_MINIO]: $msg("obsidianLiveSyncSettingTab.optionMinioS3R2"),
|
||||||
},
|
},
|
||||||
onUpdate: enableOnlySyncDisabled,
|
onUpdate: enableOnlySyncDisabled,
|
||||||
});
|
});
|
||||||
|
|
||||||
void addPanel(paneEl, $tf("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: "",
|
||||||
});
|
});
|
||||||
const ObjectStorageMessage = $tf("obsidianLiveSyncSettingTab.msgObjectStorageWarning");
|
const ObjectStorageMessage = $msg("obsidianLiveSyncSettingTab.msgObjectStorageWarning");
|
||||||
|
|
||||||
void MarkdownRenderer.render(
|
void MarkdownRenderer.render(
|
||||||
this.plugin.app,
|
this.plugin.app,
|
||||||
@@ -1369,16 +1369,16 @@ 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($tf("obsidianLiveSyncSettingTab.nameTestConnection")).addButton((button) =>
|
new Setting(paneEl).setName($msg("obsidianLiveSyncSettingTab.nameTestConnection")).addButton((button) =>
|
||||||
button
|
button
|
||||||
.setButtonText($tf("obsidianLiveSyncSettingTab.btnTest"))
|
.setButtonText($msg("obsidianLiveSyncSettingTab.btnTest"))
|
||||||
.setDisabled(false)
|
.setDisabled(false)
|
||||||
.onClick(async () => {
|
.onClick(async () => {
|
||||||
await this.testConnection(this.editingSettings);
|
await this.testConnection(this.editingSettings);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
new Setting(paneEl)
|
new Setting(paneEl)
|
||||||
.setName($tf("obsidianLiveSyncSettingTab.nameApplySettings"))
|
.setName($msg("obsidianLiveSyncSettingTab.nameApplySettings"))
|
||||||
.setClass("wizardHidden")
|
.setClass("wizardHidden")
|
||||||
.addApplyButton([
|
.addApplyButton([
|
||||||
"remoteType",
|
"remoteType",
|
||||||
@@ -1392,13 +1392,13 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
.addOnUpdate(onlyOnMinIO);
|
.addOnUpdate(onlyOnMinIO);
|
||||||
});
|
});
|
||||||
|
|
||||||
void addPanel(paneEl, $tf("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,
|
||||||
"div",
|
"div",
|
||||||
{
|
{
|
||||||
text:$tf("obsidianLiveSyncSettingTab.msgNonHTTPSWarning"),
|
text:$msg("obsidianLiveSyncSettingTab.msgNonHTTPSWarning"),
|
||||||
},
|
},
|
||||||
undefined,
|
undefined,
|
||||||
visibleOnly(() => !this.editingSettings.couchDB_URI.startsWith("https://"))
|
visibleOnly(() => !this.editingSettings.couchDB_URI.startsWith("https://"))
|
||||||
@@ -1408,7 +1408,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
paneEl,
|
paneEl,
|
||||||
"div",
|
"div",
|
||||||
{
|
{
|
||||||
text: $tf("obsidianLiveSyncSettingTab.msgNonHTTPSInfo"),
|
text: $msg("obsidianLiveSyncSettingTab.msgNonHTTPSInfo"),
|
||||||
},
|
},
|
||||||
undefined,
|
undefined,
|
||||||
visibleOnly(() => !this.editingSettings.couchDB_URI.startsWith("https://"))
|
visibleOnly(() => !this.editingSettings.couchDB_URI.startsWith("https://"))
|
||||||
@@ -1419,7 +1419,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
paneEl,
|
paneEl,
|
||||||
"div",
|
"div",
|
||||||
{
|
{
|
||||||
text: $tf("obsidianLiveSyncSettingTab.msgSettingsUnchangeableDuringSync"),
|
text: $msg("obsidianLiveSyncSettingTab.msgSettingsUnchangeableDuringSync"),
|
||||||
},
|
},
|
||||||
undefined,
|
undefined,
|
||||||
visibleOnly(() => isAnySyncEnabled())
|
visibleOnly(() => isAnySyncEnabled())
|
||||||
@@ -1444,12 +1444,12 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
});
|
});
|
||||||
|
|
||||||
new Setting(paneEl)
|
new Setting(paneEl)
|
||||||
.setName($tf("obsidianLiveSyncSettingTab.nameTestDatabaseConnection"))
|
.setName($msg("obsidianLiveSyncSettingTab.nameTestDatabaseConnection"))
|
||||||
.setClass("wizardHidden")
|
.setClass("wizardHidden")
|
||||||
.setDesc($tf("obsidianLiveSyncSettingTab.descTestDatabaseConnection"))
|
.setDesc($msg("obsidianLiveSyncSettingTab.descTestDatabaseConnection"))
|
||||||
.addButton((button) =>
|
.addButton((button) =>
|
||||||
button
|
button
|
||||||
.setButtonText($tf("obsidianLiveSyncSettingTab.btnTest"))
|
.setButtonText($msg("obsidianLiveSyncSettingTab.btnTest"))
|
||||||
.setDisabled(false)
|
.setDisabled(false)
|
||||||
.onClick(async () => {
|
.onClick(async () => {
|
||||||
await this.testConnection();
|
await this.testConnection();
|
||||||
@@ -1457,11 +1457,11 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
);
|
);
|
||||||
|
|
||||||
new Setting(paneEl)
|
new Setting(paneEl)
|
||||||
.setName($tf("obsidianLiveSyncSettingTab.nameValidateDatabaseConfig"))
|
.setName($msg("obsidianLiveSyncSettingTab.nameValidateDatabaseConfig"))
|
||||||
.setDesc($tf("obsidianLiveSyncSettingTab.descValidateDatabaseConfig"))
|
.setDesc($msg("obsidianLiveSyncSettingTab.descValidateDatabaseConfig"))
|
||||||
.addButton((button) =>
|
.addButton((button) =>
|
||||||
button
|
button
|
||||||
.setButtonText($tf("obsidianLiveSyncSettingTab.btnCheck"))
|
.setButtonText($msg("obsidianLiveSyncSettingTab.btnCheck"))
|
||||||
.setDisabled(false)
|
.setDisabled(false)
|
||||||
.onClick(async () => {
|
.onClick(async () => {
|
||||||
await checkConfig(checkResultDiv);
|
await checkConfig(checkResultDiv);
|
||||||
@@ -1472,7 +1472,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
});
|
});
|
||||||
|
|
||||||
new Setting(paneEl)
|
new Setting(paneEl)
|
||||||
.setName($tf("obsidianLiveSyncSettingTab.nameApplySettings"))
|
.setName($msg("obsidianLiveSyncSettingTab.nameApplySettings"))
|
||||||
.setClass("wizardHidden")
|
.setClass("wizardHidden")
|
||||||
.addApplyButton([
|
.addApplyButton([
|
||||||
"remoteType",
|
"remoteType",
|
||||||
@@ -1484,12 +1484,12 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
.addOnUpdate(onlyOnCouchDB);
|
.addOnUpdate(onlyOnCouchDB);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
void addPanel(paneEl, $tf("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, $tf("obsidianLiveSyncSettingTab.panelPrivacyEncryption")).then((paneEl) => {
|
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.panelPrivacyEncryption")).then((paneEl) => {
|
||||||
new Setting(paneEl).autoWireToggle("encrypt", { holdValue: true });
|
new Setting(paneEl).autoWireToggle("encrypt", { holdValue: true });
|
||||||
|
|
||||||
const isEncryptEnabled = visibleOnly(() => this.isConfiguredAs("encrypt", true));
|
const isEncryptEnabled = visibleOnly(() => this.isConfiguredAs("encrypt", true));
|
||||||
@@ -1512,13 +1512,13 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
.setClass("wizardHidden");
|
.setClass("wizardHidden");
|
||||||
});
|
});
|
||||||
|
|
||||||
void addPanel(paneEl, $tf("obsidianLiveSyncSettingTab.titleFetchSettings")).then((paneEl) => {
|
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleFetchSettings")).then((paneEl) => {
|
||||||
new Setting(paneEl)
|
new Setting(paneEl)
|
||||||
.setName($tf("obsidianLiveSyncSettingTab.titleFetchConfigFromRemote"))
|
.setName($msg("obsidianLiveSyncSettingTab.titleFetchConfigFromRemote"))
|
||||||
.setDesc($tf("obsidianLiveSyncSettingTab.descFetchConfigFromRemote"))
|
.setDesc($msg("obsidianLiveSyncSettingTab.descFetchConfigFromRemote"))
|
||||||
.addButton((button) =>
|
.addButton((button) =>
|
||||||
button
|
button
|
||||||
.setButtonText($tf("obsidianLiveSyncSettingTab.buttonFetch"))
|
.setButtonText($msg("obsidianLiveSyncSettingTab.buttonFetch"))
|
||||||
.setDisabled(false)
|
.setDisabled(false)
|
||||||
.onClick(async () => {
|
.onClick(async () => {
|
||||||
const trialSetting = { ...this.initialSettings, ...this.editingSettings };
|
const trialSetting = { ...this.initialSettings, ...this.editingSettings };
|
||||||
@@ -1532,15 +1532,15 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
});
|
});
|
||||||
new Setting(paneEl).setClass("wizardOnly").addButton((button) =>
|
new Setting(paneEl).setClass("wizardOnly").addButton((button) =>
|
||||||
button
|
button
|
||||||
.setButtonText($tf("obsidianLiveSyncSettingTab.buttonNext"))
|
.setButtonText($msg("obsidianLiveSyncSettingTab.buttonNext"))
|
||||||
.setCta()
|
.setCta()
|
||||||
.setDisabled(false)
|
.setDisabled(false)
|
||||||
.onClick(async () => {
|
.onClick(async () => {
|
||||||
if (!(await checkConfig(checkResultDiv))) {
|
if (!(await checkConfig(checkResultDiv))) {
|
||||||
if (
|
if (
|
||||||
(await this.plugin.confirm.askYesNoDialog(
|
(await this.plugin.confirm.askYesNoDialog(
|
||||||
$tf("obsidianLiveSyncSettingTab.msgConfigCheckFailed"),
|
$msg("obsidianLiveSyncSettingTab.msgConfigCheckFailed"),
|
||||||
{ defaultOption: "No", title: $tf("obsidianLiveSyncSettingTab.titleRemoteConfigCheckFailed") }
|
{ defaultOption: "No", title: $msg("obsidianLiveSyncSettingTab.titleRemoteConfigCheckFailed") }
|
||||||
)) == "no"
|
)) == "no"
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
@@ -1551,8 +1551,8 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
if (isEncryptionFullyEnabled) {
|
if (isEncryptionFullyEnabled) {
|
||||||
if (
|
if (
|
||||||
(await this.plugin.confirm.askYesNoDialog(
|
(await this.plugin.confirm.askYesNoDialog(
|
||||||
$tf("obsidianLiveSyncSettingTab.msgEnableEncryptionRecommendation"),
|
$msg("obsidianLiveSyncSettingTab.msgEnableEncryptionRecommendation"),
|
||||||
{ defaultOption: "No", title: $tf("obsidianLiveSyncSettingTab.titleEncryptionNotEnabled") }
|
{ defaultOption: "No", title: $msg("obsidianLiveSyncSettingTab.titleEncryptionNotEnabled") }
|
||||||
)) == "no"
|
)) == "no"
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
@@ -1564,8 +1564,8 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
if (!(await isPassphraseValid())) {
|
if (!(await isPassphraseValid())) {
|
||||||
if (
|
if (
|
||||||
(await this.plugin.confirm.askYesNoDialog(
|
(await this.plugin.confirm.askYesNoDialog(
|
||||||
$tf("obsidianLiveSyncSettingTab.msgInvalidPassphrase"),
|
$msg("obsidianLiveSyncSettingTab.msgInvalidPassphrase"),
|
||||||
{ defaultOption: "No", title: $tf("obsidianLiveSyncSettingTab.titleEncryptionPassphraseInvalid") }
|
{ defaultOption: "No", title: $msg("obsidianLiveSyncSettingTab.titleEncryptionPassphraseInvalid") }
|
||||||
)) == "no"
|
)) == "no"
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
@@ -1580,8 +1580,8 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
(await this.plugin.confirm.askYesNoDialog(
|
(await this.plugin.confirm.askYesNoDialog(
|
||||||
$tf("obsidianLiveSyncSettingTab.msgFetchConfigFromRemote"),
|
$msg("obsidianLiveSyncSettingTab.msgFetchConfigFromRemote"),
|
||||||
{ defaultOption: "Yes", title: $tf("obsidianLiveSyncSettingTab.titleFetchConfig") }
|
{ defaultOption: "Yes", title: $msg("obsidianLiveSyncSettingTab.titleFetchConfig") }
|
||||||
)) == "yes"
|
)) == "yes"
|
||||||
) {
|
) {
|
||||||
const trialSetting = { ...this.initialSettings, ...this.editingSettings };
|
const trialSetting = { ...this.initialSettings, ...this.editingSettings };
|
||||||
@@ -1597,7 +1597,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
void addPane(containerEl, $tf("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 +1607,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
cls: "op-warn sls-setting-hidden",
|
cls: "op-warn sls-setting-hidden",
|
||||||
},
|
},
|
||||||
(el) => {
|
(el) => {
|
||||||
this.createEl(el, "button", { text: $tf("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 () => {
|
||||||
@@ -1623,23 +1623,23 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.createEl(paneEl, "div", {
|
this.createEl(paneEl, "div", {
|
||||||
text: $tf("obsidianLiveSyncSettingTab.msgSelectAndApplyPreset"),
|
text: $msg("obsidianLiveSyncSettingTab.msgSelectAndApplyPreset"),
|
||||||
cls: "wizardOnly",
|
cls: "wizardOnly",
|
||||||
}).addClasses(["op-warn-info"]);
|
}).addClasses(["op-warn-info"]);
|
||||||
|
|
||||||
void addPanel(paneEl, $tf("obsidianLiveSyncSettingTab.titleSynchronizationPreset")).then((paneEl) => {
|
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleSynchronizationPreset")).then((paneEl) => {
|
||||||
const options: Record<string, string> =
|
const options: Record<string, string> =
|
||||||
this.editingSettings.remoteType == REMOTE_COUCHDB
|
this.editingSettings.remoteType == REMOTE_COUCHDB
|
||||||
? {
|
? {
|
||||||
NONE: "",
|
NONE: "",
|
||||||
LIVESYNC: $tf("obsidianLiveSyncSettingTab.optionLiveSync"),
|
LIVESYNC: $msg("obsidianLiveSyncSettingTab.optionLiveSync"),
|
||||||
PERIODIC: $tf("obsidianLiveSyncSettingTab.optionPeriodicWithBatch"),
|
PERIODIC: $msg("obsidianLiveSyncSettingTab.optionPeriodicWithBatch"),
|
||||||
DISABLE: $tf("obsidianLiveSyncSettingTab.optionDisableAllAutomatic"),
|
DISABLE: $msg("obsidianLiveSyncSettingTab.optionDisableAllAutomatic"),
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
NONE: "",
|
NONE: "",
|
||||||
PERIODIC: $tf("obsidianLiveSyncSettingTab.optionPeriodicWithBatch"),
|
PERIODIC: $msg("obsidianLiveSyncSettingTab.optionPeriodicWithBatch"),
|
||||||
DISABLE: $tf("obsidianLiveSyncSettingTab.optionDisableAllAutomatic"),
|
DISABLE: $msg("obsidianLiveSyncSettingTab.optionDisableAllAutomatic"),
|
||||||
};
|
};
|
||||||
|
|
||||||
new Setting(paneEl)
|
new Setting(paneEl)
|
||||||
@@ -1648,7 +1648,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
holdValue: true,
|
holdValue: true,
|
||||||
})
|
})
|
||||||
.addButton((button) => {
|
.addButton((button) => {
|
||||||
button.setButtonText($tf("obsidianLiveSyncSettingTab.btnApply"));
|
button.setButtonText($msg("obsidianLiveSyncSettingTab.btnApply"));
|
||||||
button.onClick(async () => {
|
button.onClick(async () => {
|
||||||
// await this.saveSettings(["preset"]);
|
// await this.saveSettings(["preset"]);
|
||||||
await this.saveAllDirtySettings();
|
await this.saveAllDirtySettings();
|
||||||
@@ -1657,7 +1657,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
|
|
||||||
this.addOnSaved("preset", async (currentPreset) => {
|
this.addOnSaved("preset", async (currentPreset) => {
|
||||||
if (currentPreset == "") {
|
if (currentPreset == "") {
|
||||||
Logger($tf("obsidianLiveSyncSettingTab.logSelectAnyPreset"), LOG_LEVEL_NOTICE);
|
Logger($msg("obsidianLiveSyncSettingTab.logSelectAnyPreset"), LOG_LEVEL_NOTICE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const presetAllDisabled = {
|
const presetAllDisabled = {
|
||||||
@@ -1690,15 +1690,15 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
...this.editingSettings,
|
...this.editingSettings,
|
||||||
...presetLiveSync,
|
...presetLiveSync,
|
||||||
};
|
};
|
||||||
Logger($tf("obsidianLiveSyncSettingTab.logConfiguredLiveSync"), LOG_LEVEL_NOTICE);
|
Logger($msg("obsidianLiveSyncSettingTab.logConfiguredLiveSync"), LOG_LEVEL_NOTICE);
|
||||||
} else if (currentPreset == "PERIODIC") {
|
} else if (currentPreset == "PERIODIC") {
|
||||||
this.editingSettings = {
|
this.editingSettings = {
|
||||||
...this.editingSettings,
|
...this.editingSettings,
|
||||||
...presetPeriodic,
|
...presetPeriodic,
|
||||||
};
|
};
|
||||||
Logger($tf("obsidianLiveSyncSettingTab.logConfiguredPeriodic"), LOG_LEVEL_NOTICE);
|
Logger($msg("obsidianLiveSyncSettingTab.logConfiguredPeriodic"), LOG_LEVEL_NOTICE);
|
||||||
} else {
|
} else {
|
||||||
Logger($tf("obsidianLiveSyncSettingTab.logConfiguredDisabled"), LOG_LEVEL_NOTICE);
|
Logger($msg("obsidianLiveSyncSettingTab.logConfiguredDisabled"), LOG_LEVEL_NOTICE);
|
||||||
this.editingSettings = {
|
this.editingSettings = {
|
||||||
...this.editingSettings,
|
...this.editingSettings,
|
||||||
...presetAllDisabled,
|
...presetAllDisabled,
|
||||||
@@ -1716,8 +1716,8 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
// this.resetEditingSettings();
|
// this.resetEditingSettings();
|
||||||
if (
|
if (
|
||||||
(await this.plugin.confirm.askYesNoDialog(
|
(await this.plugin.confirm.askYesNoDialog(
|
||||||
$tf("obsidianLiveSyncSettingTab.msgGenerateSetupURI"),
|
$msg("obsidianLiveSyncSettingTab.msgGenerateSetupURI"),
|
||||||
{ defaultOption: "Yes", title: $tf("obsidianLiveSyncSettingTab.titleCongratulations") }
|
{ defaultOption: "Yes", title: $msg("obsidianLiveSyncSettingTab.titleCongratulations") }
|
||||||
)) == "yes"
|
)) == "yes"
|
||||||
) {
|
) {
|
||||||
eventHub.emitEvent(EVENT_REQUEST_COPY_SETUP_URI);
|
eventHub.emitEvent(EVENT_REQUEST_COPY_SETUP_URI);
|
||||||
@@ -1737,7 +1737,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
void addPanel(paneEl, $tf("obsidianLiveSyncSettingTab.titleSynchronizationMethod")).then((paneEl) => {
|
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleSynchronizationMethod")).then((paneEl) => {
|
||||||
paneEl.addClass("wizardHidden");
|
paneEl.addClass("wizardHidden");
|
||||||
|
|
||||||
// const onlyOnLiveSync = visibleOnly(() => this.isConfiguredAs("syncMode", "LIVESYNC"));
|
// const onlyOnLiveSync = visibleOnly(() => this.isConfiguredAs("syncMode", "LIVESYNC"));
|
||||||
@@ -1747,13 +1747,13 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
const optionsSyncMode =
|
const optionsSyncMode =
|
||||||
this.editingSettings.remoteType == REMOTE_COUCHDB
|
this.editingSettings.remoteType == REMOTE_COUCHDB
|
||||||
? {
|
? {
|
||||||
ONEVENTS: $tf("obsidianLiveSyncSettingTab.optionOnEvents"),
|
ONEVENTS: $msg("obsidianLiveSyncSettingTab.optionOnEvents"),
|
||||||
PERIODIC: $tf("obsidianLiveSyncSettingTab.optionPeriodicAndEvents"),
|
PERIODIC: $msg("obsidianLiveSyncSettingTab.optionPeriodicAndEvents"),
|
||||||
LIVESYNC: $tf("obsidianLiveSyncSettingTab.optionLiveSync"),
|
LIVESYNC: $msg("obsidianLiveSyncSettingTab.optionLiveSync"),
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
ONEVENTS: $tf("obsidianLiveSyncSettingTab.optionOnEvents"),
|
ONEVENTS: $msg("obsidianLiveSyncSettingTab.optionOnEvents"),
|
||||||
PERIODIC: $tf("obsidianLiveSyncSettingTab.optionPeriodicAndEvents"),
|
PERIODIC: $msg("obsidianLiveSyncSettingTab.optionPeriodicAndEvents"),
|
||||||
};
|
};
|
||||||
|
|
||||||
new Setting(paneEl)
|
new Setting(paneEl)
|
||||||
@@ -1799,7 +1799,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
.autoWireToggle("syncAfterMerge", { onUpdate: onlyOnNonLiveSync });
|
.autoWireToggle("syncAfterMerge", { onUpdate: onlyOnNonLiveSync });
|
||||||
});
|
});
|
||||||
|
|
||||||
void addPanel(paneEl, $tf("obsidianLiveSyncSettingTab.titleUpdateThinning")).then((paneEl) => {
|
void addPanel(paneEl, $msg("obsidianLiveSyncSettingTab.titleUpdateThinning")).then((paneEl) => {
|
||||||
paneEl.addClass("wizardHidden");
|
paneEl.addClass("wizardHidden");
|
||||||
new Setting(paneEl).setClass("wizardHidden").autoWireToggle("batchSave");
|
new Setting(paneEl).setClass("wizardHidden").autoWireToggle("batchSave");
|
||||||
new Setting(paneEl).setClass("wizardHidden").autoWireNumeric("batchSaveMinimumDelay", {
|
new Setting(paneEl).setClass("wizardHidden").autoWireNumeric("batchSaveMinimumDelay", {
|
||||||
@@ -1812,13 +1812,13 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
void addPanel(paneEl, $tf("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, $tf("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 +1828,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
new Setting(paneEl).setClass("wizardHidden").autoWireToggle("showMergeDialogOnlyOnActive");
|
new Setting(paneEl).setClass("wizardHidden").autoWireToggle("showMergeDialogOnlyOnActive");
|
||||||
});
|
});
|
||||||
|
|
||||||
void addPanel(paneEl, $tf("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,14 +1840,14 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
new Setting(paneEl).autoWireToggle("notifyAllSettingSyncFile");
|
new Setting(paneEl).autoWireToggle("notifyAllSettingSyncFile");
|
||||||
});
|
});
|
||||||
|
|
||||||
void addPanel(paneEl, $tf("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 = $tf("obsidianLiveSyncSettingTab.labelEnabled");
|
const LABEL_ENABLED = $msg("obsidianLiveSyncSettingTab.labelEnabled");
|
||||||
const LABEL_DISABLED = $tf("obsidianLiveSyncSettingTab.labelDisabled");
|
const LABEL_DISABLED = $msg("obsidianLiveSyncSettingTab.labelDisabled");
|
||||||
|
|
||||||
const hiddenFileSyncSetting = new Setting(paneEl)
|
const hiddenFileSyncSetting = new Setting(paneEl)
|
||||||
.setName($tf("obsidianLiveSyncSettingTab.nameHiddenFileSynchronization"))
|
.setName($msg("obsidianLiveSyncSettingTab.nameHiddenFileSynchronization"))
|
||||||
.setClass("wizardHidden");
|
.setClass("wizardHidden");
|
||||||
const hiddenFileSyncSettingEl = hiddenFileSyncSetting.settingEl;
|
const hiddenFileSyncSettingEl = hiddenFileSyncSetting.settingEl;
|
||||||
const hiddenFileSyncSettingDiv = hiddenFileSyncSettingEl.createDiv("");
|
const hiddenFileSyncSettingDiv = hiddenFileSyncSettingEl.createDiv("");
|
||||||
@@ -1856,10 +1856,10 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
: LABEL_DISABLED;
|
: LABEL_DISABLED;
|
||||||
if (this.editingSettings.syncInternalFiles) {
|
if (this.editingSettings.syncInternalFiles) {
|
||||||
new Setting(paneEl)
|
new Setting(paneEl)
|
||||||
.setName($tf("obsidianLiveSyncSettingTab.nameDisableHiddenFileSync"))
|
.setName($msg("obsidianLiveSyncSettingTab.nameDisableHiddenFileSync"))
|
||||||
.setClass("wizardHidden")
|
.setClass("wizardHidden")
|
||||||
.addButton((button) => {
|
.addButton((button) => {
|
||||||
button.setButtonText($tf("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();
|
||||||
@@ -1867,7 +1867,7 @@ export class ObsidianLiveSyncSettingTab extends PluginSettingTab {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
new Setting(paneEl)
|
new Setting(paneEl)
|
||||||
.setName($tf("obsidianLiveSyncSettingTab.nameEnableHiddenFileSync"))
|
.setName($msg("obsidianLiveSyncSettingTab.nameEnableHiddenFileSync"))
|
||||||
.setClass("wizardHidden")
|
.setClass("wizardHidden")
|
||||||
.addButton((button) => {
|
.addButton((button) => {
|
||||||
button.setButtonText("Merge").onClick(async () => {
|
button.setButtonText("Merge").onClick(async () => {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
EVENT_SETTING_SAVED,
|
EVENT_SETTING_SAVED,
|
||||||
eventHub,
|
eventHub,
|
||||||
} from "../../common/events.ts";
|
} from "../../common/events.ts";
|
||||||
import { $tf, setLang } from "../../lib/src/common/i18n.ts";
|
import { $msg, setLang } from "../../lib/src/common/i18n.ts";
|
||||||
import { versionNumberString2Number } from "../../lib/src/string_and_binary/convert.ts";
|
import { versionNumberString2Number } from "../../lib/src/string_and_binary/convert.ts";
|
||||||
import { cancelAllPeriodicTask, cancelAllTasks } from "octagonal-wheels/concurrency/task";
|
import { cancelAllPeriodicTask, cancelAllTasks } from "octagonal-wheels/concurrency/task";
|
||||||
import { stopAllRunningProcessors } from "octagonal-wheels/concurrency/processor";
|
import { stopAllRunningProcessors } from "octagonal-wheels/concurrency/processor";
|
||||||
@@ -20,16 +20,16 @@ export class ModuleLiveSyncMain extends AbstractModule implements ICoreModule {
|
|||||||
if (!(await this.core.$everyOnLayoutReady())) return;
|
if (!(await this.core.$everyOnLayoutReady())) return;
|
||||||
eventHub.emitEvent(EVENT_LAYOUT_READY);
|
eventHub.emitEvent(EVENT_LAYOUT_READY);
|
||||||
if (this.settings.suspendFileWatching || this.settings.suspendParseReplicationResult) {
|
if (this.settings.suspendFileWatching || this.settings.suspendParseReplicationResult) {
|
||||||
const ANSWER_KEEP = $tf("moduleLiveSyncMain.optionKeepLiveSyncDisabled");
|
const ANSWER_KEEP = $msg("moduleLiveSyncMain.optionKeepLiveSyncDisabled");
|
||||||
const ANSWER_RESUME = $tf("moduleLiveSyncMain.optionResumeAndRestart");
|
const ANSWER_RESUME = $msg("moduleLiveSyncMain.optionResumeAndRestart");
|
||||||
const message = $tf("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], {
|
||||||
defaultAction: ANSWER_KEEP,
|
defaultAction: ANSWER_KEEP,
|
||||||
title: $tf("moduleLiveSyncMain.titleScramEnabled"),
|
title: $msg("moduleLiveSyncMain.titleScramEnabled"),
|
||||||
})) == ANSWER_RESUME
|
})) == ANSWER_RESUME
|
||||||
) {
|
) {
|
||||||
this.settings.suspendFileWatching = false;
|
this.settings.suspendFileWatching = false;
|
||||||
@@ -47,11 +47,11 @@ export class ModuleLiveSyncMain extends AbstractModule implements ICoreModule {
|
|||||||
if (!(await this.core.$everyOnFirstInitialize())) return;
|
if (!(await this.core.$everyOnFirstInitialize())) return;
|
||||||
await this.core.$$realizeSettingSyncMode();
|
await this.core.$$realizeSettingSyncMode();
|
||||||
fireAndForget(async () => {
|
fireAndForget(async () => {
|
||||||
this._log($tf("moduleLiveSyncMain.logAdditionalSafetyScan"), LOG_LEVEL_VERBOSE);
|
this._log($msg("moduleLiveSyncMain.logAdditionalSafetyScan"), LOG_LEVEL_VERBOSE);
|
||||||
if (!(await this.core.$allScanStat())) {
|
if (!(await this.core.$allScanStat())) {
|
||||||
this._log($tf("moduleLiveSyncMain.logSafetyScanFailed"), LOG_LEVEL_NOTICE);
|
this._log($msg("moduleLiveSyncMain.logSafetyScanFailed"), LOG_LEVEL_NOTICE);
|
||||||
} else {
|
} else {
|
||||||
this._log($tf("moduleLiveSyncMain.logSafetyScanCompleted"), LOG_LEVEL_VERBOSE);
|
this._log($msg("moduleLiveSyncMain.logSafetyScanCompleted"), LOG_LEVEL_VERBOSE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -71,9 +71,9 @@ export class ModuleLiveSyncMain extends AbstractModule implements ICoreModule {
|
|||||||
this.$$wireUpEvents();
|
this.$$wireUpEvents();
|
||||||
// debugger;
|
// debugger;
|
||||||
eventHub.emitEvent(EVENT_PLUGIN_LOADED, this.core);
|
eventHub.emitEvent(EVENT_PLUGIN_LOADED, this.core);
|
||||||
this._log($tf("moduleLiveSyncMain.logLoadingPlugin"));
|
this._log($msg("moduleLiveSyncMain.logLoadingPlugin"));
|
||||||
if (!(await this.core.$everyOnloadStart())) {
|
if (!(await this.core.$everyOnloadStart())) {
|
||||||
this._log($tf("moduleLiveSyncMain.logPluginInitCancelled"), LOG_LEVEL_NOTICE);
|
this._log($msg("moduleLiveSyncMain.logPluginInitCancelled"), LOG_LEVEL_NOTICE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// this.addUIs();
|
// this.addUIs();
|
||||||
@@ -82,10 +82,10 @@ export class ModuleLiveSyncMain extends AbstractModule implements ICoreModule {
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
const packageVersion: string = PACKAGE_VERSION || "0.0.0";
|
const packageVersion: string = PACKAGE_VERSION || "0.0.0";
|
||||||
|
|
||||||
this._log($tf("moduleLiveSyncMain.logPluginVersion", { manifestVersion, packageVersion }));
|
this._log($msg("moduleLiveSyncMain.logPluginVersion", { manifestVersion, packageVersion }));
|
||||||
await this.core.$$loadSettings();
|
await this.core.$$loadSettings();
|
||||||
if (!(await this.core.$everyOnloadAfterLoadSettings())) {
|
if (!(await this.core.$everyOnloadAfterLoadSettings())) {
|
||||||
this._log($tf("moduleLiveSyncMain.logPluginInitCancelled"), LOG_LEVEL_NOTICE);
|
this._log($msg("moduleLiveSyncMain.logPluginInitCancelled"), LOG_LEVEL_NOTICE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const lsKey = "obsidian-live-sync-ver" + this.core.$$getVaultName();
|
const lsKey = "obsidian-live-sync-ver" + this.core.$$getVaultName();
|
||||||
@@ -93,7 +93,7 @@ export class ModuleLiveSyncMain extends AbstractModule implements ICoreModule {
|
|||||||
|
|
||||||
const lastVersion = ~~(versionNumberString2Number(manifestVersion) / 1000);
|
const lastVersion = ~~(versionNumberString2Number(manifestVersion) / 1000);
|
||||||
if (lastVersion > this.settings.lastReadUpdates && this.settings.isConfigured) {
|
if (lastVersion > this.settings.lastReadUpdates && this.settings.isConfigured) {
|
||||||
this._log($tf("moduleLiveSyncMain.logReadChangelog"), LOG_LEVEL_NOTICE);
|
this._log($msg("moduleLiveSyncMain.logReadChangelog"), LOG_LEVEL_NOTICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
@@ -108,7 +108,7 @@ export class ModuleLiveSyncMain extends AbstractModule implements ICoreModule {
|
|||||||
this.settings.syncOnFileOpen = false;
|
this.settings.syncOnFileOpen = false;
|
||||||
this.settings.syncAfterMerge = false;
|
this.settings.syncAfterMerge = false;
|
||||||
this.settings.periodicReplication = false;
|
this.settings.periodicReplication = false;
|
||||||
this.settings.versionUpFlash = $tf("moduleLiveSyncMain.logVersionUpdate");
|
this.settings.versionUpFlash = $msg("moduleLiveSyncMain.logVersionUpdate");
|
||||||
await this.saveSettings();
|
await this.saveSettings();
|
||||||
}
|
}
|
||||||
localStorage.setItem(lsKey, `${VER}`);
|
localStorage.setItem(lsKey, `${VER}`);
|
||||||
@@ -139,7 +139,7 @@ export class ModuleLiveSyncMain extends AbstractModule implements ICoreModule {
|
|||||||
}
|
}
|
||||||
await this.localDatabase.close();
|
await this.localDatabase.close();
|
||||||
}
|
}
|
||||||
this._log($tf("moduleLiveSyncMain.logUnloadingPlugin"));
|
this._log($msg("moduleLiveSyncMain.logUnloadingPlugin"));
|
||||||
}
|
}
|
||||||
|
|
||||||
async $$realizeSettingSyncMode(): Promise<void> {
|
async $$realizeSettingSyncMode(): Promise<void> {
|
||||||
|
|||||||
Reference in New Issue
Block a user