├── app ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── drawable │ │ │ ├── ico_edit.png │ │ │ ├── ico_web.png │ │ │ ├── ico_delete.png │ │ │ ├── ic_launcher.png │ │ │ ├── ico_browser.png │ │ │ └── ic_launcher_round.png │ │ ├── menu │ │ │ ├── menu_nav_bottom.xml │ │ │ ├── menu_web.xml │ │ │ └── menu_browser.xml │ │ ├── layout │ │ │ ├── fragment_browser.xml │ │ │ ├── fragment_web.xml │ │ │ ├── activity_main.xml │ │ │ ├── web_listview_data.xml │ │ │ ├── web_input_qldata.xml │ │ │ └── web_input_data.xml │ │ ├── values │ │ │ ├── themes.xml │ │ │ ├── colors.xml │ │ │ └── strings.xml │ │ ├── values-night │ │ │ ├── themes.xml │ │ │ └── colors.xml │ │ ├── navigation │ │ │ └── navigation_main.xml │ │ └── values-en │ │ │ └── strings.xml │ │ ├── java │ │ └── com │ │ │ └── zgcwkj │ │ │ ├── getcks │ │ │ ├── web │ │ │ │ ├── WebViewModel.java │ │ │ │ ├── WebHandler.java │ │ │ │ ├── WebFragment.java │ │ │ │ └── WebDataAdapter.java │ │ │ ├── browser │ │ │ │ ├── BrowserViewModel.java │ │ │ │ ├── BrowserHandler.java │ │ │ │ └── BrowserFragment.java │ │ │ ├── StaticObj.java │ │ │ ├── MainActivity.java │ │ │ └── dialogs │ │ │ │ ├── QLConfigDialog.java │ │ │ │ └── WebDataDialog.java │ │ │ ├── models │ │ │ ├── QLData.java │ │ │ └── WebData.java │ │ │ └── bllcode │ │ │ ├── CommonHelp.java │ │ │ ├── DialogLoading.java │ │ │ ├── CookieHep.java │ │ │ ├── QLongHelp.java │ │ │ └── SqliteHelp.java │ │ └── AndroidManifest.xml ├── proguard-rules.pro └── build.gradle ├── imgs ├── 001.jpg ├── 002.jpg ├── 003.jpg ├── 004.jpg └── logo.png ├── gradle ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties └── libs.versions.toml ├── php ├── README.md └── open │ ├── auth │ └── token.php │ ├── envs │ └── enable.php │ ├── envs.php │ └── comm.php ├── README.md ├── settings.gradle ├── .gitignore ├── LICENSE ├── gradle.properties ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /debug 3 | /release 4 | -------------------------------------------------------------------------------- /imgs/001.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zgcwkjOpenProject/Android_GetCookies/HEAD/imgs/001.jpg -------------------------------------------------------------------------------- /imgs/002.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zgcwkjOpenProject/Android_GetCookies/HEAD/imgs/002.jpg -------------------------------------------------------------------------------- /imgs/003.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zgcwkjOpenProject/Android_GetCookies/HEAD/imgs/003.jpg -------------------------------------------------------------------------------- /imgs/004.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zgcwkjOpenProject/Android_GetCookies/HEAD/imgs/004.jpg -------------------------------------------------------------------------------- /imgs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zgcwkjOpenProject/Android_GetCookies/HEAD/imgs/logo.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zgcwkjOpenProject/Android_GetCookies/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable/ico_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zgcwkjOpenProject/Android_GetCookies/HEAD/app/src/main/res/drawable/ico_edit.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ico_web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zgcwkjOpenProject/Android_GetCookies/HEAD/app/src/main/res/drawable/ico_web.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ico_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zgcwkjOpenProject/Android_GetCookies/HEAD/app/src/main/res/drawable/ico_delete.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zgcwkjOpenProject/Android_GetCookies/HEAD/app/src/main/res/drawable/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ico_browser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zgcwkjOpenProject/Android_GetCookies/HEAD/app/src/main/res/drawable/ico_browser.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zgcwkjOpenProject/Android_GetCookies/HEAD/app/src/main/res/drawable/ic_launcher_round.png -------------------------------------------------------------------------------- /php/README.md: -------------------------------------------------------------------------------- 1 | # 说明 2 | 3 | 可以搭建中间者来使用,以避免数据泄露。 4 | 5 | # nginx 配置伪静态 6 | 7 | ```nginx.conf 8 | #Qinglong 9 | location /open { 10 | rewrite ^/open/(.*)$ /open/$1.php; 11 | } 12 | ``` 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/zgcwkj/getcks/web/WebViewModel.java: -------------------------------------------------------------------------------- 1 | package com.zgcwkj.getcks.web; 2 | 3 | import androidx.lifecycle.ViewModel; 4 | 5 | public class WebViewModel extends ViewModel { 6 | public WebViewModel() { 7 | } 8 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android_GetCookies 2 | 3 | 调用安卓内置浏览器,访问网站并获取Cookie。 4 | 5 | # 图片预览 6 | 7 | ![001](imgs/001.jpg?20250210) 8 | 9 | ![002](imgs/002.jpg?20250210) 10 | 11 | ![003](imgs/003.jpg?20250210) 12 | 13 | ![004](imgs/004.jpg?20250210) 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/zgcwkj/getcks/browser/BrowserViewModel.java: -------------------------------------------------------------------------------- 1 | package com.zgcwkj.getcks.browser; 2 | 3 | import androidx.lifecycle.ViewModel; 4 | 5 | public class BrowserViewModel extends ViewModel { 6 | public BrowserViewModel() { 7 | } 8 | } -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Apr 09 10:28:58 CST 2024 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_nav_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 11 | 12 | -------------------------------------------------------------------------------- /php/open/auth/token.php: -------------------------------------------------------------------------------- 1 | 200, 5 | "data" => array( 6 | "token" => "ql.zgcwkj.cn", 7 | ) 8 | ); 9 | $clientId = isset($_REQUEST["client_id"]) ? $_REQUEST["client_id"] : ""; 10 | $clientSecret = isset($_REQUEST["client_secret"]) ? $_REQUEST["client_secret"] : ""; 11 | if ($clientId != "zgcwkj" || $clientSecret != "zgcwkj") { 12 | $data["code"] = 403; 13 | $data["data"] = null; 14 | } 15 | 16 | echo json_encode($data); 17 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_web.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_browser.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 10 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_browser.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | google { 4 | content { 5 | includeGroupByRegex("com\\.android.*") 6 | includeGroupByRegex("com\\.google.*") 7 | includeGroupByRegex("androidx.*") 8 | } 9 | } 10 | mavenCentral() 11 | gradlePluginPortal() 12 | } 13 | } 14 | dependencyResolutionManagement { 15 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 16 | repositories { 17 | google() 18 | mavenCentral() 19 | } 20 | } 21 | 22 | include ':app' 23 | rootProject.name = "获取CK" 24 | -------------------------------------------------------------------------------- /gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | agp = "8.9.0" 3 | material = "1.10.0" 4 | navigationFragment = "2.7.7" 5 | okhttpsGson = "4.0.2" 6 | 7 | [libraries] 8 | material = { group = "com.google.android.material", name = "material", version.ref = "material" } 9 | navigation-ui = { module = "androidx.navigation:navigation-ui", version.ref = "navigationFragment" } 10 | navigation-fragment = { module = "androidx.navigation:navigation-fragment", version.ref = "navigationFragment" } 11 | okhttps-gson = { module = "cn.zhxu:okhttps-gson", version.ref = "okhttpsGson" } 12 | 13 | [plugins] 14 | androidApplication = { id = "com.android.application", version.ref = "agp" } 15 | -------------------------------------------------------------------------------- /app/src/main/res/values/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/zgcwkj/getcks/StaticObj.java: -------------------------------------------------------------------------------- 1 | package com.zgcwkj.getcks; 2 | 3 | import android.os.Handler; 4 | 5 | import com.zgcwkj.bllcode.DialogLoading; 6 | import com.zgcwkj.getcks.dialogs.QLConfigDialog; 7 | import com.zgcwkj.getcks.dialogs.WebDataDialog; 8 | 9 | //静态对象 10 | public class StaticObj { 11 | //数据目录后缀 12 | public static String dataDirectorySuffix = ""; 13 | //加载弹窗 14 | public static DialogLoading dialogLoading; 15 | //输入信息弹窗 16 | public static WebDataDialog dialogInput; 17 | //输入信息弹窗2 18 | public static QLConfigDialog dialogInputQl; 19 | 20 | //发送消息 21 | public static void sendMsg(Handler handler, int msgWhat) { 22 | var iMsg = handler.obtainMessage(); 23 | iMsg.what = msgWhat; 24 | handler.sendMessage(iMsg); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/res/navigation/navigation_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # ---> Android 2 | # Gradle files 3 | .DS_Store 4 | .gradle/ 5 | build/ 6 | 7 | # Local configuration file (sdk path, etc) 8 | local.properties 9 | 10 | # Log/OS Files 11 | *.log 12 | 13 | # Android Studio generated files and folders 14 | captures/ 15 | .externalNativeBuild/ 16 | .cxx/ 17 | *.apk 18 | output.json 19 | 20 | # IntelliJ 21 | *.iml 22 | .idea/ 23 | 24 | # Keystore files 25 | *.jks 26 | *.keystore 27 | 28 | # Google Services (e.g. APIs or Firebase) 29 | google-services.json 30 | 31 | # Android Profiling 32 | *.hprof 33 | 34 | # ---> VisualStudioCode 35 | .vs/ 36 | .vscode/* 37 | !.vscode/settings.json 38 | !.vscode/tasks.json 39 | !.vscode/launch.json 40 | !.vscode/extensions.json 41 | !.vscode/*.code-snippets 42 | 43 | # Local History for Visual Studio Code 44 | .history/ 45 | 46 | # Built Visual Studio Code Extensions 47 | *.vsix 48 | 49 | -------------------------------------------------------------------------------- /php/open/envs/enable.php: -------------------------------------------------------------------------------- 1 | 200, 9 | 'data' => array() 10 | ); 11 | echo json_encode($data); 12 | } else { 13 | //传参数据 14 | $inputJsonStr = file_get_contents('php://input'); 15 | $inputJson = json_decode($inputJsonStr); 16 | if (count($inputJson) != 1) { 17 | $data = array( 18 | 'code' => 500, 19 | 'data' => array() 20 | ); 21 | echo json_encode($data); 22 | return; 23 | } 24 | //echo json_encode($inputJson); 25 | $token = getToken(); 26 | //echo json_encode($token); 27 | //启用环境变量 28 | $envEnableUrl = "$serverUrl/open/envs/enable/"; 29 | $saveResult = posturl($envEnableUrl, $inputJson, $token, true); 30 | echo json_encode($saveResult); 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #FFFFFF 5 | 6 | #0060A0 7 | #0060A0 8 | #0060A0 9 | 10 | #FFFFFF 11 | #000000 12 | #FF0000 13 | #FFA200 14 | #0087CD 15 | #C0C0C0 16 | 17 | #FFBB86FC 18 | #FF6200EE 19 | #FF3700B3 20 | #FF03DAC5 21 | #FF018786 22 | #FF000000 23 | #FFFFFFFF 24 | -------------------------------------------------------------------------------- /app/src/main/res/values-night/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #000000 5 | 6 | #0060A0 7 | #0060A0 8 | #0060A0 9 | 10 | #000000 11 | #FFFFFF 12 | #FF0000 13 | #FFA200 14 | #0087CD 15 | #C0C0C0 16 | 17 | #FFBB86FC 18 | #FF6200EE 19 | #FF3700B3 20 | #FF03DAC5 21 | #FF018786 22 | #FF000000 23 | #FFFFFFFF 24 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | 23 | # Gson 反射结构 24 | -keepattributes Signature 25 | -keep class com.google.gson.reflect.TypeToken { *; } 26 | -keep class * extends com.google.gson.reflect.TypeToken 27 | -keepattributes AnnotationDefault,RuntimeVisibleAnnotations 28 | 29 | # 数据实体对象结构 30 | -keep class com.zgcwkj.models.** { *; } 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 GetCookies by zgcwkjOpenProject 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/zgcwkj/models/QLData.java: -------------------------------------------------------------------------------- 1 | package com.zgcwkj.models; 2 | 3 | //青龙数据结构 4 | public class QLData { 5 | //青龙地址 6 | private String weburl; 7 | //客户端ID 8 | private String clientId; 9 | //客户端凭据 10 | private String clientSecret; 11 | //自动启用环境变量 12 | private boolean autoEnable; 13 | 14 | public QLData() { 15 | weburl = ""; 16 | clientId = ""; 17 | clientSecret = ""; 18 | autoEnable = false; 19 | } 20 | 21 | public String getWeburl() { 22 | return weburl; 23 | } 24 | 25 | public void setWeburl(String weburl) { 26 | this.weburl = weburl; 27 | } 28 | 29 | public String getClientId() { 30 | return clientId; 31 | } 32 | 33 | public void setClientId(String clientId) { 34 | this.clientId = clientId; 35 | } 36 | 37 | public String getClientSecret() { 38 | return clientSecret; 39 | } 40 | 41 | public void setClientSecret(String clientSecret) { 42 | this.clientSecret = clientSecret; 43 | } 44 | 45 | public boolean getAutoEnable() { 46 | return autoEnable; 47 | } 48 | 49 | public void setAutoEnable(boolean autoEnable) { 50 | this.autoEnable = autoEnable; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. For more details, visit 12 | # https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects 13 | # org.gradle.parallel=true 14 | # AndroidX package structure to make it clearer which packages are bundled with the 15 | # Android operating system, and which are packaged with your app's APK 16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 17 | android.useAndroidX=true 18 | # Enables namespacing of each library's R class so that its R class includes only the 19 | # resources declared in the library itself and none from the library's dependencies, 20 | # thereby reducing the size of the R class for that library 21 | android.nonTransitiveRClass=true -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | alias(libs.plugins.androidApplication) 3 | } 4 | 5 | android { 6 | namespace 'com.zgcwkj.getcks' 7 | compileSdk 34 8 | 9 | defaultConfig { 10 | applicationId "com.zgcwkj.getcks" 11 | minSdk 23 12 | targetSdk 34 13 | versionCode 25021301 14 | versionName "1.1" 15 | } 16 | 17 | buildTypes { 18 | release { 19 | // 代码混淆 20 | minifyEnabled true 21 | 22 | // 移除没用的资源文件 23 | shrinkResources true 24 | 25 | // 关闭调试选项 26 | debuggable false 27 | 28 | // Includes the default ProGuard rules files that are packaged with 29 | // the Android Gradle plugin. To learn more, go to the section about 30 | // R8 configuration files. 31 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 32 | } 33 | } 34 | 35 | signingConfigs { 36 | debug { 37 | v1SigningEnabled true 38 | v2SigningEnabled true 39 | } 40 | release { 41 | v1SigningEnabled true 42 | v2SigningEnabled true 43 | } 44 | } 45 | 46 | packagingOptions { 47 | exclude "DebugProbesKt.bin" 48 | } 49 | 50 | compileOptions { 51 | sourceCompatibility JavaVersion.VERSION_17 52 | targetCompatibility JavaVersion.VERSION_17 53 | } 54 | } 55 | 56 | dependencies { 57 | implementation libs.material 58 | implementation libs.navigation.ui 59 | implementation libs.navigation.fragment 60 | implementation libs.okhttps.gson 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/zgcwkj/getcks/browser/BrowserHandler.java: -------------------------------------------------------------------------------- 1 | package com.zgcwkj.getcks.browser; 2 | 3 | import android.content.Context; 4 | import android.os.Handler; 5 | import android.os.Looper; 6 | import android.os.Message; 7 | import android.widget.Toast; 8 | 9 | import androidx.annotation.NonNull; 10 | 11 | import com.zgcwkj.getcks.StaticObj; 12 | 13 | import java.lang.ref.WeakReference; 14 | 15 | public class BrowserHandler extends Handler { 16 | WeakReference myActivity; 17 | 18 | public BrowserHandler(@NonNull Looper looper, BrowserFragment activity) { 19 | super(looper);//调用父类的显式指明的构造函数 20 | myActivity = new WeakReference(activity); 21 | } 22 | 23 | @Override 24 | public void handleMessage(Message msg) { 25 | super.handleMessage(msg); 26 | var nactivity = myActivity.get(); 27 | if (nactivity == null) return; 28 | Context context = nactivity.getContext(); 29 | //关闭加载弹窗 30 | StaticObj.dialogLoading.close(); 31 | switch (msg.what) { 32 | case 0: 33 | Toast.makeText(context, "操作失败", Toast.LENGTH_SHORT).show(); 34 | break; 35 | case 1: 36 | Toast.makeText(context, "内容已复制到剪切板", Toast.LENGTH_SHORT).show(); 37 | break; 38 | case 3: 39 | Toast.makeText(context, "失败,青龙配置异常", Toast.LENGTH_SHORT).show(); 40 | break; 41 | case 4: 42 | Toast.makeText(context, "内容已传输到青龙", Toast.LENGTH_SHORT).show(); 43 | break; 44 | default: 45 | break; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /php/open/envs.php: -------------------------------------------------------------------------------- 1 | 200, 9 | 'data' => array() 10 | ); 11 | echo json_encode($data); 12 | } else { 13 | //传参数据 14 | $inputJsonStr = file_get_contents('php://input'); 15 | $inputJson = json_decode($inputJsonStr); 16 | if (count($inputJson) != 1) { 17 | $data = array( 18 | 'code' => 500, 19 | 'data' => array() 20 | ); 21 | echo json_encode($data); 22 | return; 23 | } 24 | // echo json_encode($inputJson); 25 | $token = getToken(); 26 | //获取已有的记录 27 | $getEnvUrl = "$serverUrl/open/envs/"; 28 | $getEnvData = geturl($getEnvUrl, $token); 29 | // echo json_encode($getEnvData); 30 | $isUpdate = false; 31 | foreach ($getEnvData['data'] as $envData) { 32 | // echo 'remarks1>'.$envData['remarks']; 33 | // echo 'remarks2>'.$inputJson[0]->remarks; 34 | if ($envData['remarks'] == $inputJson[0]->remarks) { 35 | $inputJson[0]->id = $envData['id']; 36 | $inputJson[0]->name = $envData['name']; 37 | $isUpdate = true; 38 | } 39 | } 40 | //准备数据 41 | $arrayID = array(); 42 | if ($isUpdate) { 43 | array_push($arrayID, $inputJson[0]->id); 44 | $inputJson = $inputJson[0]; 45 | } 46 | //更新到平台 47 | $saveResult = posturl($getEnvUrl, $inputJson, $token, $isUpdate); 48 | ////启用环境变量 49 | //if ($isUpdate) { 50 | // $envEnableUrl = "$serverUrl/open/envs/enable/"; 51 | // $saveResult = posturl($envEnableUrl, $arrayID, $token, true); 52 | //} 53 | echo json_encode($saveResult); 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 获取CK 3 | 拼命加载中... 4 | 青龙 5 | 6 | 确定 7 | 保存 8 | 添加 9 | 取消 10 | 删除 11 | 清除 12 | 刷新 13 | 14 | 网站 15 | 浏览器 16 | 配置青龙 17 | 复制或推送CK 18 | 复制CK 19 | 推送CK 20 | 重置浏览器 21 | 22 | 添加新的网站 23 | 网站地址: 24 | 输入网站地址 25 | 获取CK键: 26 | 未匹配的键,将加到环境变量中 27 | 匹配CK值: 28 | 匹配结果预览 29 | 用户代理: 30 | 可为空,UserAgent 31 | 备 注: 32 | 不能为空,通过备注匹配平台数据 33 | 数据隔离(需要重启应用) 34 | 配置青龙 35 | 青龙地址: 36 | 客户端ID: 37 | 客户端密钥: 38 | 自动启用环境变量 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/values-en/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | GetCK 3 | Loading... 4 | QL 5 | 6 | OK 7 | Save 8 | Add 9 | Cancel 10 | Delete 11 | Clear 12 | Refresh 13 | 14 | Web 15 | Browser 16 | ConfigQL 17 | GetCK 18 | CopyCK 19 | PushCK 20 | ResetBrowser 21 | 22 | Add Web 23 | Web Url: 24 | Enter the website address 25 | CookieKey: 26 | Unmatched values will be added to the environment variable 27 | Cookie: 28 | Preview matching results 29 | UserAgent: 30 | Can be null, UserAgent 31 | Remark: 32 | Cannot be empty, match data through remarks 33 | Data isolation (restart required) 34 | ConfigQL 35 | ConfigQlUrl: 36 | ClientId: 37 | ClientSecret: 38 | AutoEnableEnv 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/zgcwkj/getcks/web/WebHandler.java: -------------------------------------------------------------------------------- 1 | package com.zgcwkj.getcks.web; 2 | 3 | import android.content.Context; 4 | import android.os.Handler; 5 | import android.os.Looper; 6 | import android.os.Message; 7 | import android.widget.Toast; 8 | 9 | import androidx.annotation.NonNull; 10 | 11 | import com.zgcwkj.getcks.StaticObj; 12 | 13 | import java.lang.ref.WeakReference; 14 | 15 | public class WebHandler extends Handler { 16 | WeakReference myActivity; 17 | 18 | public WebHandler(@NonNull Looper looper, WebFragment activity) { 19 | super(looper);//调用父类的显式指明的构造函数 20 | myActivity = new WeakReference(activity); 21 | } 22 | 23 | @Override 24 | public void handleMessage(Message msg) { 25 | super.handleMessage(msg); 26 | var nactivity = myActivity.get(); 27 | if (nactivity == null) return; 28 | Context context = nactivity.getContext(); 29 | // 30 | StaticObj.dialogLoading.close(); 31 | switch (msg.what) { 32 | case 0: 33 | Toast.makeText(context, "保存失败", Toast.LENGTH_SHORT).show(); 34 | break; 35 | case 1: 36 | StaticObj.dialogInput.close();//关闭对话框(网站配置) 37 | nactivity.LoadDataListView(nactivity.getView());//加载列表数据 38 | Toast.makeText(context, "保存成功", Toast.LENGTH_SHORT).show(); 39 | break; 40 | case 3: 41 | Toast.makeText(context, "选择失败", Toast.LENGTH_SHORT).show(); 42 | break; 43 | case 4: 44 | nactivity.LoadDataListView(nactivity.getView());//加载列表数据 45 | Toast.makeText(context, "选择成功", Toast.LENGTH_SHORT).show(); 46 | break; 47 | case 11: 48 | StaticObj.dialogInputQl.close();//关闭对话框(青龙配置) 49 | nactivity.LoadDataListView(nactivity.getView());//加载列表数据 50 | Toast.makeText(context, "保存成功", Toast.LENGTH_SHORT).show(); 51 | break; 52 | default: 53 | break; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /php/open/comm.php: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 16 | 17 | 23 | 24 | 32 | 33 | 37 | 38 | 46 | 47 | 53 | 54 | 55 | 56 | 57 | 58 | 63 | 64 |