mirror of
https://github.com/EarthMC/QuickShop-Reremake.git
synced 2026-11-25 01:49:49 -05:00
No-longer use Github API
Former-commit-id: fceac81c589f2c7d683bee76f3348850bd2c0299
This commit is contained in:
1 parent
25c4687d33
commit
4a1beb8260
2 files changed
+129
-129
No files matched your search
@@ -19,46 +19,46 @@
|
||||
|
||||
package org.maxgamer.quickshop.util.github;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.maxgamer.quickshop.nonquickshopstuff.com.sk89q.worldedit.util.net.HttpRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
public class GithubAPI {
|
||||
private final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
|
||||
|
||||
@Nullable
|
||||
public ReleaseJsonContainer.AssetsBean getLatestRelease() throws IOException {
|
||||
String json =
|
||||
HttpRequest.get(
|
||||
new URL(
|
||||
"https://api.github.com/repos/Ghost-chu/QuickShop-Reremake/releases/latest"))
|
||||
.execute()
|
||||
.returnContent()
|
||||
.asString("UTF-8");
|
||||
ReleaseJsonContainer result = gson.fromJson(json, ReleaseJsonContainer.class);
|
||||
for (ReleaseJsonContainer.AssetsBean asset : result.getAssets()) {
|
||||
if (asset.getName().contains("original-")) {
|
||||
continue;
|
||||
}
|
||||
if (asset.getName().contains("-javadoc")) {
|
||||
continue;
|
||||
}
|
||||
if (asset.getName().contains("-sources")) {
|
||||
continue;
|
||||
}
|
||||
if (asset.getName().contains("-shaded")) {
|
||||
continue;
|
||||
}
|
||||
if (asset.getName().contains("Document") || asset.getName().contains("document")) {
|
||||
continue;
|
||||
}
|
||||
return asset;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
//import com.google.gson.Gson;
|
||||
//import com.google.gson.GsonBuilder;
|
||||
//import org.jetbrains.annotations.Nullable;
|
||||
//import org.maxgamer.quickshop.nonquickshopstuff.com.sk89q.worldedit.util.net.HttpRequest;
|
||||
//
|
||||
//import java.io.IOException;
|
||||
//import java.net.URL;
|
||||
//
|
||||
//public class GithubAPI {
|
||||
// private final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
|
||||
//
|
||||
// @Nullable
|
||||
// public ReleaseJsonContainer.AssetsBean getLatestRelease() throws IOException {
|
||||
// String json =
|
||||
// HttpRequest.get(
|
||||
// new URL(
|
||||
// "https://api.github.com/repos/Ghost-chu/QuickShop-Reremake/releases/latest"))
|
||||
// .execute()
|
||||
// .returnContent()
|
||||
// .asString("UTF-8");
|
||||
// ReleaseJsonContainer result = gson.fromJson(json, ReleaseJsonContainer.class);
|
||||
// for (ReleaseJsonContainer.AssetsBean asset : result.getAssets()) {
|
||||
// if (asset.getName().contains("original-")) {
|
||||
// continue;
|
||||
// }
|
||||
// if (asset.getName().contains("-javadoc")) {
|
||||
// continue;
|
||||
// }
|
||||
// if (asset.getName().contains("-sources")) {
|
||||
// continue;
|
||||
// }
|
||||
// if (asset.getName().contains("-shaded")) {
|
||||
// continue;
|
||||
// }
|
||||
// if (asset.getName().contains("Document") || asset.getName().contains("document")) {
|
||||
// continue;
|
||||
// }
|
||||
// return asset;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -18,89 +18,89 @@
|
||||
*/
|
||||
|
||||
package org.maxgamer.quickshop.util.github;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ReleaseJsonContainer {
|
||||
/**
|
||||
* url : https://api.github.com/repos/octocat/Hello-World/releases/1 html_url :
|
||||
* https://github.com/octocat/Hello-World/releases/v1.0.0 assets_url :
|
||||
* https://api.github.com/repos/octocat/Hello-World/releases/1/assets upload_url :
|
||||
* https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label} tarball_url
|
||||
* : https://api.github.com/repos/octocat/Hello-World/tarball/v1.0.0 zipball_url :
|
||||
* https://api.github.com/repos/octocat/Hello-World/zipball/v1.0.0 id : 1 node_id :
|
||||
* MDc6UmVsZWFzZTE= tag_name : v1.0.0 target_commitish : master name : v1.0.0 body : Description
|
||||
* of the release draft : false prerelease : false created_at : 2013-02-27T19:35:32Z published_at
|
||||
* : 2013-02-27T19:35:32Z author :
|
||||
* {"login":"octocat","id":1,"node_id":"MDQ6VXNlcjE=","avatar_url":"https://github.com/images/error/octocat_happy.gif","gravatar_id":"","url":"https://api.github.com/users/octocat","html_url":"https://github.com/octocat","followers_url":"https://api.github.com/users/octocat/followers","following_url":"https://api.github.com/users/octocat/following{/other_user}","gists_url":"https://api.github.com/users/octocat/gists{/gist_id}","starred_url":"https://api.github.com/users/octocat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/octocat/subscriptions","organizations_url":"https://api.github.com/users/octocat/orgs","repos_url":"https://api.github.com/users/octocat/repos","events_url":"https://api.github.com/users/octocat/events{/privacy}","received_events_url":"https://api.github.com/users/octocat/received_events","type":"User","site_admin":false}
|
||||
* assets :
|
||||
* [{"url":"https://api.github.com/repos/octocat/Hello-World/releases/assets/1","browser_download_url":"https://github.com/octocat/Hello-World/releases/download/v1.0.0/example.zip","id":1,"node_id":"MDEyOlJlbGVhc2VBc3NldDE=","name":"example.zip","label":"short
|
||||
* description","state":"uploaded","content_type":"application/zip","size":1024,"download_count":42,"created_at":"2013-02-27T19:35:32Z","updated_at":"2013-02-27T19:35:32Z","uploader":{"login":"octocat","id":1,"node_id":"MDQ6VXNlcjE=","avatar_url":"https://github.com/images/error/octocat_happy.gif","gravatar_id":"","url":"https://api.github.com/users/octocat","html_url":"https://github.com/octocat","followers_url":"https://api.github.com/users/octocat/followers","following_url":"https://api.github.com/users/octocat/following{/other_user}","gists_url":"https://api.github.com/users/octocat/gists{/gist_id}","starred_url":"https://api.github.com/users/octocat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/octocat/subscriptions","organizations_url":"https://api.github.com/users/octocat/orgs","repos_url":"https://api.github.com/users/octocat/repos","events_url":"https://api.github.com/users/octocat/events{/privacy}","received_events_url":"https://api.github.com/users/octocat/received_events","type":"User","site_admin":false}}]
|
||||
*/
|
||||
private int id;
|
||||
|
||||
private String name;
|
||||
|
||||
private List<AssetsBean> assets;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<AssetsBean> getAssets() {
|
||||
return assets;
|
||||
}
|
||||
|
||||
public static class AssetsBean {
|
||||
/**
|
||||
* url : https://api.github.com/repos/octocat/Hello-World/releases/assets/1 browser_download_url
|
||||
* : https://github.com/octocat/Hello-World/releases/download/v1.0.0/example.zip id : 1 node_id
|
||||
* : MDEyOlJlbGVhc2VBc3NldDE= name : example.zip label : short description state : uploaded
|
||||
* content_type : application/zip size : 1024 download_count : 42 created_at :
|
||||
* 2013-02-27T19:35:32Z updated_at : 2013-02-27T19:35:32Z uploader :
|
||||
* {"login":"octocat","id":1,"node_id":"MDQ6VXNlcjE=","avatar_url":"https://github.com/images/error/octocat_happy.gif","gravatar_id":"","url":"https://api.github.com/users/octocat","html_url":"https://github.com/octocat","followers_url":"https://api.github.com/users/octocat/followers","following_url":"https://api.github.com/users/octocat/following{/other_user}","gists_url":"https://api.github.com/users/octocat/gists{/gist_id}","starred_url":"https://api.github.com/users/octocat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/octocat/subscriptions","organizations_url":"https://api.github.com/users/octocat/orgs","repos_url":"https://api.github.com/users/octocat/repos","events_url":"https://api.github.com/users/octocat/events{/privacy}","received_events_url":"https://api.github.com/users/octocat/received_events","type":"User","site_admin":false}
|
||||
*/
|
||||
private String browser_download_url;
|
||||
|
||||
private String name;
|
||||
|
||||
private int size;
|
||||
|
||||
public AssetsBean() {
|
||||
}
|
||||
|
||||
public String getBrowser_download_url() {
|
||||
return browser_download_url;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(int size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//public class ReleaseJsonContainer {
|
||||
// /**
|
||||
// * url : https://api.github.com/repos/octocat/Hello-World/releases/1 html_url :
|
||||
// * https://github.com/octocat/Hello-World/releases/v1.0.0 assets_url :
|
||||
// * https://api.github.com/repos/octocat/Hello-World/releases/1/assets upload_url :
|
||||
// * https://uploads.github.com/repos/octocat/Hello-World/releases/1/assets{?name,label} tarball_url
|
||||
// * : https://api.github.com/repos/octocat/Hello-World/tarball/v1.0.0 zipball_url :
|
||||
// * https://api.github.com/repos/octocat/Hello-World/zipball/v1.0.0 id : 1 node_id :
|
||||
// * MDc6UmVsZWFzZTE= tag_name : v1.0.0 target_commitish : master name : v1.0.0 body : Description
|
||||
// * of the release draft : false prerelease : false created_at : 2013-02-27T19:35:32Z published_at
|
||||
// * : 2013-02-27T19:35:32Z author :
|
||||
// * {"login":"octocat","id":1,"node_id":"MDQ6VXNlcjE=","avatar_url":"https://github.com/images/error/octocat_happy.gif","gravatar_id":"","url":"https://api.github.com/users/octocat","html_url":"https://github.com/octocat","followers_url":"https://api.github.com/users/octocat/followers","following_url":"https://api.github.com/users/octocat/following{/other_user}","gists_url":"https://api.github.com/users/octocat/gists{/gist_id}","starred_url":"https://api.github.com/users/octocat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/octocat/subscriptions","organizations_url":"https://api.github.com/users/octocat/orgs","repos_url":"https://api.github.com/users/octocat/repos","events_url":"https://api.github.com/users/octocat/events{/privacy}","received_events_url":"https://api.github.com/users/octocat/received_events","type":"User","site_admin":false}
|
||||
// * assets :
|
||||
// * [{"url":"https://api.github.com/repos/octocat/Hello-World/releases/assets/1","browser_download_url":"https://github.com/octocat/Hello-World/releases/download/v1.0.0/example.zip","id":1,"node_id":"MDEyOlJlbGVhc2VBc3NldDE=","name":"example.zip","label":"short
|
||||
// * description","state":"uploaded","content_type":"application/zip","size":1024,"download_count":42,"created_at":"2013-02-27T19:35:32Z","updated_at":"2013-02-27T19:35:32Z","uploader":{"login":"octocat","id":1,"node_id":"MDQ6VXNlcjE=","avatar_url":"https://github.com/images/error/octocat_happy.gif","gravatar_id":"","url":"https://api.github.com/users/octocat","html_url":"https://github.com/octocat","followers_url":"https://api.github.com/users/octocat/followers","following_url":"https://api.github.com/users/octocat/following{/other_user}","gists_url":"https://api.github.com/users/octocat/gists{/gist_id}","starred_url":"https://api.github.com/users/octocat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/octocat/subscriptions","organizations_url":"https://api.github.com/users/octocat/orgs","repos_url":"https://api.github.com/users/octocat/repos","events_url":"https://api.github.com/users/octocat/events{/privacy}","received_events_url":"https://api.github.com/users/octocat/received_events","type":"User","site_admin":false}}]
|
||||
// */
|
||||
// private int id;
|
||||
//
|
||||
// private String name;
|
||||
//
|
||||
// private List<AssetsBean> assets;
|
||||
//
|
||||
// public int getId() {
|
||||
// return id;
|
||||
// }
|
||||
//
|
||||
// public void setId(int id) {
|
||||
// this.id = id;
|
||||
// }
|
||||
//
|
||||
// public String getName() {
|
||||
// return name;
|
||||
// }
|
||||
//
|
||||
// public void setName(String name) {
|
||||
// this.name = name;
|
||||
// }
|
||||
//
|
||||
// public List<AssetsBean> getAssets() {
|
||||
// return assets;
|
||||
// }
|
||||
//
|
||||
// public static class AssetsBean {
|
||||
// /**
|
||||
// * url : https://api.github.com/repos/octocat/Hello-World/releases/assets/1 browser_download_url
|
||||
// * : https://github.com/octocat/Hello-World/releases/download/v1.0.0/example.zip id : 1 node_id
|
||||
// * : MDEyOlJlbGVhc2VBc3NldDE= name : example.zip label : short description state : uploaded
|
||||
// * content_type : application/zip size : 1024 download_count : 42 created_at :
|
||||
// * 2013-02-27T19:35:32Z updated_at : 2013-02-27T19:35:32Z uploader :
|
||||
// * {"login":"octocat","id":1,"node_id":"MDQ6VXNlcjE=","avatar_url":"https://github.com/images/error/octocat_happy.gif","gravatar_id":"","url":"https://api.github.com/users/octocat","html_url":"https://github.com/octocat","followers_url":"https://api.github.com/users/octocat/followers","following_url":"https://api.github.com/users/octocat/following{/other_user}","gists_url":"https://api.github.com/users/octocat/gists{/gist_id}","starred_url":"https://api.github.com/users/octocat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/octocat/subscriptions","organizations_url":"https://api.github.com/users/octocat/orgs","repos_url":"https://api.github.com/users/octocat/repos","events_url":"https://api.github.com/users/octocat/events{/privacy}","received_events_url":"https://api.github.com/users/octocat/received_events","type":"User","site_admin":false}
|
||||
// */
|
||||
// private String browser_download_url;
|
||||
//
|
||||
// private String name;
|
||||
//
|
||||
// private int size;
|
||||
//
|
||||
// public AssetsBean() {
|
||||
// }
|
||||
//
|
||||
// public String getBrowser_download_url() {
|
||||
// return browser_download_url;
|
||||
// }
|
||||
//
|
||||
// public String getName() {
|
||||
// return name;
|
||||
// }
|
||||
//
|
||||
// public void setName(String name) {
|
||||
// this.name = name;
|
||||
// }
|
||||
//
|
||||
// public int getSize() {
|
||||
// return size;
|
||||
// }
|
||||
//
|
||||
// public void setSize(int size) {
|
||||
// this.size = size;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
||||
Reference in new issue
Block a user