feat: support idea 2026.1
This commit is contained in:
@@ -1,2 +1,5 @@
|
||||
[SmartInput]
|
||||
EQUAL,O00oOOO0
|
||||
|
||||
[XcodeMap]
|
||||
EQUAL,com/adapgpt/xcodemapidea/b/a:checkActivation
|
||||
|
||||
2
pom.xml
2
pom.xml
@@ -63,7 +63,7 @@
|
||||
<dependency>
|
||||
<groupId>com.ja-netfilter</groupId>
|
||||
<artifactId>ja-netfilter</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<version>2025.3.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -7,19 +7,21 @@ import com.janetfilter.core.plugin.PluginConfig;
|
||||
import com.janetfilter.core.plugin.PluginEntry;
|
||||
import com.yelochick.coolrequest.VipApiTransformer;
|
||||
import com.yelochick.smartinput.OsLanguageManagerProxyTransformer;
|
||||
import com.yelochick.xcodemap.XcodeMapTransformer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ActivationPlugin implements PluginEntry {
|
||||
|
||||
private List<FilterRule> smartInputRules;
|
||||
private List<FilterRule> xcodeMapRules;
|
||||
|
||||
@Override
|
||||
public void init(Environment environment, PluginConfig config) {
|
||||
smartInputRules = Collections.unmodifiableList(config.getBySection("SmartInput"));
|
||||
xcodeMapRules = Collections.unmodifiableList(config.getBySection("XcodeMap"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -39,6 +41,10 @@ public class ActivationPlugin implements PluginEntry {
|
||||
for (FilterRule rule : smartInputRules) {
|
||||
transformers.add(new OsLanguageManagerProxyTransformer(rule.getRule()));
|
||||
}
|
||||
for (FilterRule rule : xcodeMapRules) {
|
||||
String[] split = rule.getRule().split(":");
|
||||
transformers.add(new XcodeMapTransformer(split[0], split[1]));
|
||||
}
|
||||
return transformers;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
package com.yelochick;
|
||||
|
||||
|
||||
import jdk.internal.org.objectweb.asm.ClassReader;
|
||||
import jdk.internal.org.objectweb.asm.ClassWriter;
|
||||
import jdk.internal.org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
@@ -2,11 +2,11 @@ package com.yelochick.coolrequest;
|
||||
|
||||
import com.janetfilter.core.plugin.MyTransformer;
|
||||
import com.yelochick.SafeClassWriter;
|
||||
import jdk.internal.org.objectweb.asm.ClassReader;
|
||||
import jdk.internal.org.objectweb.asm.ClassWriter;
|
||||
import jdk.internal.org.objectweb.asm.tree.*;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.*;
|
||||
|
||||
import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
import static org.objectweb.asm.Opcodes.*;
|
||||
|
||||
/**
|
||||
* @author yelochick
|
||||
|
||||
@@ -3,11 +3,11 @@ package com.yelochick.smartinput;
|
||||
import com.janetfilter.core.commons.DebugInfo;
|
||||
import com.janetfilter.core.plugin.MyTransformer;
|
||||
import com.yelochick.SafeClassWriter;
|
||||
import jdk.internal.org.objectweb.asm.ClassReader;
|
||||
import jdk.internal.org.objectweb.asm.ClassWriter;
|
||||
import jdk.internal.org.objectweb.asm.tree.*;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.*;
|
||||
|
||||
import static jdk.internal.org.objectweb.asm.Opcodes.*;
|
||||
import static org.objectweb.asm.Opcodes.*;
|
||||
|
||||
/**
|
||||
* @author yelochick
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.yelochick.xcodemap;
|
||||
|
||||
import com.janetfilter.core.plugin.MyTransformer;
|
||||
import com.yelochick.SafeClassWriter;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.tree.*;
|
||||
|
||||
import static org.objectweb.asm.Opcodes.*;
|
||||
|
||||
/**
|
||||
* @author yelochick
|
||||
*/
|
||||
public class XcodeMapTransformer implements MyTransformer {
|
||||
|
||||
private final String hookClassName;
|
||||
private final String hookMethodName;
|
||||
|
||||
public XcodeMapTransformer(String hookClassName, String hookMethodName) {
|
||||
this.hookClassName = hookClassName;
|
||||
this.hookMethodName = hookMethodName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getHookClassName() {
|
||||
return hookClassName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] transform(String className, byte[] classBytes, int order) throws Exception {
|
||||
ClassReader reader = new ClassReader(classBytes);
|
||||
ClassNode node = new ClassNode(ASM5);
|
||||
reader.accept(node, 0);
|
||||
|
||||
for (MethodNode m : node.methods) {
|
||||
if (hookMethodName.equals(m.name)) {
|
||||
m.instructions.clear();
|
||||
m.tryCatchBlocks.clear();
|
||||
InsnList list = new InsnList();
|
||||
// 返回-4
|
||||
list.add(new IntInsnNode(BIPUSH, -4));
|
||||
list.add(new InsnNode(IRETURN));
|
||||
m.instructions.insert(list);
|
||||
}
|
||||
}
|
||||
|
||||
SafeClassWriter writer = new SafeClassWriter(null, null, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
|
||||
node.accept(writer);
|
||||
return writer.toByteArray();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user