altairwei / WizNotePlus

A community-driven cross-platform note-taking client.

Home Page:https://altairwei.github.io/WizNotePlus/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to upload local storage to private server by WizNotePlus?

V-ctor opened this issue · comments

First of all thank you for your maintaining this fork, but I have some difficulties.
I have a lot of documents in wiz cloud, also it was synced by official local WizNote client. I can see it in .wiznote directory.
Then I got your WizNotePlus, started and it caught all documents/notes. Cool.
I ran private wiz server.
I clean up index.db WIZ_META table to prevent issue with the same name as for wiz server. But it does not sync my existing notes with private server. Only if I create a new or edit existing one.
But it synced all folder tree with empty notes.
Is it possible to force WizNotePlus upload all local notes to private server?

I ran private wiz server.

Is there an account in private server with the same name to that in official wiz cloud? I guess the answer is yes, but I need to know how you migrated the data from the official wiz cloud to the private server, which determines whether your later operations make sense.

I solved my issue already :-)
Yes I have the same account in official wiz cloud as in my private. Let it be username My steps are:

  1. I have full local db in PC (by old linux WizNote client)
  2. I ran my private server by docker
  3. I created in private server the same account (in its web client)
  4. Then I tried to login by WizNotePlus in my private server with the same account but it said that it's impossible due of official one
  5. I moved my local db let's say ~/.wiznote/username to another directory
  6. Logged in WizNotePlus
  7. But I had empty db
  8. I tried to replace new files in ~/.wiznote/username by old ones but it didn't work
  9. I opened ~/.wiznote/username/data/index.db and cleaned up all mentions of official server in WIZ_META table
  10. Then tried to replace files again and it worked, WizNotePlus opened it and it kept connection to private server. But it didn't want to sync these new notes. And here I stuck how to force it and wrote my question here.
  11. But I kept digging source code and found that flag of new note is field WIZ_VERSION=-1 in WIZ_DOCUMENT
  12. update WIZ_DOCUMENT set WIZ_VERSION=-1 that's all I needed. All notes were synced! Great!
    Well tbh I didn't check attachments yet but notes were really synchronized.

I'm going to check it all a bit later and then I can close it by myself if there are no objections.

You'd better check if the sync is successful on another computer, here are some points to check:

  1. Are attachments uploaded to the server?
  2. Are resources (images etc.) of documents uploaded to the server?
  3. Are document params (used by calendar etc.) uploaded to the srver?
  4. How about document tags?

Your solution works on the current machine only because you have the full local database and the resource loss is undetectable. If I have time I will double check the source code to see if your method is safe.

Sure. Now I am redoing it from the begin (download full DB from Wiz official server).

I checked it with my mobile and it seems working. Sync works in both directions on PC (I checked WizNotePlus Version: 2.11.2 Linux version only) and mobile (I checked Android version from Google Play only). So my steps for Linux/Ubuntu are:

  1. Install the latest WizNotePlus.
  2. Login to official Wiz server
  3. In Preferences->Sync select download everything/all (notes, attachements).
  4. Start sync
  5. Logout from WizNotePlus
  6. Open index.db in any SQLite DB explorer (I use DB Browser for SQLite Version 3.12.1 sudo apt-get install sqlitebrowser), execute:
    update WIZ_META set META_VALUE="" where META_NAME="ACCOUNT" and META_KEY="MYWIZMAIL"; update WIZ_DOCUMENT set WIZ_VERSION=-1; update WIZ_DOCUMENT_ATTACHMENT set WIZ_VERSION=-1
    Don't forget to save all DB changes.
    Now our local DB is ready to be uploaded on private server
  7. Install private server (docker etc)
  8. Signup in private server (I used the same account name as for official server)
  9. Login to WizNotePlus with new account for private server
  10. Start sync. Be sure that you are still with full sync.
  11. After sync complete you can check it in private server web client.
    It looks that we are done. Indeed not yet. I noticed that now clients push their updates but don't pull from server
  12. Logout from WizNotePlus, remove local wiznote DB rm ~/.wiznote
  13. Login to WizNotePlus. Now it pushes and pulls updates.
  14. Do the same with mobile. Login to private and don't forget to clean local cache in application settings not in Android.
    That's it. Probably I missed something but it really works for me at the end for notes and attachments.

But during the syncing I got interesting issue after step 10 WizNotePlus began to complain for some notes that they are too short:
[INFO] [Sync] "Can't upload object, error code : 2000" [INFO] [Sync] "note html is too small: < 20 bytes: 12, <p><br/></p>"
I found these notes in filesystems and their index.html are really just
.<p><br/></p>
I didn't want to figure it out because I had only 10 cases and decided just to edit manually it and try to upload and it worked:

  1. Edit note, just add any symbol. Sync. Ok. Error goes away.
  2. Remove our extra symbol. Sync. Ok. There is no error for this notes still.