Skip to content

Commit 75d630e

Browse files
@initial 7.0.0-preview.502.1 Add beta frame-anno comp adapt support (tc-captcha, auto-params-injection)
1 parent e980705 commit 75d630e

5 files changed

Lines changed: 71 additions & 18 deletions

File tree

pom.xml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<dependency>
5151
<groupId>org.springframework.boot</groupId>
5252
<artifactId>spring-boot-starter-mail</artifactId>
53-
<version>2.6.4</version>
53+
<version>2.6.7</version>
5454
</dependency>
5555
<!-- <dependency>-->
5656
<!-- <groupId>org.springframework.boot</groupId>-->
@@ -71,12 +71,12 @@
7171
<dependency>
7272
<groupId>org.springframework.boot</groupId>
7373
<artifactId>spring-boot-starter-web</artifactId>
74-
<version>2.6.4</version>
74+
<version>2.6.7</version>
7575
</dependency>
7676
<dependency>
7777
<groupId>org.springframework.boot</groupId>
7878
<artifactId>spring-boot-starter-websocket</artifactId>
79-
<version>2.6.4</version>
79+
<version>2.6.7</version>
8080
</dependency>
8181
<!-- <dependency>-->
8282
<!-- <groupId>org.mybatis.spring.boot</groupId>-->
@@ -100,7 +100,7 @@
100100
<dependency>
101101
<groupId>org.springframework.boot</groupId>
102102
<artifactId>spring-boot-devtools</artifactId>
103-
<version>2.6.4</version>
103+
<version>2.6.7</version>
104104
<scope>runtime</scope>
105105
<optional>true</optional>
106106
</dependency>
@@ -113,18 +113,19 @@
113113
<dependency>
114114
<groupId>org.springframework.boot</groupId>
115115
<artifactId>spring-boot-configuration-processor</artifactId>
116-
<version>2.6.4</version>
116+
<version>2.6.7</version>
117117
<optional>true</optional>
118118
</dependency>
119119
<dependency>
120120
<groupId>org.projectlombok</groupId>
121121
<artifactId>lombok</artifactId>
122+
<version>1.18.24</version>
122123
<optional>true</optional>
123124
</dependency>
124125
<dependency>
125126
<groupId>org.springframework.boot</groupId>
126127
<artifactId>spring-boot-starter-test</artifactId>
127-
<version>2.6.4</version>
128+
<version>2.6.7</version>
128129
<scope>test</scope>
129130
</dependency>
130131
<!-- <dependency>-->
@@ -172,7 +173,7 @@
172173
<dependency>
173174
<groupId>com.google.guava</groupId>
174175
<artifactId>guava</artifactId>
175-
<version>31.0.1-jre</version>
176+
<version>31.1-jre</version>
176177
</dependency>
177178
<dependency>
178179
<groupId>net.minecrell</groupId>
@@ -211,7 +212,7 @@
211212
<dependency>
212213
<groupId>com.freewayso</groupId>
213214
<artifactId>image-combiner</artifactId>
214-
<version>2.3.2</version>
215+
<version>2.3.3</version>
215216
</dependency>
216217
<!-- <dependency>-->
217218
<!-- <groupId>com.alibaba</groupId>-->
@@ -228,18 +229,24 @@
228229
<dependency>
229230
<groupId>com.alibaba</groupId>
230231
<artifactId>druid</artifactId>
231-
<version>1.2.8</version>
232+
<version>1.2.9</version>
232233
</dependency>
233234
<dependency>
234235
<groupId>org.jetbrains</groupId>
235236
<artifactId>annotations</artifactId>
236-
<version>13.0</version>
237+
<version>23.0.0</version>
237238
</dependency>
238239
<dependency>
239240
<groupId>org.apache.commons</groupId>
240241
<artifactId>commons-lang3</artifactId>
241242
<version>3.12.0</version>
242243
</dependency>
244+
<!-- maven 导入 -->
245+
<dependency>
246+
<groupId>cloud.tianai.captcha</groupId>
247+
<artifactId>tianai-captcha</artifactId>
248+
<version>1.3.0.RELEASE</version>
249+
</dependency>
243250
</dependencies>
244251

245252
<dependencyManagement>

src/main/java/com/talexframe/frame/core/modules/application/TApp.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ public TApp(String provider) {
2828

2929
this.repo = this.getRepo();
3030

31-
if ( this.repo == null ) {
31+
// 不强制要求 Repository
3232

33-
throw new RuntimeException("无法找到 Repo");
33+
// if ( this.repo == null ) {
3434

35-
}
35+
// throw new RuntimeException("无法找到 Repo");
36+
37+
// }
3638

3739
}
3840

src/main/java/com/talexframe/frame/core/modules/network/connection/RequestAnalyser.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ private void process() {
104104

105105
List<Object> params = new ArrayList<>();
106106

107-
params.add(wr);
108-
109107
String str = wr.getRequest().getBody();
110108
JSONObject json = null;
111109

@@ -129,6 +127,12 @@ private void process() {
129127

130128
for ( RequestReceiver.RequestMethodReceiver.RequestParameterReceiver paramReceiver : methodReceiver.getParamReceivers() ) {
131129

130+
if( paramReceiver.parameter.getType().equals(WrappedResponse.class) ) {
131+
132+
params.add(wr);
133+
134+
}
135+
132136
if ( !paramReceiver.processUrlParam(url, params) ) {
133137
return;
134138
}
@@ -235,15 +239,15 @@ private void process() {
235239

236240
response.setStatus(200);
237241

238-
String str = JSONUtil.toJsonStr(object);
242+
String tStr = JSONUtil.toJsonStr(object);
239243

240244
response.setContentType("application/json");
241245

242246
os.write(str.getBytes(StandardCharsets.UTF_8));
243247

244248
os.flush();
245249

246-
log.info("[应用层] OK Return: " + str);
250+
log.info("[应用层] OK Return: " + tStr);
247251

248252
methodReceiver.processRedisCache(json, params, object);
249253

src/main/java/com/talexframe/frame/core/modules/plugins/adapt/PluginCompAdapter.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
package com.talexframe.frame.core.modules.plugins.adapt;
22

3+
import com.google.common.annotations.Beta;
34
import com.talexframe.frame.core.modules.plugins.addon.PluginScanner;
45
import com.talexframe.frame.core.modules.plugins.core.WebPlugin;
56
import com.talexframe.frame.core.pojo.FrameBuilder;
7+
import com.talexframe.frame.core.talex.FrameAnno;
68
import com.talexframe.frame.core.talex.FrameCreator;
79
import com.talexframe.frame.core.talex.TFrame;
810
import lombok.SneakyThrows;
911

12+
import java.lang.annotation.Annotation;
1013
import java.lang.reflect.ParameterizedType;
1114

1215
/**
@@ -34,14 +37,35 @@ public int getPriority() {
3437

3538
}
3639

40+
private FrameAnno anno = null;
41+
42+
@Beta
43+
public void setAnno(FrameAnno anno) {
44+
45+
this.anno = anno;
46+
47+
}
48+
3749
/**
3850
*
3951
* For true for access, for false for deny
4052
*
4153
*/
4254
public boolean shouldAccess(Class<? extends FrameCreator> clazz) {
4355

44-
return templateClass.isAssignableFrom(clazz);
56+
boolean res = templateClass.isAssignableFrom(clazz);
57+
58+
if( res ) return true;
59+
60+
if( anno != null ) {
61+
62+
Annotation thisAnno = clazz.getAnnotation( anno.getClass() );
63+
64+
return thisAnno != null;
65+
66+
}
67+
68+
return false;
4569

4670
}
4771

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.talexframe.frame.core.talex;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* {@link com.talexframe.frame.core.talex Package }
10+
*
11+
* @author TalexDreamSoul 22/05/02 下午 01:12 Project: TalexFrame
12+
*/
13+
@Retention( RetentionPolicy.RUNTIME )
14+
@Target( { ElementType.METHOD, ElementType.TYPE, ElementType.ANNOTATION_TYPE, ElementType.TYPE_PARAMETER, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.PACKAGE, ElementType.PARAMETER, ElementType.TYPE_USE } )
15+
public @interface FrameAnno {
16+
}

0 commit comments

Comments
 (0)