Skip to content

Commit

Permalink
Explicitly instruct Spring to allow any origin for API points expecte…
Browse files Browse the repository at this point in the history
…d to be used by vscode. Fixes #306
  • Loading branch information
dustydecapod committed Aug 21, 2021
1 parent 6674bf4 commit d578362
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions server/src/main/java/org/eclipse/openvsx/RegistryAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected Iterable<IExtensionRegistry> getRegistries() {
path = "/api/{namespace}",
produces = MediaType.APPLICATION_JSON_VALUE
)
@CrossOrigin
@CrossOrigin(origins = "*")
@ApiOperation("Provides metadata of a namespace")
@ApiResponses({
@ApiResponse(
Expand Down Expand Up @@ -112,7 +112,7 @@ public ResponseEntity<NamespaceJson> getNamespace(
path = "/api/{namespace}/{extension}",
produces = MediaType.APPLICATION_JSON_VALUE
)
@CrossOrigin
@CrossOrigin(origins = "*")
@ApiOperation("Provides metadata of the latest version of an extension")
@ApiResponses({
@ApiResponse(
Expand Down Expand Up @@ -147,7 +147,7 @@ public ResponseEntity<ExtensionJson> getExtension(
path = "/api/{namespace}/{extension}/{version}",
produces = MediaType.APPLICATION_JSON_VALUE
)
@CrossOrigin
@CrossOrigin(origins = "*")
@ApiOperation("Provides metadata of a specific version of an extension")
@ApiResponses({
@ApiResponse(
Expand Down Expand Up @@ -181,7 +181,7 @@ public ResponseEntity<ExtensionJson> getExtension(
}

@GetMapping("/api/{namespace}/{extension}/{version}/file/{fileName:.+}")
@CrossOrigin
@CrossOrigin(origins = "*")
@ApiOperation("Access a file packaged by an extension")
@ApiResponses({
@ApiResponse(
Expand Down Expand Up @@ -226,7 +226,7 @@ public ResponseEntity<byte[]> getFile(
path = "/api/{namespace}/{extension}/reviews",
produces = MediaType.APPLICATION_JSON_VALUE
)
@CrossOrigin
@CrossOrigin(origins = "*")
@ApiOperation("Returns the list of reviews of an extension")
@ApiResponses({
@ApiResponse(
Expand Down Expand Up @@ -260,7 +260,7 @@ public ResponseEntity<ReviewListJson> getReviews(
path = "/api/-/search",
produces = MediaType.APPLICATION_JSON_VALUE
)
@CrossOrigin
@CrossOrigin(origins = "*")
@ApiOperation("Search extensions via text entered by a user")
@ApiResponses({
@ApiResponse(
Expand Down Expand Up @@ -348,7 +348,7 @@ private int mergeSearchResults(SearchResultJson result, List<SearchEntryJson> en
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
@CrossOrigin
@CrossOrigin(origins = "*")
@ApiOperation("Provides metadata of extensions matching the given parameters")
@ApiResponses({
@ApiResponse(
Expand Down Expand Up @@ -528,4 +528,4 @@ public ResponseEntity<ResultJson> deleteReview(@PathVariable String namespace,
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public class VSCodeAdapter {
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
@CrossOrigin
@CrossOrigin(origins = "*")
public ExtensionQueryResult extensionQuery(@RequestBody ExtensionQueryParam param) {
String queryString = null;
String category = null;
Expand Down Expand Up @@ -222,7 +222,7 @@ private String getSortOrder(int sortOrder) {
}

@GetMapping("/vscode/asset/{namespace}/{extensionName}/{version}/{assetType}/**")
@CrossOrigin
@CrossOrigin(origins = "*")
public ResponseEntity<byte[]> getAsset(HttpServletRequest request,
@PathVariable String namespace,
@PathVariable String extensionName,
Expand Down Expand Up @@ -412,4 +412,4 @@ private boolean test(int flags, int flag) {
return (flags & flag) != 0;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ public void addViewControllers(ViewControllerRegistry registry) {
}
}

}
}

0 comments on commit d578362

Please sign in to comment.