Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions frpc.ini
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[common]
server_addr = jp.4.frp.one
server_addr = hn.frp.one
server_port = 7000
tcp_mux = true
protocol = tcp
user = 2foFmw0KADGpHuolVOaOQrcH
token = ChmlFrpToken
dns_server = 223.6.6.6
tls_enable = false
[https]
[taila]
privilege_mode = true
type = https
type = tcp
local_ip = 127.0.0.1
local_port = 8000
custom_domains = qwqzy.de5.net
local_port = 7777
remote_port = 47758
use_encryption = false
use_compression = false

2 changes: 1 addition & 1 deletion lib/pages/dashboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ class _DashboardPageState extends State<DashboardPage> {
children: [
const SizedBox(height: 8),
_buildSystemInfoItem('操作系统', 'Windows'),
_buildSystemInfoItem('应用版本', '1.3.2'),
_buildSystemInfoItem('应用版本', '1.4.1'),
_buildSystemInfoItem('API版本', 'v2'),
_buildSystemInfoItem('SDK版本', 'ChmlFrp.SDK'),
],
Expand Down
49 changes: 1 addition & 48 deletions lib/pages/main_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ class _MainPageState extends State<MainPage> with SingleTickerProviderStateMixin
_isSidebarExpanded = !_isSidebarExpanded;
});
},
onLogout: _handleLogout,
),
// 主内容区
Expanded(
Expand All @@ -184,13 +183,7 @@ class _MainPageState extends State<MainPage> with SingleTickerProviderStateMixin
);
}

// 处理登出
Future<void> _handleLogout() async {
await ApiService.logout();
if (mounted) {
Navigator.pushReplacementNamed(context, '/login');
}
}

}

// 侧边栏组件
Expand All @@ -200,7 +193,6 @@ class SidebarWidget extends StatelessWidget {
final List<Map<String, dynamic>> menuItems;
final ValueChanged<int> onMenuItemTap;
final VoidCallback onToggleExpanded;
final VoidCallback onLogout;

const SidebarWidget({
super.key,
Expand All @@ -209,7 +201,6 @@ class SidebarWidget extends StatelessWidget {
required this.menuItems,
required this.onMenuItemTap,
required this.onToggleExpanded,
required this.onLogout,
});

@override
Expand Down Expand Up @@ -317,44 +308,6 @@ class SidebarWidget extends StatelessWidget {
},
),
),
// 底部登出按钮
const Divider(height: 1, color: AppTheme.borderColor),
MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: onLogout,
child: AnimatedContainer(
duration: const Duration(milliseconds: 300),
margin: const EdgeInsets.symmetric(horizontal: 8, vertical: 12),
decoration: BoxDecoration(
color: AppTheme.errorColor.withOpacity(0.05),
borderRadius: BorderRadius.circular(AppTheme.borderRadiusMedium),
border: Border.all(color: AppTheme.errorColor.withOpacity(0.2)),
),
child: Padding(
padding: const EdgeInsets.all(10),
child: Row(
children: [
Icon(Icons.logout, size: 22, color: AppTheme.errorColor),
if (isExpanded)
Padding(
padding: const EdgeInsets.only(left: 12),
child: Text(
'登出',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
color: AppTheme.errorColor,
fontFamily: "HarmonyOS Sans",
),
),
),
],
),
),
),
),
),
],
),
);
Expand Down
67 changes: 66 additions & 1 deletion lib/pages/node_list_page.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import '../models/models.dart';
import '../services/api_service.dart';
import '../widgets/uptime_chart.dart';

class NodeListPage extends StatefulWidget {
const NodeListPage({super.key});
Expand Down Expand Up @@ -123,6 +124,63 @@ class _NodeListPageState extends State<NodeListPage> {
);
}

// 生成节点标签
List<Widget> _generateNodeTags(NodeData node) {
final tags = <Widget>[];

// 节点组标签
if (node.nodegroup == 'user') {
tags.add(_buildTag('免费', Colors.green));
} else if (node.nodegroup == 'vip') {
tags.add(_buildTag('会员', Colors.orange));
}

// 国内限速标签
if (node.china == 'yes') {
tags.add(_buildTag('国内限速', Colors.blue));
} else if (node.china == 'no') {
tags.add(_buildTag('国外限速', Colors.purple));
}

// 建站支持标签
if (node.web == 'yes') {
tags.add(_buildTag('允许建站', Colors.green));
} else if (node.web == 'no') {
tags.add(_buildTag('禁止建站', Colors.red));
}

// UDP支持标签
if (node.udp == 'true') {
tags.add(_buildTag('UDP支持', Colors.green));
} else if (node.udp == 'false') {
tags.add(_buildTag('UDP禁用', Colors.red));
}

return tags;
}

// 构建单个标签
Widget _buildTag(String text, Color color) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
margin: const EdgeInsets.only(right: 6, top: 4),
decoration: BoxDecoration(
color: color.withAlpha(25),
borderRadius: BorderRadius.circular(12),
border: Border.all(color: color, width: 1),
),
child: Text(
text,
style: TextStyle(
color: color,
fontSize: 10,
fontFamily: "HarmonyOS Sans",
fontWeight: FontWeight.w500,
),
),
);
}

@override
Widget build(BuildContext context) {
return Scaffold(
Expand All @@ -147,12 +205,19 @@ class _NodeListPageState extends State<NodeListPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('区域: ${node.area}', style: TextStyle(fontFamily: "HarmonyOS Sans")),
Text('节点组: ${node.nodegroup}', style: TextStyle(fontFamily: "HarmonyOS Sans")),
if (node.notes.isNotEmpty)
Text(
'备注: ${node.notes}',
style: TextStyle(color: Colors.grey.shade600, fontSize: 12, fontFamily: "HarmonyOS Sans"),
),
const SizedBox(height: 8),
UptimeChart(nodeName: node.name),
const SizedBox(height: 4),
Wrap(
spacing: 4,
runSpacing: 4,
children: _generateNodeTags(node),
),
],
),
trailing: const Icon(Icons.arrow_forward_ios),
Expand Down
6 changes: 4 additions & 2 deletions lib/pages/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ class _SettingsPageState extends State<SettingsPage> with SingleTickerProviderSt
),
SettingTile(
title: '关于',
subtitle: 'ChmlFrp Flutter 客户端 v1.3.2',
subtitle: 'ChmlFrp Flutter 客户端 v1.4.1',
onTap: () {
showDialog(
context: context,
Expand Down Expand Up @@ -455,7 +455,9 @@ class _SettingsPageState extends State<SettingsPage> with SingleTickerProviderSt
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: const [
Text('版本:', style: TextStyle(fontFamily: "HarmonyOS Sans",fontSize: 12, fontWeight: FontWeight.w700)),
Text('1.3.2', style: TextStyle(fontFamily: "HarmonyOS Sans")),
Text('1.4.1', style: TextStyle(fontFamily: "HarmonyOS Sans")),


],
),
const SizedBox(height: 8),
Expand Down
2 changes: 1 addition & 1 deletion lib/res/assets_res.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ class AssetsRes {
AssetsRes._();

static const String PROJECT_NAME = 'chmlfrp_flutter';
static const String PROJECT_VERSION = '1.3.2+1';
static const String PROJECT_VERSION = '1.4.1+1';
}
2 changes: 1 addition & 1 deletion lib/res/default_res.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ class DefaultRes {
DefaultRes._();

static const String PROJECT_NAME = 'chmlfrp_flutter';
static const String PROJECT_VERSION = '1.3.2+1';
static const String PROJECT_VERSION = '1.4.1+1';
static const String FLUTTER_ICON = 'flutter_icon.png';
}
2 changes: 1 addition & 1 deletion lib/res/font_res.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class FontRes {
FontRes._();

static const String PROJECT_NAME = 'chmlfrp_flutter';
static const String PROJECT_VERSION = '1.3.2+1';
static const String PROJECT_VERSION = '1.4.1+1';
static const String HARMONYOS_SANS_SC_BLACK = 'HarmonyOS_Sans_SC_Black';
static const String HARMONYOS_SANS_SC_BOLD = 'HarmonyOS_Sans_SC_Bold';
static const String HARMONYOS_SANS_SC_LIGHT = 'HarmonyOS_Sans_SC_Light';
Expand Down
42 changes: 40 additions & 2 deletions lib/services/api_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ class ApiService {
// 获取登录状态文件路径
static Future<File> get _loginStatusFile async {
final directory = Directory(Platform.environment['APPDATA']!);
final chmlFrpDir = Directory('${directory.path}\chmlfrp');
final chmlFrpDir = Directory('${directory.path}/ChmlFrp');
if (!chmlFrpDir.existsSync()) {
chmlFrpDir.createSync();
}
return File('${chmlFrpDir.path}\login_status.json');
return File('${chmlFrpDir.path}/user.json');
}

// 初始化,尝试自动登录
Expand Down Expand Up @@ -80,9 +80,14 @@ class ApiService {
if (params != null) {
uri = uri.replace(queryParameters: params);
}

print('[DEBUG] Making GET request to: $uri');

final response = await http.get(uri);

print('[DEBUG] GET response status code: ${response.statusCode}');
print('[DEBUG] GET response body: ${response.body}');

if (response.statusCode == 200) {
return json.decode(response.body);
}
Expand Down Expand Up @@ -392,6 +397,39 @@ class ApiService {
return null;
}

// 获取节点在线率
static Future<Map<String, dynamic>?> getNodeUptime({
required int time,
String? node,
}) async {
print('[DEBUG] Fetching node uptime data');

// 构建参数
final params = <String, String>{
'time': time.toString(),
};

// 如果提供了节点参数,添加到查询参数中
if (node != null && node.isNotEmpty) {
params['node'] = node;
}

// 使用正确的端点
final endpoint = '$baseUrl/node_uptime';

print('[DEBUG] Getting node uptime with params: $params');

final result = await _getRequest(endpoint, params);

if (result != null) {
print('[DEBUG] Node uptime response: $result');
return result;
}

print('[DEBUG] Failed to get node uptime data');
return null;
}

// MARK: - 签到相关

// 用户签到
Expand Down
Loading