Asch/test #1
11 changed files with 32 additions and 14 deletions
8
backend/Cargo.lock
generated
8
backend/Cargo.lock
generated
|
|
@ -1479,7 +1479,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reconcile"
|
name = "reconcile"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"insta",
|
"insta",
|
||||||
"pretty_assertions",
|
"pretty_assertions",
|
||||||
|
|
@ -1489,7 +1489,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reconcile-fuzz"
|
name = "reconcile-fuzz"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libfuzzer-sys",
|
"libfuzzer-sys",
|
||||||
"reconcile",
|
"reconcile",
|
||||||
|
|
@ -2104,7 +2104,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sync_lib"
|
name = "sync_lib"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"console_error_panic_hook",
|
"console_error_panic_hook",
|
||||||
|
|
@ -2117,7 +2117,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sync_server"
|
name = "sync_server"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aide",
|
"aide",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "reconcile-fuzz"
|
name = "reconcile-fuzz"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
publish = false
|
publish = false
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "reconcile"
|
name = "reconcile"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "sync_lib"
|
name = "sync_lib"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
authors = ["Andras Schmelczer <andras@schmelczer.dev>"]
|
authors = ["Andras Schmelczer <andras@schmelczer.dev>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "sync_server"
|
name = "sync_server"
|
||||||
version = "0.0.16"
|
version = "0.0.17"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ npm version patch
|
||||||
echo "Updating frontend dependencies to match the new backend versions"
|
echo "Updating frontend dependencies to match the new backend versions"
|
||||||
cd ../backend/sync_lib
|
cd ../backend/sync_lib
|
||||||
wasm-pack build --target web --features console_error_panic_hook
|
wasm-pack build --target web --features console_error_panic_hook
|
||||||
|
|
||||||
|
cd ../../plugin
|
||||||
npm install
|
npm install
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "vault-link",
|
"id": "vault-link",
|
||||||
"name": "VaultLink",
|
"name": "VaultLink",
|
||||||
"version": "0.0.16",
|
"version": "0.0.17",
|
||||||
"minAppVersion": "0.0.0",
|
"minAppVersion": "0.0.0",
|
||||||
"description": "Self-hosted synchronization and collaboration for your Vault.",
|
"description": "Self-hosted synchronization and collaboration for your Vault.",
|
||||||
"author": "Andras Schmelczer",
|
"author": "Andras Schmelczer",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "vault-link",
|
"id": "vault-link",
|
||||||
"name": "VaultLink",
|
"name": "VaultLink",
|
||||||
"version": "0.0.16",
|
"version": "0.0.17",
|
||||||
"minAppVersion": "0.0.0",
|
"minAppVersion": "0.0.0",
|
||||||
"description": "Self-hosted synchronization and collaboration for your Vault.",
|
"description": "Self-hosted synchronization and collaboration for your Vault.",
|
||||||
"author": "Andras Schmelczer",
|
"author": "Andras Schmelczer",
|
||||||
|
|
|
||||||
6
plugin/package-lock.json
generated
6
plugin/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "vault-link-obsidian-plugin",
|
"name": "vault-link-obsidian-plugin",
|
||||||
"version": "0.0.16",
|
"version": "0.0.17",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "vault-link-obsidian-plugin",
|
"name": "vault-link-obsidian-plugin",
|
||||||
"version": "0.0.16",
|
"version": "0.0.17",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^29.5.14",
|
"@types/jest": "^29.5.14",
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
},
|
},
|
||||||
"../backend/sync_lib/pkg": {
|
"../backend/sync_lib/pkg": {
|
||||||
"name": "sync_lib",
|
"name": "sync_lib",
|
||||||
"version": "0.0.16",
|
"version": "0.0.17",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@ampproject/remapping": {
|
"node_modules/@ampproject/remapping": {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "vault-link-obsidian-plugin",
|
"name": "vault-link-obsidian-plugin",
|
||||||
"version": "0.0.16",
|
"version": "0.0.17",
|
||||||
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
|
"description": "This is a sample plugin for Obsidian (https://obsidian.md)",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -284,6 +284,7 @@ export class Syncer {
|
||||||
const localMetadata = this.database.getDocument(
|
const localMetadata = this.database.getDocument(
|
||||||
oldPath ?? relativePath
|
oldPath ?? relativePath
|
||||||
);
|
);
|
||||||
|
console.log(JSON.stringify(localMetadata));
|
||||||
if (!localMetadata) {
|
if (!localMetadata) {
|
||||||
if (this.database.getDocument(relativePath)) {
|
if (this.database.getDocument(relativePath)) {
|
||||||
this.history.addHistoryEntry({
|
this.history.addHistoryEntry({
|
||||||
|
|
@ -299,9 +300,13 @@ export class Syncer {
|
||||||
`Document metadata not found for ${relativePath}. This implies a corrupt local database. Consider resetting the plugin's sync history.`
|
`Document metadata not found for ${relativePath}. This implies a corrupt local database. Consider resetting the plugin's sync history.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
console.log("about to read", relativePath);
|
||||||
|
|
||||||
const contentBytes = await this.operations.read(relativePath);
|
const contentBytes = await this.operations.read(relativePath);
|
||||||
|
console.log("has read", relativePath);
|
||||||
|
|
||||||
let contentHash = hash(contentBytes);
|
let contentHash = hash(contentBytes);
|
||||||
|
console.log("has hashed", relativePath);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
localMetadata.hash === contentHash &&
|
localMetadata.hash === contentHash &&
|
||||||
|
|
@ -316,6 +321,8 @@ export class Syncer {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("about to send", relativePath);
|
||||||
|
|
||||||
const response = await this.syncService.put({
|
const response = await this.syncService.put({
|
||||||
documentId: localMetadata.documentId,
|
documentId: localMetadata.documentId,
|
||||||
parentVersionId: localMetadata.parentVersionId,
|
parentVersionId: localMetadata.parentVersionId,
|
||||||
|
|
@ -324,6 +331,8 @@ export class Syncer {
|
||||||
createdDate: updateTime
|
createdDate: updateTime
|
||||||
});
|
});
|
||||||
|
|
||||||
|
console.log("has sent", relativePath);
|
||||||
|
|
||||||
this.history.addHistoryEntry({
|
this.history.addHistoryEntry({
|
||||||
status: SyncStatus.SUCCESS,
|
status: SyncStatus.SUCCESS,
|
||||||
source: SyncSource.PUSH,
|
source: SyncSource.PUSH,
|
||||||
|
|
@ -364,15 +373,22 @@ export class Syncer {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.type === "MergingUpdate") {
|
if (response.type === "MergingUpdate") {
|
||||||
|
console.log(
|
||||||
|
"about to deserialize",
|
||||||
|
response.contentBase64
|
||||||
|
);
|
||||||
const responseBytes = deserialize(
|
const responseBytes = deserialize(
|
||||||
response.contentBase64
|
response.contentBase64
|
||||||
);
|
);
|
||||||
|
console.log("has deserialized", response.relativePath);
|
||||||
contentHash = hash(responseBytes);
|
contentHash = hash(responseBytes);
|
||||||
|
console.log("about to write", response.relativePath);
|
||||||
await this.operations.write(
|
await this.operations.write(
|
||||||
response.relativePath,
|
response.relativePath,
|
||||||
contentBytes,
|
contentBytes,
|
||||||
responseBytes
|
responseBytes
|
||||||
);
|
);
|
||||||
|
console.log("has written", response.relativePath);
|
||||||
|
|
||||||
this.history.addHistoryEntry({
|
this.history.addHistoryEntry({
|
||||||
status: SyncStatus.SUCCESS,
|
status: SyncStatus.SUCCESS,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue