├── app
├── .gitignore
├── ci-unsecured.jks
├── src
│ └── main
│ │ ├── res
│ │ ├── drawable
│ │ │ └── logo.png
│ │ ├── values
│ │ │ ├── dimens.xml
│ │ │ └── strings.xml
│ │ ├── xml
│ │ │ ├── backup_rules.xml
│ │ │ └── data_extraction_rules.xml
│ │ └── layout
│ │ │ ├── activity_main.xml
│ │ │ └── activity_qing_long_login.xml
│ │ ├── java
│ │ └── cn
│ │ │ └── moon
│ │ │ └── ql
│ │ │ ├── SiteType.java
│ │ │ ├── data
│ │ │ ├── model
│ │ │ │ ├── QLLoginData.java
│ │ │ │ ├── QLStoreData.java
│ │ │ │ ├── QLSettingsData.java
│ │ │ │ └── QLEnvData.java
│ │ │ └── QLSdk.java
│ │ │ ├── util
│ │ │ └── CookieUtil.java
│ │ │ ├── EnvUploader.java
│ │ │ ├── App.java
│ │ │ └── ui
│ │ │ ├── ql
│ │ │ └── QLLoginActivity.java
│ │ │ └── app
│ │ │ └── MainActivity.java
│ │ └── AndroidManifest.xml
├── ci-keystore.properties
├── proguard-rules.pro
└── build.gradle
├── docs
├── app.png
├── run.png
├── web.png
├── actions.png
├── ql-app.png
└── release.png
├── gradle
├── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
└── libs.versions.toml
├── .gitignore
├── README.md
├── .github
└── workflows
│ └── ci.yml
├── settings.gradle
├── gradle.properties
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/docs/app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jiangood/qinglong-jd-apk/HEAD/docs/app.png
--------------------------------------------------------------------------------
/docs/run.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jiangood/qinglong-jd-apk/HEAD/docs/run.png
--------------------------------------------------------------------------------
/docs/web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jiangood/qinglong-jd-apk/HEAD/docs/web.png
--------------------------------------------------------------------------------
/docs/actions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jiangood/qinglong-jd-apk/HEAD/docs/actions.png
--------------------------------------------------------------------------------
/docs/ql-app.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jiangood/qinglong-jd-apk/HEAD/docs/ql-app.png
--------------------------------------------------------------------------------
/docs/release.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jiangood/qinglong-jd-apk/HEAD/docs/release.png
--------------------------------------------------------------------------------
/app/ci-unsecured.jks:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jiangood/qinglong-jd-apk/HEAD/app/ci-unsecured.jks
--------------------------------------------------------------------------------
/app/src/main/res/drawable/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jiangood/qinglong-jd-apk/HEAD/app/src/main/res/drawable/logo.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jiangood/qinglong-jd-apk/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/ci-keystore.properties:
--------------------------------------------------------------------------------
1 | storeFile=./ci-unsecured.jks
2 | storePassword=phono-unsecured
3 | keyAlias=phono-unsecured
4 | keyPassword=phono-unsecured
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Jun 08 07:46:30 CST 2024
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
5 | zipStoreBase=GRADLE_USER_HOME
6 | zipStorePath=wrapper/dists
7 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | local.properties
16 | /.idea/
17 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/moon/ql/SiteType.java:
--------------------------------------------------------------------------------
1 | package cn.moon.ql;
2 |
3 | public enum SiteType {
4 | JD("https://m.jd.com","JD_COOKIE");
5 |
6 | private String url;
7 | private String env; // 青龙环境变量
8 |
9 |
10 | SiteType(String url, String env){
11 | this.url = url;
12 | this.env = env;
13 | }
14 |
15 |
16 | public String getUrl() {
17 | return url;
18 | }
19 |
20 | public String getEnv() {
21 | return env;
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/backup_rules.xml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
13 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 介绍
2 | 青龙脚本,京东cookie获取上传APP
3 | - 手机使用app
4 | - 登录后,自动将cookie上传到青龙脚本服务器
5 | - 源码全部开放
6 |
7 |
8 |
9 | ## 界面
10 | 
11 |
12 | 
13 |
14 | # 使用方式:直接下载右侧apk
15 | 在青龙后台创建一个应用,赋予修改变量的权限。 依次点击【系统设置】【应用设置】【创建应用】 ,名称无所谓,权限选择 环境变量。 创建后得到Client ID,Client Secret
16 | 
17 |
18 |
19 |
20 |
21 | # 开发自行编译
22 | IDE 用的2021版
23 | 1. 克隆 本项目
24 | 2. 直接打包即可
25 |
26 |
27 | # 开发笔记, 记录开发过程中遇到的问题
28 | 接口参考文档:https://qinglong.ukenn.top
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/moon/ql/data/model/QLLoginData.java:
--------------------------------------------------------------------------------
1 | package cn.moon.ql.data.model;
2 |
3 |
4 | public class QLLoginData {
5 |
6 | private String tokenType;
7 | private String token;
8 |
9 | public QLLoginData(String userId, String token) {
10 | this.tokenType = userId;
11 | this.token = token;
12 | }
13 |
14 | public String getTokenType() {
15 | return tokenType;
16 | }
17 |
18 | public String getToken() {
19 | return token;
20 | }
21 |
22 | public String toAuthValue(){
23 | return this.tokenType + " " + token;
24 | }
25 | }
--------------------------------------------------------------------------------
/app/src/main/res/xml/data_extraction_rules.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
12 |
13 |
19 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/moon/ql/data/model/QLStoreData.java:
--------------------------------------------------------------------------------
1 | package cn.moon.ql.data.model;
2 |
3 | public class QLStoreData {
4 | private QLLoginData loginData;
5 | private QLSettingsData settingsData;
6 |
7 | public QLStoreData(QLLoginData loginData, QLSettingsData settingsData) {
8 | this.loginData = loginData;
9 | this.settingsData = settingsData;
10 | }
11 |
12 | public QLLoginData getLoginData() {
13 | return loginData;
14 | }
15 |
16 | public QLSettingsData getSettingsData() {
17 | return settingsData;
18 | }
19 |
20 | public boolean isLoggedQL() {
21 | return this.loginData != null && loginData.getToken() != null;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: APK 打包
2 |
3 | on:
4 | workflow_dispatch:
5 | push:
6 | tags:
7 | - "v*.*.*"
8 |
9 |
10 |
11 | jobs:
12 | build:
13 |
14 | runs-on: ubuntu-latest
15 | permissions:
16 | contents: write
17 |
18 | steps:
19 | - uses: actions/checkout@v4
20 | - name: 设置Java环境
21 | uses: actions/setup-java@v3
22 | with:
23 | java-version: '17'
24 | distribution: 'temurin'
25 |
26 | - name: 打包
27 | run: |
28 | chmod +x gradlew
29 | ./gradlew assembleCiRelease
30 |
31 | - name: 发布
32 | uses: softprops/action-gh-release@v2
33 | with:
34 | files: |
35 | app/build/outputs/apk/ci/**/*.*
36 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/moon/ql/data/model/QLSettingsData.java:
--------------------------------------------------------------------------------
1 | package cn.moon.ql.data.model;
2 |
3 | /**
4 | * Data class that captures user information for logged in users retrieved from LoginRepository
5 | */
6 | public class QLSettingsData {
7 |
8 | private String url;
9 | private String cid;
10 | private String csk;
11 |
12 | public QLSettingsData(String url, String cid,String csk) {
13 | this.url = url;
14 | this.cid = cid;
15 | this.csk = csk;
16 | }
17 |
18 | public String getUrl() {
19 | return url;
20 | }
21 |
22 | public String getCid() {
23 | return cid;
24 | }
25 |
26 | public String getCsk() {
27 | return csk;
28 | }
29 | }
--------------------------------------------------------------------------------
/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
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | maven { url "https://jitpack.io" }
4 | maven { url 'https://maven.aliyun.com/repository/releases' }
5 | maven { url 'https://maven.aliyun.com/repository/jcenter' }
6 | maven { url 'https://maven.aliyun.com/repository/google' }
7 | maven { url 'https://maven.aliyun.com/repository/central' }
8 | maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
9 | maven { url 'https://maven.aliyun.com/repository/public' }
10 | google()
11 | mavenCentral()
12 | gradlePluginPortal()
13 | }
14 | }
15 | dependencyResolutionManagement {
16 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
17 | repositories {
18 | google()
19 | mavenCentral()
20 | }
21 | }
22 | rootProject.name = "QinglongClient"
23 | include ':app'
24 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 青龙京东
3 | 上传
4 | 登录青龙
5 | 青龙ClientID
6 | 青龙ClientSecret
7 | 地址,如 http://127.0.0.1:5700
8 | ClientID
9 | ClientSecret
10 | 登录
11 | 无效的URL
12 | 无效的ClientID
13 | 无效的ClientSecret
14 | "登录失败"
15 | 登录青龙
16 |
17 |
18 | 刷新
19 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
15 |
16 |
20 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/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. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec: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
22 | android.defaults.buildfeatures.buildconfig=true
23 | android.nonFinalResIds=false
--------------------------------------------------------------------------------
/app/src/main/java/cn/moon/ql/util/CookieUtil.java:
--------------------------------------------------------------------------------
1 | package cn.moon.ql.util;
2 |
3 | import android.text.TextUtils;
4 |
5 | import java.util.ArrayList;
6 | import java.util.LinkedHashMap;
7 | import java.util.List;
8 | import java.util.Map;
9 |
10 | public class CookieUtil {
11 |
12 | public static Map parse(String cookies) {
13 | String[] cookiesArr = cookies.split(";");
14 |
15 | Map map = new LinkedHashMap<>();
16 | for (String ck : cookiesArr) {
17 | String[] arr = ck.split("=");
18 | if (arr.length == 2) {
19 | String k = arr[0];
20 | String v = arr[1];
21 |
22 | if(!TextUtils.isEmpty(v)){
23 | map.put(k.trim(), v.trim());
24 | }
25 |
26 |
27 | }
28 | }
29 |
30 | return map;
31 | }
32 |
33 | public static Map parse(String cookies,String... keys) {
34 | Map map = parse(cookies);
35 |
36 | Map newMap = new LinkedHashMap<>();
37 | for (String key : keys) {
38 | String value = map.get(key);
39 | if(!TextUtils.isEmpty(value)){
40 | newMap.put(key, value);
41 | }
42 | }
43 | return newMap;
44 | }
45 |
46 | public static String join(Map cookieMap) {
47 | List list = new ArrayList<>();
48 | for (Map.Entry e : cookieMap.entrySet()) {
49 | String key = e.getKey();
50 | String value = e.getValue();
51 |
52 | list.add(key+"="+value);
53 | }
54 | return TextUtils.join("; ", list) + ";";
55 | }
56 |
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | [versions]
2 | agp = "8.4.0"
3 | kotlin = "1.9.0"
4 | coreKtx = "1.10.1"
5 | junit = "4.13.2"
6 | junitVersion = "1.1.5"
7 | espressoCore = "3.5.1"
8 | appcompat = "1.6.1"
9 | material = "1.10.0"
10 | activity = "1.8.0"
11 | constraintlayout = "2.1.4"
12 | annotation = "1.7.0"
13 | lifecycle-livedata-ktx = "2.6.2"
14 | lifecycle-viewmodel-ktx = "2.6.2"
15 |
16 | [libraries]
17 | androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
18 | junit = { group = "junit", name = "junit", version.ref = "junit" }
19 | androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
20 | androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
21 | androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
22 | material = { group = "com.google.android.material", name = "material", version.ref = "material" }
23 | androidx-activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
24 | androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
25 | annotation = { group = "androidx.annotation", name = "annotation", version.ref = "annotation" }
26 | lifecycle-livedata-ktx = { group = "androidx.lifecycle", name = "lifecycle-livedata-ktx", version.ref = "lifecycle-livedata-ktx" }
27 | lifecycle-viewmodel-ktx = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycle-viewmodel-ktx" }
28 |
29 | [plugins]
30 | android-application = { id = "com.android.application", version.ref = "agp" }
31 | jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
11 |
12 |
17 |
18 |
19 |
25 |
26 |
27 |
32 |
33 |
38 |
39 |
46 |
47 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | }
4 |
5 | android {
6 | namespace 'cn.moon.ql'
7 | compileSdk 33
8 |
9 | defaultConfig {
10 | applicationId "cn.moon.ql"
11 | minSdk 24
12 | targetSdk 33
13 | versionCode 108
14 | versionName "1.0.8"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 | signingConfigs {
19 | ci {
20 | final String keystorePropertiesFile = rootProject.file('app/ci-keystore.properties')
21 | final Properties keystoreProperties = new Properties()
22 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
23 |
24 | storeFile file(keystoreProperties['storeFile'])
25 | storePassword keystoreProperties['storePassword']
26 | keyAlias keystoreProperties['keyAlias']
27 | keyPassword keystoreProperties['keyPassword']
28 | }
29 | }
30 | flavorDimensions = ['default']
31 | productFlavors {
32 | ci {
33 | dimension 'default'
34 | signingConfig signingConfigs.ci
35 | }
36 | }
37 | buildTypes {
38 | release {
39 | minifyEnabled false
40 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
41 | }
42 | }
43 | compileOptions {
44 | sourceCompatibility JavaVersion.VERSION_1_8
45 | targetCompatibility JavaVersion.VERSION_1_8
46 | }
47 | buildFeatures {
48 | viewBinding true
49 | }
50 | }
51 |
52 | dependencies {
53 |
54 | implementation 'androidx.appcompat:appcompat:1.6.1'
55 | implementation 'com.google.android.material:material:1.8.0'
56 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
57 |
58 | implementation 'androidx.webkit:webkit:1.4.0'
59 | implementation 'com.squareup.okhttp3:okhttp:4.9.1'
60 | // implementation libs.annotation
61 | // implementation libs.lifecycle.livedata.ktx
62 | // implementation libs.lifecycle.viewmodel.ktx
63 | }
--------------------------------------------------------------------------------
/app/src/main/java/cn/moon/ql/data/model/QLEnvData.java:
--------------------------------------------------------------------------------
1 | package cn.moon.ql.data.model;
2 |
3 | import org.json.JSONException;
4 | import org.json.JSONObject;
5 |
6 | /**
7 | * Data class that captures user information for logged in users retrieved from LoginRepository
8 | */
9 | public class QLEnvData {
10 |
11 | private Integer id;
12 | private String name;
13 | private String value;
14 | private String remarks;
15 |
16 | public QLEnvData(String name, String value) {
17 | this.name = name;
18 | this.value = value;
19 | }
20 |
21 | public QLEnvData(String name, String value, String remarks) {
22 | this.name = name;
23 | this.value = value;
24 | this.remarks = remarks;
25 | }
26 |
27 | public QLEnvData(Integer id, String name, String value) {
28 | this.id = id;
29 | this.name = name;
30 | this.value = value;
31 | }
32 |
33 | public QLEnvData(Integer id, String name, String value, String remarks) {
34 | this.id = id;
35 | this.name = name;
36 | this.value = value;
37 | this.remarks = remarks;
38 | }
39 |
40 | public void setId(Integer id) {
41 | this.id = id;
42 | }
43 |
44 | public Integer getId() {
45 | return id;
46 | }
47 |
48 | public String getName() {
49 | return name;
50 | }
51 |
52 | public String getValue() {
53 | return value;
54 | }
55 |
56 | public void setRemarks(String remarks) {
57 | this.remarks = remarks;
58 | }
59 |
60 | public String getRemarks() {
61 | return remarks;
62 | }
63 |
64 | public String toJsonString() throws JSONException {
65 | return toJson().toString();
66 | }
67 |
68 | public JSONObject toJson() throws JSONException {
69 | JSONObject jo = new JSONObject();
70 | if (this.id != null) {
71 | jo.put("id", this.id);
72 | }
73 | jo.put("name", this.name);
74 | jo.put("value", this.value);
75 | jo.put("remarks", this.remarks);
76 | return jo;
77 | }
78 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_qing_long_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
23 |
24 |
32 |
33 |
41 |
42 |
43 |
44 |
45 |
46 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/moon/ql/EnvUploader.java:
--------------------------------------------------------------------------------
1 | package cn.moon.ql;
2 |
3 | import java.util.List;
4 | import java.util.Map;
5 |
6 | import cn.moon.ql.data.QLSdk;
7 | import cn.moon.ql.data.model.QLEnvData;
8 | import cn.moon.ql.data.model.QLStoreData;
9 | import cn.moon.ql.util.CookieUtil;
10 |
11 | public class EnvUploader {
12 |
13 | private QLSdk sdk = new QLSdk();
14 |
15 | public String upload(SiteType type, String envName, String cookies) throws Exception {
16 | switch (type) {
17 | case JD:
18 | return uploadJd(envName, cookies);
19 | }
20 | return envName;
21 | }
22 |
23 | public String uploadJd(String envName, String cookies) throws Exception {
24 | Map jdCookie = CookieUtil.parse(cookies, "pt_key", "pt_pin");
25 | if (jdCookie.isEmpty()) {
26 | throw new Exception("未登录京东");
27 | }
28 |
29 | String envValue = CookieUtil.join(jdCookie);
30 |
31 | Map map = CookieUtil.parse(envValue);
32 | String ptPin = map.get("pt_pin");
33 | QLStoreData qlStoreData = App.getQLStoreData();
34 |
35 | List envDataList = sdk.listEnv(envName, qlStoreData.getSettingsData(), qlStoreData.getLoginData());
36 | Integer id = null;
37 | for (QLEnvData envData : envDataList) {
38 | String name = envData.getName();
39 | String value = envData.getValue();
40 | if (envName.equals(name) && value.contains(ptPin)) {
41 | id = envData.getId();
42 | }
43 | }
44 |
45 | QLEnvData updateEnv = new QLEnvData(envName, envValue, null);
46 | if (id == null) {
47 | sdk.addEnv(updateEnv, qlStoreData.getSettingsData(), qlStoreData.getLoginData());
48 | return "添加成功";
49 | }
50 |
51 | updateEnv.setId(id);
52 | sdk.updateEnv(updateEnv, qlStoreData.getSettingsData(), qlStoreData.getLoginData());
53 | //启用token
54 | sdk.enableEnv(id, qlStoreData.getSettingsData(), qlStoreData.getLoginData());
55 | return "更新成功";
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/moon/ql/App.java:
--------------------------------------------------------------------------------
1 | package cn.moon.ql;
2 |
3 | import android.app.Application;
4 | import android.content.SharedPreferences;
5 |
6 | import cn.moon.ql.data.model.QLLoginData;
7 | import cn.moon.ql.data.model.QLSettingsData;
8 | import cn.moon.ql.data.model.QLStoreData;
9 |
10 | public class App extends Application {
11 | private static App instance;
12 | private static SharedPreferences sharedPreferences;
13 | private static final String QL_DATA_FILE_NAME = "qinglong";
14 | private static QLStoreData qlStoreData;
15 |
16 |
17 | @Override
18 | public void onCreate() {
19 | super.onCreate();
20 | instance = this;
21 | initApp();
22 | }
23 |
24 | public static App getInstance() {
25 | return instance;
26 | }
27 |
28 | public static QLStoreData getQLStoreData() {
29 | return qlStoreData;
30 | }
31 |
32 |
33 | private void initApp() {
34 | sharedPreferences = getSharedPreferences(QL_DATA_FILE_NAME, MODE_PRIVATE);
35 | String url = sharedPreferences.getString("url", "");
36 | String cid = sharedPreferences.getString("cid", "");
37 | String csk = sharedPreferences.getString("csk", "");
38 |
39 | String tokenType = sharedPreferences.getString("token_type", "Bearer");
40 | String token = sharedPreferences.getString("token", null);
41 |
42 | QLLoginData loginData = new QLLoginData(tokenType, token);
43 | QLSettingsData settingsData = new QLSettingsData(url, cid, csk);
44 | qlStoreData = new QLStoreData(loginData, settingsData);
45 | }
46 |
47 |
48 |
49 | public static void storeQLData(QLSettingsData settingsData, QLLoginData loginData) {
50 | qlStoreData = new QLStoreData(loginData, settingsData);
51 | SharedPreferences.Editor editor = sharedPreferences.edit();
52 | editor.putString("url", settingsData.getUrl());
53 | editor.putString("cid", settingsData.getCid());
54 | editor.putString("csk", settingsData.getCsk());
55 | editor.putString("token_type", loginData.getTokenType());
56 | editor.putString("token", loginData.getToken());
57 | editor.apply();
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/moon/ql/ui/ql/QLLoginActivity.java:
--------------------------------------------------------------------------------
1 | package cn.moon.ql.ui.ql;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.View;
6 | import android.widget.Toast;
7 |
8 | import androidx.appcompat.app.AppCompatActivity;
9 |
10 | import cn.moon.ql.App;
11 | import cn.moon.ql.data.QLSdk;
12 | import cn.moon.ql.data.model.QLLoginData;
13 | import cn.moon.ql.data.model.QLSettingsData;
14 | import cn.moon.ql.data.model.QLStoreData;
15 | import cn.moon.ql.databinding.ActivityQingLongLoginBinding;
16 |
17 | public class QLLoginActivity extends AppCompatActivity implements View.OnClickListener {
18 |
19 | private ActivityQingLongLoginBinding binding;
20 |
21 | private QLSdk sdk = new QLSdk();
22 |
23 | @Override
24 | public void onCreate(Bundle savedInstanceState) {
25 | super.onCreate(savedInstanceState);
26 | binding = ActivityQingLongLoginBinding.inflate(getLayoutInflater());
27 | setContentView(binding.getRoot());
28 |
29 | QLStoreData data = App.getQLStoreData();
30 | QLSettingsData settingsData = data.getSettingsData();
31 | binding.qlUrl.setText(settingsData.getUrl());
32 | binding.qlCid.setText(settingsData.getCid());
33 | binding.qlCsk.setText(settingsData.getCsk());
34 |
35 |
36 | binding.qlLogin.setOnClickListener(this);
37 | }
38 |
39 |
40 |
41 |
42 | @Override
43 | public void onClick(View v) {
44 | String url = binding.qlUrl.getText().toString();
45 | String cid = binding.qlCid.getText().toString();
46 | String csk = binding.qlCsk.getText().toString();
47 |
48 | new Thread() {
49 | @Override
50 | public void run() {
51 | try {
52 | QLLoginData login = sdk.login(url, cid, csk);
53 |
54 |
55 | runOnUiThread(() -> {
56 | Toast.makeText(getApplication(), "登录成功", Toast.LENGTH_SHORT).show();
57 |
58 | QLSettingsData settingsData = new QLSettingsData(url, cid, csk);
59 |
60 | App.storeQLData(settingsData, login);
61 |
62 | setResult(Activity.RESULT_OK);
63 | finish();
64 | });
65 |
66 | } catch (Exception e) {
67 | runOnUiThread(() -> Toast.makeText(getApplication(), e.getMessage(), Toast.LENGTH_SHORT).show());
68 | e.printStackTrace();
69 | }
70 | }
71 | }.start();
72 | }
73 | }
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/moon/ql/ui/app/MainActivity.java:
--------------------------------------------------------------------------------
1 | package cn.moon.ql.ui.app;
2 |
3 |
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.os.Handler;
7 | import android.os.Message;
8 | import android.webkit.CookieManager;
9 | import android.webkit.ValueCallback;
10 | import android.webkit.WebChromeClient;
11 | import android.webkit.WebView;
12 | import android.webkit.WebViewClient;
13 | import android.widget.Toast;
14 |
15 | import androidx.annotation.NonNull;
16 | import androidx.appcompat.app.AppCompatActivity;
17 |
18 | import java.util.List;
19 | import java.util.Map;
20 |
21 | import cn.moon.ql.App;
22 | import cn.moon.ql.EnvUploader;
23 | import cn.moon.ql.R;
24 | import cn.moon.ql.SiteType;
25 | import cn.moon.ql.data.model.QLEnvData;
26 | import cn.moon.ql.data.model.QLStoreData;
27 | import cn.moon.ql.databinding.ActivityMainBinding;
28 | import cn.moon.ql.ui.ql.QLLoginActivity;
29 | import cn.moon.ql.util.CookieUtil;
30 |
31 | public class MainActivity extends AppCompatActivity {
32 | private ActivityMainBinding bd;
33 |
34 | private WebView webView;
35 |
36 | Handler handler = new Handler() {
37 | @Override
38 | public void handleMessage(@NonNull Message msg) {
39 | String str = (String) msg.obj;
40 | if (str != null) {
41 | Toast.makeText(getBaseContext(), str, Toast.LENGTH_SHORT).show();
42 | }
43 | }
44 | };
45 |
46 | private void info(String msg) {
47 | handler.sendMessage(handler.obtainMessage(1, msg));
48 | }
49 |
50 | private void err(String msg) {
51 | handler.sendMessage(handler.obtainMessage(-1, msg));
52 | }
53 |
54 |
55 | private SiteType siteType = SiteType.JD;
56 |
57 | private EnvUploader uploader = new EnvUploader();
58 |
59 | @Override
60 | protected void onCreate(Bundle savedInstanceState) {
61 | super.onCreate(savedInstanceState);
62 | bd = ActivityMainBinding.inflate(getLayoutInflater());
63 | setContentView(bd.getRoot());
64 |
65 | // 设置点击事件
66 | bd.uploadCookieButton.setOnClickListener(v -> uploadCookie());
67 | bd.setQingLongButton.setOnClickListener(v -> showQingLongLogin());
68 | bd.clearWebview.setOnClickListener(v -> clearWebview());
69 | bd.qlEnvName.setText(siteType.getEnv());
70 |
71 |
72 | // 设置 WebView 的基本属性
73 | webView = findViewById(R.id.webView);
74 | webView.setWebChromeClient(new WebChromeClient());
75 | webView.setWebViewClient(new WebViewClient());
76 | webView.getSettings().setJavaScriptEnabled(true);
77 | webView.loadUrl(siteType.getUrl());
78 | }
79 |
80 |
81 | private void uploadCookie() {
82 | if (!App.getQLStoreData().isLoggedQL()) {
83 | err("未配置密钥");
84 | return;
85 | }
86 | String cookies = CookieManager.getInstance().getCookie(webView.getUrl());
87 |
88 |
89 | new Thread() {
90 | @Override
91 | public void run() {
92 | try {
93 | String msg= uploader.upload(siteType, bd.qlEnvName.getText().toString(), cookies);
94 | info(msg);
95 | } catch (Exception e) {
96 | err(e.getMessage());
97 | }
98 | }
99 | }.start();
100 |
101 | }
102 |
103 |
104 | private void showQingLongLogin() {
105 | Intent intent = new Intent(MainActivity.this, QLLoginActivity.class);
106 | startActivity(intent);
107 | }
108 |
109 |
110 | private void clearWebview() {
111 | CookieManager.getInstance().removeAllCookies(new ValueCallback() {
112 | @Override
113 | public void onReceiveValue(Boolean aBoolean) {
114 | info("清除cookie成功");
115 | // Cookie清除完成后的操作
116 | }
117 | });
118 | CookieManager.getInstance().flush();
119 | webView.loadUrl(siteType.getUrl());
120 | }
121 |
122 | }
123 |
--------------------------------------------------------------------------------
/app/src/main/java/cn/moon/ql/data/QLSdk.java:
--------------------------------------------------------------------------------
1 | package cn.moon.ql.data;
2 |
3 | import org.json.JSONArray;
4 | import org.json.JSONObject;
5 |
6 | import java.util.ArrayList;
7 | import java.util.Collections;
8 | import java.util.List;
9 |
10 | import cn.moon.ql.data.model.QLEnvData;
11 | import cn.moon.ql.data.model.QLLoginData;
12 | import cn.moon.ql.data.model.QLSettingsData;
13 | import okhttp3.MediaType;
14 | import okhttp3.OkHttpClient;
15 | import okhttp3.Request;
16 | import okhttp3.RequestBody;
17 | import okhttp3.Response;
18 |
19 |
20 | public class QLSdk {
21 | private OkHttpClient client = new OkHttpClient();
22 |
23 | public QLLoginData login(String url, String cid, String csk) throws Exception {
24 | JSONObject data = (JSONObject) this.doRequest(url, "/open/auth/token?client_id=" + cid + "&client_secret=" + csk, "GET", null, null);
25 |
26 | String tokenType = data.getString("token_type");
27 | String tokenValue = data.getString("token");
28 |
29 | return new QLLoginData(tokenType, tokenValue);
30 | }
31 |
32 | public List listEnv(String name, QLSettingsData settingsData, QLLoginData loginData) throws Exception {
33 | Object response = this.doRequest(settingsData.getUrl(), "/open/envs", "GET", null, loginData.toAuthValue());
34 | if (response == null) {
35 | return Collections.emptyList();
36 | }
37 |
38 | JSONArray jsonArray = (JSONArray) response;
39 | List envList = new ArrayList<>();
40 | if (jsonArray.length() < 1) {
41 | return envList;
42 | }
43 | for (int i = 0; i < jsonArray.length(); i++) {
44 | JSONObject jo = jsonArray.getJSONObject(i);
45 | QLEnvData envData = new QLEnvData(jo.getInt("id"),
46 | jo.getString("name"),
47 | jo.getString("value"),
48 | jo.getString("remarks"));
49 | envList.add(envData);
50 | }
51 | return envList;
52 | }
53 |
54 | public void addEnv(QLEnvData envData, QLSettingsData settingsData, QLLoginData loginData) throws Exception {
55 | JSONArray arr = new JSONArray();
56 | arr.put(envData.toJson());
57 | this.doRequest(settingsData.getUrl(), "/open/envs", "POST", arr.toString(), loginData.toAuthValue());
58 | }
59 |
60 | public void updateEnv(QLEnvData envData, QLSettingsData settingsData, QLLoginData loginData) throws Exception {
61 | this.doRequest(settingsData.getUrl(), "/open/envs", "PUT", envData.toJsonString(), loginData.toAuthValue());
62 | }
63 |
64 | public void enableEnv(Integer id, QLSettingsData settingsData, QLLoginData loginData) throws Exception {
65 | this.doRequest(settingsData.getUrl(), "/open/envs/enable", "PUT", "[" + id + "]", loginData.toAuthValue());
66 | }
67 |
68 | private Object doRequest(String url, String uri, String method, String content, String authStr) throws Exception {
69 | RequestBody body = null;
70 | if (content != null) {
71 | MediaType mediaType = MediaType.parse("application/json; charset=utf-8");
72 | body = RequestBody.create(mediaType, content);
73 | }
74 |
75 | Request.Builder builder = new Request.Builder();
76 | if (authStr != null) {
77 | builder.addHeader("Authorization", authStr);
78 | }
79 | Request request = builder
80 | .url(url + uri)
81 | .method(method, body)
82 | .build();
83 |
84 | Response response = client.newCall(request).execute();
85 |
86 | String rsBody = response.body().string();
87 | JSONObject rs = new JSONObject(rsBody);
88 |
89 | if (!response.isSuccessful()) {
90 |
91 | throw new IllegalStateException(uri + " " + rs.getString("message"));
92 | }
93 |
94 |
95 | if (rs.getInt("code") != 200) {
96 | String message = rs.getString("message");
97 | throw new IllegalStateException(message);
98 | }
99 | if (rs.has("data")) {
100 | return rs.get("data");
101 | }
102 | return null;
103 |
104 |
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------