mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.: pve
This commit is contained in:
@@ -40,7 +40,7 @@ final class PveProvider extends ChangeNotifier {
|
|||||||
final err = ValueNotifier<String?>(null);
|
final err = ValueNotifier<String?>(null);
|
||||||
final connected = Completer<void>();
|
final connected = Completer<void>();
|
||||||
|
|
||||||
late bool _ignoreCert = spi.custom?.pveIgnoreCert ?? false;
|
late final _ignoreCert = spi.custom?.pveIgnoreCert ?? false;
|
||||||
late final session = Dio()
|
late final session = Dio()
|
||||||
..httpClientAdapter = IOHttpClientAdapter(
|
..httpClientAdapter = IOHttpClientAdapter(
|
||||||
createHttpClient: () {
|
createHttpClient: () {
|
||||||
@@ -64,11 +64,11 @@ final class PveProvider extends ChangeNotifier {
|
|||||||
try {
|
try {
|
||||||
await _forward();
|
await _forward();
|
||||||
await _login();
|
await _login();
|
||||||
await _release;
|
await _getRelease();
|
||||||
} on PveErr {
|
} on PveErr {
|
||||||
err.value = l10n.pveLoginFailed;
|
err.value = l10n.pveLoginFailed;
|
||||||
} catch (e) {
|
} catch (e, s) {
|
||||||
Loggers.app.warning('PVE init failed', e);
|
Loggers.app.warning('PVE init failed', e, s);
|
||||||
err.value = e.toString();
|
err.value = e.toString();
|
||||||
} finally {
|
} finally {
|
||||||
connected.complete();
|
connected.complete();
|
||||||
@@ -89,7 +89,7 @@ final class PveProvider extends ChangeNotifier {
|
|||||||
final newUrl = Uri.parse(addr)
|
final newUrl = Uri.parse(addr)
|
||||||
.replace(host: 'localhost', port: _localPort)
|
.replace(host: 'localhost', port: _localPort)
|
||||||
.toString();
|
.toString();
|
||||||
print('Forwarding $newUrl to $addr');
|
debugPrint('Forwarding $newUrl to $addr');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +113,8 @@ final class PveProvider extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _login() async {
|
Future<void> _login() async {
|
||||||
final resp = await session.post('$addr/api2/extjs/access/ticket',
|
final resp = await session.post(
|
||||||
|
'$addr/api2/extjs/access/ticket',
|
||||||
data: {
|
data: {
|
||||||
'username': spi.user,
|
'username': spi.user,
|
||||||
'password': spi.pwd,
|
'password': spi.pwd,
|
||||||
@@ -121,7 +122,9 @@ final class PveProvider extends ChangeNotifier {
|
|||||||
'new-format': '1'
|
'new-format': '1'
|
||||||
},
|
},
|
||||||
options: Options(
|
options: Options(
|
||||||
headers: {HttpHeaders.contentTypeHeader: Headers.jsonContentType}));
|
headers: {HttpHeaders.contentTypeHeader: Headers.jsonContentType},
|
||||||
|
),
|
||||||
|
);
|
||||||
try {
|
try {
|
||||||
final ticket = resp.data['data']['ticket'];
|
final ticket = resp.data['data']['ticket'];
|
||||||
session.options.headers['CSRFPreventionToken'] =
|
session.options.headers['CSRFPreventionToken'] =
|
||||||
@@ -133,7 +136,7 @@ final class PveProvider extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if the PVE version is 8.0 or later
|
/// Returns true if the PVE version is 8.0 or later
|
||||||
Future<void> get _release async {
|
Future<void> _getRelease() async {
|
||||||
final resp = await session.get('$addr/api2/extjs/version');
|
final resp = await session.get('$addr/api2/extjs/version');
|
||||||
final version = resp.data['data']['release'] as String?;
|
final version = resp.data['data']['release'] as String?;
|
||||||
if (version != null) {
|
if (version != null) {
|
||||||
|
|||||||
@@ -403,15 +403,27 @@ class _ServerEditPageState extends State<ServerEditPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> _buildPVEs() {
|
List<Widget> _buildPVEs() {
|
||||||
|
const addr = 'https://127.0.0.1:8006';
|
||||||
return [
|
return [
|
||||||
const Text('PVE', style: UIs.text13Grey),
|
const Text('PVE', style: UIs.text13Grey),
|
||||||
UIs.height7,
|
UIs.height7,
|
||||||
Input(
|
Autocomplete<String>(
|
||||||
controller: _pveAddrCtrl,
|
optionsBuilder: (val) {
|
||||||
|
final v = val.text;
|
||||||
|
if (v.startsWith(addr.substring(0, v.length))) {
|
||||||
|
return [addr];
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
},
|
||||||
|
onSelected: (val) => _pveAddrCtrl.text = val,
|
||||||
|
fieldViewBuilder: (_, ctrl, node, __) => Input(
|
||||||
|
controller: ctrl,
|
||||||
type: TextInputType.url,
|
type: TextInputType.url,
|
||||||
icon: MingCute.web_line,
|
icon: MingCute.web_line,
|
||||||
|
node: node,
|
||||||
label: l10n.addr,
|
label: l10n.addr,
|
||||||
hint: 'https://example.com:8006',
|
hint: addr,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Padding(
|
leading: const Padding(
|
||||||
|
|||||||
60
pubspec.lock
60
pubspec.lock
@@ -45,10 +45,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: archive
|
name: archive
|
||||||
sha256: ecf4273855368121b1caed0d10d4513c7241dfc813f7d3c8933b36622ae9b265
|
sha256: "6bd38d335f0954f5fad9c79e614604fbf03a0e5b975923dd001b6ea965ef5b4b"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.5.1"
|
version: "3.6.0"
|
||||||
args:
|
args:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -101,10 +101,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: build_daemon
|
name: build_daemon
|
||||||
sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1"
|
sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.1"
|
version: "4.0.2"
|
||||||
build_resolvers:
|
build_resolvers:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -117,10 +117,10 @@ packages:
|
|||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: build_runner
|
name: build_runner
|
||||||
sha256: "3ac61a79bfb6f6cc11f693591063a7f19a7af628dc52f141743edac5c16e8c22"
|
sha256: "1414d6d733a85d8ad2f1dfcb3ea7945759e35a123cb99ccfac75d0758f75edfa"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.9"
|
version: "2.4.10"
|
||||||
build_runner_core:
|
build_runner_core:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -231,10 +231,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: countly_flutter
|
name: countly_flutter
|
||||||
sha256: "829853407896350bdb4881ddc92326cf87b8d70ad92a78c4775cd05666d5a965"
|
sha256: "366f0c7769b998a06579235b0afd3797bc0bc7c8ce80bb673fca59c217f66012"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "24.4.0"
|
version: "24.4.1"
|
||||||
cross_file:
|
cross_file:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -392,8 +392,8 @@ packages:
|
|||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: "8e1e3500fac2a39a43bed68aeb3cbdf792a1bd35"
|
ref: "v1.0.11"
|
||||||
resolved-ref: "8e1e3500fac2a39a43bed68aeb3cbdf792a1bd35"
|
resolved-ref: ead58f6e985600c03cd27fb6563c10b6afa2d640
|
||||||
url: "https://github.com/lollipopkit/fl_build.git"
|
url: "https://github.com/lollipopkit/fl_build.git"
|
||||||
source: git
|
source: git
|
||||||
version: "1.0.0"
|
version: "1.0.0"
|
||||||
@@ -409,8 +409,8 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: main
|
ref: "v1.0.24"
|
||||||
resolved-ref: "4a3ac8cec9b39a08790101e45ff80a42c6dfd36a"
|
resolved-ref: "3c95d07aa27446f1c05baf8fa02bd2e7392f52d0"
|
||||||
url: "https://github.com/lollipopkit/fl_lib"
|
url: "https://github.com/lollipopkit/fl_lib"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
@@ -500,10 +500,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: flutter_markdown_latex
|
name: flutter_markdown_latex
|
||||||
sha256: b07ade84e661a7a2e7b7e59bcfa95e481d38fd8782a8f9f2349a8cb1b056ae89
|
sha256: "6902b6774800fd5d7b594fa2080781586f1b851f0964d41bb7fd28c61e3ef2a7"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.3.2"
|
version: "0.3.3"
|
||||||
flutter_math_fork:
|
flutter_math_fork:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -670,10 +670,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: image
|
name: image
|
||||||
sha256: "4c68bfd5ae83e700b5204c1e74451e7bf3cf750e6843c6e158289cf56bda018e"
|
sha256: "2237616a36c0d69aef7549ab439b833fb7f9fb9fc861af2cc9ac3eedddd69ca8"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.1.7"
|
version: "4.2.0"
|
||||||
intl:
|
intl:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -766,10 +766,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: local_auth_darwin
|
name: local_auth_darwin
|
||||||
sha256: "959145a4cf6f0de745b9ec9ac60101270eb4c5b8b7c2a0470907014adc1c618d"
|
sha256: e424ebf90d5233452be146d4a7da4bcd7a70278b67791592f3fde1bda8eef9e2
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0"
|
version: "1.3.1"
|
||||||
local_auth_platform_interface:
|
local_auth_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -1166,10 +1166,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shelf_web_socket
|
name: shelf_web_socket
|
||||||
sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1"
|
sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
version: "2.0.0"
|
||||||
shortid:
|
shortid:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -1307,10 +1307,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: url_launcher_android
|
name: url_launcher_android
|
||||||
sha256: "360a6ed2027f18b73c8d98e159dda67a61b7f2e0f6ec26e86c3ada33b0621775"
|
sha256: "17cd5e205ea615e2c6ea7a77323a11712dffa0720a8a90540db57a01347f9ad9"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.3.1"
|
version: "6.3.2"
|
||||||
url_launcher_ios:
|
url_launcher_ios:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -1463,14 +1463,22 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.5.1"
|
version: "0.5.1"
|
||||||
|
web_socket:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: web_socket
|
||||||
|
sha256: "217f49b5213796cb508d6a942a5dc604ce1cb6a0a6b3d8cb3f0c314f0ecea712"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.4"
|
||||||
web_socket_channel:
|
web_socket_channel:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: web_socket_channel
|
name: web_socket_channel
|
||||||
sha256: "58c6666b342a38816b2e7e50ed0f1e261959630becd4c879c4f26bfa14aa5a42"
|
sha256: a2d56211ee4d35d9b344d9d4ce60f362e4f5d1aafb988302906bd732bc731276
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.5"
|
version: "3.0.0"
|
||||||
webdav_client:
|
webdav_client:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -1484,10 +1492,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: win32
|
name: win32
|
||||||
sha256: "0eaf06e3446824099858367950a813472af675116bf63f008a4c2a75ae13e9cb"
|
sha256: a79dbe579cb51ecd6d30b17e0cae4e0ea15e2c0e66f69ad4198f22a6789e94f4
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "5.5.0"
|
version: "5.5.1"
|
||||||
win32_registry:
|
win32_registry:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ dependencies:
|
|||||||
fl_lib:
|
fl_lib:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/lollipopkit/fl_lib
|
url: https://github.com/lollipopkit/fl_lib
|
||||||
ref: main
|
ref: v1.0.24
|
||||||
device_info_plus: ^10.1.0
|
device_info_plus: ^10.1.0
|
||||||
|
|
||||||
dependency_overrides:
|
dependency_overrides:
|
||||||
@@ -74,7 +74,7 @@ dev_dependencies:
|
|||||||
# path: ../fl_build
|
# path: ../fl_build
|
||||||
git:
|
git:
|
||||||
url: https://github.com/lollipopkit/fl_build.git
|
url: https://github.com/lollipopkit/fl_build.git
|
||||||
ref: 8e1e3500fac2a39a43bed68aeb3cbdf792a1bd35
|
ref: v1.0.11
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
generate: true
|
generate: true
|
||||||
|
|||||||
Reference in New Issue
Block a user