mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
update: update api
This commit is contained in:
@@ -359,7 +359,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 261;
|
CURRENT_PROJECT_VERSION = 262;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||||
@@ -367,7 +367,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.261;
|
MARKETING_VERSION = 1.0.262;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
@@ -490,7 +490,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 261;
|
CURRENT_PROJECT_VERSION = 262;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||||
@@ -498,7 +498,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.261;
|
MARKETING_VERSION = 1.0.262;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
@@ -515,7 +515,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 261;
|
CURRENT_PROJECT_VERSION = 262;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
|
||||||
@@ -523,7 +523,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.261;
|
MARKETING_VERSION = 1.0.262;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:r_upgrade/r_upgrade.dart';
|
import 'package:r_upgrade/r_upgrade.dart';
|
||||||
|
|
||||||
import '../data/model/app/update.dart';
|
|
||||||
import '../data/provider/app.dart';
|
import '../data/provider/app.dart';
|
||||||
import '../data/res/build_data.dart';
|
import '../data/res/build_data.dart';
|
||||||
import '../data/service/app.dart';
|
import '../data/service/app.dart';
|
||||||
@@ -27,16 +26,11 @@ Future<bool> isFileAvailable(String url) async {
|
|||||||
Future<void> doUpdate(BuildContext context, {bool force = false}) async {
|
Future<void> doUpdate(BuildContext context, {bool force = false}) async {
|
||||||
final update = await locator<AppService>().getUpdate();
|
final update = await locator<AppService>().getUpdate();
|
||||||
|
|
||||||
final newest = () {
|
final newest = update.build.last.current;
|
||||||
if (isAndroid) {
|
if (newest == null) {
|
||||||
return update.androidbuild;
|
_logger.warning('Update not available on $platform');
|
||||||
} else if (isIOS) {
|
return;
|
||||||
return update.iosbuild;
|
}
|
||||||
} else if (isMacOS) {
|
|
||||||
return update.macbuild;
|
|
||||||
}
|
|
||||||
return update.newest;
|
|
||||||
}();
|
|
||||||
|
|
||||||
locator<AppProvider>().setNewestBuild(newest);
|
locator<AppProvider>().setNewestBuild(newest);
|
||||||
|
|
||||||
@@ -47,21 +41,23 @@ Future<void> doUpdate(BuildContext context, {bool force = false}) async {
|
|||||||
}
|
}
|
||||||
_logger.info('Update available: $newest');
|
_logger.info('Update available: $newest');
|
||||||
|
|
||||||
if (isAndroid && !await isFileAvailable(update.android)) {
|
final url = update.url.current!;
|
||||||
|
|
||||||
|
if (isAndroid && !await isFileAvailable(url)) {
|
||||||
_logger.warning('Android update file not available');
|
_logger.warning('Android update file not available');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final s = S.of(context)!;
|
final s = S.of(context)!;
|
||||||
|
|
||||||
if (update.min > BuildData.build) {
|
if (update.build.min.current! > BuildData.build) {
|
||||||
showRoundDialog(
|
showRoundDialog(
|
||||||
context,
|
context,
|
||||||
s.attention,
|
s.attention,
|
||||||
Text(s.updateTipTooLow(newest)),
|
Text(s.updateTipTooLow(newest)),
|
||||||
[
|
[
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => _doUpdate(update, context, s),
|
onPressed: () => _doUpdate(url, context, s),
|
||||||
child: Text(s.ok),
|
child: Text(s.ok),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@@ -73,15 +69,15 @@ Future<void> doUpdate(BuildContext context, {bool force = false}) async {
|
|||||||
context,
|
context,
|
||||||
'${s.updateTip(newest)} \n${update.changelog}',
|
'${s.updateTip(newest)} \n${update.changelog}',
|
||||||
s.update,
|
s.update,
|
||||||
() => _doUpdate(update, context, s),
|
() => _doUpdate(url, context, s),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _doUpdate(AppUpdate update, BuildContext context, S s) async {
|
Future<void> _doUpdate(String url, BuildContext context, S s) async {
|
||||||
if (isAndroid) {
|
if (isAndroid) {
|
||||||
await RUpgrade.upgrade(
|
await RUpgrade.upgrade(
|
||||||
update.android,
|
url,
|
||||||
fileName: update.android.split('/').last,
|
fileName: url.split('/').last,
|
||||||
isAutoRequestInstall: true,
|
isAutoRequestInstall: true,
|
||||||
);
|
);
|
||||||
} else if (isIOS) {
|
} else if (isIOS) {
|
||||||
|
|||||||
@@ -1,54 +1,123 @@
|
|||||||
///
|
|
||||||
/// Code generated by jsonToDartModel https://ashamp.github.io/jsonToDartModel/
|
|
||||||
///
|
|
||||||
class AppUpdate {
|
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
"newest": 33,
|
"changelog": {
|
||||||
"android": "https://v2.custed.lolli.tech/res/tiku/apk/33.apk",
|
"mac": "xxx",
|
||||||
"ios": "https://",
|
"ios": "xxx",
|
||||||
"min": 30,
|
"android": ""
|
||||||
"changelog": ""
|
},
|
||||||
}
|
"build": {
|
||||||
|
"min": {
|
||||||
|
"mac": 1,
|
||||||
|
"ios": 1,
|
||||||
|
"android": 1
|
||||||
|
},
|
||||||
|
"last": {
|
||||||
|
"mac": 1,
|
||||||
|
"ios": 1,
|
||||||
|
"android": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"mac": "https://apps.apple.com/app/id1586449703",
|
||||||
|
"ios": "https://apps.apple.com/app/id1586449703",
|
||||||
|
"android": "https://cdn3.cust.app/uploads/ServerBox_262_Arm64.apk"
|
||||||
|
}
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
late int newest;
|
import 'dart:convert';
|
||||||
late int iosbuild;
|
|
||||||
late int androidbuild;
|
|
||||||
late int macbuild;
|
|
||||||
late String android;
|
|
||||||
late String ios;
|
|
||||||
late String mac;
|
|
||||||
late int min;
|
|
||||||
late String changelog;
|
|
||||||
|
|
||||||
AppUpdate({
|
import '/core/utils/platform.dart';
|
||||||
required this.newest,
|
|
||||||
required this.android,
|
class AppUpdate {
|
||||||
required this.ios,
|
AppUpdate({
|
||||||
required this.min,
|
required this.changelog,
|
||||||
required this.changelog,
|
required this.build,
|
||||||
});
|
required this.url,
|
||||||
AppUpdate.fromJson(Map<String, dynamic> json) {
|
});
|
||||||
newest = json["newest"]?.toInt();
|
|
||||||
macbuild = json["macbuild"]?.toInt();
|
final AppUpdatePlatformSpecific<String> changelog;
|
||||||
iosbuild = json["iosbuild"]?.toInt();
|
final Build build;
|
||||||
androidbuild = json["androidbuild"]?.toInt();
|
final AppUpdatePlatformSpecific<String> url;
|
||||||
android = json["android"].toString();
|
|
||||||
ios = json["ios"].toString();
|
factory AppUpdate.fromRawJson(String str) => AppUpdate.fromJson(json.decode(str));
|
||||||
min = json["min"].toInt();
|
|
||||||
changelog = json["changelog"].toString();
|
String toRawJson() => json.encode(toJson());
|
||||||
}
|
|
||||||
Map<String, dynamic> toJson() {
|
factory AppUpdate.fromJson(Map<String, dynamic> json) => AppUpdate(
|
||||||
final Map<String, dynamic> data = <String, dynamic>{};
|
changelog: AppUpdatePlatformSpecific.fromJson(json["changelog"]),
|
||||||
data["newest"] = newest;
|
build: Build.fromJson(json["build"]),
|
||||||
data["macbuild"] = macbuild;
|
url: AppUpdatePlatformSpecific.fromJson(json["url"]),
|
||||||
data["iosbuild"] = iosbuild;
|
);
|
||||||
data["androidbuild"] = androidbuild;
|
|
||||||
data["android"] = android;
|
Map<String, dynamic> toJson() => {
|
||||||
data["ios"] = ios;
|
"changelog": changelog.toJson(),
|
||||||
data["min"] = min;
|
"build": build.toJson(),
|
||||||
data["changelog"] = changelog;
|
"url": url.toJson(),
|
||||||
return data;
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Build {
|
||||||
|
Build({
|
||||||
|
required this.min,
|
||||||
|
required this.last,
|
||||||
|
});
|
||||||
|
|
||||||
|
final AppUpdatePlatformSpecific<int> min;
|
||||||
|
final AppUpdatePlatformSpecific<int> last;
|
||||||
|
|
||||||
|
factory Build.fromRawJson(String str) => Build.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String toRawJson() => json.encode(toJson());
|
||||||
|
|
||||||
|
factory Build.fromJson(Map<String, dynamic> json) => Build(
|
||||||
|
min: AppUpdatePlatformSpecific.fromJson(json["min"]),
|
||||||
|
last: AppUpdatePlatformSpecific.fromJson(json["last"]),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"min": min.toJson(),
|
||||||
|
"last": last.toJson(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
class AppUpdatePlatformSpecific<T> {
|
||||||
|
AppUpdatePlatformSpecific({
|
||||||
|
required this.mac,
|
||||||
|
required this.ios,
|
||||||
|
required this.android,
|
||||||
|
});
|
||||||
|
|
||||||
|
final T mac;
|
||||||
|
final T ios;
|
||||||
|
final T android;
|
||||||
|
|
||||||
|
factory AppUpdatePlatformSpecific.fromRawJson(String str) => AppUpdatePlatformSpecific.fromJson(json.decode(str));
|
||||||
|
|
||||||
|
String toRawJson() => json.encode(toJson());
|
||||||
|
|
||||||
|
factory AppUpdatePlatformSpecific.fromJson(Map<String, dynamic> json) => AppUpdatePlatformSpecific(
|
||||||
|
mac: json["mac"],
|
||||||
|
ios: json["ios"],
|
||||||
|
android: json["android"],
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() => {
|
||||||
|
"mac": mac,
|
||||||
|
"ios": ios,
|
||||||
|
"android": android,
|
||||||
|
};
|
||||||
|
|
||||||
|
T? get current {
|
||||||
|
switch (platform) {
|
||||||
|
case PlatformType.macos:
|
||||||
|
return mac;
|
||||||
|
case PlatformType.ios:
|
||||||
|
return ios;
|
||||||
|
case PlatformType.android:
|
||||||
|
return android;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
class BuildData {
|
class BuildData {
|
||||||
static const String name = "ServerBox";
|
static const String name = "ServerBox";
|
||||||
static const int build = 261;
|
static const int build = 262;
|
||||||
static const String engine = "Flutter 3.7.11 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision f72efea43c (5 days ago) • 2023-04-11 11:57:21 -0700\nEngine • revision 1a65d409c7\nTools • Dart 2.19.6 • DevTools 2.20.1\n";
|
static const String engine = "3.7.11";
|
||||||
static const String buildAt = "2023-04-17 13:09:32.878040";
|
static const String buildAt = "2023-04-17 18:13:48.223240";
|
||||||
static const int modifications = 5;
|
static const int modifications = 4;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
const backendUrl = 'https://res.lolli.tech';
|
const backendUrl = 'https://res.lolli.tech';
|
||||||
const baseUrl = '$backendUrl/toolbox';
|
const baseUrl = '$backendUrl/serverbox';
|
||||||
const joinQQGroupUrl = 'https://jq.qq.com/?_wv=1027&k=G0hUmPAq';
|
const joinQQGroupUrl = 'https://jq.qq.com/?_wv=1027&k=G0hUmPAq';
|
||||||
const myGithub = 'https://github.com/lollipopkit';
|
const myGithub = 'https://github.com/lollipopkit';
|
||||||
const issueUrl = '$myGithub/flutter_server_box/issues';
|
const issueUrl = '$myGithub/flutter_server_box/issues';
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'package:xterm/core.dart';
|
|||||||
|
|
||||||
import '../model/ssh/virtual_key.dart';
|
import '../model/ssh/virtual_key.dart';
|
||||||
|
|
||||||
var virtualKeys = [
|
final virtualKeys = [
|
||||||
VirtualKey('Esc', key: TerminalKey.escape),
|
VirtualKey('Esc', key: TerminalKey.escape),
|
||||||
VirtualKey('Alt', key: TerminalKey.alt, toggleable: true),
|
VirtualKey('Alt', key: TerminalKey.alt, toggleable: true),
|
||||||
VirtualKey('Home', key: TerminalKey.home),
|
VirtualKey('Home', key: TerminalKey.home),
|
||||||
|
|||||||
Reference in New Issue
Block a user