-
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.
Frpc download mirror selector, request API to cancel token now when l…
…ogout
- Loading branch information
Showing
50 changed files
with
402 additions
and
254 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
File renamed without changes.
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 |
---|---|---|
|
@@ -48,5 +48,4 @@ class Config implements CommandImplement { | |
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
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,14 @@ | ||
import 'package:nyalcf/templates/command_implement.dart'; | ||
import 'package:nyalcf_core/storages/stores/user_info_storage.dart'; | ||
import 'package:nyalcf_core/utils/logger.dart'; | ||
|
||
class Logout implements CommandImplement { | ||
@override | ||
Future<void> main(List<String> args) async { | ||
final userInfo = await UserInfoStorage.read(); | ||
await UserInfoStorage.sigo(userInfo?.user, userInfo?.token); | ||
|
||
Logger.info('Session data removed.'); | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
abstract class CommandImplement { | ||
/// 入口函数 | ||
void main(List<String> args); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -12,4 +12,4 @@ class ProcessModel { | |
String toString() { | ||
return '[$proxyId] PID: ${process.pid}'; | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
library auth; | ||
|
||
export 'login_auth.dart'; | ||
export 'logout_auth.dart'; | ||
export 'register_auth.dart'; | ||
export 'user_auth.dart'; |
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,54 @@ | ||
import 'package:dio/dio.dart' as dio; | ||
|
||
import 'package:nyalcf_core/network/dio/basic_config.dart'; | ||
import 'package:nyalcf_core/network/response_type.dart'; | ||
import 'package:nyalcf_core/utils/logger.dart'; | ||
|
||
class LogoutAuth { | ||
static final instance = dio.Dio(options); | ||
|
||
static Future<Response> requestLogout(user, token) async { | ||
Map<String, dynamic> paramsMap = {}; | ||
paramsMap['username'] = user; | ||
|
||
Map<String, dynamic> optionsMap = {}; | ||
optionsMap['Content-Type'] = | ||
'application/x-www-form-urlencoded;charset=UTF-8'; | ||
optionsMap['Authorization'] = 'Bearer $token'; | ||
options = options.copyWith(headers: optionsMap); | ||
|
||
try { | ||
Logger.debug('Logout: $user / $token'); | ||
final response = await instance.delete('$apiV2Url/users/reset/token/single', queryParameters: paramsMap); | ||
Map<String, dynamic> responseJson = response.data; | ||
Logger.debug(responseJson); | ||
final resData = responseJson['data']; | ||
if (responseJson['status'] == 200) { | ||
return Response( | ||
status: true, | ||
message: 'OK', | ||
data: { | ||
'origin_response': resData, | ||
}, | ||
); | ||
} else { | ||
return Response( | ||
status: false, | ||
message: resData['msg'] ?? responseJson['status'], | ||
data: { | ||
'origin_response': resData, | ||
}, | ||
); | ||
} | ||
} catch (ex, st) { | ||
Logger.error(ex, t: st); | ||
return Response( | ||
status: false, | ||
message: ex.toString(), | ||
data: { | ||
'error': ex, | ||
}, | ||
); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.