aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java/com/juick/api
diff options
context:
space:
mode:
Diffstat (limited to 'juick-api/src/main/java/com/juick/api')
-rw-r--r--juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java2
-rw-r--r--juick-api/src/main/java/com/juick/api/controllers/Messages.java9
2 files changed, 10 insertions, 1 deletions
diff --git a/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java b/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java
index df091d51..828f8cbd 100644
--- a/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java
+++ b/juick-api/src/main/java/com/juick/api/configuration/ApiAppConfiguration.java
@@ -45,7 +45,7 @@ import java.util.Collections;
@EnableWebMvc
@EnableSwagger2
@PropertySource("classpath:juick.conf")
-@ComponentScan(basePackages = "com.juick.api")
+@ComponentScan(basePackages = "com.juick")
public class ApiAppConfiguration extends BaseWebConfiguration {
@Bean
public JuickServerComponent juickServerComponent() {
diff --git a/juick-api/src/main/java/com/juick/api/controllers/Messages.java b/juick-api/src/main/java/com/juick/api/controllers/Messages.java
index 322effa3..5f00ee68 100644
--- a/juick-api/src/main/java/com/juick/api/controllers/Messages.java
+++ b/juick-api/src/main/java/com/juick/api/controllers/Messages.java
@@ -178,6 +178,15 @@ public class Messages {
}
throw new HttpForbiddenException();
}
+ @ApiIgnore
+ @RequestMapping("/messages/top_candidates")
+ public List<Integer> topCandidates() {
+ User visitor = UserUtils.getCurrentUser();
+ if ((visitor.getUid() == 0) || !(visitor.getName().equals("juick"))) {
+ throw new HttpForbiddenException();
+ }
+ return messagesService.getPopularCandidates();
+ }
@ApiIgnore
@RequestMapping("/messages/set_popular")