Compare commits

...
4 Commits
Author SHA1 Message Date
fyears acc9233611 bump to beta 0.4.5
Release A New Version / build (16.x) (push) Failing after 41s
2024-03-20 01:42:33 +08:00
fyears 4456db11cf try to make webdav header happy 2024-03-20 01:42:02 +08:00
fyears 54449dd207 add doc for onedrive 2024-03-19 01:29:10 +08:00
fyears 822941f1c3 fix statusbar 2024-03-18 23:59:52 +08:00
6 changed files with 49 additions and 21 deletions
+1
View File
@@ -92,6 +92,7 @@ Additionally, the plugin author may occasionally visit Obsidian official forum a
- If you decide to authorize this plugin to connect to OneDrive, please go to plugin's settings, and choose OneDrive then follow the instructions.
- Password-based end-to-end encryption is also supported. But please be aware that **the vault name itself is not encrypted**.
- If you want to sync the files across multiple devices, **your vault name should be the same** while using default settings.
- You might also want to checkout [faq for OneDrive](./docs/remote_services/onedrive/README.md).
### webdav
+23
View File
@@ -0,0 +1,23 @@
# OneDrive
- **This plugin is NOT an official Microsoft / OneDrive product.** The plugin just uses Microsoft's [OneDrive's public API](https://docs.microsoft.com/en-us/onedrive/developer/rest-api).
- After the authorization, the plugin can read your name and email, and read and write files in your OneDrive's `/Apps/remotely-save` folder.
- If you decide to authorize this plugin to connect to OneDrive, please go to plugin's settings, and choose OneDrive then follow the instructions.
- Password-based end-to-end encryption is also supported. But please be aware that **the vault name itself is not encrypted**.
- If you want to sync the files across multiple devices, **your vault name should be the same** while using default settings.
## FAQ
### How about OneDrive for Business?
This plugin only works for "OneDrive for personal", and not works for "OneDrive for Business" (yet). See [#11](https://github.com/fyears/remotely-save/issues/11) to further details.
### I cannot find `/Apps/remotely-save` folder
Mystically some users report that their OneDrive generate `/Application/Graph` instead of `/Apps/remotely-save`. See [#517](https://github.com/remotely-save/remotely-save/issues/517).
The solution is simple:
1. Backup your vault manually.
2. Go to onedrive website (<https://onedrive.live.com/>), and rename `/Application/Graph` to `/Application/remotely-save` (right click on the folder and you will see rename option)
3. Come back to Obsidian and try to sync!
+1 -1
View File
@@ -1,7 +1,7 @@
{
"id": "remotely-save",
"name": "Remotely Save",
"version": "0.4.4",
"version": "0.4.5",
"minAppVersion": "0.13.21",
"description": "Yet another unofficial plugin allowing users to synchronize notes between local device and the cloud service.",
"author": "fyears",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "remotely-save",
"version": "0.4.4",
"version": "0.4.5",
"description": "This is yet another sync plugin for Obsidian app.",
"scripts": {
"dev2": "node esbuild.config.mjs --watch",
+7 -10
View File
@@ -509,17 +509,14 @@ export const stringToFragment = (string: string) => {
* @param op
*/
export const changeMobileStatusBar = (op: "enable" | "disable") => {
const bar = document.querySelector(
".is-mobile .app-container .status-bar"
) as HTMLElement;
if (op === "enable") {
(
document.querySelector(
".is-mobile .app-container .status-bar"
) as HTMLElement
).style.setProperty("display", "flex");
bar.style.setProperty("display", "flex");
bar.style.setProperty("margin-bottom", "40px");
} else {
(
document.querySelector(
".is-mobile .app-container .status-bar"
) as HTMLElement
).style.setProperty("display", "none");
bar.style.removeProperty("display");
bar.style.removeProperty("margin-bottom");
}
};
+16 -9
View File
@@ -26,17 +26,26 @@ function onlyAscii(str: string) {
return !/[^\u0000-\u00ff]/g.test(str);
}
/**
* https://stackoverflow.com/questions/12539574/
* @param obj
* @returns
*/
function objKeyToLower(obj: Record<string, string>) {
return Object.fromEntries(
Object.entries(obj).map(([k, v]) => [k.toLowerCase(), v])
);
}
// @ts-ignore
import { getPatcher } from "webdav/dist/web/index.js";
if (VALID_REQURL) {
getPatcher().patch(
"request",
async (options: RequestOptionsWithState): Promise<Response> => {
const transformedHeaders = { ...options.headers };
const transformedHeaders = objKeyToLower({ ...options.headers });
delete transformedHeaders["host"];
delete transformedHeaders["Host"];
delete transformedHeaders["content-length"];
delete transformedHeaders["Content-Length"];
const r = await requestUrl({
url: options.url,
@@ -51,16 +60,14 @@ if (VALID_REQURL) {
if (options.headers !== undefined) {
contentType =
contentType ||
options.headers["Content-Type"] ||
options.headers["content-type"] ||
options.headers["Accept"] ||
options.headers["accept"];
transformedHeaders["content-type"] ||
transformedHeaders["accept"];
}
if (contentType !== undefined) {
contentType = contentType.toLowerCase();
}
const rspHeaders = { ...r.headers };
const rspHeaders = objKeyToLower({ ...r.headers });
console.log("rspHeaders");
console.log(rspHeaders);
for (let key in rspHeaders) {