renzholy / mongood

A MongoDB GUI with Fluent Design
GNU Affero General Public License v3.0
745 stars 58 forks source link

Client webview support on machine without chrome installed #72

Closed genshen closed 4 years ago

genshen commented 4 years ago

Hi @RenzHoly, in this change (737e5dc8701c1dbd8f7a69fcf7d5848aeadc15e9), I noticed you have switched client render from wails to lorca.
But it can be a big challenge to use client application for the one who does not have Chrome installed.
(Indeed, Chrome is a large dependency.)
For me, I usually use safari and Microsoft Edge on my Mac (without Chrome installed).
Then it will give me a Fatal error:

./mongood
2020/08/05 10:28:12 /Users/user/Library/Caches/Mongood/Mongood
2020/08/05 10:28:12 fork/exec : no such file or directory

Besides, in the document of lorca, it says:

Also, limitations by design: No control over the Chrome window yet (e.g. you can't remove border, make it transparent, control position or size).

Users cannot control window position or resize window.

Could we use a compile option or environment variable at go side to pick lorca or wails as client render, so that users like me can still use wails as client render.

renzholy commented 4 years ago

Users cannot control window position or resize window.

The lorca document means you can't control the window programmatically. You can control the window manually after launch.

I stop using wails because I cannot find a way to persist localStorage.

renzholy commented 4 years ago

If we can persist localStorage and IndexedDB (maybe used in the future), I prefer to use wails or serge/webview

genshen commented 4 years ago

It seems lorca is a better approach currently.
Also I found wails can not copy content to clipboard programmatically (e.g via window.navigator.clipboard) when mongood is launched as app.

renzholy commented 4 years ago

yep

genshen commented 4 years ago

I had a simple glance on some webview projects listed in https://github.com/go-graphics/go-gui-projects.
Apart from lorca, perhaps project webview/webview(previous name is vserge/webview) is another alternative package.

For macOS, it use Cocoa/WebKit.
Based on my tests on mac, the data of localstorage and IndexedDB is saved at ~/Library/WebKit/app.mongood.macos/WebsiteData. And it also support clipboard (webview/webview#405).

I didn't perform tests on windows, but it seems more complicated when using webview/webview as render.

In fact, we still need some deeper discussions and tests about what challenges we will meet before deciding to switch to webview/webview.

renzholy commented 4 years ago

If we can persist localStorage and IndexedDB (maybe used in the future), I prefer to use wails or serge/webview

I mentioned serge/webview here. In fact it was my first choice, but I found it is hard to use, harder than wails.

genshen commented 4 years ago

Forgive my poor acknowledge and understanding of the repo history.
Really thank's for your replies, and feel so sorry if my issue bothered you.

renzholy commented 4 years ago

No no no, welcome to every issue and PR

renzholy commented 4 years ago

And forgive my poor English

renzholy commented 4 years ago

I remembered another reason why I abandoned webview/webview: I dont't know how to draw window shadow on macOS, they say:

Use Window() to get native window handle and probably write some Cgo code to adjust native window to your taste.

but I'm a golang beginner and I don't know how to use unsafe.Pointer