import 'package:qinglong_app/base/userinfo_viewmodel.dart'; import 'package:qinglong_app/main.dart'; class Url { static get login => "/api/user/login"; static get system => "/api/system"; static get loginOld => "/api/login"; static get loginTwo => "/api/user/two-factor/login"; static const loginByClientId = "/open/auth/token"; static const user = "/api/user"; static const updatePassword = "/api/user"; static get tasks => getIt().useSecretLogined ? "/open/crons" : "/api/crons"; static get runTasks => getIt().useSecretLogined ? "/open/crons/run" : "/api/crons/run"; static get stopTasks => getIt().useSecretLogined ? "/open/crons/stop" : "/api/crons/stop"; static get taskDetail => getIt().useSecretLogined ? "/open/crons/" : "/api/crons/"; static get addTask => getIt().useSecretLogined ? "/open/crons" : "/api/crons"; static get pinTask => getIt().useSecretLogined ? "/open/crons/pin" : "/api/crons/pin"; static get unpinTask => getIt().useSecretLogined ? "/open/crons/unpin" : "/api/crons/unpin"; static get enableTask => getIt().useSecretLogined ? "/open/crons/enable" : "/api/crons/enable"; static get disableTask => getIt().useSecretLogined ? "/open/crons/disable" : "/api/crons/disable"; static get files => getIt().useSecretLogined ? "/open/configs/files" : "/api/configs/files"; static get configContent => getIt().useSecretLogined ? "/open/configs/" : "/api/configs/"; static get saveFile => getIt().useSecretLogined ? "/open/configs/save" : "/api/configs/save"; static get envs => getIt().useSecretLogined ? "/open/envs" : "/api/envs"; static get addEnv => getIt().useSecretLogined ? "/open/envs" : "/api/envs"; static get delEnv => getIt().useSecretLogined ? "/open/envs" : "/api/envs"; static get disableEnvs => getIt().useSecretLogined ? "/open/envs/disable" : "/api/envs/disable"; static get enableEnvs => getIt().useSecretLogined ? "/open/envs/enable" : "/api/envs/enable"; static get loginLog => getIt().useSecretLogined ? "/open/user/login-log" : "/api/user/login-log"; static get taskLog => getIt().useSecretLogined ? "/open/logs" : "/api/logs"; static get taskLogDetail => getIt().useSecretLogined ? "/open/logs/" : "/api/logs/"; static get scripts => getIt().useSecretLogined ? "/open/scripts/files" : "/api/scripts/files"; static get scripts2 => getIt().useSecretLogined ? "/open/scripts" : "/api/scripts"; static get scriptUpdate => getIt().useSecretLogined ? "/open/scripts" : "/api/scripts"; static get scriptDetail => getIt().useSecretLogined ? "/open/scripts/" : "/api/scripts/"; static get dependencies => getIt().useSecretLogined ? "/open/dependencies" : "/api/dependencies"; static get addScript => getIt().useSecretLogined ? "/open/scripts" : "/api/scripts"; static get dependencyReinstall => getIt().useSecretLogined ? "/open/dependencies/reinstall" : "/api/dependencies/reinstall"; static intimeLog(String cronId) { return getIt().useSecretLogined ? "/open/crons/$cronId/log" : "/api/crons/$cronId/log"; } static envMove(String envId) { return getIt().useSecretLogined ? "/open/envs/$envId/move" : "/api/envs/$envId/move"; } static bool inWhiteList(String path) { if (path == login || path == loginByClientId || path == loginTwo || path == loginOld) { return true; } return false; } static bool inLoginList(String path) { if (path == login || path == loginByClientId || path == loginOld) { return true; } return false; } }