Compare commits

..
19 Commits
Author SHA1 Message Date
fyears 8d286a79a1 bump 0.3.31
Release A New Version / build (16.x) (push) Failing after 40s
2024-01-06 11:47:38 +08:00
fyears e69674e34e globally skip 2024-01-06 11:46:19 +08:00
fyears c3ed69af66 track deletions of .obsidian 2024-01-06 11:44:34 +08:00
fyears 832828e6f6 0.3.30
Release A New Version / build (16.x) (push) Failing after 38s
2024-01-06 00:04:58 +08:00
fyears b3c9ac8cbb refactor statusbar 2024-01-06 00:03:53 +08:00
fyears 8a631ee809 Merge branch 'Drumber-statusbar' 2024-01-05 23:08:43 +08:00
fyears b49e545759 merge statusbar 2024-01-05 23:07:15 +08:00
fyears 6588952227 webdav doc refactor 2024-01-05 22:44:19 +08:00
fyears 0f8b1951a6 refactor s3 docs 2024-01-05 22:38:53 +08:00
fyears 8b838656ce Merge branch 'master' of https://github.com/fyears/remotely-save 2024-01-05 22:26:47 +08:00
fyears 37d36fe5b3 Merge pull request #410 from williamgurzoni/s3-docs
Add guide to configure Policy and User for AWS S3 Bucket
2024-01-05 22:26:20 +08:00
fyears d1cfe0c978 list all the actions i could think of 2024-01-05 22:24:37 +08:00
fyears e3e8db04e2 Merge branch 'master' into s3-docs 2024-01-05 22:13:38 +08:00
fyears 084a04f4e9 wider 2024-01-05 22:11:34 +08:00
William Gurzoni 7b2343e879 Link s3 user and policy to main readme 2023-12-26 16:06:38 +13:00
William Gurzoni 6969c555da Create s3 user and policy guide 2023-12-26 16:06:12 +13:00
Lars 229f74b5e8 Added option to settings to toggle status bar item 2022-08-13 11:55:19 +02:00
Lars 30d94986c6 Added last sync time to statusbar
Adds an item to the statusbar that displays the time of the last successful sync.
2022-08-12 18:05:45 +02:00
Lars 4f03024200 Fixed webpack build
Build failed due to missing polyfills needed by @azure/msal-node.
2022-08-12 18:02:06 +02:00
15 changed files with 372 additions and 41 deletions
+4 -12
View File
@@ -26,7 +26,7 @@ This is yet another unofficial sync plugin for Obsidian. If you like it or find
- **[End-to-end encryption](./docs/encryption.md) supported.** Files would be encrypted using openssl format before being sent to the cloud **if** user specify a password.
- **Scheduled auto sync supported.** You can also manually trigger the sync using sidebar ribbon, or using the command from the command palette (or even bind the hot key combination to the command then press the hot key combination).
- **[Minimal Intrusive](./docs/minimal_intrusive_design.md).**
- **Skip Large files and skip paths by custom regex conditions!
- \*\*Skip Large files and skip paths by custom regex conditions!
- **Fully open source under [Apache-2.0 License](./LICENSE).**
- **[Sync Algorithm open](./docs/sync_algorithm_v2.md) for discussion.**
@@ -65,9 +65,8 @@ Additionally, the plugin author may occasionally visit Obsidian official forum a
- [Cloudflare R2](./docs/remote_services/s3_cloudflare_r2/README.md)
- [MinIO](./docs/remote_services/s3_minio/README.md)
- Prepare your S3 (-compatible) service information: [endpoint, region](https://docs.aws.amazon.com/general/latest/gr/s3.html), [access key id, secret access key](https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/getting-your-credentials.html), bucket name. The bucket should be empty and solely for syncing a vault.
- About CORS:
- If you are using Obsidian desktop >= 0.13.25 or mobile >= 1.1.1, you can skip this CORS part.
- If you are using Obsidian desktop < 0.13.25 or mobile < 1.1.1, you need to configure (enable) [CORS](https://docs.aws.amazon.com/AmazonS3/latest/userguide/enabling-cors-examples.html) for requests from `app://obsidian.md` and `capacitor://localhost` and `http://localhost`, and add at least `ETag` into exposed headers. Full example is [here](./docs/s3_cors_configure.md). It's unfortunately required, because the plugin sends requests from a browser-like envirement. And those addresses are tested and found on desktop and ios and android.
- If you are using AWS S3, create [policy and user](./docs/remote_services/s3_general/s3_user_policy.md).
- Very old version of Obsidian needs [configuring CORS](./docs/remote_services/s3_general/s3_cors_configure.md).
- Download and enable this plugin.
- Enter your information to the settings of this plugin.
- If you want to enable end-to-end encryption, also set a password in settings. If you do not specify a password, the files and folders are synced in plain, original content to the cloud.
@@ -95,14 +94,7 @@ Additionally, the plugin author may occasionally visit Obsidian official forum a
- [ownCloud](./docs/remote_services/webdav_owncloud/README.md)
- [InfiniCloud](./docs/remote_services/webdav_infinicloud_teracloud/README.md)
- [坚果云 JianGuoYun/NutStore](./docs/remote_services/webdav_jianguoyun/README.md)
- About CORS:
- If you are using Obsidian desktop >= 0.13.25 or iOS >= 1.1.1, you can skip this CORS part.
- If you are using Obsidian desktop < 0.13.25 or iOS < 1.1.1 or any Android version:
- The webdav server has to be enabled CORS for requests from `app://obsidian.md` and `capacitor://localhost` and `http://localhost`, **AND** all webdav HTTP methods, **AND** all webdav headers. These are required, because Obsidian mobile works like a browser and mobile plugins are limited by CORS policies unless under a upgraded Obsidian version.
- Popular software NextCloud, OwnCloud, `rclone serve webdav` do **NOT** enable CORS by default. If you are using any of them, you should evaluate the risk, and find a way to enable CORS, before using this plugin, or use a upgraded Obsidian version.
- **Unofficial** workaround: NextCloud users can **evaluate the risk by themselves**, and if decide to accept the risk, they can install [WebAppPassword](https://apps.nextcloud.com/apps/webapppassword) app, and add `app://obsidian.md`, `capacitor://localhost`, `http://localhost` to `Allowed origins`
- **Unofficial** workaround: OwnCloud users can **evaluate the risk by themselves**, and if decide to accept the risk, they can download `.tar.gz` of `WebAppPassword` above and manually install and configure it on their instances.
- The plugin is tested successfully under python package [`wsgidav` (version 4.0)](https://github.com/mar10/wsgidav). See [this issue](https://github.com/mar10/wsgidav/issues/239) for some details.
- Very old version of Obsidian needs [configuring CORS](./docs/remote_services/webdav_general/webav_cors.md).
- Your data would be synced to a `${vaultName}` sub folder on your webdav server.
- Password-based end-to-end encryption is also supported. But please be aware that **the vault name itself is not encrypted**.
@@ -0,0 +1,83 @@
# AWS S3 Bucket: How to configure user's policy
## Attention
Please read the doc carefully and adjust the optional fields accordingly. The doc is not fully tested and contributions are welcome.
## AWS Official Docs
- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-policy-language-overview.html>
- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html>
- <https://docs.aws.amazon.com/AmazonS3/latest/API/API_Operations.html>
## Prerequisites
Using the principle of least privilege is crucial for security when allowing a third party system to access your AWS resources.
**Prerequisites**: Ensure you have an AWS account and administrative access to manage IAM policies.
## Step 1: Create a new IAM Policy
1. Log in to your AWS Management Console.
1. Navigate to the IAM Policies section.
1. Create a new policy with the following configuration.
**Note**: `my-bucket` is a placeholder. For example, if your bucket's name is `obsidian-data`, the resource line should read `arn:aws:s3:::obsidian-data`.
```JSON
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ObsidianBucket",
"Effect": "Allow",
"Action": [
"s3:HeadBucket"
],
"Resource": "arn:aws:s3:::my-bucket"
},
{
"Sid": "ObsidianObjects",
"Effect": "Allow",
"Action": [
"s3:HeadObject",
"s3:PutObject",
"s3:CopyObject",
"s3:UploadPart",
"s3:UploadPartCopy",
"s3:ListMultipartUploads",
"s3:AbortMultipartUpload",
"s3:CompleteMultipartUpload",
"s3:ListObjects",
"s3:ListObjectsV2",
"s3:ListParts",
"s3:GetObject",
"s3:GetObjectAttributes",
"s3:DeleteObject",
"s3:DeleteObjects"
],
"Resource": "arn:aws:s3:::my-bucket/*"
}
]
}
```
> The policy allows the Obsidian plugin to list, add, retrieve, and delete objects in the specified S3 bucket.
## Step 2: Attach the Policy to Obsidian user
1. Create a new user in the IAM console. (Never use your own root user, as it would have full access to your AWS account).
1. When creating the user, select "Attach policy directly" and select the policy created.
1. Edit the recent created user and go to "Security Credentials" tab to create your access key.
1. Create an Access Key. If asked for a "use case", select "other"
1. Use the credentials in the plugin settings. (NEVER share these credentials)
> PS. The bucket doesn't need to have a policy, only the user.
## Verifying the Policy
After attaching the policy, test it by trying to access the S3 bucket through the Obsidian plugin. Ensure that all intended actions can be performed without errors.
## Troubleshooting
If you encounter permission errors, check the policy for typos in the bucket name or actions. Ensure the policy is attached to the correct user.
@@ -0,0 +1,10 @@
If you are using Obsidian desktop >= 0.13.25 or iOS >= 1.1.1, you can skip this CORS part.
If you are using Obsidian desktop < 0.13.25 or iOS < 1.1.1 or any Android version:
- The webdav server has to be enabled CORS for requests from `app://obsidian.md` and `capacitor://localhost` and `http://localhost`, **AND** all webdav HTTP methods, **AND** all webdav headers. These are required, because Obsidian mobile works like a browser and mobile plugins are limited by CORS policies unless under a upgraded Obsidian version.
- Popular software NextCloud, OwnCloud, `rclone serve webdav` do **NOT** enable CORS by default. If you are using any of them, you should evaluate the risk, and find a way to enable CORS, before using this plugin, or use a upgraded Obsidian version.
- **Unofficial** workaround: NextCloud users can **evaluate the risk by themselves**, and if decide to accept the risk, they can install [WebAppPassword](https://apps.nextcloud.com/apps/webapppassword) app, and add `app://obsidian.md`, `capacitor://localhost`, `http://localhost` to `Allowed origins`
- **Unofficial** workaround: OwnCloud users can **evaluate the risk by themselves**, and if decide to accept the risk, they can download `.tar.gz` of `WebAppPassword` above and manually install and configure it on their instances.
- [Apache is also possible](./webdav_apache_cors.md).
- The plugin is tested successfully under python package [`wsgidav` (version 4.0)](https://github.com/mar10/wsgidav). See [this issue](https://github.com/mar10/wsgidav/issues/239) for some details.
+1 -1
View File
@@ -1,7 +1,7 @@
{
"id": "remotely-save",
"name": "Remotely Save",
"version": "0.3.29",
"version": "0.3.31",
"minAppVersion": "0.13.21",
"description": "Yet another unofficial plugin allowing users to synchronize notes between local device and the cloud service.",
"author": "fyears",
+1
View File
@@ -87,6 +87,7 @@ export interface RemotelySavePluginSettings {
logToDB?: boolean;
skipSizeLargerThan?: number;
ignorePaths?: string[];
enableStatusBarInfo?: boolean;
/**
* @deprecated
+78 -2
View File
@@ -18,6 +18,7 @@ export const DEFAULT_TBL_SYNC_MAPPING = "syncmetadatahistory";
export const DEFAULT_SYNC_PLANS_HISTORY = "syncplanshistory";
export const DEFAULT_TBL_VAULT_RANDOM_ID_MAPPING = "vaultrandomidmapping";
export const DEFAULT_TBL_LOGGER_OUTPUT = "loggeroutput";
export const DEFAULT_TBL_SIMPLE_KV_FOR_MISC = "simplekvformisc";
export interface FileFolderHistoryRecord {
key: string;
@@ -58,6 +59,7 @@ export interface InternalDBs {
syncPlansTbl: LocalForage;
vaultRandomIDMappingTbl: LocalForage;
loggerOutputTbl: LocalForage;
simpleKVForMiscTbl: LocalForage;
}
/**
@@ -216,6 +218,10 @@ export const prepareDBs = async (
name: DEFAULT_DB_NAME,
storeName: DEFAULT_TBL_LOGGER_OUTPUT,
}),
simpleKVForMiscTbl: localforage.createInstance({
name: DEFAULT_DB_NAME,
storeName: DEFAULT_TBL_SIMPLE_KV_FOR_MISC,
}),
} as InternalDBs;
// try to get vaultRandomID firstly
@@ -324,7 +330,7 @@ export const clearDeleteRenameHistoryOfKeyAndVault = async (
export const insertDeleteRecordByVault = async (
db: InternalDBs,
fileOrFolder: TAbstractFile,
fileOrFolder: TAbstractFile | string,
vaultRandomID: string
) => {
// log.info(fileOrFolder);
@@ -341,6 +347,7 @@ export const insertDeleteRecordByVault = async (
renameTo: "",
vaultRandomID: vaultRandomID,
};
await db.fileHistoryTbl.setItem(`${vaultRandomID}\t${k.key}`, k);
} else if (fileOrFolder instanceof TFolder) {
// key should endswith "/"
const key = fileOrFolder.path.endsWith("/")
@@ -359,8 +366,57 @@ export const insertDeleteRecordByVault = async (
renameTo: "",
vaultRandomID: vaultRandomID,
};
await db.fileHistoryTbl.setItem(`${vaultRandomID}\t${k.key}`, k);
} else if (typeof fileOrFolder === "string") {
// always the deletions in .obsidian folder
// so annoying that the path doesn't exists
// and we have to guess whether the path is folder or file
k = {
key: fileOrFolder,
ctime: 0,
mtime: 0,
size: 0,
actionWhen: Date.now(),
actionType: "delete",
keyType: "file",
renameTo: "",
vaultRandomID: vaultRandomID,
};
await db.fileHistoryTbl.setItem(`${vaultRandomID}\t${k.key}`, k);
for (const ext of [
"json",
"js",
"mjs",
"ts",
"md",
"txt",
"css",
"png",
"gif",
"jpg",
"jpeg",
"gitignore",
"gitkeep",
]) {
if (fileOrFolder.endsWith(`.${ext}`)) {
// stop here, no more need to insert the folder record later
return;
}
}
// also add a deletion record as folder if not ending with special exts
k = {
key: `${fileOrFolder}/`,
ctime: 0,
mtime: 0,
size: 0,
actionWhen: Date.now(),
actionType: "delete",
keyType: "folder",
renameTo: "",
vaultRandomID: vaultRandomID,
};
await db.fileHistoryTbl.setItem(`${vaultRandomID}\t${k.key}`, k);
}
await db.fileHistoryTbl.setItem(`${vaultRandomID}\t${k.key}`, k);
};
/**
@@ -680,3 +736,23 @@ export const clearExpiredLoggerOutputRecords = async (db: InternalDBs) => {
});
await Promise.all(ps);
};
export const upsertLastSuccessSyncByVault = async (
db: InternalDBs,
vaultRandomID: string,
millis: number
) => {
await db.simpleKVForMiscTbl.setItem(
`${vaultRandomID}-lastSuccessSyncMillis`,
millis
);
};
export const getLastSuccessSyncByVault = async (
db: InternalDBs,
vaultRandomID: string
) => {
return (await db.simpleKVForMiscTbl.getItem(
`${vaultRandomID}-lastSuccessSyncMillis`
)) as number;
};
+121
View File
@@ -6,6 +6,9 @@ import {
addIcon,
setIcon,
FileSystemAdapter,
Platform,
TFile,
TFolder,
} from "obsidian";
import cloneDeep from "lodash/cloneDeep";
import { createElement, RotateCcw, RefreshCcw, FileText } from "lucide";
@@ -31,6 +34,8 @@ import {
insertLoggerOutputByVault,
clearExpiredLoggerOutputRecords,
clearExpiredSyncPlanRecords,
upsertLastSuccessSyncByVault,
getLastSuccessSyncByVault,
} from "./localdb";
import { RemoteClient } from "./remote";
import {
@@ -86,6 +91,7 @@ const DEFAULT_SETTINGS: RemotelySavePluginSettings = {
logToDB: false,
skipSizeLargerThan: -1,
ignorePaths: [],
enableStatusBarInfo: true,
};
interface OAuth2Info {
@@ -126,6 +132,7 @@ export default class RemotelySavePlugin extends Plugin {
settings: RemotelySavePluginSettings;
db: InternalDBs;
syncStatus: SyncStatusType;
statusBarElement: HTMLSpanElement;
oauth2Info: OAuth2Info;
currLogLevel: string;
currSyncMsg?: string;
@@ -357,11 +364,22 @@ export default class RemotelySavePlugin extends Plugin {
this.syncStatus = "finish";
this.syncStatus = "idle";
const lastSuccessSyncMillis = Date.now();
await upsertLastSuccessSyncByVault(
this.db,
this.vaultRandomID,
lastSuccessSyncMillis
);
if (this.syncRibbon !== undefined) {
setIcon(this.syncRibbon, iconNameSyncWait);
this.syncRibbon.setAttribute("aria-label", originLabel);
}
if (this.statusBarElement !== undefined) {
this.updateLastSuccessSyncMsg(lastSuccessSyncMillis);
}
log.info(
`${
this.manifest.id
@@ -480,6 +498,31 @@ export default class RemotelySavePlugin extends Plugin {
})
);
function getMethods(obj: any) {
var result = [];
for (var id in obj) {
try {
if (typeof obj[id] == "function") {
result.push(id + ": " + obj[id].toString());
}
} catch (err) {
result.push(id + ": inaccessible");
}
}
return result.join("\n");
}
this.registerEvent(
this.app.vault.on("raw" as any, async (fileOrFolder) => {
// special track on .obsidian folder
const name = `${fileOrFolder}`;
if (name.startsWith(this.app.vault.configDir)) {
if (!(await this.app.vault.adapter.exists(name))) {
await insertDeleteRecordByVault(this.db, name, this.vaultRandomID);
}
}
})
);
this.registerObsidianProtocolHandler(COMMAND_URI, async (inputParams) => {
const parsed = importQrCodeUri(inputParams, this.app.vault.getName());
if (parsed.status === "error") {
@@ -673,6 +716,25 @@ export default class RemotelySavePlugin extends Plugin {
async () => this.syncRun("manual")
);
// Create Status Bar Item (not supported on mobile)
if (!Platform.isMobileApp && this.settings.enableStatusBarInfo === true) {
const statusBarItem = this.addStatusBarItem();
this.statusBarElement = statusBarItem.createEl("span");
this.statusBarElement.setAttribute("aria-label-position", "top");
this.updateLastSuccessSyncMsg(
await getLastSuccessSyncByVault(this.db, this.vaultRandomID)
);
// update statusbar text every 30 seconds
this.registerInterval(
window.setInterval(async () => {
this.updateLastSuccessSyncMsg(
await getLastSuccessSyncByVault(this.db, this.vaultRandomID)
);
}, 1000 * 30)
);
}
this.addCommand({
id: "start-sync",
name: t("command_startsync"),
@@ -798,6 +860,9 @@ export default class RemotelySavePlugin extends Plugin {
if (this.settings.ignorePaths === undefined) {
this.settings.ignorePaths = [];
}
if (this.settings.enableStatusBarInfo === undefined) {
this.settings.enableStatusBarInfo = true;
}
}
async checkIfPresetRulesFollowed() {
@@ -970,6 +1035,62 @@ export default class RemotelySavePlugin extends Plugin {
this.currSyncMsg = msg;
}
updateLastSuccessSyncMsg(lastSuccessSyncMillis?: number) {
if (this.statusBarElement === undefined) return;
const t = (x: TransItemType, vars?: any) => {
return this.i18n.t(x, vars);
};
let lastSyncMsg = t("statusbar_lastsync_never");
let lastSyncLabelMsg = t("statusbar_lastsync_never_label");
if (lastSuccessSyncMillis !== undefined && lastSuccessSyncMillis > 0) {
const deltaTime = Date.now() - lastSuccessSyncMillis;
// create human readable time
const years = Math.floor(deltaTime / 31556952000);
const months = Math.floor(deltaTime / 2629746000);
const weeks = Math.floor(deltaTime / 604800000);
const days = Math.floor(deltaTime / 86400000);
const hours = Math.floor(deltaTime / 3600000);
const minutes = Math.floor(deltaTime / 60000);
let timeText = "";
if (years > 0) {
timeText = t("statusbar_time_years", { time: years });
} else if (months > 0) {
timeText = t("statusbar_time_months", { time: months });
} else if (weeks > 0) {
timeText = t("statusbar_time_weeks", { time: weeks });
} else if (days > 0) {
timeText = t("statusbar_time_days", { time: days });
} else if (hours > 0) {
timeText = t("statusbar_time_hours", { time: hours });
} else if (minutes > 0) {
timeText = t("statusbar_time_minutes", { time: minutes });
} else {
timeText = t("statusbar_time_lessminute");
}
let dateText = new Date(lastSuccessSyncMillis).toLocaleTimeString(
navigator.language,
{
weekday: "long",
year: "numeric",
month: "long",
day: "numeric",
}
);
lastSyncMsg = t("statusbar_lastsync", { time: timeText });
lastSyncLabelMsg = t("statusbar_lastsync_label", { date: dateText });
}
this.statusBarElement.setText(lastSyncMsg);
this.statusBarElement.setAttribute("aria-label", lastSyncLabelMsg);
}
/**
* Because data.json contains sensitive information,
* We usually want to ignore it in the version control.
+28
View File
@@ -427,3 +427,31 @@ export const statFix = async (vault: Vault, path: string) => {
}
return s;
};
export const isFolderToSkip = (x: string, more: string[] | undefined) => {
let specialFolders = [
".git",
".github",
".gitlab",
".svn",
"node_modules",
".DS_Store",
"__MACOSX ",
"Icon\r", // https://superuser.com/questions/298785/icon-file-on-os-x-desktop
"desktop.ini",
"Desktop.ini",
"thumbs.db",
"Thumbs.db",
].concat(more !== undefined ? more : []);
for (const iterator of specialFolders) {
if (
x === iterator ||
x === `${iterator}/` ||
x.endsWith(`/${iterator}`) ||
x.endsWith(`/${iterator}/`)
) {
return true;
}
}
return false;
};
+3 -25
View File
@@ -2,7 +2,7 @@ import { Vault, Stat, ListedFiles } from "obsidian";
import { Queue } from "@fyears/tsqueue";
import chunk from "lodash/chunk";
import flatten from "lodash/flatten";
import { statFix } from "./misc";
import { statFix, isFolderToSkip } from "./misc";
export interface ObsConfigDirFileType {
key: string;
@@ -12,28 +12,6 @@ export interface ObsConfigDirFileType {
type: "folder" | "file";
}
const isFolderToSkip = (x: string) => {
let specialFolders = [
".git",
".github",
".gitlab",
".svn",
"node_modules",
".DS_Store",
];
for (const iterator of specialFolders) {
if (
x === iterator ||
x === `${iterator}/` ||
x.endsWith(`/${iterator}`) ||
x.endsWith(`/${iterator}/`)
) {
return true;
}
}
return false;
};
const isPluginDirItself = (x: string, pluginId: string) => {
return (
x === pluginId ||
@@ -106,7 +84,7 @@ export const listFilesInObsFolder = async (
const isInsideSelfPlugin = isPluginDirItself(iter.itself.key, pluginId);
if (iter.children !== undefined) {
for (const iter2 of iter.children.folders) {
if (isFolderToSkip(iter2)) {
if (isFolderToSkip(iter2, ["workspace", "workspace.json"])) {
continue;
}
if (isInsideSelfPlugin && !isLikelyPluginSubFiles(iter2)) {
@@ -116,7 +94,7 @@ export const listFilesInObsFolder = async (
q.push(iter2);
}
for (const iter2 of iter.children.files) {
if (isFolderToSkip(iter2)) {
if (isFolderToSkip(iter2, ["workspace", "workspace.json"])) {
continue;
}
if (isInsideSelfPlugin && !isLikelyPluginSubFiles(iter2)) {
+35
View File
@@ -30,6 +30,7 @@ import {
clearAllLoggerOutputRecords,
insertLoggerOutputByVault,
clearExpiredLoggerOutputRecords,
upsertLastSuccessSyncByVault,
} from "./localdb";
import type RemotelySavePlugin from "./main"; // unavoidable
import { RemoteClient } from "./remote";
@@ -1596,6 +1597,39 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
});
});
// custom status bar items is not supported on mobile
if (!Platform.isMobileApp) {
new Setting(basicDiv)
.setName(t("settings_enablestatusbar_info"))
.setDesc(t("settings_enablestatusbar_info_desc"))
.addToggle((toggle) => {
toggle
.setValue(this.plugin.settings.enableStatusBarInfo)
.onChange(async (val) => {
this.plugin.settings.enableStatusBarInfo = val;
await this.plugin.saveSettings();
new Notice(t("settings_enablestatusbar_reloadrequired_notice"));
});
});
new Setting(basicDiv)
.setName(t("settings_resetstatusbar_time"))
.setDesc(t("settings_resetstatusbar_time_desc"))
.addButton((button) => {
button.setButtonText(t("settings_resetstatusbar_button"));
button.onClick(async () => {
// reset last sync time
await upsertLastSuccessSyncByVault(
this.plugin.db,
this.plugin.vaultRandomID,
-1
);
this.plugin.updateLastSuccessSyncMsg(-1);
new Notice(t("settings_resetstatusbar_notice"));
});
});
}
new Setting(basicDiv)
.setName(t("settings_ignorepaths"))
.setDesc(t("settings_ignorepaths_desc"))
@@ -1609,6 +1643,7 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
await this.plugin.saveSettings();
});
textArea.inputEl.rows = 10;
textArea.inputEl.cols = 30;
textArea.inputEl.addClass("ignorepaths-textarea");
});
+5
View File
@@ -39,6 +39,7 @@ import {
atWhichLevel,
unixTimeToStr,
statFix,
isFolderToSkip,
} from "./misc";
import { RemoteClient } from "./remote";
import {
@@ -307,6 +308,10 @@ const isSkipItem = (
if (syncConfigDir && isInsideObsFolder(key, configDir)) {
return false;
}
if (isFolderToSkip(key, [])) {
// some special dirs and files are always skipped
return true;
}
return (
isHiddenPath(key, true, false) ||
(!syncUnderscoreItems && isHiddenPath(key, false, true)) ||
+2
View File
@@ -23,6 +23,8 @@ const DEFAULT_SETTINGS: RemotelySavePluginSettings = {
password: "password",
serviceType: "s3",
currLogLevel: "info",
ignorePaths: ["somefoldertoignore"],
enableStatusBarInfo: true,
};
describe("Config Persist tests", () => {