fix: sponsor mess code
This commit is contained in:
@@ -110,8 +110,7 @@ public class SponsorPage extends StackPane {
|
|||||||
|
|
||||||
private void loadSponsorList() {
|
private void loadSponsorList() {
|
||||||
Task.<List<Sponsor>>supplyAsync(() -> HttpRequest.GET("https://hmcl.huangyuhui.net/api/sponsor").getJson(new TypeToken<List<Sponsor>>() {
|
Task.<List<Sponsor>>supplyAsync(() -> HttpRequest.GET("https://hmcl.huangyuhui.net/api/sponsor").getJson(new TypeToken<List<Sponsor>>() {
|
||||||
}.getType())
|
}.getType())).thenAcceptAsync(Schedulers.javafx(), sponsors -> {
|
||||||
).thenAcceptAsync(Schedulers.javafx(), sponsors -> {
|
|
||||||
listView.getItems().setAll(sponsors);
|
listView.getItems().setAll(sponsors);
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import java.lang.reflect.Type;
|
|||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -97,7 +98,7 @@ public abstract class HttpRequest {
|
|||||||
public String getString() throws IOException {
|
public String getString() throws IOException {
|
||||||
HttpURLConnection con = createConnection();
|
HttpURLConnection con = createConnection();
|
||||||
con = resolveConnection(con);
|
con = resolveConnection(con);
|
||||||
return IOUtils.readFullyAsString(con.getInputStream());
|
return IOUtils.readFullyAsString(con.getInputStream(), StandardCharsets.UTF_8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user