Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f50ba953f1 | ||
|
|
55cb26bd22 | ||
|
|
36d3018efb | ||
|
|
421b43d937 | ||
|
|
17708359a1 | ||
|
|
9acae1b077 | ||
|
|
4ade975585 | ||
|
|
e988fc7ae9 |
@@ -39,13 +39,13 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout codes
|
- name: Checkout codes
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: Checkout LFS file list
|
- name: Checkout LFS file list
|
||||||
run: git lfs ls-files --long | cut -d ' ' -f1 | sort > .lfs-assets-id
|
run: git lfs ls-files --long | cut -d ' ' -f1 | sort > .lfs-assets-id
|
||||||
- name: LFS Cache
|
- name: LFS Cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: .git/lfs/objects
|
path: .git/lfs/objects
|
||||||
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
|
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
|
||||||
@@ -60,7 +60,7 @@ jobs:
|
|||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npm test
|
- run: npm test
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: my-dist
|
name: my-dist
|
||||||
path: |
|
path: |
|
||||||
|
|||||||
@@ -42,13 +42,13 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout codes
|
- name: Checkout codes
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
- name: Checkout LFS file list
|
- name: Checkout LFS file list
|
||||||
run: git lfs ls-files --long | cut -d ' ' -f1 | sort > .lfs-assets-id
|
run: git lfs ls-files --long | cut -d ' ' -f1 | sort > .lfs-assets-id
|
||||||
- name: LFS Cache
|
- name: LFS Cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: .git/lfs/objects
|
path: .git/lfs/objects
|
||||||
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
|
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
|
||||||
@@ -63,44 +63,14 @@ jobs:
|
|||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npm test
|
- run: npm test
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- name: Create Release
|
- name: Create Release And Upload
|
||||||
id: create_release
|
uses: softprops/action-gh-release@v2
|
||||||
uses: actions/create-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
VERSION: ${{ github.ref }}
|
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ github.ref }}
|
files: |
|
||||||
release_name: ${{ github.ref }}
|
main.js
|
||||||
|
manifest.json
|
||||||
|
styles.css
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: true
|
prerelease: false
|
||||||
- name: Upload main.js
|
make_latest: true
|
||||||
id: upload-main
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: ./main.js
|
|
||||||
asset_name: main.js
|
|
||||||
asset_content_type: text/javascript
|
|
||||||
- name: Upload manifest.json
|
|
||||||
id: upload-manifest
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: ./manifest.json
|
|
||||||
asset_name: manifest.json
|
|
||||||
asset_content_type: application/json
|
|
||||||
- name: Upload styles.css
|
|
||||||
id: upload-styles
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: ./styles.css
|
|
||||||
asset_name: styles.css
|
|
||||||
asset_content_type: text/css
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "remotely-save",
|
"id": "remotely-save",
|
||||||
"name": "Remotely Save",
|
"name": "Remotely Save",
|
||||||
"version": "0.5.21",
|
"version": "0.5.22",
|
||||||
"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,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "remotely-save",
|
"id": "remotely-save",
|
||||||
"name": "Remotely Save",
|
"name": "Remotely Save",
|
||||||
"version": "0.5.21",
|
"version": "0.5.22",
|
||||||
"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.5.21",
|
"version": "0.5.22",
|
||||||
"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",
|
||||||
|
|||||||
@@ -95,6 +95,10 @@ class GoogleDriveAuthModal extends Modal {
|
|||||||
k.expires_in * 1000;
|
k.expires_in * 1000;
|
||||||
this.plugin.settings.googledrive.accessTokenExpiresAtTimeMs =
|
this.plugin.settings.googledrive.accessTokenExpiresAtTimeMs =
|
||||||
ts + k.expires_in * 1000 - 60 * 2 * 1000;
|
ts + k.expires_in * 1000 - 60 * 2 * 1000;
|
||||||
|
|
||||||
|
// manually set it expired after 60 days;
|
||||||
|
this.plugin.settings.googledrive.credentialsShouldBeDeletedAtTimeMs =
|
||||||
|
Date.now() + 1000 * 60 * 60 * 24 * 59;
|
||||||
await this.plugin.saveSettings();
|
await this.plugin.saveSettings();
|
||||||
|
|
||||||
// try to remove data in clipboard
|
// try to remove data in clipboard
|
||||||
|
|||||||
+70
-30
@@ -202,15 +202,22 @@ export const checkIsSkipItemOrNotByName = (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (syncConfigDir && isInsideObsFolder(key, configDir)) {
|
|
||||||
if (finalIsIgnored === undefined) {
|
// we have to check bookmarks.json firstly then check the whole .obsidian folder later
|
||||||
|
if (isBookmarksFile(key, configDir) && finalIsIgnored === undefined) {
|
||||||
|
if (syncBookmarks) {
|
||||||
finalIsIgnored = false;
|
finalIsIgnored = false;
|
||||||
|
} else {
|
||||||
|
finalIsIgnored = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (syncBookmarks && isBookmarksFile(key, configDir)) {
|
// we have to check bookmarks.json firstly then check the whole .obsidian folder later
|
||||||
if (finalIsIgnored === undefined) {
|
if (isInsideObsFolder(key, configDir) && finalIsIgnored === undefined) {
|
||||||
|
if (syncConfigDir) {
|
||||||
finalIsIgnored = false;
|
finalIsIgnored = false;
|
||||||
|
} else {
|
||||||
|
finalIsIgnored = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,17 +263,9 @@ export const checkIsSkipItemOrNotByName = (
|
|||||||
* | yes, also apply to children | explictly ignored | yes | yes | yes |
|
* | yes, also apply to children | explictly ignored | yes | yes | yes |
|
||||||
*/
|
*/
|
||||||
export const getSkipItemsByList = (
|
export const getSkipItemsByList = (
|
||||||
skipOrNotResults: Record<string, IsSkipResult>,
|
skipOrNotResults: Record<string, IsSkipResult>
|
||||||
ignorePaths: string[],
|
|
||||||
onlyAllowPaths: string[]
|
|
||||||
): string[] => {
|
): string[] => {
|
||||||
const allPotentialKeys = Object.keys(skipOrNotResults);
|
const allPotentialKeys = Object.keys(skipOrNotResults);
|
||||||
if (
|
|
||||||
allPotentialKeys.length === 0 ||
|
|
||||||
(ignorePaths.length === 0 && onlyAllowPaths.length === 0)
|
|
||||||
) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
// from short(shadow) to long(deep) , ascending
|
// from short(shadow) to long(deep) , ascending
|
||||||
const sortedKeys = allPotentialKeys.sort((k1, k2) => k1.length - k2.length);
|
const sortedKeys = allPotentialKeys.sort((k1, k2) => k1.length - k2.length);
|
||||||
@@ -329,6 +328,7 @@ export const getSkipItemsByList = (
|
|||||||
result.push(key);
|
result.push(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.debug(`finalIsIgnored list= ${JSON.stringify(result)}`);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -495,11 +495,7 @@ const ensembleMixedEnties = async (
|
|||||||
profiler?.insertSize("sizeof finalMappings", finalMappings);
|
profiler?.insertSize("sizeof finalMappings", finalMappings);
|
||||||
|
|
||||||
// we check the skipOrNotResults again! in case we adjust some paths!
|
// we check the skipOrNotResults again! in case we adjust some paths!
|
||||||
const allReallySkipKeys = getSkipItemsByList(
|
const allReallySkipKeys = getSkipItemsByList(skipOrNotResults);
|
||||||
skipOrNotResults,
|
|
||||||
ignorePaths,
|
|
||||||
onlyAllowPaths
|
|
||||||
);
|
|
||||||
for (const key of allReallySkipKeys) {
|
for (const key of allReallySkipKeys) {
|
||||||
delete finalMappings[key];
|
delete finalMappings[key];
|
||||||
}
|
}
|
||||||
@@ -625,14 +621,36 @@ const getSyncPlanInplace = async (
|
|||||||
mixedEntry.change = false;
|
mixedEntry.change = false;
|
||||||
keptFolder.add(getParentFolder(key));
|
keptFolder.add(getParentFolder(key));
|
||||||
} else if (syncDirection === "incremental_pull_and_delete_only") {
|
} else if (syncDirection === "incremental_pull_and_delete_only") {
|
||||||
mixedEntry.decisionBranch = 135;
|
if (
|
||||||
mixedEntry.decision = "folder_to_be_deleted_on_local";
|
key === `${configDir}/` ||
|
||||||
mixedEntry.change = true;
|
key === `${configDir}/bookmarks.json`
|
||||||
|
) {
|
||||||
|
// special: never delete .obsidian folder!
|
||||||
|
mixedEntry.decisionBranch = 137;
|
||||||
|
mixedEntry.decision = "folder_existed_both_then_do_nothing";
|
||||||
|
mixedEntry.change = false;
|
||||||
|
keptFolder.add(getParentFolder(key));
|
||||||
|
} else {
|
||||||
|
mixedEntry.decisionBranch = 135;
|
||||||
|
mixedEntry.decision = "folder_to_be_deleted_on_local";
|
||||||
|
mixedEntry.change = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// bidirectional
|
// bidirectional
|
||||||
mixedEntry.decisionBranch = 124;
|
if (
|
||||||
mixedEntry.decision = "folder_to_be_deleted_on_local";
|
key === `${configDir}/` ||
|
||||||
mixedEntry.change = true;
|
key === `${configDir}/bookmarks.json`
|
||||||
|
) {
|
||||||
|
// special: never delete .obsidian folder!
|
||||||
|
mixedEntry.decisionBranch = 138;
|
||||||
|
mixedEntry.decision = "folder_existed_both_then_do_nothing";
|
||||||
|
mixedEntry.change = false;
|
||||||
|
keptFolder.add(getParentFolder(key));
|
||||||
|
} else {
|
||||||
|
mixedEntry.decisionBranch = 124;
|
||||||
|
mixedEntry.decision = "folder_to_be_deleted_on_local";
|
||||||
|
mixedEntry.change = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// then the folder is created on local
|
// then the folder is created on local
|
||||||
@@ -1074,13 +1092,35 @@ const getSyncPlanInplace = async (
|
|||||||
mixedEntry.decision = "conflict_created_then_do_nothing";
|
mixedEntry.decision = "conflict_created_then_do_nothing";
|
||||||
mixedEntry.change = false;
|
mixedEntry.change = false;
|
||||||
} else if (syncDirection === "incremental_pull_and_delete_only") {
|
} else if (syncDirection === "incremental_pull_and_delete_only") {
|
||||||
mixedEntry.decisionBranch = 39;
|
if (
|
||||||
mixedEntry.decision = "remote_is_deleted_thus_also_delete_local";
|
key === `${configDir}/` ||
|
||||||
mixedEntry.change = true;
|
key === `${configDir}/bookmarks.json`
|
||||||
|
) {
|
||||||
|
// special: never delete .obsidian/bookmarks.json file!
|
||||||
|
mixedEntry.decisionBranch = 139;
|
||||||
|
mixedEntry.decision = "conflict_created_then_keep_local";
|
||||||
|
mixedEntry.change = true;
|
||||||
|
keptFolder.add(getParentFolder(key));
|
||||||
|
} else {
|
||||||
|
mixedEntry.decisionBranch = 39;
|
||||||
|
mixedEntry.decision = "remote_is_deleted_thus_also_delete_local";
|
||||||
|
mixedEntry.change = true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mixedEntry.decisionBranch = 7;
|
if (
|
||||||
mixedEntry.decision = "remote_is_deleted_thus_also_delete_local";
|
key === `${configDir}/` ||
|
||||||
mixedEntry.change = true;
|
key === `${configDir}/bookmarks.json`
|
||||||
|
) {
|
||||||
|
// special: never delete .obsidian/bookmarks.json file!
|
||||||
|
mixedEntry.decisionBranch = 140;
|
||||||
|
mixedEntry.decision = "conflict_created_then_keep_local";
|
||||||
|
mixedEntry.change = true;
|
||||||
|
keptFolder.add(getParentFolder(key));
|
||||||
|
} else {
|
||||||
|
mixedEntry.decisionBranch = 7;
|
||||||
|
mixedEntry.decision = "remote_is_deleted_thus_also_delete_local";
|
||||||
|
mixedEntry.change = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if A is in the previous list and MODIFIED, A has been deleted by B but modified by A
|
// if A is in the previous list and MODIFIED, A has been deleted by B but modified by A
|
||||||
|
|||||||
@@ -1560,6 +1560,7 @@ export default class RemotelySavePlugin extends Plugin {
|
|||||||
this.settings.dropbox.refreshToken !== "" &&
|
this.settings.dropbox.refreshToken !== "" &&
|
||||||
current >= this.settings!.dropbox!.credentialsShouldBeDeletedAtTime!
|
current >= this.settings!.dropbox!.credentialsShouldBeDeletedAtTime!
|
||||||
) {
|
) {
|
||||||
|
console.warn(`dropbox expired`);
|
||||||
dropboxExpired = true;
|
dropboxExpired = true;
|
||||||
this.settings.dropbox = cloneDeep(DEFAULT_DROPBOX_CONFIG);
|
this.settings.dropbox = cloneDeep(DEFAULT_DROPBOX_CONFIG);
|
||||||
needSave = true;
|
needSave = true;
|
||||||
@@ -1570,6 +1571,7 @@ export default class RemotelySavePlugin extends Plugin {
|
|||||||
this.settings.onedrive.refreshToken !== "" &&
|
this.settings.onedrive.refreshToken !== "" &&
|
||||||
current >= this.settings!.onedrive!.credentialsShouldBeDeletedAtTime!
|
current >= this.settings!.onedrive!.credentialsShouldBeDeletedAtTime!
|
||||||
) {
|
) {
|
||||||
|
console.warn(`onedrive expired`);
|
||||||
onedriveExpired = true;
|
onedriveExpired = true;
|
||||||
this.settings.onedrive = cloneDeep(DEFAULT_ONEDRIVE_CONFIG);
|
this.settings.onedrive = cloneDeep(DEFAULT_ONEDRIVE_CONFIG);
|
||||||
needSave = true;
|
needSave = true;
|
||||||
@@ -1580,6 +1582,7 @@ export default class RemotelySavePlugin extends Plugin {
|
|||||||
this.settings.onedrivefull.refreshToken !== "" &&
|
this.settings.onedrivefull.refreshToken !== "" &&
|
||||||
current >= this.settings!.onedrivefull!.credentialsShouldBeDeletedAtTime!
|
current >= this.settings!.onedrivefull!.credentialsShouldBeDeletedAtTime!
|
||||||
) {
|
) {
|
||||||
|
console.warn(`onedrive full expired`);
|
||||||
onedriveFullExpired = true;
|
onedriveFullExpired = true;
|
||||||
this.settings.onedrivefull = cloneDeep(DEFAULT_ONEDRIVEFULL_CONFIG);
|
this.settings.onedrivefull = cloneDeep(DEFAULT_ONEDRIVEFULL_CONFIG);
|
||||||
needSave = true;
|
needSave = true;
|
||||||
@@ -1590,6 +1593,7 @@ export default class RemotelySavePlugin extends Plugin {
|
|||||||
this.settings.googledrive.refreshToken !== "" &&
|
this.settings.googledrive.refreshToken !== "" &&
|
||||||
current >= this.settings!.googledrive!.credentialsShouldBeDeletedAtTimeMs!
|
current >= this.settings!.googledrive!.credentialsShouldBeDeletedAtTimeMs!
|
||||||
) {
|
) {
|
||||||
|
console.warn(`google drive expired`);
|
||||||
googleDriveExpired = true;
|
googleDriveExpired = true;
|
||||||
this.settings.googledrive = cloneDeep(DEFAULT_GOOGLEDRIVE_CONFIG);
|
this.settings.googledrive = cloneDeep(DEFAULT_GOOGLEDRIVE_CONFIG);
|
||||||
needSave = true;
|
needSave = true;
|
||||||
@@ -1600,6 +1604,7 @@ export default class RemotelySavePlugin extends Plugin {
|
|||||||
this.settings.box.refreshToken !== "" &&
|
this.settings.box.refreshToken !== "" &&
|
||||||
current >= this.settings!.box!.credentialsShouldBeDeletedAtTimeMs!
|
current >= this.settings!.box!.credentialsShouldBeDeletedAtTimeMs!
|
||||||
) {
|
) {
|
||||||
|
console.warn(`box expired`);
|
||||||
boxExpired = true;
|
boxExpired = true;
|
||||||
this.settings.box = cloneDeep(DEFAULT_BOX_CONFIG);
|
this.settings.box = cloneDeep(DEFAULT_BOX_CONFIG);
|
||||||
needSave = true;
|
needSave = true;
|
||||||
@@ -1610,6 +1615,7 @@ export default class RemotelySavePlugin extends Plugin {
|
|||||||
this.settings.pcloud.accessToken !== "" &&
|
this.settings.pcloud.accessToken !== "" &&
|
||||||
current >= this.settings!.pcloud!.credentialsShouldBeDeletedAtTimeMs!
|
current >= this.settings!.pcloud!.credentialsShouldBeDeletedAtTimeMs!
|
||||||
) {
|
) {
|
||||||
|
console.warn(`pcloud expired`);
|
||||||
pCloudExpired = true;
|
pCloudExpired = true;
|
||||||
this.settings.pcloud = cloneDeep(DEFAULT_PCLOUD_CONFIG);
|
this.settings.pcloud = cloneDeep(DEFAULT_PCLOUD_CONFIG);
|
||||||
needSave = true;
|
needSave = true;
|
||||||
@@ -1620,6 +1626,7 @@ export default class RemotelySavePlugin extends Plugin {
|
|||||||
this.settings.yandexdisk.refreshToken !== "" &&
|
this.settings.yandexdisk.refreshToken !== "" &&
|
||||||
current >= this.settings!.yandexdisk!.credentialsShouldBeDeletedAtTimeMs!
|
current >= this.settings!.yandexdisk!.credentialsShouldBeDeletedAtTimeMs!
|
||||||
) {
|
) {
|
||||||
|
console.warn(`yandex disk expired`);
|
||||||
yandexDiskExpired = true;
|
yandexDiskExpired = true;
|
||||||
this.settings.yandexdisk = cloneDeep(DEFAULT_YANDEXDISK_CONFIG);
|
this.settings.yandexdisk = cloneDeep(DEFAULT_YANDEXDISK_CONFIG);
|
||||||
needSave = true;
|
needSave = true;
|
||||||
@@ -1630,6 +1637,7 @@ export default class RemotelySavePlugin extends Plugin {
|
|||||||
this.settings.koofr.refreshToken !== "" &&
|
this.settings.koofr.refreshToken !== "" &&
|
||||||
current >= this.settings!.koofr!.credentialsShouldBeDeletedAtTimeMs!
|
current >= this.settings!.koofr!.credentialsShouldBeDeletedAtTimeMs!
|
||||||
) {
|
) {
|
||||||
|
console.warn(`koofr expired`);
|
||||||
koofrExpired = true;
|
koofrExpired = true;
|
||||||
this.settings.koofr = cloneDeep(DEFAULT_KOOFR_CONFIG);
|
this.settings.koofr = cloneDeep(DEFAULT_KOOFR_CONFIG);
|
||||||
needSave = true;
|
needSave = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user