mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
Merge branch 'dev' of https://github.com/qinglong-app/qinglong_app into dev
This commit is contained in:
@@ -29,7 +29,7 @@ class Api {
|
||||
String id,
|
||||
String secret,
|
||||
) async {
|
||||
return await Http.post<LoginBean>(
|
||||
return await Http.get<LoginBean>(
|
||||
Url.loginByClientId,
|
||||
{
|
||||
"client_id": id,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:qinglong_app/base/http/url.dart';
|
||||
import 'package:qinglong_app/main.dart';
|
||||
|
||||
import '../userinfo_viewmodel.dart';
|
||||
@@ -15,8 +16,10 @@ class TokenInterceptor extends Interceptor {
|
||||
options.headers["User-Agent"] =
|
||||
"Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1";
|
||||
options.headers["Content-Type"] = "application/json;charset=UTF-8";
|
||||
options.queryParameters["t"] =
|
||||
(DateTime.now().millisecondsSinceEpoch ~/ 1000).toString();
|
||||
if (options.path != Url.loginByClientId) {
|
||||
options.queryParameters["t"] =
|
||||
(DateTime.now().millisecondsSinceEpoch ~/ 1000).toString();
|
||||
}
|
||||
return handler.next(options);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ class Url {
|
||||
static const loginByClientId = "/open/auth/token";
|
||||
static const user = "/api/user";
|
||||
|
||||
static get tasks => getIt<UserInfoViewModel>().useSecretLogined ? "/open/user/login" : "/api/crons";
|
||||
static get tasks => getIt<UserInfoViewModel>().useSecretLogined ? "/open/crons" : "/api/crons";
|
||||
|
||||
static get runTasks => getIt<UserInfoViewModel>().useSecretLogined ? "/open/crons/run" : "/api/crons/run";
|
||||
|
||||
|
||||
@@ -49,12 +49,12 @@ class Routes {
|
||||
return CupertinoPageRoute(builder: (context) => const AddTaskPage());
|
||||
}
|
||||
case routeAddDependency:
|
||||
return CupertinoPageRoute(builder: (context) => const AddDependenyPage());
|
||||
return CupertinoPageRoute(builder: (context) => const AddDependencyPage());
|
||||
case routeAddEnv:
|
||||
if (settings.arguments != null) {
|
||||
return CupertinoPageRoute(
|
||||
builder: (context) => AddEnvPage(
|
||||
taskBean: settings.arguments as EnvBean,
|
||||
envBean: settings.arguments as EnvBean,
|
||||
));
|
||||
} else {
|
||||
return CupertinoPageRoute(builder: (context) => const AddEnvPage());
|
||||
|
||||
@@ -13,8 +13,10 @@ class UserInfoViewModel {
|
||||
String userInfoJson = SpUtil.getString(spUserInfo);
|
||||
_userName = SpUtil.getString(spUserName);
|
||||
_passWord = SpUtil.getString(spPassWord);
|
||||
|
||||
_useSecertLogined = SpUtil.getBool(spSecretLogined, defValue: false);
|
||||
_host = SpUtil.getString(spHost, defValue: 'http://49.234.59.95:5700');
|
||||
_host = SpUtil.getString(spHost, defValue: '');
|
||||
|
||||
if (userInfoJson.isNotEmpty) {
|
||||
_token = userInfoJson;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user