新增(移动)一些应该放在“管理”形成列表管理,而非放在“设置”形成单一配置的内容

This commit is contained in:
2025-07-03 15:58:27 +08:00
parent 04cf470ead
commit 148583cdaa
52 changed files with 2433 additions and 362 deletions

View File

@@ -1,69 +0,0 @@
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Base64;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import quant.rich.emoney.util.VersionComparator;
public class WeibaPlayground {
private static final short[] XCUtil_short = new short[]{2176, 1289, 2869, 2868, 2854, 2893, 2904, 2219, 2231, 2231, 2227, 2297, 2284, 2284, 2228, 2214, 2218, 2209, 2210, 2285, 2215, 2230, 2220, 2216, 2210, 2218, 2234, 2210, 2285, 2208, 2220, 2222, 2284, 2221, 2214, 2228, 2227, 2219, 2220, 2221, 2214, 2285, 2227, 2219, 2227, 2300, 2218, 2215, 2302, 1330, 1378, 1393, 1382, 1321, 1971, 2022, 2044, 2034, 2043, 1960};
public static void main(String[] args) throws IOException {
System.out.println(
((Object)"ۤۢۢ").hashCode()
);
System.out.println(decodeShort(XCUtil_short, 1, 1, 1397));
// (1745665457, MTc0NTY2NTQ1N3xkZjJkOThjYw==)
// FM%5C%29GMR%2BGMJ*G%2CqdScCdHMacRp%3D%3D
Path path = Path.of("E:\\eclipse-workspace\\emoney-auto\\conf\\system\\emoneyRequest.androidChromeVersions.json");
String str = Files.readString(path);
ObjectMapper mapper = new ObjectMapper();
ArrayNode node = (ArrayNode) mapper.readTree(str);
List<String> ver = mapper.convertValue(node, new TypeReference<List<String>>() {});
ver.sort(VersionComparator.INSTANCE.reversed());
Set<String> verSet = new LinkedHashSet<>(ver);
ver = List.copyOf(verSet);
ArrayNode ja = mapper.valueToTree(verSet);
Files.writeString(path, ja.toPrettyString());
//System.out.println(ccc("1745665457", "MTc0NTY2NTQ1N3xkZjJkOThjYw=="));
}
public static String decodeShort(short[] sArr, int i, int i2, int i3) {
char[] cArr = new char[i2];
for (int i4 = 0; i4 < i2; i4++) {
cArr[i4] = (char) (sArr[i + i4] ^ i3);
}
return new String(cArr);
}
public static String ccc(String var0, String var1) throws UnsupportedEncodingException {
String decoded = new String(Base64.getDecoder().decode(var1)).trim();
StringBuilder sb = new StringBuilder();
// 获取时间戳最后一位作为减法因子(如 1745660488 → 8
int offset = var0.charAt(9) - '0'; // var0 是时间戳
for (char ch : decoded.toCharArray()) {
if (ch == '=') continue;
sb.append((char)(ch - offset));
}
return URLEncoder.encode(sb.toString(), "UTF-8");
}
}

View File

@@ -233,7 +233,7 @@ public class EmoneyIndexScraper {
try {
Files.writeString(
Path.of("./conf/extra/nonParamsIndexDetail." + detail.getNameCode() + ".json"),
Path.of("./resources/conf/extra/nonParamsIndexDetail." + detail.getNameCode() + ".json"),
MAPPER.valueToTree(detail).toPrettyString());
} catch (IllegalArgumentException | IOException e) {
// TODO Auto-generated catch block

View File

@@ -4,8 +4,10 @@ import quant.rich.emoney.EmoneyAutoApplication;
import quant.rich.emoney.client.EmoneyClient;
import quant.rich.emoney.client.WebviewClient;
import quant.rich.emoney.client.WebviewClient.WebviewResponseWrapper;
import quant.rich.emoney.util.SmartResourceResolver;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map.Entry;
@@ -21,6 +23,8 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import io.micrometer.core.instrument.util.IOUtils;
@SpringBootTest
@ContextConfiguration(classes = EmoneyAutoApplication.class)
@RunWith(SpringJUnit4ClassRunner.class)
@@ -31,8 +35,8 @@ public class RelativeEmoneyScraper {
@Test
void test() throws Exception {
String js = Files.readString(Path.of("./conf/extra/indexJs.js"));
String js = IOUtils.toString(SmartResourceResolver.loadResource("./conf/extra/indexJs.js"), StandardCharsets.UTF_8);
String jsArrayText;
Matcher m = nonParamsIndexDetailPattern.matcher(js);

View File

@@ -0,0 +1,38 @@
package quant.rich;
import lombok.extern.slf4j.Slf4j;
import quant.rich.emoney.EmoneyAutoApplication;
import quant.rich.emoney.client.EmoneyClient;
import quant.rich.emoney.client.WebviewClient;
import quant.rich.emoney.client.WebviewClient.WebviewResponseWrapper;
import quant.rich.emoney.util.SmartResourceResolver;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@SpringBootTest
@ContextConfiguration(classes = EmoneyAutoApplication.class)
@RunWith(SpringJUnit4ClassRunner.class)
@Slf4j
public class SmartResourceLoaderTest {
@Test
void test() throws Exception {
SmartResourceResolver.loadResource("/conf/system/proxy.json");
}
}

View File

@@ -1,9 +1,8 @@
package quant.rich;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@@ -11,17 +10,32 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.graalvm.polyglot.*;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import io.micrometer.core.instrument.util.IOUtils;
import quant.rich.emoney.entity.config.SmartViewWriter;
import quant.rich.emoney.pojo.dto.IndexDetail;
import quant.rich.emoney.pojo.dto.NonParamsIndexDetail;
import quant.rich.emoney.util.SmartResourceResolver;
public class TestIndexJsMatch {
private static final ObjectMapper MAPPER = new ObjectMapper();
private static final SmartViewWriter writer = new SmartViewWriter();
static {
MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
public static void main(String[] args) throws IOException {
String script = Files.readString(Path.of("./conf/extra/indexJs.js"), StandardCharsets.UTF_8);
//String script = Files.readString(Path.of("./conf/extra/indexJs.js"), StandardCharsets.UTF_8);
String script = IOUtils.toString(SmartResourceResolver.loadResource("./conf/extra/indexJs.js"), StandardCharsets.UTF_8);
/** 一般来说如果要匹配,只会匹配出一个,但是为了保险起见还是做一个 List 来存储 */
@@ -30,6 +44,16 @@ public class TestIndexJsMatch {
System.out.println("✔ 匹配数组,共 " + array.size() + " 个对象");
for (JsonNode obj : array) {
System.out.println(obj.toPrettyString());
if (!obj.has("nameCode")) continue;
String nameCode = obj.get("nameCode").asText();
// 载入已有本地文件填充 original 字段
String path = "./conf/extra/indexDetail/nonParams/" + nameCode + ".json";
InputStream stream = SmartResourceResolver.loadResource(path);
NonParamsIndexDetail detail = MAPPER.readValue(stream, NonParamsIndexDetail.class);
detail.setOriginal(obj.toString());
String joString = MAPPER.writerWithView(IndexDetail.class).writeValueAsString(detail);
SmartResourceResolver.saveText(path, joString);
}
}
}