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:
- I have full local db in PC (by old linux WizNote client)
- I ran my private server by docker
- I created in private server the same account (in its web client)
- 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
- I moved my local db let's say ~/.wiznote/username to another directory
- Logged in WizNotePlus
- But I had empty db
- I tried to replace new files in ~/.wiznote/username by old ones but it didn't work
- I opened ~/.wiznote/username/data/index.db and cleaned up all mentions of official server in WIZ_META table
- 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.
- But I kept digging source code and found that flag of new note is field WIZ_VERSION=-1 in WIZ_DOCUMENT
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:
- Are attachments uploaded to the server?
- Are resources (images etc.) of documents uploaded to the server?
- Are document params (used by calendar etc.) uploaded to the srver?
- 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:
- Install the latest WizNotePlus.
- Login to official Wiz server
- In Preferences->Sync select download everything/all (notes, attachements).
- Start sync
- Logout from WizNotePlus
- 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 - Install private server (docker etc)
- Signup in private server (I used the same account name as for official server)
- Login to WizNotePlus with new account for private server
- Start sync. Be sure that you are still with full sync.
- 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 - Logout from WizNotePlus, remove local wiznote DB
rm ~/.wiznote
- Login to WizNotePlus. Now it pushes and pulls updates.
- 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:
- Edit note, just add any symbol. Sync. Ok. Error goes away.
- Remove our extra symbol. Sync. Ok. There is no error for this notes still.