]> git.proxmox.com Git - flutter/pve_flutter_frontend.git/blame - README.md
web console: tell noVNC to hide broken fullscreen-button
[flutter/pve_flutter_frontend.git] / README.md
CommitLineData
00a48038
TM
1# pve_flutter_frontend
2
3Frontend for Proxmox Virtual Environment
4
37261111
TL
5# Setup How-To
6
7## Get Flutter
8
9See:
10https://flutter.dev/docs/get-started/install/linux#install-flutter-manually
11
12Make `flutter doctor` as happy as possible. Note you may need to tell it where
13chromium is located, e.g., with `export CHROME_EXECUTABLE=/usr/bin/chromium`
14
15## Get Path-Dependencies
16
17Most dependencies can be served from pub.dev, but the frontend also depends on
18to local path dependencies maintained by Proxmox.
19
20So, in the parent folder clone both, the API client library (pure dart package)
21and the login manager, serving as a base for Proxmox api2 projects.
22
23 cd ..
24 git clone git://git.proxmox.com/git/flutter/proxmox_dart_api_client.git
25 cd proxmox_dart_api_client
26 flutter pub get
27 flutter packages pub run build_runner build --delete-conflicting-outputs
28
29
30 cd ..
31 git clone git://git.proxmox.com/git/flutter/proxmox_login_manager.git
32 cd proxmox_login_manager
33 flutter pub get
34 flutter packages pub run build_runner build --delete-conflicting-outputs
35
36Now you have made the local dependencies and their dependencies available, and
37built the generated (data) model code for each.
38
0ecfc6cf 39# Run the App
37261111 40
0ecfc6cf 41## Linux native
37261111
TL
42
43With the dependencies setup you should cd back into this directory
44(pve_flutter_frontend repository root) and also generate the model code once:
45
46 flutter packages pub run build_runner build --delete-conflicting-outputs
47
48Note: the `--delete-conflicting-outputs` option is normally not required, but
49can come in handy during development trial/error coding.
50
51To actually run it you can do:
52
53 flutter run -d linux
54
0ecfc6cf 55## Build errors
37261111
TL
56
57If there's an error during build use the verbose `-v` flag, to make flutter
58tell you what's actually going on. Quick remedies are then often rebuilding the
59models, build from clean state, upgrade or downgrade flutter to the last known
60working version - as we use latest master we sometimes run actually into bugs.
61Or if you made code changes resulting in an error, well duh, fix those.
62
00a48038
TM
63## Web build infos
64
0ecfc6cf
TL
65You'll need some sort workaround for CORS in order to serve the flutter
66frontend from your local dev machine, which will enable some convenient
67features, like hot reload, automatic builds on changes...
68
69This is required as CORS boundaries are any change in <scheme><addr><port>
70tuples, and chrome will forbid even cross site requests to localhost on a
71different port.
72
73### Disable CORS in chrome/ium
74
75
76Create a small shell script, lets name it `chrome-no-cors.sh`, with the
77following content:
78
79 #!/bin/sh
80 mkdir -p /tmp/chrome || true
9f56e8da 81 /usr/bin/chromium --disable-features=CrossOriginOpenerPolicy,CrossOriginEmbedderPolicy --disable-web-security --user-data-dir="/tmp/chrome" $*
0ecfc6cf
TL
82
83Then `chmod +x chrome-no-cors.sh` it and adapt the CHROME_EXECUTABLE env
84variable:
85
86 export CHROME_EXECUTABLE="$(realpath chrome-no-cors.sh)"
87
88Now you can start the web based build normally:
89
7869e2e8
DM
90$ flutter run -d chrome --web-port=35000
91
92
352ab963
TL
93NOTE: without setting a fixed port flutter uses a random one, as chrome binds
94 certificate expections and local browser storage to a (protocol, host, port)
95 tuple, this means that we'd lose all saved settings etc. every time else
96
0ecfc6cf
TL
97### Use reverse proxy to allow connections to PVE and the App over the same port
98
e259af5c
TM
99Launch App in Chrome:
100$ flutter run -d chrome --web-port 42000
e259af5c
TM
101
102nginx snippets:
103
104location / {
105
106 if ( $query_string ~ "console" ) {
107 proxy_pass https://<clusterip>:8006;
108 }
109 proxy_pass http://127.0.0.1:42000;
110 proxy_read_timeout 24h;
111 proxy_http_version 1.1;
112 proxy_set_header Connection "";
113 proxy_buffering off;
114
115}
116
117location /xterm {
118 proxy_set_header Host $host;
119 proxy_set_header Cookie $http_cookie;
120 proxy_pass https://<clusterip>:8006;
121}
122
123location /api2 {
124 proxy_set_header Upgrade $http_upgrade;
125 proxy_set_header Connection "Upgrade";
126 proxy_set_header Host $host;
127 proxy_set_header Cookie $http_cookie;
128 proxy_pass https://<clusterip>:8006;
129}
130
0ecfc6cf
TL
131# Misc.
132
e259af5c
TM
133To upgrade the proxmox_api_client dependency execute:
134$ flutter packages upgrade
135
136To build the model classes use:
137$ flutter packages pub run build_runner build
138
139If you want to login without typing your password for your
140Test-Cluster, add this to the main function:
141
0c2b1c5d
TM
142var apiClient = await proxclient.authenticate("root@pam", "yourpassword");
143
144
145## Screenshots Android
146adb shell settings put global sysui_demo_allowed 1