-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from Muska-Ami/dev
添加高级启动功能 #1
- Loading branch information
Showing
13 changed files
with
398 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:dio/dio.dart'; | ||
import 'package:nyalcf/dio/basicConfig.dart'; | ||
|
||
class ProxiesConfigurationDio { | ||
final dio = Dio(); | ||
|
||
Future<dynamic> get(String frp_token, int proxy_id) async { | ||
try { | ||
Map<String, dynamic> params_map = Map(); | ||
params_map['action'] = 'getcfg'; | ||
params_map['token'] = frp_token; | ||
params_map['id'] = proxy_id; | ||
|
||
final res = await dio.get('${basicConfig.frpc_config_url}', | ||
queryParameters: params_map); | ||
try { | ||
final Map<String, dynamic> resData = jsonDecode(res.data); | ||
print(res); | ||
if (resData['success']) { | ||
return resData['cfg'].replaceAll('\\n', ''' | ||
'''); | ||
} else { | ||
return null; | ||
} | ||
} catch (ie) { | ||
print(ie); | ||
return null; | ||
} | ||
} catch (e) { | ||
return e; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:nyalcf/util/FileIO.dart'; | ||
|
||
class FrpcConfigurationStorage { | ||
static var _path = FileIO.support_path; | ||
/// 配置文件目录路径 | ||
static get _configDir async { | ||
final dir = Directory('${await _path}/frpc/.confini'); | ||
if (!await dir.exists()) | ||
await dir.create(); | ||
return '${await _path}/frpc/.confini'; | ||
} | ||
/// 配置文件路径 | ||
static _configPath(int proxy_id) async => | ||
'${await _configDir}/${proxy_id}.ini'; | ||
/// 设置配置文件 | ||
static setConfig(int proxy_id, String ini) async { | ||
final String cp = await _configPath(proxy_id); | ||
final f = File(cp); | ||
if (!(await f.exists())) f.create(); | ||
f.writeAsString(ini); | ||
} | ||
/// 获取配置文件路径 | ||
static Future<String?> getConfigPath(int proxy_id) async { | ||
final String cp = await _configPath(proxy_id); | ||
if (await File(cp).exists()) | ||
return cp; | ||
else | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.