Compare commits

...
7 Commits
Author SHA1 Message Date
fyears 6d1b451f4c bump to 0.3.40
Release A New Version / build (16.x) (push) Failing after 46s
2024-02-12 17:25:07 +08:00
fyears 69537f7002 better sync status in zh 2024-02-12 17:23:26 +08:00
Vijayasantham 17de78240f Feat: Add #481 (#492) 2024-02-12 17:13:43 +08:00
fyears 8cbcdf5323 fix doc format 2024-02-08 16:45:24 +08:00
fyears 6ba5abc0a6 format 2024-02-08 16:45:15 +08:00
Vijayasantham d820285d1e Fix: Save on sync issue (#486)
* Fix: Save on sync issue

* Fix: Add delay before run sync on save
2024-02-08 11:58:57 +08:00
fyears a6002ba340 storj 2024-01-21 15:00:01 +08:00
12 changed files with 100 additions and 42 deletions
+1
View File
@@ -64,6 +64,7 @@ Additionally, the plugin author may occasionally visit Obsidian official forum a
- Tutorials / Examples: - Tutorials / Examples:
- [Cloudflare R2](./docs/remote_services/s3_cloudflare_r2/README.md) - [Cloudflare R2](./docs/remote_services/s3_cloudflare_r2/README.md)
- [BackBlaze B2](./docs/remote_services/s3_backblaze_b2/README.md) - [BackBlaze B2](./docs/remote_services/s3_backblaze_b2/README.md)
- [Storj](./docs/remote_services/s3_storj_io/README.md)
- [腾讯云 COS](./docs/remote_services/s3_tencent_cloud_cos/README.zh-cn.md) | [Tencent Cloud COS](./docs/remote_services/s3_tencent_cloud_cos/README.md) - [腾讯云 COS](./docs/remote_services/s3_tencent_cloud_cos/README.zh-cn.md) | [Tencent Cloud COS](./docs/remote_services/s3_tencent_cloud_cos/README.md)
- [MinIO](./docs/remote_services/s3_minio/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. - 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.
@@ -0,0 +1,17 @@
# Storj
## Links
<https://www.storj.io/>
## Steps
1. Register an account. Login.
2. Create a bucket.
3. Create S3 Credentials in Access Management. Allow all permissions for the bucket. Remember the access key and secret key and the end point. The end point is likely to be [`https://gateway.storjshare.io`](https://docs.storj.io/dcs/api/s3/s3-compatible-gateway).
![](./storj_create_s3_cred_1.png)
![](./storj_create_s3_cred_2.png)
4. Input your credentials into remotely-save settings. Region [should be `global`](https://docs.storj.io/dcs/api/s3/s3-compatibility).
![](storj_remotely_save_settings.png)
5. Check connectivity.
6. Sync!
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a3484f74f45fbdae6110de285edeff10c196c13160cb97f079da77843ae92e80
size 386188
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:42593d98e1b154f4174a932088e72c25db9a976b5613f4d6ae21df1445b4559c
size 278219
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7843c31153054eb4762dbaf3027c1042b0d7cb4dd774bf584788cd7a97ba4044
size 571188
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"id": "remotely-save", "id": "remotely-save",
"name": "Remotely Save", "name": "Remotely Save",
"version": "0.3.38", "version": "0.3.40",
"minAppVersion": "0.13.21", "minAppVersion": "0.13.21",
"description": "Yet another unofficial plugin allowing users to synchronize notes between local device and the cloud service.", "description": "Yet another unofficial plugin allowing users to synchronize notes between local device and the cloud service.",
"author": "fyears", "author": "fyears",
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"id": "remotely-save", "id": "remotely-save",
"name": "Remotely Save", "name": "Remotely Save",
"version": "0.3.38", "version": "0.3.40",
"minAppVersion": "0.13.21", "minAppVersion": "0.13.21",
"description": "Yet another unofficial plugin allowing users to synchronize notes between local device and the cloud service.", "description": "Yet another unofficial plugin allowing users to synchronize notes between local device and the cloud service.",
"author": "fyears", "author": "fyears",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "remotely-save", "name": "remotely-save",
"version": "0.3.38", "version": "0.3.40",
"description": "This is yet another sync plugin for Obsidian app.", "description": "This is yet another sync plugin for Obsidian app.",
"scripts": { "scripts": {
"dev2": "node esbuild.config.mjs --watch", "dev2": "node esbuild.config.mjs --watch",
+9 -7
View File
@@ -40,14 +40,16 @@
"command_exportsyncplans_json": "export sync plans in json format", "command_exportsyncplans_json": "export sync plans in json format",
"command_exportlogsindb": "export logs saved in db", "command_exportlogsindb": "export logs saved in db",
"statusbar_time_years": "{{time}} years", "statusbar_time_years": "Synced {{time}} years ago",
"statusbar_time_months": "{{time}} months", "statusbar_time_months": "Synced {{time}} months ago",
"statusbar_time_weeks": "{{time}} weeks", "statusbar_time_weeks": "Synced {{time}} weeks ago",
"statusbar_time_days": "{{time}} days", "statusbar_time_days": "Synced {{time}} days ago",
"statusbar_time_hours": "{{time}} hours", "statusbar_time_hours": "Synced {{time}} hours ago",
"statusbar_time_minutes": "{{time}} minutes", "statusbar_time_minutes": "Synced {{time}} minutes ago",
"statusbar_time_lessminute": "less than a minute", "statusbar_time_lessminute": "Synced less than a minute ago",
"statusbar_lastsync": "Synced {{time}} ago", "statusbar_lastsync": "Synced {{time}} ago",
"statusbar_syncing": "Syncing...",
"statusbar_now": "Synced just now",
"statusbar_lastsync_label": "Last successful Sync on {{date}}", "statusbar_lastsync_label": "Last successful Sync on {{date}}",
"statusbar_lastsync_never": "Never Synced", "statusbar_lastsync_never": "Never Synced",
"statusbar_lastsync_never_label": "Never Synced before", "statusbar_lastsync_never_label": "Never Synced before",
+9 -7
View File
@@ -40,14 +40,16 @@
"command_exportsyncplans_json": "导出同步计划为 json 格式(export sync plans in json format", "command_exportsyncplans_json": "导出同步计划为 json 格式(export sync plans in json format",
"command_exportlogsindb": "从数据库导出终端日志(export logs saved in db", "command_exportlogsindb": "从数据库导出终端日志(export logs saved in db",
"statusbar_time_years": "{{time}} 年前", "statusbar_time_years": "{{time}} 年前同步",
"statusbar_time_months": "{{time}} 月前", "statusbar_time_months": "{{time}} 月前同步",
"statusbar_time_weeks": "{{time}} 周前", "statusbar_time_weeks": "{{time}} 周前同步",
"statusbar_time_days": "{{time}} 天前", "statusbar_time_days": "{{time}} 天前同步",
"statusbar_time_hours": "{{time}} 小时前", "statusbar_time_hours": "{{time}} 小时前同步",
"statusbar_time_minutes": "{{time}} 分钟前", "statusbar_time_minutes": "{{time}} 分钟前同步",
"statusbar_time_lessminute": "一分钟之内", "statusbar_time_lessminute": "一分钟之内同步",
"statusbar_lastsync": "上一次同步于:{{time}}", "statusbar_lastsync": "上一次同步于:{{time}}",
"statusbar_syncing": "正在同步",
"statusbar_now": "刚同步完",
"statusbar_lastsync_label": "上一次同步于:{{date}}", "statusbar_lastsync_label": "上一次同步于:{{date}}",
"statusbar_lastsync_never": "没触发过同步", "statusbar_lastsync_never": "没触发过同步",
"statusbar_lastsync_never_label": "没触发过同步", "statusbar_lastsync_never_label": "没触发过同步",
+9 -7
View File
@@ -40,14 +40,16 @@
"command_exportsyncplans_json": "匯出同步計劃為 json 格式(export sync plans in json format", "command_exportsyncplans_json": "匯出同步計劃為 json 格式(export sync plans in json format",
"command_exportlogsindb": "從資料庫匯出終端日誌(export logs saved in db", "command_exportlogsindb": "從資料庫匯出終端日誌(export logs saved in db",
"statusbar_time_years": "{{time}} 年前", "statusbar_time_years": "{{time}} 年前同步",
"statusbar_time_months": "{{time}} 月前", "statusbar_time_months": "{{time}} 月前同步",
"statusbar_time_weeks": "{{time}} 周前", "statusbar_time_weeks": "{{time}} 周前同步",
"statusbar_time_days": "{{time}} 天前", "statusbar_time_days": "{{time}} 天前同步",
"statusbar_time_hours": "{{time}} 小時前", "statusbar_time_hours": "{{time}} 小時前同步",
"statusbar_time_minutes": "{{time}} 分鐘前", "statusbar_time_minutes": "{{time}} 分鐘前同步",
"statusbar_time_lessminute": "一分鐘之內", "statusbar_time_lessminute": "一分鐘之內同步",
"statusbar_lastsync": "上一次同步於:{{time}}", "statusbar_lastsync": "上一次同步於:{{time}}",
"statusbar_syncing": "正在同步",
"statusbar_now": "剛同步完",
"statusbar_lastsync_label": "上一次同步於:{{date}}", "statusbar_lastsync_label": "上一次同步於:{{date}}",
"statusbar_lastsync_never": "沒觸發過同步", "statusbar_lastsync_never": "沒觸發過同步",
"statusbar_lastsync_never_label": "沒觸發過同步", "statusbar_lastsync_never_label": "沒觸發過同步",
+43 -18
View File
@@ -203,6 +203,10 @@ export default class RemotelySavePlugin extends Plugin {
} }
} }
// change status to "syncing..." on statusbar
if (this.statusBarElement !== undefined) {
this.updateLastSuccessSyncMsg(-1);
}
//log.info(`huh ${this.settings.password}`) //log.info(`huh ${this.settings.password}`)
if (this.settings.currLogLevel === "info") { if (this.settings.currLogLevel === "info") {
getNotice( getNotice(
@@ -332,6 +336,7 @@ export default class RemotelySavePlugin extends Plugin {
getNotice(t("syncrun_step7")); getNotice(t("syncrun_step7"));
} }
this.syncStatus = "syncing"; this.syncStatus = "syncing";
await doActualSync( await doActualSync(
client, client,
this.db, this.db,
@@ -1076,6 +1081,19 @@ export default class RemotelySavePlugin extends Plugin {
this.settings.syncOnSaveAfterMilliseconds > 0 this.settings.syncOnSaveAfterMilliseconds > 0
) { ) {
let runScheduled = false; let runScheduled = false;
let needToRunAgain = false;
const scheduleSyncOnSave = (scheduleTimeFromNow: number) => {
log.info(
`schedule a run for ${scheduleTimeFromNow} milliseconds later`
);
runScheduled = true;
setTimeout(() => {
this.syncRun("auto_sync_on_save");
runScheduled = false;
}, scheduleTimeFromNow);
};
this.app.workspace.onLayoutReady(() => { this.app.workspace.onLayoutReady(() => {
const intervalID = window.setInterval(() => { const intervalID = window.setInterval(() => {
const currentFile = this.app.workspace.getActiveFile(); const currentFile = this.app.workspace.getActiveFile();
@@ -1086,29 +1104,28 @@ export default class RemotelySavePlugin extends Plugin {
// then schedule a run for syncOnSaveAfterMilliseconds after it was modified // then schedule a run for syncOnSaveAfterMilliseconds after it was modified
const lastModified = currentFile.stat.mtime; const lastModified = currentFile.stat.mtime;
const currentTime = Date.now(); const currentTime = Date.now();
// log.debug(
// `Checking if file was modified within last ${
// this.settings.syncOnSaveAfterMilliseconds / 1000
// } seconds, last modified: ${
// (currentTime - lastModified) / 1000
// } seconds ago`
// );
if ( if (
currentTime - lastModified < currentTime - lastModified <
this.settings!.syncOnSaveAfterMilliseconds! this.settings!.syncOnSaveAfterMilliseconds!
) { ) {
if (!runScheduled) { if (
!needToRunAgain &&
!runScheduled &&
this.syncStatus === "idle"
) {
const scheduleTimeFromNow = const scheduleTimeFromNow =
this.settings!.syncOnSaveAfterMilliseconds! - this.settings!.syncOnSaveAfterMilliseconds! -
(currentTime - lastModified); (currentTime - lastModified);
log.info( scheduleSyncOnSave(scheduleTimeFromNow);
`schedule a run for ${scheduleTimeFromNow} milliseconds later` } else if (
); needToRunAgain &&
runScheduled = true; !runScheduled &&
setTimeout(() => { this.syncStatus === "idle"
this.syncRun("auto_sync_on_save"); ) {
runScheduled = false; scheduleSyncOnSave(this.settings!.syncOnSaveAfterMilliseconds!);
}, scheduleTimeFromNow); needToRunAgain = false;
} else {
needToRunAgain = true;
} }
} }
} }
@@ -1144,6 +1161,10 @@ export default class RemotelySavePlugin extends Plugin {
let lastSyncMsg = t("statusbar_lastsync_never"); let lastSyncMsg = t("statusbar_lastsync_never");
let lastSyncLabelMsg = t("statusbar_lastsync_never_label"); let lastSyncLabelMsg = t("statusbar_lastsync_never_label");
if (lastSuccessSyncMillis !== undefined && lastSuccessSyncMillis === -1) {
lastSyncMsg = t("statusbar_syncing");
}
if (lastSuccessSyncMillis !== undefined && lastSuccessSyncMillis > 0) { if (lastSuccessSyncMillis !== undefined && lastSuccessSyncMillis > 0) {
const deltaTime = Date.now() - lastSuccessSyncMillis; const deltaTime = Date.now() - lastSuccessSyncMillis;
@@ -1154,6 +1175,8 @@ export default class RemotelySavePlugin extends Plugin {
const days = Math.floor(deltaTime / 86400000); const days = Math.floor(deltaTime / 86400000);
const hours = Math.floor(deltaTime / 3600000); const hours = Math.floor(deltaTime / 3600000);
const minutes = Math.floor(deltaTime / 60000); const minutes = Math.floor(deltaTime / 60000);
const seconds = Math.floor(deltaTime / 1000);
let timeText = ""; let timeText = "";
if (years > 0) { if (years > 0) {
@@ -1168,8 +1191,10 @@ export default class RemotelySavePlugin extends Plugin {
timeText = t("statusbar_time_hours", { time: hours }); timeText = t("statusbar_time_hours", { time: hours });
} else if (minutes > 0) { } else if (minutes > 0) {
timeText = t("statusbar_time_minutes", { time: minutes }); timeText = t("statusbar_time_minutes", { time: minutes });
} else { } else if (seconds > 30) {
timeText = t("statusbar_time_lessminute"); timeText = t("statusbar_time_lessminute");
} else {
timeText = t("statusbar_now");
} }
let dateText = new Date(lastSuccessSyncMillis).toLocaleTimeString( let dateText = new Date(lastSuccessSyncMillis).toLocaleTimeString(
@@ -1182,7 +1207,7 @@ export default class RemotelySavePlugin extends Plugin {
} }
); );
lastSyncMsg = t("statusbar_lastsync", { time: timeText }); lastSyncMsg = timeText;
lastSyncLabelMsg = t("statusbar_lastsync_label", { date: dateText }); lastSyncLabelMsg = t("statusbar_lastsync_label", { date: dateText });
} }