Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1581cb3822 | ||
|
|
99926adbbd | ||
|
|
4edd8caaea | ||
|
|
005b698862 | ||
|
|
e76a5e4c12 |
@@ -61,8 +61,8 @@ Additionally, the plugin author may occasionally visit Obsidian official forum a
|
|||||||
|
|
||||||
- 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.
|
||||||
- About CORS:
|
- About CORS:
|
||||||
- If you are using Obsidian >= 0.13.25, you can skip this CORS part.
|
- 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 < 0.13.25, 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 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.
|
||||||
- Download and enable this plugin.
|
- Download and enable this plugin.
|
||||||
- Enter your information to the settings of 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.
|
- 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.
|
||||||
@@ -87,8 +87,8 @@ Additionally, the plugin author may occasionally visit Obsidian official forum a
|
|||||||
### webdav
|
### webdav
|
||||||
|
|
||||||
- About CORS:
|
- About CORS:
|
||||||
- If you are using Obsidian >= 0.13.25, you can skip this CORS part.
|
- 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 < 0.13.25:
|
- If you are using Obsidian desktop < 0.13.25 or mobile < 1.1.1:
|
||||||
- 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.
|
- 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.
|
- 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.
|
||||||
- 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.
|
- 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.
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ The plugin is developed for the browser environment. The "fake" browser behind t
|
|||||||
|
|
||||||
[MDN has a doc about CORS.](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)
|
[MDN has a doc about CORS.](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS)
|
||||||
|
|
||||||
From Obsidian version >= insider 0.13.25, Obsidian [provides a new API `requiestUrl`](https://forum.obsidian.md/t/obsidian-release-v0-13-25-insider-build/32701), that allows the plugin to fully bypass the CORS issue. As of Mar 2022, the latest public-released Obsidian desktop has supported this API, but the Obsidian mobile still stays in insider.
|
From Obsidian desktop >= 0.13.25 or mobile >= 1.1.1, Obsidian [provides a new API `requiestUrl`](https://forum.obsidian.md/t/obsidian-release-v0-13-25-insider-build/32701), that allows the plugin to fully bypass the CORS issue. As of Mar 2022, the latest public-released Obsidian desktop has supported this API, but the Obsidian mobile still stays in insider.
|
||||||
|
|
||||||
For using this plugin in Obsidian version < 0.13.25, we need to configure the server side to return the header `Access-Control-Allow-Origin` allowing the origins `app://obsidian.md` and `capacitor://localhost` and `http://localhost`. Here is an example [configuration for Amazon S3](./s3_cors_configure.md).
|
For using this plugin in Obsidian desktop < 0.13.25 or mobile < 1.1.1, we need to configure the server side to return the header `Access-Control-Allow-Origin` allowing the origins `app://obsidian.md` and `capacitor://localhost` and `http://localhost`. Here is an example [configuration for Amazon S3](./s3_cors_configure.md).
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# How To Configure S3 CORS Rules
|
# How To Configure S3 CORS Rules
|
||||||
|
|
||||||
If you are using the latest version of this plugin AND Obsidian >= 0.13.25, you do not need to configure it any more. If you are using Obsidian < 0.13.25, you are required to configure the rules as following.
|
If you are using the latest version of this plugin AND Obsidian desktop >= 0.13.25, mobile >= 1.1.1, you do not need to configure it any more. If you are using Obsidian desktop < 0.13.25, moble < 1.1.1, you are required to configure the rules as following.
|
||||||
|
|
||||||
Thanks to [@NAL100 in the Discussion](https://github.com/fyears/remotely-save/discussions/28).
|
Thanks to [@NAL100 in the Discussion](https://github.com/fyears/remotely-save/discussions/28).
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
Here is an overview of the connectability ("connectable" or "not connectable" or "in the plan" or "never") to some services by this plugin.
|
Here is an overview of the connectability ("connectable" or "not connectable" or "in the plan" or "never") to some services by this plugin.
|
||||||
|
|
||||||
The plugin works under the browser environment in Obsidian, so CORS is an issue. Obsidian starts to provide a rich API `requestUrl` for version >= 0.13.25 to bypass the CORS issue. But if the users are still using an older version of Obsidian, they need to configure CORS on server.
|
The plugin works under the browser environment in Obsidian, so CORS is an issue. Obsidian starts to provide a rich API `requestUrl` for desktop version >= 0.13.25, mobile >= 1.1.1 to bypass the CORS issue. But if the users are still using an older version of Obsidian, they need to configure CORS on server.
|
||||||
|
|
||||||
The list is for information purposes only.
|
The list is for information purposes only.
|
||||||
|
|
||||||
| Service | Connectable | by S3 | by WebDAV | by other protocol | can bypass CORS issue in Obsidian>=0.13.25 | need CORS config in Obsidian<0.13.25 |
|
| Service | Connectable | by S3 | by WebDAV | by other protocol | can bypass CORS issue in latest Obsidian | need CORS config in old Obsidian |
|
||||||
| ------------------------------------------------------------------------------------- | ----------- | ----- | --------- | ---------------------------------------------------------------- | ------------------------------------------ | ------------------------------------------------ |
|
| ------------------------------------------------------------------------------------- | ----------- | ----- | --------- | ---------------------------------------------------------------- | ---------------------------------------- | ------------------------------------------------ |
|
||||||
| Amazon S3 | Yes | Yes | | | Yes | [CORS config needed.](./s3_cors_configure.md) |
|
| Amazon S3 | Yes | Yes | | | Yes | [CORS config needed.](./s3_cors_configure.md) |
|
||||||
| Tencent Cloud - Cloud Object Storage (COS) 腾讯云对象存储 | Yes | Yes | | | Yes | CORS config needed. |
|
| Tencent Cloud - Cloud Object Storage (COS) 腾讯云对象存储 | Yes | Yes | | | Yes | CORS config needed. |
|
||||||
| Alibaba Cloud - Object Storage Service 阿里云对象存储 | Yes | Yes | | | Yes | CORS config needed. |
|
| Alibaba Cloud - Object Storage Service 阿里云对象存储 | Yes | Yes | | | Yes | CORS config needed. |
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "remotely-save",
|
"id": "remotely-save",
|
||||||
"name": "Remotely Save",
|
"name": "Remotely Save",
|
||||||
"version": "0.3.11",
|
"version": "0.3.13",
|
||||||
"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
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "remotely-save",
|
"name": "remotely-save",
|
||||||
"version": "0.3.11",
|
"version": "0.3.13",
|
||||||
"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",
|
"dev2": "node esbuild.config.mjs",
|
||||||
|
|||||||
+1
-1
Submodule src/langs updated: 28730585f8...475d524994
+10
-3
@@ -1,5 +1,11 @@
|
|||||||
import { Buffer } from "buffer";
|
import { Buffer } from "buffer";
|
||||||
import { Vault, request, requestUrl, requireApiVersion } from "obsidian";
|
import {
|
||||||
|
Vault,
|
||||||
|
request,
|
||||||
|
requestUrl,
|
||||||
|
requireApiVersion,
|
||||||
|
Platform,
|
||||||
|
} from "obsidian";
|
||||||
|
|
||||||
import { Queue } from "@fyears/tsqueue";
|
import { Queue } from "@fyears/tsqueue";
|
||||||
import chunk from "lodash/chunk";
|
import chunk from "lodash/chunk";
|
||||||
@@ -20,7 +26,7 @@ import type {
|
|||||||
ResponseDataDetailed,
|
ResponseDataDetailed,
|
||||||
} from "webdav/web";
|
} from "webdav/web";
|
||||||
import { getPatcher } from "webdav/web";
|
import { getPatcher } from "webdav/web";
|
||||||
if (requireApiVersion(API_VER_REQURL)) {
|
if (requireApiVersion(API_VER_REQURL) && !Platform.isAndroidApp) {
|
||||||
getPatcher().patch(
|
getPatcher().patch(
|
||||||
"request",
|
"request",
|
||||||
async (
|
async (
|
||||||
@@ -110,6 +116,7 @@ if (requireApiVersion(API_VER_REQURL)) {
|
|||||||
// return r;
|
// return r;
|
||||||
// });
|
// });
|
||||||
import { AuthType, BufferLike, createClient } from "webdav/web";
|
import { AuthType, BufferLike, createClient } from "webdav/web";
|
||||||
|
import { Plane } from "lucide";
|
||||||
export type { WebDAVClient } from "webdav/web";
|
export type { WebDAVClient } from "webdav/web";
|
||||||
|
|
||||||
export const DEFAULT_WEBDAV_CONFIG = {
|
export const DEFAULT_WEBDAV_CONFIG = {
|
||||||
@@ -204,7 +211,7 @@ export class WrappedWebdavClient {
|
|||||||
if (this.vaultFolderExists) {
|
if (this.vaultFolderExists) {
|
||||||
// pass
|
// pass
|
||||||
} else {
|
} else {
|
||||||
const res = await this.client.exists(`/${this.vaultName}`);
|
const res = await this.client.exists(`/${this.vaultName}/`);
|
||||||
if (res) {
|
if (res) {
|
||||||
// log.info("remote vault folder exits!");
|
// log.info("remote vault folder exits!");
|
||||||
this.vaultFolderExists = true;
|
this.vaultFolderExists = true;
|
||||||
|
|||||||
+20
-15
@@ -1105,6 +1105,9 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
|
|||||||
this.plugin.settings.serviceType !== "webdav"
|
this.plugin.settings.serviceType !== "webdav"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const webdavReq =
|
||||||
|
requireApiVersion(API_VER_REQURL) && !Platform.isAndroidApp;
|
||||||
|
|
||||||
webdavDiv.createEl("h2", { text: t("settings_webdav") });
|
webdavDiv.createEl("h2", { text: t("settings_webdav") });
|
||||||
|
|
||||||
webdavDiv.createEl("p", {
|
webdavDiv.createEl("p", {
|
||||||
@@ -1112,7 +1115,17 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
|
|||||||
cls: "webdav-disclaimer",
|
cls: "webdav-disclaimer",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!requireApiVersion(API_VER_REQURL)) {
|
if (!webdavReq) {
|
||||||
|
if (Platform.isAndroidApp) {
|
||||||
|
webdavDiv.createEl("p", {
|
||||||
|
text: t("settings_webdav_cors_android"),
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
webdavDiv.createEl("p", {
|
||||||
|
text: t("settings_webdav_cors_otheros"),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
webdavDiv.createEl("p", {
|
webdavDiv.createEl("p", {
|
||||||
text: t("settings_webdav_cors"),
|
text: t("settings_webdav_cors"),
|
||||||
});
|
});
|
||||||
@@ -1168,15 +1181,12 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
|
|||||||
.setDesc(t("settings_webdav_auth_desc"))
|
.setDesc(t("settings_webdav_auth_desc"))
|
||||||
.addDropdown(async (dropdown) => {
|
.addDropdown(async (dropdown) => {
|
||||||
dropdown.addOption("basic", "basic");
|
dropdown.addOption("basic", "basic");
|
||||||
if (requireApiVersion(API_VER_REQURL)) {
|
if (webdavReq) {
|
||||||
dropdown.addOption("digest", "digest");
|
dropdown.addOption("digest", "digest");
|
||||||
}
|
}
|
||||||
|
|
||||||
// new version config, copied to old version, we need to reset it
|
// new version config, copied to old version, we need to reset it
|
||||||
if (
|
if (!webdavReq && this.plugin.settings.webdav.authType !== "basic") {
|
||||||
!requireApiVersion(API_VER_REQURL) &&
|
|
||||||
this.plugin.settings.webdav.authType !== "basic"
|
|
||||||
) {
|
|
||||||
this.plugin.settings.webdav.authType = "basic";
|
this.plugin.settings.webdav.authType = "basic";
|
||||||
await this.plugin.saveSettings();
|
await this.plugin.saveSettings();
|
||||||
}
|
}
|
||||||
@@ -1249,16 +1259,11 @@ export class RemotelySaveSettingTab extends PluginSettingTab {
|
|||||||
if (res) {
|
if (res) {
|
||||||
new Notice(t("settings_webdav_connect_succ"));
|
new Notice(t("settings_webdav_connect_succ"));
|
||||||
} else {
|
} else {
|
||||||
let corsErrMsg = "/CORS";
|
if (webdavReq) {
|
||||||
if (requireApiVersion(API_VER_REQURL)) {
|
new Notice(t("settings_webdav_connect_fail"));
|
||||||
corsErrMsg = "";
|
} else {
|
||||||
|
new Notice(t("settings_webdav_connect_fail_withcors"));
|
||||||
}
|
}
|
||||||
|
|
||||||
new Notice(
|
|
||||||
t("settings_webdav_connect_fail", {
|
|
||||||
corsErrMsg: corsErrMsg,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
new Notice(errors.msg);
|
new Notice(errors.msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"0.3.2": "0.12.15",
|
"0.3.2": "0.12.15",
|
||||||
"0.3.11": "0.13.21"
|
"0.3.13": "0.13.21"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user