mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-09 09:47:50 +01:00
cleanup GitHub and Pastebin paste services
This commit is contained in:
parent
eb91eefc80
commit
d69c492577
@ -49,7 +49,9 @@ public class GithubPasteService implements PasteService {
|
|||||||
public URL getPostURL() {
|
public URL getPostURL() {
|
||||||
try {
|
try {
|
||||||
return new URL("https://api.github.com/gists");
|
return new URL("https://api.github.com/gists");
|
||||||
//return new URL("http://jsonplaceholder.typicode.com/posts");
|
|
||||||
|
// the following can be used for testing purposes
|
||||||
|
// return new URL("http://jsonplaceholder.typicode.com/posts");
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
return null; // should never hit here
|
return null; // should never hit here
|
||||||
}
|
}
|
||||||
@ -68,8 +70,6 @@ public class GithubPasteService implements PasteService {
|
|||||||
|
|
||||||
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||||
String line;
|
String line;
|
||||||
String pastieUrl = "";
|
|
||||||
//Pattern pastiePattern = this.getURLMatchingPattern();
|
|
||||||
StringBuilder responseString = new StringBuilder();
|
StringBuilder responseString = new StringBuilder();
|
||||||
|
|
||||||
while ((line = rd.readLine()) != null) {
|
while ((line = rd.readLine()) != null) {
|
||||||
|
@ -40,12 +40,11 @@ public class PastebinPasteService implements PasteService {
|
|||||||
@Override
|
@Override
|
||||||
public String encodeData(String data) {
|
public String encodeData(String data) {
|
||||||
try {
|
try {
|
||||||
String encData = URLEncoder.encode("api_dev_key", "UTF-8") + "=" + URLEncoder.encode("d61d68d31e8e0392b59b50b277411c71", "UTF-8");
|
return URLEncoder.encode("api_dev_key", "UTF-8") + "=" + URLEncoder.encode("d61d68d31e8e0392b59b50b277411c71", "UTF-8") +
|
||||||
encData += "&" + URLEncoder.encode("api_option", "UTF-8") + "=" + URLEncoder.encode("paste", "UTF-8");
|
"&" + URLEncoder.encode("api_option", "UTF-8") + "=" + URLEncoder.encode("paste", "UTF-8") +
|
||||||
encData += "&" + URLEncoder.encode("api_paste_code", "UTF-8") + "=" + URLEncoder.encode(data, "UTF-8");
|
"&" + URLEncoder.encode("api_paste_code", "UTF-8") + "=" + URLEncoder.encode(data, "UTF-8") +
|
||||||
encData += "&" + URLEncoder.encode("api_paste_private", "UTF-8") + "=" + URLEncoder.encode(this.isPrivate ? "1" : "0", "UTF-8");
|
"&" + URLEncoder.encode("api_paste_private", "UTF-8") + "=" + URLEncoder.encode(this.isPrivate ? "1" : "0", "UTF-8") +
|
||||||
encData += "&" + URLEncoder.encode("api_paste_format", "UTF-8") + "=" + URLEncoder.encode("yaml", "UTF-8");
|
"&" + URLEncoder.encode("api_paste_format", "UTF-8") + "=" + URLEncoder.encode("yaml", "UTF-8");
|
||||||
return encData;
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
return ""; // should never hit here
|
return ""; // should never hit here
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user